highlevelil module

binaryninja.highlevelil.GotoLabel(function, id)

binaryninja.highlevelil.HighLevelILBasicBlock(…)

binaryninja.highlevelil.HighLevelILExpr(index)

class HighLevelILExpr hold the index of IL Expressions.

binaryninja.highlevelil.HighLevelILFunction([…])

class HighLevelILFunction contains the a HighLevelILInstruction object that makes up the abstract syntax tree of a binaryninja.function.

binaryninja.highlevelil.HighLevelILInstruction(…)

class HighLevelILInstruction High Level Intermediate Language Instructions form an abstract syntax tree of the code.

binaryninja.highlevelil.HighLevelILOperationAndSize(…)

class GotoLabel(function, id)[source]

Bases: object

definition
label_id
name
uses
class HighLevelILBasicBlock(view, handle, owner)[source]

Bases: binaryninja.basicblock.BasicBlock

il_function
class HighLevelILExpr(index)[source]

Bases: object

class HighLevelILExpr hold the index of IL Expressions.

Note

This class shouldn’t be instantiated directly. Rather the helper members of HighLevelILFunction should be used instead.

index
class HighLevelILFunction(arch=None, handle=None, source_func=None)[source]

Bases: object

class HighLevelILFunction contains the a HighLevelILInstruction object that makes up the abstract syntax tree of a binaryninja.function.

add_operand_list(operands)[source]

add_operand_list returns an operand list expression for the given list of integer operands.

Parameters

operands (list(int)) – list of operand numbers

Returns

an operand list expression

Return type

HighLevelILExpr

create_graph(settings=None)[source]
expr(operation, a=0, b=0, c=0, d=0, e=0, size=0)[source]
finalize()[source]

finalize ends the function and computes the list of basic blocks.

Return type

None

get_label(label_idx)[source]
get_label_uses(label_idx)[source]
get_medium_level_il_expr_index(expr)[source]
get_non_ssa_instruction_index(instr)[source]
get_ssa_instruction_index(instr)[source]
get_ssa_memory_definition(version)[source]
get_ssa_memory_uses(version)[source]
get_ssa_var_definition(ssa_var)[source]
get_ssa_var_uses(ssa_var)[source]
get_var_definitions(var)[source]
get_var_uses(var)[source]
is_ssa_var_live(ssa_var)[source]

is_ssa_var_live determines if ssa_var is live at any point in the function

Parameters

ssa_var (SSAVariable) – the SSA variable to query

Returns

whether the variable is live at any point in the function

Return type

bool

set_current_address(value, arch=None)[source]
arch
basic_blocks

list of HighLevelILBasicBlock objects (read-only)

current_address

Current IL Address (read/write)

instructions

A generator of hlil instructions of the current function

medium_level_il

Medium level IL for this function

mlil

Alias for medium_level_il

non_ssa_form

High level IL in non-SSA (default) form (read-only)

root

Root of the abstract syntax tree

source_function
ssa_form

High level IL in SSA form (read-only)

class HighLevelILInstruction(func, expr_index, as_ast=True, instr_index=None)[source]

Bases: object

class HighLevelILInstruction High Level Intermediate Language Instructions form an abstract syntax tree of the code. Control flow structures are present as high level constructs in the HLIL tree.

get_possible_values(options=[])[source]
get_ssa_var_version(var)[source]
ILOperations = {<HighLevelILOperation.HLIL_NOP: 0>: [], <HighLevelILOperation.HLIL_BLOCK: 1>: [('body', 'expr_list')], <HighLevelILOperation.HLIL_IF: 2>: [('condition', 'expr'), ('true', 'expr'), ('false', 'expr')], <HighLevelILOperation.HLIL_WHILE: 3>: [('condition', 'expr'), ('body', 'expr')], <HighLevelILOperation.HLIL_DO_WHILE: 4>: [('body', 'expr'), ('condition', 'expr')], <HighLevelILOperation.HLIL_FOR: 5>: [('init', 'expr'), ('condition', 'expr'), ('update', 'expr'), ('body', 'expr')], <HighLevelILOperation.HLIL_SWITCH: 6>: [('condition', 'expr'), ('default', 'expr'), ('cases', 'expr_list')], <HighLevelILOperation.HLIL_CASE: 7>: [('values', 'expr_list'), ('body', 'expr')], <HighLevelILOperation.HLIL_BREAK: 8>: [], <HighLevelILOperation.HLIL_CONTINUE: 9>: [], <HighLevelILOperation.HLIL_JUMP: 10>: [('dest', 'expr')], <HighLevelILOperation.HLIL_RET: 11>: [('src', 'expr_list')], <HighLevelILOperation.HLIL_NORET: 12>: [], <HighLevelILOperation.HLIL_GOTO: 13>: [('target', 'label')], <HighLevelILOperation.HLIL_LABEL: 14>: [('target', 'label')], <HighLevelILOperation.HLIL_VAR_DECLARE: 15>: [('var', 'var')], <HighLevelILOperation.HLIL_VAR_INIT: 16>: [('dest', 'var'), ('src', 'expr')], <HighLevelILOperation.HLIL_ASSIGN: 17>: [('dest', 'expr'), ('src', 'expr')], <HighLevelILOperation.HLIL_ASSIGN_UNPACK: 18>: [('dest', 'expr_list'), ('src', 'expr')], <HighLevelILOperation.HLIL_VAR: 19>: [('var', 'var')], <HighLevelILOperation.HLIL_STRUCT_FIELD: 20>: [('src', 'expr'), ('offset', 'int'), ('member_index', 'member_index')], <HighLevelILOperation.HLIL_ARRAY_INDEX: 21>: [('src', 'expr'), ('index', 'expr')], <HighLevelILOperation.HLIL_SPLIT: 22>: [('high', 'expr'), ('low', 'expr')], <HighLevelILOperation.HLIL_DEREF: 23>: [('src', 'expr')], <HighLevelILOperation.HLIL_DEREF_FIELD: 24>: [('src', 'expr'), ('offset', 'int'), ('member_index', 'member_index')], <HighLevelILOperation.HLIL_ADDRESS_OF: 25>: [('src', 'expr')], <HighLevelILOperation.HLIL_CONST: 26>: [('constant', 'int')], <HighLevelILOperation.HLIL_CONST_PTR: 27>: [('constant', 'int')], <HighLevelILOperation.HLIL_EXTERN_PTR: 28>: [('constant', 'int'), ('offset', 'int')], <HighLevelILOperation.HLIL_FLOAT_CONST: 29>: [('constant', 'float')], <HighLevelILOperation.HLIL_IMPORT: 30>: [('constant', 'int')], <HighLevelILOperation.HLIL_ADD: 31>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_ADC: 32>: [('left', 'expr'), ('right', 'expr'), ('carry', 'expr')], <HighLevelILOperation.HLIL_SUB: 33>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_SBB: 34>: [('left', 'expr'), ('right', 'expr'), ('carry', 'expr')], <HighLevelILOperation.HLIL_AND: 35>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_OR: 36>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_XOR: 37>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_LSL: 38>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_LSR: 39>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_ASR: 40>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_ROL: 41>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_RLC: 42>: [('left', 'expr'), ('right', 'expr'), ('carry', 'expr')], <HighLevelILOperation.HLIL_ROR: 43>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_RRC: 44>: [('left', 'expr'), ('right', 'expr'), ('carry', 'expr')], <HighLevelILOperation.HLIL_MUL: 45>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_MULU_DP: 46>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_MULS_DP: 47>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_DIVU: 48>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_DIVU_DP: 49>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_DIVS: 50>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_DIVS_DP: 51>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_MODU: 52>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_MODU_DP: 53>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_MODS: 54>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_MODS_DP: 55>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_NEG: 56>: [('src', 'expr')], <HighLevelILOperation.HLIL_NOT: 57>: [('src', 'expr')], <HighLevelILOperation.HLIL_SX: 58>: [('src', 'expr')], <HighLevelILOperation.HLIL_ZX: 59>: [('src', 'expr')], <HighLevelILOperation.HLIL_LOW_PART: 60>: [('src', 'expr')], <HighLevelILOperation.HLIL_CALL: 61>: [('dest', 'expr'), ('params', 'expr_list')], <HighLevelILOperation.HLIL_CMP_E: 62>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_CMP_NE: 63>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_CMP_SLT: 64>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_CMP_ULT: 65>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_CMP_SLE: 66>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_CMP_ULE: 67>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_CMP_SGE: 68>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_CMP_UGE: 69>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_CMP_SGT: 70>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_CMP_UGT: 71>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_TEST_BIT: 72>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_BOOL_TO_INT: 73>: [('src', 'expr')], <HighLevelILOperation.HLIL_ADD_OVERFLOW: 74>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_SYSCALL: 75>: [('params', 'expr_list')], <HighLevelILOperation.HLIL_TAILCALL: 76>: [('dest', 'expr'), ('params', 'expr_list')], <HighLevelILOperation.HLIL_INTRINSIC: 77>: [('intrinsic', 'intrinsic'), ('params', 'expr_list')], <HighLevelILOperation.HLIL_BP: 78>: [], <HighLevelILOperation.HLIL_TRAP: 79>: [('vector', 'int')], <HighLevelILOperation.HLIL_UNDEF: 80>: [], <HighLevelILOperation.HLIL_UNIMPL: 81>: [], <HighLevelILOperation.HLIL_UNIMPL_MEM: 82>: [('src', 'expr')], <HighLevelILOperation.HLIL_FADD: 83>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_FSUB: 84>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_FMUL: 85>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_FDIV: 86>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_FSQRT: 87>: [('src', 'expr')], <HighLevelILOperation.HLIL_FNEG: 88>: [('src', 'expr')], <HighLevelILOperation.HLIL_FABS: 89>: [('src', 'expr')], <HighLevelILOperation.HLIL_FLOAT_TO_INT: 90>: [('src', 'expr')], <HighLevelILOperation.HLIL_INT_TO_FLOAT: 91>: [('src', 'expr')], <HighLevelILOperation.HLIL_FLOAT_CONV: 92>: [('src', 'expr')], <HighLevelILOperation.HLIL_ROUND_TO_INT: 93>: [('src', 'expr')], <HighLevelILOperation.HLIL_FLOOR: 94>: [('src', 'expr')], <HighLevelILOperation.HLIL_CEIL: 95>: [('src', 'expr')], <HighLevelILOperation.HLIL_FTRUNC: 96>: [('src', 'expr')], <HighLevelILOperation.HLIL_FCMP_E: 97>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_FCMP_NE: 98>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_FCMP_LT: 99>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_FCMP_LE: 100>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_FCMP_GE: 101>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_FCMP_GT: 102>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_FCMP_O: 103>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_FCMP_UO: 104>: [('left', 'expr'), ('right', 'expr')], <HighLevelILOperation.HLIL_WHILE_SSA: 105>: [('condition_phi', 'expr'), ('condition', 'expr'), ('body', 'expr')], <HighLevelILOperation.HLIL_DO_WHILE_SSA: 106>: [('body', 'expr'), ('condition_phi', 'expr'), ('condition', 'expr')], <HighLevelILOperation.HLIL_FOR_SSA: 107>: [('init', 'expr'), ('condition_phi', 'expr'), ('condition', 'expr'), ('update', 'expr'), ('body', 'expr')], <HighLevelILOperation.HLIL_VAR_INIT_SSA: 108>: [('dest', 'var_ssa'), ('src', 'expr')], <HighLevelILOperation.HLIL_ASSIGN_MEM_SSA: 109>: [('dest', 'expr'), ('dest_memory', 'int'), ('src', 'expr'), ('src_memory', 'int')], <HighLevelILOperation.HLIL_ASSIGN_UNPACK_MEM_SSA: 110>: [('dest', 'expr_list'), ('dest_memory', 'int'), ('src', 'expr'), ('src_memory', 'int')], <HighLevelILOperation.HLIL_VAR_SSA: 111>: [('var', 'var_ssa')], <HighLevelILOperation.HLIL_ARRAY_INDEX_SSA: 112>: [('src', 'expr'), ('src_memory', 'int'), ('index', 'expr')], <HighLevelILOperation.HLIL_DEREF_SSA: 113>: [('src', 'expr'), ('src_memory', 'int')], <HighLevelILOperation.HLIL_DEREF_FIELD_SSA: 114>: [('src', 'expr'), ('src_memory', 'int'), ('offset', 'int'), ('member_index', 'member_index')], <HighLevelILOperation.HLIL_CALL_SSA: 115>: [('dest', 'expr'), ('params', 'expr_list'), ('dest_memory', 'int'), ('src_memory', 'int')], <HighLevelILOperation.HLIL_SYSCALL_SSA: 116>: [('params', 'expr_list'), ('dest_memory', 'int'), ('src_memory', 'int')], <HighLevelILOperation.HLIL_INTRINSIC_SSA: 117>: [('intrinsic', 'intrinsic'), ('params', 'expr_list'), ('dest_memory', 'int'), ('src_memory', 'int')], <HighLevelILOperation.HLIL_VAR_PHI: 118>: [('dest', 'var_ssa'), ('src', 'var_ssa_list')], <HighLevelILOperation.HLIL_MEM_PHI: 119>: [('dest', 'int'), ('src', 'int_list')]}
address
ast

This expression with full AST printing (read-only)

expr_index
expr_type

Type of expression

function
il_basic_block

IL basic block object containing this expression (read-only) (only available on finalized functions). Returns None for HLIL_BLOCK expressions as these can contain multiple basic blocks.

instr

The statement that this expression belongs to (read-only)

instr_index

Index of the statement that this expression belongs to (read-only)

lines

HLIL text lines (read-only)

llil

Alias for low_level_il

low_level_il

Low level IL form of this expression

medium_level_il

Medium level IL form of this expression

mlil

Alias for medium_level_il

non_ast

This expression without full AST printing (read-only)

non_ssa_form

Non-SSA form of expression (read-only)

operands
operation
parent
possible_values

Possible values of expression using path-sensitive static data flow analysis (read-only)

postfix_operands

All operands in the expression tree in postfix order

prefix_operands

All operands in the expression tree in prefix order

size
source_operand
ssa_form

SSA form of expression (read-only)

ssa_memory_version

Version of active memory contents in SSA form for this instruction

value

Value of expression if constant or a known value (read-only)

class HighLevelILOperationAndSize(operation, size)[source]

Bases: object

operation
size