├── Brake.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── Brake.xccheckout │ └── xcuserdata │ │ └── Ninja.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── Ninja.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── Brake.xcscheme │ └── xcschememanagement.plist ├── Brake ├── Angry.jpg ├── AppDelegate.h ├── AppDelegate.m ├── AppDoc.h ├── AppDoc.m ├── AppManager.h ├── AppManager.m ├── AppModel.h ├── AppModel.m ├── Base.lproj │ └── MainMenu.xib ├── Brake-Info.plist ├── Brake-Prefix.pch ├── DFSSHWrapper │ ├── headers │ │ ├── DFSSHConnectionType.h │ │ ├── DFSSHConnector.h │ │ ├── DFSSHOperator.h │ │ └── DFSSHServer.h │ └── source │ │ ├── DFSSHConnectionType.m │ │ ├── DFSSHConnector.m │ │ ├── DFSSHOperator.m │ │ └── DFSSHServer.m ├── DeviceManager.h ├── DeviceManager.m ├── GeneralPreferencesViewController.h ├── GeneralPreferencesViewController.m ├── GeneralPreferencesViewController.xib ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── MASPreferences │ ├── .gitignore │ ├── MASPreferencesViewController.h │ ├── MASPreferencesWindow.xib │ ├── MASPreferencesWindowController.h │ ├── MASPreferencesWindowController.m │ └── README.md ├── MasterViewController.h ├── MasterViewController.m ├── MasterViewController.xib ├── en.lproj │ ├── Credits.rtf │ └── InfoPlist.strings ├── include │ ├── channel.h │ ├── comp.h │ ├── crypto.h │ ├── libgcrypt.h │ ├── libssh2.h │ ├── libssh2_config.h │ ├── libssh2_priv.h │ ├── libssh2_publickey.h │ ├── libssh2_sftp.h │ ├── mac.h │ ├── misc.h │ ├── openssl.h │ ├── packet.h │ ├── session.h │ ├── sftp.h │ ├── transport.h │ └── userauth.h ├── lib │ └── libssh2.a └── main.m ├── BrakeTests ├── BrakeTests-Info.plist ├── BrakeTests.m └── en.lproj │ └── InfoPlist.strings ├── External Libraries ├── AUTHORS ├── BSD └── libssh │ ├── CMakeLists.txt │ ├── agent.h │ ├── auth.h │ ├── bind.h │ ├── buffer.h │ ├── callbacks.h │ ├── channels.h │ ├── crypto.h │ ├── dh.h │ ├── kex.h │ ├── keyfiles.h │ ├── keys.h │ ├── legacy.h │ ├── libcrypto.h │ ├── libgcrypt.h │ ├── libssh.h │ ├── libsshpp.hpp │ ├── messages.h │ ├── misc.h │ ├── packet.h │ ├── pcap.h │ ├── pki.h │ ├── poll.h │ ├── priv.h │ ├── scp.h │ ├── server.h │ ├── session.h │ ├── sftp.h │ ├── socket.h │ ├── ssh1.h │ ├── ssh2.h │ ├── string.h │ ├── threads.h │ └── wrapper.h └── README.md /Brake.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Brake.xcodeproj/project.xcworkspace/xcshareddata/Brake.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 2AC22A1D-9ACF-4A9C-9350-42F40167AA5C 9 | IDESourceControlProjectName 10 | Brake 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | BCC875F4-E25B-45CF-AEF2-D514AE70A66C 14 | https://github.com/KJCracks/Brake-for-Mac.git 15 | 16 | IDESourceControlProjectPath 17 | Brake.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 42D7509B-D2F9-4A48-AE0F-619111ABC3A7 21 | ../../Brake/MASPreferences 22 | BCC875F4-E25B-45CF-AEF2-D514AE70A66C 23 | ../.. 24 | 25 | IDESourceControlProjectURL 26 | https://github.com/KJCracks/Brake-for-Mac.git 27 | IDESourceControlProjectVersion 28 | 110 29 | IDESourceControlProjectWCCIdentifier 30 | BCC875F4-E25B-45CF-AEF2-D514AE70A66C 31 | IDESourceControlProjectWCConfigurations 32 | 33 | 34 | IDESourceControlRepositoryExtensionIdentifierKey 35 | public.vcs.git 36 | IDESourceControlWCCIdentifierKey 37 | BCC875F4-E25B-45CF-AEF2-D514AE70A66C 38 | IDESourceControlWCCName 39 | Brake-for-Mac 40 | 41 | 42 | IDESourceControlRepositoryExtensionIdentifierKey 43 | public.vcs.git 44 | IDESourceControlWCCIdentifierKey 45 | 42D7509B-D2F9-4A48-AE0F-619111ABC3A7 46 | IDESourceControlWCCName 47 | MASPreferences 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /Brake.xcodeproj/project.xcworkspace/xcuserdata/Ninja.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KJCracks/Brake-for-Mac/7825b557d27e09b3bdc179b06b8190c2242e3007/Brake.xcodeproj/project.xcworkspace/xcuserdata/Ninja.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Brake.xcodeproj/xcuserdata/Ninja.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /Brake.xcodeproj/xcuserdata/Ninja.xcuserdatad/xcschemes/Brake.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /Brake.xcodeproj/xcuserdata/Ninja.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Brake.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | BC0119B818103CF0000F8286 16 | 17 | primary 18 | 19 | 20 | BC0119D918103CF0000F8286 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Brake/Angry.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KJCracks/Brake-for-Mac/7825b557d27e09b3bdc179b06b8190c2242e3007/Brake/Angry.jpg -------------------------------------------------------------------------------- /Brake/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Brake 4 | // 5 | // Created by Thomas Hedderwick on 17/10/2013. 6 | // Copyright (c) 2013 Dybero. All rights reserved. 7 | // 8 | 9 | #import 10 | #include "MasterViewController.h" 11 | 12 | 13 | @interface AppDelegate : NSObject 14 | { 15 | NSWindowController *_preferencesWindowController; 16 | } 17 | 18 | @property (assign) IBOutlet NSWindow *window; 19 | @property (nonatomic, strong) IBOutlet MasterViewController *masterViewController; 20 | @property (nonatomic, readonly) NSWindowController *preferencesWindowController; 21 | 22 | // Methods 23 | - (IBAction)openPreferences:(id)sender; 24 | 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Brake/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Brake 4 | // 5 | // Created by Thomas Hedderwick on 17/10/2013. 6 | // Copyright (c) 2013 Dybero. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "AppDoc.h" 11 | #import "DFSSHServer.h" 12 | #import "DFSSHConnector.h" 13 | #import "DFSSHOperator.h" 14 | #import "DeviceManager.h" 15 | #import "MASPreferencesWindowController.h" 16 | #import "GeneralPreferencesViewController.h" 17 | 18 | @implementation AppDelegate 19 | 20 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 21 | { 22 | // Insert code here to initialize your application 23 | self.masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil]; 24 | 25 | [self.window.contentView addSubview:self.masterViewController.view]; 26 | 27 | // Check if the defaults are set, if not set them with default settings 28 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 29 | 30 | if ([defaults objectForKey:@"host"] == nil) { 31 | [defaults setObject:@"localhost" forKey:@"host"]; 32 | } else if ([defaults objectForKey:@"user"] == nil) { 33 | [defaults setObject:@"root" forKey:@"user"]; 34 | } else if ([defaults objectForKey:@"password"] == nil) { 35 | [defaults setObject:@"alpine" forKey:@"password"]; 36 | } else if ([defaults objectForKey:@"port"] == nil) { 37 | [defaults setObject:[NSNumber numberWithInt:22] forKey:@"port"]; 38 | } 39 | 40 | [defaults synchronize]; 41 | 42 | self.masterViewController.view.frame = ((NSView *)self.window.contentView).bounds; 43 | } 44 | 45 | - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender 46 | { 47 | return NO; 48 | } 49 | 50 | - (NSWindowController *)preferencesWindowController 51 | { 52 | if (_preferencesWindowController == nil) { 53 | NSViewController *generalPreferenceViewController = [[GeneralPreferencesViewController alloc] init]; 54 | NSArray *controllers = @[generalPreferenceViewController]; 55 | 56 | NSString *title = @"Preferences"; 57 | _preferencesWindowController = [[MASPreferencesWindowController alloc] initWithViewControllers:controllers title:title]; 58 | } 59 | 60 | return _preferencesWindowController; 61 | } 62 | 63 | - (IBAction)openPreferences:(id)sender 64 | { 65 | [self.preferencesWindowController showWindow:nil]; 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /Brake/AppDoc.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDoc.h 3 | // Brake 4 | // 5 | // Created by Thomas Hedderwick on 17/10/2013. 6 | // Copyright (c) 2013 Dybero. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class AppModel; 12 | 13 | @interface AppDoc : NSObject 14 | 15 | @property (strong) AppModel *data; 16 | @property (strong) NSImage *icon; 17 | 18 | // Methods 19 | 20 | - (id)initWithIcon:(NSImage *)icon name:(NSString *)name developer:(NSString *)developer version:(NSString *)version appid:(NSUInteger)appid applicationDirectory:(NSString *)applicationDirectory applicationBaseDirectory:(NSString *)applicationBaseDirectory applicationDisplayName:(NSString *)applicationDisplayName applicationName:(NSString *)applicationName applicationBaseName:(NSString *)applicationBaseName realUniqueID:(NSString *)realUniqueID applicationVersion:(NSString *)applicationVersion; 21 | 22 | //- (id)initWithIcon:(NSImage *)icon name:(NSString *)name; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Brake/AppDoc.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDoc.m 3 | // Brake 4 | // 5 | // Created by Thomas Hedderwick on 17/10/2013. 6 | // Copyright (c) 2013 Dybero. All rights reserved. 7 | // 8 | 9 | #import "AppDoc.h" 10 | #import "AppModel.h" 11 | 12 | @implementation AppDoc 13 | 14 | - (id)initWithIcon:(NSImage *)icon name:(NSString *)name developer:(NSString *)developer version:(NSString *)version appid:(NSUInteger)appid applicationDirectory:(NSString *)applicationDirectory applicationBaseDirectory:(NSString *)applicationBaseDirectory applicationDisplayName:(NSString *)applicationDisplayName applicationName:(NSString *)applicationName applicationBaseName:(NSString *)applicationBaseName realUniqueID:(NSString *)realUniqueID applicationVersion:(NSString *)applicationVersion 15 | { 16 | if ((self = [super init])) { 17 | self.data = [[AppModel alloc] initWithIcon:icon name:name developer:developer version:version appid:appid applicationDirectory:applicationDirectory applicationBaseDirectory:applicationBaseDirectory applicationDisplayName:applicationDisplayName applicationName:applicationName applicationBaseName:applicationBaseName realUniqueID:realUniqueID applicationVersion:applicationVersion]; 18 | self.icon = icon; 19 | } 20 | 21 | return self; 22 | } 23 | 24 | /*- (id)initWithIcon:(NSImage *)icon name:(NSString *)name 25 | { 26 | if ((self = [super init])) { 27 | self.icon = icon; 28 | self.data = [[AppModel alloc] initWithIcon:icon name:name]; 29 | } 30 | 31 | return self; 32 | }*/ 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Brake/AppManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppManager.h 3 | // Brake 4 | // 5 | // Created by Thomas Hedderwick on 18/10/2013. 6 | // Copyright (c) 2013 Dybero. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DeviceManager.h" 11 | 12 | @class DeviceManager; 13 | @interface AppManager : NSObject 14 | { 15 | DeviceManager *deviceManager; 16 | } 17 | 18 | @property (nonatomic) int count; 19 | @property (nonatomic) NSMutableArray *applications; 20 | 21 | + (id)sharedInstance; 22 | - (NSMutableArray *)getApplicationsFromDevice; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Brake/AppManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppManager.m 3 | // Brake 4 | // 5 | // Created by Thomas Hedderwick on 18/10/2013. 6 | // Copyright (c) 2013 Dybero. All rights reserved. 7 | // 8 | 9 | #import "AppManager.h" 10 | #import "DeviceManager.h" 11 | 12 | @implementation AppManager 13 | 14 | + (id)sharedInstance 15 | { 16 | static dispatch_once_t p = 0; 17 | 18 | __strong static id _sharedObject = nil; 19 | 20 | dispatch_once(&p, ^{ 21 | _sharedObject = [[self alloc] init]; 22 | }); 23 | 24 | return _sharedObject; 25 | } 26 | 27 | - (NSMutableArray *)getApplicationsFromDevice 28 | { 29 | deviceManager = [DeviceManager sharedInstance]; 30 | 31 | if (deviceManager.isConnectedToDevice == NO) { 32 | // Device needs to be connected to get applications 33 | return nil; 34 | } 35 | 36 | NSString *returnString = [NSString string]; 37 | 38 | returnString = [deviceManager changeDirectory:@"/var/private/mobile/Applications/"]; 39 | 40 | NSLog(@"%@", returnString); 41 | 42 | return nil; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Brake/AppModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppModel.h 3 | // Brake 4 | // 5 | // Created by Thomas Hedderwick on 17/10/2013. 6 | // Copyright (c) 2013 Dybero. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppModel : NSObject 12 | 13 | // Application Data 14 | @property (nonatomic, strong) NSImage *icon; 15 | @property (nonatomic, strong) NSString *name; 16 | @property (nonatomic, strong) NSString *developer; 17 | @property (nonatomic, strong) NSString *version; 18 | @property (nonatomic) NSUInteger appid; 19 | 20 | // Clutch needed Data 21 | @property (nonatomic, strong) NSString *applicationDirectory; 22 | @property (nonatomic, strong) NSString *applicationBaseDirectory; 23 | @property (nonatomic, strong) NSString *applicationDisplayName; 24 | @property (nonatomic, strong) NSString *applicationName; 25 | @property (nonatomic, strong) NSString *applicationBaseName; 26 | @property (nonatomic, strong) NSString *realUniqueID; 27 | @property (nonatomic, strong) NSString *applicationVersion; 28 | 29 | // Methods 30 | - (id)initWithIcon:(NSImage *)icon name:(NSString *)name developer:(NSString *)developer version:(NSString *)version appid:(NSUInteger)appid applicationDirectory:(NSString *)applicationDirectory applicationBaseDirectory:(NSString *)applicationBaseDirectory applicationDisplayName:(NSString *)applicationDisplayName applicationName:(NSString *)applicationName applicationBaseName:(NSString *)applicationBaseName realUniqueID:(NSString *)realUniqueID applicationVersion:(NSString *)applicationVersion; 31 | 32 | //- (id)initWithIcon:(NSImage *)icon name:(NSString *)name; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Brake/AppModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppModel.m 3 | // Brake 4 | // 5 | // Created by Thomas Hedderwick on 17/10/2013. 6 | // Copyright (c) 2013 Dybero. All rights reserved. 7 | // 8 | 9 | #import "AppModel.h" 10 | 11 | @implementation AppModel 12 | 13 | - (id)initWithIcon:(NSImage *)icon name:(NSString *)name developer:(NSString *)developer version:(NSString *)version appid:(NSUInteger)appid applicationDirectory:(NSString *)applicationDirectory applicationBaseDirectory:(NSString *)applicationBaseDirectory applicationDisplayName:(NSString *)applicationDisplayName applicationName:(NSString *)applicationName applicationBaseName:(NSString *)applicationBaseName realUniqueID:(NSString *)realUniqueID applicationVersion:(NSString *)applicationVersion 14 | { 15 | if ((self = [super init])) { 16 | self.icon = icon; 17 | self.name = name; 18 | self.developer = developer; 19 | self.version = version; 20 | self.appid = appid; 21 | 22 | self.applicationDirectory = applicationDirectory; 23 | self.applicationBaseDirectory = applicationBaseDirectory; 24 | self.applicationDisplayName = applicationDisplayName; 25 | self.applicationName = applicationName; 26 | self.applicationBaseName = applicationBaseName; 27 | self.realUniqueID = realUniqueID; 28 | self.applicationVersion = applicationVersion; 29 | } 30 | 31 | return self; 32 | } 33 | 34 | /*- (id)initWithIcon:(NSImage *)icon name:(NSString *)name 35 | { 36 | if ((self = [super init])) { 37 | self.icon = icon; 38 | self.name = name; 39 | } 40 | 41 | return self; 42 | }*/ 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /Brake/Brake-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.dybero.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2013 Dybero. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /Brake/Brake-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #endif 10 | -------------------------------------------------------------------------------- /Brake/DFSSHWrapper/headers/DFSSHConnectionType.h: -------------------------------------------------------------------------------- 1 | // 2 | // sshConnectionType.h 3 | // sshwrapper 4 | // 5 | // Created by Daniel Finneran on 27/10/2011. 6 | // Copyright (c) 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DFSSHConnectionType : NSObject { 12 | 13 | BOOL publicKey; 14 | BOOL password; 15 | BOOL keyboard_interactive; 16 | BOOL autoDetect; 17 | } 18 | 19 | @property (nonatomic) BOOL publicKey; 20 | @property (nonatomic) BOOL password; 21 | @property (nonatomic) BOOL keyboard_interactive; 22 | @property (nonatomic) BOOL autoDetect; 23 | 24 | +(id)auto; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Brake/DFSSHWrapper/headers/DFSSHConnector.h: -------------------------------------------------------------------------------- 1 | // 2 | // sshConnector.h 3 | // sshtest 4 | // 5 | // Created by Daniel Finneran on 23/10/2011. 6 | // Copyright 2011 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DFSSHServer.h" 11 | #import "DFSSHConnectionType.h" 12 | 13 | @interface DFSSHConnector : NSObject { 14 | 15 | //const char *test; 16 | } 17 | 18 | -(BOOL) closeSSH:(DFSSHServer*)server; 19 | -(int) connectInit:(DFSSHServer*)server; 20 | 21 | -(int) connectPublicKey:(DFSSHServer*)server; 22 | -(int) connectPassword:(DFSSHServer*)server; 23 | -(int) connectKeyboard_Interactive:(DFSSHServer*)server; 24 | -(int) connect:(DFSSHServer*)server connectionType:(DFSSHConnectionType*)connectionType; 25 | -(int)reverse_port_forward:(DFSSHServer *)server; 26 | 27 | 28 | void kb_int(const char *name, int name_len, const char *instr, int instr_len, 29 | int num_prompts, const LIBSSH2_USERAUTH_KBDINT_PROMPT *prompts, LIBSSH2_USERAUTH_KBDINT_RESPONSE *res, 30 | void **abstract); 31 | //char *passwordFunc(const char *s); 32 | char *passwordFunc(); 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Brake/DFSSHWrapper/headers/DFSSHOperator.h: -------------------------------------------------------------------------------- 1 | // 2 | // sshOperator.h 3 | // sshtest 4 | // 5 | // Created by Daniel Finneran on 23/10/2011. 6 | // Copyright 2011 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DFSSHServer.h" 11 | 12 | @interface DFSSHOperator : NSObject 13 | 14 | +(NSString*) execCommand:(NSString *)commandline server:(DFSSHServer*)server; 15 | 16 | +(NSString*) execCommand:(NSString *)commandline server:(DFSSHServer*)server timeout:(NSNumber *)timeout; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Brake/DFSSHWrapper/headers/DFSSHServer.h: -------------------------------------------------------------------------------- 1 | // 2 | // sshServer.h 3 | // sshtest 4 | // 5 | // Created by Daniel Finneran on 23/10/2011. 6 | // Copyright 2011 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "libssh2.h" 11 | 12 | 13 | 14 | @interface DFSSHServer : NSObject { 15 | // Average SSH Details Required 16 | NSString *hostname; 17 | int port; 18 | NSString *username; 19 | NSString *password; 20 | // SSH Key Details 21 | NSString *key; 22 | NSString *keypub; 23 | // Session Status/Details 24 | bool connected; 25 | int sock; 26 | LIBSSH2_SESSION *session; 27 | LIBSSH2_CHANNEL *channel; 28 | 29 | } 30 | //Getter methods 31 | /* 32 | - (const char *)hostname; 33 | 34 | - (const char *)username; 35 | - (const char *)password; 36 | - (const char *)key; 37 | - (const char *)keypub; 38 | */ 39 | - (int)port; 40 | - (int) sock; 41 | - (LIBSSH2_SESSION *)session; 42 | - (LIBSSH2_CHANNEL *)channel; 43 | 44 | @property (nonatomic, strong) NSString *hostname; 45 | //@property (nonatomic, retain) int port; 46 | @property (nonatomic, strong) NSString *username; 47 | @property (nonatomic, strong) NSString *password; 48 | @property (nonatomic, strong) NSString *key; 49 | @property (nonatomic, strong) NSString *keypub; 50 | 51 | //sshServer Methods 52 | 53 | /*-(char *)passwordFunc:(const char *)s;*/ 54 | -(void) setSSHHost:(NSString*)sshHost port:(int)sshPort user:(NSString*)sshUser key:(NSString*)sshKey keypub:(NSString*)sshKeypub password:(NSString*)sshpassWord; /* Set SSH Server Details */ 55 | 56 | -(void) setSession:(LIBSSH2_SESSION *)sshSession; /* Set the persistant Session */ 57 | -(void) setSock:(int)sshSock; /* Set a persistant socket */ 58 | -(void) setConnected:(bool)sshconnected; /* Set state to connected */ 59 | -(bool) connectionStatus; /* Return connected status */ 60 | 61 | -(NSDictionary *) sanitizedData; 62 | //- (NSMutableArray *) sanitizedData; 63 | - (void) setSSHHostWithDictionary:(NSDictionary *)sshDetails; 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /Brake/DFSSHWrapper/source/DFSSHConnectionType.m: -------------------------------------------------------------------------------- 1 | // 2 | // sshConnectionType.m 3 | // sshwrapper 4 | // 5 | // Created by Daniel Finneran on 27/10/2011. 6 | // Copyright (c) 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "DFSSHConnectionType.h" 10 | 11 | @implementation DFSSHConnectionType 12 | 13 | @synthesize password, keyboard_interactive, publicKey, autoDetect; 14 | 15 | +(id)auto { 16 | id autoConnectorClass = [[[self class] alloc] init]; 17 | [autoConnectorClass setAutoDetect:YES]; 18 | return autoConnectorClass; 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Brake/DFSSHWrapper/source/DFSSHOperator.m: -------------------------------------------------------------------------------- 1 | // 2 | // sshOperator.m 3 | // sshtest 4 | // 5 | // Created by Daniel Finneran on 23/10/2011. 6 | // Copyright 2011 Home. All rights reserved. 7 | // 8 | 9 | #import "DFSSHOperator.h" 10 | #import "libssh2.h" 11 | 12 | LIBSSH2_CHANNEL *channel; 13 | unsigned long rc; 14 | 15 | int exitcode; 16 | 17 | @implementation DFSSHOperator 18 | 19 | - (id)init 20 | { 21 | self = [super init]; 22 | if (self) { 23 | // Initialization code here. 24 | } 25 | 26 | return self; 27 | } 28 | 29 | static int waitsocket(int socket_fd, LIBSSH2_SESSION *session) 30 | { 31 | // Variable Declarations 32 | struct timeval timeout; 33 | 34 | fd_set fd; 35 | fd_set *writefd = NULL; 36 | fd_set *readfd = NULL; 37 | 38 | int rc; 39 | int dir; 40 | // Wait time in Seconds 41 | timeout.tv_sec = 0; 42 | // Wait time in Microseconds... (really need that level of granularity :/ ) 43 | timeout.tv_usec = 500000; 44 | 45 | FD_ZERO(&fd); 46 | FD_SET(socket_fd, &fd); 47 | 48 | 49 | /* now make sure we wait in the correct direction */ 50 | dir = libssh2_session_block_directions(session); 51 | if(dir & LIBSSH2_SESSION_BLOCK_INBOUND) 52 | readfd = &fd; 53 | if(dir & LIBSSH2_SESSION_BLOCK_OUTBOUND) 54 | writefd = &fd; 55 | rc = select(socket_fd + 1, readfd, writefd, NULL, &timeout); 56 | 57 | return rc; 58 | } 59 | 60 | // Timer driven exec 61 | +(NSString*) execCommand:(NSString *)commandline server:(DFSSHServer*)server { 62 | return [self execCommand:commandline server:server timeout:[NSNumber numberWithDouble:1]]; 63 | } 64 | 65 | 66 | 67 | // from libssh2 example - ssh2_exec.c 68 | +(NSString*) execCommand:(NSString *)commandline server:(DFSSHServer*)server timeout:(NSNumber *)timeout { 69 | int bytecount = 0; /*wrap up in a function*/ 70 | CFAbsoluteTime time; 71 | time = CFAbsoluteTimeGetCurrent() + [timeout doubleValue]; 72 | if (![server connectionStatus]) 73 | return @"No Connection"; 74 | 75 | const char * cmd = [commandline UTF8String]; 76 | 77 | if (!cmd) 78 | return @""; 79 | 80 | char buffer[0x4000]; 81 | 82 | //Clear buffer 83 | memset(buffer, 0, 0x4000); 84 | /* Exec non-blocking on the remote host */ 85 | channel = libssh2_channel_open_session([server session]); 86 | int sessionError = libssh2_session_last_error([server session],NULL,NULL,0); 87 | while( channel == NULL && sessionError == LIBSSH2_ERROR_EAGAIN ) 88 | { 89 | waitsocket([server sock], [server session]); 90 | // Testing Methods 91 | if (time < CFAbsoluteTimeGetCurrent()) 92 | break; 93 | // NSLog(@"%d", sessionError); 94 | channel = libssh2_channel_open_session([server session]); 95 | sessionError = libssh2_session_last_error([server session],NULL,NULL,0); 96 | 97 | } 98 | if( channel == NULL ) 99 | { 100 | NSLog(@"Error Channel is incorrect"); 101 | NSLog(@"Returning empty string"); 102 | return @""; 103 | //exit( 1 ); 104 | } 105 | while( (rc = libssh2_channel_exec(channel, cmd)) == LIBSSH2_ERROR_EAGAIN ) 106 | { 107 | waitsocket([server sock], [server session]); 108 | } 109 | if( rc != 0 ) 110 | { 111 | NSLog(@"Error, return value is wrong rc = %ld\n", rc); 112 | NSLog(@"Returning empty string"); 113 | return @""; 114 | } 115 | for( ;; ) 116 | { 117 | /* loop until we block */ 118 | long rc1; 119 | if (time < CFAbsoluteTimeGetCurrent()) 120 | break; 121 | do { 122 | rc1 = libssh2_channel_read( channel, buffer, (sizeof(buffer))); 123 | if( rc1 > 0 ) 124 | bytecount += rc1; 125 | //else 126 | //NSLog(@"libssh2_channel_read returned %ld", rc1); 127 | } 128 | while( rc1 > 0 ); 129 | 130 | /* this is due to blocking that would occur otherwise so we loop on 131 | this condition */ 132 | if( rc1 == LIBSSH2_ERROR_EAGAIN ) { 133 | waitsocket([server sock], [server session]); 134 | } 135 | else 136 | break; 137 | } 138 | exitcode = 127; 139 | while( (rc = libssh2_channel_close(channel)) == LIBSSH2_ERROR_EAGAIN ) 140 | waitsocket([server sock], [server session]); 141 | 142 | if( rc == 0 ) 143 | { 144 | exitcode = libssh2_channel_get_exit_status( channel ); 145 | } 146 | //NSLog(@"Number of bytes :%d", bytecount); 147 | if (sizeof(buffer) > bytecount) 148 | buffer[(bytecount+1)] = 0; 149 | //NSLog(@"\nEXIT: %d bytecount: %d", exitcode, bytecount); 150 | libssh2_channel_free(channel); 151 | channel = NULL; 152 | //Depricated but needed :/ 153 | if (bytecount == 0) 154 | return @""; 155 | return [NSString stringWithCString:buffer encoding:NSASCIIStringEncoding]; 156 | } 157 | @end -------------------------------------------------------------------------------- /Brake/DFSSHWrapper/source/DFSSHServer.m: -------------------------------------------------------------------------------- 1 | // 2 | // sshServer.m 3 | // sshtest 4 | // 5 | // Created by Daniel Finneran on 23/10/2011. 6 | // Copyright 2011 Home. All rights reserved. 7 | // 8 | 9 | #import "DFSSHServer.h" 10 | 11 | 12 | 13 | @implementation DFSSHServer 14 | 15 | 16 | @synthesize hostname, username, password,key, keypub; 17 | 18 | - (id)init 19 | { 20 | self = [super init]; 21 | if (self) { 22 | // Initialization code here. 23 | } 24 | 25 | return self; 26 | } 27 | 28 | 29 | 30 | - (void) setSSHHost:(NSString*)sshHost 31 | port:(int)sshPort 32 | user:(NSString*)sshUser 33 | key:(NSString*)sshKey 34 | keypub:(NSString*)sshKeypub 35 | password:(NSString*)sshpassWord { 36 | 37 | //allocate Host details to object 38 | hostname = sshHost; 39 | port = sshPort; 40 | username = sshUser ; 41 | key = sshKey; 42 | keypub = sshKeypub; 43 | password = sshpassWord; 44 | //passwordFunc(password); 45 | 46 | } 47 | 48 | - (void) setSSHHostWithDictionary:(NSDictionary *)sshDetails { 49 | NSLog(@"%@",sshDetails); 50 | hostname = [sshDetails objectForKey:@"hostname"]; 51 | port = [[sshDetails objectForKey:@"port"]intValue]; 52 | username = [sshDetails objectForKey:@"username"]; 53 | key = [sshDetails objectForKey:@"key"]; 54 | keypub = [sshDetails objectForKey:@"keypub"]; 55 | password = [sshDetails objectForKey:@"password"]; 56 | } 57 | 58 | -(void) setSession:(LIBSSH2_SESSION *)sshSession { 59 | session = sshSession; 60 | } 61 | 62 | -(void) setSock:(int)sshSock{ 63 | sock = sshSock; 64 | } 65 | -(void) setConnected:(bool)sshconnected{ 66 | connected = sshconnected; 67 | } 68 | 69 | -(bool) connectionStatus { 70 | return connected; 71 | } 72 | -(NSDictionary *) sanitizedData { 73 | NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys: 74 | hostname, @"hostname", 75 | [NSNumber numberWithInt:port], @"port", 76 | username, @"username", 77 | key, @"key", 78 | keypub, @"keypub", 79 | password, @"password", nil]; 80 | NSLog(@"%@", dict); 81 | return dict; 82 | } 83 | /* 84 | 85 | - (NSMutableArray *) sanitizedData { 86 | //NSMutableArray *sanitizedArray = [[NSMutableArray alloc] init]; 87 | // [sanitizedArray addObject:hostname]; 88 | // [sanitizedArray addObject:(int)port]; 89 | // [sanitizedArray addObject:key]; 90 | // [sanitizedArray addObject:keypub]; 91 | 92 | // WithObjects:hostname, port,username, key, keypub,password, nil]; 93 | return [[NSMutableArray alloc] initWithObjects:hostname, [NSNumber numberWithInt:port] ,username, key, keypub,password, nil]; 94 | //return sanitizedArray; 95 | }}*/ 96 | 97 | // Getter Methods 98 | 99 | - (int) port {return port;} 100 | - (int) sock {return sock;} 101 | - (LIBSSH2_SESSION *)session {return session;} 102 | - (LIBSSH2_CHANNEL *)channel {return channel;} 103 | 104 | @end 105 | -------------------------------------------------------------------------------- /Brake/DeviceManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // DeviceManager.h 3 | // Brake 4 | // 5 | // Created by Thomas Hedderwick on 17/10/2013. 6 | // Copyright (c) 2013 Dybero. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DFSSHServer.h" 11 | #import "DFSSHOperator.h" 12 | #import "DFSSHConnector.h" 13 | #import "AppManager.h" 14 | 15 | @protocol ProgressUpdateDelegate 16 | 17 | @required 18 | - (void)updateProgress:(NSString *)message log:(NSString *)log; 19 | 20 | @end 21 | 22 | @class AppManager; 23 | @interface DeviceManager : NSObject 24 | { 25 | AppManager *appManager; 26 | } 27 | 28 | @property (nonatomic) bool isConnectedToDevice; 29 | 30 | // General 31 | @property (nonatomic) DFSSHServer *server; 32 | @property (nonatomic) DFSSHConnector *connection; 33 | 34 | // Required by user input 35 | @property (nonatomic) NSString *host; 36 | @property (nonatomic) NSString *user; 37 | @property (nonatomic) NSString *password; 38 | @property (nonatomic) int port; 39 | 40 | // Optional for key login 41 | @property (nonatomic) NSString *key; 42 | @property (nonatomic) NSString *keyPub; 43 | 44 | // Set once connection occurs 45 | @property (nonatomic) NSString *currentDirectory; 46 | @property (nonatomic) NSString *directoryPath; 47 | @property (nonatomic) NSString *deviceName; 48 | 49 | // Delegate 50 | @property (nonatomic) id delegate; 51 | 52 | + (id)sharedInstance; 53 | 54 | - (void)connectToDevice; 55 | - (void)disconnectFromDevice; 56 | - (NSString *)getDeviceName; 57 | - (NSString *)executeCommand:(NSString *)command; 58 | - (NSString *)changeDirectory:(NSString *)directory; 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /Brake/DeviceManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // DeviceManager.m 3 | // Brake 4 | // 5 | // Created by Thomas Hedderwick on 17/10/2013. 6 | // Copyright (c) 2013 Dybero. All rights reserved. 7 | // 8 | 9 | #import "DeviceManager.h" 10 | #import "DFSSHServer.h" 11 | #import "DFSSHOperator.h" 12 | #import "DFSSHConnector.h" 13 | #import "AppManager.h" 14 | 15 | @implementation DeviceManager 16 | 17 | int timeout = 2; 18 | 19 | + (id)sharedInstance 20 | { 21 | static dispatch_once_t p = 0; 22 | 23 | __strong static id _sharedObject = nil; 24 | 25 | dispatch_once(&p, ^{ 26 | _sharedObject = [[self alloc] init]; 27 | }); 28 | 29 | return _sharedObject; 30 | } 31 | 32 | - (id)initWithHost:(NSString *)host user:(NSString *)user password:(NSString *)password port:(int)port 33 | { 34 | self.host = host; 35 | self.user = user; 36 | self.password = password; 37 | self.port = port; 38 | 39 | appManager = [AppManager sharedInstance]; 40 | 41 | return self; 42 | } 43 | 44 | - (id)settingsWithHost:(NSString *)host user:(NSString *)user key:(NSString *)key keyPub:(NSString *)keyPub 45 | { 46 | self.host = host; 47 | self.user = user; 48 | self.key = key; 49 | self.keyPub = keyPub; 50 | 51 | return self; 52 | } 53 | 54 | - (void)connectToDevice 55 | { 56 | NSLog(@"hit"); 57 | [self.delegate updateProgress:@"Connecting" log:@"Connecting to device"]; 58 | 59 | dispatch_queue_t queue = dispatch_get_global_queue(0,0); 60 | 61 | dispatch_async(queue, ^{ 62 | self.server = [[DFSSHServer alloc] init]; 63 | [self.server setSSHHost:self.host port:self.port user:self.user key:self.key keypub:self.keyPub password:self.password]; 64 | self.connection = [[DFSSHConnector alloc] init]; 65 | [self.connection connect:self.server connectionType:[DFSSHConnectionType auto]]; 66 | 67 | dispatch_queue_t main = dispatch_get_main_queue(); 68 | 69 | dispatch_async(main, ^{ 70 | if ([self.server connectionStatus]) { 71 | [self.delegate updateProgress:@"Connected" log:@"Connected to device successfully"]; 72 | self.isConnectedToDevice = YES; 73 | [self getDeviceName]; 74 | [appManager getApplicationsFromDevice]; 75 | } else { 76 | [self.delegate updateProgress:@"Error!" log:@"Error during SSH session attempt:"]; 77 | [self disconnectFromDevice]; 78 | } 79 | }); 80 | }); 81 | } 82 | 83 | - (void)disconnectFromDevice 84 | { 85 | [self.connection closeSSH:self.server]; 86 | [self.delegate updateProgress:@"Disconnected" log:@"Disconnected from device"]; 87 | self.isConnectedToDevice = NO; 88 | } 89 | 90 | - (NSString *)getDeviceName 91 | { 92 | NSString *deviceName = [self executeCommand:@"hostname"]; 93 | [self.delegate updateProgress:[NSString stringWithFormat:@"Connected to %@", deviceName] log:[NSString stringWithFormat:@"Device name: %@", deviceName]]; 94 | self.deviceName = deviceName; 95 | return self.deviceName; 96 | } 97 | 98 | - (NSString *)executeCommand:(NSString *)command 99 | { 100 | [self.delegate updateProgress:nil log:[NSString stringWithFormat:@"Executing command: %@", command]]; 101 | return [DFSSHOperator execCommand:command server:self.server timeout:[NSNumber numberWithInt:timeout]]; 102 | } 103 | 104 | - (NSString *)changeDirectory:(NSString *)directory 105 | { 106 | [self.delegate updateProgress:nil log:[NSString stringWithFormat:@"Changing directory to: %@", directory]]; 107 | return [DFSSHOperator execCommand:[NSString stringWithFormat:@"cd %@", directory] server:self.server timeout:[NSNumber numberWithInt:timeout]]; 108 | } 109 | 110 | @end 111 | -------------------------------------------------------------------------------- /Brake/GeneralPreferencesViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // GeneralPreferencesViewController.h 3 | // Brake 4 | // 5 | // Created by Thomas Hedderwick on 17/10/2013. 6 | // Copyright (c) 2013 Dybero. All rights reserved. 7 | // 8 | 9 | #import "MASPreferencesWindowController.h" 10 | 11 | @interface GeneralPreferencesViewController : NSViewController 12 | 13 | @property (nonatomic) IBOutlet NSTextField *hostField; 14 | @property (nonatomic) IBOutlet NSTextField *userField; 15 | @property (nonatomic) IBOutlet NSTextField *passwordField; 16 | @property (nonatomic) IBOutlet NSTextField *portField; 17 | 18 | @property (nonatomic) IBOutlet NSTextField *keyField; // not yet integrated 19 | @property (nonatomic) IBOutlet NSTextField *keyPubField; // not yet integrated 20 | 21 | @property (nonatomic) NSButton *saveButton; 22 | @property (nonatomic) NSButton *clearButton; 23 | 24 | // Methods 25 | - (IBAction)saveValues:(id)sender; 26 | 27 | @end 28 | 29 | -------------------------------------------------------------------------------- /Brake/GeneralPreferencesViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // GeneralPreferencesViewController.m 3 | // Brake 4 | // 5 | // Created by Thomas Hedderwick on 17/10/2013. 6 | // Copyright (c) 2013 Dybero. All rights reserved. 7 | // 8 | 9 | #import "GeneralPreferencesViewController.h" 10 | 11 | @interface GeneralPreferencesViewController () 12 | 13 | @end 14 | 15 | @implementation GeneralPreferencesViewController 16 | 17 | - (id)init 18 | { 19 | return [super initWithNibName:@"GeneralPreferencesViewController" bundle:nil]; 20 | } 21 | 22 | - (void)updateTextFields 23 | { 24 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 25 | 26 | [self.hostField setStringValue:[defaults objectForKey:@"host"]]; 27 | self.userField.stringValue = [defaults objectForKey:@"user"]; 28 | self.passwordField.stringValue = [defaults objectForKey:@"password"]; 29 | self.portField.stringValue = [defaults objectForKey:@"port"]; 30 | } 31 | 32 | - (void)awakeFromNib 33 | { 34 | [self updateTextFields]; 35 | } 36 | 37 | - (IBAction)saveValues:(id)sender 38 | { 39 | NSLog(@"did save"); 40 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 41 | 42 | [defaults setValue:self.hostField.stringValue forKey:@"host"]; 43 | [defaults setValue:self.userField.stringValue forKey:@"user"]; 44 | [defaults setValue:self.passwordField.stringValue forKey:@"password"]; 45 | [defaults setValue:self.portField.stringValue forKey:@"port"]; 46 | 47 | [defaults synchronize]; 48 | } 49 | 50 | - (IBAction)clear:(id)sender 51 | { 52 | [NSUserDefaults resetStandardUserDefaults]; 53 | } 54 | 55 | #pragma mark - MASPreferencesViewController 56 | 57 | - (NSString *)identifier 58 | { 59 | return @"GeneralPreferences"; 60 | } 61 | 62 | - (NSImage *)toolbarItemImage 63 | { 64 | return [NSImage imageNamed:NSImageNamePreferencesGeneral]; 65 | } 66 | 67 | - (NSString *)toolbarItemLabel 68 | { 69 | return @"General"; 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /Brake/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /Brake/MASPreferences/.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | build/* 3 | *.pbxuser 4 | !default.pbxuser 5 | *.mode1v3 6 | !default.mode1v3 7 | *.mode2v3 8 | !default.mode2v3 9 | *.perspectivev3 10 | !default.perspectivev3 11 | *.xcworkspace 12 | !default.xcworkspace 13 | xcuserdata 14 | profile 15 | *.moved-aside 16 | # Finder 17 | .DS_Store -------------------------------------------------------------------------------- /Brake/MASPreferences/MASPreferencesViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Any controller providing preference pane view must support this protocol 3 | // 4 | 5 | @protocol MASPreferencesViewController 6 | 7 | @optional 8 | 9 | - (void)viewWillAppear; 10 | - (void)viewDidDisappear; 11 | - (NSView*)initialKeyView; 12 | 13 | @required 14 | 15 | @property (nonatomic, readonly) NSString *identifier; 16 | @property (nonatomic, readonly) NSImage *toolbarItemImage; 17 | @property (nonatomic, readonly) NSString *toolbarItemLabel; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Brake/MASPreferences/MASPreferencesWindowController.h: -------------------------------------------------------------------------------- 1 | // 2 | // You create an application Preferences window using code like this: 3 | // _preferencesWindowController = [[MASPreferencesWindowController alloc] initWithViewControllers:controllers 4 | // title:title] 5 | // 6 | // To open the Preferences window: 7 | // [_preferencesWindowController showWindow:sender] 8 | // 9 | 10 | #import "MASPreferencesViewController.h" 11 | 12 | extern NSString *const kMASPreferencesWindowControllerDidChangeViewNotification; 13 | 14 | __attribute__((__visibility__("default"))) 15 | #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 16 | @interface MASPreferencesWindowController : NSWindowController 17 | #else 18 | @interface MASPreferencesWindowController : NSWindowController 19 | #endif 20 | { 21 | @private 22 | NSArray *_viewControllers; 23 | NSMutableDictionary *_minimumViewRects; 24 | NSString *_title; 25 | NSViewController *_selectedViewController; 26 | } 27 | 28 | @property (nonatomic, readonly) NSArray *viewControllers; 29 | @property (nonatomic, readonly) NSUInteger indexOfSelectedController; 30 | @property (nonatomic, readonly, retain) NSViewController *selectedViewController; 31 | @property (nonatomic, readonly) NSString *title; 32 | 33 | - (id)initWithViewControllers:(NSArray *)viewControllers; 34 | - (id)initWithViewControllers:(NSArray *)viewControllers title:(NSString *)title; 35 | 36 | - (void)selectControllerAtIndex:(NSUInteger)controllerIndex; 37 | 38 | - (IBAction)goNextTab:(id)sender; 39 | - (IBAction)goPreviousTab:(id)sender; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Brake/MASPreferences/README.md: -------------------------------------------------------------------------------- 1 | # MASPreferences 2 | 3 | This component is intended as a replacement for SS_PrefsController by Matt Legend Gemmell and Selectable Toolbar by Brandon Walkin. It is designed to use NSViewController subclasses for preference panes. 4 | 5 | # How to use 6 | 7 | You can find a Demo project at [MASPreferencesDemo](https://github.com/shpakovski/MASPreferencesDemo). 8 | 9 | # License 10 | 11 | MASPreferences is licensed under the BSD license -------------------------------------------------------------------------------- /Brake/MasterViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MasterViewController.h 3 | // Brake 4 | // 5 | // Created by Thomas Hedderwick on 17/10/2013. 6 | // Copyright (c) 2013 Dybero. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DeviceManager.h" 11 | #import "AppManager.h" 12 | 13 | @class DeviceManager; 14 | @class AppManager; 15 | @interface MasterViewController : NSViewController 16 | { 17 | DeviceManager *manager; 18 | AppManager *appManager; 19 | } 20 | 21 | @property (strong) NSMutableArray *apps; 22 | 23 | // Interface Builder Outlets 24 | 25 | @property (weak) IBOutlet NSTextField *applicationName; 26 | @property (weak) IBOutlet NSTextField *applicationVersion; 27 | @property (weak) IBOutlet NSTextField *applicationDeveloper; 28 | @property (weak) IBOutlet NSImageView *iconView; 29 | 30 | @property (weak) IBOutlet NSButton *crackButton; 31 | @property (weak) IBOutlet NSButton *queueButton; 32 | @property (weak) IBOutlet NSButton *connectButton; 33 | @property (weak) IBOutlet NSTableView *applicationTableView; 34 | @property (weak) IBOutlet NSTableView *descriptionTableView; 35 | 36 | // Methods 37 | - (IBAction)connectToDevice:(id)sender; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Brake/MasterViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // MasterViewController.m 3 | // Brake 4 | // 5 | // Created by Thomas Hedderwick on 17/10/2013. 6 | // Copyright (c) 2013 Dybero. All rights reserved. 7 | // 8 | 9 | #import "MasterViewController.h" 10 | #import "AppDoc.h" 11 | #import "AppModel.h" 12 | #import "DeviceManager.h" 13 | #import "AppManager.h" 14 | 15 | @interface MasterViewController () 16 | 17 | @end 18 | 19 | @implementation MasterViewController 20 | 21 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 22 | { 23 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 24 | if (self) { 25 | // Initialization code here. 26 | 27 | manager = [DeviceManager sharedInstance]; 28 | appManager = [AppManager sharedInstance]; 29 | } 30 | 31 | return self; 32 | } 33 | 34 | - (void)updateProgress:(NSString *)message log:(NSString *)log 35 | { 36 | [self.connectButton setTitle:message]; 37 | NSLog(@"%@", log); 38 | } 39 | 40 | - (IBAction)connectToDevice:(id)sender 41 | { 42 | if (manager.isConnectedToDevice == YES) { 43 | [manager disconnectFromDevice]; 44 | [self updateProgress:@"Connect to Device" log:nil]; 45 | } else { 46 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 47 | manager.host = [defaults objectForKey:@"host"]; 48 | manager.user = [defaults objectForKey:@"user"]; 49 | manager.password = [defaults objectForKey:@"password"]; 50 | manager.port = [defaults integerForKey:@"port"]; 51 | [manager connectToDevice]; 52 | //[self updateProgress:@"Disconnect" log:nil]; 53 | } 54 | } 55 | 56 | - (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row 57 | { 58 | NSTableCellView *cellView = [tableView makeViewWithIdentifier:tableColumn.identifier owner:self]; 59 | 60 | if ([tableColumn.identifier isEqualToString:@"Applications"]) { 61 | cellView.textField.stringValue = @"Please connect to your device."; 62 | 63 | return cellView; 64 | } else { 65 | if ([tableColumn.identifier isEqualToString:@"Applications"]) { 66 | AppDoc *appDoc = [self.apps objectAtIndex:row]; 67 | cellView.imageView.image = appDoc.icon; 68 | cellView.textField.stringValue = appDoc.data.name; 69 | 70 | return cellView; 71 | } 72 | } 73 | 74 | return cellView; 75 | } 76 | 77 | - (AppDoc *)selectedAppDoc 78 | { 79 | NSInteger selectedRow = [self.applicationTableView selectedRow]; 80 | 81 | if (selectedRow >= 0 && self.apps.count > selectedRow) { 82 | AppDoc *selectedApp = [self.apps objectAtIndex:selectedRow]; 83 | 84 | return selectedApp; 85 | } 86 | 87 | return nil; 88 | } 89 | 90 | - (void)setDetailInfo:(AppDoc *)doc 91 | { 92 | NSString *name = @""; 93 | NSImage *image = nil; 94 | 95 | if (doc != nil) { 96 | name = doc.data.name; 97 | image = doc.icon; 98 | } 99 | 100 | [self.applicationTableView setStringValue:name]; 101 | [self.iconView setImage:image]; 102 | [self.applicationName setStringValue:name]; 103 | } 104 | 105 | - (void)tableViewSelectionDidChange:(NSNotification *)notification 106 | { 107 | AppDoc *selectedDoc = [self selectedAppDoc]; 108 | 109 | [self setDetailInfo:selectedDoc]; 110 | } 111 | 112 | - (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView 113 | { 114 | return [self.apps count]; 115 | } 116 | 117 | @end 118 | -------------------------------------------------------------------------------- /Brake/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /Brake/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Brake/include/channel.h: -------------------------------------------------------------------------------- 1 | #ifndef __LIBSSH2_CHANNEL_H 2 | #define __LIBSSH2_CHANNEL_H 3 | /* Copyright (c) 2008-2010 by Daniel Stenberg 4 | * 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, 8 | * with or without modification, are permitted provided 9 | * that the following conditions are met: 10 | * 11 | * Redistributions of source code must retain the above 12 | * copyright notice, this list of conditions and the 13 | * following disclaimer. 14 | * 15 | * Redistributions in binary form must reproduce the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer in the documentation and/or other materials 18 | * provided with the distribution. 19 | * 20 | * Neither the name of the copyright holder nor the names 21 | * of any other contributors may be used to endorse or 22 | * promote products derived from this software without 23 | * specific prior written permission. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 26 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 27 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 28 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 30 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 32 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 33 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 34 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 35 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 36 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 37 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 38 | * OF SUCH DAMAGE. 39 | */ 40 | 41 | /* 42 | * _libssh2_channel_receive_window_adjust 43 | * 44 | * Adjust the receive window for a channel by adjustment bytes. If the amount 45 | * to be adjusted is less than LIBSSH2_CHANNEL_MINADJUST and force is 0 the 46 | * adjustment amount will be queued for a later packet. 47 | * 48 | * Always non-blocking. 49 | */ 50 | int _libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL * channel, 51 | uint32_t adjustment, 52 | unsigned char force, 53 | unsigned int *store); 54 | 55 | /* 56 | * _libssh2_channel_flush 57 | * 58 | * Flush data from one (or all) stream 59 | * Returns number of bytes flushed, or negative on failure 60 | */ 61 | int _libssh2_channel_flush(LIBSSH2_CHANNEL *channel, int streamid); 62 | 63 | /* 64 | * _libssh2_channel_free 65 | * 66 | * Make sure a channel is closed, then remove the channel from the session 67 | * and free its resource(s) 68 | * 69 | * Returns 0 on success, negative on failure 70 | */ 71 | int _libssh2_channel_free(LIBSSH2_CHANNEL *channel); 72 | 73 | int 74 | _libssh2_channel_extended_data(LIBSSH2_CHANNEL *channel, int ignore_mode); 75 | 76 | /* 77 | * _libssh2_channel_write 78 | * 79 | * Send data to a channel 80 | */ 81 | ssize_t 82 | _libssh2_channel_write(LIBSSH2_CHANNEL *channel, int stream_id, 83 | const unsigned char *buf, size_t buflen); 84 | 85 | /* 86 | * _libssh2_channel_open 87 | * 88 | * Establish a generic session channel 89 | */ 90 | LIBSSH2_CHANNEL * 91 | _libssh2_channel_open(LIBSSH2_SESSION * session, const char *channel_type, 92 | uint32_t channel_type_len, 93 | uint32_t window_size, 94 | uint32_t packet_size, 95 | const unsigned char *message, size_t message_len); 96 | 97 | 98 | /* 99 | * _libssh2_channel_process_startup 100 | * 101 | * Primitive for libssh2_channel_(shell|exec|subsystem) 102 | */ 103 | int 104 | _libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel, 105 | const char *request, size_t request_len, 106 | const char *message, size_t message_len); 107 | 108 | /* 109 | * _libssh2_channel_read 110 | * 111 | * Read data from a channel 112 | * 113 | * It is important to not return 0 until the currently read channel is 114 | * complete. If we read stuff from the wire but it was no payload data to fill 115 | * in the buffer with, we MUST make sure to return PACKET_EAGAIN. 116 | */ 117 | ssize_t _libssh2_channel_read(LIBSSH2_CHANNEL *channel, int stream_id, 118 | char *buf, size_t buflen); 119 | 120 | uint32_t _libssh2_channel_nextid(LIBSSH2_SESSION * session); 121 | 122 | LIBSSH2_CHANNEL *_libssh2_channel_locate(LIBSSH2_SESSION * session, 123 | uint32_t channel_id); 124 | 125 | size_t _libssh2_channel_packet_data_len(LIBSSH2_CHANNEL * channel, 126 | int stream_id); 127 | 128 | int _libssh2_channel_close(LIBSSH2_CHANNEL * channel); 129 | 130 | /* 131 | * _libssh2_channel_forward_cancel 132 | * 133 | * Stop listening on a remote port and free the listener 134 | * Toss out any pending (un-accept()ed) connections 135 | * 136 | * Return 0 on success, LIBSSH2_ERROR_EAGAIN if would block, -1 on error 137 | */ 138 | int _libssh2_channel_forward_cancel(LIBSSH2_LISTENER *listener); 139 | 140 | #endif /* __LIBSSH2_CHANNEL_H */ 141 | 142 | -------------------------------------------------------------------------------- /Brake/include/comp.h: -------------------------------------------------------------------------------- 1 | #ifndef __LIBSSH2_COMP_H 2 | #define __LIBSSH2_COMP_H 3 | 4 | /* Copyright (C) 2009-2010 by Daniel Stenberg 5 | * 6 | * Redistribution and use in source and binary forms, 7 | * with or without modification, are permitted provided 8 | * that the following conditions are met: 9 | * 10 | * Redistributions of source code must retain the above 11 | * copyright notice, this list of conditions and the 12 | * following disclaimer. 13 | * 14 | * Redistributions in binary form must reproduce the above 15 | * copyright notice, this list of conditions and the following 16 | * disclaimer in the documentation and/or other materials 17 | * provided with the distribution. 18 | * 19 | * Neither the name of the copyright holder nor the names 20 | * of any other contributors may be used to endorse or 21 | * promote products derived from this software without 22 | * specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 25 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 26 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 27 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 29 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 31 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 34 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 35 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 36 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 37 | * OF SUCH DAMAGE. 38 | * 39 | */ 40 | 41 | #include "libssh2_priv.h" 42 | 43 | const LIBSSH2_COMP_METHOD **_libssh2_comp_methods(LIBSSH2_SESSION *session); 44 | 45 | #endif /* __LIBSSH2_COMP_H */ 46 | -------------------------------------------------------------------------------- /Brake/include/crypto.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2009, 2010 Simon Josefsson 2 | * Copyright (C) 2006, 2007 The Written Word, Inc. All rights reserved. 3 | * Copyright (C) 2010 Daniel Stenberg 4 | * 5 | * Redistribution and use in source and binary forms, 6 | * with or without modification, are permitted provided 7 | * that the following conditions are met: 8 | * 9 | * Redistributions of source code must retain the above 10 | * copyright notice, this list of conditions and the 11 | * following disclaimer. 12 | * 13 | * Redistributions in binary form must reproduce the above 14 | * copyright notice, this list of conditions and the following 15 | * disclaimer in the documentation and/or other materials 16 | * provided with the distribution. 17 | * 18 | * Neither the name of the copyright holder nor the names 19 | * of any other contributors may be used to endorse or 20 | * promote products derived from this software without 21 | * specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 24 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 25 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 26 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 28 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 30 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 33 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 34 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 35 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 36 | * OF SUCH DAMAGE. 37 | */ 38 | #ifndef LIBSSH2_CRYPTO_H 39 | #define LIBSSH2_CRYPTO_H 40 | 41 | #ifdef LIBSSH2_LIBGCRYPT 42 | #include "libgcrypt.h" 43 | #else 44 | #include "openssl.h" 45 | #endif 46 | 47 | int _libssh2_rsa_new(libssh2_rsa_ctx ** rsa, 48 | const unsigned char *edata, 49 | unsigned long elen, 50 | const unsigned char *ndata, 51 | unsigned long nlen, 52 | const unsigned char *ddata, 53 | unsigned long dlen, 54 | const unsigned char *pdata, 55 | unsigned long plen, 56 | const unsigned char *qdata, 57 | unsigned long qlen, 58 | const unsigned char *e1data, 59 | unsigned long e1len, 60 | const unsigned char *e2data, 61 | unsigned long e2len, 62 | const unsigned char *coeffdata, unsigned long coefflen); 63 | int _libssh2_rsa_new_private(libssh2_rsa_ctx ** rsa, 64 | LIBSSH2_SESSION * session, 65 | const char *filename, 66 | unsigned const char *passphrase); 67 | int _libssh2_rsa_sha1_verify(libssh2_rsa_ctx * rsa, 68 | const unsigned char *sig, 69 | unsigned long sig_len, 70 | const unsigned char *m, unsigned long m_len); 71 | int _libssh2_rsa_sha1_sign(LIBSSH2_SESSION * session, 72 | libssh2_rsa_ctx * rsactx, 73 | const unsigned char *hash, 74 | size_t hash_len, 75 | unsigned char **signature, 76 | size_t *signature_len); 77 | 78 | #if LIBSSH2_DSA 79 | int _libssh2_dsa_new(libssh2_dsa_ctx ** dsa, 80 | const unsigned char *pdata, 81 | unsigned long plen, 82 | const unsigned char *qdata, 83 | unsigned long qlen, 84 | const unsigned char *gdata, 85 | unsigned long glen, 86 | const unsigned char *ydata, 87 | unsigned long ylen, 88 | const unsigned char *x, unsigned long x_len); 89 | int _libssh2_dsa_new_private(libssh2_dsa_ctx ** dsa, 90 | LIBSSH2_SESSION * session, 91 | const char *filename, 92 | unsigned const char *passphrase); 93 | int _libssh2_dsa_sha1_verify(libssh2_dsa_ctx * dsactx, 94 | const unsigned char *sig, 95 | const unsigned char *m, unsigned long m_len); 96 | int _libssh2_dsa_sha1_sign(libssh2_dsa_ctx * dsactx, 97 | const unsigned char *hash, 98 | unsigned long hash_len, unsigned char *sig); 99 | #endif 100 | 101 | int _libssh2_cipher_init(_libssh2_cipher_ctx * h, 102 | _libssh2_cipher_type(algo), 103 | unsigned char *iv, 104 | unsigned char *secret, int encrypt); 105 | 106 | int _libssh2_cipher_crypt(_libssh2_cipher_ctx * ctx, 107 | _libssh2_cipher_type(algo), 108 | int encrypt, unsigned char *block, size_t blocksize); 109 | 110 | int _libssh2_pub_priv_keyfile(LIBSSH2_SESSION *session, 111 | unsigned char **method, 112 | size_t *method_len, 113 | unsigned char **pubkeydata, 114 | size_t *pubkeydata_len, 115 | const char *privatekey, 116 | const char *passphrase); 117 | 118 | void _libssh2_init_aes_ctr(void); 119 | 120 | #endif 121 | -------------------------------------------------------------------------------- /Brake/include/libgcrypt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008, 2009, 2010 Simon Josefsson 3 | * Copyright (C) 2006, 2007, The Written Word, Inc. 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, 7 | * with or without modification, are permitted provided 8 | * that the following conditions are met: 9 | * 10 | * Redistributions of source code must retain the above 11 | * copyright notice, this list of conditions and the 12 | * following disclaimer. 13 | * 14 | * Redistributions in binary form must reproduce the above 15 | * copyright notice, this list of conditions and the following 16 | * disclaimer in the documentation and/or other materials 17 | * provided with the distribution. 18 | * 19 | * Neither the name of the copyright holder nor the names 20 | * of any other contributors may be used to endorse or 21 | * promote products derived from this software without 22 | * specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 25 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 26 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 27 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 29 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 31 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 34 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 35 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 36 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 37 | * OF SUCH DAMAGE. 38 | */ 39 | 40 | #include 41 | 42 | #define LIBSSH2_MD5 1 43 | 44 | #define LIBSSH2_HMAC_RIPEMD 1 45 | 46 | #define LIBSSH2_AES 1 47 | #define LIBSSH2_AES_CTR 1 48 | #define LIBSSH2_BLOWFISH 1 49 | #define LIBSSH2_RC4 1 50 | #define LIBSSH2_CAST 1 51 | #define LIBSSH2_3DES 1 52 | 53 | #define LIBSSH2_RSA 1 54 | #define LIBSSH2_DSA 1 55 | 56 | #define MD5_DIGEST_LENGTH 16 57 | #define SHA_DIGEST_LENGTH 20 58 | 59 | #define _libssh2_random(buf, len) \ 60 | (gcry_randomize ((buf), (len), GCRY_STRONG_RANDOM), 1) 61 | 62 | #define libssh2_sha1_ctx gcry_md_hd_t 63 | #define libssh2_sha1_init(ctx) gcry_md_open (ctx, GCRY_MD_SHA1, 0); 64 | #define libssh2_sha1_update(ctx, data, len) gcry_md_write (ctx, data, len) 65 | #define libssh2_sha1_final(ctx, out) \ 66 | memcpy (out, gcry_md_read (ctx, 0), SHA_DIGEST_LENGTH), gcry_md_close (ctx) 67 | #define libssh2_sha1(message, len, out) \ 68 | gcry_md_hash_buffer (GCRY_MD_SHA1, out, message, len) 69 | 70 | #define libssh2_md5_ctx gcry_md_hd_t 71 | 72 | /* returns 0 in case of failure */ 73 | #define libssh2_md5_init(ctx) \ 74 | (GPG_ERR_NO_ERROR == gcry_md_open (ctx, GCRY_MD_MD5, 0)) 75 | 76 | #define libssh2_md5_update(ctx, data, len) gcry_md_write (ctx, data, len) 77 | #define libssh2_md5_final(ctx, out) \ 78 | memcpy (out, gcry_md_read (ctx, 0), MD5_DIGEST_LENGTH), gcry_md_close (ctx) 79 | #define libssh2_md5(message, len, out) \ 80 | gcry_md_hash_buffer (GCRY_MD_MD5, out, message, len) 81 | 82 | #define libssh2_hmac_ctx gcry_md_hd_t 83 | #define libssh2_hmac_sha1_init(ctx, key, keylen) \ 84 | gcry_md_open (ctx, GCRY_MD_SHA1, GCRY_MD_FLAG_HMAC), \ 85 | gcry_md_setkey (*ctx, key, keylen) 86 | #define libssh2_hmac_md5_init(ctx, key, keylen) \ 87 | gcry_md_open (ctx, GCRY_MD_MD5, GCRY_MD_FLAG_HMAC), \ 88 | gcry_md_setkey (*ctx, key, keylen) 89 | #define libssh2_hmac_ripemd160_init(ctx, key, keylen) \ 90 | gcry_md_open (ctx, GCRY_MD_RMD160, GCRY_MD_FLAG_HMAC), \ 91 | gcry_md_setkey (*ctx, key, keylen) 92 | #define libssh2_hmac_update(ctx, data, datalen) \ 93 | gcry_md_write (ctx, data, datalen) 94 | #define libssh2_hmac_final(ctx, data) \ 95 | memcpy (data, gcry_md_read (ctx, 0), \ 96 | gcry_md_get_algo_dlen (gcry_md_get_algo (ctx))) 97 | #define libssh2_hmac_cleanup(ctx) gcry_md_close (*ctx); 98 | 99 | #define libssh2_crypto_init() gcry_control (GCRYCTL_DISABLE_SECMEM) 100 | #define libssh2_crypto_exit() 101 | 102 | #define libssh2_rsa_ctx struct gcry_sexp 103 | 104 | #define _libssh2_rsa_free(rsactx) gcry_sexp_release (rsactx) 105 | 106 | #define libssh2_dsa_ctx struct gcry_sexp 107 | 108 | #define _libssh2_dsa_free(dsactx) gcry_sexp_release (dsactx) 109 | 110 | #define _libssh2_cipher_type(name) int name 111 | #define _libssh2_cipher_ctx gcry_cipher_hd_t 112 | 113 | #define _libssh2_gcry_ciphermode(c,m) ((c << 8) | m) 114 | #define _libssh2_gcry_cipher(c) (c >> 8) 115 | #define _libssh2_gcry_mode(m) (m & 0xFF) 116 | 117 | #define _libssh2_cipher_aes256ctr \ 118 | _libssh2_gcry_ciphermode(GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_CTR) 119 | #define _libssh2_cipher_aes192ctr \ 120 | _libssh2_gcry_ciphermode(GCRY_CIPHER_AES192, GCRY_CIPHER_MODE_CTR) 121 | #define _libssh2_cipher_aes128ctr \ 122 | _libssh2_gcry_ciphermode(GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_CTR) 123 | #define _libssh2_cipher_aes256 \ 124 | _libssh2_gcry_ciphermode(GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_CBC) 125 | #define _libssh2_cipher_aes192 \ 126 | _libssh2_gcry_ciphermode(GCRY_CIPHER_AES192, GCRY_CIPHER_MODE_CBC) 127 | #define _libssh2_cipher_aes128 \ 128 | _libssh2_gcry_ciphermode(GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_CBC) 129 | #define _libssh2_cipher_blowfish \ 130 | _libssh2_gcry_ciphermode(GCRY_CIPHER_BLOWFISH, GCRY_CIPHER_MODE_CBC) 131 | #define _libssh2_cipher_arcfour \ 132 | _libssh2_gcry_ciphermode(GCRY_CIPHER_ARCFOUR, GCRY_CIPHER_MODE_STREAM) 133 | #define _libssh2_cipher_cast5 \ 134 | _libssh2_gcry_ciphermode(GCRY_CIPHER_CAST5, GCRY_CIPHER_MODE_CBC) 135 | #define _libssh2_cipher_3des \ 136 | _libssh2_gcry_ciphermode(GCRY_CIPHER_3DES, GCRY_CIPHER_MODE_CBC) 137 | 138 | 139 | #define _libssh2_cipher_dtor(ctx) gcry_cipher_close(*(ctx)) 140 | 141 | #define _libssh2_bn struct gcry_mpi 142 | #define _libssh2_bn_ctx int 143 | #define _libssh2_bn_ctx_new() 0 144 | #define _libssh2_bn_ctx_free(bnctx) ((void)0) 145 | #define _libssh2_bn_init() gcry_mpi_new(0) 146 | #define _libssh2_bn_rand(bn, bits, top, bottom) gcry_mpi_randomize (bn, bits, GCRY_WEAK_RANDOM) 147 | #define _libssh2_bn_mod_exp(r, a, p, m, ctx) gcry_mpi_powm (r, a, p, m) 148 | #define _libssh2_bn_set_word(bn, val) gcry_mpi_set_ui(bn, val) 149 | #define _libssh2_bn_from_bin(bn, len, val) gcry_mpi_scan(&((bn)), GCRYMPI_FMT_USG, val, len, NULL) 150 | #define _libssh2_bn_to_bin(bn, val) gcry_mpi_print (GCRYMPI_FMT_USG, val, _libssh2_bn_bytes(bn), NULL, bn) 151 | #define _libssh2_bn_bytes(bn) (gcry_mpi_get_nbits (bn) / 8 + ((gcry_mpi_get_nbits (bn) % 8 == 0) ? 0 : 1)) 152 | #define _libssh2_bn_bits(bn) gcry_mpi_get_nbits (bn) 153 | #define _libssh2_bn_free(bn) gcry_mpi_release(bn) 154 | 155 | -------------------------------------------------------------------------------- /Brake/include/libssh2_config.h: -------------------------------------------------------------------------------- 1 | /* src/libssh2_config.h. Generated from libssh2_config.h.in by configure. */ 2 | /* src/libssh2_config.h.in. Generated from configure.ac by autoheader. */ 3 | 4 | /* Define if building universal (internal helper macro) */ 5 | /* #undef AC_APPLE_UNIVERSAL_BUILD */ 6 | 7 | /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP 8 | systems. This function is required for `alloca.c' support on those systems. 9 | */ 10 | /* #undef CRAY_STACKSEG_END */ 11 | 12 | /* Define to 1 if using `alloca.c'. */ 13 | /* #undef C_ALLOCA */ 14 | 15 | /* Define to 1 if you have `alloca', as a function or macro. */ 16 | #define HAVE_ALLOCA 1 17 | 18 | /* Define to 1 if you have and it should be used (not on Ultrix). 19 | */ 20 | #define HAVE_ALLOCA_H 1 21 | 22 | /* Define to 1 if you have the header file. */ 23 | #define HAVE_ARPA_INET_H 1 24 | 25 | /* disabled non-blocking sockets */ 26 | /* #undef HAVE_DISABLED_NONBLOCKING */ 27 | 28 | /* Define to 1 if you have the header file. */ 29 | #define HAVE_DLFCN_H 1 30 | 31 | /* Define to 1 if you have the header file. */ 32 | #define HAVE_ERRNO_H 1 33 | 34 | /* Define to 1 if you have the `EVP_aes_128_ctr' function. */ 35 | /* #undef HAVE_EVP_AES_128_CTR */ 36 | 37 | /* Define to 1 if you have the header file. */ 38 | #define HAVE_FCNTL_H 1 39 | 40 | /* use FIONBIO for non-blocking sockets */ 41 | /* #undef HAVE_FIONBIO */ 42 | 43 | /* Define to 1 if you have the `gettimeofday' function. */ 44 | #define HAVE_GETTIMEOFDAY 1 45 | 46 | /* Define to 1 if you have the header file. */ 47 | #define HAVE_INTTYPES_H 1 48 | 49 | /* use ioctlsocket() for non-blocking sockets */ 50 | /* #undef HAVE_IOCTLSOCKET */ 51 | 52 | /* use Ioctlsocket() for non-blocking sockets */ 53 | /* #undef HAVE_IOCTLSOCKET_CASE */ 54 | 55 | /* Define if you have the gcrypt library. */ 56 | /* #undef HAVE_LIBGCRYPT */ 57 | 58 | /* Define if you have the ssl library. */ 59 | #define HAVE_LIBSSL 1 60 | 61 | /* Define if you have the z library. */ 62 | #define HAVE_LIBZ 1 63 | 64 | /* Define to 1 if the compiler supports the 'long long' data type. */ 65 | #define HAVE_LONGLONG 1 66 | 67 | /* Define to 1 if you have the header file. */ 68 | #define HAVE_MEMORY_H 1 69 | 70 | /* Define to 1 if you have the header file. */ 71 | #define HAVE_NETINET_IN_H 1 72 | 73 | /* use O_NONBLOCK for non-blocking sockets */ 74 | #define HAVE_O_NONBLOCK 1 75 | 76 | /* Define to 1 if you have the `poll' function. */ 77 | /* #undef HAVE_POLL */ 78 | 79 | /* Define to 1 if you have the select function. */ 80 | #define HAVE_SELECT 1 81 | 82 | /* use SO_NONBLOCK for non-blocking sockets */ 83 | /* #undef HAVE_SO_NONBLOCK */ 84 | 85 | /* Define to 1 if you have the header file. */ 86 | #define HAVE_STDINT_H 1 87 | 88 | /* Define to 1 if you have the header file. */ 89 | #define HAVE_STDIO_H 1 90 | 91 | /* Define to 1 if you have the header file. */ 92 | #define HAVE_STDLIB_H 1 93 | 94 | /* Define to 1 if you have the header file. */ 95 | #define HAVE_STRINGS_H 1 96 | 97 | /* Define to 1 if you have the header file. */ 98 | #define HAVE_STRING_H 1 99 | 100 | /* Define to 1 if you have the `strtoll' function. */ 101 | #define HAVE_STRTOLL 1 102 | 103 | /* Define to 1 if you have the header file. */ 104 | #define HAVE_SYS_IOCTL_H 1 105 | 106 | /* Define to 1 if you have the header file. */ 107 | #define HAVE_SYS_SELECT_H 1 108 | 109 | /* Define to 1 if you have the header file. */ 110 | #define HAVE_SYS_SOCKET_H 1 111 | 112 | /* Define to 1 if you have the header file. */ 113 | #define HAVE_SYS_STAT_H 1 114 | 115 | /* Define to 1 if you have the header file. */ 116 | #define HAVE_SYS_TIME_H 1 117 | 118 | /* Define to 1 if you have the header file. */ 119 | #define HAVE_SYS_TYPES_H 1 120 | 121 | /* Define to 1 if you have the header file. */ 122 | #define HAVE_SYS_UIO_H 1 123 | 124 | /* Define to 1 if you have the header file. */ 125 | #define HAVE_SYS_UN_H 1 126 | 127 | /* Define to 1 if you have the header file. */ 128 | #define HAVE_UNISTD_H 1 129 | 130 | /* Define to 1 if you have the header file. */ 131 | /* #undef HAVE_WINDOWS_H */ 132 | 133 | /* Define to 1 if you have the header file. */ 134 | /* #undef HAVE_WINSOCK2_H */ 135 | 136 | /* Define to 1 if you have the header file. */ 137 | /* #undef HAVE_WS2TCPIP_H */ 138 | 139 | /* to make a symbol visible */ 140 | /* #undef LIBSSH2_API */ 141 | 142 | /* Enable "none" cipher -- NOT RECOMMENDED */ 143 | /* #undef LIBSSH2_CRYPT_NONE */ 144 | 145 | /* Enable newer diffie-hellman-group-exchange-sha1 syntax */ 146 | #define LIBSSH2_DH_GEX_NEW 1 147 | 148 | /* Compile in zlib support */ 149 | #define LIBSSH2_HAVE_ZLIB 1 150 | 151 | /* Use libgcrypt */ 152 | /* #undef LIBSSH2_LIBGCRYPT */ 153 | 154 | /* Enable "none" MAC -- NOT RECOMMENDED */ 155 | /* #undef LIBSSH2_MAC_NONE */ 156 | 157 | /* Define to the sub-directory in which libtool stores uninstalled libraries. 158 | */ 159 | #define LT_OBJDIR ".libs/" 160 | 161 | /* Define to 1 if _REENTRANT preprocessor symbol must be defined. */ 162 | /* #undef NEED_REENTRANT */ 163 | 164 | /* Name of package */ 165 | #define PACKAGE "libssh2" 166 | 167 | /* Define to the address where bug reports for this package should be sent. */ 168 | #define PACKAGE_BUGREPORT "libssh2-devel@cool.haxx.se" 169 | 170 | /* Define to the full name of this package. */ 171 | #define PACKAGE_NAME "libssh2" 172 | 173 | /* Define to the full name and version of this package. */ 174 | #define PACKAGE_STRING "libssh2 -" 175 | 176 | /* Define to the one symbol short name of this package. */ 177 | #define PACKAGE_TARNAME "libssh2" 178 | 179 | /* Define to the home page for this package. */ 180 | #define PACKAGE_URL "" 181 | 182 | /* Define to the version of this package. */ 183 | #define PACKAGE_VERSION "-" 184 | 185 | /* If using the C implementation of alloca, define if you know the 186 | direction of stack growth for your system; otherwise it will be 187 | automatically deduced at runtime. 188 | STACK_DIRECTION > 0 => grows toward higher addresses 189 | STACK_DIRECTION < 0 => grows toward lower addresses 190 | STACK_DIRECTION = 0 => direction of growth unknown */ 191 | /* #undef STACK_DIRECTION */ 192 | 193 | /* Define to 1 if you have the ANSI C header files. */ 194 | #define STDC_HEADERS 1 195 | 196 | /* Version number of package */ 197 | #define VERSION "-" 198 | 199 | /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most 200 | significant byte first (like Motorola and SPARC, unlike Intel). */ 201 | #if defined AC_APPLE_UNIVERSAL_BUILD 202 | # if defined __BIG_ENDIAN__ 203 | # define WORDS_BIGENDIAN 1 204 | # endif 205 | #else 206 | # ifndef WORDS_BIGENDIAN 207 | /* # undef WORDS_BIGENDIAN */ 208 | # endif 209 | #endif 210 | 211 | /* Enable large inode numbers on Mac OS X 10.5. */ 212 | #ifndef _DARWIN_USE_64_BIT_INODE 213 | # define _DARWIN_USE_64_BIT_INODE 1 214 | #endif 215 | 216 | /* Number of bits in a file offset, on hosts where this is settable. */ 217 | /* #undef _FILE_OFFSET_BITS */ 218 | 219 | /* Define for large files, on AIX-style hosts. */ 220 | /* #undef _LARGE_FILES */ 221 | 222 | /* Define to empty if `const' does not conform to ANSI C. */ 223 | /* #undef const */ 224 | 225 | /* Define to `__inline__' or `__inline' if that's what the C compiler 226 | calls it, or to nothing if 'inline' is not supported under any name. */ 227 | #ifndef __cplusplus 228 | /* #undef inline */ 229 | #endif 230 | 231 | /* Define to `unsigned int' if does not define. */ 232 | /* #undef size_t */ 233 | -------------------------------------------------------------------------------- /Brake/include/libssh2_publickey.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2004-2006, Sara Golemon 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, 5 | * with or without modification, are permitted provided 6 | * that the following conditions are met: 7 | * 8 | * Redistributions of source code must retain the above 9 | * copyright notice, this list of conditions and the 10 | * following disclaimer. 11 | * 12 | * Redistributions in binary form must reproduce the above 13 | * copyright notice, this list of conditions and the following 14 | * disclaimer in the documentation and/or other materials 15 | * provided with the distribution. 16 | * 17 | * Neither the name of the copyright holder nor the names 18 | * of any other contributors may be used to endorse or 19 | * promote products derived from this software without 20 | * specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 24 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 27 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 32 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 33 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 34 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | /* Note: This include file is only needed for using the 39 | * publickey SUBSYSTEM which is not the same as publickey 40 | * authentication. For authentication you only need libssh2.h 41 | * 42 | * For more information on the publickey subsystem, 43 | * refer to IETF draft: secsh-publickey 44 | */ 45 | 46 | #ifndef LIBSSH2_PUBLICKEY_H 47 | #define LIBSSH2_PUBLICKEY_H 1 48 | 49 | #include "libssh2.h" 50 | 51 | typedef struct _LIBSSH2_PUBLICKEY LIBSSH2_PUBLICKEY; 52 | 53 | typedef struct _libssh2_publickey_attribute { 54 | const char *name; 55 | unsigned long name_len; 56 | const char *value; 57 | unsigned long value_len; 58 | char mandatory; 59 | } libssh2_publickey_attribute; 60 | 61 | typedef struct _libssh2_publickey_list { 62 | unsigned char *packet; /* For freeing */ 63 | 64 | const unsigned char *name; 65 | unsigned long name_len; 66 | const unsigned char *blob; 67 | unsigned long blob_len; 68 | unsigned long num_attrs; 69 | libssh2_publickey_attribute *attrs; /* free me */ 70 | } libssh2_publickey_list; 71 | 72 | /* Generally use the first macro here, but if both name and value are string literals, you can use _fast() to take advantage of preprocessing */ 73 | #define libssh2_publickey_attribute(name, value, mandatory) \ 74 | { (name), strlen(name), (value), strlen(value), (mandatory) }, 75 | #define libssh2_publickey_attribute_fast(name, value, mandatory) \ 76 | { (name), sizeof(name) - 1, (value), sizeof(value) - 1, (mandatory) }, 77 | 78 | #ifdef __cplusplus 79 | extern "C" { 80 | #endif 81 | 82 | /* Publickey Subsystem */ 83 | LIBSSH2_API LIBSSH2_PUBLICKEY *libssh2_publickey_init(LIBSSH2_SESSION *session); 84 | 85 | LIBSSH2_API int libssh2_publickey_add_ex(LIBSSH2_PUBLICKEY *pkey, 86 | const unsigned char *name, 87 | unsigned long name_len, 88 | const unsigned char *blob, 89 | unsigned long blob_len, char overwrite, 90 | unsigned long num_attrs, 91 | const libssh2_publickey_attribute attrs[]); 92 | #define libssh2_publickey_add(pkey, name, blob, blob_len, overwrite, \ 93 | num_attrs, attrs) \ 94 | libssh2_publickey_add_ex((pkey), (name), strlen(name), (blob), (blob_len), \ 95 | (overwrite), (num_attrs), (attrs)) 96 | 97 | LIBSSH2_API int libssh2_publickey_remove_ex(LIBSSH2_PUBLICKEY *pkey, 98 | const unsigned char *name, 99 | unsigned long name_len, 100 | const unsigned char *blob, 101 | unsigned long blob_len); 102 | #define libssh2_publickey_remove(pkey, name, blob, blob_len) \ 103 | libssh2_publickey_remove_ex((pkey), (name), strlen(name), (blob), (blob_len)) 104 | 105 | LIBSSH2_API int 106 | libssh2_publickey_list_fetch(LIBSSH2_PUBLICKEY *pkey, 107 | unsigned long *num_keys, 108 | libssh2_publickey_list **pkey_list); 109 | LIBSSH2_API void libssh2_publickey_list_free(LIBSSH2_PUBLICKEY *pkey, 110 | libssh2_publickey_list *pkey_list); 111 | 112 | LIBSSH2_API int libssh2_publickey_shutdown(LIBSSH2_PUBLICKEY *pkey); 113 | 114 | #ifdef __cplusplus 115 | } /* extern "C" */ 116 | #endif 117 | 118 | #endif /* ifndef: LIBSSH2_PUBLICKEY_H */ 119 | -------------------------------------------------------------------------------- /Brake/include/mac.h: -------------------------------------------------------------------------------- 1 | #ifndef __LIBSSH2_MAC_H 2 | #define __LIBSSH2_MAC_H 3 | 4 | /* Copyright (C) 2009-2010 by Daniel Stenberg 5 | * 6 | * Redistribution and use in source and binary forms, 7 | * with or without modification, are permitted provided 8 | * that the following conditions are met: 9 | * 10 | * Redistributions of source code must retain the above 11 | * copyright notice, this list of conditions and the 12 | * following disclaimer. 13 | * 14 | * Redistributions in binary form must reproduce the above 15 | * copyright notice, this list of conditions and the following 16 | * disclaimer in the documentation and/or other materials 17 | * provided with the distribution. 18 | * 19 | * Neither the name of the copyright holder nor the names 20 | * of any other contributors may be used to endorse or 21 | * promote products derived from this software without 22 | * specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 25 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 26 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 27 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 29 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 31 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 34 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 35 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 36 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 37 | * OF SUCH DAMAGE. 38 | * 39 | */ 40 | 41 | #include "libssh2_priv.h" 42 | 43 | struct _LIBSSH2_MAC_METHOD 44 | { 45 | const char *name; 46 | 47 | /* The length of a given MAC packet */ 48 | int mac_len; 49 | 50 | /* integrity key length */ 51 | int key_len; 52 | 53 | /* Message Authentication Code Hashing algo */ 54 | int (*init) (LIBSSH2_SESSION * session, unsigned char *key, int *free_key, 55 | void **abstract); 56 | int (*hash) (LIBSSH2_SESSION * session, unsigned char *buf, 57 | uint32_t seqno, const unsigned char *packet, 58 | uint32_t packet_len, const unsigned char *addtl, 59 | uint32_t addtl_len, void **abstract); 60 | int (*dtor) (LIBSSH2_SESSION * session, void **abstract); 61 | }; 62 | 63 | typedef struct _LIBSSH2_MAC_METHOD LIBSSH2_MAC_METHOD; 64 | 65 | const LIBSSH2_MAC_METHOD **_libssh2_mac_methods(void); 66 | 67 | #endif /* __LIBSSH2_MAC_H */ 68 | -------------------------------------------------------------------------------- /Brake/include/misc.h: -------------------------------------------------------------------------------- 1 | #ifndef __LIBSSH2_MISC_H 2 | #define __LIBSSH2_MISC_H 3 | /* Copyright (c) 2009-2011 by Daniel Stenberg 4 | * 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, 8 | * with or without modification, are permitted provided 9 | * that the following conditions are met: 10 | * 11 | * Redistributions of source code must retain the above 12 | * copyright notice, this list of conditions and the 13 | * following disclaimer. 14 | * 15 | * Redistributions in binary form must reproduce the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer in the documentation and/or other materials 18 | * provided with the distribution. 19 | * 20 | * Neither the name of the copyright holder nor the names 21 | * of any other contributors may be used to endorse or 22 | * promote products derived from this software without 23 | * specific prior written permission. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 26 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 27 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 28 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 30 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 32 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 33 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 34 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 35 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 36 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 37 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 38 | * OF SUCH DAMAGE. 39 | */ 40 | 41 | struct list_head { 42 | struct list_node *last; 43 | struct list_node *first; 44 | }; 45 | 46 | struct list_node { 47 | struct list_node *next; 48 | struct list_node *prev; 49 | struct list_head *head; 50 | }; 51 | 52 | int _libssh2_error(LIBSSH2_SESSION* session, int errcode, const char* errmsg); 53 | 54 | void _libssh2_list_init(struct list_head *head); 55 | 56 | /* add a node last in the list */ 57 | void _libssh2_list_add(struct list_head *head, 58 | struct list_node *entry); 59 | 60 | /* return the "first" node in the list this head points to */ 61 | void *_libssh2_list_first(struct list_head *head); 62 | 63 | /* return the next node in the list */ 64 | void *_libssh2_list_next(struct list_node *node); 65 | 66 | /* return the prev node in the list */ 67 | void *_libssh2_list_prev(struct list_node *node); 68 | 69 | /* remove this node from the list */ 70 | void _libssh2_list_remove(struct list_node *entry); 71 | 72 | size_t _libssh2_base64_encode(struct _LIBSSH2_SESSION *session, 73 | const char *inp, size_t insize, char **outptr); 74 | 75 | unsigned int _libssh2_ntohu32(const unsigned char *buf); 76 | libssh2_uint64_t _libssh2_ntohu64(const unsigned char *buf); 77 | void _libssh2_htonu32(unsigned char *buf, uint32_t val); 78 | void _libssh2_store_u32(unsigned char **buf, uint32_t value); 79 | void _libssh2_store_str(unsigned char **buf, const char *str, size_t len); 80 | 81 | #if defined(LIBSSH2_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) 82 | /* provide a private one */ 83 | #undef HAVE_GETTIMEOFDAY 84 | int __cdecl _libssh2_gettimeofday(struct timeval *tp, void *tzp); 85 | #define HAVE_LIBSSH2_GETTIMEOFDAY 86 | #define LIBSSH2_GETTIMEOFDAY_WIN32 /* enable the win32 implementation */ 87 | #else 88 | #ifdef HAVE_GETTIMEOFDAY 89 | #define _libssh2_gettimeofday(x,y) gettimeofday(x,y) 90 | #define HAVE_LIBSSH2_GETTIMEOFDAY 91 | #endif 92 | #endif 93 | 94 | #endif /* _LIBSSH2_MISC_H */ 95 | -------------------------------------------------------------------------------- /Brake/include/openssl.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2009, 2010 Simon Josefsson 2 | * Copyright (C) 2006, 2007 The Written Word, Inc. All rights reserved. 3 | * 4 | * Author: Simon Josefsson 5 | * 6 | * Redistribution and use in source and binary forms, 7 | * with or without modification, are permitted provided 8 | * that the following conditions are met: 9 | * 10 | * Redistributions of source code must retain the above 11 | * copyright notice, this list of conditions and the 12 | * following disclaimer. 13 | * 14 | * Redistributions in binary form must reproduce the above 15 | * copyright notice, this list of conditions and the following 16 | * disclaimer in the documentation and/or other materials 17 | * provided with the distribution. 18 | * 19 | * Neither the name of the copyright holder nor the names 20 | * of any other contributors may be used to endorse or 21 | * promote products derived from this software without 22 | * specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 25 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 26 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 27 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 29 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 31 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 34 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 35 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 36 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 37 | * OF SUCH DAMAGE. 38 | */ 39 | 40 | #include 41 | #include 42 | #ifndef OPENSSL_NO_MD5 43 | #include 44 | #endif 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | 51 | #ifdef OPENSSL_NO_RSA 52 | # define LIBSSH2_RSA 0 53 | #else 54 | # define LIBSSH2_RSA 1 55 | #endif 56 | 57 | #ifdef OPENSSL_NO_DSA 58 | # define LIBSSH2_DSA 0 59 | #else 60 | # define LIBSSH2_DSA 1 61 | #endif 62 | 63 | #ifdef OPENSSL_NO_MD5 64 | # define LIBSSH2_MD5 0 65 | #else 66 | # define LIBSSH2_MD5 1 67 | #endif 68 | 69 | #ifdef OPENSSL_NO_RIPEMD 70 | # define LIBSSH2_HMAC_RIPEMD 0 71 | #else 72 | # define LIBSSH2_HMAC_RIPEMD 1 73 | #endif 74 | 75 | #if OPENSSL_VERSION_NUMBER >= 0x00907000L && !defined(OPENSSL_NO_AES) 76 | # define LIBSSH2_AES_CTR 1 77 | # define LIBSSH2_AES 1 78 | #else 79 | # define LIBSSH2_AES_CTR 0 80 | # define LIBSSH2_AES 0 81 | #endif 82 | 83 | #ifdef OPENSSL_NO_BLOWFISH 84 | # define LIBSSH2_BLOWFISH 0 85 | #else 86 | # define LIBSSH2_BLOWFISH 1 87 | #endif 88 | 89 | #ifdef OPENSSL_NO_RC4 90 | # define LIBSSH2_RC4 0 91 | #else 92 | # define LIBSSH2_RC4 1 93 | #endif 94 | 95 | #ifdef OPENSSL_NO_CAST 96 | # define LIBSSH2_CAST 0 97 | #else 98 | # define LIBSSH2_CAST 1 99 | #endif 100 | 101 | #ifdef OPENSSL_NO_DES 102 | # define LIBSSH2_3DES 0 103 | #else 104 | # define LIBSSH2_3DES 1 105 | #endif 106 | 107 | #define _libssh2_random(buf, len) RAND_bytes ((buf), (len)) 108 | 109 | #define libssh2_sha1_ctx EVP_MD_CTX 110 | #define libssh2_sha1_init(ctx) EVP_DigestInit(ctx, EVP_get_digestbyname("sha1")) 111 | #define libssh2_sha1_update(ctx, data, len) EVP_DigestUpdate(&(ctx), data, len) 112 | #define libssh2_sha1_final(ctx, out) EVP_DigestFinal(&(ctx), out, NULL) 113 | void libssh2_sha1(const unsigned char *message, unsigned long len, unsigned char *out); 114 | 115 | #define libssh2_md5_ctx EVP_MD_CTX 116 | 117 | /* returns 0 in case of failure */ 118 | #define libssh2_md5_init(ctx) EVP_DigestInit(ctx, EVP_get_digestbyname("md5")) 119 | 120 | #define libssh2_md5_update(ctx, data, len) EVP_DigestUpdate(&(ctx), data, len) 121 | #define libssh2_md5_final(ctx, out) EVP_DigestFinal(&(ctx), out, NULL) 122 | void libssh2_md5(const unsigned char *message, unsigned long len, unsigned char *out); 123 | 124 | #define libssh2_hmac_ctx HMAC_CTX 125 | #define libssh2_hmac_sha1_init(ctx, key, keylen) \ 126 | HMAC_Init(ctx, key, keylen, EVP_sha1()) 127 | #define libssh2_hmac_md5_init(ctx, key, keylen) \ 128 | HMAC_Init(ctx, key, keylen, EVP_md5()) 129 | #define libssh2_hmac_ripemd160_init(ctx, key, keylen) \ 130 | HMAC_Init(ctx, key, keylen, EVP_ripemd160()) 131 | #define libssh2_hmac_update(ctx, data, datalen) \ 132 | HMAC_Update(&(ctx), data, datalen) 133 | #define libssh2_hmac_final(ctx, data) HMAC_Final(&(ctx), data, NULL) 134 | #define libssh2_hmac_cleanup(ctx) HMAC_cleanup(ctx) 135 | 136 | #define libssh2_crypto_init() OpenSSL_add_all_algorithms() 137 | #define libssh2_crypto_exit() 138 | 139 | #define libssh2_rsa_ctx RSA 140 | 141 | #define _libssh2_rsa_free(rsactx) RSA_free(rsactx) 142 | 143 | #define libssh2_dsa_ctx DSA 144 | 145 | 146 | #define _libssh2_dsa_free(dsactx) DSA_free(dsactx) 147 | 148 | #define _libssh2_cipher_type(name) const EVP_CIPHER *(*name)(void) 149 | #define _libssh2_cipher_ctx EVP_CIPHER_CTX 150 | 151 | #define _libssh2_cipher_aes256 EVP_aes_256_cbc 152 | #define _libssh2_cipher_aes192 EVP_aes_192_cbc 153 | #define _libssh2_cipher_aes128 EVP_aes_128_cbc 154 | #ifdef HAVE_EVP_AES_128_CTR 155 | #define _libssh2_cipher_aes128ctr EVP_aes_128_ctr 156 | #define _libssh2_cipher_aes192ctr EVP_aes_192_ctr 157 | #define _libssh2_cipher_aes256ctr EVP_aes_256_ctr 158 | #else 159 | #define _libssh2_cipher_aes128ctr _libssh2_EVP_aes_128_ctr 160 | #define _libssh2_cipher_aes192ctr _libssh2_EVP_aes_192_ctr 161 | #define _libssh2_cipher_aes256ctr _libssh2_EVP_aes_256_ctr 162 | #endif 163 | #define _libssh2_cipher_blowfish EVP_bf_cbc 164 | #define _libssh2_cipher_arcfour EVP_rc4 165 | #define _libssh2_cipher_cast5 EVP_cast5_cbc 166 | #define _libssh2_cipher_3des EVP_des_ede3_cbc 167 | 168 | #define _libssh2_cipher_dtor(ctx) EVP_CIPHER_CTX_cleanup(ctx) 169 | 170 | #define _libssh2_bn BIGNUM 171 | #define _libssh2_bn_ctx BN_CTX 172 | #define _libssh2_bn_ctx_new() BN_CTX_new() 173 | #define _libssh2_bn_ctx_free(bnctx) BN_CTX_free(bnctx) 174 | #define _libssh2_bn_init() BN_new() 175 | #define _libssh2_bn_rand(bn, bits, top, bottom) BN_rand(bn, bits, top, bottom) 176 | #define _libssh2_bn_mod_exp(r, a, p, m, ctx) BN_mod_exp(r, a, p, m, ctx) 177 | #define _libssh2_bn_set_word(bn, val) BN_set_word(bn, val) 178 | #define _libssh2_bn_from_bin(bn, len, val) BN_bin2bn(val, len, bn) 179 | #define _libssh2_bn_to_bin(bn, val) BN_bn2bin(bn, val) 180 | #define _libssh2_bn_bytes(bn) BN_num_bytes(bn) 181 | #define _libssh2_bn_bits(bn) BN_num_bits(bn) 182 | #define _libssh2_bn_free(bn) BN_clear_free(bn) 183 | 184 | const EVP_CIPHER *_libssh2_EVP_aes_128_ctr(void); 185 | const EVP_CIPHER *_libssh2_EVP_aes_192_ctr(void); 186 | const EVP_CIPHER *_libssh2_EVP_aes_256_ctr(void); 187 | 188 | -------------------------------------------------------------------------------- /Brake/include/packet.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBSSH2_PACKET_H 2 | #define LIBSSH2_PACKET_H 3 | /* 4 | * Copyright (C) 2010 by Daniel Stenberg 5 | * Author: Daniel Stenberg 6 | * 7 | * Redistribution and use in source and binary forms, 8 | * with or without modification, are permitted provided 9 | * that the following conditions are met: 10 | * 11 | * Redistributions of source code must retain the above 12 | * copyright notice, this list of conditions and the 13 | * following disclaimer. 14 | * 15 | * Redistributions in binary form must reproduce the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer in the documentation and/or other materials 18 | * provided with the distribution. 19 | * 20 | * Neither the name of the copyright holder nor the names 21 | * of any other contributors may be used to endorse or 22 | * promote products derived from this software without 23 | * specific prior written permission. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 26 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 27 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 28 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 30 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 32 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 33 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 34 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 35 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 36 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 37 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 38 | * OF SUCH DAMAGE. 39 | * 40 | */ 41 | 42 | int _libssh2_packet_read(LIBSSH2_SESSION * session); 43 | 44 | int _libssh2_packet_ask(LIBSSH2_SESSION * session, unsigned char packet_type, 45 | unsigned char **data, size_t *data_len, 46 | int match_ofs, 47 | const unsigned char *match_buf, 48 | size_t match_len); 49 | 50 | int _libssh2_packet_askv(LIBSSH2_SESSION * session, 51 | const unsigned char *packet_types, 52 | unsigned char **data, size_t *data_len, 53 | int match_ofs, 54 | const unsigned char *match_buf, 55 | size_t match_len); 56 | int _libssh2_packet_require(LIBSSH2_SESSION * session, 57 | unsigned char packet_type, unsigned char **data, 58 | size_t *data_len, int match_ofs, 59 | const unsigned char *match_buf, 60 | size_t match_len, 61 | packet_require_state_t * state); 62 | int _libssh2_packet_requirev(LIBSSH2_SESSION *session, 63 | const unsigned char *packet_types, 64 | unsigned char **data, size_t *data_len, 65 | int match_ofs, 66 | const unsigned char *match_buf, 67 | size_t match_len, 68 | packet_requirev_state_t * state); 69 | int _libssh2_packet_burn(LIBSSH2_SESSION * session, 70 | libssh2_nonblocking_states * state); 71 | int _libssh2_packet_write(LIBSSH2_SESSION * session, unsigned char *data, 72 | unsigned long data_len); 73 | int _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, 74 | size_t datalen, int macstate); 75 | 76 | #endif /* LIBSSH2_PACKET_H */ 77 | -------------------------------------------------------------------------------- /Brake/include/session.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBSSH2_SESSION_H 2 | #define LIBSSH2_SESSION_H 3 | /* Copyright (c) 2004-2007 Sara Golemon 4 | * Copyright (c) 2009-2010 by Daniel Stenberg 5 | * Copyright (c) 2010 Simon Josefsson 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, 9 | * with or without modification, are permitted provided 10 | * that the following conditions are met: 11 | * 12 | * Redistributions of source code must retain the above 13 | * copyright notice, this list of conditions and the 14 | * following disclaimer. 15 | * 16 | * Redistributions in binary form must reproduce the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer in the documentation and/or other materials 19 | * provided with the distribution. 20 | * 21 | * Neither the name of the copyright holder nor the names 22 | * of any other contributors may be used to endorse or 23 | * promote products derived from this software without 24 | * specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 27 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 28 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 29 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 31 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 34 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 35 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 36 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 37 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 38 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 39 | * OF SUCH DAMAGE. 40 | */ 41 | 42 | /* Conveniance-macros to allow code like this; 43 | 44 | int rc = BLOCK_ADJUST(rc, session, session_startup(session, sock) ); 45 | 46 | int rc = BLOCK_ADJUST_ERRNO(ptr, session, session_startup(session, sock) ); 47 | 48 | The point of course being to make sure that while in non-blocking mode 49 | these always return no matter what the return code is, but in blocking mode 50 | it blocks if EAGAIN is the reason for the return from the underlying 51 | function. 52 | 53 | */ 54 | #define BLOCK_ADJUST(rc,sess,x) \ 55 | do { \ 56 | time_t entry_time = time (NULL); \ 57 | do { \ 58 | rc = x; \ 59 | /* the order of the check below is important to properly deal with \ 60 | the case when the 'sess' is freed */ \ 61 | if((rc != LIBSSH2_ERROR_EAGAIN) || !sess->api_block_mode) \ 62 | break; \ 63 | rc = _libssh2_wait_socket(sess, entry_time); \ 64 | } while(!rc); \ 65 | } while(0) 66 | 67 | /* 68 | * For functions that returns a pointer, we need to check if the API is 69 | * non-blocking and return immediately. If the pointer is non-NULL we return 70 | * immediately. If the API is blocking and we get a NULL we check the errno 71 | * and *only* if that is EAGAIN we loop and wait for socket action. 72 | */ 73 | #define BLOCK_ADJUST_ERRNO(ptr,sess,x) \ 74 | do { \ 75 | time_t entry_time = time (NULL); \ 76 | int rc; \ 77 | do { \ 78 | ptr = x; \ 79 | if(!sess->api_block_mode || \ 80 | (ptr != NULL) || \ 81 | (libssh2_session_last_errno(sess) != LIBSSH2_ERROR_EAGAIN) ) \ 82 | break; \ 83 | rc = _libssh2_wait_socket(sess, entry_time); \ 84 | } while(!rc); \ 85 | } while(0) 86 | 87 | 88 | int _libssh2_wait_socket(LIBSSH2_SESSION *session, time_t entry_time); 89 | 90 | /* this is the lib-internal set blocking function */ 91 | int _libssh2_session_set_blocking(LIBSSH2_SESSION * session, int blocking); 92 | 93 | #endif /* LIBSSH2_SESSION_H */ 94 | -------------------------------------------------------------------------------- /Brake/include/sftp.h: -------------------------------------------------------------------------------- 1 | #ifndef _LIBSSH2_SFTP_H 2 | #define _LIBSSH2_SFTP_H 3 | /* 4 | * Copyright (C) 2010 - 2012 by Daniel Stenberg 5 | * Author: Daniel Stenberg 6 | * 7 | * Redistribution and use in source and binary forms, 8 | * with or without modification, are permitted provided 9 | * that the following conditions are met: 10 | * 11 | * Redistributions of source code must retain the above 12 | * copyright notice, this list of conditions and the 13 | * following disclaimer. 14 | * 15 | * Redistributions in binary form must reproduce the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer in the documentation and/or other materials 18 | * provided with the distribution. 19 | * 20 | * Neither the name of the copyright holder nor the names 21 | * of any other contributors may be used to endorse or 22 | * promote products derived from this software without 23 | * specific prior written permission. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 26 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 27 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 28 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 30 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 32 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 33 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 34 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 35 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 36 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 37 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 38 | * OF SUCH DAMAGE. 39 | * 40 | */ 41 | 42 | /* 43 | * MAX_SFTP_OUTGOING_SIZE MUST not be larger than 32500 or so. This is the 44 | * amount of data sent in each FXP_WRITE packet 45 | */ 46 | #define MAX_SFTP_OUTGOING_SIZE 30000 47 | 48 | /* MAX_SFTP_READ_SIZE is how much data is asked for at max in each FXP_READ 49 | * packets. 50 | */ 51 | #define MAX_SFTP_READ_SIZE 2000 52 | 53 | struct sftp_pipeline_chunk { 54 | struct list_node node; 55 | size_t len; /* WRITE: size of the data to write 56 | READ: how many bytes that was asked for */ 57 | size_t sent; 58 | ssize_t lefttosend; /* if 0, the entire packet has been sent off */ 59 | uint32_t request_id; 60 | unsigned char packet[1]; /* data */ 61 | }; 62 | 63 | struct sftp_zombie_requests { 64 | struct list_node node; 65 | uint32_t request_id; 66 | }; 67 | 68 | #ifndef MIN 69 | #define MIN(x,y) ((x)<(y)?(x):(y)) 70 | #endif 71 | 72 | struct _LIBSSH2_SFTP_PACKET 73 | { 74 | struct list_node node; /* linked list header */ 75 | uint32_t request_id; 76 | unsigned char *data; 77 | size_t data_len; /* payload size */ 78 | }; 79 | 80 | typedef struct _LIBSSH2_SFTP_PACKET LIBSSH2_SFTP_PACKET; 81 | 82 | #define SFTP_HANDLE_MAXLEN 256 /* according to spec! */ 83 | 84 | struct _LIBSSH2_SFTP_HANDLE 85 | { 86 | struct list_node node; 87 | 88 | LIBSSH2_SFTP *sftp; 89 | 90 | char handle[SFTP_HANDLE_MAXLEN]; 91 | size_t handle_len; 92 | 93 | enum { 94 | LIBSSH2_SFTP_HANDLE_FILE, 95 | LIBSSH2_SFTP_HANDLE_DIR 96 | } handle_type; 97 | 98 | union _libssh2_sftp_handle_data 99 | { 100 | struct _libssh2_sftp_handle_file_data 101 | { 102 | libssh2_uint64_t offset; 103 | libssh2_uint64_t offset_sent; 104 | size_t acked; /* container for acked data that hasn't been 105 | returned to caller yet, used for sftp_write */ 106 | 107 | /* 'data' is used by sftp_read() and is allocated data that has 108 | been received already from the server but wasn't returned to 109 | the caller yet. It is of size 'data_len' and 'data_left is the 110 | number of bytes not yet returned, counted from the end of the 111 | buffer. */ 112 | unsigned char *data; 113 | size_t data_len; 114 | size_t data_left; 115 | 116 | char eof; /* we have read to the end */ 117 | } file; 118 | struct _libssh2_sftp_handle_dir_data 119 | { 120 | uint32_t names_left; 121 | void *names_packet; 122 | char *next_name; 123 | } dir; 124 | } u; 125 | 126 | /* State variables used in libssh2_sftp_close_handle() */ 127 | libssh2_nonblocking_states close_state; 128 | uint32_t close_request_id; 129 | unsigned char *close_packet; 130 | 131 | /* list of outstanding packets sent to server */ 132 | struct list_head packet_list; 133 | 134 | }; 135 | 136 | struct _LIBSSH2_SFTP 137 | { 138 | LIBSSH2_CHANNEL *channel; 139 | 140 | uint32_t request_id, version; 141 | 142 | struct list_head packets; 143 | 144 | /* List of FXP_READ responses to ignore because EOF already received. */ 145 | struct list_head zombie_requests; 146 | 147 | /* a list of _LIBSSH2_SFTP_HANDLE structs */ 148 | struct list_head sftp_handles; 149 | 150 | uint32_t last_errno; 151 | 152 | /* Holder for partial packet, use in libssh2_sftp_packet_read() */ 153 | unsigned char partial_size[4]; /* buffer for size field */ 154 | size_t partial_size_len; /* size field length */ 155 | unsigned char *partial_packet; /* The data */ 156 | uint32_t partial_len; /* Desired number of bytes */ 157 | size_t partial_received; /* Bytes received so far */ 158 | 159 | /* Time that libssh2_sftp_packet_requirev() started reading */ 160 | time_t requirev_start; 161 | 162 | /* State variables used in libssh2_sftp_open_ex() */ 163 | libssh2_nonblocking_states open_state; 164 | unsigned char *open_packet; 165 | uint32_t open_packet_len; /* 32 bit on the wire */ 166 | size_t open_packet_sent; 167 | uint32_t open_request_id; 168 | 169 | /* State variable used in sftp_read() */ 170 | libssh2_nonblocking_states read_state; 171 | 172 | /* State variable used in sftp_packet_read() */ 173 | libssh2_nonblocking_states packet_state; 174 | 175 | /* State variable used in sftp_write() */ 176 | libssh2_nonblocking_states write_state; 177 | 178 | /* State variables used in libssh2_sftp_readdir() */ 179 | libssh2_nonblocking_states readdir_state; 180 | unsigned char *readdir_packet; 181 | uint32_t readdir_request_id; 182 | 183 | /* State variables used in libssh2_sftp_fstat_ex() */ 184 | libssh2_nonblocking_states fstat_state; 185 | unsigned char *fstat_packet; 186 | uint32_t fstat_request_id; 187 | 188 | /* State variables used in libssh2_sftp_unlink_ex() */ 189 | libssh2_nonblocking_states unlink_state; 190 | unsigned char *unlink_packet; 191 | uint32_t unlink_request_id; 192 | 193 | /* State variables used in libssh2_sftp_rename_ex() */ 194 | libssh2_nonblocking_states rename_state; 195 | unsigned char *rename_packet; 196 | unsigned char *rename_s; 197 | uint32_t rename_request_id; 198 | 199 | /* State variables used in libssh2_sftp_fstatvfs() */ 200 | libssh2_nonblocking_states fstatvfs_state; 201 | unsigned char *fstatvfs_packet; 202 | uint32_t fstatvfs_request_id; 203 | 204 | /* State variables used in libssh2_sftp_statvfs() */ 205 | libssh2_nonblocking_states statvfs_state; 206 | unsigned char *statvfs_packet; 207 | uint32_t statvfs_request_id; 208 | 209 | /* State variables used in libssh2_sftp_mkdir() */ 210 | libssh2_nonblocking_states mkdir_state; 211 | unsigned char *mkdir_packet; 212 | uint32_t mkdir_request_id; 213 | 214 | /* State variables used in libssh2_sftp_rmdir() */ 215 | libssh2_nonblocking_states rmdir_state; 216 | unsigned char *rmdir_packet; 217 | uint32_t rmdir_request_id; 218 | 219 | /* State variables used in libssh2_sftp_stat() */ 220 | libssh2_nonblocking_states stat_state; 221 | unsigned char *stat_packet; 222 | uint32_t stat_request_id; 223 | 224 | /* State variables used in libssh2_sftp_symlink() */ 225 | libssh2_nonblocking_states symlink_state; 226 | unsigned char *symlink_packet; 227 | uint32_t symlink_request_id; 228 | }; 229 | 230 | #endif 231 | -------------------------------------------------------------------------------- /Brake/include/transport.h: -------------------------------------------------------------------------------- 1 | #ifndef __LIBSSH2_TRANSPORT_H 2 | #define __LIBSSH2_TRANSPORT_H 3 | 4 | /* Copyright (C) 2007 The Written Word, Inc. All rights reserved. 5 | * Copyright (C) 2009-2010 by Daniel Stenberg 6 | * Author: Daniel Stenberg 7 | * 8 | * Redistribution and use in source and binary forms, 9 | * with or without modification, are permitted provided 10 | * that the following conditions are met: 11 | * 12 | * Redistributions of source code must retain the above 13 | * copyright notice, this list of conditions and the 14 | * following disclaimer. 15 | * 16 | * Redistributions in binary form must reproduce the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer in the documentation and/or other materials 19 | * provided with the distribution. 20 | * 21 | * Neither the name of the copyright holder nor the names 22 | * of any other contributors may be used to endorse or 23 | * promote products derived from this software without 24 | * specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 27 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 28 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 29 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 31 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 34 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 35 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 36 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 37 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 38 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 39 | * OF SUCH DAMAGE. 40 | * 41 | * This file handles reading and writing to the SECSH transport layer. RFC4253. 42 | */ 43 | 44 | #include "libssh2_priv.h" 45 | #include "packet.h" 46 | 47 | 48 | /* 49 | * libssh2_transport_send 50 | * 51 | * Send a packet, encrypting it and adding a MAC code if necessary 52 | * Returns 0 on success, non-zero on failure. 53 | * 54 | * The data is provided as _two_ data areas that are combined by this 55 | * function. The 'data' part is sent immediately before 'data2'. 'data2' can 56 | * be set to NULL (or data2_len to 0) to only use a single part. 57 | * 58 | * Returns LIBSSH2_ERROR_EAGAIN if it would block or if the whole packet was 59 | * not sent yet. If it does so, the caller should call this function again as 60 | * soon as it is likely that more data can be sent, and this function MUST 61 | * then be called with the same argument set (same data pointer and same 62 | * data_len) until ERROR_NONE or failure is returned. 63 | * 64 | * This function DOES NOT call _libssh2_error() on any errors. 65 | */ 66 | int _libssh2_transport_send(LIBSSH2_SESSION *session, 67 | const unsigned char *data, size_t data_len, 68 | const unsigned char *data2, size_t data2_len); 69 | 70 | /* 71 | * _libssh2_transport_read 72 | * 73 | * Collect a packet into the input brigade block only controls whether or not 74 | * to wait for a packet to start. 75 | * 76 | * Returns packet type added to input brigade (PACKET_NONE if nothing added), 77 | * or PACKET_FAIL on failure and PACKET_EAGAIN if it couldn't process a full 78 | * packet. 79 | */ 80 | 81 | /* 82 | * This function reads the binary stream as specified in chapter 6 of RFC4253 83 | * "The Secure Shell (SSH) Transport Layer Protocol" 84 | */ 85 | int _libssh2_transport_read(LIBSSH2_SESSION * session); 86 | 87 | #endif /* __LIBSSH2_TRANSPORT_H */ 88 | -------------------------------------------------------------------------------- /Brake/include/userauth.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBSSH2_USERAUTH_H 2 | #define LIBSSH2_USERAUTH_H 3 | /* Copyright (c) 2004-2007, Sara Golemon 4 | * Copyright (c) 2009-2010 by Daniel Stenberg 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, 8 | * with or without modification, are permitted provided 9 | * that the following conditions are met: 10 | * 11 | * Redistributions of source code must retain the above 12 | * copyright notice, this list of conditions and the 13 | * following disclaimer. 14 | * 15 | * Redistributions in binary form must reproduce the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer in the documentation and/or other materials 18 | * provided with the distribution. 19 | * 20 | * Neither the name of the copyright holder nor the names 21 | * of any other contributors may be used to endorse or 22 | * promote products derived from this software without 23 | * specific prior written permission. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 26 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 27 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 28 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 30 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 32 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 33 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 34 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 35 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 36 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 37 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 38 | * OF SUCH DAMAGE. 39 | */ 40 | 41 | int 42 | _libssh2_userauth_publickey(LIBSSH2_SESSION *session, 43 | const char *username, 44 | unsigned int username_len, 45 | const unsigned char *pubkeydata, 46 | unsigned long pubkeydata_len, 47 | LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC((*sign_callback)), 48 | void *abstract); 49 | 50 | #endif /* LIBSSH2_USERAUTH_H */ 51 | -------------------------------------------------------------------------------- /Brake/lib/libssh2.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KJCracks/Brake-for-Mac/7825b557d27e09b3bdc179b06b8190c2242e3007/Brake/lib/libssh2.a -------------------------------------------------------------------------------- /Brake/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Brake 4 | // 5 | // Created by Thomas Hedderwick on 17/10/2013. 6 | // Copyright (c) 2013 Dybero. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, const char * argv[]) 12 | { 13 | return NSApplicationMain(argc, argv); 14 | } 15 | -------------------------------------------------------------------------------- /BrakeTests/BrakeTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.dybero.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /BrakeTests/BrakeTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // BrakeTests.m 3 | // BrakeTests 4 | // 5 | // Created by Thomas Hedderwick on 17/10/2013. 6 | // Copyright (c) 2013 Dybero. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface BrakeTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation BrakeTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /BrakeTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /External Libraries/AUTHORS: -------------------------------------------------------------------------------- 1 | Author(s): 2 | Aris Adamantiadis (project initiator) 3 | 4 | Andreas Schneider (developer) 5 | 6 | Nick Zitzmann (mostly client SFTP stuff) 7 | 8 | Norbert Kiesel (getaddrinfo and other patches) 9 | 10 | Jean-Philippe Garcia Ballester (Port to libgcrypt and configure.in voodoo, debian packaging) 11 | 12 | Contributor(s): 13 | 14 | Laurent Bigonville (debian packaging) 15 | 16 | -------------------------------------------------------------------------------- /External Libraries/BSD: -------------------------------------------------------------------------------- 1 | Some parts are under the BSDv2 License : 2 | 3 | 4 | Copyright (c) 2000 Markus Friedl. All rights reserved. 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | 25 | -------------------------------------------------------------------------------- /External Libraries/libssh/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(libssh-headers C) 2 | 3 | set(libssh_HDRS 4 | callbacks.h 5 | libssh.h 6 | ssh2.h 7 | legacy.h 8 | ) 9 | 10 | if (WITH_SFTP) 11 | set(libssh_HDRS 12 | ${libssh_HDRS} 13 | sftp.h 14 | ) 15 | endif (WITH_SFTP) 16 | 17 | if (WITH_SSH1) 18 | set(libssh_HDRS 19 | ${libssh_HDRS} 20 | ssh1.h 21 | ) 22 | endif (WITH_SSH1) 23 | 24 | if (WITH_SERVER) 25 | set(libssh_HDRS 26 | ${libssh_HDRS} 27 | server.h 28 | ) 29 | endif (WITH_SERVER) 30 | 31 | install( 32 | FILES 33 | ${libssh_HDRS} 34 | DESTINATION 35 | ${INCLUDE_INSTALL_DIR}/${APPLICATION_NAME} 36 | COMPONENT 37 | headers 38 | ) 39 | 40 | -------------------------------------------------------------------------------- /External Libraries/libssh/agent.h: -------------------------------------------------------------------------------- 1 | #ifndef __AGENT_H 2 | #define __AGENT_H 3 | 4 | #include "libssh/libssh.h" 5 | 6 | /* Messages for the authentication agent connection. */ 7 | #define SSH_AGENTC_REQUEST_RSA_IDENTITIES 1 8 | #define SSH_AGENT_RSA_IDENTITIES_ANSWER 2 9 | #define SSH_AGENTC_RSA_CHALLENGE 3 10 | #define SSH_AGENT_RSA_RESPONSE 4 11 | #define SSH_AGENT_FAILURE 5 12 | #define SSH_AGENT_SUCCESS 6 13 | #define SSH_AGENTC_ADD_RSA_IDENTITY 7 14 | #define SSH_AGENTC_REMOVE_RSA_IDENTITY 8 15 | #define SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES 9 16 | 17 | /* private OpenSSH extensions for SSH2 */ 18 | #define SSH2_AGENTC_REQUEST_IDENTITIES 11 19 | #define SSH2_AGENT_IDENTITIES_ANSWER 12 20 | #define SSH2_AGENTC_SIGN_REQUEST 13 21 | #define SSH2_AGENT_SIGN_RESPONSE 14 22 | #define SSH2_AGENTC_ADD_IDENTITY 17 23 | #define SSH2_AGENTC_REMOVE_IDENTITY 18 24 | #define SSH2_AGENTC_REMOVE_ALL_IDENTITIES 19 25 | 26 | /* smartcard */ 27 | #define SSH_AGENTC_ADD_SMARTCARD_KEY 20 28 | #define SSH_AGENTC_REMOVE_SMARTCARD_KEY 21 29 | 30 | /* lock/unlock the agent */ 31 | #define SSH_AGENTC_LOCK 22 32 | #define SSH_AGENTC_UNLOCK 23 33 | 34 | /* add key with constraints */ 35 | #define SSH_AGENTC_ADD_RSA_ID_CONSTRAINED 24 36 | #define SSH2_AGENTC_ADD_ID_CONSTRAINED 25 37 | #define SSH_AGENTC_ADD_SMARTCARD_KEY_CONSTRAINED 26 38 | 39 | #define SSH_AGENT_CONSTRAIN_LIFETIME 1 40 | #define SSH_AGENT_CONSTRAIN_CONFIRM 2 41 | 42 | /* extended failure messages */ 43 | #define SSH2_AGENT_FAILURE 30 44 | 45 | /* additional error code for ssh.com's ssh-agent2 */ 46 | #define SSH_COM_AGENT2_FAILURE 102 47 | 48 | #define SSH_AGENT_OLD_SIGNATURE 0x01 49 | 50 | struct ssh_agent_struct { 51 | struct ssh_socket_struct *sock; 52 | ssh_buffer ident; 53 | unsigned int count; 54 | }; 55 | 56 | #ifndef _WIN32 57 | /* agent.c */ 58 | /** 59 | * @brief Create a new ssh agent structure. 60 | * 61 | * @return An allocated ssh agent structure or NULL on error. 62 | */ 63 | struct ssh_agent_struct *agent_new(struct ssh_session_struct *session); 64 | 65 | void agent_close(struct ssh_agent_struct *agent); 66 | 67 | /** 68 | * @brief Free an allocated ssh agent structure. 69 | * 70 | * @param agent The ssh agent structure to free. 71 | */ 72 | void agent_free(struct ssh_agent_struct *agent); 73 | 74 | /** 75 | * @brief Check if the ssh agent is running. 76 | * 77 | * @param session The ssh session to check for the agent. 78 | * 79 | * @return 1 if it is running, 0 if not. 80 | */ 81 | int agent_is_running(struct ssh_session_struct *session); 82 | 83 | int agent_get_ident_count(struct ssh_session_struct *session); 84 | 85 | struct ssh_public_key_struct *agent_get_next_ident(struct ssh_session_struct *session, 86 | char **comment); 87 | 88 | struct ssh_public_key_struct *agent_get_first_ident(struct ssh_session_struct *session, 89 | char **comment); 90 | 91 | ssh_string agent_sign_data(struct ssh_session_struct *session, 92 | struct ssh_buffer_struct *data, 93 | struct ssh_public_key_struct *pubkey); 94 | #endif 95 | 96 | #endif /* __AGENT_H */ 97 | /* vim: set ts=2 sw=2 et cindent: */ 98 | -------------------------------------------------------------------------------- /External Libraries/libssh/auth.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2009 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef AUTH_H_ 23 | #define AUTH_H_ 24 | #include "config.h" 25 | #include "libssh/callbacks.h" 26 | 27 | SSH_PACKET_CALLBACK(ssh_packet_userauth_banner); 28 | SSH_PACKET_CALLBACK(ssh_packet_userauth_failure); 29 | SSH_PACKET_CALLBACK(ssh_packet_userauth_success); 30 | SSH_PACKET_CALLBACK(ssh_packet_userauth_pk_ok); 31 | SSH_PACKET_CALLBACK(ssh_packet_userauth_info_request); 32 | 33 | #ifdef WITH_SSH1 34 | void ssh_auth1_handler(ssh_session session, uint8_t type); 35 | 36 | /* auth1.c */ 37 | int ssh_userauth1_none(ssh_session session, const char *username); 38 | int ssh_userauth1_offer_pubkey(ssh_session session, const char *username, 39 | int type, ssh_string pubkey); 40 | int ssh_userauth1_password(ssh_session session, const char *username, 41 | const char *password); 42 | 43 | 44 | #endif 45 | 46 | /** @internal 47 | * States of authentication in the client-side. They describe 48 | * what was the last response from the server 49 | */ 50 | enum ssh_auth_state_e { 51 | /** No authentication asked */ 52 | SSH_AUTH_STATE_NONE=0, 53 | /** Last authentication response was a partial success */ 54 | SSH_AUTH_STATE_PARTIAL, 55 | /** Last authentication response was a success */ 56 | SSH_AUTH_STATE_SUCCESS, 57 | /** Last authentication response was failed */ 58 | SSH_AUTH_STATE_FAILED, 59 | /** Last authentication was erroneous */ 60 | SSH_AUTH_STATE_ERROR, 61 | /** Last state was a keyboard-interactive ask for info */ 62 | SSH_AUTH_STATE_INFO, 63 | /** Last state was a public key accepted for authentication */ 64 | SSH_AUTH_STATE_PK_OK, 65 | /** We asked for a keyboard-interactive authentication */ 66 | SSH_AUTH_STATE_KBDINT_SENT 67 | 68 | }; 69 | 70 | /** @internal 71 | * @brief states of the authentication service request 72 | */ 73 | enum ssh_auth_service_state_e { 74 | /** initial state */ 75 | SSH_AUTH_SERVICE_NONE=0, 76 | /** Authentication service request packet sent */ 77 | SSH_AUTH_SERVICE_SENT, 78 | /** Service accepted */ 79 | SSH_AUTH_SERVICE_ACCEPTED, 80 | /** Access to service denied (fatal) */ 81 | SSH_AUTH_SERVICE_DENIED, 82 | /** Specific to SSH1 */ 83 | SSH_AUTH_SERVICE_USER_SENT 84 | }; 85 | 86 | #endif /* AUTH_H_ */ 87 | -------------------------------------------------------------------------------- /External Libraries/libssh/bind.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2010 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef BIND_H_ 23 | #define BIND_H_ 24 | 25 | #include "libssh/priv.h" 26 | #include "libssh/session.h" 27 | 28 | struct ssh_bind_struct { 29 | struct ssh_common_struct common; /* stuff common to ssh_bind and ssh_session */ 30 | struct ssh_bind_callbacks_struct *bind_callbacks; 31 | void *bind_callbacks_userdata; 32 | 33 | struct ssh_poll_handle_struct *poll; 34 | /* options */ 35 | char *wanted_methods[10]; 36 | char *banner; 37 | char *dsakey; 38 | char *rsakey; 39 | char *bindaddr; 40 | socket_t bindfd; 41 | unsigned int bindport; 42 | int blocking; 43 | int toaccept; 44 | }; 45 | 46 | struct ssh_poll_handle_struct *ssh_bind_get_poll(struct ssh_bind_struct 47 | *sshbind); 48 | 49 | 50 | #endif /* BIND_H_ */ 51 | -------------------------------------------------------------------------------- /External Libraries/libssh/buffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2009 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef BUFFER_H_ 23 | #define BUFFER_H_ 24 | 25 | #include "libssh/libssh.h" 26 | /* 27 | * Describes a buffer state 28 | * [XXXXXXXXXXXXDATA PAYLOAD XXXXXXXXXXXXXXXXXXXXXXXX] 29 | * ^ ^ ^ ^] 30 | * \_data points\_pos points here \_used points here | / 31 | * here Allocated 32 | */ 33 | struct ssh_buffer_struct { 34 | char *data; 35 | uint32_t used; 36 | uint32_t allocated; 37 | uint32_t pos; 38 | }; 39 | 40 | LIBSSH_API void ssh_buffer_free(ssh_buffer buffer); 41 | LIBSSH_API void *ssh_buffer_get_begin(ssh_buffer buffer); 42 | LIBSSH_API uint32_t ssh_buffer_get_len(ssh_buffer buffer); 43 | LIBSSH_API ssh_buffer ssh_buffer_new(void); 44 | int buffer_add_ssh_string(ssh_buffer buffer, ssh_string string); 45 | int buffer_add_u8(ssh_buffer buffer, uint8_t data); 46 | int buffer_add_u16(ssh_buffer buffer, uint16_t data); 47 | int buffer_add_u32(ssh_buffer buffer, uint32_t data); 48 | int buffer_add_u64(ssh_buffer buffer, uint64_t data); 49 | int buffer_add_data(ssh_buffer buffer, const void *data, uint32_t len); 50 | int buffer_prepend_data(ssh_buffer buffer, const void *data, uint32_t len); 51 | int buffer_add_buffer(ssh_buffer buffer, ssh_buffer source); 52 | int buffer_reinit(ssh_buffer buffer); 53 | 54 | /* buffer_get_rest returns a pointer to the current position into the buffer */ 55 | void *buffer_get_rest(ssh_buffer buffer); 56 | /* buffer_get_rest_len returns the number of bytes which can be read */ 57 | uint32_t buffer_get_rest_len(ssh_buffer buffer); 58 | 59 | /* buffer_read_*() returns the number of bytes read, except for ssh strings */ 60 | int buffer_get_u8(ssh_buffer buffer, uint8_t *data); 61 | int buffer_get_u32(ssh_buffer buffer, uint32_t *data); 62 | int buffer_get_u64(ssh_buffer buffer, uint64_t *data); 63 | 64 | uint32_t buffer_get_data(ssh_buffer buffer, void *data, uint32_t requestedlen); 65 | /* buffer_get_ssh_string() is an exception. if the String read is too large or invalid, it will answer NULL. */ 66 | ssh_string buffer_get_ssh_string(ssh_buffer buffer); 67 | /* gets a string out of a SSH-1 mpint */ 68 | ssh_string buffer_get_mpint(ssh_buffer buffer); 69 | /* buffer_pass_bytes acts as if len bytes have been read (used for padding) */ 70 | uint32_t buffer_pass_bytes_end(ssh_buffer buffer, uint32_t len); 71 | uint32_t buffer_pass_bytes(ssh_buffer buffer, uint32_t len); 72 | 73 | #endif /* BUFFER_H_ */ 74 | -------------------------------------------------------------------------------- /External Libraries/libssh/channels.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2009 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef CHANNELS_H_ 23 | #define CHANNELS_H_ 24 | #include "libssh/priv.h" 25 | 26 | /** @internal 27 | * Describes the different possible states in a 28 | * outgoing (client) channel request 29 | */ 30 | enum ssh_channel_request_state_e { 31 | /** No request has been made */ 32 | SSH_CHANNEL_REQ_STATE_NONE = 0, 33 | /** A request has been made and answer is pending */ 34 | SSH_CHANNEL_REQ_STATE_PENDING, 35 | /** A request has been replied and accepted */ 36 | SSH_CHANNEL_REQ_STATE_ACCEPTED, 37 | /** A request has been replied and refused */ 38 | SSH_CHANNEL_REQ_STATE_DENIED, 39 | /** A request has been replied and an error happend */ 40 | SSH_CHANNEL_REQ_STATE_ERROR 41 | }; 42 | 43 | enum ssh_channel_state_e { 44 | SSH_CHANNEL_STATE_NOT_OPEN = 0, 45 | SSH_CHANNEL_STATE_OPEN_DENIED, 46 | SSH_CHANNEL_STATE_OPEN, 47 | SSH_CHANNEL_STATE_CLOSED 48 | }; 49 | 50 | struct ssh_channel_struct { 51 | ssh_session session; /* SSH_SESSION pointer */ 52 | uint32_t local_channel; 53 | uint32_t local_window; 54 | int local_eof; 55 | uint32_t local_maxpacket; 56 | 57 | uint32_t remote_channel; 58 | uint32_t remote_window; 59 | int remote_eof; /* end of file received */ 60 | uint32_t remote_maxpacket; 61 | enum ssh_channel_state_e state; 62 | int delayed_close; 63 | ssh_buffer stdout_buffer; 64 | ssh_buffer stderr_buffer; 65 | void *userarg; 66 | int version; 67 | int blocking; 68 | int exit_status; 69 | enum ssh_channel_request_state_e request_state; 70 | ssh_channel_callbacks callbacks; 71 | }; 72 | 73 | SSH_PACKET_CALLBACK(ssh_packet_channel_open_conf); 74 | SSH_PACKET_CALLBACK(ssh_packet_channel_open_fail); 75 | SSH_PACKET_CALLBACK(ssh_packet_channel_success); 76 | SSH_PACKET_CALLBACK(ssh_packet_channel_failure); 77 | SSH_PACKET_CALLBACK(ssh_request_success); 78 | SSH_PACKET_CALLBACK(ssh_request_denied); 79 | 80 | SSH_PACKET_CALLBACK(channel_rcv_change_window); 81 | SSH_PACKET_CALLBACK(channel_rcv_eof); 82 | SSH_PACKET_CALLBACK(channel_rcv_close); 83 | SSH_PACKET_CALLBACK(channel_rcv_request); 84 | SSH_PACKET_CALLBACK(channel_rcv_data); 85 | 86 | ssh_channel ssh_channel_new(ssh_session session); 87 | int channel_default_bufferize(ssh_channel channel, void *data, int len, 88 | int is_stderr); 89 | uint32_t ssh_channel_new_id(ssh_session session); 90 | ssh_channel ssh_channel_from_local(ssh_session session, uint32_t id); 91 | int channel_write_common(ssh_channel channel, const void *data, 92 | uint32_t len, int is_stderr); 93 | #ifdef WITH_SSH1 94 | SSH_PACKET_CALLBACK(ssh_packet_data1); 95 | SSH_PACKET_CALLBACK(ssh_packet_close1); 96 | SSH_PACKET_CALLBACK(ssh_packet_exist_status1); 97 | 98 | /* channels1.c */ 99 | int channel_open_session1(ssh_channel channel); 100 | int channel_request_pty_size1(ssh_channel channel, const char *terminal, 101 | int cols, int rows); 102 | int channel_change_pty_size1(ssh_channel channel, int cols, int rows); 103 | int channel_request_shell1(ssh_channel channel); 104 | int channel_request_exec1(ssh_channel channel, const char *cmd); 105 | int channel_write1(ssh_channel channel, const void *data, int len); 106 | ssh_channel ssh_get_channel1(ssh_session session); 107 | #endif 108 | 109 | #endif /* CHANNELS_H_ */ 110 | -------------------------------------------------------------------------------- /External Libraries/libssh/crypto.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2003,2009 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | /* 23 | * crypto.h is an include file for internal cryptographic structures of libssh 24 | */ 25 | 26 | #ifndef _CRYPTO_H_ 27 | #define _CRYPTO_H_ 28 | 29 | #include "config.h" 30 | 31 | #ifdef HAVE_LIBGCRYPT 32 | #include 33 | #endif 34 | #include "libssh/wrapper.h" 35 | 36 | #ifdef cbc_encrypt 37 | #undef cbc_encrypt 38 | #endif 39 | #ifdef cbc_decrypt 40 | #undef cbc_decrypt 41 | #endif 42 | 43 | struct ssh_crypto_struct { 44 | bignum e,f,x,k,y; 45 | unsigned char session_id[SHA_DIGEST_LEN]; 46 | 47 | unsigned char encryptIV[SHA_DIGEST_LEN*2]; 48 | unsigned char decryptIV[SHA_DIGEST_LEN*2]; 49 | 50 | unsigned char decryptkey[SHA_DIGEST_LEN*2]; 51 | unsigned char encryptkey[SHA_DIGEST_LEN*2]; 52 | 53 | unsigned char encryptMAC[SHA_DIGEST_LEN]; 54 | unsigned char decryptMAC[SHA_DIGEST_LEN]; 55 | unsigned char hmacbuf[EVP_MAX_MD_SIZE]; 56 | struct crypto_struct *in_cipher, *out_cipher; /* the cipher structures/objects */ 57 | ssh_string server_pubkey; 58 | const char *server_pubkey_type; 59 | int do_compress_out; /* idem */ 60 | int do_compress_in; /* don't set them, set the option instead */ 61 | int delayed_compress_in; /* Use of zlib@openssh.org */ 62 | int delayed_compress_out; 63 | void *compress_out_ctx; /* don't touch it */ 64 | void *compress_in_ctx; /* really, don't */ 65 | }; 66 | 67 | struct crypto_struct { 68 | const char *name; /* ssh name of the algorithm */ 69 | unsigned int blocksize; /* blocksize of the algo */ 70 | unsigned int keylen; /* length of the key structure */ 71 | #ifdef HAVE_LIBGCRYPT 72 | gcry_cipher_hd_t *key; 73 | #elif defined HAVE_LIBCRYPTO 74 | void *key; /* a key buffer allocated for the algo */ 75 | #endif 76 | unsigned int keysize; /* bytes of key used. != keylen */ 77 | #ifdef HAVE_LIBGCRYPT 78 | /* sets the new key for immediate use */ 79 | int (*set_encrypt_key)(struct crypto_struct *cipher, void *key, void *IV); 80 | int (*set_decrypt_key)(struct crypto_struct *cipher, void *key, void *IV); 81 | void (*cbc_encrypt)(struct crypto_struct *cipher, void *in, void *out, 82 | unsigned long len); 83 | void (*cbc_decrypt)(struct crypto_struct *cipher, void *in, void *out, 84 | unsigned long len); 85 | #elif defined HAVE_LIBCRYPTO 86 | /* sets the new key for immediate use */ 87 | int (*set_encrypt_key)(struct crypto_struct *cipher, void *key); 88 | int (*set_decrypt_key)(struct crypto_struct *cipher, void *key); 89 | void (*cbc_encrypt)(struct crypto_struct *cipher, void *in, void *out, 90 | unsigned long len, void *IV); 91 | void (*cbc_decrypt)(struct crypto_struct *cipher, void *in, void *out, 92 | unsigned long len, void *IV); 93 | #endif 94 | }; 95 | 96 | /* vim: set ts=2 sw=2 et cindent: */ 97 | #endif /* _CRYPTO_H_ */ 98 | -------------------------------------------------------------------------------- /External Libraries/libssh/dh.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2009 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef DH_H_ 23 | #define DH_H_ 24 | #include "config.h" 25 | 26 | /* DH key generation */ 27 | #include "libssh/keys.h" 28 | 29 | void ssh_print_bignum(const char *which,bignum num); 30 | int dh_generate_e(ssh_session session); 31 | int dh_generate_f(ssh_session session); 32 | int dh_generate_x(ssh_session session); 33 | int dh_generate_y(ssh_session session); 34 | 35 | int ssh_crypto_init(void); 36 | void ssh_crypto_finalize(void); 37 | 38 | ssh_string dh_get_e(ssh_session session); 39 | ssh_string dh_get_f(ssh_session session); 40 | int dh_import_f(ssh_session session,ssh_string f_string); 41 | int dh_import_e(ssh_session session, ssh_string e_string); 42 | void dh_import_pubkey(ssh_session session,ssh_string pubkey_string); 43 | int dh_build_k(ssh_session session); 44 | int make_sessionid(ssh_session session); 45 | /* add data for the final cookie */ 46 | int hashbufin_add_cookie(ssh_session session, unsigned char *cookie); 47 | int hashbufout_add_cookie(ssh_session session); 48 | int generate_session_keys(ssh_session session); 49 | int sig_verify(ssh_session session, ssh_public_key pubkey, 50 | SIGNATURE *signature, unsigned char *digest, int size); 51 | /* returns 1 if server signature ok, 0 otherwise. The NEXT crypto is checked, not the current one */ 52 | int signature_verify(ssh_session session,ssh_string signature); 53 | bignum make_string_bn(ssh_string string); 54 | ssh_string make_bignum_string(bignum num); 55 | 56 | 57 | #endif /* DH_H_ */ 58 | -------------------------------------------------------------------------------- /External Libraries/libssh/kex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2009 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef KEX_H_ 23 | #define KEX_H_ 24 | 25 | #include "libssh/priv.h" 26 | #include "libssh/callbacks.h" 27 | 28 | SSH_PACKET_CALLBACK(ssh_packet_kexinit); 29 | #ifdef WITH_SSH1 30 | SSH_PACKET_CALLBACK(ssh_packet_publickey1); 31 | #endif 32 | 33 | #endif /* KEX_H_ */ 34 | -------------------------------------------------------------------------------- /External Libraries/libssh/keyfiles.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2009 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef KEYFILES_H_ 23 | #define KEYFILES_H_ 24 | 25 | /* in keyfiles.c */ 26 | 27 | ssh_private_key _privatekey_from_file(void *session, const char *filename, 28 | int type); 29 | ssh_string try_publickey_from_file(ssh_session session, 30 | struct ssh_keys_struct keytab, 31 | char **privkeyfile, int *type); 32 | 33 | #endif /* KEYFILES_H_ */ 34 | -------------------------------------------------------------------------------- /External Libraries/libssh/keys.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2009 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef KEYS_H_ 23 | #define KEYS_H_ 24 | 25 | #include "config.h" 26 | #include "libssh/libssh.h" 27 | #include "libssh/wrapper.h" 28 | 29 | struct ssh_public_key_struct { 30 | int type; 31 | const char *type_c; /* Don't free it ! it is static */ 32 | #ifdef HAVE_LIBGCRYPT 33 | gcry_sexp_t dsa_pub; 34 | gcry_sexp_t rsa_pub; 35 | #elif HAVE_LIBCRYPTO 36 | DSA *dsa_pub; 37 | RSA *rsa_pub; 38 | #endif 39 | }; 40 | 41 | struct ssh_private_key_struct { 42 | int type; 43 | #ifdef HAVE_LIBGCRYPT 44 | gcry_sexp_t dsa_priv; 45 | gcry_sexp_t rsa_priv; 46 | #elif defined HAVE_LIBCRYPTO 47 | DSA *dsa_priv; 48 | RSA *rsa_priv; 49 | #endif 50 | }; 51 | 52 | typedef struct signature_struct { 53 | int type; 54 | #ifdef HAVE_LIBGCRYPT 55 | gcry_sexp_t dsa_sign; 56 | gcry_sexp_t rsa_sign; 57 | #elif defined HAVE_LIBCRYPTO 58 | DSA_SIG *dsa_sign; 59 | ssh_string rsa_sign; 60 | #endif 61 | } SIGNATURE; 62 | 63 | const char *ssh_type_to_char(int type); 64 | int ssh_type_from_name(const char *name); 65 | ssh_buffer ssh_userauth_build_digest(ssh_session session, ssh_message msg, char *service); 66 | 67 | ssh_private_key privatekey_make_dss(ssh_session session, ssh_buffer buffer); 68 | ssh_private_key privatekey_make_rsa(ssh_session session, ssh_buffer buffer, 69 | const char *type); 70 | ssh_private_key privatekey_from_string(ssh_session session, ssh_string privkey_s); 71 | 72 | ssh_public_key publickey_make_dss(ssh_session session, ssh_buffer buffer); 73 | ssh_public_key publickey_make_rsa(ssh_session session, ssh_buffer buffer, int type); 74 | ssh_public_key publickey_from_string(ssh_session session, ssh_string pubkey_s); 75 | SIGNATURE *signature_from_string(ssh_session session, ssh_string signature,ssh_public_key pubkey,int needed_type); 76 | void signature_free(SIGNATURE *sign); 77 | ssh_string ssh_do_sign_with_agent(struct ssh_session_struct *session, 78 | struct ssh_buffer_struct *buf, struct ssh_public_key_struct *publickey); 79 | ssh_string ssh_do_sign(ssh_session session,ssh_buffer sigbuf, 80 | ssh_private_key privatekey); 81 | ssh_string ssh_sign_session_id(ssh_session session, ssh_private_key privatekey); 82 | ssh_string ssh_encrypt_rsa1(ssh_session session, ssh_string data, ssh_public_key key); 83 | 84 | #endif /* KEYS_H_ */ 85 | -------------------------------------------------------------------------------- /External Libraries/libssh/legacy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2010 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | /* Since libssh.h includes legacy.h, it's important that libssh.h is included 23 | * first. we don't define LEGACY_H now because we want it to be defined when 24 | * included from libssh.h 25 | * All function calls declared in this header are deprecated and meant to be 26 | * removed in future. 27 | */ 28 | 29 | #include "libssh/libssh.h" 30 | 31 | #ifndef LEGACY_H_ 32 | #define LEGACY_H_ 33 | LIBSSH_API void buffer_free(ssh_buffer buffer); 34 | LIBSSH_API void *buffer_get(ssh_buffer buffer); 35 | LIBSSH_API uint32_t buffer_get_len(ssh_buffer buffer); 36 | LIBSSH_API ssh_buffer buffer_new(void); 37 | 38 | LIBSSH_API ssh_channel channel_accept_x11(ssh_channel channel, int timeout_ms); 39 | LIBSSH_API int channel_change_pty_size(ssh_channel channel,int cols,int rows); 40 | LIBSSH_API ssh_channel channel_forward_accept(ssh_session session, int timeout_ms); 41 | LIBSSH_API int channel_close(ssh_channel channel); 42 | LIBSSH_API int channel_forward_cancel(ssh_session session, const char *address, int port); 43 | LIBSSH_API int channel_forward_listen(ssh_session session, const char *address, int port, int *bound_port); 44 | LIBSSH_API void channel_free(ssh_channel channel); 45 | LIBSSH_API int channel_get_exit_status(ssh_channel channel); 46 | LIBSSH_API ssh_session channel_get_session(ssh_channel channel); 47 | LIBSSH_API int channel_is_closed(ssh_channel channel); 48 | LIBSSH_API int channel_is_eof(ssh_channel channel); 49 | LIBSSH_API int channel_is_open(ssh_channel channel); 50 | LIBSSH_API ssh_channel channel_new(ssh_session session); 51 | LIBSSH_API int channel_open_forward(ssh_channel channel, const char *remotehost, 52 | int remoteport, const char *sourcehost, int localport); 53 | LIBSSH_API int channel_open_session(ssh_channel channel); 54 | LIBSSH_API int channel_poll(ssh_channel channel, int is_stderr); 55 | LIBSSH_API int channel_read(ssh_channel channel, void *dest, uint32_t count, int is_stderr); 56 | 57 | LIBSSH_API int channel_read_buffer(ssh_channel channel, ssh_buffer buffer, uint32_t count, 58 | int is_stderr); 59 | 60 | LIBSSH_API int channel_read_nonblocking(ssh_channel channel, void *dest, uint32_t count, 61 | int is_stderr); 62 | LIBSSH_API int channel_request_env(ssh_channel channel, const char *name, const char *value); 63 | LIBSSH_API int channel_request_exec(ssh_channel channel, const char *cmd); 64 | LIBSSH_API int channel_request_pty(ssh_channel channel); 65 | LIBSSH_API int channel_request_pty_size(ssh_channel channel, const char *term, 66 | int cols, int rows); 67 | LIBSSH_API int channel_request_shell(ssh_channel channel); 68 | LIBSSH_API int channel_request_send_signal(ssh_channel channel, const char *signum); 69 | LIBSSH_API int channel_request_sftp(ssh_channel channel); 70 | LIBSSH_API int channel_request_subsystem(ssh_channel channel, const char *subsystem); 71 | LIBSSH_API int channel_request_x11(ssh_channel channel, int single_connection, const char *protocol, 72 | const char *cookie, int screen_number); 73 | LIBSSH_API int channel_send_eof(ssh_channel channel); 74 | LIBSSH_API int channel_select(ssh_channel *readchans, ssh_channel *writechans, ssh_channel *exceptchans, struct 75 | timeval * timeout); 76 | LIBSSH_API void channel_set_blocking(ssh_channel channel, int blocking); 77 | LIBSSH_API int channel_write(ssh_channel channel, const void *data, uint32_t len); 78 | 79 | LIBSSH_API void privatekey_free(ssh_private_key prv); 80 | LIBSSH_API ssh_private_key privatekey_from_file(ssh_session session, const char *filename, 81 | int type, const char *passphrase); 82 | LIBSSH_API void publickey_free(ssh_public_key key); 83 | LIBSSH_API int ssh_publickey_to_file(ssh_session session, const char *file, 84 | ssh_string pubkey, int type); 85 | LIBSSH_API ssh_string publickey_from_file(ssh_session session, const char *filename, 86 | int *type); 87 | LIBSSH_API ssh_public_key publickey_from_privatekey(ssh_private_key prv); 88 | LIBSSH_API ssh_string publickey_to_string(ssh_public_key key); 89 | LIBSSH_API ssh_message ssh_message_retrieve(ssh_session session, uint32_t packettype); 90 | LIBSSH_API void string_burn(ssh_string str); 91 | LIBSSH_API ssh_string string_copy(ssh_string str); 92 | LIBSSH_API void *string_data(ssh_string str); 93 | LIBSSH_API int string_fill(ssh_string str, const void *data, size_t len); 94 | LIBSSH_API void string_free(ssh_string str); 95 | LIBSSH_API ssh_string string_from_char(const char *what); 96 | LIBSSH_API size_t string_len(ssh_string str); 97 | LIBSSH_API ssh_string string_new(size_t size); 98 | LIBSSH_API char *string_to_char(ssh_string str); 99 | 100 | #endif /* LEGACY_H_ */ 101 | -------------------------------------------------------------------------------- /External Libraries/libssh/libcrypto.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2009 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef LIBCRYPTO_H_ 23 | #define LIBCRYPTO_H_ 24 | 25 | #include "config.h" 26 | 27 | #ifdef HAVE_LIBCRYPTO 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | typedef SHA_CTX* SHACTX; 35 | typedef MD5_CTX* MD5CTX; 36 | typedef HMAC_CTX* HMACCTX; 37 | 38 | #define SHA_DIGEST_LEN SHA_DIGEST_LENGTH 39 | #ifdef MD5_DIGEST_LEN 40 | #undef MD5_DIGEST_LEN 41 | #endif 42 | #define MD5_DIGEST_LEN MD5_DIGEST_LENGTH 43 | 44 | #include 45 | #include 46 | #define OPENSSL_0_9_7b 0x0090702fL 47 | #if (OPENSSL_VERSION_NUMBER <= OPENSSL_0_9_7b) 48 | #define BROKEN_AES_CTR 49 | #endif 50 | typedef BIGNUM* bignum; 51 | typedef BN_CTX* bignum_CTX; 52 | 53 | #define bignum_new() BN_new() 54 | #define bignum_free(num) BN_clear_free(num) 55 | #define bignum_set_word(bn,n) BN_set_word(bn,n) 56 | #define bignum_bin2bn(bn,datalen,data) BN_bin2bn(bn,datalen,data) 57 | #define bignum_bn2dec(num) BN_bn2dec(num) 58 | #define bignum_dec2bn(bn,data) BN_dec2bn(data,bn) 59 | #define bignum_bn2hex(num) BN_bn2hex(num) 60 | #define bignum_rand(rnd, bits, top, bottom) BN_rand(rnd,bits,top,bottom) 61 | #define bignum_ctx_new() BN_CTX_new() 62 | #define bignum_ctx_free(num) BN_CTX_free(num) 63 | #define bignum_mod_exp(dest,generator,exp,modulo,ctx) BN_mod_exp(dest,generator,exp,modulo,ctx) 64 | #define bignum_num_bytes(num) BN_num_bytes(num) 65 | #define bignum_num_bits(num) BN_num_bits(num) 66 | #define bignum_is_bit_set(num,bit) BN_is_bit_set(num,bit) 67 | #define bignum_bn2bin(num,ptr) BN_bn2bin(num,ptr) 68 | #define bignum_cmp(num1,num2) BN_cmp(num1,num2) 69 | 70 | struct crypto_struct *ssh_get_ciphertab(void); 71 | 72 | #endif /* HAVE_LIBCRYPTO */ 73 | 74 | #endif /* LIBCRYPTO_H_ */ 75 | -------------------------------------------------------------------------------- /External Libraries/libssh/libgcrypt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2009 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef LIBGCRYPT_H_ 23 | #define LIBGCRYPT_H_ 24 | 25 | #include "config.h" 26 | 27 | #ifdef HAVE_LIBGCRYPT 28 | 29 | #include 30 | typedef gcry_md_hd_t SHACTX; 31 | typedef gcry_md_hd_t MD5CTX; 32 | typedef gcry_md_hd_t HMACCTX; 33 | #define SHA_DIGEST_LEN 20 34 | #define MD5_DIGEST_LEN 16 35 | #define EVP_MAX_MD_SIZE 36 36 | 37 | typedef gcry_mpi_t bignum; 38 | 39 | #define bignum_new() gcry_mpi_new(0) 40 | #define bignum_free(num) gcry_mpi_release(num) 41 | #define bignum_set_word(bn,n) gcry_mpi_set_ui(bn,n) 42 | #define bignum_bin2bn(bn,datalen,data) gcry_mpi_scan(data,GCRYMPI_FMT_USG,bn,datalen,NULL) 43 | #define bignum_bn2dec(num) my_gcry_bn2dec(num) 44 | #define bignum_dec2bn(num, data) my_gcry_dec2bn(data, num) 45 | #define bignum_bn2hex(num,data) gcry_mpi_aprint(GCRYMPI_FMT_HEX,data,NULL,num) 46 | #define bignum_hex2bn(num,datalen,data) gcry_mpi_scan(num,GCRYMPI_FMT_HEX,data,datalen,NULL) 47 | #define bignum_rand(num,bits) gcry_mpi_randomize(num,bits,GCRY_STRONG_RANDOM),gcry_mpi_set_bit(num,bits-1),gcry_mpi_set_bit(num,0) 48 | #define bignum_mod_exp(dest,generator,exp,modulo) gcry_mpi_powm(dest,generator,exp,modulo) 49 | #define bignum_num_bits(num) gcry_mpi_get_nbits(num) 50 | #define bignum_num_bytes(num) ((gcry_mpi_get_nbits(num)+7)/8) 51 | #define bignum_is_bit_set(num,bit) gcry_mpi_test_bit(num,bit) 52 | #define bignum_bn2bin(num,datalen,data) gcry_mpi_print(GCRYMPI_FMT_USG,data,datalen,NULL,num) 53 | #define bignum_cmp(num1,num2) gcry_mpi_cmp(num1,num2) 54 | 55 | 56 | #endif /* HAVE_LIBGCRYPT */ 57 | 58 | struct crypto_struct *ssh_get_ciphertab(void); 59 | 60 | #endif /* LIBGCRYPT_H_ */ 61 | -------------------------------------------------------------------------------- /External Libraries/libssh/messages.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2009 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef MESSAGES_H_ 23 | #define MESSAGES_H_ 24 | 25 | #include "config.h" 26 | 27 | struct ssh_auth_request { 28 | char *username; 29 | int method; 30 | char *password; 31 | struct ssh_public_key_struct *public_key; 32 | char signature_state; 33 | }; 34 | 35 | struct ssh_channel_request_open { 36 | int type; 37 | uint32_t sender; 38 | uint32_t window; 39 | uint32_t packet_size; 40 | char *originator; 41 | uint16_t originator_port; 42 | char *destination; 43 | uint16_t destination_port; 44 | }; 45 | 46 | struct ssh_service_request { 47 | char *service; 48 | }; 49 | 50 | struct ssh_global_request { 51 | int type; 52 | uint8_t want_reply; 53 | char *bind_address; 54 | uint16_t bind_port; 55 | }; 56 | 57 | struct ssh_channel_request { 58 | int type; 59 | ssh_channel channel; 60 | uint8_t want_reply; 61 | /* pty-req type specifics */ 62 | char *TERM; 63 | uint32_t width; 64 | uint32_t height; 65 | uint32_t pxwidth; 66 | uint32_t pxheight; 67 | ssh_string modes; 68 | 69 | /* env type request */ 70 | char *var_name; 71 | char *var_value; 72 | /* exec type request */ 73 | char *command; 74 | /* subsystem */ 75 | char *subsystem; 76 | }; 77 | 78 | struct ssh_message_struct { 79 | ssh_session session; 80 | int type; 81 | struct ssh_auth_request auth_request; 82 | struct ssh_channel_request_open channel_request_open; 83 | struct ssh_channel_request channel_request; 84 | struct ssh_service_request service_request; 85 | struct ssh_global_request global_request; 86 | }; 87 | 88 | SSH_PACKET_CALLBACK(ssh_packet_channel_open); 89 | SSH_PACKET_CALLBACK(ssh_packet_service_request); 90 | SSH_PACKET_CALLBACK(ssh_packet_userauth_request); 91 | SSH_PACKET_CALLBACK(ssh_packet_global_request); 92 | 93 | int ssh_message_handle_channel_request(ssh_session session, ssh_channel channel, ssh_buffer packet, 94 | const char *request, uint8_t want_reply); 95 | void ssh_message_queue(ssh_session session, ssh_message message); 96 | ssh_message ssh_message_pop_head(ssh_session session); 97 | 98 | #endif /* MESSAGES_H_ */ 99 | -------------------------------------------------------------------------------- /External Libraries/libssh/misc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2009 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef MISC_H_ 23 | #define MISC_H_ 24 | 25 | /* in misc.c */ 26 | /* gets the user home dir. */ 27 | char *ssh_get_user_home_dir(void); 28 | char *ssh_get_local_username(ssh_session session); 29 | int ssh_file_readaccess_ok(const char *file); 30 | 31 | char *ssh_path_expand_tilde(const char *d); 32 | char *ssh_path_expand_escape(ssh_session session, const char *s); 33 | int ssh_analyze_banner(ssh_session session, int server, int *ssh1, int *ssh2); 34 | int ssh_is_ipaddr_v4(const char *str); 35 | int ssh_is_ipaddr(const char *str); 36 | 37 | /* macro for byte ordering */ 38 | uint64_t ntohll(uint64_t); 39 | #define htonll(x) ntohll(x) 40 | 41 | /* list processing */ 42 | 43 | struct ssh_list { 44 | struct ssh_iterator *root; 45 | struct ssh_iterator *end; 46 | }; 47 | 48 | struct ssh_iterator { 49 | struct ssh_iterator *next; 50 | const void *data; 51 | }; 52 | 53 | struct ssh_timestamp { 54 | long seconds; 55 | long useconds; 56 | }; 57 | 58 | struct ssh_list *ssh_list_new(void); 59 | void ssh_list_free(struct ssh_list *list); 60 | struct ssh_iterator *ssh_list_get_iterator(const struct ssh_list *list); 61 | struct ssh_iterator *ssh_list_find(const struct ssh_list *list, void *value); 62 | int ssh_list_append(struct ssh_list *list, const void *data); 63 | int ssh_list_prepend(struct ssh_list *list, const void *data); 64 | void ssh_list_remove(struct ssh_list *list, struct ssh_iterator *iterator); 65 | char *ssh_lowercase(const char* str); 66 | char *ssh_hostport(const char *host, int port); 67 | 68 | const void *_ssh_list_pop_head(struct ssh_list *list); 69 | 70 | #define ssh_iterator_value(type, iterator)\ 71 | ((type)((iterator)->data)) 72 | 73 | /** @brief fetch the head element of a list and remove it from list 74 | * @param type type of the element to return 75 | * @param list the ssh_list to use 76 | * @return the first element of the list, or NULL if the list is empty 77 | */ 78 | #define ssh_list_pop_head(type, ssh_list)\ 79 | ((type)_ssh_list_pop_head(ssh_list)) 80 | 81 | int ssh_make_milliseconds(long sec, long usec); 82 | void ssh_timestamp_init(struct ssh_timestamp *ts); 83 | int ssh_timeout_elapsed(struct ssh_timestamp *ts, int timeout); 84 | int ssh_timeout_update(struct ssh_timestamp *ts, int timeout); 85 | 86 | #endif /* MISC_H_ */ 87 | -------------------------------------------------------------------------------- /External Libraries/libssh/packet.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2009 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef PACKET_H_ 23 | #define PACKET_H_ 24 | 25 | /* this structure should go someday */ 26 | typedef struct packet_struct { 27 | int valid; 28 | uint32_t len; 29 | uint8_t type; 30 | } PACKET; 31 | 32 | /** different state of packet reading. */ 33 | enum ssh_packet_state_e { 34 | /** Packet not initialized, must read the size of packet */ 35 | PACKET_STATE_INIT, 36 | /** Size was read, waiting for the rest of data */ 37 | PACKET_STATE_SIZEREAD, 38 | /** Full packet was read and callbacks are being called. Future packets 39 | * should wait for the end of the callback. */ 40 | PACKET_STATE_PROCESSING 41 | }; 42 | 43 | int packet_send(ssh_session session); 44 | 45 | #ifdef WITH_SSH1 46 | int packet_send1(ssh_session session) ; 47 | void ssh_packet_set_default_callbacks1(ssh_session session); 48 | 49 | SSH_PACKET_CALLBACK(ssh_packet_disconnect1); 50 | SSH_PACKET_CALLBACK(ssh_packet_smsg_success1); 51 | SSH_PACKET_CALLBACK(ssh_packet_smsg_failure1); 52 | int ssh_packet_socket_callback1(const void *data, size_t receivedlen, void *user); 53 | 54 | #endif 55 | 56 | SSH_PACKET_CALLBACK(ssh_packet_unimplemented); 57 | int ssh_packet_send_unimplemented(ssh_session session, uint32_t seqnum); 58 | int ssh_packet_parse_type(ssh_session session); 59 | //int packet_flush(ssh_session session, int enforce_blocking); 60 | 61 | 62 | #endif /* PACKET_H_ */ 63 | -------------------------------------------------------------------------------- /External Libraries/libssh/pcap.h: -------------------------------------------------------------------------------- 1 | #ifndef PCAP_H_ 2 | #define PCAP_H_ 3 | 4 | #include "config.h" 5 | #include "libssh/libssh.h" 6 | 7 | #ifdef WITH_PCAP 8 | typedef struct ssh_pcap_context_struct* ssh_pcap_context; 9 | 10 | int ssh_pcap_file_write_packet(ssh_pcap_file pcap, ssh_buffer packet, uint32_t original_len); 11 | 12 | ssh_pcap_context ssh_pcap_context_new(ssh_session session); 13 | void ssh_pcap_context_free(ssh_pcap_context ctx); 14 | 15 | enum ssh_pcap_direction{ 16 | SSH_PCAP_DIR_IN, 17 | SSH_PCAP_DIR_OUT 18 | }; 19 | void ssh_pcap_context_set_file(ssh_pcap_context, ssh_pcap_file); 20 | int ssh_pcap_context_write(ssh_pcap_context,enum ssh_pcap_direction direction, void *data, 21 | uint32_t len, uint32_t origlen); 22 | 23 | 24 | #endif /* WITH_PCAP */ 25 | #endif /* PCAP_H_ */ 26 | /* vim: set ts=2 sw=2 et cindent: */ 27 | -------------------------------------------------------------------------------- /External Libraries/libssh/pki.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2010 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef PKI_H_ 23 | #define PKI_H_ 24 | 25 | #define SSH_KEY_FLAG_EMPTY 0 26 | #define SSH_KEY_FLAG_PUBLIC 1 27 | #define SSH_KEY_FLAG_PRIVATE 2 28 | 29 | struct ssh_key_struct { 30 | enum ssh_keytypes_e type; 31 | int flags; 32 | const char *type_c; /* Don't free it ! it is static */ 33 | #ifdef HAVE_LIBGCRYPT 34 | gcry_sexp_t dsa; 35 | gcry_sexp_t rsa; 36 | #elif HAVE_LIBCRYPTO 37 | DSA *dsa; 38 | RSA *rsa; 39 | #endif 40 | }; 41 | 42 | ssh_key ssh_key_new (void); 43 | void ssh_key_clean (ssh_key key); 44 | enum ssh_keytypes_e ssh_key_type(ssh_key key); 45 | int ssh_key_import_private(ssh_key key, ssh_session session, 46 | const char *filename, const char *passphrase); 47 | void ssh_key_free (ssh_key key); 48 | 49 | #endif /* PKI_H_ */ 50 | -------------------------------------------------------------------------------- /External Libraries/libssh/poll.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2009 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef POLL_H_ 23 | #define POLL_H_ 24 | #include "config.h" 25 | 26 | #ifdef HAVE_POLL 27 | 28 | #include 29 | typedef struct pollfd ssh_pollfd_t; 30 | 31 | #else /* HAVE_POLL */ 32 | 33 | /* poll emulation support */ 34 | 35 | typedef struct ssh_pollfd_struct { 36 | socket_t fd; /* file descriptor */ 37 | short events; /* requested events */ 38 | short revents; /* returned events */ 39 | } ssh_pollfd_t; 40 | 41 | typedef unsigned long int nfds_t; 42 | 43 | #ifdef _WIN32 44 | 45 | #ifndef POLLRDNORM 46 | #define POLLRDNORM 0x0100 47 | #endif 48 | #ifndef POLLRDBAND 49 | #define POLLRDBAND 0x0200 50 | #endif 51 | #ifndef POLLIN 52 | #define POLLIN (POLLRDNORM | POLLRDBAND) 53 | #endif 54 | #ifndef POLLPRI 55 | #define POLLPRI 0x0400 56 | #endif 57 | 58 | #ifndef POLLWRNORM 59 | #define POLLWRNORM 0x0010 60 | #endif 61 | #ifndef POLLOUT 62 | #define POLLOUT (POLLWRNORM) 63 | #endif 64 | #ifndef POLLWRBAND 65 | #define POLLWRBAND 0x0020 66 | #endif 67 | 68 | #ifndef POLLERR 69 | #define POLLERR 0x0001 70 | #endif 71 | #ifndef POLLHUP 72 | #define POLLHUP 0x0002 73 | #endif 74 | #ifndef POLLNVAL 75 | #define POLLNVAL 0x0004 76 | #endif 77 | 78 | #else /* _WIN32 */ 79 | 80 | /* poll.c */ 81 | #ifndef POLLIN 82 | #define POLLIN 0x001 /* There is data to read. */ 83 | #endif 84 | #ifndef POLLPRI 85 | #define POLLPRI 0x002 /* There is urgent data to read. */ 86 | #endif 87 | #ifndef POLLOUT 88 | #define POLLOUT 0x004 /* Writing now will not block. */ 89 | #endif 90 | 91 | #ifndef POLLERR 92 | #define POLLERR 0x008 /* Error condition. */ 93 | #endif 94 | #ifndef POLLHUP 95 | #define POLLHUP 0x010 /* Hung up. */ 96 | #endif 97 | #ifndef POLLNVAL 98 | #define POLLNVAL 0x020 /* Invalid polling request. */ 99 | #endif 100 | 101 | #ifndef POLLRDNORM 102 | #define POLLRDNORM 0x040 /* mapped to read fds_set */ 103 | #endif 104 | #ifndef POLLRDBAND 105 | #define POLLRDBAND 0x080 /* mapped to exception fds_set */ 106 | #endif 107 | #ifndef POLLWRNORM 108 | #define POLLWRNORM 0x100 /* mapped to write fds_set */ 109 | #endif 110 | #ifndef POLLWRBAND 111 | #define POLLWRBAND 0x200 /* mapped to write fds_set */ 112 | #endif 113 | 114 | #endif /* WIN32 */ 115 | #endif /* HAVE_POLL */ 116 | 117 | void ssh_poll_init(void); 118 | void ssh_poll_cleanup(void); 119 | int ssh_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout); 120 | typedef struct ssh_poll_ctx_struct *ssh_poll_ctx; 121 | typedef struct ssh_poll_handle_struct *ssh_poll_handle; 122 | 123 | /** 124 | * @brief SSH poll callback. This callback will be used when an event 125 | * caught on the socket. 126 | * 127 | * @param p Poll object this callback belongs to. 128 | * @param fd The raw socket. 129 | * @param revents The current poll events on the socket. 130 | * @param userdata Userdata to be passed to the callback function. 131 | * 132 | * @return 0 on success, < 0 if you removed the poll object from 133 | * its poll context. 134 | */ 135 | typedef int (*ssh_poll_callback)(ssh_poll_handle p, socket_t fd, int revents, 136 | void *userdata); 137 | 138 | 139 | ssh_poll_handle ssh_poll_new(socket_t fd, short events, ssh_poll_callback cb, 140 | void *userdata); 141 | void ssh_poll_free(ssh_poll_handle p); 142 | ssh_poll_ctx ssh_poll_get_ctx(ssh_poll_handle p); 143 | short ssh_poll_get_events(ssh_poll_handle p); 144 | void ssh_poll_set_events(ssh_poll_handle p, short events); 145 | void ssh_poll_add_events(ssh_poll_handle p, short events); 146 | void ssh_poll_remove_events(ssh_poll_handle p, short events); 147 | socket_t ssh_poll_get_fd(ssh_poll_handle p); 148 | void ssh_poll_set_fd(ssh_poll_handle p, socket_t fd); 149 | void ssh_poll_set_callback(ssh_poll_handle p, ssh_poll_callback cb, void *userdata); 150 | ssh_poll_ctx ssh_poll_ctx_new(size_t chunk_size); 151 | void ssh_poll_ctx_free(ssh_poll_ctx ctx); 152 | int ssh_poll_ctx_add(ssh_poll_ctx ctx, ssh_poll_handle p); 153 | int ssh_poll_ctx_add_socket (ssh_poll_ctx ctx, struct ssh_socket_struct *s); 154 | void ssh_poll_ctx_remove(ssh_poll_ctx ctx, ssh_poll_handle p); 155 | int ssh_poll_ctx_dopoll(ssh_poll_ctx ctx, int timeout); 156 | ssh_poll_ctx ssh_poll_get_default_ctx(ssh_session session); 157 | 158 | #endif /* POLL_H_ */ 159 | -------------------------------------------------------------------------------- /External Libraries/libssh/priv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2003-2009 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | /* 23 | * priv.h file 24 | * This include file contains everything you shouldn't deal with in 25 | * user programs. Consider that anything in this file might change 26 | * without notice; libssh.h file will keep backward compatibility 27 | * on binary & source 28 | */ 29 | 30 | #ifndef _LIBSSH_PRIV_H 31 | #define _LIBSSH_PRIV_H 32 | 33 | #include "config.h" 34 | 35 | #ifdef _WIN32 36 | 37 | /* Imitate define of inttypes.h */ 38 | # ifndef PRIdS 39 | # define PRIdS "Id" 40 | # endif 41 | 42 | # ifdef _MSC_VER 43 | # include 44 | 45 | /* On Microsoft compilers define inline to __inline on all others use inline */ 46 | # undef inline 47 | # define inline __inline 48 | 49 | # define strcasecmp _stricmp 50 | # define strncasecmp _strnicmp 51 | # define strtoull _strtoui64 52 | # define isblank(ch) ((ch) == ' ' || (ch) == '\t' || (ch) == '\n' || (ch) == '\r') 53 | 54 | # define usleep(X) Sleep(((X)+1000)/1000) 55 | 56 | # undef strtok_r 57 | # define strtok_r strtok_s 58 | 59 | # if defined(HAVE__SNPRINTF_S) 60 | # undef snprintf 61 | # define snprintf(d, n, ...) _snprintf_s((d), (n), _TRUNCATE, __VA_ARGS__) 62 | # else /* HAVE__SNPRINTF_S */ 63 | # if defined(HAVE__SNPRINTF) 64 | # undef snprintf 65 | # define snprintf _snprintf 66 | # else /* HAVE__SNPRINTF */ 67 | # if !defined(HAVE_SNPRINTF) 68 | # error "no snprintf compatible function found" 69 | # endif /* HAVE_SNPRINTF */ 70 | # endif /* HAVE__SNPRINTF */ 71 | # endif /* HAVE__SNPRINTF_S */ 72 | 73 | # if defined(HAVE__VSNPRINTF_S) 74 | # undef vsnprintf 75 | # define vsnprintf(s, n, f, v) _vsnprintf_s((s), (n), _TRUNCATE, (f), (v)) 76 | # else /* HAVE__VSNPRINTF_S */ 77 | # if defined(HAVE__VSNPRINTF) 78 | # undef vsnprintf 79 | # define vsnprintf _vsnprintf 80 | # else 81 | # if !defined(HAVE_VSNPRINTF) 82 | # error "No vsnprintf compatible function found" 83 | # endif /* HAVE_VSNPRINTF */ 84 | # endif /* HAVE__VSNPRINTF */ 85 | # endif /* HAVE__VSNPRINTF_S */ 86 | 87 | # endif /* _MSC_VER */ 88 | 89 | #else /* _WIN32 */ 90 | 91 | #include 92 | #define PRIdS "zd" 93 | 94 | #endif /* _WIN32 */ 95 | 96 | #include "libssh/libssh.h" 97 | #include "libssh/callbacks.h" 98 | #include "libssh/crypto.h" 99 | 100 | /* some constants */ 101 | #define MAX_PACKET_LEN 262144 102 | #define ERROR_BUFFERLEN 1024 103 | #define CLIENTBANNER1 "SSH-1.5-libssh-" SSH_STRINGIFY(LIBSSH_VERSION) 104 | #define CLIENTBANNER2 "SSH-2.0-libssh-" SSH_STRINGIFY(LIBSSH_VERSION) 105 | #define KBDINT_MAX_PROMPT 256 /* more than openssh's :) */ 106 | 107 | #ifdef __cplusplus 108 | extern "C" { 109 | #endif 110 | 111 | 112 | #ifdef HAVE_SYS_TIME_H 113 | #include 114 | #endif 115 | 116 | typedef struct kex_struct { 117 | unsigned char cookie[16]; 118 | char **methods; 119 | } KEX; 120 | 121 | struct error_struct { 122 | /* error handling */ 123 | int error_code; 124 | char error_buffer[ERROR_BUFFERLEN]; 125 | }; 126 | 127 | /* TODO: remove that include */ 128 | #include "libssh/wrapper.h" 129 | 130 | struct ssh_keys_struct { 131 | const char *privatekey; 132 | const char *publickey; 133 | }; 134 | 135 | struct ssh_message_struct; 136 | struct ssh_common_struct; 137 | 138 | /* server data */ 139 | 140 | 141 | SSH_PACKET_CALLBACK(ssh_packet_disconnect_callback); 142 | SSH_PACKET_CALLBACK(ssh_packet_ignore_callback); 143 | 144 | /* client.c */ 145 | 146 | int ssh_send_banner(ssh_session session, int is_server); 147 | SSH_PACKET_CALLBACK(ssh_packet_dh_reply); 148 | SSH_PACKET_CALLBACK(ssh_packet_newkeys); 149 | SSH_PACKET_CALLBACK(ssh_packet_service_accept); 150 | 151 | /* config.c */ 152 | int ssh_config_parse_file(ssh_session session, const char *filename); 153 | 154 | /* errors.c */ 155 | void ssh_set_error(void *error, int code, const char *descr, ...) PRINTF_ATTRIBUTE(3, 4); 156 | void ssh_set_error_oom(void *); 157 | void ssh_set_error_invalid(void *, const char *); 158 | 159 | /* in crypt.c */ 160 | uint32_t packet_decrypt_len(ssh_session session,char *crypted); 161 | int packet_decrypt(ssh_session session, void *packet,unsigned int len); 162 | unsigned char *packet_encrypt(ssh_session session,void *packet,unsigned int len); 163 | /* it returns the hmac buffer if exists*/ 164 | struct ssh_poll_handle_struct; 165 | 166 | int packet_hmac_verify(ssh_session session,ssh_buffer buffer,unsigned char *mac); 167 | 168 | struct ssh_socket_struct; 169 | 170 | int ssh_packet_socket_callback(const void *data, size_t len, void *user); 171 | void ssh_packet_register_socket_callback(ssh_session session, struct ssh_socket_struct *s); 172 | void ssh_packet_set_callbacks(ssh_session session, ssh_packet_callbacks callbacks); 173 | void ssh_packet_set_default_callbacks(ssh_session session); 174 | void ssh_packet_process(ssh_session session, uint8_t type); 175 | /* connect.c */ 176 | socket_t ssh_connect_host(ssh_session session, const char *host,const char 177 | *bind_addr, int port, long timeout, long usec); 178 | socket_t ssh_connect_host_nonblocking(ssh_session session, const char *host, 179 | const char *bind_addr, int port); 180 | void ssh_sock_set_nonblocking(socket_t sock); 181 | void ssh_sock_set_blocking(socket_t sock); 182 | 183 | /* in kex.c */ 184 | extern const char *ssh_kex_nums[]; 185 | int ssh_send_kex(ssh_session session, int server_kex); 186 | void ssh_list_kex(ssh_session session, KEX *kex); 187 | int set_kex(ssh_session session); 188 | int verify_existing_algo(int algo, const char *name); 189 | char **space_tokenize(const char *chain); 190 | int ssh_get_kex1(ssh_session session); 191 | char *ssh_find_matching(const char *in_d, const char *what_d); 192 | 193 | 194 | /* in base64.c */ 195 | ssh_buffer base64_to_bin(const char *source); 196 | unsigned char *bin_to_base64(const unsigned char *source, int len); 197 | 198 | /* gzip.c */ 199 | int compress_buffer(ssh_session session,ssh_buffer buf); 200 | int decompress_buffer(ssh_session session,ssh_buffer buf, size_t maxlen); 201 | 202 | /* crc32.c */ 203 | uint32_t ssh_crc32(const char *buf, uint32_t len); 204 | 205 | 206 | /* match.c */ 207 | int match_hostname(const char *host, const char *pattern, unsigned int len); 208 | 209 | int message_handle(ssh_session session, void *user, uint8_t type, ssh_buffer packet); 210 | /* log.c */ 211 | 212 | void ssh_log_common(struct ssh_common_struct *common, int verbosity, 213 | const char *format, ...) PRINTF_ATTRIBUTE(3, 4); 214 | 215 | /* misc.c */ 216 | #ifdef _WIN32 217 | int gettimeofday(struct timeval *__p, void *__t); 218 | #endif /* _WIN32 */ 219 | 220 | #ifndef __FUNCTION__ 221 | #if defined(__SUNPRO_C) 222 | #define __FUNCTION__ __func__ 223 | #endif 224 | #endif 225 | 226 | #define _enter_function(sess) \ 227 | do {\ 228 | if((sess)->common.log_verbosity >= SSH_LOG_FUNCTIONS){ \ 229 | ssh_log((sess),SSH_LOG_FUNCTIONS,"entering function %s line %d in " __FILE__ , __FUNCTION__,__LINE__);\ 230 | (sess)->common.log_indent++; \ 231 | } \ 232 | } while(0) 233 | 234 | #define _leave_function(sess) \ 235 | do { \ 236 | if((sess)->common.log_verbosity >= SSH_LOG_FUNCTIONS){ \ 237 | (sess)->common.log_indent--; \ 238 | ssh_log((sess),SSH_LOG_FUNCTIONS,"leaving function %s line %d in " __FILE__ , __FUNCTION__,__LINE__);\ 239 | }\ 240 | } while(0) 241 | 242 | #ifdef DEBUG_CALLTRACE 243 | #define enter_function() _enter_function(session) 244 | #define leave_function() _leave_function(session) 245 | #else 246 | #define enter_function() (void)session 247 | #define leave_function() (void)session 248 | #endif 249 | 250 | /* options.c */ 251 | 252 | int ssh_options_set_algo(ssh_session session, int algo, const char *list); 253 | int ssh_options_apply(ssh_session session); 254 | 255 | /* server.c */ 256 | SSH_PACKET_CALLBACK(ssh_packet_kexdh_init); 257 | 258 | /** Free memory space */ 259 | #define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0) 260 | 261 | /** Zero a structure */ 262 | #define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x)) 263 | 264 | /** Zero a structure given a pointer to the structure */ 265 | #define ZERO_STRUCTP(x) do { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); } while(0) 266 | 267 | /** Get the size of an array */ 268 | #define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) 269 | 270 | /** Overwrite the complete string with 'X' */ 271 | #define BURN_STRING(x) do { if ((x) != NULL) memset((x), 'X', strlen((x))); } while(0) 272 | 273 | #ifdef HAVE_LIBGCRYPT 274 | /* gcrypt_missing.c */ 275 | int my_gcry_dec2bn(bignum *bn, const char *data); 276 | char *my_gcry_bn2dec(bignum bn); 277 | #endif /* !HAVE_LIBGCRYPT */ 278 | 279 | #ifdef __cplusplus 280 | } 281 | #endif 282 | 283 | #endif /* _LIBSSH_PRIV_H */ 284 | /* vim: set ts=2 sw=2 et cindent: */ 285 | -------------------------------------------------------------------------------- /External Libraries/libssh/scp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2003-2009 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef _SCP_H 23 | #define _SCP_H 24 | 25 | enum ssh_scp_states { 26 | SSH_SCP_NEW, //Data structure just created 27 | SSH_SCP_WRITE_INITED, //Gave our intention to write 28 | SSH_SCP_WRITE_WRITING,//File was opened and currently writing 29 | SSH_SCP_READ_INITED, //Gave our intention to read 30 | SSH_SCP_READ_REQUESTED, //We got a read request 31 | SSH_SCP_READ_READING, //File is opened and reading 32 | SSH_SCP_ERROR, //Something bad happened 33 | SSH_SCP_TERMINATED //Transfer finished 34 | }; 35 | 36 | struct ssh_scp_struct { 37 | ssh_session session; 38 | int mode; 39 | int recursive; 40 | ssh_channel channel; 41 | char *location; 42 | enum ssh_scp_states state; 43 | size_t filelen; 44 | size_t processed; 45 | enum ssh_scp_request_types request_type; 46 | char *request_name; 47 | char *warning; 48 | int request_mode; 49 | }; 50 | 51 | int ssh_scp_read_string(ssh_scp scp, char *buffer, size_t len); 52 | int ssh_scp_integer_mode(const char *mode); 53 | char *ssh_scp_string_mode(int mode); 54 | int ssh_scp_response(ssh_scp scp, char **response); 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /External Libraries/libssh/server.h: -------------------------------------------------------------------------------- 1 | /* Public include file for server support */ 2 | /* 3 | * This file is part of the SSH Library 4 | * 5 | * Copyright (c) 2003-2008 by Aris Adamantiadis 6 | * 7 | * The SSH Library is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser General Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or (at your 10 | * option) any later version. 11 | * 12 | * The SSH Library is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 15 | * License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with the SSH Library; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 20 | * MA 02111-1307, USA. 21 | */ 22 | 23 | /** 24 | * @defgroup libssh_server The libssh server API 25 | * 26 | * @{ 27 | */ 28 | 29 | #ifndef SERVER_H 30 | #define SERVER_H 31 | 32 | #include "libssh/libssh.h" 33 | #define SERVERBANNER CLIENTBANNER 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | enum ssh_bind_options_e { 40 | SSH_BIND_OPTIONS_BINDADDR, 41 | SSH_BIND_OPTIONS_BINDPORT, 42 | SSH_BIND_OPTIONS_BINDPORT_STR, 43 | SSH_BIND_OPTIONS_HOSTKEY, 44 | SSH_BIND_OPTIONS_DSAKEY, 45 | SSH_BIND_OPTIONS_RSAKEY, 46 | SSH_BIND_OPTIONS_BANNER, 47 | SSH_BIND_OPTIONS_LOG_VERBOSITY, 48 | SSH_BIND_OPTIONS_LOG_VERBOSITY_STR 49 | }; 50 | 51 | typedef struct ssh_bind_struct* ssh_bind; 52 | 53 | /* Callback functions */ 54 | 55 | /** 56 | * @brief Incoming connection callback. This callback is called when a ssh_bind 57 | * has a new incoming connection. 58 | * @param sshbind Current sshbind session handler 59 | * @param message the actual message 60 | * @param userdata Userdata to be passed to the callback function. 61 | */ 62 | typedef void (*ssh_bind_incoming_connection_callback) (ssh_bind sshbind, 63 | void *userdata); 64 | 65 | /** 66 | * @brief These are the callbacks exported by the ssh_bind structure. 67 | * 68 | * They are called by the server module when events appear on the network. 69 | */ 70 | struct ssh_bind_callbacks_struct { 71 | /** DON'T SET THIS use ssh_callbacks_init() instead. */ 72 | size_t size; 73 | /** A new connection is available. */ 74 | ssh_bind_incoming_connection_callback incoming_connection; 75 | }; 76 | typedef struct ssh_bind_callbacks_struct *ssh_bind_callbacks; 77 | 78 | /** 79 | * @brief Creates a new SSH server bind. 80 | * 81 | * @return A newly allocated ssh_bind session pointer. 82 | */ 83 | LIBSSH_API ssh_bind ssh_bind_new(void); 84 | 85 | /** 86 | * @brief Set the options for the current SSH server bind. 87 | * 88 | * @param sshbind The ssh server bind to configure. 89 | * 90 | * @param type The option type to set. This could be one of the 91 | * following: 92 | * 93 | * - SSH_BIND_OPTIONS_BINDADDR 94 | * The ip address to bind (const char *). 95 | * 96 | * - SSH_BIND_OPTIONS_BINDPORT 97 | * The port to bind (unsigned int). 98 | * 99 | * - SSH_BIND_OPTIONS_BINDPORT_STR 100 | * The port to bind (const char *). 101 | * 102 | * - SSH_BIND_OPTIONS_HOSTKEY 103 | * This specifies the file containing the private host key used 104 | * by SSHv1. (const char *). 105 | * 106 | * - SSH_BIND_OPTIONS_DSAKEY 107 | * This specifies the file containing the private host dsa key 108 | * used by SSHv2. (const char *). 109 | * 110 | * - SSH_BIND_OPTIONS_RSAKEY 111 | * This specifies the file containing the private host dsa key 112 | * used by SSHv2. (const char *). 113 | * 114 | * - SSH_BIND_OPTIONS_BANNER 115 | * That the server banner (version string) for SSH. 116 | * (const char *). 117 | * 118 | * - SSH_BIND_OPTIONS_LOG_VERBOSITY 119 | * Set the session logging verbosity (int).\n 120 | * \n 121 | * The verbosity of the messages. Every log smaller or 122 | * equal to verbosity will be shown. 123 | * - SSH_LOG_NOLOG: No logging 124 | * - SSH_LOG_RARE: Rare conditions or warnings 125 | * - SSH_LOG_ENTRY: API-accessible entrypoints 126 | * - SSH_LOG_PACKET: Packet id and size 127 | * - SSH_LOG_FUNCTIONS: Function entering and leaving 128 | * 129 | * - SSH_BIND_OPTIONS_LOG_VERBOSITY_STR 130 | * Set the session logging verbosity (const char *).\n 131 | * \n 132 | * The verbosity of the messages. Every log smaller or 133 | * equal to verbosity will be shown. 134 | * - SSH_LOG_NOLOG: No logging 135 | * - SSH_LOG_RARE: Rare conditions or warnings 136 | * - SSH_LOG_ENTRY: API-accessible entrypoints 137 | * - SSH_LOG_PACKET: Packet id and size 138 | * - SSH_LOG_FUNCTIONS: Function entering and leaving 139 | * \n 140 | * See the corresponding numbers in libssh.h. 141 | * 142 | * @param value The value to set. This is a generic pointer and the 143 | * datatype which is used should be set according to the 144 | * type set. 145 | * 146 | * @returns SSH_OK on success, SSH_ERROR on invalid option or parameter. 147 | */ 148 | LIBSSH_API int ssh_bind_options_set(ssh_bind sshbind, 149 | enum ssh_bind_options_e type, const void *value); 150 | 151 | /** 152 | * @brief Start listening to the socket. 153 | * 154 | * @param ssh_bind_o The ssh server bind to use. 155 | * 156 | * @return 0 on success, < 0 on error. 157 | */ 158 | LIBSSH_API int ssh_bind_listen(ssh_bind ssh_bind_o); 159 | 160 | /** 161 | * @brief Set the callback for this bind. 162 | * 163 | * @param[in] sshbind The bind to set the callback on. 164 | * 165 | * @param[in] callbacks An already set up ssh_bind_callbacks instance. 166 | * 167 | * @param[in] userdata A pointer to private data to pass to the callbacks. 168 | * 169 | * @return SSH_OK on success, SSH_ERROR if an error occured. 170 | * 171 | * @code 172 | * struct ssh_callbacks_struct cb = { 173 | * .userdata = data, 174 | * .auth_function = my_auth_function 175 | * }; 176 | * ssh_callbacks_init(&cb); 177 | * ssh_bind_set_callbacks(session, &cb); 178 | * @endcode 179 | */ 180 | LIBSSH_API int ssh_bind_set_callbacks(ssh_bind sshbind, ssh_bind_callbacks callbacks, 181 | void *userdata); 182 | 183 | /** 184 | * @brief Set the session to blocking/nonblocking mode. 185 | * 186 | * @param ssh_bind_o The ssh server bind to use. 187 | * 188 | * @param blocking Zero for nonblocking mode. 189 | */ 190 | LIBSSH_API void ssh_bind_set_blocking(ssh_bind ssh_bind_o, int blocking); 191 | 192 | /** 193 | * @brief Recover the file descriptor from the session. 194 | * 195 | * @param ssh_bind_o The ssh server bind to get the fd from. 196 | * 197 | * @return The file descriptor. 198 | */ 199 | LIBSSH_API socket_t ssh_bind_get_fd(ssh_bind ssh_bind_o); 200 | 201 | /** 202 | * @brief Set the file descriptor for a session. 203 | * 204 | * @param ssh_bind_o The ssh server bind to set the fd. 205 | * 206 | * @param fd The file descriptssh_bind B 207 | */ 208 | LIBSSH_API void ssh_bind_set_fd(ssh_bind ssh_bind_o, socket_t fd); 209 | 210 | /** 211 | * @brief Allow the file descriptor to accept new sessions. 212 | * 213 | * @param ssh_bind_o The ssh server bind to use. 214 | */ 215 | LIBSSH_API void ssh_bind_fd_toaccept(ssh_bind ssh_bind_o); 216 | 217 | /** 218 | * @brief Accept an incoming ssh connection and initialize the session. 219 | * 220 | * @param ssh_bind_o The ssh server bind to accept a connection. 221 | * @param session A preallocated ssh session 222 | * @see ssh_new 223 | * @return SSH_OK when a connection is established 224 | */ 225 | LIBSSH_API int ssh_bind_accept(ssh_bind ssh_bind_o, ssh_session session); 226 | 227 | /** 228 | * @brief Handles the key exchange and set up encryption 229 | * 230 | * @param session A connected ssh session 231 | * @see ssh_bind_accept 232 | * @return SSH_OK if the key exchange was successful 233 | */ 234 | LIBSSH_API int ssh_handle_key_exchange(ssh_session session); 235 | 236 | /** 237 | * @brief Free a ssh servers bind. 238 | * 239 | * @param ssh_bind_o The ssh server bind to free. 240 | */ 241 | LIBSSH_API void ssh_bind_free(ssh_bind ssh_bind_o); 242 | 243 | /* messages.c */ 244 | LIBSSH_API int ssh_message_reply_default(ssh_message msg); 245 | 246 | LIBSSH_API char *ssh_message_auth_user(ssh_message msg); 247 | LIBSSH_API char *ssh_message_auth_password(ssh_message msg); 248 | LIBSSH_API ssh_public_key ssh_message_auth_publickey(ssh_message msg); 249 | LIBSSH_API enum ssh_publickey_state_e ssh_message_auth_publickey_state(ssh_message msg); 250 | LIBSSH_API int ssh_message_auth_reply_success(ssh_message msg,int partial); 251 | LIBSSH_API int ssh_message_auth_reply_pk_ok(ssh_message msg, ssh_string algo, ssh_string pubkey); 252 | LIBSSH_API int ssh_message_auth_reply_pk_ok_simple(ssh_message msg); 253 | 254 | LIBSSH_API int ssh_message_auth_set_methods(ssh_message msg, int methods); 255 | 256 | LIBSSH_API int ssh_message_service_reply_success(ssh_message msg); 257 | LIBSSH_API char *ssh_message_service_service(ssh_message msg); 258 | 259 | LIBSSH_API int ssh_message_global_request_reply_success(ssh_message msg, 260 | uint16_t bound_port); 261 | 262 | LIBSSH_API void ssh_set_message_callback(ssh_session session, 263 | int(*ssh_bind_message_callback)(ssh_session session, ssh_message msg, void *data), 264 | void *data); 265 | LIBSSH_API int ssh_execute_message_callbacks(ssh_session session); 266 | 267 | LIBSSH_API char *ssh_message_channel_request_open_originator(ssh_message msg); 268 | LIBSSH_API int ssh_message_channel_request_open_originator_port(ssh_message msg); 269 | LIBSSH_API char *ssh_message_channel_request_open_destination(ssh_message msg); 270 | LIBSSH_API int ssh_message_channel_request_open_destination_port(ssh_message msg); 271 | 272 | LIBSSH_API ssh_channel ssh_message_channel_request_channel(ssh_message msg); 273 | 274 | LIBSSH_API char *ssh_message_channel_request_pty_term(ssh_message msg); 275 | LIBSSH_API int ssh_message_channel_request_pty_width(ssh_message msg); 276 | LIBSSH_API int ssh_message_channel_request_pty_height(ssh_message msg); 277 | LIBSSH_API int ssh_message_channel_request_pty_pxwidth(ssh_message msg); 278 | LIBSSH_API int ssh_message_channel_request_pty_pxheight(ssh_message msg); 279 | 280 | LIBSSH_API char *ssh_message_channel_request_env_name(ssh_message msg); 281 | LIBSSH_API char *ssh_message_channel_request_env_value(ssh_message msg); 282 | 283 | LIBSSH_API char *ssh_message_channel_request_command(ssh_message msg); 284 | 285 | LIBSSH_API char *ssh_message_channel_request_subsystem(ssh_message msg); 286 | 287 | LIBSSH_API char *ssh_message_global_request_address(ssh_message msg); 288 | LIBSSH_API int ssh_message_global_request_port(ssh_message msg); 289 | 290 | LIBSSH_API int ssh_channel_open_reverse_forward(ssh_channel channel, const char *remotehost, 291 | int remoteport, const char *sourcehost, int localport); 292 | 293 | LIBSSH_API int ssh_channel_request_send_exit_status(ssh_channel channel, 294 | int exit_status); 295 | LIBSSH_API int ssh_channel_request_send_exit_signal(ssh_channel channel, 296 | const char *signum, 297 | int core, 298 | const char *errmsg, 299 | const char *lang); 300 | LIBSSH_API int ssh_channel_write_stderr(ssh_channel channel, 301 | const void *data, 302 | uint32_t len); 303 | 304 | /* deprecated functions */ 305 | SSH_DEPRECATED LIBSSH_API int ssh_accept(ssh_session session); 306 | SSH_DEPRECATED LIBSSH_API int channel_write_stderr(ssh_channel channel, 307 | const void *data, uint32_t len); 308 | 309 | #ifdef __cplusplus 310 | } 311 | #endif /* __cplusplus */ 312 | 313 | #endif /* SERVER_H */ 314 | 315 | /** @} */ 316 | -------------------------------------------------------------------------------- /External Libraries/libssh/session.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2009 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef SESSION_H_ 23 | #define SESSION_H_ 24 | #include "libssh/priv.h" 25 | #include "libssh/packet.h" 26 | #include "libssh/pcap.h" 27 | #include "libssh/auth.h" 28 | #include "libssh/channels.h" 29 | #include "libssh/poll.h" 30 | typedef struct ssh_kbdint_struct* ssh_kbdint; 31 | 32 | /* These are the different states a SSH session can be into its life */ 33 | enum ssh_session_state_e { 34 | SSH_SESSION_STATE_NONE=0, 35 | SSH_SESSION_STATE_CONNECTING, 36 | SSH_SESSION_STATE_SOCKET_CONNECTED, 37 | SSH_SESSION_STATE_BANNER_RECEIVED, 38 | SSH_SESSION_STATE_INITIAL_KEX, 39 | SSH_SESSION_STATE_KEXINIT_RECEIVED, 40 | SSH_SESSION_STATE_DH, 41 | SSH_SESSION_STATE_AUTHENTICATING, 42 | SSH_SESSION_STATE_AUTHENTICATED, 43 | SSH_SESSION_STATE_ERROR, 44 | SSH_SESSION_STATE_DISCONNECTED 45 | }; 46 | 47 | enum ssh_dh_state_e { 48 | DH_STATE_INIT=0, 49 | DH_STATE_INIT_SENT, 50 | DH_STATE_NEWKEYS_SENT, 51 | DH_STATE_FINISHED 52 | }; 53 | 54 | enum ssh_pending_call_e { 55 | SSH_PENDING_CALL_NONE = 0, 56 | SSH_PENDING_CALL_CONNECT, 57 | SSH_PENDING_CALL_AUTH_NONE, 58 | SSH_PENDING_CALL_AUTH_PASSWORD 59 | }; 60 | 61 | /* libssh calls may block an undefined amount of time */ 62 | #define SSH_SESSION_FLAG_BLOCKING 1 63 | 64 | /* members that are common to ssh_session and ssh_bind */ 65 | struct ssh_common_struct { 66 | struct error_struct error; 67 | ssh_callbacks callbacks; /* Callbacks to user functions */ 68 | int log_verbosity; /* verbosity of the log functions */ 69 | int log_indent; /* indentation level in enter_function logs */ 70 | }; 71 | 72 | struct ssh_session_struct { 73 | struct ssh_common_struct common; 74 | struct ssh_socket_struct *socket; 75 | char *serverbanner; 76 | char *clientbanner; 77 | int protoversion; 78 | int server; 79 | int client; 80 | int openssh; 81 | uint32_t send_seq; 82 | uint32_t recv_seq; 83 | /* status flags */ 84 | int closed; 85 | int closed_by_except; 86 | 87 | int connected; 88 | /* !=0 when the user got a session handle */ 89 | int alive; 90 | /* two previous are deprecated */ 91 | /* int auth_service_asked; */ 92 | 93 | /* session flags (SSH_SESSION_FLAG_*) */ 94 | int flags; 95 | 96 | ssh_string banner; /* that's the issue banner from 97 | the server */ 98 | char *discon_msg; /* disconnect message from 99 | the remote host */ 100 | ssh_buffer in_buffer; 101 | PACKET in_packet; 102 | ssh_buffer out_buffer; 103 | 104 | /* the states are used by the nonblocking stuff to remember */ 105 | /* where it was before being interrupted */ 106 | enum ssh_pending_call_e pending_call_state; 107 | enum ssh_session_state_e session_state; 108 | int packet_state; 109 | enum ssh_dh_state_e dh_handshake_state; 110 | enum ssh_auth_service_state_e auth_service_state; 111 | enum ssh_auth_state_e auth_state; 112 | enum ssh_channel_request_state_e global_req_state; 113 | ssh_string dh_server_signature; /* information used by dh_handshake. */ 114 | KEX server_kex; 115 | KEX client_kex; 116 | ssh_buffer in_hashbuf; 117 | ssh_buffer out_hashbuf; 118 | struct ssh_crypto_struct *current_crypto; 119 | struct ssh_crypto_struct *next_crypto; /* next_crypto is going to be used after a SSH2_MSG_NEWKEYS */ 120 | 121 | struct ssh_list *channels; /* linked list of channels */ 122 | int maxchannel; 123 | int exec_channel_opened; /* version 1 only. more 124 | info in channels1.c */ 125 | ssh_agent agent; /* ssh agent */ 126 | 127 | /* keyb interactive data */ 128 | struct ssh_kbdint_struct *kbdint; 129 | int version; /* 1 or 2 */ 130 | /* server host keys */ 131 | ssh_private_key rsa_key; 132 | ssh_private_key dsa_key; 133 | /* auths accepted by server */ 134 | int auth_methods; 135 | int hostkeys; /* contains type of host key wanted by client, in server impl */ 136 | struct ssh_list *ssh_message_list; /* list of delayed SSH messages */ 137 | int (*ssh_message_callback)( struct ssh_session_struct *session, ssh_message msg, void *userdata); 138 | void *ssh_message_callback_data; 139 | 140 | void (*ssh_connection_callback)( struct ssh_session_struct *session); 141 | struct ssh_packet_callbacks_struct default_packet_callbacks; 142 | struct ssh_list *packet_callbacks; 143 | struct ssh_socket_callbacks_struct socket_callbacks; 144 | ssh_poll_ctx default_poll_ctx; 145 | /* options */ 146 | #ifdef WITH_PCAP 147 | ssh_pcap_context pcap_ctx; /* pcap debugging context */ 148 | #endif 149 | char *username; 150 | char *host; 151 | char *bindaddr; /* bind the client to an ip addr */ 152 | char *xbanner; /* TODO: looks like it is not needed */ 153 | struct ssh_list *identity; 154 | char *sshdir; 155 | char *knownhosts; 156 | char *wanted_methods[10]; 157 | char compressionlevel; 158 | unsigned long timeout; /* seconds */ 159 | unsigned long timeout_usec; 160 | unsigned int port; 161 | socket_t fd; 162 | int ssh2; 163 | int ssh1; 164 | int StrictHostKeyChecking; 165 | char *ProxyCommand; 166 | }; 167 | 168 | /** @internal 169 | * @brief a termination function evaluates the status of an object 170 | * @param user[in] object to evaluate 171 | * @returns 1 if the polling routine should terminate, 0 instead 172 | */ 173 | typedef int (*ssh_termination_function)(void *user); 174 | int ssh_handle_packets(ssh_session session, int timeout); 175 | int ssh_handle_packets_termination(ssh_session session, int timeout, 176 | ssh_termination_function fct, void *user); 177 | void ssh_socket_exception_callback(int code, int errno_code, void *user); 178 | 179 | #endif /* SESSION_H_ */ 180 | -------------------------------------------------------------------------------- /External Libraries/libssh/socket.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2009 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef SOCKET_H_ 23 | #define SOCKET_H_ 24 | 25 | #include "libssh/callbacks.h" 26 | struct ssh_poll_handle_struct; 27 | /* socket.c */ 28 | 29 | struct ssh_socket_struct; 30 | typedef struct ssh_socket_struct* ssh_socket; 31 | 32 | int ssh_socket_init(void); 33 | void ssh_socket_cleanup(void); 34 | ssh_socket ssh_socket_new(ssh_session session); 35 | void ssh_socket_reset(ssh_socket s); 36 | void ssh_socket_free(ssh_socket s); 37 | void ssh_socket_set_fd(ssh_socket s, socket_t fd); 38 | socket_t ssh_socket_get_fd_in(ssh_socket s); 39 | #ifndef _WIN32 40 | int ssh_socket_unix(ssh_socket s, const char *path); 41 | void ssh_execute_command(const char *command, socket_t in, socket_t out); 42 | int ssh_socket_connect_proxycommand(ssh_socket s, const char *command); 43 | #endif 44 | void ssh_socket_close(ssh_socket s); 45 | int ssh_socket_write(ssh_socket s,const void *buffer, int len); 46 | int ssh_socket_is_open(ssh_socket s); 47 | int ssh_socket_fd_isset(ssh_socket s, fd_set *set); 48 | void ssh_socket_fd_set(ssh_socket s, fd_set *set, socket_t *max_fd); 49 | void ssh_socket_set_fd_in(ssh_socket s, socket_t fd); 50 | void ssh_socket_set_fd_out(ssh_socket s, socket_t fd); 51 | int ssh_socket_nonblocking_flush(ssh_socket s); 52 | void ssh_socket_set_write_wontblock(ssh_socket s); 53 | void ssh_socket_set_read_wontblock(ssh_socket s); 54 | void ssh_socket_set_except(ssh_socket s); 55 | int ssh_socket_get_status(ssh_socket s); 56 | int ssh_socket_buffered_write_bytes(ssh_socket s); 57 | int ssh_socket_data_available(ssh_socket s); 58 | int ssh_socket_data_writable(ssh_socket s); 59 | 60 | void ssh_socket_set_callbacks(ssh_socket s, ssh_socket_callbacks callbacks); 61 | int ssh_socket_pollcallback(struct ssh_poll_handle_struct *p, socket_t fd, int revents, void *v_s); 62 | struct ssh_poll_handle_struct * ssh_socket_get_poll_handle_in(ssh_socket s); 63 | struct ssh_poll_handle_struct * ssh_socket_get_poll_handle_out(ssh_socket s); 64 | 65 | void ssh_socket_set_connecting(ssh_socket s, socket_t fd); 66 | int ssh_socket_connect(ssh_socket s, const char *host, int port, const char *bind_addr); 67 | 68 | #endif /* SOCKET_H_ */ 69 | -------------------------------------------------------------------------------- /External Libraries/libssh/ssh1.h: -------------------------------------------------------------------------------- 1 | #ifndef __SSH1_H 2 | #define __SSH1_H 3 | 4 | #define SSH_MSG_NONE 0 /* no message */ 5 | #define SSH_MSG_DISCONNECT 1 /* cause (string) */ 6 | #define SSH_SMSG_PUBLIC_KEY 2 /* ck,msk,srvk,hostk */ 7 | #define SSH_CMSG_SESSION_KEY 3 /* key (BIGNUM) */ 8 | #define SSH_CMSG_USER 4 /* user (string) */ 9 | #define SSH_CMSG_AUTH_RHOSTS 5 /* user (string) */ 10 | #define SSH_CMSG_AUTH_RSA 6 /* modulus (BIGNUM) */ 11 | #define SSH_SMSG_AUTH_RSA_CHALLENGE 7 /* int (BIGNUM) */ 12 | #define SSH_CMSG_AUTH_RSA_RESPONSE 8 /* int (BIGNUM) */ 13 | #define SSH_CMSG_AUTH_PASSWORD 9 /* pass (string) */ 14 | #define SSH_CMSG_REQUEST_PTY 10 /* TERM, tty modes */ 15 | #define SSH_CMSG_WINDOW_SIZE 11 /* row,col,xpix,ypix */ 16 | #define SSH_CMSG_EXEC_SHELL 12 /* */ 17 | #define SSH_CMSG_EXEC_CMD 13 /* cmd (string) */ 18 | #define SSH_SMSG_SUCCESS 14 /* */ 19 | #define SSH_SMSG_FAILURE 15 /* */ 20 | #define SSH_CMSG_STDIN_DATA 16 /* data (string) */ 21 | #define SSH_SMSG_STDOUT_DATA 17 /* data (string) */ 22 | #define SSH_SMSG_STDERR_DATA 18 /* data (string) */ 23 | #define SSH_CMSG_EOF 19 /* */ 24 | #define SSH_SMSG_EXITSTATUS 20 /* status (int) */ 25 | #define SSH_MSG_CHANNEL_OPEN_CONFIRMATION 21 /* channel (int) */ 26 | #define SSH_MSG_CHANNEL_OPEN_FAILURE 22 /* channel (int) */ 27 | #define SSH_MSG_CHANNEL_DATA 23 /* ch,data (int,str) */ 28 | #define SSH_MSG_CHANNEL_CLOSE 24 /* channel (int) */ 29 | #define SSH_MSG_CHANNEL_CLOSE_CONFIRMATION 25 /* channel (int) */ 30 | /* SSH_CMSG_X11_REQUEST_FORWARDING 26 OBSOLETE */ 31 | #define SSH_SMSG_X11_OPEN 27 /* channel (int) */ 32 | #define SSH_CMSG_PORT_FORWARD_REQUEST 28 /* p,host,hp (i,s,i) */ 33 | #define SSH_MSG_PORT_OPEN 29 /* ch,h,p (i,s,i) */ 34 | #define SSH_CMSG_AGENT_REQUEST_FORWARDING 30 /* */ 35 | #define SSH_SMSG_AGENT_OPEN 31 /* port (int) */ 36 | #define SSH_MSG_IGNORE 32 /* string */ 37 | #define SSH_CMSG_EXIT_CONFIRMATION 33 /* */ 38 | #define SSH_CMSG_X11_REQUEST_FORWARDING 34 /* proto,data (s,s) */ 39 | #define SSH_CMSG_AUTH_RHOSTS_RSA 35 /* user,mod (s,mpi) */ 40 | #define SSH_MSG_DEBUG 36 /* string */ 41 | #define SSH_CMSG_REQUEST_COMPRESSION 37 /* level 1-9 (int) */ 42 | #define SSH_CMSG_MAX_PACKET_SIZE 38 /* size 4k-1024k (int) */ 43 | #define SSH_CMSG_AUTH_TIS 39 /* we use this for s/key */ 44 | #define SSH_SMSG_AUTH_TIS_CHALLENGE 40 /* challenge (string) */ 45 | #define SSH_CMSG_AUTH_TIS_RESPONSE 41 /* response (string) */ 46 | #define SSH_CMSG_AUTH_KERBEROS 42 /* (KTEXT) */ 47 | #define SSH_SMSG_AUTH_KERBEROS_RESPONSE 43 /* (KTEXT) */ 48 | #define SSH_CMSG_HAVE_KERBEROS_TGT 44 /* credentials (s) */ 49 | #define SSH_CMSG_HAVE_AFS_TOKEN 65 /* token (s) */ 50 | 51 | /* protocol version 1.5 overloads some version 1.3 message types */ 52 | #define SSH_MSG_CHANNEL_INPUT_EOF SSH_MSG_CHANNEL_CLOSE 53 | #define SSH_MSG_CHANNEL_OUTPUT_CLOSE SSH_MSG_CHANNEL_CLOSE_CONFIRMATION 54 | 55 | /* 56 | * Authentication methods. New types can be added, but old types should not 57 | * be removed for compatibility. The maximum allowed value is 31. 58 | */ 59 | #define SSH_AUTH_RHOSTS 1 60 | #define SSH_AUTH_RSA 2 61 | #define SSH_AUTH_PASSWORD 3 62 | #define SSH_AUTH_RHOSTS_RSA 4 63 | #define SSH_AUTH_TIS 5 64 | #define SSH_AUTH_KERBEROS 6 65 | #define SSH_PASS_KERBEROS_TGT 7 66 | /* 8 to 15 are reserved */ 67 | #define SSH_PASS_AFS_TOKEN 21 68 | 69 | /* Protocol flags. These are bit masks. */ 70 | #define SSH_PROTOFLAG_SCREEN_NUMBER 1 /* X11 forwarding includes screen */ 71 | #define SSH_PROTOFLAG_HOST_IN_FWD_OPEN 2 /* forwarding opens contain host */ 72 | 73 | /* cipher flags. they are bit numbers */ 74 | #define SSH_CIPHER_NONE 0 /* No encryption */ 75 | #define SSH_CIPHER_IDEA 1 /* IDEA in CFB mode */ 76 | #define SSH_CIPHER_DES 2 /* DES in CBC mode */ 77 | #define SSH_CIPHER_3DES 3 /* Triple-DES in CBC mode */ 78 | #define SSH_CIPHER_RC4 5 /* RC4 */ 79 | #define SSH_CIPHER_BLOWFISH 6 80 | 81 | #endif 82 | 83 | -------------------------------------------------------------------------------- /External Libraries/libssh/ssh2.h: -------------------------------------------------------------------------------- 1 | #ifndef __SSH2_H 2 | #define __SSH2_H 3 | 4 | #define SSH2_MSG_DISCONNECT 1 5 | #define SSH2_MSG_IGNORE 2 6 | #define SSH2_MSG_UNIMPLEMENTED 3 7 | #define SSH2_MSG_DEBUG 4 8 | #define SSH2_MSG_SERVICE_REQUEST 5 9 | #define SSH2_MSG_SERVICE_ACCEPT 6 10 | 11 | #define SSH2_MSG_KEXINIT 20 12 | #define SSH2_MSG_NEWKEYS 21 13 | 14 | #define SSH2_MSG_KEXDH_INIT 30 15 | #define SSH2_MSG_KEXDH_REPLY 31 16 | 17 | #define SSH2_MSG_KEX_DH_GEX_REQUEST_OLD 30 18 | #define SSH2_MSG_KEX_DH_GEX_GROUP 31 19 | #define SSH2_MSG_KEX_DH_GEX_INIT 32 20 | #define SSH2_MSG_KEX_DH_GEX_REPLY 33 21 | #define SSH2_MSG_KEX_DH_GEX_REQUEST 34 22 | #define SSH2_MSG_USERAUTH_REQUEST 50 23 | #define SSH2_MSG_USERAUTH_FAILURE 51 24 | #define SSH2_MSG_USERAUTH_SUCCESS 52 25 | #define SSH2_MSG_USERAUTH_BANNER 53 26 | #define SSH2_MSG_USERAUTH_PK_OK 60 27 | #define SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ 60 28 | #define SSH2_MSG_USERAUTH_INFO_REQUEST 60 29 | #define SSH2_MSG_USERAUTH_INFO_RESPONSE 61 30 | #define SSH2_MSG_GLOBAL_REQUEST 80 31 | #define SSH2_MSG_REQUEST_SUCCESS 81 32 | #define SSH2_MSG_REQUEST_FAILURE 82 33 | #define SSH2_MSG_CHANNEL_OPEN 90 34 | #define SSH2_MSG_CHANNEL_OPEN_CONFIRMATION 91 35 | #define SSH2_MSG_CHANNEL_OPEN_FAILURE 92 36 | #define SSH2_MSG_CHANNEL_WINDOW_ADJUST 93 37 | #define SSH2_MSG_CHANNEL_DATA 94 38 | #define SSH2_MSG_CHANNEL_EXTENDED_DATA 95 39 | #define SSH2_MSG_CHANNEL_EOF 96 40 | #define SSH2_MSG_CHANNEL_CLOSE 97 41 | #define SSH2_MSG_CHANNEL_REQUEST 98 42 | #define SSH2_MSG_CHANNEL_SUCCESS 99 43 | #define SSH2_MSG_CHANNEL_FAILURE 100 44 | 45 | #define SSH2_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT 1 46 | #define SSH2_DISCONNECT_PROTOCOL_ERROR 2 47 | #define SSH2_DISCONNECT_KEY_EXCHANGE_FAILED 3 48 | #define SSH2_DISCONNECT_HOST_AUTHENTICATION_FAILED 4 49 | #define SSH2_DISCONNECT_RESERVED 4 50 | #define SSH2_DISCONNECT_MAC_ERROR 5 51 | #define SSH2_DISCONNECT_COMPRESSION_ERROR 6 52 | #define SSH2_DISCONNECT_SERVICE_NOT_AVAILABLE 7 53 | #define SSH2_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED 8 54 | #define SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE 9 55 | #define SSH2_DISCONNECT_CONNECTION_LOST 10 56 | #define SSH2_DISCONNECT_BY_APPLICATION 11 57 | #define SSH2_DISCONNECT_TOO_MANY_CONNECTIONS 12 58 | #define SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER 13 59 | #define SSH2_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE 14 60 | #define SSH2_DISCONNECT_ILLEGAL_USER_NAME 15 61 | 62 | #define SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED 1 63 | #define SSH2_OPEN_CONNECT_FAILED 2 64 | #define SSH2_OPEN_UNKNOWN_CHANNEL_TYPE 3 65 | #define SSH2_OPEN_RESOURCE_SHORTAGE 4 66 | 67 | #define SSH2_EXTENDED_DATA_STDERR 1 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /External Libraries/libssh/string.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2009 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef STRING_H_ 23 | #define STRING_H_ 24 | #include "libssh/priv.h" 25 | 26 | /* must be 32 bits number + immediately our data */ 27 | #ifdef _MSC_VER 28 | #pragma pack(1) 29 | #endif 30 | struct ssh_string_struct { 31 | uint32_t size; 32 | unsigned char string[MAX_PACKET_LEN]; 33 | } 34 | #if !defined(__SUNPRO_C) && !defined(_MSC_VER) 35 | __attribute__ ((packed)) 36 | #endif 37 | #ifdef _MSC_VER 38 | #pragma pack() 39 | #endif 40 | ; 41 | 42 | #endif /* STRING_H_ */ 43 | -------------------------------------------------------------------------------- /External Libraries/libssh/threads.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2010 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef THREADS_H_ 23 | #define THREADS_H_ 24 | 25 | #include 26 | #include 27 | 28 | int ssh_threads_init(void); 29 | void ssh_threads_finalize(void); 30 | const char *ssh_threads_get_type(void); 31 | 32 | #endif /* THREADS_H_ */ 33 | -------------------------------------------------------------------------------- /External Libraries/libssh/wrapper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SSH Library 3 | * 4 | * Copyright (c) 2009 by Aris Adamantiadis 5 | * 6 | * The SSH Library is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; either version 2.1 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * The SSH Library is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | * License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with the SSH Library; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 19 | * MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef WRAPPER_H_ 23 | #define WRAPPER_H_ 24 | 25 | #include "config.h" 26 | #include "libssh/libcrypto.h" 27 | #include "libssh/libgcrypt.h" 28 | 29 | MD5CTX md5_init(void); 30 | void md5_update(MD5CTX c, const void *data, unsigned long len); 31 | void md5_final(unsigned char *md,MD5CTX c); 32 | SHACTX sha1_init(void); 33 | void sha1_update(SHACTX c, const void *data, unsigned long len); 34 | void sha1_final(unsigned char *md,SHACTX c); 35 | void sha1(unsigned char *digest,int len,unsigned char *hash); 36 | #define HMAC_SHA1 1 37 | #define HMAC_MD5 2 38 | HMACCTX hmac_init(const void *key,int len,int type); 39 | void hmac_update(HMACCTX c, const void *data, unsigned long len); 40 | void hmac_final(HMACCTX ctx,unsigned char *hashmacbuf,unsigned int *len); 41 | 42 | int crypt_set_algorithms(ssh_session ); 43 | int crypt_set_algorithms_server(ssh_session session); 44 | struct ssh_crypto_struct *crypto_new(void); 45 | void crypto_free(struct ssh_crypto_struct *crypto); 46 | 47 | 48 | #endif /* WRAPPER_H_ */ 49 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Brake-for-Mac 2 | ============= 3 | 4 | Brake is a remote iOS binary tool 5 | 6 | Brake is in alpha stage, and anyone who wants to help jump in :) 7 | --------------------------------------------------------------------------------