Skip to content

Instantly share code, notes, and snippets.

@lucasg
Created June 13, 2019 14:43
Show Gist options
  • Save lucasg/2fe0e9a15c31925a8fd15bd681f6df1a to your computer and use it in GitHub Desktop.
Save lucasg/2fe0e9a15c31925a8fd15bd681f6df1a to your computer and use it in GitHub Desktop.
Read memory as GUID via IDA
import ida_bytes
import binascii
def get_guid(address):
data1 = ida_bytes.get_dword(address)
data2 = ida_bytes.get_word(address + 4)
data3 = ida_bytes.get_word(address + 6)
data4 = ida_bytes.get_bytes(address + 8, 8)
return "%08x-%04x-%04x-%s" % (data1, data2, data3, binascii.hexlify(data4))
def get_alt_guid(address):
data1 = ida_bytes.get_dword(address)
data2 = ida_bytes.get_word(address + 4)
data3 = ida_bytes.get_word(address + 6)
data4 = ida_bytes.get_word(address + 8)
data5 = ida_bytes.get_bytes(address + 10, 6)
return "{%08x-%04x-%04x-%04x-%s}" % (data1, data2, data3, data4, binascii.hexlify(data5))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment