Skip to content

Commit

Permalink
1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Alticha authored Feb 16, 2019
1 parent bfc070f commit 935f98c
Show file tree
Hide file tree
Showing 30 changed files with 246 additions and 85 deletions.
4 changes: 4 additions & 0 deletions RootlessInstaller/RootlessInstaller.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -38,6 +39,7 @@
E002CC6E22186C8B00E13A87 /* ent.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = ent.xml; sourceTree = "<group>"; };
E003589222189DE5002A6853 /* jbd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jbd.h; sourceTree = "<group>"; };
E003589322189DE5002A6853 /* jbd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = jbd.c; sourceTree = "<group>"; };
E00358962218AC5F002A6853 /* install.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = install.sh; sourceTree = "<group>"; };
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 = "<group>"; };
E05B9A37220B31D700DDE972 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -130,6 +132,7 @@
E0E3DD0E220F5EB2002777B8 /* resources */ = {
isa = PBXGroup;
children = (
E00358962218AC5F002A6853 /* install.sh */,
E0E3DD16220F7B4B002777B8 /* ldid2.tar.gz */,
E06C63CB220E1F8300B6679C /* patch.sh */,
E002CC6E22186C8B00E13A87 /* ent.xml */,
Expand Down Expand Up @@ -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 */,
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
</Bucket>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>RootlessInstaller.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
},
{
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion RootlessInstaller/RootlessInstaller/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<string>1.0.2</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
Expand Down
4 changes: 2 additions & 2 deletions RootlessInstaller/RootlessInstaller/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<constraints>
<constraint firstAttribute="height" constant="50" id="Ahd-yP-QbW"/>
</constraints>
<string key="text">Alticha - version 1.0.1
<string key="text">Alticha - version 1.0.2
this is strictly for tweaks</string>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
Expand All @@ -78,7 +78,7 @@ this is strictly for tweaks</string>
<constraint firstAttribute="height" constant="50" id="sh6-Yc-OzY"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<state key="normal" title="Exploit">
<state key="normal" title="Get root">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<userDefinedRuntimeAttributes>
Expand Down
132 changes: 65 additions & 67 deletions RootlessInstaller/RootlessInstaller/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,17 @@
#include <spawn.h>
#include <sys/sysctl.h>
#include <sys/stat.h>
#include "kernel_memory.h"
#include <sys/utsname.h>
#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_____;\
Expand All @@ -28,8 +21,6 @@
}
#define retrn(why) \
{\
[[[Post alloc] init] mobile];\
[[[Post alloc] init] sandbox];\
[self dismissableController:@"Failed" text:@(why)];\
return;\
}
Expand Down Expand Up @@ -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<UITouch *> *)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;
}

Expand All @@ -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
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -321,22 +328,24 @@ - (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."];
}

// 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];
Expand Down Expand Up @@ -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
11 changes: 11 additions & 0 deletions RootlessInstaller/RootlessInstaller/ent.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>platform-application</key>
<true/>
<key>com.apple.private.security.no-container</key>
<true/>
<key>com.apple.private.security.container-required</key>
<false/>
</dict>
</plist>
Loading

0 comments on commit 935f98c

Please sign in to comment.