Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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
You can’t perform that action at this time.