types module

binaryninja.types.ArrayBuilder(handle[, ...])

binaryninja.types.ArrayType(handle[, ...])

binaryninja.types.BoolBuilder(handle[, ...])

binaryninja.types.BoolType(handle[, ...])

binaryninja.types.BoolWithConfidence(value)

binaryninja.types.CharBuilder(handle[, ...])

binaryninja.types.CharType(handle[, ...])

binaryninja.types.CoreSymbol(handle)

binaryninja.types.EnumerationBuilder(handle, ...)

binaryninja.types.EnumerationMember(name[, ...])

binaryninja.types.EnumerationType(handle[, ...])

binaryninja.types.FloatBuilder(handle[, ...])

binaryninja.types.FloatType(handle[, ...])

binaryninja.types.FunctionBuilder(handle[, ...])

binaryninja.types.FunctionParameter(type[, ...])

binaryninja.types.FunctionType(handle[, ...])

binaryninja.types.IntegerBuilder(handle[, ...])

binaryninja.types.IntegerType(handle[, ...])

binaryninja.types.MutableTypeBuilder(type, ...)

binaryninja.types.NameSpace([name])

binaryninja.types.NamedTypeReferenceBuilder(...)

binaryninja.types.NamedTypeReferenceType(handle)

binaryninja.types.OffsetWithConfidence(value)

binaryninja.types.PointerBuilder(handle[, ...])

binaryninja.types.PointerType(handle[, ...])

binaryninja.types.QualifiedName([name])

binaryninja.types.RegisterSet(regs[, confidence])

binaryninja.types.RegisterStackAdjustmentWithConfidence(value)

binaryninja.types.StructureBuilder(handle, ...)

binaryninja.types.StructureMember(type, ...)

binaryninja.types.StructureType(handle[, ...])

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.TypeBuilder(handle[, ...])

All TypeBuilder objects should not be instantiated directly but created via .create APIs.

binaryninja.types.TypeDefinitionLine(...)

binaryninja.types.TypeFieldReference(func, ...)

binaryninja.types.TypeParserResult(types, ...)

binaryninja.types.TypeReferenceSource(name, ...)

binaryninja.types.VoidBuilder(handle[, ...])

binaryninja.types.VoidType(handle[, ...])

binaryninja.types.WideCharBuilder(handle[, ...])

binaryninja.types.WideCharType(handle[, ...])

class ArrayBuilder(handle: binaryninja._binaryninjacore.LP_BNTypeBuilder, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: binaryninja.types.TypeBuilder

Parameters
  • handle (binaryninja._binaryninjacore.LP_BNTypeBuilder) –

  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

classmethod create(type: Union[TypeBuilder, Type], element_count: int, platform: Optional[Platform] = None, confidence: int = 255) ArrayBuilder[source]
Parameters
Return type

ArrayBuilder

property children: List[TypeBuilder]
property count: int
property element_type: TypeBuilder
class ArrayType(handle, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: binaryninja.types.Type

Parameters
  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

classmethod create(element_type: Type, count: int, platform: Optional[Platform] = None, confidence: int = 255) ArrayType[source]
Parameters
Return type

ArrayType

property children: List[Type]
property count

Type count (read-only)

property element_type: Type
class BoolBuilder(handle: binaryninja._binaryninjacore.LP_BNTypeBuilder, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: binaryninja.types.TypeBuilder

Parameters
  • handle (binaryninja._binaryninjacore.LP_BNTypeBuilder) –

  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

classmethod create(platform: Optional[Platform] = None, confidence: int = 255) BoolBuilder[source]
Parameters
Return type

BoolBuilder

class BoolType(handle, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: binaryninja.types.Type

Parameters
  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

classmethod create(platform: Optional[Platform] = None, confidence: int = 255) BoolType[source]
Parameters
Return type

BoolType

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

Bases: object

Parameters
  • value (bool) –

  • confidence (int) –

Return type

None

classmethod from_core_struct(core_struct: binaryninja._binaryninjacore.BNBoolWithConfidence) BoolWithConfidence[source]
Parameters

core_struct (binaryninja._binaryninjacore.BNBoolWithConfidence) –

Return type

BoolWithConfidence

static get_core_struct(value: Union[bool, BoolWithConfidence], confidence: int = 255) binaryninja._binaryninjacore.BNBoolWithConfidence[source]
Parameters
Return type

binaryninja._binaryninjacore.BNBoolWithConfidence

confidence: int = 255
value: bool
class CharBuilder(handle: binaryninja._binaryninjacore.LP_BNTypeBuilder, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: binaryninja.types.IntegerBuilder

Parameters
  • handle (binaryninja._binaryninjacore.LP_BNTypeBuilder) –

  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

classmethod create(alternate_name: str = '', platform: Optional[Platform] = None, confidence: int = 255) CharBuilder[source]
Parameters
Return type

CharBuilder

class CharType(handle, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: binaryninja.types.IntegerType

Parameters
  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

classmethod create(altname: str = 'char', platform: Optional[Platform] = None, confidence: int = 255) CharType[source]
Parameters
Return type

CharType

class CoreSymbol(handle: binaryninja._binaryninjacore.LP_BNSymbol)[source]

Bases: object

Parameters

handle (binaryninja._binaryninjacore.LP_BNSymbol) –

property address: int

Symbol address (read-only)

property auto: bool

Whether the symbol was auto-defined

property binding: SymbolBinding

Symbol binding (read-only)

property full_name: str

Symbol full name (read-only)

property handle
property name: str

Symbol name (read-only)

property namespace: NameSpace

Symbol namespace (read-only)

property ordinal: int

Symbol ordinal (read-only)

property raw_bytes: bytes

Bytes of the raw symbol (read-only)

property raw_name: str

Symbol raw name (read-only)

property short_name: str

Symbol short name (read-only)

property type: SymbolType

Symbol type (read-only)

class EnumerationBuilder(handle: binaryninja._binaryninjacore.LP_BNTypeBuilder, enum_builder_handle: binaryninja._binaryninjacore.LP_BNEnumerationBuilder, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: binaryninja.types.TypeBuilder

Parameters
  • handle (binaryninja._binaryninjacore.LP_BNTypeBuilder) –

  • enum_builder_handle (binaryninja._binaryninjacore.LP_BNEnumerationBuilder) –

  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

append(name: str, value: Optional[int] = None) EnumerationBuilder[source]
Parameters
Return type

EnumerationBuilder

classmethod create(members: Optional[Union[List[Tuple[str, int]], List[str], List[EnumerationMember]]] = None, width: Optional[int] = None, arch: Optional[Architecture] = None, sign: Union[bool, BoolWithConfidence] = False, platform: Optional[Platform] = None, confidence: int = 255) EnumerationBuilder[source]
Parameters
Return type

EnumerationBuilder

immutable_copy() EnumerationType[source]
Return type

EnumerationType

remove(i: int) EnumerationBuilder[source]
Parameters

i (int) –

Return type

EnumerationBuilder

replace(i: int, name: str, value: int) EnumerationBuilder[source]
Parameters
Return type

EnumerationBuilder

property members: List[EnumerationMember]

Enumeration member list (read-only)

class EnumerationMember(name: str, value: Union[int, NoneType] = None)[source]

Bases: object

Parameters
Return type

None

name: str
value: Optional[int] = None
class EnumerationType(handle, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: binaryninja.types.IntegerType

Parameters
  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

classmethod create(members=typing.Union[typing.List[typing.Tuple[str, int]], typing.List[str], typing.List[ForwardRef('EnumerationMember')]], width: Optional[int] = None, arch: Optional[Architecture] = None, sign: Union[bool, BoolWithConfidence] = False, platform: Optional[Platform] = None, confidence: int = 255) EnumerationType[source]
Parameters
Return type

EnumerationType

generate_named_type_reference(guid: str, name: Union[Iterable[Union[str, bytes]], str, QualifiedName])[source]
Parameters
mutable_copy() EnumerationBuilder[source]
Return type

EnumerationBuilder

property members

Enumeration member list (read-only)

class FloatBuilder(handle: binaryninja._binaryninjacore.LP_BNTypeBuilder, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: binaryninja.types.TypeBuilder

Parameters
  • handle (binaryninja._binaryninjacore.LP_BNTypeBuilder) –

  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

classmethod create(width: int, alternate_name: str = '', platform: Optional[Platform] = None, confidence: int = 255) FloatBuilder[source]
Parameters
Return type

FloatBuilder

class FloatType(handle, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: binaryninja.types.Type

Parameters
  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

classmethod create(width: int, altname: str = '', platform: Optional[Platform] = None, confidence: int = 255) FloatType[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

  • platform (Optional[Platform]) –

  • confidence (int) –

Return type

FloatType

class FunctionBuilder(handle: binaryninja._binaryninjacore.LP_BNTypeBuilder, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: binaryninja.types.TypeBuilder

Parameters
  • handle (binaryninja._binaryninjacore.LP_BNTypeBuilder) –

  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

append(type: Union[TypeBuilder, Type, FunctionParameter], name: str = '')[source]
Parameters
classmethod create(return_type: Optional[Union[TypeBuilder, Type]] = None, calling_convention: Optional[CallingConvention] = None, params: Optional[Union[List[Type], List[FunctionParameter], List[Tuple[str, Type]]]] = None, var_args: Optional[Union[bool, BoolWithConfidence]] = None, stack_adjust: Optional[Union[int, OffsetWithConfidence]] = None, platform: Optional[Platform] = None, confidence: int = 255, can_return: Optional[BoolWithConfidence] = None, reg_stack_adjust: Optional[Dict[RegisterName, Union[int, OffsetWithConfidence]]] = None, return_regs: Optional[Union[RegisterSet, List[Union[RegisterName, ILRegister, RegisterIndex]]]] = None, name_type: NameType = NameType.NoNameType) FunctionBuilder[source]
Parameters
Return type

FunctionBuilder

property calling_convention: CallingConvention
property can_return: BoolWithConfidence
property children: List[TypeBuilder]
property immutable_return_value: Type
property parameters: List[FunctionParameter]

Type parameters list (read-only)

property return_value: TypeBuilder
property stack_adjust: OffsetWithConfidence
property stack_adjustment: OffsetWithConfidence
property variable_arguments: BoolWithConfidence
class FunctionParameter(type: Union[ForwardRef('TypeBuilder'), ForwardRef('Type')], name: str = '', location: Union[ForwardRef('variable.VariableNameAndType'), NoneType] = None)[source]

Bases: object

Parameters
Return type

None

immutable_copy() FunctionParameter[source]
Return type

FunctionParameter

mutable_copy() FunctionParameter[source]
Return type

FunctionParameter

location: Optional[VariableNameAndType] = None
name: str = ''
type: Union[TypeBuilder, Type]
class FunctionType(handle, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: binaryninja.types.Type

Parameters
  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

classmethod create(ret: Optional[Type] = None, params: Optional[Union[List[Type], List[FunctionParameter], List[Tuple[str, Type]]]] = None, calling_convention: Optional[CallingConvention] = None, variable_arguments: Union[bool, BoolWithConfidence] = BoolWithConfidence(value=False, confidence=255), stack_adjust: OffsetWithConfidence = OffsetWithConfidence(value=0, confidence=255), platform: Optional[Platform] = None, confidence: int = 255, can_return: BoolWithConfidence = True, reg_stack_adjust: Optional[Dict[RegisterName, Union[int, OffsetWithConfidence]]] = None, return_regs: Optional[Union[RegisterSet, List[Union[RegisterName, ILRegister, RegisterIndex]]]] = None, name_type: NameType = NameType.NoNameType) FunctionType[source]
Parameters
Return type

FunctionType

property calling_convention: Optional[CallingConvention]

Calling convention (read-only)

property can_return: BoolWithConfidence

Whether type can return

property children: List[Type]
property has_variable_arguments: BoolWithConfidence

Whether type has variable arguments (read-only)

property parameters: List[FunctionParameter]

Type parameters list (read-only)

property return_value: Type

Return value (read-only)

property stack_adjustment: OffsetWithConfidence

Stack adjustment for function (read-only)

class IntegerBuilder(handle: binaryninja._binaryninjacore.LP_BNTypeBuilder, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: binaryninja.types.TypeBuilder

Parameters
  • handle (binaryninja._binaryninjacore.LP_BNTypeBuilder) –

  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

classmethod create(width: int, sign: Union[bool, BoolWithConfidence] = True, alternate_name: str = '', platform: Optional[Platform] = None, confidence: int = 255) IntegerBuilder[source]
Parameters
Return type

IntegerBuilder

class IntegerType(handle, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: binaryninja.types.Type

Parameters
  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

classmethod create(width: int, sign: Union[bool, BoolWithConfidence] = True, alternate_name: str = '', platform: Optional[Platform] = None, confidence: int = 255) IntegerType[source]
Parameters
Return type

IntegerType

property signed: BoolWithConfidence

Whether type is signed (read-only)

class MutableTypeBuilder(type: 'TypeBuilder', container: Union[ForwardRef('binaryview.BinaryView'), ForwardRef('typelibrary.TypeLibrary')], name: QualifiedName, platform: Union[ForwardRef('_platform.Platform'), NoneType], confidence: int, user: bool = True)[source]

Bases: object

Parameters
Return type

None

confidence: int
container: Union[BinaryView, TypeLibrary]
name: QualifiedName
platform: Optional[Platform]
type: TypeBuilder
user: bool = True
class NameSpace(name: Optional[Union[Iterable[Union[str, bytes]], str, QualifiedName]] = None)[source]

Bases: binaryninja.types.QualifiedName

Parameters

name (Optional[Union[Iterable[Union[str, bytes]], str, QualifiedName]]) –

static get_core_struct(name: Optional[Union[str, List[str], NameSpace]]) Optional[binaryninja._binaryninjacore.BNNameSpace][source]
Parameters

name (Optional[Union[str, List[str], NameSpace]]) –

Return type

Optional[binaryninja._binaryninjacore.BNNameSpace]

class NamedTypeReferenceBuilder(handle: binaryninja._binaryninjacore.LP_BNTypeBuilder, ntr_builder_handle: binaryninja._binaryninjacore.LP_BNNamedTypeReferenceBuilder, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: binaryninja.types.TypeBuilder

Parameters
  • handle (binaryninja._binaryninjacore.LP_BNTypeBuilder) –

  • ntr_builder_handle (binaryninja._binaryninjacore.LP_BNNamedTypeReferenceBuilder) –

  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

classmethod create(type_class: NamedTypeReferenceClass = NamedTypeReferenceClass.UnknownNamedTypeClass, type_id: Optional[str] = None, name: Union[Iterable[Union[str, bytes]], str, QualifiedName] = '', width: int = 0, align: int = 1, platform: Optional[Platform] = None, confidence: int = 255, const: Union[bool, BoolWithConfidence] = False, volatile: Union[bool, BoolWithConfidence] = False) NamedTypeReferenceBuilder[source]
Parameters
Return type

NamedTypeReferenceBuilder

immutable_copy() NamedTypeReferenceType[source]
Return type

NamedTypeReferenceType

static named_type(named_type: NamedTypeReferenceBuilder, width: int = 0, align: int = 1, const: Union[bool, BoolWithConfidence] = BoolWithConfidence(value=False, confidence=255), volatile: Union[bool, BoolWithConfidence] = BoolWithConfidence(value=False, confidence=255)) NamedTypeReferenceBuilder[source]
Parameters
Return type

NamedTypeReferenceBuilder

static named_type_from_registered_type(view: BinaryView, name: Union[Iterable[Union[str, bytes]], str, QualifiedName]) NamedTypeReferenceBuilder[source]
Parameters
Return type

NamedTypeReferenceBuilder

static named_type_from_type(name: Union[Iterable[Union[str, bytes]], str, QualifiedName], type_class: Optional[NamedTypeReferenceClass] = None) NamedTypeReferenceBuilder[source]
Parameters
Return type

NamedTypeReferenceBuilder

static named_type_from_type_and_id(type_id: str, name: Union[Iterable[Union[str, bytes]], str, QualifiedName], type: Optional[Type] = None) NamedTypeReferenceBuilder[source]
Parameters
Return type

NamedTypeReferenceBuilder

property id: str
property name: QualifiedName
property named_type_class: NamedTypeReferenceClass
property type_id: str
class NamedTypeReferenceType(handle, platform: Optional[Platform] = None, confidence: int = 255, ntr_handle=None)[source]

Bases: binaryninja.types.Type

Parameters
  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

classmethod create(named_type_class: NamedTypeReferenceClass, guid: Optional[str], name: Union[Iterable[Union[str, bytes]], str, QualifiedName], alignment: int = 0, width: int = 0, platform: Optional[Platform] = None, confidence: int = 255, const: Union[bool, BoolWithConfidence] = False, volatile: Union[bool, BoolWithConfidence] = False) NamedTypeReferenceType[source]
Parameters
Return type

NamedTypeReferenceType

classmethod create_from_registered_type(view: BinaryView, name: Union[Iterable[Union[str, bytes]], str, QualifiedName], platform: Optional[Platform] = None, confidence: int = 255) NamedTypeReferenceType[source]
Parameters
Return type

NamedTypeReferenceType

classmethod create_from_type(name: Union[Iterable[Union[str, bytes]], str, QualifiedName], type: Optional[Type], guid: Optional[str] = None, platform: Optional[Platform] = None, confidence: int = 255) NamedTypeReferenceType[source]
Parameters
Return type

NamedTypeReferenceType

static generate_auto_demangled_type_ref(type_class: NamedTypeReferenceClass, name: Union[Iterable[Union[str, bytes]], str, QualifiedName])[source]
Parameters
static generate_auto_type_ref(type_class: NamedTypeReferenceClass, source: str, name: Union[Iterable[Union[str, bytes]], str, QualifiedName])[source]
Parameters
mutable_copy()[source]
target(bv: BinaryView) Optional[Type][source]

Returns the type pointed to by the current type

Parameters

bv (BinaryView) – The BinaryView in which this type is defined.

Returns

The type this NamedTypeReference is referencing

Return type

Optional[Type]

property name: QualifiedName
property named_type_class: NamedTypeReferenceClass
property type_id: str
class OffsetWithConfidence(value: int, confidence: int = 255)[source]

Bases: object

Parameters
  • value (int) –

  • confidence (int) –

Return type

None

classmethod from_core_struct(core_struct: binaryninja._binaryninjacore.BNOffsetWithConfidence) OffsetWithConfidence[source]
Parameters

core_struct (binaryninja._binaryninjacore.BNOffsetWithConfidence) –

Return type

OffsetWithConfidence

static get_core_struct(value: Union[int, OffsetWithConfidence], confidence: int = 255) binaryninja._binaryninjacore.BNOffsetWithConfidence[source]
Parameters
Return type

binaryninja._binaryninjacore.BNOffsetWithConfidence

confidence: int = 255
value: int
class PointerBuilder(handle: binaryninja._binaryninjacore.LP_BNTypeBuilder, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: binaryninja.types.TypeBuilder

Parameters
  • handle (binaryninja._binaryninjacore.LP_BNTypeBuilder) –

  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

classmethod create(type: Type, width: int = 4, arch: Optional[Architecture] = None, const: Union[bool, BoolWithConfidence] = False, volatile: Union[bool, BoolWithConfidence] = False, ref_type: ReferenceType = ReferenceType.PointerReferenceType, platform: Optional[Platform] = None, confidence: int = 255) PointerBuilder[source]
Parameters
Return type

PointerBuilder

property children: List[TypeBuilder]
property immutable_target: Type
property target: TypeBuilder
class PointerType(handle, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: binaryninja.types.Type

Parameters
  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

classmethod create(arch: Architecture, type: Union[TypeBuilder, Type], const: Union[bool, BoolWithConfidence] = False, volatile: Union[bool, BoolWithConfidence] = False, ref_type: ReferenceType = ReferenceType.PointerReferenceType, platform: Optional[Platform] = None, confidence: int = 255) PointerType[source]
Parameters
Return type

PointerType

classmethod create_with_width(width: int, type: Union[TypeBuilder, Type], const: Union[bool, BoolWithConfidence] = False, volatile: Union[bool, BoolWithConfidence] = False, ref_type: Optional[ReferenceType] = None, platform: Optional[Platform] = None, confidence: int = 255) PointerType[source]
Parameters
Return type

PointerType

static from_bools(const: Union[bool, BoolWithConfidence], volatile: Union[bool, BoolWithConfidence]) Tuple[BoolWithConfidence, BoolWithConfidence][source]
Parameters
Return type

Tuple[BoolWithConfidence, BoolWithConfidence]

property children: List[Type]
property ref_type: ReferenceType
property target: Type

Target (read-only)

class QualifiedName(name: Optional[Union[Iterable[Union[str, bytes]], str, QualifiedName]] = None)[source]

Bases: object

Parameters

name (Optional[Union[Iterable[Union[str, bytes]], str, QualifiedName]]) –

static escape(name: Union[Iterable[Union[str, bytes]], str, QualifiedName], escaping: TokenEscapingType) str[source]
Parameters
Return type

str

static unescape(name: Union[Iterable[Union[str, bytes]], str, QualifiedName], escaping: TokenEscapingType) str[source]
Parameters
Return type

str

property name: List[str]
class RegisterSet(regs: List[ForwardRef('architecture.RegisterName')], confidence: int = 255)[source]

Bases: object

Parameters
  • regs (List[RegisterName]) –

  • confidence (int) –

Return type

None

with_confidence(confidence)[source]
confidence: int = 255
regs: List[RegisterName]
class RegisterStackAdjustmentWithConfidence(value: int, confidence: int = 255)[source]

Bases: object

Parameters
  • value (int) –

  • confidence (int) –

Return type

None

confidence: int = 255
value: int
class StructureBuilder(handle: binaryninja._binaryninjacore.LP_BNTypeBuilder, builder_handle: binaryninja._binaryninjacore.LP_BNStructureBuilder, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: binaryninja.types.TypeBuilder

Parameters
  • handle (binaryninja._binaryninjacore.LP_BNTypeBuilder) –

  • builder_handle (binaryninja._binaryninjacore.LP_BNStructureBuilder) –

  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

add_member_at_offset(name: str, type: Union[TypeBuilder, Type], offset: int, overwrite_existing: bool = True, access: MemberAccess = MemberAccess.NoAccess, scope: MemberScope = MemberScope.NoScope) StructureBuilder[source]
Parameters
Return type

StructureBuilder

append(type: Union[TypeBuilder, Type], name: str = '', access: MemberAccess = MemberAccess.NoAccess, scope: MemberScope = MemberScope.NoScope) StructureBuilder[source]
Parameters
Return type

StructureBuilder

classmethod create(members: Optional[Union[List[StructureMember], List[Type], List[Tuple[Type, str]]]] = None, type: StructureVariant = StructureVariant.StructStructureType, packed: bool = False, width: Optional[int] = None, platform: Optional[Platform] = None, confidence: int = 255) StructureBuilder[source]
Parameters
Return type

StructureBuilder

immutable_copy() StructureType[source]
Return type

StructureType

index_by_name(name: str) Optional[int][source]
Parameters

name (str) –

Return type

Optional[int]

index_by_offset(offset: int) Optional[int][source]
Parameters

offset (int) –

Return type

Optional[int]

insert(offset: int, type: Union[TypeBuilder, Type], name: str = '', overwrite_existing: bool = True, access: MemberAccess = MemberAccess.NoAccess, scope: MemberScope = MemberScope.NoScope)[source]
Parameters
member_at_offset(offset: int) Optional[StructureMember][source]
Parameters

offset (int) –

Return type

Optional[StructureMember]

remove(index: int)[source]
Parameters

index (int) –

replace(index: int, type: Union[TypeBuilder, Type], name: str = '', overwrite_existing: bool = True)[source]
Parameters
property alignment: int
property children: List[TypeBuilder]
property members: List[StructureMember]

Structure member list (read-only)

property packed: bool
property type: StructureVariant
property union: bool
property width: int
class StructureMember(type: 'Type', name: str, offset: int, access: binaryninja.enums.MemberAccess = <MemberAccess.NoAccess: 0>, scope: binaryninja.enums.MemberScope = <MemberScope.NoScope: 0>)[source]

Bases: object

Parameters
Return type

None

access: MemberAccess = 0
name: str
offset: int
scope: MemberScope = 0
type: Type
class StructureType(handle, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: binaryninja.types.Type

Parameters
  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

classmethod create(members: Optional[Union[List[StructureMember], List[Type], List[Tuple[Type, str]]]] = None, packed: bool = False, type: StructureVariant = StructureVariant.StructStructureType, platform: Optional[Platform] = None, confidence: int = 255) StructureType[source]
Parameters
Return type

StructureType

classmethod from_core_struct(structure: binaryninja._binaryninjacore.BNStructure) StructureType[source]
Parameters

structure (binaryninja._binaryninjacore.BNStructure) –

Return type

StructureType

generate_named_type_reference(guid: str, name: Union[Iterable[Union[str, bytes]], str, QualifiedName])[source]
Parameters
member_at_offset(offset: int) StructureMember[source]
Parameters

offset (int) –

Return type

StructureMember

mutable_copy() StructureBuilder[source]
Return type

StructureBuilder

with_replaced_enumeration(from_enum, to_enum) StructureType[source]
Return type

StructureType

with_replaced_named_type_reference(from_ref, to_ref) StructureType[source]
Return type

StructureType

with_replaced_structure(from_struct, to_struct) StructureType[source]
Return type

StructureType

property alignment

Structure alignment

property children: List[Type]
property members

Structure member list (read-only)

property packed
property type: StructureVariant
property width

Structure width

class Symbol(sym_type, addr, short_name, full_name=None, raw_name=None, binding=None, namespace=None, ordinal=0)[source]

Bases: binaryninja.types.CoreSymbol

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

class Type(handle, platform: Optional[Platform] = None, confidence: int = 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

Parameters
  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

static array(type: Type, count: int) ArrayType[source]
Parameters
Return type

ArrayType

static bool() BoolType[source]
Return type

BoolType

static builder(bv: BinaryView, name: Optional[QualifiedName] = None, id: Optional[str] = None, platform: Optional[Platform] = None, confidence: int = 255) MutableTypeBuilder[source]
Parameters
Return type

MutableTypeBuilder

static char(alternate_name: str = '') CharType[source]
Parameters

alternate_name (str) –

Return type

CharType

static class_type(members: Optional[Union[List[StructureMember], List[Type], List[Tuple[Type, str]]]] = None, packed: bool = False) StructureType[source]
Parameters
Return type

StructureType

classmethod create(handle=<class 'binaryninja._binaryninjacore.LP_BNType'>, platform: typing.Optional[binaryninja.platform.Platform] = None, confidence: int = 255) Type[source]
Parameters
Return type

Type

static enumeration(arch: Optional[Architecture] = None, members: Optional[Union[List[Tuple[str, int]], List[str], List[EnumerationMember]]] = None, width: Optional[int] = None, sign: Union[bool, BoolWithConfidence] = False) EnumerationType[source]
Parameters
Return type

EnumerationType

static enumeration_type(arch, enum: EnumerationBuilder, width: Optional[int] = None, sign: bool = False) EnumerationType[source]
Parameters
Return type

EnumerationType

static float(width: int, alternate_name: str = '') FloatType[source]

float class method for creating floating point Types. :param int width: width of the floating point number in bytes :param str alternate_name: alternate name for type

Parameters
  • width (int) –

  • alternate_name (str) –

Return type

FloatType

static from_core_struct(core_type: binaryninja._binaryninjacore.BNType)[source]
Parameters

core_type (binaryninja._binaryninjacore.BNType) –

static function(ret: Optional[Type] = None, params: Optional[Union[List[Type], List[FunctionParameter], List[Tuple[str, Type]]]] = None, calling_convention: Optional[CallingConvention] = None, variable_arguments: Union[bool, BoolWithConfidence] = False, stack_adjust: OffsetWithConfidence = OffsetWithConfidence(value=0, confidence=255)) FunctionType[source]

function class method for creating a function Type. :param Type ret: return Type of the function :param params: list of parameter Types :type params: list(Type) :param CallingConvention calling_convention: optional argument for the function calling convention :param bool variable_arguments: optional boolean, true if the function has a variable number of arguments

Parameters
Return type

FunctionType

static generate_auto_demangled_type_id(name: Union[Iterable[Union[str, bytes]], str, QualifiedName]) str[source]
Parameters

name (Union[Iterable[Union[str, bytes]], str, QualifiedName]) –

Return type

str

static generate_auto_type_id(source: str, name: Union[Iterable[Union[str, bytes]], str, QualifiedName]) str[source]
Parameters
Return type

str

static generate_named_type_reference(guid: str, name: Union[Iterable[Union[str, bytes]], str, QualifiedName]) NamedTypeReferenceType[source]
Parameters
Return type

NamedTypeReferenceType

static get_auto_demangled_type_id_source() str[source]
Return type

str

get_builder(bv: BinaryView) MutableTypeBuilder[source]
Parameters

bv (BinaryView) –

Return type

MutableTypeBuilder

get_lines(bv: BinaryView, name: str, line_width: int = 80, collapsed: bool = False, escaping: TokenEscapingType = TokenEscapingType.NoTokenEscapingType) List[TypeDefinitionLine][source]

Get a list of TypeDefinitionLine structures for representing a Type in a structured form. This structure uses the same logic as Types View and will expand structures and enumerations unless collapsed is set.

Parameters
  • bv (BinaryView) – BinaryView object owning this Type

  • name (str) – Displayed name of the Type

  • line_width (int) – Maximum width of lines (in characters)

  • collapsed (bool) – If the type should be collapsed, and not show fields/members

  • escaping (TokenEscapingType) – How to escape non-parsable strings in types

Returns

Returns a list of TypeDefinitionLine structures

Return type

TypeDefinitionLine

get_string(escaping: TokenEscapingType = TokenEscapingType.NoTokenEscapingType) str[source]

Get string representation for this type

Parameters

escaping (TokenEscapingType) – How to escape non-parsable strings in types

Returns

String for type

Return type

str

Example
>>> Type.array(Type.int(4), 10).get_string()
'int32_t[0xa]'
get_string_after_name(escaping: TokenEscapingType = TokenEscapingType.NoTokenEscapingType) str[source]

Get the string to be printed after this type’s name in a representation

Parameters

escaping (TokenEscapingType) – How to escape non-parsable strings in types

Returns

String for type representation after the name

Return type

str

Example
>>> Type.array(Type.int(4), 10).get_string()
'int32_t[0xa]'
>>> Type.array(Type.int(4), 10).get_string_after_name()
'[0xa]'
get_string_before_name(escaping: TokenEscapingType = TokenEscapingType.NoTokenEscapingType) str[source]

Get the string to be printed before this type’s name in a representation of it

Parameters

escaping (TokenEscapingType) – How to escape non-parsable strings in types

Returns

String for type representation before the name

Return type

str

Example
>>> Type.array(Type.int(4), 10).get_string()
'int32_t[0xa]'
>>> Type.array(Type.int(4), 10).get_string_before_name()
'int32_t'
get_tokens(base_confidence=255, escaping: TokenEscapingType = TokenEscapingType.NoTokenEscapingType) List[InstructionTextToken][source]

Get a list of tokens for the definition of a type

Parameters
  • base_confidence (int) – Confidence of this type

  • escaping (TokenEscapingType) – How to escape non-parsable strings in types

Returns

List of tokens

Return type

List[_function.InstructionTextToken]

Example
>>> Type.array(Type.int(4), 10).get_string()
'int32_t[0xa]'
>>> Type.array(Type.int(4), 10).get_tokens()
['int32_t', ' ', '[', '0xa', ']']
get_tokens_after_name(base_confidence=255, escaping: TokenEscapingType = TokenEscapingType.NoTokenEscapingType) List[InstructionTextToken][source]

Get a list of tokens for the definition of a type that are placed after the type name

Parameters
  • base_confidence (int) – Confidence of this type

  • escaping (TokenEscapingType) – How to escape non-parsable strings in types

Returns

List of tokens

Return type

List[_function.InstructionTextToken]

Example
>>> Type.array(Type.int(4), 10).get_string()
'int32_t[0xa]'
>>> Type.array(Type.int(4), 10).get_tokens_after_name()
['[', '0xa', ']']
get_tokens_before_name(base_confidence=255, escaping: TokenEscapingType = TokenEscapingType.NoTokenEscapingType) List[InstructionTextToken][source]

Get a list of tokens for the definition of a type that are placed before the type name

Parameters
  • base_confidence (int) – Confidence of this type

  • escaping (TokenEscapingType) – How to escape non-parsable strings in types

Returns

List of tokens

Return type

List[_function.InstructionTextToken]

Example
>>> Type.array(Type.int(4), 10).get_string()
'int32_t[0xa]'
>>> Type.array(Type.int(4), 10).get_tokens_before_name()
['int32_t']
immutable_copy() Type[source]
Return type

Type

static int(width: int, sign: Union[bool, BoolWithConfidence] = True, alternate_name: str = '') IntegerType[source]

int class method for creating an int Type. :param int width: width of the integer in bytes :param bool sign: optional variable representing signedness :param str alternate_name: alternate name for type

Parameters
Return type

IntegerType

mutable_copy() TypeBuilder[source]
Return type

TypeBuilder

static named_type(named_type: NamedTypeReferenceBuilder) NamedTypeReferenceType[source]
Parameters

named_type (NamedTypeReferenceBuilder) –

Return type

NamedTypeReferenceType

static named_type_from_registered_type(view: BinaryView, name: Union[Iterable[Union[str, bytes]], str, QualifiedName]) NamedTypeReferenceType[source]
Parameters
Return type

NamedTypeReferenceType

static named_type_from_type(name: Union[Iterable[Union[str, bytes]], str, QualifiedName], type: Type) NamedTypeReferenceType[source]
Parameters
Return type

NamedTypeReferenceType

static named_type_from_type_and_id(type_id: str, name: Union[Iterable[Union[str, bytes]], str, QualifiedName], type: Optional[Type] = None) NamedTypeReferenceType[source]
Parameters
Return type

NamedTypeReferenceType

static named_type_reference(type_class: NamedTypeReferenceClass, name: Union[Iterable[Union[str, bytes]], str, QualifiedName], type_id: Optional[str] = None, alignment: int = 1, width: int = 0, const: Union[bool, BoolWithConfidence] = BoolWithConfidence(value=False, confidence=255), volatile: Union[bool, BoolWithConfidence] = BoolWithConfidence(value=False, confidence=255))[source]
Parameters
static pointer(arch: Architecture, type: Type, const: Union[bool, BoolWithConfidence] = BoolWithConfidence(value=False, confidence=255), volatile: Union[bool, BoolWithConfidence] = BoolWithConfidence(value=False, confidence=255), ref_type: ReferenceType = ReferenceType.PointerReferenceType, width: Optional[int] = None) PointerType[source]
Parameters
Return type

PointerType

static pointer_of_width(width: int, type: Type, const: Union[bool, BoolWithConfidence] = False, volatile: Union[bool, BoolWithConfidence] = False, ref_type: ReferenceType = ReferenceType.PointerReferenceType) PointerType[source]
Parameters
Return type

PointerType

static structure(members: Optional[Union[List[StructureMember], List[Type], List[Tuple[Type, str]]]] = None, packed: bool = False, type: StructureVariant = StructureVariant.StructStructureType) StructureType[source]
Parameters
Return type

StructureType

static structure_type(structure: StructureBuilder) StructureType[source]
Parameters

structure (StructureBuilder) –

Return type

StructureType

static union(members: Optional[Union[List[StructureMember], List[Type], List[Tuple[Type, str]]]] = None, packed: bool = False) StructureType[source]
Parameters
Return type

StructureType

static void() VoidType[source]
Return type

VoidType

static wide_char(width: int, alternate_name: str = '') WideCharType[source]

wide_char class method for creating wide char Types. :param int width: width of the wide character in bytes :param str alternate_name: alternate name for type

Parameters
  • width (int) –

  • alternate_name (str) –

Return type

WideCharType

with_confidence(confidence: int) Type[source]
Parameters

confidence (int) –

Return type

Type

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: int

Type alignment (read-only)

property altname: str

Alternative name for the type object

property children: List[Type]
property confidence: int
property const

Whether type is const (read/write)

property handle
property name: QualifiedName
property offset: int

Offset into structure (read-only)

property platform: Optional[Platform]
property registered_name: Optional[NamedTypeReferenceType]

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

property system_call_number: Optional[int]

Returns the system call number for a FunctionType object if one exists otherwise None

property tokens: List[InstructionTextToken]

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

property type_class: TypeClass

Type class (read-only)

property volatile

Whether type is volatile (read/write)

property width: int

Type width (read-only)

class TypeBuilder(handle: binaryninja._binaryninjacore.LP_BNTypeBuilder, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: object

All TypeBuilder objects should not be instantiated directly but created via .create APIs.

Parameters
  • handle (binaryninja._binaryninjacore.LP_BNTypeBuilder) –

  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

static array(type: Type, count: int) ArrayBuilder[source]
Parameters
Return type

ArrayBuilder

static bool() BoolBuilder[source]
Return type

BoolBuilder

classmethod builder(container: Union[BinaryView, TypeLibrary], name: QualifiedName, user: bool = True, platform: Optional[Platform] = None, confidence: int = 255) MutableTypeBuilder[source]
Parameters
Return type

MutableTypeBuilder

static char(alternate_name: str = '') CharBuilder[source]
Parameters

alternate_name (str) –

Return type

CharBuilder

static class_type(members: Optional[Union[List[StructureMember], List[Type], List[Tuple[Type, str]]]] = None, packed: bool = False) StructureBuilder[source]
Parameters
Return type

StructureBuilder

clear_system_call() None[source]
Return type

None

classmethod create()[source]
static enumeration(arch: Optional[Architecture] = None, members: Optional[Union[List[Tuple[str, int]], List[str], List[EnumerationMember]]] = None, width: Optional[int] = None, sign: Union[bool, BoolWithConfidence] = BoolWithConfidence(value=False, confidence=255)) EnumerationBuilder[source]
Parameters
Return type

EnumerationBuilder

static float(width: int, altname: str = '') FloatBuilder[source]

float class method for creating floating point Types. :param int width: width of the floating point number in bytes :param str altname: alternate name for type

Parameters
  • width (int) –

  • altname (str) –

Return type

FloatBuilder

static function(ret: Optional[Type] = None, params: Optional[Union[List[Type], List[FunctionParameter], List[Tuple[str, Type]]]] = None, calling_convention: Optional[CallingConvention] = None, variable_arguments: Optional[Union[bool, BoolWithConfidence]] = None, stack_adjust: Optional[Union[int, OffsetWithConfidence]] = None) FunctionBuilder[source]

function class method for creating a function Type. :param Type ret: return Type of the function :param params: list of parameter Types :type params: list(Type) :param CallingConvention calling_convention: optional argument for the function calling convention :param bool variable_arguments: optional boolean, true if the function has a variable number of arguments

Parameters
Return type

FunctionBuilder

immutable_copy()[source]
static int(width: int, sign: Union[bool, BoolWithConfidence] = BoolWithConfidence(value=True, confidence=255), altname: str = '') IntegerBuilder[source]

int class method for creating an int Type. :param int width: width of the integer in bytes :param bool sign: optional variable representing signedness :param str altname: alternate name for type

Parameters
Return type

IntegerBuilder

mutable_copy() TypeBuilder[source]
Return type

TypeBuilder

static named_type_from_registered_type(view: BinaryView, name: QualifiedName) NamedTypeReferenceBuilder[source]
Parameters
Return type

NamedTypeReferenceBuilder

static named_type_from_type(name: Union[Iterable[Union[str, bytes]], str, QualifiedName], type_class: Optional[NamedTypeReferenceClass] = None) NamedTypeReferenceBuilder[source]
Parameters
Return type

NamedTypeReferenceBuilder

static named_type_from_type_and_id(type_id: str, name: Union[Iterable[Union[str, bytes]], str, QualifiedName], type: Optional[Type] = None) NamedTypeReferenceBuilder[source]
Parameters
Return type

NamedTypeReferenceBuilder

static named_type_reference(type_class: NamedTypeReferenceClass, name: QualifiedName, type_id: Optional[str] = None, alignment: int = 1, width: int = 0, const: Union[bool, BoolWithConfidence] = BoolWithConfidence(value=False, confidence=255), volatile: Union[bool, BoolWithConfidence] = BoolWithConfidence(value=False, confidence=255)) NamedTypeReferenceBuilder[source]
Parameters
Return type

NamedTypeReferenceBuilder

static pointer(arch: Architecture, type: Type, const: Union[bool, BoolWithConfidence] = BoolWithConfidence(value=False, confidence=255), volatile: Union[bool, BoolWithConfidence] = BoolWithConfidence(value=False, confidence=255), ref_type: ReferenceType = ReferenceType.PointerReferenceType) PointerBuilder[source]
Parameters
Return type

PointerBuilder

static pointer_of_width(width: int, type: Type, const: Union[bool, BoolWithConfidence] = BoolWithConfidence(value=False, confidence=255), volatile: Union[bool, BoolWithConfidence] = BoolWithConfidence(value=False, confidence=255), ref_type: ReferenceType = ReferenceType.PointerReferenceType) PointerBuilder[source]
Parameters
Return type

PointerBuilder

static structure(members: Optional[Union[List[StructureMember], List[Type], List[Tuple[Type, str]]]] = None, packed: bool = False, type: StructureVariant = StructureVariant.StructStructureType) StructureBuilder[source]
Parameters
Return type

StructureBuilder

static union(members: Optional[Union[List[StructureMember], List[Type], List[Tuple[Type, str]]]] = None, packed: bool = False) StructureBuilder[source]
Parameters
Return type

StructureBuilder

static void() VoidBuilder[source]
Return type

VoidBuilder

static wide_char(width: int, altname: str = '') WideCharBuilder[source]

wide_char class method for creating wide char Types. :param int width: width of the wide character in bytes :param str altname: alternate name for type

Parameters
  • width (int) –

  • altname (str) –

Return type

WideCharBuilder

property alignment: int
property alternate_name: Optional[str]
property child: Type
property children: List[TypeBuilder]
property const: BoolWithConfidence

Whether type is const (read/write)

property finalized
property handle: binaryninja._binaryninjacore.LP_BNType
property signed: BoolWithConfidence
property system_call_number: Optional[int]

Gets/Sets the system call number for a FunctionType object if one exists otherwise None

property type_class: TypeClass
property volatile: BoolWithConfidence

Whether type is volatile (read/write)

property width: int
class TypeDefinitionLine(line_type: TypeDefinitionLineType, tokens: List[ForwardRef('_function.InstructionTextToken')], type: 'Type', root_type: 'Type', root_type_name: str, offset: int, field_index: int)[source]

Bases: object

Parameters
Return type

None

field_index: int
line_type: TypeDefinitionLineType
offset: int
root_type: Type
root_type_name: str
tokens: List[InstructionTextToken]
type: Type
class TypeFieldReference(func: Union[ForwardRef('_function.Function'), NoneType], arch: Union[ForwardRef('architecture.Architecture'), NoneType], address: int, size: int, incomingType: Union[Type, NoneType])[source]

Bases: object

Parameters
Return type

None

address: int
arch: Optional[Architecture]
func: Optional[Function]
incomingType: Optional[Type]
size: int
class TypeReferenceSource(name: QualifiedName, offset: int, ref_type: TypeReferenceType)[source]

Bases: object

Parameters
Return type

None

name: QualifiedName
offset: int
ref_type: TypeReferenceType
class VoidBuilder(handle: binaryninja._binaryninjacore.LP_BNTypeBuilder, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: binaryninja.types.TypeBuilder

Parameters
  • handle (binaryninja._binaryninjacore.LP_BNTypeBuilder) –

  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

classmethod create(platform: Optional[Platform] = None, confidence: int = 255) VoidBuilder[source]
Parameters
Return type

VoidBuilder

class VoidType(handle, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: binaryninja.types.Type

Parameters
  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

classmethod create(platform: Optional[Platform] = None, confidence: int = 255) VoidType[source]
Parameters
Return type

VoidType

class WideCharBuilder(handle: binaryninja._binaryninjacore.LP_BNTypeBuilder, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: binaryninja.types.TypeBuilder

Parameters
  • handle (binaryninja._binaryninjacore.LP_BNTypeBuilder) –

  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

classmethod create(width: int, alternate_name: str = '', platform: Optional[Platform] = None, confidence: int = 255) WideCharBuilder[source]
Parameters
Return type

WideCharBuilder

class WideCharType(handle, platform: Optional[Platform] = None, confidence: int = 255)[source]

Bases: binaryninja.types.Type

Parameters
  • platform (Optional[_platform.Platform]) –

  • confidence (int) –

classmethod create(width: int, alternate_name: str = '', platform: Optional[Platform] = None, confidence: int = 255) WideCharType[source]

wide_char class method for creating wide char Types.

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

  • alternate_name (str) – alternate name for type

  • platform (Optional[Platform]) –

  • confidence (int) –

Return type

WideCharType