Skip to content

Commit

Permalink
The secret sauce, get task and init kcall
Browse files Browse the repository at this point in the history
  • Loading branch information
xavo95 committed Mar 3, 2019
1 parent 1c66996 commit 706223f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
TARGET = jailbreakd
OUTDIR ?= bin

CC = xcrun -sdk iphoneos cc -arch arm64e -Iinclude -Ivoucher_swap/headers -Ivoucher_swap/voucher_swap -Ivoucher_swap/voucher_swap/kernel_call
CC = xcrun -sdk iphoneos cc -arch arm64e -Iinclude
LDID = ldid2
CFLAGS = -Wall -Wno-unused-variable -Wno-unused-function

Expand All @@ -19,7 +19,7 @@ endif
$(OUTDIR):
mkdir -p $(OUTDIR)

$(OUTDIR)/$(TARGET): voucher_swap/voucher_swap/*.c voucher_swap/voucher_swap/kernel_call/*c *.c *.m | $(OUTDIR)
$(OUTDIR)/$(TARGET): *.c *.m | $(OUTDIR)
$(CC) -o $@ $^ -framework Foundation -framework IOKit $(CFLAGS)

export LANG=C
Expand Down
1 change: 1 addition & 0 deletions kern_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ kern_return_t mach_vm_write(vm_map_t target_task, mach_vm_address_t address, vm_
kern_return_t mach_vm_allocate(vm_map_t target, mach_vm_address_t *address, mach_vm_size_t size, int flags);
kern_return_t mach_vm_deallocate(vm_map_t target, mach_vm_address_t address, mach_vm_size_t size);

uint64_t proc_find(int pd, int tries);
uint64_t find_port(mach_port_name_t port);

void fixupsetuid(int pid);
Expand Down
15 changes: 12 additions & 3 deletions main.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
#include "kmem.h"
#include "parameters.h"
#include "kernel_call.h"
#include "kernel_memory.h"
#include "kernel_slide.h"
#include "user_client.h"
#include "kc_parameters.h"
#include "offsetof.h"
#include "offsets.h"

#define PROC_PIDPATHINFO_MAXSIZE (4*MAXPATHLEN)
Expand Down Expand Up @@ -101,8 +102,16 @@ int runserver(){
NSLog(@"[jailbreakd] slide: 0x%016llx", kernel_slide);

kernel_task_port = tfpzero;
uint64_t our_proc = proc_find(getpid(), 1);
current_task = rk64(our_proc + offsetof_task);

parameters_init();
kernel_call_init();
bool ok = kernel_call_init();
if(!ok) {
NSLog(@"[jailbreakd] Failed to set kernel_call!");
exit(-1);
}
NSLog(@"[jailbreakd] Successfully set kernel_call!");

struct sockaddr_in serveraddr; /* server's addr */
struct sockaddr_in clientaddr; /* client addr */
Expand Down

0 comments on commit 706223f

Please # to comment.