Skip to content

Commit

Permalink
Removed unused hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
asdfugil committed Aug 9, 2024
1 parent 84213cf commit 1e836ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 60 deletions.
2 changes: 2 additions & 0 deletions plooshInit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2063,6 +2063,7 @@
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
Expand Down Expand Up @@ -2134,6 +2135,7 @@
GCC_C_LANGUAGE_STANDARD = gnu17;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
Expand Down
63 changes: 3 additions & 60 deletions src/systemhook/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,28 +286,6 @@ SHOOK_EXPORT const char * libroot_get_boot_uuid(void) {
return "00000000-0000-0000-0000-000000000000";
}


void* dlopen_from_hook(const char* path, int mode, void* addressInCaller)
{
return dlopen_from(path, mode, addressInCaller);
}

void* dlopen_hook(const char* path, int mode)
{
void* callerAddress = __builtin_return_address(0);
return dlopen_from_hook(path, mode, callerAddress);
}

void* dlopen_audited_hook(const char* path, int mode)
{
return dlopen_audited(path, mode);
}

bool dlopen_preflight_hook(const char* path)
{
return dlopen_preflight(path);
}

int sandbox_init_hook(const char *profile, uint64_t flags, char **errorbuf)
{
int retval = sandbox_init(profile, flags, errorbuf);
Expand Down Expand Up @@ -335,32 +313,6 @@ int sandbox_init_with_extensions_hook(const char *profile, uint64_t flags, const
return retval;
}

int ptrace_hook(int request, pid_t pid, caddr_t addr, int data)
{
int retval = ptrace(request, pid, addr, data);
return retval;
}

pid_t fork_hook(void)
{
return fork();
}

pid_t vfork_hook(void)
{
return vfork();
}

pid_t forkpty_hook(int *amaster, char *name, struct termios *termp, struct winsize *winp)
{
return forkpty(amaster, name, termp, winp);
}

int daemon_hook(int __nochdir, int __noclose)
{
return daemon(__nochdir, __noclose);
}

bool shouldEnableTweaks(void)
{
if (pflags & (palerain_option_safemode | palerain_option_force_revert | palerain_option_setup_rootful)) {
Expand Down Expand Up @@ -464,13 +416,13 @@ __attribute__((constructor)) static void initializer(void)
strcmp(gExecutablePath, "/usr/sbin/cfprefsd") == 0 ||
strcmp(gExecutablePath, "/Applications/PineBoard.app/PineBoard") == 0 ||
strcmp(gExecutablePath, "/Applications/HeadBoard.app/HeadBoard") == 0) {
dlopen_hook("/cores/binpack/usr/lib/universalhooks.dylib", RTLD_NOW);
dlopen("/cores/binpack/usr/lib/universalhooks.dylib", RTLD_NOW);
}
}
if (release >= 24) {
if (stringEndsWith(gExecutablePath, "/TrollStore.app/trollstorehelper")) {
if (getuid() == 0)
dlopen_hook("/cores/binpack/usr/lib/universalhooks.dylib", RTLD_NOW);
dlopen("/cores/binpack/usr/lib/universalhooks.dylib", RTLD_NOW);
}
}
}
Expand Down Expand Up @@ -503,7 +455,7 @@ __attribute__((constructor)) static void initializer(void)
} else tweakLoaderPath = JB_TweakLoaderPath;
if(access(tweakLoaderPath, F_OK) == 0)
{
void *tweakLoaderHandle = dlopen_hook(tweakLoaderPath, RTLD_NOW);
void *tweakLoaderHandle = dlopen(tweakLoaderPath, RTLD_NOW);
if (tweakLoaderHandle != NULL) {
dlclose(tweakLoaderHandle);
}
Expand Down Expand Up @@ -685,18 +637,9 @@ DYLD_INTERPOSE(execv_hook, execv)
DYLD_INTERPOSE(execl_hook, execl)
DYLD_INTERPOSE(execvp_hook, execvp)
DYLD_INTERPOSE(execvP_hook, execvP)
DYLD_INTERPOSE(dlopen_hook, dlopen)
DYLD_INTERPOSE(dlopen_from_hook, dlopen_from)
DYLD_INTERPOSE(dlopen_audited_hook, dlopen_audited)
DYLD_INTERPOSE(dlopen_preflight_hook, dlopen_preflight)
DYLD_INTERPOSE(sandbox_init_hook, sandbox_init)
DYLD_INTERPOSE(sandbox_init_with_parameters_hook, sandbox_init_with_parameters)
DYLD_INTERPOSE(sandbox_init_with_extensions_hook, sandbox_init_with_extensions)
DYLD_INTERPOSE(ptrace_hook, ptrace)
DYLD_INTERPOSE(fork_hook, fork)
DYLD_INTERPOSE(vfork_hook, vfork)
DYLD_INTERPOSE(forkpty_hook, forkpty)
DYLD_INTERPOSE(daemon_hook, daemon)
DYLD_INTERPOSE(reboot3_hook, reboot3)

__API_AVAILABLE(macos(10.15), ios(13.0), tvos(13.0), bridgeos(4.0))
Expand Down

0 comments on commit 1e836ae

Please sign in to comment.