Skip to content

Instantly share code, notes, and snippets.

@lucasg
Created June 13, 2019 14:43
Show Gist options
  • Select an option

  • Save lucasg/2fe0e9a15c31925a8fd15bd681f6df1a to your computer and use it in GitHub Desktop.

Select an option

Save lucasg/2fe0e9a15c31925a8fd15bd681f6df1a to your computer and use it in GitHub Desktop.

Revisions

  1. lucasg created this gist Jun 13, 2019.
    21 changes: 21 additions & 0 deletions ida_get_guid.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    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))