forked from akusio/KernBypass-Public
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ichitaso
committed
Nov 9, 2020
1 parent
f1b4573
commit 688b6c8
Showing
44 changed files
with
1,865 additions
and
546 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
Binary file not shown.
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 |
---|---|---|
@@ -1,126 +1,94 @@ | ||
#include <stdio.h> | ||
#import <Foundation/Foundation.h> | ||
#include <stdio.h> | ||
#include <stdint.h> | ||
#include <dirent.h> | ||
|
||
#include "config.h" | ||
#include "kernel.h" | ||
#include "vnode_utils.h" | ||
#include "utils.h" | ||
|
||
#include <dirent.h> | ||
|
||
//#if 0 | ||
extern CFNotificationCenterRef CFNotificationCenterGetDistributedCenter(void); | ||
|
||
bool change_rootvnode(uint64_t vp, pid_t pid){ | ||
|
||
if(!vp) return false; | ||
bool change_rootvnode(uint64_t vp, pid_t pid) { | ||
|
||
printf("getting proc_t\n"); | ||
if (!vp) return false; | ||
printf("vp:%"PRIx64"\n",vp); | ||
|
||
uint64_t proc = proc_of_pid(pid); | ||
|
||
if(!proc) return false; | ||
|
||
printf("reading pfd\n"); | ||
printf("getting proc_t:%"PRIx64"\n",proc); | ||
|
||
if (!proc) return false; | ||
|
||
uint64_t filedesc = kernel_read64(proc + off_p_pfd); | ||
|
||
printf("writing fd_cdir\n"); | ||
printf("reading pfd:%"PRIx64"\n",filedesc); | ||
|
||
kernel_write64(filedesc + off_fd_cdir, vp); | ||
|
||
printf("writing fd_rdir\n"); | ||
printf("writing fd_cdir:%"PRIx64"\n",(filedesc + off_fd_cdir)); | ||
|
||
kernel_write64(filedesc + off_fd_rdir, vp); | ||
|
||
printf("setting up fd_flags\n"); | ||
printf("writing fd_rdir:%"PRIx64"\n",(filedesc + off_fd_rdir)); | ||
|
||
uint32_t fd_flags = kernel_read32(filedesc + 0x58); | ||
|
||
printf("setting up fd_flags:%"PRIx64"\n",filedesc + 0x58); | ||
|
||
fd_flags |= 1; // FD_CHROOT = 1; | ||
|
||
kernel_write32(filedesc + 0x58, fd_flags); | ||
|
||
printf("finish\n"); | ||
printf("finish fd_flags:%"PRIx32"\n",fd_flags); | ||
return true; | ||
|
||
} | ||
|
||
uint64_t rootvp; | ||
|
||
void receive_notify_chrooter(CFNotificationCenterRef center, | ||
void * observer, | ||
CFStringRef name, | ||
const void * object, | ||
CFDictionaryRef userInfo){ | ||
NSDictionary* info = (__bridge NSDictionary*)userInfo; | ||
CFDictionaryRef userInfo) { | ||
|
||
NSDictionary *info = (__bridge NSDictionary*)userInfo; | ||
|
||
NSLog(@"receive notify %@", info); | ||
|
||
pid_t pid = [info[@"Pid"] intValue]; | ||
|
||
uint64_t rootvp = get_vnode_with_chdir(FAKEROOTDIR); | ||
set_vnode_usecount(rootvp, 0x2000, 0x2000); | ||
|
||
//change_rootvnode(FAKEROOTDIR, pid); | ||
|
||
change_rootvnode(rootvp, pid); | ||
|
||
//set_vnode_usecount(vnode_ref_by_chdir(FAKEROOTDIR), 0xf000); | ||
|
||
set_vnode_usecount(rootvp, 0x2000, 0x2000); | ||
|
||
usleep(100000); | ||
|
||
kill(pid, SIGCONT); | ||
|
||
} | ||
|
||
|
||
|
||
bool is_empty(const char* path){ | ||
|
||
DIR* dir = opendir(path); | ||
struct dirent* ent; | ||
int count = 0; | ||
|
||
while ((ent = readdir(dir)) != NULL) { | ||
count++; | ||
} | ||
|
||
if(count == 2){ | ||
return YES; | ||
}else{ | ||
return NO; | ||
} | ||
|
||
} | ||
|
||
|
||
int main(int argc, char *argv[], char *envp[]) { | ||
|
||
int err = init_kernel(); | ||
if (err) { | ||
printf("error init_kernel\n"); | ||
return 1; | ||
} | ||
|
||
if(is_empty(FAKEROOTDIR) || access(FAKEROOTDIR"/private/var/containers", F_OK) != 0){ | ||
if (is_empty(FAKEROOTDIR) || access(FAKEROOTDIR"/private/var/containers", F_OK) != 0) { | ||
printf("error fakeroot not mounted\n"); | ||
return 1; | ||
} | ||
|
||
//uint64_t rootvp = getVnodeAtPath(FAKEROOTDIR); | ||
chdir("/"); | ||
|
||
#pragma clang diagnostic push | ||
#pragma clang diagnostic ignored "-Wimplicit-function-declaration" | ||
|
||
|
||
CFNotificationCenterAddObserver(CFNotificationCenterGetDistributedCenter(), NULL, receive_notify_chrooter, (__bridge CFStringRef)@"jp.akusio.chrooter", NULL, CFNotificationSuspensionBehaviorDeliverImmediately); | ||
|
||
|
||
#pragma clang diagnostic pop | ||
|
||
|
||
CFNotificationCenterAddObserver(CFNotificationCenterGetDistributedCenter(), | ||
NULL, | ||
receive_notify_chrooter, | ||
CFSTR(Notify_Chrooter), | ||
NULL, | ||
CFNotificationSuspensionBehaviorDeliverImmediately); | ||
|
||
printf("start changerootfs\n"); | ||
|
||
|
||
FILE *fp = fopen(kernbypassMem, "w"); | ||
fclose(fp); | ||
|
||
CFRunLoopRun(); | ||
|
||
return 1; | ||
|
||
|
||
return 1; | ||
} | ||
//#endif | ||
//int main() {} |
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 |
---|---|---|
@@ -1,10 +1,17 @@ | ||
Package: jp.akusio.kernbypass | ||
Author: akusio | ||
Maintainer: ichitaso | ||
Name: KernBypass | ||
Version: 0.0.3 | ||
Depends: mobilesubstrate, applist, preferenceloader, firmware(>=12.0) | ||
Package: jp.akusio.kernbypass-unofficial | ||
Pre-Depends: firmware (>= 12.0), firmware (<< 14.2) | ||
Depends: mobilesubstrate, preferenceloader | ||
Conflicts: jp.akusio.kernbypass, com.apple.memecity | ||
Replaces: jp.akusio.kernbypass-unofficial | ||
Section: System | ||
Version: 0.0.4 | ||
Architecture: iphoneos-arm | ||
Description: kernel level jailbreak detection bypass. | ||
Depiction: http://akusio.github.io/descriptions/kernbypass/index.html | ||
Maintainer: akusio, Misty | ||
Author: akusio, Misty | ||
Section: System | ||
Depiction: https://cydia.ichitaso.com/depiction/kernbypass.html | ||
Homepage: https://ichitaso.com | ||
dev: akusio, Misty, ichitaso | ||
Tag: purpose::extension, compatible::ios12, compatible::ios13, compatible::ios14 | ||
Icon: file:///Library/PreferenceBundles/KernBypassPrefs.bundle/[email protected] |
Binary file not shown.
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 |
---|---|---|
@@ -1,10 +1,9 @@ | ||
DEBUG = 0 | ||
ARCHS = arm64 arm64e | ||
|
||
TOOL_NAME = kernbypassd | ||
kernbypassd_FILES = kernbypassd.m | ||
kernbypassd_CFLAGS = -objc-arc | ||
kernbypassd_CODESIGN_FLAGS = -S../ent.plist | ||
$(TOOL_NAME)_FILES = kernbypassd.m | ||
$(TOOL_NAME)_CFLAGS = -objc-arc | ||
$(TOOL_NAME)_CODESIGN_FLAGS = -S../ent.plist | ||
|
||
include $(THEOS)/makefiles/common.mk | ||
include $(THEOS_MAKE_PATH)/tool.mk |
Oops, something went wrong.