Module idautils
[frames] | no frames]

Module idautils

idautils.py - High level utility functions for IDA

Functions
 
refs(ea, funcfirst, funcnext)
Generic reference collector - INTERNAL USE ONLY.
 
CodeRefsTo(ea, flow)
Get a list of code references to 'ea'
 
CodeRefsFrom(ea, flow)
Get a list of code references from 'ea'
 
DataRefsTo(ea)
Get a list of data references to 'ea'
 
DataRefsFrom(ea)
Get a list of data references from 'ea'
 
XrefTypeName(typecode)
Convert cross-reference type codes to readable names
 
XrefsFrom(ea, flags=0)
Return all references from address 'ea'
 
XrefsTo(ea, flags=0)
Return all references to address 'ea'
 
Heads(start=4198400, end=4219904)
Get a list of heads (instructions or data)
 
Functions(start=4198400, end=4219904)
Get a list of functions
 
Chunks(start)
Get a list of function chunks
 
Segments()
Get list of segments (sections) in the binary image
 
GetDataList(ea, count, itemsize=1)
Get data list - INTERNAL USE ONLY
 
PutDataList(ea, datalist, itemsize=1)
Put data list - INTERNAL USE ONLY
 
MapDataList(ea, length, func, wordsize=1)
Map through a list of data words in the database
 
GetInputFileMD5()
Return the MD5 hash of the input binary file
Variables
  cpu = _cpu()
Function Details

CodeRefsTo(ea, flow)

 

Get a list of code references to 'ea'

Parameters:
  • ea - Target address
  • flow (Boolean (0/1, False/True)) - Follow normal code flow or not
Returns:
list of references (may be empty list)

Example:

   for ref in CodeRefsTo(ScreenEA(), 1):
       print ref

CodeRefsFrom(ea, flow)

 

Get a list of code references from 'ea'

Parameters:
  • ea - Target address
  • flow (Boolean (0/1, False/True)) - Follow normal code flow or not
Returns:
list of references (may be empty list)

Example:

   for ref in CodeRefsFrom(ScreenEA(), 1):
       print ref

DataRefsTo(ea)

 

Get a list of data references to 'ea'

Parameters:
  • ea - Target address
Returns:
list of references (may be empty list)

Example:

   for ref in DataRefsTo(ScreenEA(), 1):
       print ref

DataRefsFrom(ea)

 

Get a list of data references from 'ea'

Parameters:
  • ea - Target address
Returns:
list of references (may be empty list)

Example:

   for ref in DataRefsFrom(ScreenEA(), 1):
       print ref

XrefTypeName(typecode)

 

Convert cross-reference type codes to readable names

Parameters:
  • typecode - cross-reference type code

XrefsFrom(ea, flags=0)

 

Return all references from address 'ea'

@param ea: Reference address
@param flags: any of idaapi.XREF_* flags

Example:
       for xref in XrefsFrom(here(), 0):
           print xref.type, XrefTypeName(xref.type),                          'from', hex(xref.frm), 'to', hex(xref.to)

XrefsTo(ea, flags=0)

 

Return all references to address 'ea'

@param ea: Reference address
@param flags: any of idaapi.XREF_* flags

Example:
       for xref in XrefsTo(here(), 0):
           print xref.type, XrefTypeName(xref.type),                          'from', hex(xref.frm), 'to', hex(xref.to)

Heads(start=4198400, end=4219904)

 

Get a list of heads (instructions or data)

Parameters:
  • start - start address (default: inf.minEA)
  • end - end address (default: inf.maxEA)
Returns:
list of heads between start and end

Functions(start=4198400, end=4219904)

 

Get a list of functions

Parameters:
  • start - start address (default: inf.minEA)
  • end - end address (default: inf.maxEA)
Returns:
list of heads between start and end

Note: The last function that starts before 'end' is included even if it extends beyond 'end'. Any function that has its chunks scattered in multiple segments will be reported multiple times, once in each segment as they are listed.

Chunks(start)

 

Get a list of function chunks

Parameters:
  • start - address of the function
Returns:
list of funcion chunks (tuples of the form (start_ea, end_ea)) belonging to the function

Segments()

 

Get list of segments (sections) in the binary image

Returns:
List of segment start addresses.

MapDataList(ea, length, func, wordsize=1)

 

Map through a list of data words in the database

Parameters:
  • ea - start address
  • length - number of words to map
  • func - mapping function
  • wordsize - size of words to map [default: 1 byte]
Returns:
None

GetInputFileMD5()

 

Return the MD5 hash of the input binary file

Returns:
MD5 string or None on error