Skip to content

Instantly share code, notes, and snippets.

@xmpf
Created February 17, 2021 21:10
Show Gist options
  • Save xmpf/66af365793281937a851a6b3b08f0718 to your computer and use it in GitHub Desktop.
Save xmpf/66af365793281937a851a6b3b08f0718 to your computer and use it in GitHub Desktop.
binary2shellcode
function bin2shellcode {
echo "----- CUT HERE -----"
sc=""
for i in $(objdump -d "$1" | awk -F"\t" '{ print $2 }' | tr '\n' ' ' | sed 's/\ //g' | fold -w 2 | paste -sd' ')
do
sc="${sc}\\\x${i}"
done
echo "\"${sc}\""
echo "--------------------"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment