variable module

binaryninja.variable.AddressRange(start, end)

binaryninja.variable.ConstantPointerRegisterValue(...)

binaryninja.variable.ConstantReference(...)

binaryninja.variable.ConstantRegisterValue(...)

binaryninja.variable.CoreVariable(...)

binaryninja.variable.EntryRegisterValue(...)

binaryninja.variable.ExternalPointerRegisterValue(...)

binaryninja.variable.ImportedAddressRegisterValue(...)

binaryninja.variable.IndirectBranchInfo(...)

binaryninja.variable.LookupTableEntry(...)

binaryninja.variable.ParameterVariables(var_list)

Note

This object is a "passive" object. Any changes you make to it will not be reflected in the core and vice-versa. If you wish to update a core version of this object you should use the appropriate API.

binaryninja.variable.PossibleValueSet([...])

class PossibleValueSet PossibleValueSet is used to define possible values that a variable can take.

binaryninja.variable.RegisterValue(value, ...)

binaryninja.variable.ReturnAddressRegisterValue(...)

binaryninja.variable.StackFrameOffsetRegisterValue(...)

binaryninja.variable.StackVariableReference(...)

binaryninja.variable.Undetermined(value, ...)

binaryninja.variable.ValueRange(start, end, step)

binaryninja.variable.Variable(func, ...)

binaryninja.variable.VariableNameAndType(...)

class AddressRange(start: int, end: int)[source]

Bases: object

Parameters
  • start (int) –

  • end (int) –

Return type

None

end: int
start: int
class ConstantPointerRegisterValue(value: int, offset: int = 0, type: binaryninja.enums.RegisterValueType = <RegisterValueType.ConstantPointerValue: 3>, confidence: int = 255)[source]

Bases: binaryninja.variable.RegisterValue

Parameters
Return type

None

offset: int = 0
type: binaryninja.enums.RegisterValueType = 3
class ConstantReference(value: int, size: int, pointer: bool, intermediate: bool)[source]

Bases: object

Parameters
  • value (int) –

  • size (int) –

  • pointer (bool) –

  • intermediate (bool) –

Return type

None

intermediate: bool
pointer: bool
size: int
value: int
class ConstantRegisterValue(value: int, offset: int = 0, type: binaryninja.enums.RegisterValueType = <RegisterValueType.ConstantValue: 2>, confidence: int = 255)[source]

Bases: binaryninja.variable.RegisterValue

Parameters
Return type

None

offset: int = 0
type: binaryninja.enums.RegisterValueType = 2
class CoreVariable(_source_type: int, index: int, storage: int)[source]

Bases: object

Parameters
  • _source_type (int) –

  • index (int) –

  • storage (int) –

Return type

None

classmethod from_BNVariable(var: binaryninja._binaryninjacore.BNVariable)[source]
Parameters

var (binaryninja._binaryninjacore.BNVariable) –

classmethod from_identifier(identifier)[source]
to_BNVariable()[source]
property identifier: int
index: int
property source_type: binaryninja.enums.VariableSourceType
storage: int
class EntryRegisterValue(value: int = 0, offset: int = 0, type: binaryninja.enums.RegisterValueType = <RegisterValueType.EntryValue: 1>, confidence: int = 255, reg: Optional[ForwardRef('binaryninja.architecture.RegisterName')] = None)[source]

Bases: binaryninja.variable.RegisterValue

Parameters
Return type

None

offset: int = 0
reg: Optional[binaryninja.architecture.RegisterName] = None
type: binaryninja.enums.RegisterValueType = 1
value: int = 0
class ExternalPointerRegisterValue(value: int, offset: int, type: binaryninja.enums.RegisterValueType = <RegisterValueType.ExternalPointerValue: 4>, confidence: int = 255)[source]

Bases: binaryninja.variable.RegisterValue

Parameters
Return type

None

type: binaryninja.enums.RegisterValueType = 4
class ImportedAddressRegisterValue(value: int, offset: int = 0, type: binaryninja.enums.RegisterValueType = <RegisterValueType.ImportedAddressValue: 7>, confidence: int = 255)[source]

Bases: binaryninja.variable.RegisterValue

Parameters
Return type

None

offset: int = 0
type: binaryninja.enums.RegisterValueType = 7
class IndirectBranchInfo(source_arch: 'binaryninja.architecture.Architecture', source_addr: int, dest_arch: 'binaryninja.architecture.Architecture', dest_addr: int, auto_defined: bool)[source]

Bases: object

Parameters
Return type

None

auto_defined: bool
dest_addr: int
dest_arch: binaryninja.architecture.Architecture
source_addr: int
source_arch: binaryninja.architecture.Architecture
class LookupTableEntry(from_values: List[int], to_value: int, type: binaryninja.enums.RegisterValueType = <RegisterValueType.LookupTableValue: 10>)[source]

Bases: object

