variable module¶
Class | Description |
|---|---|
| |
Note This object is a “passive” object. Any changes you make to it will not be reflected in… | |
class PossibleValueSet PossibleValueSet is used to define possible values that a variable can… | |
| |
|
AddressRange¶
ConstantData¶
- classConstantData[source]¶
Bases:
RegisterValueConstantData(value: int, offset: int, type: binaryninja.enums.RegisterValueType = <RegisterValueType.UndeterminedValue: 0>, confidence: int = 255, size: int = 0, function: ‘_function.Function’ = None)
- __init__(value:int,offset:int,type:RegisterValueType=RegisterValueType.UndeterminedValue,confidence:int=255,size:int=0,function:_function.Function=None)→None¶
- Parameters:
value (int) –
offset (int) –
type (RegisterValueType) –
confidence (int) –
size (int) –
function (_function.Function) –
- Return type:
None
- propertydata:DataBuffer¶
- propertydata_and_builtin:Tuple[DataBuffer,BuiltinType]¶
- function:_function.Function=None¶
ConstantDataRegisterValue¶
- classConstantDataRegisterValue[source]¶
Bases:
RegisterValueConstantDataRegisterValue(value: int, offset: int, type: binaryninja.enums.RegisterValueType = <RegisterValueType.UndeterminedValue: 0>, confidence: int = 255, size: int = 0)
ConstantPointerRegisterValue¶
- classConstantPointerRegisterValue[source]¶
Bases:
RegisterValueConstantPointerRegisterValue(value: int, offset: int = 0, type: binaryninja.enums.RegisterValueType = <RegisterValueType.ConstantPointerValue: 3>, confidence: int = 255, size: int = 0)
- __init__(value:int,offset:int=0,type:RegisterValueType=RegisterValueType.ConstantPointerValue,confidence:int=255,size:int=0)→None¶
- Parameters:
value (int) –
offset (int) –
type (RegisterValueType) –
confidence (int) –
size (int) –
- Return type:
None
- type:RegisterValueType=3¶
ConstantReference¶
ConstantRegisterValue¶
- classConstantRegisterValue[source]¶
Bases:
RegisterValueConstantRegisterValue(value: int, offset: int = 0, type: binaryninja.enums.RegisterValueType = <RegisterValueType.ConstantValue: 2>, confidence: int = 255, size: int = 0)
- __init__(value:int,offset:int=0,type:RegisterValueType=RegisterValueType.ConstantValue,confidence:int=255,size:int=0)→None¶
- Parameters:
value (int) –
offset (int) –
type (RegisterValueType) –
confidence (int) –
size (int) –
- Return type:
None
- type:RegisterValueType=2¶
CoreVariable¶
- classCoreVariable[source]¶
Bases:
objectclassCoreVariableis the base class for other variable types,such asVariableNameAndTypeandVariable- Variables:
index – Internal identifier
storage – If this variable is a stack variable(source_type == VariableSourceType.StackVariableSourceType),then the storage location is the offset onto the stack that containsthe first byte of this variable. Otherwise it’s used as an internal identifier.
- propertysource_type:VariableSourceType¶
Whether this variable was created based off of an underlying register, stack location, or flag.
EntryRegisterValue¶
- classEntryRegisterValue[source]¶
Bases:
RegisterValueEntryRegisterValue(value: int = 0, offset: int = 0, type: binaryninja.enums.RegisterValueType = <RegisterValueType.EntryValue: 1>, confidence: int = 255, size: int = 0, reg: Optional[ForwardRef(‘binaryninja.architecture.RegisterName’)] = None)
- __init__(value:int=0,offset:int=0,type:RegisterValueType=RegisterValueType.EntryValue,confidence:int=255,size:int=0,reg:RegisterName|None=None)→None¶
- Parameters:
value (int) –
offset (int) –
type (RegisterValueType) –
confidence (int) –
size (int) –
reg (RegisterName |None) –
- Return type:
None
- type:RegisterValueType=1¶
ExternalPointerRegisterValue¶
- classExternalPointerRegisterValue[source]¶
Bases:
RegisterValueExternalPointerRegisterValue(value: int, offset: int, type: binaryninja.enums.RegisterValueType = <RegisterValueType.ExternalPointerValue: 4>, confidence: int = 255, size: int = 0)
- __init__(value:int,offset:int,type:RegisterValueType=RegisterValueType.ExternalPointerValue,confidence:int=255,size:int=0)→None¶
- Parameters:
value (int) –
offset (int) –
type (RegisterValueType) –
confidence (int) –
size (int) –
- Return type:
None
- type:RegisterValueType=4¶
ImportedAddressRegisterValue¶
- classImportedAddressRegisterValue[source]¶
Bases:
RegisterValueImportedAddressRegisterValue(value: int, offset: int = 0, type: binaryninja.enums.RegisterValueType = <RegisterValueType.ImportedAddressValue: 7>, confidence: int = 255, size: int = 0)
- __init__(value:int,offset:int=0,type:RegisterValueType=RegisterValueType.ImportedAddressValue,confidence:int=255,size:int=0)→None¶
- Parameters:
value (int) –
offset (int) –
type (RegisterValueType) –
confidence (int) –
size (int) –
- Return type:
None
- type:RegisterValueType=7¶
IndirectBranchInfo¶
- classIndirectBranchInfo[source]¶
Bases:
objectIndirectBranchInfo(source_arch: ‘binaryninja.architecture.Architecture’, source_addr: int, dest_arch: ‘binaryninja.architecture.Architecture’, dest_addr: int, auto_defined: bool)
- __init__(source_arch:Architecture,source_addr:int,dest_arch:Architecture,dest_addr:int,auto_defined:bool)→None¶
- Parameters:
source_arch (Architecture) –
source_addr (int) –
dest_arch (Architecture) –
dest_addr (int) –
auto_defined (bool) –
- Return type:
None
- dest_arch:Architecture¶
- source_arch:Architecture¶
LookupTableEntry¶
- classLookupTableEntry[source]¶
Bases:
objectLookupTableEntry(from_values: List[int], to_value: int, type: binaryninja.enums.RegisterValueType = <RegisterValueType.LookupTableValue: 10>)
- __init__(from_values:List[int],to_value:int,type:RegisterValueType=RegisterValueType.LookupTableValue)→None¶
- Parameters:
to_value (int) –
type (RegisterValueType) –
- Return type:
None
- type:RegisterValueType=10¶
ParameterVariables¶
- classParameterVariables[source]¶
Bases:
objectNote
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.
- with_confidence(confidence:int)→ParameterVariables[source]¶
- Parameters:
confidence (int) –
- Return type:
PossibleValueSet¶
- classPossibleValueSet[source]¶
Bases:
objectclass PossibleValueSet PossibleValueSet is used to define possible valuesthat a variable can take. It contains methods to instantiate differentvalue 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.
- staticconstant(value:int)→PossibleValueSet[source]¶
Create a constant valued PossibleValueSet object.
- Parameters:
value (int) – Integer value of the constant
- Return type:
- staticconstant_ptr(value:int)→PossibleValueSet[source]¶
Create constant pointer valued PossibleValueSet object.
- Parameters:
value (int) – Integer value of the constant pointer
- Return type:
- staticin_set_of_values(values:List[int]|Set[int])→PossibleValueSet[source]¶
Create a PossibleValueSet object for a value in a set of values.
- Parameters:
- Return type:
- staticlookup_table_value(lookup_table,mapping)→PossibleValueSet[source]¶
Create a PossibleValueSet object for a value which is a member of alookup table.
- Parameters:
lookup_table (list(LookupTableEntry)) – List of table entries
- Return type:
- staticnot_in_set_of_values(values)→PossibleValueSet[source]¶
Create a PossibleValueSet object for a value NOT in a set of values.
- Parameters:
- Return type:
- staticsigned_range_value(ranges:List[ValueRange])→PossibleValueSet[source]¶
Create a PossibleValueSet object for a signed range of values.
- Parameters:
ranges (list(ValueRange)) – List of ValueRanges
- Return type:
- 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>]>
- staticstack_frame_offset(offset:int)→PossibleValueSet[source]¶
Create a PossibleValueSet object for a stack frame offset.
- Parameters:
offset (int) – Integer value of the offset
- Return type:
- staticundetermined()→PossibleValueSet[source]¶
Create a PossibleValueSet object of type UndeterminedValue.
- Returns:
PossibleValueSet object of type UndeterminedValue
- Return type:
- staticunsigned_range_value(ranges:List[ValueRange])→PossibleValueSet[source]¶
Create a PossibleValueSet object for a unsigned signed range of values.
- Parameters:
ranges (list(ValueRange)) – List of ValueRanges
- Return type:
- 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>]>
- propertyranges:List[ValueRange]¶
- propertyreg:RegisterName¶
- propertytable:List[LookupTableEntry]¶
- propertytype:RegisterValueType¶
RegisterValue¶
- classRegisterValue[source]¶
Bases:
objectRegisterValue(value: int, offset: int, type: binaryninja.enums.RegisterValueType = <RegisterValueType.UndeterminedValue: 0>, confidence: int = 255, size: int = 0)
- __init__(value:int,offset:int,type:RegisterValueType=RegisterValueType.UndeterminedValue,confidence:int=255,size:int=0)→None¶
- Parameters:
value (int) –
offset (int) –
type (RegisterValueType) –
confidence (int) –
size (int) –
- Return type:
None
- classmethodfrom_BNRegisterValue(reg_value:BNRegisterValue|BNRegisterValueWithConfidence,arch:Architecture|None=None)→RegisterValue[source]¶
- Parameters:
reg_value (BNRegisterValue |BNRegisterValueWithConfidence) –
arch (Architecture |None) –
- Return type:
- classmethodto_BNRegisterValue(reg_value:RegisterValue)→BNRegisterValue[source]¶
- Parameters:
reg_value (RegisterValue) –
- Return type:
BNRegisterValue
- type:RegisterValueType=0¶
ReturnAddressRegisterValue¶
- classReturnAddressRegisterValue[source]¶
Bases:
RegisterValueReturnAddressRegisterValue(value: int, offset: int = 0, type: binaryninja.enums.RegisterValueType = <RegisterValueType.ReturnAddressValue: 6>, confidence: int = 255, size: int = 0)
- __init__(value:int,offset:int=0,type:RegisterValueType=RegisterValueType.ReturnAddressValue,confidence:int=255,size:int=0)→None¶
- Parameters:
value (int) –
offset (int) –
type (RegisterValueType) –
confidence (int) –
size (int) –
- Return type:
None
- type:RegisterValueType=6¶
StackFrameOffsetRegisterValue¶
- classStackFrameOffsetRegisterValue[source]¶
Bases:
RegisterValueStackFrameOffsetRegisterValue(value: int, offset: int = 0, type: binaryninja.enums.RegisterValueType = <RegisterValueType.StackFrameOffset: 5>, confidence: int = 255, size: int = 0)
- __init__(value:int,offset:int=0,type:RegisterValueType=RegisterValueType.StackFrameOffset,confidence:int=255,size:int=0)→None¶
- Parameters:
value (int) –
offset (int) –
type (RegisterValueType) –
confidence (int) –
size (int) –
- Return type:
None
- type:RegisterValueType=5¶
StackVariableReference¶
- classStackVariableReference[source]¶
Bases:
objectStackVariableReference(_source_operand: Optional[int], type: ‘binaryninja.types.Type’, name: str, var: ‘Variable’, referenced_offset: int, size: int)
- __init__(_source_operand:int|None,type:Type,name:str,var:Variable,referenced_offset:int,size:int)→None¶
- propertysource_operand¶
Undetermined¶
- classUndetermined[source]¶
Bases:
RegisterValueUndetermined(value: int = 0, offset: int = 0, type: binaryninja.enums.RegisterValueType = <RegisterValueType.UndeterminedValue: 0>, confidence: int = 255, size: int = 0)
- __init__(value:int=0,offset:int=0,type:RegisterValueType=RegisterValueType.UndeterminedValue,confidence:int=255,size:int=0)→None¶
- Parameters:
value (int) –
offset (int) –
type (RegisterValueType) –
confidence (int) –
size (int) –
- Return type:
None
- type:RegisterValueType=0¶
ValueRange¶
Variable¶
- classVariable[source]¶
Bases:
CoreVariableclassVariablerepresents variables in Binary Ninja. Variables are resolvedin medium level IL, so variables objects are only valid for MLIL and above.- __init__(func:Function|LowLevelILFunction|MediumLevelILFunction|HighLevelILFunction,source_type:VariableSourceType,index:int,storage:int)[source]¶
- Parameters:
func (Function |LowLevelILFunction |MediumLevelILFunction |HighLevelILFunction) –
source_type (VariableSourceType) –
index (int) –
storage (int) –
- classmethodfrom_BNVariable(func:Function|LowLevelILFunction|MediumLevelILFunction|HighLevelILFunction,var:BNVariable)[source]¶
- Parameters:
func (Function |LowLevelILFunction |MediumLevelILFunction |HighLevelILFunction) –
var (BNVariable) –
- classmethodfrom_core_variable(func:Function|LowLevelILFunction|MediumLevelILFunction|HighLevelILFunction,var:CoreVariable)[source]¶
- Parameters:
func (Function |LowLevelILFunction |MediumLevelILFunction |HighLevelILFunction) –
var (CoreVariable) –
- classmethodfrom_identifier(func:Function|LowLevelILFunction|MediumLevelILFunction|HighLevelILFunction,identifier:int)[source]¶
- Parameters:
func (Function |LowLevelILFunction |MediumLevelILFunction |HighLevelILFunction) –
identifier (int) –
- classmethodfrom_variable_name_and_type(func:Function|LowLevelILFunction|MediumLevelILFunction|HighLevelILFunction,var:VariableNameAndType)[source]¶
- Parameters:
func (Function |LowLevelILFunction |MediumLevelILFunction |HighLevelILFunction) –
var (VariableNameAndType) –
- set_name_and_type_async(name:str|None,new_type:Type)→None[source]¶
set_name_and_type_asyncprovides a way to asynchronously set both the name and type of a variable. This method should be usedwhen speed is of concern.
- set_name_async(name:str|None)→None[source]¶
set_name_asyncprovides a way to asynchronously set the name of a variable. This method should be usedwhen speed is of concern.- Parameters:
name (str |None) –
- Return type:
None
- set_type_async(new_type:Type)→None[source]¶
set_type_asyncprovides a way to asynchronously set the type of a variable. This method should be usedwhen speed is of concern.- Parameters:
new_type (Type) –
- Return type:
None
- propertycore_variable:CoreVariable¶
Retrieve the underlying
CoreVariableclass
- propertydead_store_elimination:DeadStoreElimination¶
returns the dead store elimination setting for this variable
- propertyil_function:function.ILFunctionType¶
returns the IL Function object which this variable belongs to
- propertylast_seen_name:str¶
Name of the variable, or the name most recently assigned if the variable has since been removed (read-only).
- propertyname:str¶
Name of the variable, Settings this property is slow because it ensures that analysis has been updated. If you are renaming many variables, use
set_name_async, then callupdate_analysiswhen complete.
- propertyssa_versions:Generator[int,None,None]¶
Returns the SSA versions associated with this variable. Doesn’t return anything for aliased variables.
- propertyvar_name_and_type:VariableNameAndType¶
Convert to
VariableNameAndType
VariableNameAndType¶
- classVariableNameAndType[source]¶
Bases:
CoreVariableclassVariableNameAndTypeis a lightweight wrapper around avariable and its name, useful for shuttling between APIs that requirethem both. WhileVariablehasVariable.nameandVariable.typefields, those require additional core callseach time you fetch them.- Variables:
name – The variable’s name
type – The variable’s type