Last active
August 29, 2015 14:11
-
-
Save bsmt/dda10ef7b210ec4dba0e to your computer and use it in GitHub Desktop.
Revisions
-
bsmt revised this gist
Dec 18, 2014 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -45,8 +45,7 @@ var run_command = function(cmd) // blocks [task launch]; [task waitUntilExit]; [task release]; return [[NSString alloc] initWithData:[[out fileHandleForReading] readDataToEndOfFile] encoding:4]; } var hookPostInputText = function() { -
bsmt revised this gist
Dec 18, 2014 . 1 changed file with 3 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -65,21 +65,19 @@ var hookPostInputText = function() if (output) { delegate.inputText = output; } else { var notFoundAlert = [[NSAlert alloc] init]; [notFoundAlert setMessageText: @"Sorry..."]; [notFoundAlert setInformativeText:@"Command not found"]; [notFoundAlert runModal]; delegate.inputText = ""; return; } } } return oldm->call(this); }, oldm); } hookPostInputText() -
bsmt revised this gist
Dec 18, 2014 . 1 changed file with 11 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -39,7 +39,7 @@ var run_command = function(cmd) // blocks [args removeObjectAtIndex:0]; var out = [NSPipe pipe]; var task = [[NSTask alloc] init]; [task setLaunchPath:run]; [task setArguments:args]; [task setStandardOutput:out]; [task launch]; @@ -57,22 +57,29 @@ var hookPostInputText = function() var msg = delegate.inputText; if ([msg hasPrefix:@"/"]) { msg = [msg substringFromIndex:1]; if (!([msg hasPrefix:@"me"] || [msg hasPrefix:@"add"] || [msg hasPrefix:@"alertson"] || [msg hasPrefix:@"alertsoff"] || [msg hasPrefix:@"help"])) { NSLog(@"Received a command: %@", msg); var output = run_command(msg); if (output) { delegate.inputText = output; return oldm->call(this); } else { var notFoundAlert = [[NSAlert alloc] init]; [notFoundAlert setMessageText: @"Sorry..."]; [notFoundAlert setInformativeText:@"Command not found"]; [notFoundAlert runModal]; } } } else { return oldm->call(this); } }, oldm); } hookPostInputText() -
bsmt revised this gist
Dec 17, 2014 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -50,10 +50,10 @@ var run_command = function(cmd) // blocks } var hookPostInputText = function() { var oldm = {}; NSLog(@"Hooking [PanAmericanChatInputViewController postInputText]"); MS.hookMessage(PanAmericanChatInputViewController, @selector(postInputText), function() { var delegate = choose(ChatInputTextView)[0].delegate; var msg = delegate.inputText; if ([msg hasPrefix:@"/"]) { @@ -72,7 +72,7 @@ var hookPostInputText = function() } } } return oldm->call(this); }, oldm); } hookPostInputText() -
bsmt revised this gist
Dec 17, 2014 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,9 +8,6 @@ var get = function(name) } NSLog = get("NSLog"); var send_message = function(msg) { var delegate = choose(ChatInputTextView)[0].delegate; @@ -78,3 +75,4 @@ var hookPostInputText = function() return oldm->call(this); }, oldm); } hookPostInputText() -
bsmt created this gist
Dec 17, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,80 @@ //sudo cycript -p Skype @import com.saurik.substrate.MS var get = function(name) { func_ = dlsym(RTLD_DEFAULT, name) func = function() { var types = 'v', args = [], count = arguments.length; for (var i = 0; i != count; ++i) { types += '@'; args.push(arguments[i]); } new Functor(func_, types).apply(null, args); }; return func } NSLog = get("NSLog"); var chatViewController = chatBoxDelegate.delegate var conversations = choose(SKConversation) var send_message = function(msg) { var delegate = choose(ChatInputTextView)[0].delegate; delegate.inputText = msg; [delegate postInputText]; } var path_for_command = function(cmd) // blocks { var task = [[NSTask alloc] init]; var pipe = [NSPipe pipe]; [task setLaunchPath:@"/usr/bin/which"]; [task setArguments:@[cmd]]; [task setStandardOutput:pipe]; [task launch]; [task waitUntilExit]; [task release]; var ret = [[NSString alloc] initWithData:[[pipe fileHandleForReading] readDataToEndOfFile] encoding:4]; return [ret stringByReplacingOccurrencesOfString:@"\n" withString:@""]; } var run_command = function(cmd) // blocks { cmd = [cmd componentsSeparatedByString:@" "]; var run = path_for_command(cmd[0]); if (![[NSFileManager defaultManager] isExecutableFileAtPath:run]) { return false; } var args = [cmd mutableCopy]; [args removeObjectAtIndex:0]; var out = [NSPipe pipe]; var task = [[NSTask alloc] init]; [task setLaunchPath:run]; // wrong [task setArguments:args]; [task setStandardOutput:out]; [task launch]; [task waitUntilExit]; [task release]; var ret = [[NSString alloc] initWithData:[[out fileHandleForReading] readDataToEndOfFile] encoding:4]; return [ret stringByReplacingOccurrencesOfString:@"\n" withString:@""]; } var hookPostInputText = function() { var delegate = choose(ChatInputTextView)[0].delegate; var oldm = {}; NSLog(@"Hooking [%@ postInputText]", delegate.className); MS.hookMessage(delegate.class, @selector(postInputText), function() { var msg = delegate.inputText; if ([msg hasPrefix:@"/"]) { msg = [msg stringByReplacingOccurrencesOfString:@"/" withString:@""]; if (!([msg hasPrefix:@"me"] || [msg hasPrefix:@"add"] || [msg hasPrefix:@"alertson"] || [msg hasPrefix:@"alertsoff"] || [msg hasPrefix:@"help"])) { NSLog(@"Received a command: %@", msg); var output = run_command(msg); if (output) { delegate.inputText = output; } else { delegate.inputText = "Command not found"; } } } return oldm->call(this); }, oldm); }