types module

binaryninja.types.Enumeration([handle])
binaryninja.types.EnumerationMember(name, ...)
binaryninja.types.NamedTypeReference([...])
binaryninja.types.QualifiedName([name])
binaryninja.types.Structure([handle])
binaryninja.types.StructureMember(t, name, ...)
binaryninja.types.Symbol(sym_type, addr, ...) Symbols are defined as one of the following types:
binaryninja.types.Type(handle)
binaryninja.types.TypeParserResult(types, ...)
binaryninja.types.preprocess_source(source) preprocess_source run the C preprocessor on the given source or source filename.
class binaryninja.types.Enumeration(handle=None)[source]

Bases: object

append(name, value=None)[source]
members

Enumeration member list (read-only)

remove(i)[source]
replace(i, name, value)[source]
class binaryninja.types.EnumerationMember(name, value, default)[source]

Bases: object

class binaryninja.types.NamedTypeReference(type_class=<NamedTypeReferenceClass.UnknownNamedTypeClass: 0>, name=None, handle=None)[source]

Bases: object

name
type_class
class binaryninja.types.QualifiedName(name=[])[source]

Bases: object

class binaryninja.types.Structure(handle=None)[source]

Bases: object

alignment

Structure alignment

append(t, name='')[source]
insert(offset, t, name='')[source]
members

Structure member list (read-only)

packed
remove(i)[source]
replace(i, t, name='')[source]
union
width

Structure width

class binaryninja.types.StructureMember(t, name, offset)[source]

Bases: object

class binaryninja.types.Symbol(sym_type, addr, short_name, full_name=None, raw_name=None, handle=None)[source]

Bases: object

Symbols are defined as one of the following types:

SymbolType Description
FunctionSymbol Symbol for Function that exists in the current binary
ImportAddressSymbol Symbol defined in the Import Address Table
ImportedFunctionSymbol Symbol for Function that is not defined in the current binary
DataSymbol Symbol for Data in the current binary
ImportedDataSymbol Symbol for Data that is not defined in the current binary
address

Symbol address (read-only)

auto
full_name

Symbol full name (read-only)

name

Symbol name (read-only)

raw_name

Symbol raw name (read-only)

short_name

Symbol short name (read-only)

type

Symbol type (read-only)

class binaryninja.types.Type(handle)[source]

Bases: object

alignment

Type alignment (read-only)

classmethod array(t, count)[source]
classmethod bool()[source]
calling_convention

Calling convention (read-only)

can_return

Whether type can return (read-only)

const

Whether type is const (read-only)

count

Type count (read-only)

element_type

Target (read-only)

enumeration

Type enumeration (read-only)

classmethod enumeration_type(arch, e, width=None)[source]
classmethod float(width)[source]
classmethod function(ret, params, calling_convention=None, variable_arguments=False)[source]
get_string_after_name()[source]
get_string_before_name()[source]
get_tokens_after_name()[source]
get_tokens_before_name()[source]
has_variable_arguments

Whether type has variable arguments (read-only)

classmethod int(width, sign=True, altname='')[source]
modified

Whether type is modified (read-only)

classmethod named_type(named_type, width=0, align=1)[source]
classmethod named_type_from_type(name, t)[source]
named_type_reference

Reference to a named type (read-only)

parameters

Type parameters list (read-only)

classmethod pointer(arch, t, const=False)[source]
return_value

Return value (read-only)

signed

Wether type is signed (read-only)

structure

Structure of the type (read-only)

classmethod structure_type(structure_type)[source]
target

Target (read-only)

tokens

Type string as a list of tokens (read-only)

type_class

Type class (read-only)

classmethod void()[source]
width

Type width (read-only)

class binaryninja.types.TypeParserResult(types, variables, functions)[source]

Bases: object

binaryninja.types.preprocess_source(source, filename=None, include_dirs=[])[source]

preprocess_source run the C preprocessor on the given source or source filename.

Parameters:
  • source (str) – source to preprocess
  • filename (str) – optional filename to preprocess
  • include_dirs (list(str)) – list of string directorires to use as include directories.
Returns:

returns a tuple of (preprocessed_source, error_string)

Return type:

tuple(str,str)

Example:
>>> source = "#define TEN 10\nint x[TEN];\n"
>>> preprocess_source(source)
('#line 1 "input"\n\n#line 2 "input"\n int x [ 10 ] ;\n', '')
>>>