Improve attach scripts

This commit is contained in:
roboot 2020-09-11 15:30:08 -05:00 committed by TotallyNotElite
parent 836f5ce3d4
commit 60437defac
3 changed files with 23 additions and 23 deletions

8
attach
View File

@ -43,10 +43,10 @@ echo loading "$FILENAME" to "$proc"
gdb -n -q -batch \ gdb -n -q -batch \
-ex "attach $proc" \ -ex "attach $proc" \
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \ -ex "echo \033[1mCalling dlopen\033[0m\n" \
-ex "call \$dlopen(\"$FILENAME\", 1)" \ -ex "call ((void*(*)(const char*, int))dlopen)(\"$FILENAME\", 1)" \
-ex "call dlerror()" \ -ex "echo \033[1mCalling dlerror\033[0m\n" \
-ex 'print (char *) $2' \ -ex "call ((char*(*)(void))dlerror)()" \
-ex "detach" \ -ex "detach" \
-ex "quit" -ex "quit"

View File

@ -43,10 +43,10 @@ echo loading "$FILENAME" to "$proc"
gdb -n -q -batch \ gdb -n -q -batch \
-ex "attach $proc" \ -ex "attach $proc" \
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \ -ex "echo \033[1mCalling dlopen\033[0m\n" \
-ex "call \$dlopen(\"$FILENAME\", 1)" \ -ex "call ((void*(*)(const char*, int))dlopen)(\"$FILENAME\", 1)" \
-ex "call dlerror()" \ -ex "echo \033[1mCalling dlerror\033[0m\n" \
-ex 'print (char *) $2' \ -ex "call ((char*(*)(void))dlerror)()" \
-ex "continue" \ -ex "continue" \
-ex "backtrace" -ex "backtrace"

View File

@ -50,12 +50,12 @@ sudo cp "bin/libcathook.so" "/lib/i386-linux-gnu/${FILENAME}"
echo loading "$FILENAME" to "$proc" echo loading "$FILENAME" to "$proc"
sudo gdb -n -q -batch \ gdb -n -q -batch \
-ex "attach $proc" \ -ex "attach $proc" \
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \ -ex "echo \033[1mCalling dlopen\033[0m\n" \
-ex "call \$dlopen(\"/lib/i386-linux-gnu/$FILENAME\", 1)" \ -ex "call ((void*(*)(const char*, int))dlopen)(\"/lib/i386-linux-gnu/$FILENAME\", 1)" \
-ex "call dlerror()" \ -ex "echo \033[1mCalling dlerror\033[0m\n" \
-ex 'print (char *) $2' \ -ex "call ((char*(*)(void))dlerror)()" \
-ex "detach" \ -ex "detach" \
-ex "quit" -ex "quit"