Created
June 6, 2020 13:34
-
-
Save jasperla/04dcab3cdb44911ceed2c0b058a35eb5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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