Skip to content

Commit 5e129e9

Browse files
committed
improvements and fixes
1: fixed the issue of SMS app lag/crash after injecting tweaks 2: fxied an issue that could cause Springboard to crash. 3: fxied the issue of NSTask not working 4: enhanced tweak compatibility 5: fix compatibility issues with iOS15 6: enhance the compatibility of the injection system app. 7: fixed issues that could cause system panic/reboot 8: fixed issues where some packages(eg:llvm*)cannot be installed correctly. 9: fixed the black screen issue when launching the injected system app 10: fixed an issue where iCloud backup might not work on iOS 17.0.
1 parent 68dea4d commit 5e129e9

6 files changed

Lines changed: 39 additions & 27 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ packages/
55
.vscode/
66
/Bootstrap/basebin
77
/Bootstrap.xcodeproj/project.xcworkspace/xcuserdata
8+
/sandbox-profiles

Bootstrap/AppEnabler.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ int backupApp(NSString* bundlePath)
150150
ASSERT([fm removeItemAtPath:backup error:nil]);
151151
}
152152

153-
ASSERT(clonefile(bundlePath.fileSystemRepresentation, backup.fileSystemRepresentation, CLONE_ACL) == 0);
153+
ASSERT(clonefile(bundlePath.fileSystemRepresentation, backup.fileSystemRepresentation, 0) == 0);
154154

155155
ASSERT([@"1" writeToFile:[backup.stringByDeletingLastPathComponent stringByAppendingPathComponent:@".appbackup"] atomically:YES encoding:NSUTF8StringEncoding error:nil]);
156156

Bootstrap/ViewController.m

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -447,21 +447,14 @@ void rebootUserspaceAction()
447447

448448
int exploitStart(NSString* execDir)
449449
{
450-
NSFileManager* fm = NSFileManager.defaultManager;
451-
452-
// Patch basebin plists
453-
NSURL *basebinDaemonsURL = [NSURL fileURLWithPath:jbroot(@"/basebin/LaunchDaemons")];
454-
for (NSURL *fileURL in [fm contentsOfDirectoryAtURL:basebinDaemonsURL includingPropertiesForKeys:nil options:0 error:nil]) {
455-
NSString* plistContent = [NSString stringWithContentsOfFile:fileURL.path encoding:NSUTF8StringEncoding error:nil];
456-
if(plistContent) {
457-
plistContent = [plistContent stringByReplacingOccurrencesOfString:@"@JBROOT@" withString:jbroot(@"/")];
458-
plistContent = [plistContent stringByReplacingOccurrencesOfString:@"@JBRAND@" withString:[NSString stringWithFormat:@"%016llX",jbrand()]];
459-
ASSERT([plistContent writeToFile:fileURL.path atomically:YES encoding:NSUTF8StringEncoding error:nil]);
460-
}
450+
NSString* log=nil;
451+
NSString* err=nil;
452+
int status = spawn_root(jbroot(@"/basebin/TaskPortHaxx"), @[execDir], &log, &err);
453+
if(status != 0) {
454+
STRAPLOG("TaskPortHaxx: %@", err); //only output stderr here
455+
return status;
461456
}
462457

463-
ASSERT(spawn_root(jbroot(@"/basebin/TaskPortHaxx"), @[execDir], nil, nil) == 0);
464-
465458
ASSERT(spawn_root(jbroot(@"/basebin/bsctl"), @[@"usreboot"], nil, nil) == 0);
466459

467460
return 0;
@@ -599,27 +592,37 @@ void bootstrapAction()
599592
[AppDelegate addLogText:Localized(@"exploit...")];
600593

601594
NSString* execDir = [@"/var/db/com.apple.xpc.roleaccountd.staging/exec-" stringByAppendingString:[[NSUUID UUID] UUIDString]];
595+
596+
NSString* log=nil;
597+
NSString* err=nil;
598+
int status = spawn_root(jbroot(@"/basebin/TaskPortHaxx"), @[@"prepare", execDir], &log, &err);
599+
if(status != 0) {
600+
[AppDelegate showMesage:[NSString stringWithFormat:@"%@\n\n%@\n\nstderr:\n%@",Localized(@"Please reboot device and try again!"),log,err] title:[NSString stringWithFormat:@"code(%d)",status]];
601+
return;
602+
}
602603

603604
@try {
604-
ASSERT(spawn_root(jbroot(@"/basebin/TaskPortHaxx"), @[@"prepare", execDir], nil, nil) == 0);
605-
606605
int load_trust_cache(NSString *tcPath);
607606
ASSERT(load_trust_cache(jbroot(@"/tmp/TaskPortHaxx/UpdateBrainService/AssetData/.TrustCache")) == 0);
608607
}
609608
@catch (NSException *exception)
610609
{
611-
[AppDelegate showMesage:[NSString stringWithFormat:@"***exception: %@", exception] title:@"ERROR"];
610+
[AppDelegate showMesage:[NSString stringWithFormat:@"***exception: %@\n\n%@", exception] title:@"ERROR"];
612611
return;
613612
}
614613

615614
const char* argv[] = {jbroot("/basebin/bsctl"), "resign", NULL};
616-
int status = spawn(argv[0], argv, environ, nil, ^(char* outstr, int length) {
615+
status = spawn(argv[0], argv, environ, nil, ^(char* outstr, int length) {
617616
NSString *str = [[NSString alloc] initWithBytes:outstr length:length encoding:NSASCIIStringEncoding];
618617
[AppDelegate addLogText:str];
619618
}, ^(char* errstr, int length){
620619
NSString *str = [[NSString alloc] initWithBytes:errstr length:length encoding:NSASCIIStringEncoding];
621620
[AppDelegate addLogText:[NSString stringWithFormat:@"ERR: %@\n",str]];
622621
});
622+
if(status != 0) {
623+
[AppDelegate showMesage:@"" title:[NSString stringWithFormat:@"code(%d)",status]];
624+
return;
625+
}
623626

624627
const char* argv2[] = {NSBundle.mainBundle.executablePath.fileSystemRepresentation, "exploit", execDir.fileSystemRepresentation, NULL};
625628
status = spawn(argv2[0], argv2, environ, nil, ^(char* outstr, int length) {
@@ -630,7 +633,7 @@ void bootstrapAction()
630633
[AppDelegate addLogText:[NSString stringWithFormat:@"ERR: %@\n",str]];
631634
});
632635
if(status!=0) {
633-
[AppDelegate showMesage:[NSString stringWithFormat:@"%@\n\nstderr:\n%@",log,err] title:[NSString stringWithFormat:@"code(%d)",status]];
636+
[AppDelegate showMesage:Localized(@"Please reboot device and try again!") title:[NSString stringWithFormat:@"code(%d)",status]];
634637
return;
635638
}
636639

@@ -643,7 +646,10 @@ void bootstrapAction()
643646

644647
[AppDelegate addLogText:Localized(@"respring now...")]; sleep(1);
645648
status = spawn_bootstrap_binary((char*[]){"/usr/bin/sbreload", NULL}, &log, &err);
646-
if(status!=0) [AppDelegate showMesage:[NSString stringWithFormat:@"%@\n\nstderr:\n%@",log,err] title:[NSString stringWithFormat:@"code(%d)",status]];
649+
if(status!=0) {
650+
[AppDelegate showMesage:[NSString stringWithFormat:@"%@\n\nstderr:\n%@",log,err] title:[NSString stringWithFormat:@"code(%d)",status]];
651+
return;
652+
}
647653

648654
});
649655
}

Bootstrap/bootstrap.m

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,17 @@ int rebuildBasebin()
143143
unlink(jbroot(@"/basebin/.jbroot").fileSystemRepresentation);
144144
ASSERT([fm createSymbolicLinkAtPath:jbroot(@"/basebin/.jbroot") withDestinationPath:@"../.jbroot" error:nil]); //use a relative path so libvroot won't remove it
145145

146+
// Patch basebin plists
147+
NSURL *basebinDaemonsURL = [NSURL fileURLWithPath:jbroot(@"/basebin/LaunchDaemons")];
148+
for (NSURL *fileURL in [fm contentsOfDirectoryAtURL:basebinDaemonsURL includingPropertiesForKeys:nil options:0 error:nil]) {
149+
NSString* plistContent = [NSString stringWithContentsOfFile:fileURL.path encoding:NSUTF8StringEncoding error:nil];
150+
if(plistContent) {
151+
plistContent = [plistContent stringByReplacingOccurrencesOfString:@"@JBROOT@" withString:jbroot(@"/")];
152+
plistContent = [plistContent stringByReplacingOccurrencesOfString:@"@JBRAND@" withString:[NSString stringWithFormat:@"%016llX",jbrand()]];
153+
ASSERT([plistContent writeToFile:fileURL.path atomically:YES encoding:NSUTF8StringEncoding error:nil]);
154+
}
155+
}
156+
146157
return 0;
147158
}
148159

basebin

Submodule basebin updated 48 files

entitlements.plist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@
3838
<key>com.apple.private.persona-mgmt</key>
3939
<true/>
4040

41-
<key>com.apple.security.exception.shared-preference.read-write</key>
42-
<array>
43-
<string>com.roothide.Bootstrap</string>
44-
<string>com.roothide.Bootstrap.shared</string>
45-
</array>
46-
4741
<key>com.apple.private.MobileContainerManager.allowed</key>
4842
<true/>
4943

0 commit comments

Comments
 (0)