ida_netnode
Functions that provide the lowest level public interface to the database. Namely, we use Btree. To learn more about BTree:
[https://en.wikipedia.org/wiki/B-tree](https://en.wikipedia.org/wiki/B-tree) We do not use Btree directly. Instead, we have another layer built on the top of Btree. Here is a brief explanation of this layer. An object called “netnode” is modeled on the top of Btree. Each netnode has a unique id: a 32-bit value (64-bit for ida64). Initially there is a trivial mapping of the linear addresses used in the program to netnodes (later this mapping may be modified using ea2node and node2ea functions; this is used for fast database rebasings). If we have additional information about an address (for example, a comment is attached to it), this information is stored in the corresponding netnode. See nalt.hpp to see how the kernel uses netnodes. Also, some netnodes have no corresponding linear address (however, they still have an id). They are used to store information not related to a particular address. Each netnode _may_ have the following attributes:
a name: an arbitrary non-empty string, up to 255KB-1 bytes
a value: arbitrary sized object, max size is MAXSPECSIZE
altvals: a sparse array of 32-bit values. indexes in this array may be 8-bit or 32-bit values
supvals: an array of arbitrary sized objects. (size of each object is limited by MAXSPECSIZE) indexes in this array may be 8-bit or 32-bit values
charvals: a sparse array of 8-bit values. indexes in this array may be 8-bit or 32-bit values
hashvals: a hash (an associative array). indexes in this array are strings values are arbitrary sized (max size is MAXSPECSIZE)
Initially a new netnode contains no information at all so no disk space is used for it. As you add new information, the netnode grows. All arrays that are attached to the netnode behave in the same manner. Initially: * all members of altvals/charvals array are zeroes * all members of supvals/hashvals array are undefined
If you need to store objects bigger that MAXSPECSIZE, please note that there are high-level functions to store arbitrary sized objects in supvals. See setblob/getblob and other blob-related functions. You may use netnodes to store additional information about the program. Limitations on the use of netnodes are the following:
use netnodes only if you could not find a kernel service to store your type of information
do not create netnodes with valid identifier names. Use the “$ “ prefix (or any other prefix with characters not allowed in the identifiers for the names of your netnodes. Although you will probably not destroy anything by accident, using already defined names for the names of your netnodes is still discouraged.
you may create as many netnodes as you want (creation of an unnamed netnode does not increase the size of the database). however, since each netnode has a number, creating too many netnodes could lead to the exhaustion of the netnode numbers (the numbering starts at 0xFF000000)
remember that netnodes are automatically saved to the disk by the kernel.
Advanced info: In fact a netnode may contain up to 256 arrays of arbitrary sized objects (not only the 4 listed above). Each array has an 8-bit tag. Usually tags are represented by character constants. For example, altvals and supvals are simply 2 of 256 arrays, with the tags ‘A’ and ‘S’ respectively.
Attributes
A number to represent a bad netnode reference. |
|
Maximum length of a netnode name. WILL BE REMOVED IN THE FUTURE. |
|
Maximum length of a name. We permit names up to 32KB-1 bytes. |
|
Maximum length of strings or objects stored in a supval array element. |
|
Array of altvals. |
|
Array of supvals. |
|
Array of hashvals. |
|
Value of netnode. |
|
Name of netnode. |
|
Links between netnodes. |
|
Classes
Functions
|
Module Contents
- ida_netnode.SWIG_PYTHON_LEGACY_BOOL
- ida_netnode.BADNODE
A number to represent a bad netnode reference.
- ida_netnode.SIZEOF_nodeidx_t
- class ida_netnode.netnode(*args)
Bases:
object
- thisown
- static exist(_name: str) bool
Does the netnode with the specified name exist?
- create(*args) bool
- kill() None
- get_name() ssize_t
- rename(newname: str, namlen: size_t = 0) bool
- valobj(*args) ssize_t
- valstr() ssize_t
- set(value: void const *) bool
- delvalue() bool
- set_long(x: nodeidx_t) bool
- value_exists() bool
- long_value() nodeidx_t
- altval(*args) nodeidx_t
- altval_ea(*args) nodeidx_t
- altset(*args) bool
- altset_ea(*args) bool
- altdel_ea(*args) bool
- easet(ea: ida_idaapi.ea_t, addr: ida_idaapi.ea_t, tag: uchar) bool
- eaget(ea: ida_idaapi.ea_t, tag: uchar) ida_idaapi.ea_t
- eadel(ea: ida_idaapi.ea_t, tag: uchar) bool
- easet_idx(idx: nodeidx_t, addr: ida_idaapi.ea_t, tag: uchar) bool
- eaget_idx(idx: nodeidx_t, tag: uchar) ida_idaapi.ea_t
- easet_idx8(idx: uchar, addr: ida_idaapi.ea_t, tag: uchar) bool
- eaget_idx8(idx: uchar, tag: uchar) ida_idaapi.ea_t
- eadel_idx8(idx: uchar, tag: uchar) bool
- altfirst(*args) nodeidx_t
- altnext(*args) nodeidx_t
- altlast(*args) nodeidx_t
- altprev(*args) nodeidx_t
- altshift(*args) size_t
- charval(alt: nodeidx_t, tag: uchar) uchar
- charset(alt: nodeidx_t, val: uchar, tag: uchar) bool
- chardel(alt: nodeidx_t, tag: uchar) bool
- charval_ea(ea: ida_idaapi.ea_t, tag: uchar) uchar
- charset_ea(ea: ida_idaapi.ea_t, val: uchar, tag: uchar) bool
- chardel_ea(ea: ida_idaapi.ea_t, tag: uchar) bool
- charfirst(tag: uchar) nodeidx_t
- charnext(cur: nodeidx_t, tag: uchar) nodeidx_t
- charlast(tag: uchar) nodeidx_t
- charprev(cur: nodeidx_t, tag: uchar) nodeidx_t
- charshift(_from: nodeidx_t, to: nodeidx_t, size: nodeidx_t, tag: uchar) size_t
- altval_idx8(alt: uchar, tag: uchar) nodeidx_t
- altset_idx8(alt: uchar, val: nodeidx_t, tag: uchar) bool
- altdel_idx8(alt: uchar, tag: uchar) bool
- altfirst_idx8(tag: uchar) nodeidx_t
- altnext_idx8(cur: uchar, tag: uchar) nodeidx_t
- altlast_idx8(tag: uchar) nodeidx_t
- altprev_idx8(cur: uchar, tag: uchar) nodeidx_t
- charval_idx8(alt: uchar, tag: uchar) uchar
- charset_idx8(alt: uchar, val: uchar, tag: uchar) bool
- chardel_idx8(alt: uchar, tag: uchar) bool
- charfirst_idx8(tag: uchar) nodeidx_t
- charnext_idx8(cur: uchar, tag: uchar) nodeidx_t
- charlast_idx8(tag: uchar) nodeidx_t
- charprev_idx8(cur: uchar, tag: uchar) nodeidx_t
- altdel(*args) bool
- altdel_all(*args) bool
- supval(*args) ssize_t
- supval_ea(*args) ssize_t
- supstr(*args) ssize_t
- supstr_ea(*args) ssize_t
- supdel_ea(*args) bool
- lower_bound(*args) nodeidx_t
- lower_bound_ea(*args) nodeidx_t
- supfirst(*args) nodeidx_t
- supnext(*args) nodeidx_t
- suplast(*args) nodeidx_t
- supprev(*args) nodeidx_t
- supshift(*args) size_t
- supval_idx8(*args) ssize_t
- supstr_idx8(alt: uchar, tag: uchar) ssize_t
- supset_idx8(alt: uchar, value: void const *, tag: uchar) bool
- supdel_idx8(alt: uchar, tag: uchar) bool
- lower_bound_idx8(alt: uchar, tag: uchar) nodeidx_t
- supfirst_idx8(tag: uchar) nodeidx_t
- supnext_idx8(alt: uchar, tag: uchar) nodeidx_t
- suplast_idx8(tag: uchar) nodeidx_t
- supprev_idx8(alt: uchar, tag: uchar) nodeidx_t
- supdel(*args) bool
- supdel_all(tag: uchar) bool
- supdel_range(idx1: nodeidx_t, idx2: nodeidx_t, tag: uchar) int
- supdel_range_idx8(idx1: uchar, idx2: uchar, tag: uchar) int
- hashval(*args) ssize_t
- hashstr(*args) ssize_t
- hashval_long(*args) nodeidx_t
- hashset(*args) bool
- hashset_idx(*args) bool
- hashdel(*args) bool
- hashfirst(*args) ssize_t
- hashnext(*args) ssize_t
- hashlast(*args) ssize_t
- hashprev(*args) ssize_t
- hashdel_all(*args) bool
- blobsize(_start: nodeidx_t, tag: uchar) size_t
- blobsize_ea(ea: ida_idaapi.ea_t, tag: uchar) size_t
- setblob(buf: void const *, _start: nodeidx_t, tag: uchar) bool
- setblob_ea(buf: void const *, ea: ida_idaapi.ea_t, tag: uchar) bool
- delblob(_start: nodeidx_t, tag: uchar) int
- delblob_ea(ea: ida_idaapi.ea_t, tag: uchar) int
- blobshift(_from: nodeidx_t, to: nodeidx_t, size: nodeidx_t, tag: uchar) size_t
- start() bool
- end() bool
- next() bool
- prev() bool
- index() nodeidx_t
- getblob(start, tag) bytes | None
Get a blob from a netnode.
- Parameters:
start – the index where the blob starts (it may span on multiple indexes)
tag – the netnode tag
- Returns:
a blob, or None
- getclob(start, tag) str | None
Get a large amount of text from a netnode.
- Parameters:
start – the index where the clob starts (it may span on multiple indexes)
tag – the netnode tag
- Returns:
a clob, or None
- getblob_ea(ea: ida_idaapi.ea_t, tag: char) PyObject *
- hashstr_buf(*args) PyObject *
- hashset_buf(*args) bool
- supset(*args) bool
- supset_ea(*args) bool
- ida_netnode.cvar
- ida_netnode.MAXNAMESIZE
Maximum length of a netnode name. WILL BE REMOVED IN THE FUTURE.
- ida_netnode.MAX_NODENAME_SIZE
Maximum length of a name. We permit names up to 32KB-1 bytes.
- ida_netnode.MAXSPECSIZE
Maximum length of strings or objects stored in a supval array element.
- ida_netnode.atag
Array of altvals.
- ida_netnode.stag
Array of supvals.
- ida_netnode.htag
Array of hashvals.
- ida_netnode.vtag
Value of netnode.
- ida_netnode.ntag
Name of netnode.
- ida_netnode.ltag
Links between netnodes.
- ida_netnode.NETMAP_IDX
- ida_netnode.NETMAP_VAL
- ida_netnode.NETMAP_STR
- ida_netnode.NETMAP_X8
- ida_netnode.NETMAP_V8
- ida_netnode.NETMAP_VAL_NDX
- ida_netnode.netnode_exist