Skip to content

Instantly share code, notes, and snippets.

@ret5et
Forked from wirepair/gist:5720064
Last active March 28, 2016 16:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ret5et/a581c2165f30f4b3d585 to your computer and use it in GitHub Desktop.
Save ret5et/a581c2165f30f4b3d585 to your computer and use it in GitHub Desktop.
IDAPython script to get Data Ref's for a variable and print out function, address ref'd and whether read/write,
from idautils import *
from idc import *
from idaapi import *
ea = ScreenEA()
for xref in XrefsTo(ea, 0):
ref_type = ""
if xref.type == dr_W:
ref_type = "W"
elif xref.type == dr_R:
ref_type = "R"
else:
ref_type = "Unknown"
print "%s(0x%x) | %s"%(GetFunctionName(xref.frm), xref.frm, ref_type)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment