Skip to content

Instantly share code, notes, and snippets.

@inaz2
Created July 8, 2014 08:46
Show Gist options
  • Save inaz2/003bf82ecbc29725e5d3 to your computer and use it in GitHub Desktop.
Save inaz2/003bf82ecbc29725e5d3 to your computer and use it in GitHub Desktop.
convert between asm and opcodes
function asm() {
echo "$*" | as -msyntax=intel -mnaked-reg -aln -o /dev/null
}
function disas() {
echo "$*" | perl -ne 's/([0-9A-Fa-f]{2})/print pack("H2",$1)/eg' >/tmp/disasm && objdump -M intel -D -b binary -m i386 /tmp/disasm | tail -n+8
}
$ asm jmp esp
1 0000 FFE4 jmp esp
$ disas ff e4
0: ff e4 jmp esp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment