Skip to content

Instantly share code, notes, and snippets.

@jasperla
Created June 6, 2020 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasperla/04dcab3cdb44911ceed2c0b058a35eb5 to your computer and use it in GitHub Desktop.
Save jasperla/04dcab3cdb44911ceed2c0b058a35eb5 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import subprocess
import sys
for i in range(0x00, 0xff+1):
opcodes = '00' + str(hex(i)).replace('0x', '').rjust(2, '0') + '00'
cmd = ['rasm2', '-a', 'x86', '-b', '32', '-d', opcodes]
try:
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
output = p.stdout.readlines()
if b'invalid\n' in output:
continue
else:
print('[+] {} -> {}'.format(opcodes, b''.join(output).decode().strip()))
except Exception as e:
print('[-] Failed to invoke rasm2: {}'.format(e))
sys.exit(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment