Created
December 22, 2014 08:40
-
-
Save oliverchang/8f0bb6bf92ae17378678 to your computer and use it in GitHub Desktop.
catalyst_patch_load_extension.sh
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
#!/bin/sh | |
LOAD_EXTENSION_OFF=$(printf "%d" 0x`objdump -d $1 | grep -m1 '<LoadExtension@plt>:' | cut -d' ' -f1`) | |
LOAD_EXTENSION_LIST_OFF=$(printf "%d" 0x`objdump -d $1 | grep -m1 '<LoadExtensionList@plt>:' | cut -d' ' -f1`) | |
DIFF=$((LOAD_EXTENSION_LIST_OFF - LOAD_EXTENSION_OFF)) | |
cat << EOF > patch$$.asm | |
BITS 64 | |
mov rsi, rdx | |
xor rsi, rsi | |
inc rsi | |
jmp $((DIFF)) | |
EOF | |
nasm -o patch$$.bin patch$$.asm | |
dd conv=notrunc if=patch.bin bs=1 count=14 seek=$LOAD_EXTENSION_OFF of=$1 | |
rm patch$$.bin | |
rm patch$$.asm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment