You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
526 B
Plaintext
16 lines
526 B
Plaintext
4 years ago
|
#!/bin/sh
|
||
|
|
||
|
cp build/libexample.so /tmp/libexample.so
|
||
|
|
||
|
sudo gdb -n -q -batch \
|
||
|
-ex "attach $(pidof qemu-system-x86_64)" \
|
||
|
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \
|
||
|
-ex "set \$dlclose = (int(*)(void*)) dlclose" \
|
||
|
-ex "set \$dlerror = (char*(*)(void)) dlerror" \
|
||
|
-ex "set \$library = \$dlopen(\"/tmp/libexample.so\", 1)" \
|
||
|
-ex "p \$library ? \"Injection successful!\" : \"Injection failed!\"" \
|
||
|
-ex "call \$library ? \$dlclose(\$library) : \$dlerror()" \
|
||
|
-ex "detach" \
|
||
|
-ex "quit"
|
||
|
|