Skip to content

Instantly share code, notes, and snippets.

@Ddorda
Created March 2, 2020 20:51
Show Gist options
  • Save Ddorda/ae9ee21abfe35b569cb5e3b2a726cd15 to your computer and use it in GitHub Desktop.
Save Ddorda/ae9ee21abfe35b569cb5e3b2a726cd15 to your computer and use it in GitHub Desktop.
Convert assembly to shellcode. include in your bashrc file.
function asmbler()
{
f=$(mktemp)
cat<<EOF>${f}.s
.globl _main
.intel_syntax noprefix
_main:
EOF
while read -r line; do
echo "$line" >> ${f}.s
done
gcc -o $f -c ${f}.s
objdump -d $f | tail -n +8 | cut -f2 -d:|cut -f1-6 -d' '|tr -s ' '|tr '\t' ' '|sed 's/ $//g'|sed 's/ /\\x/g'|paste -d '' -s
rm ${f}.s ${f}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment