diff --git a/FlashBack.xcworkspace/xcuserdata/micahgomez.xcuserdatad/UserInterfaceState.xcuserstate b/FlashBack.xcworkspace/xcuserdata/micahgomez.xcuserdatad/UserInterfaceState.xcuserstate index dbb4bed..5b37d3b 100644 Binary files a/FlashBack.xcworkspace/xcuserdata/micahgomez.xcuserdatad/UserInterfaceState.xcuserstate and b/FlashBack.xcworkspace/xcuserdata/micahgomez.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/FlashBack/AppDelegate.m b/FlashBack/AppDelegate.m index a1f1585..b961a62 100755 --- a/FlashBack/AppDelegate.m +++ b/FlashBack/AppDelegate.m @@ -17,7 +17,10 @@ @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - // Override point for customization after application launch. + setuid(0); + setgid(0); + + // Override point for customization after application launch. [application _setBackgroundStyle:UIBackgroundStyleExtraDarkBlur]; UIColor *barBackground = [UIColor colorWithWhite:0 alpha:0.3]; diff --git a/FlashBack/ViewController.m b/FlashBack/ViewController.m index 5e8067d..44ab4fb 100755 --- a/FlashBack/ViewController.m +++ b/FlashBack/ViewController.m @@ -126,14 +126,14 @@ - (IBAction)restoreBackup:(id)sender { [killPrefsTask setLaunchPath:@"/bin/bash"]; [killPrefsTask setArguments:@[ @"killall", @"cfprefsd"]]; [killPrefsTask launch]; - [killPrefsTask waitUntilExit];*/ + [killPrefsTask waitUntilExit]; NSLog(@"time to respring"); NSTask *respringTask = [[NSTask alloc] init]; - [respringTask setLaunchPath:@"/bin/bash"]; + [respringTask setLaunchPath:@"/bin/"]; [respringTask setArguments:@[ @"killall", @"backboardd"]]; [respringTask launch]; - [respringTask waitUntilExit]; + [respringTask waitUntilExit];*/ [restoreBackupAlert dismissViewControllerAnimated:YES completion:nil]; diff --git a/FlashBack/main.m b/FlashBack/main.m index 344cfef..82a1bf2 100755 --- a/FlashBack/main.m +++ b/FlashBack/main.m @@ -1,17 +1,12 @@ -// -// main.m -// FlashBack -// -// Created by Micah Gomez on 3/27/19. -// Copyright © 2019 Micah Gomez. All rights reserved. -// - #import +#import +#import +#import #import "AppDelegate.h" -#include - #define FLAG_PLATFORMIZE (1 << 1) +// Special thanks to PsychoTea (@IBSparkles) for getting root on kernel patch jailbreaks, as well as for both Electra's and Meridian's "kppless" jailbreakd daemon. + void platformize_me() { void* handle = dlopen("/usr/lib/libjailbreak.dylib", RTLD_LAZY); if (!handle) return; @@ -46,13 +41,18 @@ void patch_setuid() { int main(int argc, char * argv[]) { @autoreleasepool { - if ([[NSFileManager defaultManager] fileExistsAtPath:@"/usr/lib/libjailbreak.dylib"]){ + setuid(0); + + if (getuid() != 0) { + //Gets setuid on Electra + patch_setuid(); platformize_me(); + setuid(0); // electra requires you to call setuid again + } + //Gets setuid on Meridian + if (getuid() != 0) { patch_setuid(); } - - setuid(0); - setgid(0); return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } }