diff --git a/RootlessInstaller/RootlessInstaller.xcodeproj/project.pbxproj b/RootlessInstaller/RootlessInstaller.xcodeproj/project.pbxproj index 1b708be..717441c 100644 --- a/RootlessInstaller/RootlessInstaller.xcodeproj/project.pbxproj +++ b/RootlessInstaller/RootlessInstaller.xcodeproj/project.pbxproj @@ -9,6 +9,7 @@ /* Begin PBXBuildFile section */ E002CC6F22186CA700E13A87 /* ent.xml in Resources */ = {isa = PBXBuildFile; fileRef = E002CC6E22186C8B00E13A87 /* ent.xml */; }; E003589422189DE5002A6853 /* jbd.c in Sources */ = {isa = PBXBuildFile; fileRef = E003589322189DE5002A6853 /* jbd.c */; }; + E00358972218AC5F002A6853 /* install.sh in Resources */ = {isa = PBXBuildFile; fileRef = E00358962218AC5F002A6853 /* install.sh */; }; E05B9A38220B31D700DDE972 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E05B9A37220B31D700DDE972 /* AppDelegate.m */; }; E05B9A3B220B31D700DDE972 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E05B9A3A220B31D700DDE972 /* ViewController.m */; }; E05B9A40220B31DB00DDE972 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E05B9A3F220B31DB00DDE972 /* Assets.xcassets */; }; @@ -38,6 +39,7 @@ E002CC6E22186C8B00E13A87 /* ent.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = ent.xml; sourceTree = ""; }; E003589222189DE5002A6853 /* jbd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jbd.h; sourceTree = ""; }; E003589322189DE5002A6853 /* jbd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = jbd.c; sourceTree = ""; }; + E00358962218AC5F002A6853 /* install.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = install.sh; sourceTree = ""; }; E05B9A33220B31D700DDE972 /* RootlessInstaller.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RootlessInstaller.app; sourceTree = BUILT_PRODUCTS_DIR; }; E05B9A36220B31D700DDE972 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; E05B9A37220B31D700DDE972 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; @@ -130,6 +132,7 @@ E0E3DD0E220F5EB2002777B8 /* resources */ = { isa = PBXGroup; children = ( + E00358962218AC5F002A6853 /* install.sh */, E0E3DD16220F7B4B002777B8 /* ldid2.tar.gz */, E06C63CB220E1F8300B6679C /* patch.sh */, E002CC6E22186C8B00E13A87 /* ent.xml */, @@ -206,6 +209,7 @@ buildActionMask = 2147483647; files = ( E002CC6F22186CA700E13A87 /* ent.xml in Resources */, + E00358972218AC5F002A6853 /* install.sh in Resources */, E06C63CC220E1F8300B6679C /* patch.sh in Resources */, E0E3DD17220F7B4B002777B8 /* ldid2.tar.gz in Resources */, E0E3DD13220F6B24002777B8 /* Main.storyboard in Resources */, diff --git a/RootlessInstaller/RootlessInstaller.xcodeproj/project.xcworkspace/xcuserdata/physuru.xcuserdatad/UserInterfaceState.xcuserstate b/RootlessInstaller/RootlessInstaller.xcodeproj/project.xcworkspace/xcuserdata/physuru.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..a4dc26b Binary files /dev/null and b/RootlessInstaller/RootlessInstaller.xcodeproj/project.xcworkspace/xcuserdata/physuru.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/RootlessInstaller/RootlessInstaller.xcodeproj/xcuserdata/physuru.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/RootlessInstaller/RootlessInstaller.xcodeproj/xcuserdata/physuru.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..fe2b454 --- /dev/null +++ b/RootlessInstaller/RootlessInstaller.xcodeproj/xcuserdata/physuru.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/RootlessInstaller/RootlessInstaller.xcodeproj/xcuserdata/physuru.xcuserdatad/xcschemes/xcschememanagement.plist b/RootlessInstaller/RootlessInstaller.xcodeproj/xcuserdata/physuru.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..f97fa96 --- /dev/null +++ b/RootlessInstaller/RootlessInstaller.xcodeproj/xcuserdata/physuru.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + RootlessInstaller.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/Contents.json b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/Contents.json index db70d58..29d9125 100644 --- a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -12,12 +12,6 @@ "filename" : "icon_20pt@3x.png", "scale" : "3x" }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "icon_29pt.png", - "scale" : "1x" - }, { "size" : "29x29", "idiom" : "iphone", @@ -55,48 +49,57 @@ "scale" : "3x" }, { - "idiom" : "ipad", "size" : "20x20", + "idiom" : "ipad", + "filename" : "icon_20pt.png", "scale" : "1x" }, { - "idiom" : "ipad", "size" : "20x20", + "idiom" : "ipad", + "filename" : "icon_20pt@2x-1.png", "scale" : "2x" }, { - "idiom" : "ipad", "size" : "29x29", + "idiom" : "ipad", + "filename" : "icon_29pt.png", "scale" : "1x" }, { - "idiom" : "ipad", "size" : "29x29", + "idiom" : "ipad", + "filename" : "icon_29pt@2x-1.png", "scale" : "2x" }, { - "idiom" : "ipad", "size" : "40x40", + "idiom" : "ipad", + "filename" : "icon_40pt.png", "scale" : "1x" }, { - "idiom" : "ipad", "size" : "40x40", + "idiom" : "ipad", + "filename" : "icon_40pt@2x-1.png", "scale" : "2x" }, { - "idiom" : "ipad", "size" : "76x76", + "idiom" : "ipad", + "filename" : "icon_76pt.png", "scale" : "1x" }, { - "idiom" : "ipad", "size" : "76x76", + "idiom" : "ipad", + "filename" : "icon_76pt@2x.png", "scale" : "2x" }, { - "idiom" : "ipad", "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "icon_83.5@2x.png", "scale" : "2x" }, { diff --git a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/Icon.png b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/Icon.png index 3147b1f..628f8e3 100644 Binary files a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/Icon.png and b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/Icon.png differ diff --git a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_20pt.png b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_20pt.png new file mode 100644 index 0000000..7c86867 Binary files /dev/null and b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_20pt.png differ diff --git a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x-1.png b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x-1.png new file mode 100644 index 0000000..a82a759 Binary files /dev/null and b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x-1.png differ diff --git a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x.png b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x.png index 67cc986..a82a759 100644 Binary files a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x.png and b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x.png differ diff --git a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_20pt@3x.png b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_20pt@3x.png index d8a26dd..8a10f69 100644 Binary files a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_20pt@3x.png and b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_20pt@3x.png differ diff --git a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_29pt.png b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_29pt.png index 6c59d6c..91584a0 100644 Binary files a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_29pt.png and b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_29pt.png differ diff --git a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x-1.png b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x-1.png new file mode 100644 index 0000000..87d0998 Binary files /dev/null and b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x-1.png differ diff --git a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x.png b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x.png index 3237327..87d0998 100644 Binary files a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x.png and b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x.png differ diff --git a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_29pt@3x.png b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_29pt@3x.png index 0a370e0..44c4370 100644 Binary files a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_29pt@3x.png and b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_29pt@3x.png differ diff --git a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_40pt.png b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_40pt.png new file mode 100644 index 0000000..a82a759 Binary files /dev/null and b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_40pt.png differ diff --git a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x-1.png b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x-1.png new file mode 100644 index 0000000..8c5c38c Binary files /dev/null and b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x-1.png differ diff --git a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x.png b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x.png index 39cd560..8c5c38c 100644 Binary files a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x.png and b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x.png differ diff --git a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_40pt@3x.png b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_40pt@3x.png index 6fdf845..4481046 100644 Binary files a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_40pt@3x.png and b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_40pt@3x.png differ diff --git a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_60pt@2x.png b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_60pt@2x.png index 6fdf845..4481046 100644 Binary files a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_60pt@2x.png and b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_60pt@2x.png differ diff --git a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_60pt@3x.png b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_60pt@3x.png index 08a2b04..13f9267 100644 Binary files a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_60pt@3x.png and b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_60pt@3x.png differ diff --git a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_76pt.png b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_76pt.png new file mode 100644 index 0000000..f433024 Binary files /dev/null and b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_76pt.png differ diff --git a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_76pt@2x.png b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_76pt@2x.png new file mode 100644 index 0000000..d353f09 Binary files /dev/null and b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_76pt@2x.png differ diff --git a/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_83.5@2x.png b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_83.5@2x.png new file mode 100644 index 0000000..c4703d3 Binary files /dev/null and b/RootlessInstaller/RootlessInstaller/Assets.xcassets/AppIcon.appiconset/icon_83.5@2x.png differ diff --git a/RootlessInstaller/RootlessInstaller/Info.plist b/RootlessInstaller/RootlessInstaller/Info.plist index d333d09..c736ad8 100644 --- a/RootlessInstaller/RootlessInstaller/Info.plist +++ b/RootlessInstaller/RootlessInstaller/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0.0 + 1.0.2 CFBundleVersion 1 LSRequiresIPhoneOS diff --git a/RootlessInstaller/RootlessInstaller/Main.storyboard b/RootlessInstaller/RootlessInstaller/Main.storyboard index fa09e56..e0534e5 100644 --- a/RootlessInstaller/RootlessInstaller/Main.storyboard +++ b/RootlessInstaller/RootlessInstaller/Main.storyboard @@ -65,7 +65,7 @@ - Alticha - version 1.0.1 + Alticha - version 1.0.2 this is strictly for tweaks @@ -78,7 +78,7 @@ this is strictly for tweaks - + diff --git a/RootlessInstaller/RootlessInstaller/ViewController.m b/RootlessInstaller/RootlessInstaller/ViewController.m index 99bb1ce..f1afa72 100644 --- a/RootlessInstaller/RootlessInstaller/ViewController.m +++ b/RootlessInstaller/RootlessInstaller/ViewController.m @@ -2,24 +2,17 @@ #include #include #include -#include "kernel_memory.h" #include -#include "post.h" -#include "voucher_swap.h" #include "ArchiveFile.h" +#include "jbd.h" // definitions - -// REMOVE THE FLLOWING LINE TO ENABLE THE UNINSTALL FEATURE -#define UNINSTALL_DEB_DISABLED - #define hex(hex, alphaVal) [UIColor colorWithRed:((float)((hex & 0xFF0000) >> 16))/255.0 green:((float)((hex & 0xFF00) >> 8))/255.0 blue:((float)(hex & 0xFF))/255.0 alpha:alphaVal] #define isConnectedToInternet !([[Reachability reachabilityForInternetConnection] currentReachabilityStatus] == NotReachable) #define bgDisabledColour hex(0xB8B8B8, 1.0) #define setBgDisabledColour setBackgroundColor:hex(0xB8B8B8, 1.0) #define bgEnabledColour [UIColor colorWithRed:1 green:0.57637232540000005 blue:0 alpha:1] #define setBgEnabledColour setBackgroundColor:[UIColor colorWithRed:1 green:0.57637232540000005 blue:0 alpha:1] -#define Utilities [[Post alloc] init] #define execute(ARGS) \ {\ pid_t _____PID_____;\ @@ -28,8 +21,6 @@ } #define retrn(why) \ {\ - [[[Post alloc] init] mobile];\ - [[[Post alloc] init] sandbox];\ [self dismissableController:@"Failed" text:@(why)];\ return;\ } @@ -108,36 +99,52 @@ - (void)undismissableController:(NSString *)title text:(NSString *)text { [self presentViewController:alert animated:YES completion:nil]; } -#pragma mark - UITextFieldDelegate - - (BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; return YES; } -// Dismiss keyboard when touching outside of UITextField. - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ [self.view endEditing:YES]; } + // exploitation etc -- (bool)isJailbroken { - if (![[NSFileManager defaultManager] fileExistsAtPath:@"/var/LIB/"]) return false; - if ([Utilities pid_for_name:@"/var/containers/Bundle/iosbinpack64/bin/jailbreakd"] == -1) return false; - return true; +- (pid_t)pid_for_name:(NSString *)name { + static int maxArgumentSize = 0; + size_t size = sizeof(maxArgumentSize); + sysctl((int[]){ CTL_KERN, KERN_ARGMAX }, 2, &maxArgumentSize, &size, NULL, 0); + int mib[3] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL }; + struct kinfo_proc *info; + size_t length; + sysctl(mib, 3, NULL, &length, NULL, 0); + info = malloc(length); + sysctl(mib, 3, info, &length, NULL, 0); + for (int i = 0; i < length / sizeof(struct kinfo_proc); i++) { + pid_t pid = info[i].kp_proc.p_pid; + if (pid == 0) { + continue; + } + size_t size = maxArgumentSize; + char *buffer = (char *)malloc(length); + sysctl((int[]){ CTL_KERN, KERN_PROCARGS2, pid }, 3, buffer, &size, NULL, 0); + NSString *executable = [NSString stringWithCString:buffer + sizeof(int) encoding:NSUTF8StringEncoding]; + free(buffer); + if ([executable isEqual:name]) { + free(info); + return pid; + } else if ([[executable lastPathComponent] isEqual:name]) { + free(info); + return pid; + } + } + free(info); + return -1; } -- (bool)voucher_swap { - if (![Utilities is16KAndIsNotA12]) { - printf("non-16k and a12 devices are unsupported.\n"); - return false; - } - // Run voucher_swap - voucher_swap(); - if (!MACH_PORT_VALID(kernel_task_port)) { - // Failed - return false; - } +- (bool)isJailbroken { + if (![[NSFileManager defaultManager] fileExistsAtPath:@"/var/LIB/"]) return false; + if ([self pid_for_name:@"/var/containers/Bundle/iosbinpack64/bin/jailbreakd"] == -1) return false; return true; } @@ -148,25 +155,29 @@ - (bool)isUnsandboxed { return true; } -- (IBAction)run_exploit:(id)sender { +- (IBAction)run_exploit:(id)sender { // cba renaming leave me alone if (!(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"12.0") && SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(@"12.1.2"))) { [self undismissableController:@"Failed" text:@"Unfortunately, your iOS version is unsupported."]; return; } - if (![self voucher_swap]) { - [self undismissableController:@"Failed" text:@"Unfortunately, your device is unsupported."]; - return; - } - - // Basic post-exploitation - [Utilities go]; - - if (![self isJailbroken]) { - [Utilities mobile]; - [Utilities sandbox]; - [self undismissableController:@"Failed" text:@"Please jailbreak with rootlessJB."]; - return; + calljailbreakd(getpid(), 6); + calljailbreakd(getpid(), 7); + static int tries = 0; + sleep(1); + setuid(0); + seteuid(0); + setgid(0); + setegid(0); + if (![self isUnsandboxed] || getuid()) { + if (tries < 10) { + tries++; + [self run_exploit:sender]; + return; + } else { + [self dismissableController:@"Error" text:@"RootlessInstaller hasn't been installed properly. To correct this, SSH into your device and run the following command:\nsh \"$(find /var/containers/Bundle/Application | grep RootlessInstaller.app/install.sh)\""]; + return; + } } // install and trust ldid2 @@ -232,10 +243,6 @@ - (BOOL)extractDEB:(NSString *)debPath to:(NSString *)to { // installer - (IBAction)installDEB:(id)sender { - // root & unsandbox - [Utilities root]; - [Utilities unsandbox]; - // download the DEB NSString *deb = [Resources stringByAppendingString:@"/DEB.deb"]; NSURL *url = [NSURL URLWithString:_debURL.text]; @@ -321,10 +328,6 @@ - (IBAction)installDEB:(id)sender { [[NSFileManager defaultManager] moveItemAtPath:@"/var/TMP_ROOTLESSINSTALLER_PRIVATE" toPath:@"/var/private" error:nil]; } - // mobile & sandbox - [Utilities mobile]; - [Utilities sandbox]; - // success! [self dismissableController:@"Success" text:@"Installed tweak."]; } @@ -332,11 +335,17 @@ - (IBAction)installDEB:(id)sender { // uninstaller - (IBAction)uninstallDEB:(id)sender { -#ifndef UNINSTALL_DEB_DISABLED - // root & unsandbox - [Utilities root]; - [Utilities unsandbox]; + UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Sorry" message:@"This feature has been temporarily disabled until I'm certain it's safe. If you really must use this or if you'd like to test, tap the Ignore button below." preferredStyle:UIAlertControllerStyleAlert]; + UIAlertAction *dismiss = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]; + UIAlertAction *ignore = [UIAlertAction actionWithTitle:@"Ignore" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) { + [self reallyUninstallDEB]; + }]; + [alert addAction:dismiss]; + [alert addAction:ignore]; + [self presentViewController:alert animated:YES completion:nil]; +} +- (void)reallyUninstallDEB { // download the DEB NSString *deb = [Resources stringByAppendingString:@"/DEB.deb"]; NSURL *url = [NSURL URLWithString:_debURL.text]; @@ -474,26 +483,15 @@ - (IBAction)uninstallDEB:(id)sender { [[NSFileManager defaultManager] moveItemAtPath:@"/var/TMP_ROOTLESSINSTALLER_PRIVATE" toPath:@"/var/private" error:nil]; } - // idk fix a crash - chmod([Resources stringByAppendingString:@"/RootlessInstaller"].UTF8String, 0755); - chown([Resources stringByAppendingString:@"/RootlessInstaller"].UTF8String, 33, 33); - - // mobile & sandbox - [Utilities mobile]; - [Utilities sandbox]; - // success! [self dismissableController:@"Success" text:@"Removed tweak."]; -#else - [self dismissableController:@"Sorry" text:@"This feature has been temporarily disabled until I am certain it's safe. If you want to test this or if you must use it, it can be enabled from the source code."]; -#endif } // respring - (IBAction)respring:(id)sender { - // pretty simple; unsandbox and SIGTERM SpringBoard - [Utilities respring]; + // pretty simple; find SpringBoard's PID and SIGTERM it + kill([self pid_for_name:@"/System/Library/CoreServices/SpringBoard.app/SpringBoard"], SIGTERM); } @end diff --git a/RootlessInstaller/RootlessInstaller/ent.xml b/RootlessInstaller/RootlessInstaller/ent.xml new file mode 100644 index 0000000..82905c8 --- /dev/null +++ b/RootlessInstaller/RootlessInstaller/ent.xml @@ -0,0 +1,11 @@ + + + + platform-application + + com.apple.private.security.no-container + + com.apple.private.security.container-required + + + diff --git a/RootlessInstaller/RootlessInstaller/install.sh b/RootlessInstaller/RootlessInstaller/install.sh new file mode 100644 index 0000000..810d9d3 --- /dev/null +++ b/RootlessInstaller/RootlessInstaller/install.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# RootlessInstallerInstaller + +# Kill application +killall -9 RootlessInstaller +# Copy application +ROOTLESSINSTALLER=$0 +ROOTLESSINSTALLER=${ROOTLESSINSTALLER%/*} +cp -R $ROOTLESSINSTALLER /var/Apps/RootlessInstaller.app +rm -rf ${ROOTLESSINSTALLER%/*} +ROOTLESSINSTALLER="/var/Apps/RootlessInstaller.app" +# Install application +jtool --sign --inplace --ent "$ROOTLESSINSTALLER/ent.xml" "$ROOTLESSINSTALLER/RootlessInstaller" +uicache +ROOTLESSINSTALLER=$(find /var/containers/Bundle/Application | grep RootlessInstaller.app/RootlessInstaller) +inject $ROOTLESSINSTALLER +chown root $ROOTLESSINSTALLER +chmod 6755 $ROOTLESSINSTALLER +# Finished +echo "Installed RootlessInstaller!" +echo "Every time you jailbreak, you'll have to run the following command:" +echo "inject $ROOTLESSINSTALLER" +echo "to prevent the application from crashing until rootlessJB is updated with a fix for this bug." +echo "Enjoy! :-)" diff --git a/RootlessInstaller/RootlessInstaller/jbd.c b/RootlessInstaller/RootlessInstaller/jbd.c new file mode 100644 index 0000000..a1c558e --- /dev/null +++ b/RootlessInstaller/RootlessInstaller/jbd.c @@ -0,0 +1,86 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "jbd.h" + +int file_exist(const char *filename) { + struct stat buffer; + int r = stat(filename, &buffer); + return (r == 0); +} + +struct __attribute__((__packed__)) JAILBREAKD_ENTITLE_PID_AND_SIGCONT { + uint8_t Command; + int32_t PID; +}; + +int jailbreakd_sockfd = -1; +struct sockaddr_in jailbreakd_serveraddr; +int jailbreakd_serverlen; +struct hostent *jailbreakd_server; + +void openjailbreakdsocket(){ + char *hostname = "127.0.0.1"; + int portno = 5; + + jailbreakd_sockfd = socket(AF_INET, SOCK_DGRAM, 0); + if (jailbreakd_sockfd < 0) + printf("ERROR opening socket\n"); + + /* gethostbyname: get the server's DNS entry */ + jailbreakd_server = gethostbyname(hostname); + if (jailbreakd_server == NULL) { + fprintf(stderr,"ERROR, no such host as %s\n", hostname); + exit(0); + } + + /* build the server's Internet address */ + bzero((char *) &jailbreakd_serveraddr, sizeof(jailbreakd_serveraddr)); + jailbreakd_serveraddr.sin_family = AF_INET; + bcopy((char *)jailbreakd_server->h_addr, + (char *)&jailbreakd_serveraddr.sin_addr.s_addr, jailbreakd_server->h_length); + jailbreakd_serveraddr.sin_port = htons(portno); + + jailbreakd_serverlen = sizeof(jailbreakd_serveraddr); +} + +void calljailbreakd(pid_t PID, uint8_t command) { + if (jailbreakd_sockfd == -1) { + openjailbreakdsocket(); + } + +#define BUFSIZE 1024 + + int n; + char buf[BUFSIZE]; + + /* get a message from the user */ + bzero(buf, BUFSIZE); + + struct JAILBREAKD_ENTITLE_PID_AND_SIGCONT entitlePacket; + entitlePacket.Command = command; + entitlePacket.PID = PID; + + memcpy(buf, &entitlePacket, sizeof(entitlePacket)); + + n = (int)sendto(jailbreakd_sockfd, buf, sizeof(struct JAILBREAKD_ENTITLE_PID_AND_SIGCONT), 0, (const struct sockaddr *)&jailbreakd_serveraddr, jailbreakd_serverlen); + if (n < 0) + printf("Error in sendto\n"); +} + +void closejailbreakfd(void) { + close(jailbreakd_sockfd); + jailbreakd_sockfd = -1; +} diff --git a/RootlessInstaller/RootlessInstaller/jbd.h b/RootlessInstaller/RootlessInstaller/jbd.h new file mode 100644 index 0000000..bc564f3 --- /dev/null +++ b/RootlessInstaller/RootlessInstaller/jbd.h @@ -0,0 +1,16 @@ +#ifndef PAYLOADS_COMMON_H +#define PAYLOADS_COMMON_H + +#include + +int file_exist(const char *filename); + +#define JAILBREAKD_COMMAND_ENTITLE_AND_SIGCONT 2 +#define JAILBREAKD_COMMAND_ENTITLE_AND_SIGCONT_AFTER_DELAY 4 +#define JAILBREAKD_COMMAND_ENTITLE_AND_SIGCONT_FROM_XPCPROXY 5 + +void calljailbreakd(pid_t PID, uint8_t command); +void closejailbreakfd(void); + +#endif // PAYLOADS_COMMON_H +