diff options
| author | spv <aquaticvegetable@gmail.com> | 2022-04-22 13:33:36 -0400 |
|---|---|---|
| committer | spv <aquaticvegetable@gmail.com> | 2022-04-22 13:33:36 -0400 |
| commit | f6a6595c6df8266673decccbd909aecf4cd60cf0 (patch) | |
| tree | cd06d24ffd1fa8d67d95f4fd298a8133038383ff | |
| parent | 64ef7cbaf51af9a60c19ff28c8cb5537c8134454 (diff) | |
wip compile on device
| -rwxr-xr-x | build_native.sh | 22 | ||||
| -rw-r--r-- | ent.xml | 14 | ||||
| -rwxr-xr-x | src/common.h | 4 | ||||
| -rw-r--r-- | src/main.c | 31 |
4 files changed, 62 insertions, 9 deletions
diff --git a/build_native.sh b/build_native.sh new file mode 100755 index 0000000..12ec3b9 --- /dev/null +++ b/build_native.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +cat js/*.js > exp.js +echo >> exp.js +echo "main();" >> exp.js + +# build for host +gcc -I $(pwd)/inc/ \ + src/main.c \ + src/ip_tools.c \ + src/stage0_primitives.c \ + src/stage1_primitives.c \ + src/patchfinder.c \ + src/stage2.c \ + src/shit.c \ + -o bin/main_arm \ + -D__WHOAMI__="\"$(whoami)\"" \ + -D__PWD__="\"$(pwd)\"" \ + -g \ + --std=c99 + +ldid -Sent.xml bin/main_arm @@ -1,8 +1,8 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>get-task-allow</key>
- <true/>
-</dict>
+<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>get-task-allow</key> + <true/> +</dict> </plist>
\ No newline at end of file diff --git a/src/common.h b/src/common.h index 8f5a32b..9550400 100755 --- a/src/common.h +++ b/src/common.h @@ -12,4 +12,6 @@ struct racoon_offsets { extern char* fuck_memory_leaks; -#endif
\ No newline at end of file +void* memmem(const void *l, size_t l_len, const void *s, size_t s_len); + +#endif @@ -11,7 +11,6 @@ #include <string.h> #include <stdio.h> - #include "stage1_primitives.h" #include "stage0_primitives.h" #include "patchfinder.h" @@ -23,6 +22,36 @@ uint32_t DNS4_OFFSET; uint32_t LC_CONF_OFFSET; +// https://opensource.apple.com/source/Libc/Libc-825.26/string/FreeBSD/memmem.c.auto.html +void * +memmem(const void *l, size_t l_len, const void *s, size_t s_len) +{ + register char *cur, *last; + const char *cl = (const char *)l; + const char *cs = (const char *)s; + + /* we need something to compare */ + if (l_len == 0 || s_len == 0) + return NULL; + + /* "s" must be smaller or equal to "l" */ + if (l_len < s_len) + return NULL; + + /* special case where s_len == 1 */ + if (s_len == 1) + return memchr(l, (int)*cs, l_len); + + /* the last position where its possible to find "s" in "l" */ + last = (char *)cl + l_len - s_len; + + for (cur = (char *)cl; cur <= last; cur++) + if (cur[0] == cs[0] && memcmp(cur, cs, s_len) == 0) + return cur; + + return NULL; +} + char* fuck_memory_leaks = NULL; FILE* fp = NULL; |
