GeezerVison is showing api.binary.ninja (truncated) — types module — Binary Ninja API Documentation v6.0.10905
types module¶
CoreSymbol¶
-
class CoreSymbol[source]¶
Bases: object
-
__init__(handle: LP_BNSymbol)[source]¶
- Parameters:
handle (LP_BNSymbol)
-
imported_function_from_import_address_symbol(addr: int) → CoreSymbol | None[source]¶
- Parameters:
addr (int)
- Return type:
CoreSymbol | None
-
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)
EnumerationBuilder¶
-
class EnumerationBuilder[source]¶
Bases: TypeBuilder
-
__init__(handle: LP_BNTypeBuilder, enum_builder_handle: LP_BNEnumerationBuilder, platform: Platform | None = None, confidence: int = 255)[source]¶
- Parameters:
handle (LP_BNTypeBuilder)
enum_builder_handle (LP_BNEnumerationBuilder)
platform (Platform | None)
confidence (int)
-
append(name: str, value: int | None = None) → EnumerationBuilder[source]¶
- Parameters:
-
- Return type:
EnumerationBuilder
-
classmethod create(members: List[Tuple[str, int]] | List[str] | List[EnumerationMember] | None = None, width: int | None = None, arch: Architecture | None = None, sign: bool | BoolWithConfidence = False, platform: Platform | None = None, confidence: int = 255) → EnumerationBuilder[source]¶
- Parameters:
-
- Return type:
EnumerationBuilder
-
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)
FloatType¶
-
class FloatType[source]¶
Bases: Type
-
classmethod create(width: int, altname: str = '', platform: Platform | None = 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 (Platform | None)
confidence (int)
- Return type:
FloatType
FragmentBuilder¶
-
class FragmentBuilder[source]¶
Bases: TypeBuilder
Mutable builder for a bitwise slice, with live size and container placement measured in bits.
-
classmethod create(type: TypeBuilder | Type, width: int, offset: int, endianness: Endianness = Endianness.LittleEndian, confidence: int = 255) → FragmentBuilder[source]¶
Create a mutable fragment whose live bits initially fill a container whose width is measured in bytes.
- Parameters:
type (Type) – larger source type of which the fragment is a slice
width (int) – container width in bytes; the initial live fragment size is width * 8 bits
offset (int) – original source byte offset within type
endianness (Endianness) – byte order used to map source-layout bytes to container bits
confidence (int) – confidence in the resulting type
- Returns:
Mutable fragment type builder
- Return type:
FragmentBuilder
- Example:
>>> source = Type.array(Type.int(1, False), 16)
>>> fragment = FragmentBuilder.create(source, 8, 4, Endianness.BigEndian)
>>> fragment.offset, fragment.fragment_width_bits
(4, 64)
-
property endianness: Endianness¶
Byte order used to map source-layout bytes to bit positions in the current container.
-
property fragment_original_width: int¶
Width in bytes of the original source window, not the live fragment’s bit size.
-
property fragment_start_bit: int¶
Bit offset of the live fragment in the current container, where the least-significant bit is zero.
-
property fragment_truncated_start_bits: int¶
Number of original low-order logical fragment bits no longer represented.
-
property fragment_width_bits: int¶
Size in bits of the live fragment represented in the current container.
-
property fragment_wrap_bit: int¶
Saved historical wrap boundary; zero means the current container width is used.
-
property offset: int¶
Original source byte offset, not the live fragment’s placement within the container.
FragmentType¶
-
class FragmentType[source]¶
Bases: Type
A bitwise slice of a larger source type carried in an integer-like container. Its live size
and placement within the container are measured in bits.
Fragments are generally transient analysis types. They commonly arise when a calling
convention moves part of a structure through a register or when optimized code performs an
inline memcpy using register-sized moves. Retaining a byte-aligned source window, the
source-to-container byte-order mapping, and subsequent bit transformations lets analysis
preserve source and member types through those partial moves. Advanced bit state is normally
produced by analysis; use create or Type.fragment to create a fresh
fragment.
-
classmethod create(type: TypeBuilder | Type, width: int, offset: int, endianness: Endianness = Endianness.LittleEndian, platform: Platform | None = None, confidence: int = 255) → FragmentType[source]¶
Create a fresh fragment whose live bits initially fill a container whose width is measured in bytes.
- Parameters:
type (Type) – larger source type of which the fragment is a slice
width (int) – container width in bytes; the initial live fragment size is width * 8 bits
offset (int) – original source byte offset within type
endianness (Endianness) – byte order used to map source-layout bytes to container bits
platform (Platform) – optional platform associated with the type
confidence (int) – confidence in the resulting type
- Returns:
Immutable fragment type
- Return type:
FragmentType
- Example:
>>> source = Type.array(Type.int(1, False), 16)
>>> fragment = FragmentType.create(source, 8, 4, Endianness.BigEndian)
>>> fragment.fragment_original_width_bytes
8
>>> fragment.fragment_endianness == Endianness.BigEndian
True
-
property fragment_endianness: Endianness¶
Byte order used to map source-layout bytes to bit positions in the current container (read-only).
-
property fragment_original_width_bytes: int¶
Width in bytes of the original source window, not the live fragment’s bit size (read-only).
-
property fragment_start_bit: int¶
Bit offset of the live fragment in the current container, where the least-significant bit is zero (read-only).
-
property fragment_truncated_start_bits: int¶
Number of original low-order logical fragment bits no longer represented (read-only).
-
property fragment_width_bits: int¶
Size in bits of the live fragment represented in the current container (read-only).
-
property fragment_wrap_bit: int¶
Saved historical wrap boundary; zero means the current container width is used (read-only).
-
property offset: int¶
Original source byte offset, not the live fragment’s placement within the container (read-only).
-
property target: Type¶
Larger source type of which this fragment is a slice (read-only).
FunctionBuilder¶
-
class FunctionBuilder[source]¶
Bases: TypeBuilder
-
append(type: TypeBuilder | Type | FunctionParameter, name: str = '')[source]¶
- Parameters:
-
-
classmethod create(return_type: TypeBuilder | Type | ReturnValue | None = None, calling_convention: CallingConvention | None = None, params: List[Type] | List[FunctionParameter] | List[Tuple[str, Type]] | None = None, var_args: bool | BoolWithConfidence | None = None, stack_adjust: int | OffsetWithConfidence | None = None, platform: Platform | None = None, confidence: int = 255, can_return: BoolWithConfidence | None = None, reg_stack_adjust: Dict[RegisterName, int | OffsetWithConfidence] | None = None, name_type: NameType = NameType.NoNameType, pure: BoolWithConfidence | None = None) → 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 pure: BoolWithConfidence¶
-
property return_value: TypeBuilder¶
-
property return_value_location: ValueLocationWithConfidence | None¶
-
property stack_adjust: OffsetWithConfidence¶
-
property stack_adjustment: OffsetWithConfidence¶
-
property variable_arguments: BoolWithConfidence¶
FunctionType¶
-
class FunctionType[source]¶
Bases: Type
-
classmethod create(ret: Type | ReturnValue | None = None, params: List[Type] | List[FunctionParameter] | List[Tuple[str, Type]] | None = None, calling_convention: CallingConvention | None = None, variable_arguments: bool | BoolWithConfidence = BoolWithConfidence(value=False, confidence=255), stack_adjust: OffsetWithConfidence = OffsetWithConfidence(value=0, confidence=255), platform: Platform | None = None, confidence: int = 255, can_return: BoolWithConfidence | bool = True, reg_stack_adjust: Dict[RegisterName, int | OffsetWithConfidence] | None = None, name_type: NameType = NameType.NoNameType, pure: BoolWithConfidence | bool = False) → FunctionType[source]¶
- Parameters:
-
- Return type:
FunctionType
-
property calling_convention: CallingConvention | None¶
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 parameters_with_all_locations: List[FunctionParameter]¶
Type parameters list with default locations filled in with values (read-only)
-
property pure: BoolWithConfidence¶
Whether type is pure
-
property return_value: Type¶
Return value (read-only)
-
property return_value_location: ValueLocationWithConfidence | None¶
Return value location (read-only)
-
property stack_adjustment: OffsetWithConfidence¶
Stack adjustment for function (read-only)
NamedTypeReferenceBuilder¶
-
class NamedTypeReferenceBuilder[source]¶
Bases: TypeBuilder
-
__init__(handle: LP_BNTypeBuilder, ntr_builder_handle: LP_BNNamedTypeReferenceBuilder, platform: Platform | None = None, confidence: int = 255)[source]¶
- Parameters:
handle (LP_BNTypeBuilder)
ntr_builder_handle (LP_BNNamedTypeReferenceBuilder)
platform (Platform | None)
confidence (int)
-
classmethod create(type_class: NamedTypeReferenceClass = NamedTypeReferenceClass.UnknownNamedTypeClass, type_id: str | None = None, name: Iterable[str | bytes] | str | QualifiedName = '', width: int = 0, align: int = 1, platform: Platform | None = None, confidence: int = 255, const: bool | BoolWithConfidence = False, volatile: bool | BoolWithConfidence = False) → NamedTypeReferenceBuilder[source]¶
- Parameters:
-
- Return type:
NamedTypeReferenceBuilder
-
static named_type(named_type: NamedTypeReferenceBuilder, width: int = 0, align: int = 1, const: bool | BoolWithConfidence = BoolWithConfidence(value=False, confidence=255), volatile: bool | BoolWithConfidence = BoolWithConfidence(value=False, confidence=255)) → NamedTypeReferenceBuilder[source]¶
- Parameters:
-
- Return type:
NamedTypeReferenceBuilder
-
static named_type_from_registered_type(view: BinaryView, name: Iterable[str | bytes] | str | QualifiedName) → NamedTypeReferenceBuilder[source]¶
- Parameters:
-
- Return type:
NamedTypeReferenceBuilder
-
static named_type_from_type(name: Iterable[str | bytes] | str | QualifiedName, type_class: NamedTypeReferenceClass | None = None) → NamedTypeReferenceBuilder[source]¶
- Parameters:
-
- Return type:
NamedTypeReferenceBuilder
-
static named_type_from_type_and_id(type_id: str, name: Iterable[str | bytes] | str | QualifiedName, type: TypeBuilder | Type | None = None) → NamedTypeReferenceBuilder[source]¶
- Parameters:
-
- Return type:
NamedTypeReferenceBuilder
-
property id: str¶
-
property name: QualifiedName¶
-
property named_type_class: NamedTypeReferenceClass¶
-
property type_id: str¶
NamedTypeReferenceType¶
-
class NamedTypeReferenceType[source]¶
Bases: Type
-
__init__(handle, platform: Platform | None = None, confidence: int = 255, ntr_handle=None)[source]¶
- Parameters:
-
-
classmethod create(named_type_class: NamedTypeReferenceClass, guid: str | None, name: Iterable[str | bytes] | str | QualifiedName, alignment: int = 0, width: int = 0, platform: Platform | None = None, confidence: int = 255, const: bool | BoolWithConfidence = False, volatile: bool | BoolWithConfidence = False) → NamedTypeReferenceType[source]¶
- Parameters:
-
- Return type:
NamedTypeReferenceType
-
classmethod create_from_handle(ntr_handle, alignment: int = 0, width: int = 0, platform: Platform | None = None, confidence: int = 255, const: bool | BoolWithConfidence = False, volatile: bool | BoolWithConfidence = False)[source]¶
Create a NamedTypeReferenceType from a BNNamedTypeReference handle
- Parameters:
-
-
classmethod create_from_registered_type(view: BinaryView, name: Iterable[str | bytes] | str | QualifiedName, platform: Platform | None = None, confidence: int = 255) → NamedTypeReferenceType[source]¶
- Parameters:
-
- Return type:
NamedTypeReferenceType
-
classmethod create_from_type(name: Iterable[str | bytes] | str | QualifiedName, type: TypeBuilder | Type | None, guid: str | None = None, platform: Platform | None = None, confidence: int = 255, const: bool | BoolWithConfidence = False, volatile: bool | BoolWithConfidence = False) → NamedTypeReferenceType[source]¶
- Parameters:
-
- Return type:
NamedTypeReferenceType
-
static generate_auto_demangled_type_ref(type_class: NamedTypeReferenceClass, name: Iterable[str | bytes] | str | QualifiedName)[source]¶
- Parameters:
-
-
static generate_auto_type_ref(type_class: NamedTypeReferenceClass, source: str, name: Iterable[str | bytes] | str | QualifiedName)[source]¶
- Parameters:
-
-
mutable_copy()[source]¶
-
target(bv: BinaryView) → Type | None[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¶
PointerBuilder¶
-
class PointerBuilder[source]¶
Bases: TypeBuilder
-
add_pointer_suffix(suffix: PointerSuffix)[source]¶
Append a suffix to the pointer, must be one defined in PointerSuffix.
:param suffix: New suffix
- Parameters:
suffix (PointerSuffix)
-
classmethod create(type: TypeBuilder | Type, width: int = 4, arch: Architecture | None = None, const: bool | BoolWithConfidence = False, volatile: bool | BoolWithConfidence = False, ref_type: ReferenceType = ReferenceType.PointerReferenceType, platform: Platform | None = None, confidence: int = 255) → PointerBuilder[source]¶
- Parameters:
-
- Return type:
PointerBuilder
-
get_pointer_suffix_tokens(base_confidence: int = 255) → List[InstructionTextToken][source]¶
Get the pointer suffix, as a list of tokens
:param base_confidence: (optional) Confidence value to combine with the pointer’s confidence
:return: Token list
- Parameters:
base_confidence (int)
- Return type:
List[InstructionTextToken]
-
set_pointer_base(base_type: PointerBaseType, base_offset: int)[source]¶
Set the pointer base type and offset
:param base_type: Base type, e.g. __based(start) is RelativeToBinaryStartPointerBaseType
:param base_offset: Base offset, e.g. __based(start, 0x1000) is 0x1000
- Parameters:
-
-
property children: List[TypeBuilder]¶
-
property immutable_target: Type¶
-
property offset: int¶
Currently not used and has no effect (Leaving this in for compatibility)
-
property origin: Tuple[QualifiedName, int] | None¶
-
property pointer_base_offset: int¶
Pointer base offset, e.g. __based(start, 0x1000) is 0x1000
-
property pointer_base_type: PointerBaseType¶
Pointer base type, e.g. __based(start) is RelativeToBinaryStartPointerBaseType
-
property pointer_suffix: List[PointerSuffix]¶
Pointer suffix, e.g. __unaligned is [UnalignedSuffix] (read-only)
-
property pointer_suffix_string: str¶
Pointer suffix, but as a string, e.g. “__unaligned” (read-only)
-
property target: TypeBuilder¶
PointerType¶
-
class PointerType[source]¶
Bases: Type
-
classmethod create(arch: Architecture, type: TypeBuilder | Type, const: bool | BoolWithConfidence = False, volatile: bool | BoolWithConfidence = False, ref_type: ReferenceType = ReferenceType.PointerReferenceType, platform: Platform | None = None, confidence: int = 255) → PointerType[source]¶
- Parameters:
-
- Return type:
PointerType
-
classmethod create_with_width(width: int, type: TypeBuilder | Type, const: bool | BoolWithConfidence = False, volatile: bool | BoolWithConfidence = False, ref_type: ReferenceType | None = None, platform: Platform | None = None, confidence: int = 255) → PointerType[source]¶
- Parameters:
-
- Return type:
PointerType
-
static from_bools(const: bool | BoolWithConfidence, volatile: bool | BoolWithConfidence) → Tuple[BoolWithConfidence, BoolWithConfidence][source]¶
- Parameters:
-
- Return type:
Tuple[BoolWithConfidence, BoolWithConfidence]
-
get_pointer_suffix_tokens(base_confidence: int = 255) → List[InstructionTextToken][source]¶
Get the pointer suffix, as a list of tokens
:param base_confidence: (optional) Confidence value to combine with the pointer’s confidence
:return: Token list
- Parameters:
base_confidence (int)
- Return type:
List[InstructionTextToken]
-
origin(bv: BinaryView | None) → Tuple[QualifiedName, int] | None[source]¶
- Parameters:
bv (BinaryView | None)
- Return type:
Tuple[QualifiedName, int] | None
-
property children: List[Type]¶
-
property pointer_base_offset: int¶
Pointer base offset, e.g. __based(start, 0x1000) is 0x1000 (read-only)
-
property pointer_base_type: PointerBaseType¶
Pointer base type, e.g. __based(start) is RelativeToBinaryStartPointerBaseType (read-only)
-
property pointer_suffix: List[PointerSuffix]¶
Pointer suffix, e.g. __unaligned is [UnalignedSuffix] (read-only)
-
property pointer_suffix_string: str¶
Pointer suffix, but as a string, e.g. “__unaligned” (read-only)
-
property ref_type: ReferenceType¶
-
property target: Type¶
Target (read-only)
RegisterSet¶
-
class RegisterSet[source]¶
Bases: object
-
__init__(regs: List[RegisterName], confidence: int = 255) → None¶
- Parameters:
-
- Return type:
None
-
with_confidence(confidence)[source]¶
-
confidence: int = 255¶
-
regs: List[RegisterName]¶
RegisterStackAdjustmentWithConfidence¶
-
class RegisterStackAdjustmentWithConfidence[source]¶
Bases: object
-
__init__(value: int, confidence: int = 255) → None¶
- Parameters:
-
- Return type:
None
-
confidence: int = 255¶
-
value: int¶
StructureBuilder¶
-
class StructureBuilder[source]¶
Bases: TypeBuilder
-
__init__(handle: LP_BNTypeBuilder, builder_handle: LP_BNStructureBuilder, platform: Platform | None = None, confidence: int = 255)[source]¶
- Parameters:
handle (LP_BNTypeBuilder)
builder_handle (LP_BNStructureBuilder)
platform (Platform | None)
confidence (int)
-
add_member_at_offset(name: str, type: TypeBuilder | Type, offset: int, overwrite_existing: bool = True, access: MemberAccess = MemberAccess.NoAccess, scope: MemberScope = MemberScope.NoScope, bit_position: int = 0, bit_width: int = 0) → StructureBuilder[source]¶
- Parameters:
-
- Return type:
StructureBuilder
-
append(type: TypeBuilder | Type, name: str = '', access: MemberAccess = MemberAccess.NoAccess, scope: MemberScope = MemberScope.NoScope) → StructureBuilder[source]¶
- Parameters:
-
- Return type:
StructureBuilder
-
classmethod create(members: List[StructureMember] | List[Type] | List[Tuple[Type, str]] | None = None, type: StructureVariant = StructureVariant.StructStructureType, packed: bool = False, width: int | None = None, platform: Platform | None = None, confidence: int = 255) → StructureBuilder[source]¶
- Parameters:
-
- Return type:
StructureBuilder
-
index_by_name(name: str) → int | None[source]¶
- Parameters:
name (str)
- Return type:
int | None
-
index_by_offset(offset: int) → int | None[source]¶
- Parameters:
offset (int)
- Return type:
int | None
-
insert(offset: int, type: TypeBuilder | Type, name: str = '', overwrite_existing: bool = True, access: MemberAccess = MemberAccess.NoAccess, scope: MemberScope = MemberScope.NoScope, bit_position: int = 0, bit_width: int = 0)[source]¶
- Parameters:
-
-
member_at_offset(offset: int) → StructureMember | None[source]¶
- Parameters:
offset (int)
- Return type:
StructureMember | None
-
remove(index: int)[source]¶
- Parameters:
index (int)
-
replace(index: int, type: TypeBuilder | Type, name: str = '', overwrite_existing: bool = True)[source]¶
- Parameters:
-
-
property alignment: int¶
-
property base_structures: List[BaseStructure]¶
Base structure list. Offsets that are not defined by this structure will be filled
in by the fields of the base structure(s).
-
property children: List[TypeBuilder]¶
-
property members: List[StructureMember]¶
Structure member list (read-only)
-
property packed: bool¶
-
property pointer_offset: int¶
-
property propagate_data_var_refs: bool¶
-
property type: StructureVariant¶
-
property union: bool¶
-
property width: int¶
StructureType¶
-
class StructureType[source]¶
Bases: Type
-
__init__(handle, platform: Platform | None = None, confidence: int = 255)[source]¶
- Parameters:
-
-
classmethod create(members: List[StructureMember] | List[Type] | List[Tuple[Type, str]] | None = None, packed: bool = False, type: StructureVariant = StructureVariant.StructStructureType, platform: Platform | None = None, confidence: int = 255) → StructureType[source]¶
- Parameters:
-
- Return type:
StructureType
-
classmethod from_core_struct(structure: BNStructure) → StructureType[source]¶
- Parameters:
structure (BNStructure)
- Return type:
StructureType
-
generate_named_type_reference(guid: str, name: Iterable[str | bytes] | str | QualifiedName)[source]¶
- Parameters:
-
-
member_at_offset(offset: int) → StructureMember[source]¶
- Parameters:
offset (int)
- Return type:
StructureMember
-
member_at_offset_including_inherited(view: BinaryView, offset: int) → InheritedStructureMember[source]¶
Returns the member (including inherited member at the specified offset
- Parameters:
-
- Return type:
InheritedStructureMember
-
members_including_inherited(view: BinaryView | TypeContainer) → List[InheritedStructureMember][source]¶
Returns structure member list, including those inherited by base structures
- Parameters:
view (BinaryView | TypeContainer)
- Return type:
List[InheritedStructureMember]
-
mutable_copy() → StructureBuilder[source]¶
- Return type:
StructureBuilder
-
resolve_member_or_base_member(view: BinaryView | None, offset: int, size: int, resolve_func: Callable[[NamedTypeReferenceType, StructureType, int, int, int, StructureMember], None], member_index_hint: int | None = None) → bool[source]¶
- Parameters:
-
- Return type:
bool
-
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 base_structures: List[BaseStructure]¶
Base structure list (read-only). Offsets that are not defined by this structure will be filled
in by the fields of the base structure(s).
-
property children: List[Type]¶
-
property members¶
Structure member list (read-only). This list will not contain members inherited from base structures.
To get members including inherited ones, call members_including_inherited.
-
property packed¶
-
property pointer_offset¶
Structure pointer offset. Pointers to this structure will implicitly
have this offset subtracted from the pointer to arrive at the start of the structure.
Effectively, the pointer offset becomes the new start of the structure, and fields
before it are accessed using negative offsets from the pointer.
-
property propagate_data_var_refs: bool¶
Whether structure field references propagate the references to data variable field values
-
property type: StructureVariant¶
-
property width¶
Structure width
Symbol¶
-
class Symbol[source]¶
Bases: 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 functions identified as belonging to a shared library |
SymbolicFunctionSymbol |
Symbols for functions without a concrete implementation or which have been abstractly represented |
LocalLabelSymbol |
Symbol for a local label in the current binary |
-
__init__(sym_type, addr, short_name, full_name=None, raw_name=None, binding=None, namespace=None, ordinal=0)[source]¶
Type¶
-
class Type[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
-
__init__(handle, platform: Platform | None = None, confidence: int = 255)[source]¶
- Parameters:
-
-
static array(type: Type, count: int) → ArrayType[source]¶
- Parameters:
-
- Return type:
ArrayType
-
static bool() → BoolType[source]¶
- Return type:
BoolType
-
static builder(bv: BinaryView, name: QualifiedName | None = None, id: str | None = None, platform: Platform | None = 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: List[StructureMember] | List[Type] | List[Tuple[Type, str]] | None = None, packed: bool = False) → StructureType[source]¶
- Parameters:
-
- Return type:
StructureType
-
classmethod create(handle: LP_BNType, platform: Platform | None = None, confidence: int = 255) → Type[source]¶
- Parameters:
-
- Return type:
Type
-
deref_named_type_reference(view: BinaryView) → Type[source]¶
Dereferences any named type references to find the underlying type. This may still return a
named type reference if there are circular references. If the type isn’t a named type
reference, the input type is returned unchanged.
- Parameters:
view (BinaryView) – BinaryView object owning this Type
- Returns:
Type with named type references resolved
- Return type:
Type
-
static enumeration(arch: Architecture | None = None, members: List[Tuple[str, int]] | List[str] | List[EnumerationMember] | None = None, width: int | None = None, sign: bool | BoolWithConfidence = False) → EnumerationType[source]¶
- Parameters:
-
- Return type:
EnumerationType
-
static enumeration_type(arch, enum: EnumerationBuilder, width: int | None = 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.
- Parameters:
-
- Return type:
FloatType
-
static fragment(type: TypeBuilder | Type, width: int, offset: int, endianness: Endianness = Endianness.LittleEndian) → FragmentType[source]¶
Create a fresh fragment whose live bits initially fill a container whose width is measured in bytes.
- Parameters:
type (Type) – larger source type of which the fragment is a slice
width (int) – container width in bytes; the initial live fragment size is width * 8 bits
offset (int) – original source byte offset within type
endianness (Endianness) – byte order used to map source-layout bytes to container bits
- Returns:
Immutable fragment type
- Return type:
FragmentType
- Example:
>>> source = Type.array(Type.int(1, False), 16)
>>> fragment = Type.fragment(source, 8, 4, Endianness.BigEndian)
>>> fragment.target == source
True
>>> fragment.width, fragment.offset
(8, 4)
-
static from_core_struct(core_type: BNType)[source]¶
- Parameters:
core_type (BNType)
-
static function(ret: Type | ReturnValue | None = None, params: List[Type] | List[FunctionParameter] | List[Tuple[str, Type]] | None = None, calling_convention: CallingConvention | None = None, variable_arguments: bool | BoolWithConfidence = False, stack_adjust: OffsetWithConfidence = OffsetWithConfidence(value=0, confidence=255)) → FunctionType[source]¶
function class method for creating a 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
stack_adjust (OffsetWithConfidence)
- Return type:
FunctionType
-
static generate_auto_demangled_type_id(name: Iterable[str | bytes] | str | QualifiedName) → str[source]¶
- Parameters:
name (Iterable[str | bytes] | str | QualifiedName)
- Return type:
str
-
static generate_auto_type_id(source: str, name: Iterable[str | bytes] | str | QualifiedName) → str[source]¶
- Parameters:
-
- Return type:
str
-
static generate_named_type_reference(guid: str, name: Iterable[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 | TypeContainer, name: str | QualifiedName, padding_cols: int = 64, 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
padding_cols (int) – Maximum number of bytes represented by each padding line
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:
-
- 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:
-
- 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:
-
- 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: bool | BoolWithConfidence = True, alternate_name: str = '') → IntegerType[source]¶
int class method for creating an int Type.
- Parameters:
width (int) – width of the integer in bytes
sign (bool) – optional variable representing signedness
alternate_name (str) – alternate name for type
- 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: Iterable[str | bytes] | str | QualifiedName) → NamedTypeReferenceType[source]¶
- Parameters:
-
- Return type:
NamedTypeReferenceType
-
static named_type_from_type(name: Iterable[str | bytes] | str | QualifiedName, type: TypeBuilder | Type) → NamedTypeReferenceType[source]¶
- Parameters:
-
- Return type:
NamedTypeReferenceType
-
static named_type_from_type_and_id(type_id: str, name: Iterable[str | bytes] | str | QualifiedName, type: TypeBuilder | Type | None = None) → NamedTypeReferenceType[source]¶
- Parameters:
-
- Return type:
NamedTypeReferenceType
-
static named_type_reference(type_class: NamedTypeReferenceClass, name: Iterable[str | bytes] | str | QualifiedName, type_id: str | None = None, alignment: int = 1, width: int = 0, const: bool | BoolWithConfidence = BoolWithConfidence(value=False, confidence=255), volatile: bool | BoolWithConfidence = BoolWithConfidence(value=False, confidence=255))[source]¶
- Parameters:
-
-
static pointer(arch: Architecture, type: TypeBuilder | Type, const: bool | BoolWithConfidence = BoolWithConfidence(value=False, confidence=255), volatile: bool | BoolWithConfidence = BoolWithConfidence(value=False, confidence=255), ref_type: ReferenceType = ReferenceType.PointerReferenceType, width: int | None = None) → PointerType[source]¶
- Parameters:
-
- Return type:
PointerType
-
static pointer_of_width(width: int, type: TypeBuilder | Type, const: bool | BoolWithConfidence = False, volatile: bool | BoolWithConfidence = False, ref_type: ReferenceType = ReferenceType.PointerReferenceType) → PointerType[source]¶
- Parameters:
-
- Return type:
PointerType
-
static structure(members: List[StructureMember] | List[Type] | List[Tuple[Type, str]] | None = 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: List[StructureMember] | List[Type] | You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |