Add unload to injector script

Usage: ./inject unload
This commit is contained in:
8dcc 2023-07-21 06:29:41 +02:00
parent b76e33d526
commit 80242d0a3f
1 changed files with 21 additions and 3 deletions

View File

@ -6,6 +6,24 @@ libpath=$(realpath "libhlcheat.so")
# Used to echo the command. For debugging.
#set -x
if [ "$1" == "unload" ]; then
sudo gdb -n -q -batch \
-ex "attach $pid" \
-ex "set \$dlopen = (void* (*)(char*, int))dlopen" \
-ex "set \$dlclose = (int (*)(void*))dlclose" \
-ex "set \$dlerror = (char* (*)(void))dlerror" \
\
-ex "set \$self = \$dlopen(\"$libpath\", 6)" \
-ex "call \$dlclose(\$self)" \
-ex "call \$dlclose(\$self)" \
\
-ex "call \$dlerror()" \
-ex "detach" \
-ex "quit"
exit 0;
fi
if grep -q "$libpath" "/proc/$pid/maps"; then
echo -e "hl-cheat already loaded. Reloading...\n";