modified paths

This commit is contained in:
nullifiedcat 2017-02-24 17:01:24 +03:00
parent 347d1b5b24
commit 3a226c344d
3 changed files with 8 additions and 8 deletions

6
attach
View File

@ -20,16 +20,16 @@ fi
echo Running instances: ${arr[@]}
echo Attaching to ${arr[$1]}
if grep -q $(realpath libcathook.so) /proc/${arr[$1]}/maps; then
if grep -q $(realpath bin/libcathook.so) /proc/${arr[$1]}/maps; then
echo already loaded
exit
fi
echo loading $(realpath libcathook.so) to ${arr[$1]}
echo loading $(realpath bin/libcathook.so) to ${arr[$1]}
gdb -n -q -batch \
-ex "attach ${arr[$1]}" \
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \
-ex "call \$dlopen(\"$(realpath libcathook.so)\", 1)" \
-ex "call \$dlopen(\"$(realpath bin/libcathook.so)\", 1)" \
-ex "call dlerror()" \
-ex 'print (char *) $2' \
-ex "detach" \

View File

@ -22,18 +22,18 @@ proc=${arr[$inst]}
echo Running instances: ${arr[@]}
echo Attaching to $proc
sudo ./detach $inst libcathook.so
sudo ./detach $inst bin/libcathook.so
if grep -q $(realpath libcathook.so) /proc/$proc/maps; then
if grep -q $(realpath bin/libcathook.so) /proc/$proc/maps; then
echo already loaded
exit
fi
echo loading $(realpath libcathook.so) to $proc
echo loading $(realpath bin/libcathook.so) to $proc
gdb -n -q -batch \
-ex "attach $proc" \
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \
-ex "call \$dlopen(\"$(realpath libcathook.so)\", 1)" \
-ex "call \$dlopen(\"$(realpath bin/libcathook.so)\", 1)" \
-ex "call dlerror()" \
-ex 'print (char *) $2' \
-ex "continue" \

2
detach
View File

@ -20,7 +20,7 @@ fi
echo Running instances: ${arr[@]}
echo Detaching from ${arr[$1]}
if grep -q $(realpath libcathook.so) /proc/${arr[$1]}/maps; then
if grep -q $(realpath bin/libcathook.so) /proc/${arr[$1]}/maps; then
gdb -n -q -batch \
-ex "attach ${arr[$1]}" \
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \