Advertisement
bottomy

tester

Oct 2nd, 2012
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #import <Foundation/Foundation.h>
  2. #import <mach/mach.h>
  3. #import <mach/mach_vm.h>
  4.  
  5. int main(int argc, char *argv[])
  6. {
  7.     @autoreleasepool {
  8.         NSString *ResourcePath = [[NSBundle mainBundle] resourcePath];
  9.         NSTask *Target = [NSTask launchedTaskWithLaunchPath: [ResourcePath stringByAppendingString: @"/target"] arguments: [NSArray array]];
  10.        
  11.         const pid_t TargetPID = [Target processIdentifier];
  12.         vm_map_t RemoteTask;
  13.         mach_error_t err = task_for_pid(mach_task_self(), TargetPID, &RemoteTask);
  14.         if (err != KERN_SUCCESS)
  15.         {
  16.             printf("Not running as root?\n");
  17.             [Target terminate];
  18.             return EXIT_FAILURE;
  19.         }
  20.        
  21.         NSTask *Feedface = [NSTask launchedTaskWithLaunchPath: [ResourcePath stringByAppendingString: @"/feedface"] arguments: [NSArray arrayWithObjects:
  22.                                                                                                                                [[NSNumber numberWithInt: TargetPID] stringValue],
  23.                                                                                                                                @"-string",
  24.                                                                                                                                @"works\\x00",
  25.                                                                                                                                @"rel[0x100000f28]",
  26.                                                                                                                                nil]];
  27.        
  28.         [Feedface waitUntilExit];
  29.        
  30.         task_resume(RemoteTask);
  31.        
  32.         [Target waitUntilExit];
  33.        
  34.         printf("Feedface: %s\nTarget: %s\n", [Feedface terminationStatus] == EXIT_SUCCESS ? "Success" : "Failed", [Target terminationStatus] == EXIT_SUCCESS ? "Success" : "Failed");
  35.     }
  36.    
  37.     return EXIT_SUCCESS;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement