-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'ichi/master'
- Loading branch information
Showing
8 changed files
with
163 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
DEBUG = 0 | ||
ARCHS = arm64 arm64e | ||
|
||
TOOL_NAME = kernbypassd | ||
kernbypassd_FILES = kernbypassd.m | ||
kernbypassd_CFLAGS = -objc-arc | ||
kernbypassd_CODESIGN_FLAGS = -S../ent.plist | ||
|
||
include $(THEOS)/makefiles/common.mk | ||
include $(THEOS_MAKE_PATH)/tool.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#include <spawn.h> | ||
#import <dlfcn.h> | ||
#import <sys/sysctl.h> | ||
|
||
#define FLAG_PLATFORMIZE (1 << 1) | ||
|
||
static void easy_spawn(const char* args[]) { | ||
pid_t pid; | ||
int status; | ||
posix_spawn(&pid, args[0], NULL, NULL, (char* const*)args, NULL); | ||
waitpid(pid, &status, WEXITED); | ||
} | ||
|
||
void platformize_me() { | ||
void* handle = dlopen("/usr/lib/libjailbreak.dylib", RTLD_LAZY); | ||
if (!handle) return; | ||
// Reset errors | ||
dlerror(); | ||
typedef void (*fix_entitle_prt_t)(pid_t pid, uint32_t what); | ||
fix_entitle_prt_t ptr = (fix_entitle_prt_t)dlsym(handle, "jb_oneshot_entitle_now"); | ||
|
||
const char *dlsym_error = dlerror(); | ||
if (dlsym_error) return; | ||
|
||
ptr(getpid(), FLAG_PLATFORMIZE); | ||
} | ||
|
||
void patch_setuid() { | ||
void* handle = dlopen("/usr/lib/libjailbreak.dylib", RTLD_LAZY); | ||
if (!handle) return; | ||
// Reset errors | ||
dlerror(); | ||
typedef void (*fix_setuid_prt_t)(pid_t pid); | ||
fix_setuid_prt_t ptr = (fix_setuid_prt_t)dlsym(handle, "jb_oneshot_fix_setuid_now"); | ||
|
||
const char *dlsym_error = dlerror(); | ||
if (dlsym_error) return; | ||
|
||
ptr(getpid()); | ||
} | ||
|
||
int main(int argc, char **argv, char **envp) { | ||
@autoreleasepool { | ||
patch_setuid(); | ||
platformize_me(); | ||
setuid(0); | ||
if((chdir("/")) < 0) { | ||
exit(EXIT_FAILURE); | ||
} | ||
|
||
printf("/usr/bin/changerootfs &\n"); | ||
easy_spawn((const char *[]){"/usr/bin/changerootfs", "&", NULL}); | ||
|
||
sleep(3); | ||
|
||
printf("disown %%1\n"); | ||
easy_spawn((const char *[]){"disown", "%1", NULL}); | ||
|
||
printf("RUNNING DAEMON\n"); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/sh | ||
|
||
if ! [ -d /var/MobileSoftwareUpdate/mnt1 ]; then | ||
echo "/var/MobileSoftwareUpdate/mnt1 FOLDER NOT FOUND" | ||
|
||
mkdir -p /var/MobileSoftwareUpdate/mnt1 | ||
chmod 700 /var/MobileSoftwareUpdate/mnt1 | ||
chown root:wheel /var/MobileSoftwareUpdate/mnt1 | ||
|
||
echo "/var/MobileSoftwareUpdate/mnt1 FOLDER CREATED SUCCESS" | ||
fi | ||
|
||
/usr/bin/changerootfs & | ||
|
||
echo "/usr/bin/changerootfs &" | ||
sleep 3 | ||
|
||
disown %1 | ||
echo "disown %1" | ||
|
||
echo "RUNNING DAEMON" | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
|
||
echo "Reboot after uninstalling." | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters