Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import idautils
from idaapi import *
import re
sc = idautils.Strings()
packets = {}
for s in sc:
value = str(s)
if re.match("eTr[a-zA-Z0-9]+Ack", value):
xrefs = idautils.XrefsTo(s.ea)
for xref in xrefs:
opcode = GetMnem(xref.frm)
if opcode == 'lea':
opcod2 = GetMnem(xref.frm-0x4C)
if opcod2 == 'mov':
packets[value.replace('eTr', '')] = hex(GetOperandValue(xref.frm-0x4C, 1)).replace('L', '')
with open('G:\\packets.txt', 'wb') as f:
for opcode in packets:
f.write(opcode + '=' + packets[opcode] + '\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment