Created
January 16, 2016 08:07
-
-
Save falconscript/7f75bceee444eef39e61 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # Fixes compilation issues derived from armv7 -> armv7s/arm64 from iOS 7 to iOS 8 | |
| # I never fully understood what the reason was for executables just randomly breaking | |
| # But this will fix it | |
| if [ "$1" = "FIXALL" ]; then | |
| echo "[+] About to run ASM replacement on ALL files in /usr/sbin, /usr/bin, and /usr/local/bin." | |
| echo "[!] WARNING This may break things. HIT CTRL+C RIGHT NOW TO STOP. Otherwise hit enter. BACKUP YOUR DEVICE." | |
| read WARNING | |
| for i in `ls /usr/sbin`; do "$0" "/usr/sbin/$i"; done | |
| for i in `ls /usr/bin`; do "$0" "/usr/bin/$i"; done | |
| for i in `ls /usr/local/bin`; do "$0" "/usr/local/bin/$i"; done | |
| echo "[+] FINISHED. Hopefully the binaries work now and your device isn't DESTROYED." | |
| exit 0 | |
| fi | |
| if ! [ -z "$1" ]; then | |
| sed -i'' ' s/\x00\x30\x93\xe4/\x00\x30\x93\xe5/g;s/\x00\x30\xd3\xe4/\x00\x30\xd3\xe5/g;' "$1" | |
| echo "[+] Performing replace - $1" | |
| else | |
| echo "[+] Usage: $0 [filename] # Will replace incorrect processor instructions in iPhone binary" | |
| echo "[+] Usage2: $0 'FIXALL' # Will do replacing in ALL binaries for common binary paths" | |
| fi |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is used to fix "Illegal instruction: 4" errors on older executables.
Run:
./iphonefixbin.sh brokenfile
to fix it. This is useful after installing gcc/libgcc on iOS hoping to compile on iOS. Then you run
./iphonefixbin.sh FIXALL
in order to fix all the binary files in your main binary paths. The "sed" call is doing the processor instruction swap out.