ida_pro
This is the first header included in the IDA project.
It defines the most common types, functions and data. Also, it tries to make system dependent definitions. The following preprocessor macros are used in the project (the list may be incomplete) Platform must be specified as one of: __NT__ - MS Windows (all platforms)
__LINUX__ - Linux __MAC__ - MAC OS X
- __EA64__ - 64-bit address size (sizeof(ea_t)==8)
__X86__ - 32-bit debug servers (sizeof(void*)==4) __X64__ - x64 processor (sizeof(void*)==8) default __PPC__ - PowerPC __ARM__ - ARM
Attributes
IDA SDK v9.2. |
|
maximum string size |
|
convert non-printable characters to C escapes ( |
|
UTF-16 codepage. |
|
default char, used if a char cannot be represented in a codepage |
|
input redirection |
|
output redirection |
|
append, do not overwrite the output file |
|
the file name was quoted |
|
Classes
Functions
|
|
|
Call qatexit functions, shut down UI and kernel, and exit. |
|
calculate ceil(log2(d64)) or floor(log2(d64)), it returns 0 if d64 == 0 |
|
|
|
count the number of consecutive trailing zero bits (line C++20 std::countr_zero()) |
|
Sign-, or zero-extend the value 'v' to occupy 64 bits. The value 'v' is considered to be of size 'nbytes'. |
|
Read at most 4 bytes from file. |
|
Write at most 4 bytes to file. |
|
|
|
Change capacity of given qvector. |
|
|
|
is IDA converting IDB into I64? |
|
Quote a command line argument if it contains escape characters. For example, .c will be converted into ".c" because * may be inadvertently expanded by the shell |
|
Parse the -r command line switch (for instant debugging). r_switch points to the value of the -r switch. Example: win32@localhost+ |
|
Check whether process has terminated or not. |
|
Check if the current process is the owner of the TTY specified by 'fd' (typically an opened descriptor to /dev/tty). |
|
If the current terminal is the controlling terminal of the calling process, give up this controlling terminal. |
|
Make the current terminal the controlling terminal of the calling process. |
|
Are two threads equal? |
|
Are we running in the main thread? |
|
Get the user name for the current desktop session |
|
Get the total CPU physical core count |
|
Get the total CPU logical core count |
|
Get the number of logical CPU cores available to the current process if supported by the OS. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Insert C-style escape characters to string |
Module Contents
- ida_pro.SWIG_PYTHON_LEGACY_BOOL
- ida_pro.BADDIFF
- ida_pro.IDA_SDK_VERSION
IDA SDK v9.2.
- ida_pro.BADMEMSIZE
- ida_pro.MAXSTR
maximum string size
- ida_pro.qatoll(nptr: str) int64
- ida_pro.FMT_64
- ida_pro.FMT_Z
- ida_pro.FMT_ZX
- ida_pro.FMT_ZS
- ida_pro.FMT_EA
- ida_pro.qexit(code: int) None
Call qatexit functions, shut down UI and kernel, and exit.
- Parameters:
code – exit code
- ida_pro.log2ceil(d64: uint64) int
calculate ceil(log2(d64)) or floor(log2(d64)), it returns 0 if d64 == 0
- ida_pro.log2floor(d64: uint64) int
- ida_pro.bitcountr_zero(x: uint64) int
count the number of consecutive trailing zero bits (line C++20 std::countr_zero())
- ida_pro.extend_sign(v: uint64, nbytes: int, sign_extend: bool) uint64
Sign-, or zero-extend the value ‘v’ to occupy 64 bits. The value ‘v’ is considered to be of size ‘nbytes’.
- ida_pro.readbytes(h: int, res: uint32 *, size: int, mf: bool) int
Read at most 4 bytes from file.
- Parameters:
h – file handle
res – value read from file
size – size of value in bytes (1,2,4)
mf – is MSB first?
- Returns:
0 on success, nonzero otherwise
- ida_pro.writebytes(h: int, l: int, size: int, mf: bool) int
Write at most 4 bytes to file.
- Parameters:
h – file handle
l – value to write
size – size of value in bytes (1,2,4)
mf – is MSB first?
- Returns:
0 on success, nonzero otherwise
- ida_pro.reloc_value(value: void *, size: int, delta: adiff_t, mf: bool) None
- ida_pro.qvector_reserve(vec: void *, old: void *, cnt: size_t, elsize: size_t) void *
Change capacity of given qvector.
- Parameters:
vec – a pointer to a qvector
old – a pointer to the qvector’s array
cnt – number of elements to reserve
elsize – size of each element
- Returns:
a pointer to the newly allocated array
- class ida_pro.qrefcnt_obj_t(*args, **kwargs)
Bases:
object
- thisown
- refcnt: int
counter
- release() None
Call destructor. We use release() instead of operator delete() to maintain binary compatibility with all compilers (vc and gcc use different vtable layouts for operator delete)
- ida_pro.relocate_relobj(_relobj: relobj_t *, ea: ida_idaapi.ea_t, mf: bool) bool
- ida_pro.IDBDEC_ESCAPE
convert non-printable characters to C escapes ( , xNN, uNNNN)
- ida_pro.CP_BOM
- ida_pro.UTF8_BOM
- ida_pro.UTF16LE_BOM
- ida_pro.UTF16BE_BOM
- ida_pro.UTF32LE_BOM
- ida_pro.UTF32BE_BOM
- ida_pro.CP_ELLIPSIS
- ida_pro.UTF8_ELLIPSIS
- ida_pro.CP_REPLCHAR
- ida_pro.UTF8_REPLCHAR
- ida_pro.MAX_UTF8_SEQ_LEN
- ida_pro.is_cvt64() bool
is IDA converting IDB into I64?
- ida_pro.CEF_RETERR
- ida_pro.ENC_WIN1252
- ida_pro.ENC_UTF8
- ida_pro.ENC_MUTF8
- ida_pro.ENC_UTF16
- ida_pro.ENC_UTF16LE
- ida_pro.ENC_UTF16BE
- ida_pro.ENC_UTF32
- ida_pro.ENC_UTF32LE
- ida_pro.ENC_UTF32BE
- ida_pro.CP_UTF8
- ida_pro.CP_UTF16
UTF-16 codepage.
- ida_pro.SUBSTCHAR
default char, used if a char cannot be represented in a codepage
- class ida_pro.channel_redir_t
Bases:
object
- thisown
- fd: int
channel number
- file: str
file name to redirect to/from. if empty, the channel must be closed.
- flags: int
i/o redirection flags
- is_input() bool
- is_output() bool
- is_append() bool
- is_quoted() bool
- start: int
begin of the redirection string in the command line
- length: int
length of the redirection string in the command line
- ida_pro.IOREDIR_INPUT
input redirection
- ida_pro.IOREDIR_OUTPUT
output redirection
- ida_pro.IOREDIR_APPEND
append, do not overwrite the output file
- ida_pro.IOREDIR_QUOTED
the file name was quoted
- ida_pro.quote_cmdline_arg(arg: str) bool
Quote a command line argument if it contains escape characters. For example, .c will be converted into “.c” because * may be inadvertently expanded by the shell
- Returns:
true: modified ‘arg’
- class ida_pro.plugin_options_t
Bases:
object
- thisown
- find(name: str) plugin_option_t const *
- erase(name: str) bool
- class ida_pro.instant_dbgopts_t
Bases:
object
- thisown
- debmod: str
name of debugger module
- env: str
config variables for debmod. example: DEFAULT_CPU=13;MAXPACKETSIZE=-1
- host: str
remote hostname (if remote debugging)
- port: int
port number for the remote debugger server
- pid: int
process to attach to (-1: ask the user)
- event_id: int
event to trigger upon attaching
- attach: bool
should attach to a process?
- ida_pro.parse_dbgopts(ido: instant_dbgopts_t, r_switch: str) bool
Parse the -r command line switch (for instant debugging). r_switch points to the value of the -r switch. Example: win32@localhost+
- Returns:
true-ok, false-parse error
- ida_pro.QWCONTINUED
- ida_pro.QWNOHANG
- ida_pro.check_process_exit(handle: void *, exit_code: int *, msecs: int = -1) int
Check whether process has terminated or not.
- Parameters:
handle – process handle to wait for
exit_code – pointer to the buffer for the exit code
- Returns:
0: process has exited, and the exit code is available. if *exit_code < 0: the process was killed with a signal -*exit_code
- Returns:
1: process has not exited yet
- Returns:
-1: error happened, see error code for winerr() in *exit_code
- ida_pro.TCT_UNKNOWN
- ida_pro.TCT_OWNER
- ida_pro.TCT_NOT_OWNER
- ida_pro.is_control_tty(fd: int) enum tty_control_t
Check if the current process is the owner of the TTY specified by ‘fd’ (typically an opened descriptor to /dev/tty).
- ida_pro.qdetach_tty() None
If the current terminal is the controlling terminal of the calling process, give up this controlling terminal.
- ida_pro.qcontrol_tty() None
Make the current terminal the controlling terminal of the calling process.
- ida_pro.qthread_equal(q1: __qthread_t, q2: __qthread_t) bool
Are two threads equal?
- ida_pro.is_main_thread() bool
Are we running in the main thread?
- ida_pro.get_login_name() str
Get the user name for the current desktop session
- Returns:
success
- ida_pro.get_physical_core_count() int
Get the total CPU physical core count
- Returns:
the physical core count, or -1 on error
- ida_pro.get_logical_core_count() int
Get the total CPU logical core count
- Returns:
the logical core count, or -1 on error
- ida_pro.get_available_core_count() int
Get the number of logical CPU cores available to the current process if supported by the OS.
- Returns:
the logical core count available for the process, or -1 on error
- class ida_pro.intvec_t(*args)
Bases:
object
- thisown
- push_back(*args) int &
- pop_back() None
- size() size_t
- empty() bool
- at(_idx: size_t) int const &
- qclear() None
- clear() None
- resize(*args) None
- capacity() size_t
- reserve(cnt: size_t) None
- truncate() None
- extract() int *
- inject(s: int *, len: size_t) None
- begin(*args) qvector< int >::const_iterator
- end(*args) qvector< int >::const_iterator
- insert(it: qvector< int >::iterator, x: int const &) qvector< int >::iterator
- erase(*args) qvector< int >::iterator
- find(*args) qvector< int >::const_iterator
- has(x: int const &) bool
- add_unique(x: int const &) bool
- append(x: int const &) None
- front
- back
- ida_pro.cvar
- ida_pro.NULL_PIPE_HANDLE
- class ida_pro.uintvec_t(*args)
Bases:
object
- thisown
- push_back(*args) unsigned int &
- pop_back() None
- size() size_t
- empty() bool
- at(_idx: size_t) unsigned int const &
- qclear() None
- clear() None
- resize(*args) None
- capacity() size_t
- reserve(cnt: size_t) None
- truncate() None
- extract() unsigned int *
- inject(s: unsigned int *, len: size_t) None
- begin(*args) qvector< unsigned int >::const_iterator
- end(*args) qvector< unsigned int >::const_iterator
- insert(it: qvector< unsigned int >::iterator, x: unsigned int const &) qvector< unsigned int >::iterator
- erase(*args) qvector< unsigned int >::iterator
- find(*args) qvector< unsigned int >::const_iterator
- has(x: unsigned int const &) bool
- add_unique(x: unsigned int const &) bool
- append(x: unsigned int const &) None
- front
- back
- class ida_pro.int64vec_t(*args)
Bases:
object
- thisown
- push_back(*args) long long &
- pop_back() None
- size() size_t
- empty() bool
- at(_idx: size_t) long long const &
- qclear() None
- clear() None
- resize(*args) None
- capacity() size_t
- reserve(cnt: size_t) None
- truncate() None
- swap(r: int64vec_t) None
- extract() long long *
- inject(s: long long *, len: size_t) None
- begin(*args) qvector< long long >::const_iterator
- end(*args) qvector< long long >::const_iterator
- insert(it: qvector< long long >::iterator, x: long long const &) qvector< long long >::iterator
- erase(*args) qvector< long long >::iterator
- find(*args) qvector< long long >::const_iterator
- has(x: long long const &) bool
- add_unique(x: long long const &) bool
- append(x: long long const &) None
- extend(x: int64vec_t) None
- front
- back
- class ida_pro.uint64vec_t(*args)
Bases:
object
- thisown
- push_back(*args) unsigned long long &
- pop_back() None
- size() size_t
- empty() bool
- at(_idx: size_t) unsigned long long const &
- qclear() None
- clear() None
- resize(*args) None
- capacity() size_t
- reserve(cnt: size_t) None
- truncate() None
- swap(r: uint64vec_t) None
- extract() unsigned long long *
- inject(s: unsigned long long *, len: size_t) None
- begin(*args) qvector< unsigned long long >::const_iterator
- end(*args) qvector< unsigned long long >::const_iterator
- insert(it: qvector< unsigned long long >::iterator, x: unsigned long long const &) qvector< unsigned long long >::iterator
- erase(*args) qvector< unsigned long long >::iterator
- find(*args) qvector< unsigned long long >::const_iterator
- has(x: unsigned long long const &) bool
- add_unique(x: unsigned long long const &) bool
- append(x: unsigned long long const &) None
- extend(x: uint64vec_t) None
- front
- back
- class ida_pro.boolvec_t(*args)
Bases:
object
- thisown
- push_back(*args) bool &
- pop_back() None
- size() size_t
- empty() bool
- at(_idx: size_t) bool const &
- qclear() None
- clear() None
- resize(*args) None
- grow(*args) None
- capacity() size_t
- reserve(cnt: size_t) None
- truncate() None
- extract() bool *
- inject(s: bool *, len: size_t) None
- begin(*args) qvector< bool >::const_iterator
- end(*args) qvector< bool >::const_iterator
- insert(it: qvector< bool >::iterator, x: bool const &) qvector< bool >::iterator
- erase(*args) qvector< bool >::iterator
- find(*args) qvector< bool >::const_iterator
- has(x: bool const &) bool
- add_unique(x: bool const &) bool
- append(x: bool const &) None
- front
- back
- class ida_pro.strvec_t(*args)
Bases:
object
- thisown
- push_back(*args) simpleline_t &
- pop_back() None
- size() size_t
- empty() bool
- at(_idx: size_t) simpleline_t const &
- qclear() None
- clear() None
- resize(*args) None
- grow(*args) None
- capacity() size_t
- reserve(cnt: size_t) None
- truncate() None
- extract() simpleline_t *
- inject(s: simpleline_t *, len: size_t) None
- begin(*args) qvector< simpleline_t >::const_iterator
- end(*args) qvector< simpleline_t >::const_iterator
- insert(it: qvector< simpleline_t >::iterator, x: simpleline_t const &) qvector< simpleline_t >::iterator
- erase(*args) qvector< simpleline_t >::iterator
- append(x: simpleline_t const &) None
- front
- back
- class ida_pro.sizevec_t(*args)
Bases:
object
- thisown
- push_back(*args) size_t &
- pop_back() None
- size() size_t
- empty() bool
- at(_idx: size_t) size_t const &
- qclear() None
- clear() None
- resize(*args) None
- grow(*args) None
- capacity() size_t
- reserve(cnt: size_t) None
- truncate() None
- extract() size_t *
- inject(s: size_t *, len: size_t) None
- begin(*args) qvector< size_t >::const_iterator
- end(*args) qvector< size_t >::const_iterator
- insert(it: qvector< size_t >::iterator, x: size_t const &) qvector< size_t >::iterator
- erase(*args) qvector< size_t >::iterator
- find(*args) qvector< size_t >::const_iterator
- has(x: size_t const &) bool
- add_unique(x: size_t const &) bool
- append(x: size_t const &) None
- front
- back
- ida_pro.qstrvec_t_create() PyObject *
- ida_pro.qstrvec_t_destroy(py_obj: PyObject *) bool
- ida_pro.qstrvec_t_get_clink(_self: PyObject *) qstrvec_t *
- ida_pro.qstrvec_t_get_clink_ptr(_self: PyObject *) PyObject *
- ida_pro.qstrvec_t_assign(_self: PyObject *, other: PyObject *) bool
- ida_pro.qstrvec_t_addressof(_self: PyObject *, idx: size_t) PyObject *
- ida_pro.qstrvec_t_set(_self: PyObject *, idx: size_t, s: str) bool
- ida_pro.qstrvec_t_from_list(_self: PyObject *, py_list: PyObject *) bool
- ida_pro.qstrvec_t_size(_self: PyObject *) size_t
- ida_pro.qstrvec_t_get(_self: PyObject *, idx: size_t) PyObject *
- ida_pro.qstrvec_t_add(_self: PyObject *, s: str) bool
- ida_pro.qstrvec_t_clear(_self: PyObject *, qclear: bool) bool
- ida_pro.qstrvec_t_insert(_self: PyObject *, idx: size_t, s: str) bool
- ida_pro.qstrvec_t_remove(_self: PyObject *, idx: size_t) bool
- ida_pro.str2user(str)
Insert C-style escape characters to string
- Parameters:
str – the input string
- Returns:
new string with escape characters inserted, or None
- class ida_pro.uchar_array(nelements: size_t)
Bases:
object
- thisown
- cast() uchar *
- static frompointer(t: uchar *) uchar_array *
- class ida_pro.tid_array(nelements: size_t)
Bases:
object
- thisown
- cast() tid_t *
- static frompointer(t: tid_t *) tid_array *
- class ida_pro.ea_array(nelements: size_t)
Bases:
object
- thisown
- cast() ea_t *
- static frompointer(t: ea_t *) ea_array *
- class ida_pro.sel_array(nelements: size_t)
Bases:
object
- thisown
- cast() sel_t *
- static frompointer(t: sel_t *) sel_array *
- class ida_pro.uval_array(nelements: size_t)
Bases:
object
- thisown
- cast() uval_t *
- static frompointer(t: uval_t *) uval_array *
- class ida_pro.uchar_pointer
Bases:
object
- thisown
- assign(value: uchar) None
- value() uchar
- cast() uchar *
- static frompointer(t: uchar *) uchar_pointer *
- class ida_pro.ushort_pointer
Bases:
object
- thisown
- assign(value: ushort) None
- value() ushort
- cast() ushort *
- static frompointer(t: ushort *) ushort_pointer *
- class ida_pro.uint_pointer
Bases:
object
- thisown
- assign(value: uint) None
- value() uint
- cast() uint *
- static frompointer(t: uint *) uint_pointer *
- class ida_pro.sint8_pointer
Bases:
object
- thisown
- assign(value: sint8) None
- value() sint8
- cast() sint8 *
- static frompointer(t: sint8 *) sint8_pointer *
- class ida_pro.int8_pointer
Bases:
object
- thisown
- assign(value: int8) None
- value() int8
- cast() int8 *
- static frompointer(t: int8 *) int8_pointer *
- class ida_pro.uint8_pointer
Bases:
object
- thisown
- assign(value: uint8) None
- value() uint8
- cast() uint8 *
- static frompointer(t: uint8 *) uint8_pointer *
- class ida_pro.int16_pointer
Bases:
object
- thisown
- assign(value: int16) None
- value() int16
- cast() int16 *
- static frompointer(t: int16 *) int16_pointer *
- class ida_pro.uint16_pointer
Bases:
object
- thisown
- assign(value: uint16) None
- value() uint16
- cast() uint16 *
- static frompointer(t: uint16 *) uint16_pointer *
- class ida_pro.int32_pointer
Bases:
object
- thisown
- assign(value: int) None
- value() int
- cast() int32 *
- static frompointer(t: int32 *) int32_pointer *
- class ida_pro.uint32_pointer
Bases:
object
- thisown
- assign(value: int) None
- value() int
- cast() uint32 *
- static frompointer(t: uint32 *) uint32_pointer *
- class ida_pro.int64_pointer
Bases:
object
- thisown
- assign(value: int64) None
- value() int64
- cast() int64 *
- static frompointer(t: int64 *) int64_pointer *
- class ida_pro.uint64_pointer
Bases:
object
- thisown
- assign(value: uint64) None
- value() uint64
- cast() uint64 *
- static frompointer(t: uint64 *) uint64_pointer *
- class ida_pro.ssize_pointer
Bases:
object
- thisown
- assign(value: ssize_t) None
- value() ssize_t
- cast() ssize_t *
- static frompointer(t: ssize_t *) ssize_pointer *
- class ida_pro.bool_pointer
Bases:
object
- thisown
- assign(value: bool) None
- value() bool
- cast() bool *
- static frompointer(t: bool *) bool_pointer *
- class ida_pro.char_pointer
Bases:
object
- thisown
- assign(value: char) None
- value() char
- cast() char *
- static frompointer(t: char *) char_pointer *
- class ida_pro.short_pointer
Bases:
object
- thisown
- assign(value: short) None
- value() short
- cast() short *
- static frompointer(t: short *) short_pointer *
- class ida_pro.int_pointer
Bases:
object
- thisown
- assign(value: int) None
- value() int
- cast() int *
- static frompointer(t: int *) int_pointer *
- class ida_pro.ea_pointer
Bases:
object
- thisown
- assign(value: ida_idaapi.ea_t) None
- value() ida_idaapi.ea_t
- cast() ea_t *
- static frompointer(t: ea_t *) ea_pointer *
- class ida_pro.sel_pointer
Bases:
object
- thisown
- assign(value: sel_t) None
- value() sel_t
- cast() sel_t *
- static frompointer(t: sel_t *) sel_pointer *
- class ida_pro.asize_pointer
Bases:
object
- thisown
- assign(value: asize_t) None
- value() asize_t
- cast() asize_t *
- static frompointer(t: asize_t *) asize_pointer *
- class ida_pro.adiff_pointer
Bases:
object
- thisown
- assign(value: adiff_t) None
- value() adiff_t
- cast() adiff_t *
- static frompointer(t: adiff_t *) adiff_pointer *
- class ida_pro.uval_pointer
Bases:
object
- thisown
- assign(value: int) None
- value() int
- cast() uval_t *
- static frompointer(t: uval_t *) uval_pointer *
- class ida_pro.sval_pointer
Bases:
object
- thisown
- assign(value: int) None
- value() int
- cast() sval_t *
- static frompointer(t: sval_t *) sval_pointer *
- class ida_pro.ea32_pointer
Bases:
object
- thisown
- assign(value: ea32_t) None
- value() ea32_t
- cast() ea32_t *
- static frompointer(t: ea32_t *) ea32_pointer *
- class ida_pro.ea64_pointer
Bases:
object
- thisown
- assign(value: ea64_t) None
- value() ea64_t
- cast() ea64_t *
- static frompointer(t: ea64_t *) ea64_pointer *
- class ida_pro.flags_pointer
Bases:
object
- thisown
- assign(value: flags_t) None
- value() flags_t
- cast() flags_t *
- static frompointer(t: flags_t *) flags_pointer *
- class ida_pro.flags64_pointer
Bases:
object
- thisown
- assign(value: flags64_t) None
- value() flags64_t
- cast() flags64_t *
- static frompointer(t: flags64_t *) flags64_pointer *
- class ida_pro.tid_pointer
Bases:
object
- thisown
- assign(value: tid_t) None
- value() tid_t
- cast() tid_t *
- static frompointer(t: tid_t *) tid_pointer *
- ida_pro.longlongvec_t
- ida_pro.ulonglongvec_t
- ida_pro.svalvec_t
- ida_pro.eavec_t