Skip to content

Instantly share code, notes, and snippets.

@wirepair
Created June 6, 2013 08:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save wirepair/5720064 to your computer and use it in GitHub Desktop.
Save wirepair/5720064 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