Parameters
Return type

None

from_values: List[int]
to_value: int
type: binaryninja.enums.RegisterValueType = 10
class ParameterVariables(var_list: List[binaryninja.variable.Variable], confidence: int = 255, func: Optional[binaryninja.function.Function] = None)[source]

Bases: object

Note

This object is a “passive” object. Any changes you make to it will not be reflected in the core and vice-versa. If you wish to update a core version of this object you should use the appropriate API.

Parameters
with_confidence(confidence: int) binaryninja.variable.ParameterVariables[source]
Parameters

confidence (int) –

Return type

binaryninja.variable.ParameterVariables

property confidence: int
property function: Optional[binaryninja.function.Function]
property vars: List[binaryninja.variable.Variable]
class PossibleValueSet(arch=None, value=None)[source]

Bases: object

class PossibleValueSet PossibleValueSet is used to define possible values that a variable can take. It contains methods to instantiate different value sets such as Constant, Signed/Unsigned Ranges, etc.

Note

This object is a “passive” object. Any changes you make to it will not be reflected in the core and vice-versa. If you wish to update a core version of this object you should use the appropriate API.

static constant(value: int) binaryninja.variable.PossibleValueSet[source]

Create a constant valued PossibleValueSet object.

Parameters

value (int) – Integer value of the constant

Return type

PossibleValueSet

static constant_ptr(value: int) binaryninja.variable.PossibleValueSet[source]

Create constant pointer valued PossibleValueSet object.

Parameters

value (int) – Integer value of the constant pointer

Return type

PossibleValueSet

static in_set_of_values(values: Union[List[int], Set[int]]) binaryninja.variable.PossibleValueSet[source]

Create a PossibleValueSet object for a value in a set of values.

Parameters

values (list(int)) – List of integer values

Return type

PossibleValueSet

static lookup_table_value(lookup_table, mapping) binaryninja.variable.PossibleValueSet[source]

Create a PossibleValueSet object for a value which is a member of a lookuptable.

Parameters
Return type

PossibleValueSet

static not_in_set_of_values(values) binaryninja.variable.PossibleValueSet[source]

Create a PossibleValueSet object for a value NOT in a set of values.

Parameters

values (list(int)) – List of integer values

Return type

PossibleValueSet

static signed_range_value(ranges: List[binaryninja.variable.ValueRange]) binaryninja.variable.PossibleValueSet[source]

Create a PossibleValueSet object for a signed range of values.

Parameters

ranges (list(ValueRange)) – List of ValueRanges

Return type

PossibleValueSet

Example
>>> v_1 = ValueRange(-5, -1, 1)
>>> v_2 = ValueRange(7, 10, 1)
>>> val = PossibleValueSet.signed_range_value([v_1, v_2])
<signed ranges: [<range: -0x5 to -0x1>, <range: 0x7 to 0xa>]>
static stack_frame_offset(offset: int) binaryninja.variable.PossibleValueSet[source]

Create a PossibleValueSet object for a stack frame offset.

Parameters

offset (int) – Integer value of the offset

Return type

PossibleValueSet

static undetermined() binaryninja.variable.PossibleValueSet[source]

Create a PossibleValueSet object of type UndeterminedValue.

Returns

PossibleValueSet object of type UndeterminedValue

Return type

PossibleValueSet

static unsigned_range_value(ranges: List[binaryninja.variable.ValueRange]) binaryninja.variable.PossibleValueSet[source]

Create a PossibleValueSet object for a unsigned signed range of values.

Parameters

ranges (list(ValueRange)) – List of ValueRanges

Return type

PossibleValueSet

Example
>>> v_1 = ValueRange(0, 5, 1)
>>> v_2 = ValueRange(7, 10, 1)
>>> val = PossibleValueSet.unsigned_range_value([v_1, v_2])
<unsigned ranges: [<range: 0x0 to 0x5>, <range: 0x7 to 0xa>]>
property count: int
property mapping: Mapping[int, int]
property offset: int
property ranges: List[binaryninja.variable.ValueRange]
property reg: RegisterName
property table: List[binaryninja.variable.LookupTableEntry]
property type: binaryninja.enums.RegisterValueType
property value: int
property values: Set[int]
class RegisterValue(value: int, offset: int, type: binaryninja.enums.RegisterValueType = <RegisterValueType.UndeterminedValue: 0>, confidence: int = 255)[source]

Bases: object

Parameters
Return type

None

classmethod from_BNRegisterValue(reg_value: Union[binaryninja._binaryninjacore.BNRegisterValue, binaryninja._binaryninjacore.BNRegisterValueWithConfidence], arch: Optional[binaryninja.architecture.Architecture] = None) binaryninja.variable.RegisterValue[source]
Parameters
Return type

binaryninja.variable.RegisterValue

confidence: int = 255
offset: int
type: binaryninja.enums.RegisterValueType = 0
value: int
class ReturnAddressRegisterValue(value: int, offset: int = 0, type: binaryninja.enums.RegisterValueType = <RegisterValueType.ReturnAddressValue: 6>, confidence: int = 255)[source]

Bases: binaryninja.variable.RegisterValue

Parameters
Return type

None

offset: int = 0
type: binaryninja.enums.RegisterValueType = 6
class StackFrameOffsetRegisterValue(value: int, offset: int = 0, type: binaryninja.enums.RegisterValueType = <RegisterValueType.StackFrameOffset: 5>, confidence: int = 255)[source]

Bases: binaryninja.variable.RegisterValue

Parameters
Return type

None

offset: int = 0
type: binaryninja.enums.RegisterValueType = 5
class StackVariableReference(_source_operand: Optional[int], type: 'binaryninja.types.Type', name: str, var: 'Variable', referenced_offset: int, size: int)[source]

Bases: object

Parameters
Return type

None

name: str
referenced_offset: int
size: int
property source_operand
type: binaryninja.types.Type
var: binaryninja.variable.Variable
class Undetermined(value: int = 0, offset: int = 0, type: binaryninja.enums.RegisterValueType = <RegisterValueType.UndeterminedValue: 0>, confidence: int = 255)[source]

Bases: binaryninja.variable.RegisterValue

Parameters
Return type

None

offset: int = 0
type: binaryninja.enums.RegisterValueType = 0
value: int = 0
class ValueRange(start: int, end: int, step: int)[source]

Bases: object

Parameters
  • start (int) –

  • end (int) –

  • step (int) –

Return type

None

end: int
start: int
step: int
class Variable(func: Union[binaryninja.function.Function, binaryninja.lowlevelil.LowLevelILFunction, binaryninja.mediumlevelil.MediumLevelILFunction, binaryninja.highlevelil.HighLevelILFunction], source_type: binaryninja.enums.VariableSourceType, index: int, storage: int)[source]

Bases: binaryninja.variable.CoreVariable

Parameters
classmethod from_BNVariable(func: Union[binaryninja.function.Function, binaryninja.lowlevelil.LowLevelILFunction, binaryninja.mediumlevelil.MediumLevelILFunction, binaryninja.highlevelil.HighLevelILFunction], var: binaryninja._binaryninjacore.BNVariable)[source]
Parameters
classmethod from_core_variable(func: Union[binaryninja.function.Function, binaryninja.lowlevelil.LowLevelILFunction, binaryninja.mediumlevelil.MediumLevelILFunction, binaryninja.highlevelil.HighLevelILFunction], var: binaryninja.variable.CoreVariable)[source]
Parameters
classmethod from_identifier(func: Union[binaryninja.function.Function, binaryninja.lowlevelil.LowLevelILFunction, binaryninja.mediumlevelil.MediumLevelILFunction, binaryninja.highlevelil.HighLevelILFunction], identifier: int)[source]
Parameters
classmethod from_variable_name_and_type(func: Union[binaryninja.function.Function, binaryninja.lowlevelil.LowLevelILFunction, binaryninja.mediumlevelil.MediumLevelILFunction, binaryninja.highlevelil.HighLevelILFunction], var: binaryninja.variable.VariableNameAndType)[source]
Parameters
set_name_and_type_async(name: Optional[str], new_type: binaryninja.types.Type) None[source]

set_name_and_type_async provides a way to asynchronously set both the name and type of a variable. This method should be used when speed is of concern.

Parameters
Return type

None

set_name_async(name: Optional[str]) None[source]

set_name_async provides a way to asynchronously set the name of a variable. This method should be used when speed is of concern.

Parameters

name (Optional[str]) –

Return type

None

set_type_async(new_type: binaryninja.types.Type) None[source]

set_type_async provides a way to asynchronously set the type of a variable. This method should be used when speed is of concern.

Parameters

new_type (binaryninja.types.Type) –

Return type

None

property core_variable: binaryninja.variable.CoreVariable
property dead_store_elimination: binaryninja.enums.DeadStoreElimination
property function: binaryninja.function.Function

returns the source Function object which this variable belongs to

index: int
property name: str

Name of the variable, Settings thisslow because it ensures that analysis has been updated.

property ssa_versions: Generator[int, None, None]

Returns the SSA versions associated with this variable. Doesn’t return anything for aliased variables.

storage: int
property type: Optional[binaryninja.types.Type]
property var_name_and_type: binaryninja.variable.VariableNameAndType
class VariableNameAndType(_source_type: int, index: int, storage: int, name: str, type: 'binaryninja.types.Type')[source]

Bases: binaryninja.variable.CoreVariable

Parameters
Return type

None

classmethod from_core_variable(var, name, type)[source]
classmethod from_identifier(identifier, name, type)[source]
name: str
type: binaryninja.types.Type