Skip to content

Instantly share code, notes, and snippets.

@ek0
Last active October 28, 2019 00:31
Show Gist options
  • Save ek0/e75cee46e3e656c42869462b19e24e9e to your computer and use it in GitHub Desktop.
Save ek0/e75cee46e3e656c42869462b19e24e9e to your computer and use it in GitHub Desktop.
Small re-implementation of removed functions
def crefs_from(address = here()):
current = ida_xref.get_first_cref_from(address)
while current != ida_idaapi.BADADDR:
yield current
current = ida_xref.get_next_cref_from(address, current)
def crefs_to(address = here()):
current = ida_xref.get_first_cref_to(address)
while current != ida_idaapi.BADADDR:
yield current
current = ida_xref.get_next_cref_to(address, current)
def drefs_from(address = here()):
current = ida_xref.get_first_dref_from(address)
while current != ida_idaapi.BADADDR:
yield current
current = ida_xref.get_next_dref_from(address, current)
def drefs_to(address = here()):
current = ida_xref.get_first_dref_to(address)
while current != ida_idaapi.BADADDR:
yield current
current = ida_xref.get_next_dref_to(address, current)
def xrefs_from(address = here()):
for i in crefs_from(address):
yield i
for i in drefs_from(address):
yield i
def xrefs_to(address = here()):
for i in crefs_to(address):
yield i
for i in drefs_to(address):
yield i
# replacement for FuncItems()
def function_instructions(address = idc.get_func_attr(idc.here(), idc.FUNCATTR_START)):
current = address
while current < idc.get_func_attr(address, idc.FUNCATTR_END):
yield current
current = idc.next_head(current)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment