@@ -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 );
0 commit comments