Skip to content

Instantly share code, notes, and snippets.

@hshrzd
Created August 6, 2020 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hshrzd/1ce09bdbe53db6c4713a4ab914b8e8b2 to your computer and use it in GitHub Desktop.
Save hshrzd/1ce09bdbe53db6c4713a4ab914b8e8b2 to your computer and use it in GitHub Desktop.
IDA script to fetch string references
import idautils
sc = idautils.Strings()
for s in sc:
curr_str = str(s)
str_offset = s.ea
for xref in idautils.XrefsTo(s.ea):
func = idaapi.get_func(xref.frm)
if not func:
continue
functionName = idc.GetFunctionName(xref.frm)
print ("%x, %s") % (str_offset, curr_str)
print ("\tref: %x, %s") % (xref.frm, functionName)
print("---\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment