Skip to content

Commit

Permalink
Unfuck up shit
Browse files Browse the repository at this point in the history
  • Loading branch information
hrtowii committed Jul 28, 2024
1 parent b040975 commit 4431270
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ ChOma_host
*.dylib
RootHelperSample/launchdshim/launchdhook/jitter/jitter
Bootstrap/jb
.stamp
13 changes: 9 additions & 4 deletions RootHelperSample/launchdshim/launchdhook/jitter/jitter.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
#include "../fun/memoryControl.h"
#include "../jbserver/bsm/audit.h"
#include "../jbserver/xpc_private.h"

#include <spawn.h>
#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, ...);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -122,7 +128,6 @@ int main(int argc, char* argv[])
jitterd_received_message(lMachPort, true);
});
dispatch_resume(sourceSystemWide);

dispatch_main();
return 0;
}
Expand Down
12 changes: 12 additions & 0 deletions RootHelperSample/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand Down

0 comments on commit 4431270

Please sign in to comment.