From 4431270bde6ce00a1cc4e832ad242c4a7bd0ff72 Mon Sep 17 00:00:00 2001 From: hrtowii <68852354+hrtowii@users.noreply.github.com> Date: Sun, 28 Jul 2024 23:34:31 +0800 Subject: [PATCH] Unfuck up shit --- .gitignore | 1 + .../launchdshim/launchdhook/jitter/jitter.m | 13 +++++++++---- RootHelperSample/main.m | 12 ++++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 69550e6..846cc0b 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ ChOma_host *.dylib RootHelperSample/launchdshim/launchdhook/jitter/jitter Bootstrap/jb +.stamp diff --git a/RootHelperSample/launchdshim/launchdhook/jitter/jitter.m b/RootHelperSample/launchdshim/launchdhook/jitter/jitter.m index f5e8eb0..61c1760 100644 --- a/RootHelperSample/launchdshim/launchdhook/jitter/jitter.m +++ b/RootHelperSample/launchdshim/launchdhook/jitter/jitter.m @@ -13,12 +13,12 @@ #include "../fun/memoryControl.h" #include "../jbserver/bsm/audit.h" #include "../jbserver/xpc_private.h" - +#include #define PT_DETACH 11 /* stop tracing a process */ #define PT_ATTACHEXC 14 /* attach to running process with signal exception */ #define MEMORYSTATUS_CMD_SET_JETSAM_HIGH_WATER_MARK 5 #define JBD_MSG_PROC_SET_DEBUGGED 23 - +bool shouldUiCache = true; int ptrace(int request, pid_t pid, caddr_t addr, int data); // void JBLogError(const char *format, ...); // void JBLogDebug(const char *format, ...); @@ -94,7 +94,13 @@ int main(int argc, char* argv[]) { @autoreleasepool { setJetsamEnabled(true); - + if (shouldUiCache == true) { + pid_t pid; + extern char **environ; + char *argv[] = {"/var/jb/usr/bin/uicache", "-a", NULL}; + posix_spawn(&pid, argv[0], NULL, NULL, argv, environ); + shouldUiCache = false; + } mach_port_t machPort = 0; kern_return_t kr = bootstrap_check_in(bootstrap_port, "com.hrtowii.jitterd", &machPort); if (kr != KERN_SUCCESS) { @@ -122,7 +128,6 @@ int main(int argc, char* argv[]) jitterd_received_message(lMachPort, true); }); dispatch_resume(sourceSystemWide); - dispatch_main(); return 0; } diff --git a/RootHelperSample/main.m b/RootHelperSample/main.m index 97f553c..b32b445 100644 --- a/RootHelperSample/main.m +++ b/RootHelperSample/main.m @@ -414,6 +414,18 @@ int main(int argc, char *argv[], char *envp[]) { jbrootobjc(@"/Library/LaunchDaemons/com.hrtowii.jitterd.plist"), @"/var/jb", ]; + if ([fileManager fileExistsAtPath:@"/var/jb/"]) { + NSDirectoryEnumerator *dirEnum = [fileManager enumeratorAtPath:@"/var/jb/"]; + NSString *documentsName; + while (documentsName = [dirEnum nextObject]) { + NSString *filePath = [@"/var/jb/" stringByAppendingString:documentsName]; + BOOL isFileDeleted = [fileManager removeItemAtPath:filePath error:nil]; + if(isFileDeleted == NO) { + NSLog(@"All Contents not removed"); + break; + } + } + } for (NSString *path in pathsToRemove) { if ([fileManager fileExistsAtPath:path]) { if (![fileManager removeItemAtPath:path error:&error]) {