]> snippets.scripts.mit.edu Git - Scripts/git/.git/commitdiff
disasm: Disassemble hex bytes given on the command line as x86
authorGeoffrey Thomas <geofft@mit.edu>
Mon, 23 Aug 2010 10:00:44 +0000 (06:00 -0400)
committerGeoffrey Thomas <geofft@mit.edu>
Mon, 23 Aug 2010 10:02:28 +0000 (06:02 -0400)
dr-wily:~ geofft$ disasm c9c3
   0:   c9                      leave
   1:   c3                      ret

Signed-off-by: Geoffrey Thomas <geofft@mit.edu>
programming/disasm [new file with mode: 0755]

diff --git a/programming/disasm b/programming/disasm
new file mode 100755 (executable)
index 0000000..0531dc5
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+file=$(mktemp)
+echo "$*" | xxd -r -p > "$file"
+objdump -D -b binary -m i386 "$file" | tail -n +7
+rm "$file"