Skip to content

Instantly share code, notes, and snippets.

@hasherezade
Created January 28, 2020 01:42
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 hasherezade/4ceb59d6701d2fe95747543d77c04276 to your computer and use it in GitHub Desktop.
Save hasherezade/4ceb59d6701d2fe95747543d77c04276 to your computer and use it in GitHub Desktop.
IDA script snippets
#IDA script to print all referenced strings along with their 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")
#IDA script to enum strings
import idautils
sc = idautils.Strings()
for s in sc:
curr_str = str(s)
print curr_str
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment