Guest User

Untitled

a guest
Jan 16th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. import idautils
  2. from idaapi import *
  3. import re
  4.  
  5. sc = idautils.Strings()
  6.  
  7. packets = {}
  8.  
  9. for s in sc:
  10. value = str(s)
  11. if re.match("eTr[a-zA-Z0-9]+Ack", value):
  12. xrefs = idautils.XrefsTo(s.ea)
  13. for xref in xrefs:
  14. opcode = GetMnem(xref.frm)
  15. if opcode == 'lea':
  16. opcod2 = GetMnem(xref.frm-0x4C)
  17. if opcod2 == 'mov':
  18. packets[value.replace('eTr', '')] = hex(GetOperandValue(xref.frm-0x4C, 1)).replace('L', '')
  19.  
  20. with open('G:\\packets.txt', 'wb') as f:
  21. for opcode in packets:
  22. f.write(opcode + '=' + packets[opcode] + '\n')
Add Comment
Please, Sign In to add comment