Skip to content

Commit 0b0a7e4

Browse files
committed
fixed that load trust cache failed on iphone15* ios17.0
1 parent 28797a2 commit 0b0a7e4

File tree

7 files changed

+25
-22
lines changed

7 files changed

+25
-22
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ packages/
44
/layout/
55
.vscode/
66
/Bootstrap/basebin
7+
/Bootstrap.xcodeproj/project.xcworkspace/xcuserdata

Bootstrap.xcodeproj/project.xcworkspace/xcuserdata/admin.xcuserdatad/IDEFindNavigatorScopes.plist

Lines changed: 0 additions & 5 deletions
This file was deleted.

Bootstrap/ViewController.m

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,7 @@ void initFromSwiftUI()
160160

161161
[AppDelegate addLogText:[NSString stringWithFormat:Localized(@"ios-version: %@"),UIDevice.currentDevice.systemVersion]];
162162

163-
struct utsname systemInfo;
164-
uname(&systemInfo);
163+
struct utsname systemInfo={0}; uname(&systemInfo);
165164
[AppDelegate addLogText:[NSString stringWithFormat:Localized(@"device-model: %s"),systemInfo.machine]];
166165

167166
[AppDelegate addLogText:[NSString stringWithFormat:Localized(@"app-version: %@"),NSBundle.mainBundle.infoDictionary[@"CFBundleShortVersionString"]]];
@@ -440,7 +439,7 @@ BOOL opensshAction(BOOL enable)
440439

441440
#define RESIGNED_SYSROOT_PATH jbroot(@"/.sysroot")
442441

443-
int exploitStart()
442+
int exploitStart(NSString* execDir)
444443
{
445444
NSFileManager* fm = NSFileManager.defaultManager;
446445

@@ -508,12 +507,6 @@ int exploitStart()
508507
ASSERT(spawnRoot(fastSignPath, @[destPath], nil, nil) == 0);
509508
}
510509

511-
512-
NSString* execDir = [@"/var/db/com.apple.xpc.roleaccountd.staging/exec-" stringByAppendingString:[[NSUUID UUID] UUIDString]];
513-
514-
int child_stage1_prepare(NSString* execDir);
515-
ASSERT(child_stage1_prepare(execDir) == 0);
516-
517510
ASSERT(spawnRoot(jbroot(@"/basebin/TaskPortHaxx"), @[execDir], nil, nil) == 0);
518511

519512
ASSERT(spawnRoot(jbroot(@"/basebin/bsctl"), @[@"usreboot"], nil, nil) == 0);
@@ -617,9 +610,6 @@ void bootstrapAction()
617610
[AppDelegate addLogText:[NSString stringWithFormat:@"ERR: %@\n",str]];
618611
});
619612

620-
[AppDelegate dismissHud];
621-
setIdleTimerDisabled(NO);
622-
623613
if(status != 0)
624614
{
625615
[AppDelegate showMesage:@"" title:[NSString stringWithFormat:@"code(%d)",status]];
@@ -654,7 +644,22 @@ void bootstrapAction()
654644
if(@available(iOS 16.0, *))
655645
{
656646
[AppDelegate addLogText:Localized(@"exploit...")];
657-
const char* argv2[] = {NSBundle.mainBundle.executablePath.fileSystemRepresentation, "exploit", NULL};
647+
648+
NSString* execDir = [@"/var/db/com.apple.xpc.roleaccountd.staging/exec-" stringByAppendingString:[[NSUUID UUID] UUIDString]];
649+
650+
@try {
651+
ASSERT(spawnRoot(jbroot(@"/basebin/TaskPortHaxx"), @[@"prepare", execDir], nil, nil) == 0);
652+
653+
int load_trust_cache(NSString *tcPath);
654+
ASSERT(load_trust_cache(jbroot(@"/tmp/TaskPortHaxx/UpdateBrainService/AssetData/.TrustCache")) == 0);
655+
}
656+
@catch (NSException *exception)
657+
{
658+
[AppDelegate showMesage:[NSString stringWithFormat:@"***exception: %@", exception] title:@"ERROR"];
659+
return;
660+
}
661+
662+
const char* argv2[] = {NSBundle.mainBundle.executablePath.fileSystemRepresentation, "exploit", execDir.fileSystemRepresentation, NULL};
658663
status = spawn(argv2[0], argv2, environ, nil, ^(char* outstr, int length) {
659664
NSString *str = [[NSString alloc] initWithBytes:outstr length:length encoding:NSASCIIStringEncoding];
660665
[AppDelegate addLogText:str];
@@ -670,6 +675,8 @@ void bootstrapAction()
670675
return;
671676
}
672677

678+
setIdleTimerDisabled(NO);
679+
[AppDelegate dismissHud];
673680
[generator impactOccurred];
674681

675682
[AppDelegate addLogText:Localized(@"respring now...")]; sleep(1);

Bootstrap/main.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ int main(int argc, char * argv[]) {
3232
exit(unbootstrap());
3333
} else if(strcmp(argv[1], "exploit")==0) {
3434
int exploitStart();
35-
exit(exploitStart());
35+
exit(exploitStart(@(argv[2])));
3636
} else if(strcmp(argv[1], "enableapp")==0) {
3737
int enableForApp(NSString* bundlePath);
3838
exit(enableForApp(@(argv[2])));

Bootstrap/seh.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#define ABORT() do {\
88
@throw [NSException\
99
exceptionWithName:@"ABORT"\
10-
reason:[NSString stringWithFormat:@"%s (%d)", __FILE_NAME__, __LINE__]\
10+
reason:[NSString stringWithFormat:@"%s: %s (%d)", __FILE_NAME__, __func__, __LINE__]\
1111
userInfo:nil];\
1212
} while(0)
1313

@@ -17,7 +17,7 @@
1717
#define ASSERT(...) do{if(!(__VA_ARGS__)) {\
1818
@throw [NSException\
1919
exceptionWithName:@"ASSERT"\
20-
reason:[NSString stringWithFormat:@"%s (%d): %s", __FILE_NAME__, __LINE__, #__VA_ARGS__]\
20+
reason:[NSString stringWithFormat:@"%s: %s (%d): %s", __FILE_NAME__, __func__, __LINE__, #__VA_ARGS__]\
2121
userInfo:nil];\
2222
}} while(0)
2323

0 commit comments

Comments
 (0)