66#include < spawn.h>
77
88int csops (pid_t pid, unsigned int ops, void *useraddr, size_t usersize);
9- int csops_audittoken (pid_t pid, unsigned int ops, void * useraddr, size_t usersize, audit_token_t * token);
10- bool os_variant_has_internal_content (const char * subsystem);
119int ptrace (int , int , int , int );
1210uint32_t SecTaskGetCodeSignStatus ();
1311
14- int (*orig_csops)(pid_t pid, unsigned int ops, void * useraddr, size_t usersize);
15- int (*orig_csops_audittoken)(pid_t pid, unsigned int ops, void * useraddr, size_t usersize, audit_token_t * token);
12+ void redirectFunction (void *patchAddr, void *target);
1613
1714// JIT
1815#define CS_DEBUGGED 0x10000000
@@ -29,10 +26,6 @@ uint32_t hooked_SecTaskGetCodeSignStatus() {
2926 return 0x36803809 ; // CS_PLATFORM_BINARY
3027}
3128
32- bool hooked_os_variant_has_internal_content (const char * subsystem) {
33- return true ;
34- }
35-
3629int (*SBSystemAppMain)(int argc, char *argv[], char *envp[]);
3730
3831int main (int argc, char *argv[], char *envp[]) {
@@ -51,16 +44,15 @@ int main(int argc, char *argv[], char *envp[]) {
5144 }
5245 }
5346
54- assert (isJITEnabled ());
55- MSHookFunction (&SecTaskGetCodeSignStatus, &hooked_SecTaskGetCodeSignStatus, NULL );
56- MSHookFunction (&os_variant_has_internal_content, &hooked_os_variant_has_internal_content, NULL );
47+ // assert(isJITEnabled());
48+ redirectFunction ((void *)SecTaskGetCodeSignStatus, (void *)hooked_SecTaskGetCodeSignStatus);
5749
58- [NSUserDefaults .standardUserDefaults setBool: YES forKey: @" SBDontLockAfterCrash" ];
50+ // [NSUserDefaults.standardUserDefaults setBool:YES forKey:@"SBDontLockAfterCrash"];
5951 void *handle = dlopen (" /System/Library/PrivateFrameworks/SpringBoard.framework/SpringBoard" , RTLD_GLOBAL);
6052
6153 void *tweakHandle = dlopen (" @executable_path/SpringBoardTweak.dylib" , RTLD_GLOBAL|RTLD_NOW);
6254 if (!tweakHandle) {
63- // [@(dlerror()) writeToFile:@"/tmp/AAAAA.txt" atomically:YES];
55+ [@(dlerror ()) writeToFile: @" /tmp/AAAAA.txt" atomically: YES ];
6456 abort ();
6557 }
6658
0 commit comments