types module

binaryninja.types.BoolWithConfidence(value)

binaryninja.types.Enumeration([handle])

binaryninja.types.EnumerationMember(name, …)

binaryninja.types.FunctionParameter(param_type)

binaryninja.types.NameSpace([name])

binaryninja.types.NamedTypeReference([…])

binaryninja.types.QualifiedName([name])

binaryninja.types.ReferenceTypeWithConfidence(value)

binaryninja.types.RegisterSet(reg_list[, …])

binaryninja.types.RegisterStackAdjustmentWithConfidence(value)

binaryninja.types.SizeWithConfidence(value)

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[, platform, …])

class Type allows you to interact with the Binary Ninja type system.

binaryninja.types.TypeParserResult(types, …)

binaryninja.types.TypeReferenceSource(name, …)

binaryninja.types.log_warn(text)

log_warn Logs message to console, if run through the GUI it logs with Warning icon.

binaryninja.types.preprocess_source(source)

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

binaryninja.types.pyNativeStr(arg)

class BoolWithConfidence(value, confidence=255)[source]

Bases: object

property confidence
property value
class Enumeration(handle=None)[source]

Bases: object

append(name, value=None)[source]
mutable_copy()[source]
remove(i)[source]
replace(i, name, value)[source]
property handle
property members

Enumeration member list (read-only)

class EnumerationMember(name, value, default)[source]

Bases: object

property default
property name
property value
class FunctionParameter(param_type, name='', location=None)[source]

Bases: object

property location
property name
property type
class NameSpace(name=[])[source]

Bases: binaryninja.types.QualifiedName

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

Bases: object

classmethod generate_auto_demangled_type_ref(type_class, name)[source]
classmethod generate_auto_type_ref(type_class, source, name)[source]
property name
property type_class
property type_id
class QualifiedName(name=[])[source]

Bases: object

property byte_name
property name
class ReferenceTypeWithConfidence(value, confidence=255)[source]

Bases: object

property confidence
property value
class RegisterSet(reg_list, confidence=255)[source]

Bases: object

with_confidence(confidence)[source]
property confidence
property regs
class RegisterStackAdjustmentWithConfidence(value, confidence=255)[source]

Bases: object

property confidence
property value
class SizeWithConfidence(value, confidence=255)[source]

Bases: object

property confidence
property value
class Structure(handle=None)[source]

Bases: object

append(t, name='')[source]
insert(offset, t, name='', overwriteExisting=True)[source]
member_at_offset(offset)[source]
mutable_copy()[source]
remove(i)[source]
replace(i, t, name='', overwriteExisting=True)[source]
with_replaced_enumeration(from_enum, to_enum)[source]
with_replaced_named_type_reference(from_ref, to_ref)[source]
with_replaced_structure(from_struct, to_struct)[source]
property alignment

Structure alignment

property handle
property members

Structure member list (read-only)

property packed
property type
property union
property width

Structure width

class StructureMember(t, name, offset)[source]

Bases: object

property name
property offset
property type
class Symbol(sym_type, addr, short_name, full_name=None, raw_name=None, handle=None, binding=None, namespace=None, ordinal=0)[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 a 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

ExternalSymbol

Symbols for data and code that reside outside the BinaryView

LibraryFunctionSymbol

Symbols for external functions outside the library

property address

Symbol address (read-only)

property auto
property binding

Symbol binding (read-only)

property full_name

Symbol full name (read-only)

property name

Symbol name (read-only)

property namespace

Symbol namespace (read-only)

property ordinal

Symbol ordinal (read-only)

property raw_name

Symbol raw name (read-only)

property short_name

Symbol short name (read-only)

property type

Symbol type (read-only)

class Type(handle, platform=None, confidence=255)[source]

Bases: object

class Type allows you to interact with the Binary Ninja type system. Note that the repr and str handlers respond differently on type objects.

Other related functions that may be helpful include:

parse_type_string parse_types_from_source parse_types_from_source_file

classmethod array(t, count)[source]
classmethod bool()[source]
classmethod char()[source]
classmethod enumeration_type(arch, e, width=None, sign=False)[source]
classmethod float(width, altname='')[source]

float class method for creating floating point Types.

Parameters
  • width (int) – width of the floating point number in bytes

  • altname (str) – alternate name for type

classmethod function(ret, params, calling_convention=None, variable_arguments=None, stack_adjust=None)[source]

function class method for creating an function Type.

Parameters
  • ret (Type) – return Type of the function

  • params (list(Type)) – list of parameter Types

  • calling_convention (CallingConvention) – optional argument for the function calling convention

  • variable_arguments (bool) – optional boolean, true if the function has a variable number of arguments

classmethod generate_auto_demangled_type_id(name)[source]
classmethod generate_auto_type_id(source, name)[source]
classmethod get_auto_demangled_type_id_source()[source]
get_string_after_name()[source]
get_string_before_name()[source]
get_tokens(base_confidence=255)[source]
get_tokens_after_name(base_confidence=255)[source]
get_tokens_before_name(base_confidence=255)[source]
classmethod int(width, sign=None, altname='')[source]

int class method for creating an int Type.

Parameters
  • width (int) – width of the integer in bytes

  • sign (bool) – optional variable representing signedness

  • altname (str) – alternate name for type

mutable_copy()[source]
classmethod named_type(named_type, width=0, align=1)[source]
classmethod named_type_from_registered_type(view, name)[source]
classmethod named_type_from_type(name, t)[source]
classmethod named_type_from_type_and_id(type_id, name, t)[source]
classmethod pointer(arch, t, const=None, volatile=None, ref_type=None)[source]
classmethod structure_type(structure_type)[source]
classmethod void()[source]
classmethod wide_char(width, altname='')[source]

wide_char class method for creating wide char Types.

Parameters
  • width (int) – width of the wide character in bytes

  • altname (str) – alternate name for type

with_confidence(confidence)[source]
with_replaced_enumeration(from_enum, to_enum)[source]
with_replaced_named_type_reference(from_ref, to_ref)[source]
with_replaced_structure(from_struct, to_struct)[source]
property alignment

Type alignment (read-only)

property calling_convention

Calling convention (read-only)

property can_return

Whether type can return

property confidence
property const

Whether type is const (read/write)

property count

Type count (read-only)

property element_type

Target (read-only)

property enumeration

Type enumeration (read-only)

property floating_point

Whether type is floating point (read-only)

property handle
property has_variable_arguments

Whether type has variable arguments (read-only)

property named_type_reference

Reference to a named type (read-only)

property offset

Offset into structure (read-only)

property parameters

Type parameters list (read-only)

property platform
property registered_name

Name of type registered to binary view, if any (read-only)

property return_value

Return value (read-only)

property signed

Whether type is signed (read-only)

property stack_adjustment

Stack adjustment for function (read-only)

property structure

Structure of the type (read-only)

property target

Target (read-only)

property tokens

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

property type_class

Type class (read-only)

property volatile

Whether type is volatile (read/write)

property width

Type width (read-only)

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

Bases: object

property functions
property types
property variables
class TypeReferenceSource(name, offset, ref_type)[source]

Bases: object

property name
property offset
property ref_type
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 pre-process

  • filename (str) – optional filename to pre-process

  • include_dirs (list(str)) – list of string directories 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', '')
>>>