Jump to content


Useful IDA Scripts

No replies to this topic

#1 Apoc



  • Administrators
  • 15 posts

Posted 22 November 2014 - 01:55 PM

Dump user-named type info (address, name, and function declaration, if any)
from idautils import *
from cStringIO import StringIO
import re

with open("IDA TypeInfo.txt", "w") as fh:
	for func in idautils.Functions():
		if hasUserName(GetFlags(func)) and not ((GetFunctionFlags(func) & FUNC_LIB) == FUNC_LIB):
			type = GetType(func)

			func_name = GetFunctionName(func)

			# GetType returns the typedef of a function ie. int __cdecl(int a1). We need to trim it so it looks like,
			# int __cdecl Funcname(int a1)
			#type = "%s %s%s" % (type[:type.find("(")], func_name, type[type.find("("):])

			if type is not None and type != "":
				fh.write("%x16\t%s\t%s\n" % (func, func_name, type))
				fh.write("%x16\t%s\n" % (func, func_name))
Quickly dump xrefs to whatever is on the current caret:

from idautils import *

ea = ScreenEA()
print "EA: %x" % ea
offsets = dict()

xref = RfirstB(ea)

while xref != BADADDR:
	print "%x" % xref
	xref = RnextB(xref, ea)

  • 0

Reply to this topic


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users