Skip to content

Instantly share code, notes, and snippets.

@malware-kitten
Created June 1, 2016 23:46
Show Gist options
  • Save malware-kitten/36f340f8a6ed9d4c5557fcbbb08733da to your computer and use it in GitHub Desktop.
Save malware-kitten/36f340f8a6ed9d4c5557fcbbb08733da to your computer and use it in GitHub Desktop.
@mal_share challenge 2
import r2pipe
import sys
import json
import binascii
r2p = r2pipe.open(sys.argv[1])
r2p.cmd('aaa;aac')
funcs = {}
for func in r2p.cmdj('aflj'):
instructions = r2p.cmd("pdfj @ %s" % func['offset'])
json_instructions = json.loads(instructions)
str = ""
for ops in json_instructions['ops']:
if ops['type'] == "cmp" :
if "al," in ops['opcode']:
str += binascii.unhexlify(ops['opcode'].split(", 0x")[-1])
if str:
print("%s" % str)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment