binaryninja.lowlevelil.LowLevelILFunction¶
-
class
binaryninja.lowlevelil.LowLevelILFunction(arch, handle=None, source_func=None)[source]¶ class LowLevelILFunctioncontains the list of LowLevelILExpr objects that make up a binaryninja.function. LowLevelILExpr objects can be added to the LowLevelILFunction by callingappendand passing the result of the various class methods which return LowLevelILExpr objects.LowLevelILFlagCondition values used as parameters in the
flag_conditionmethod.LowLevelILFlagCondition Operator Description LLFC_E == Equal LLFC_NE != Not equal LLFC_SLT s< Signed less than LLFC_ULT u< Unsigned less than LLFC_SLE s<= Signed less than or equal LLFC_ULE u<= Unsigned less than or equal LLFC_SGE s>= Signed greater than or equal LLFC_UGE u>= Unsigned greater than or equal LLFC_SGT s> Signed greather than LLFC_UGT u> Unsigned greater than LLFC_NEG Negative LLFC_POS Positive LLFC_O overflow Overflow LLFC_NO !overflow No overflow Methods
__init__(arch[, handle, source_func])add(size, a, b[, flags])addadds expressionato expressionbpotentially setting flagsflagsand returningadd_carry(size, a, b, carry[, flags])add_carryadds with carry expressionato expressionbpotentially setting flagsflagsandadd_label_for_address(arch, addr)add_label_for_addressadds a low-level IL label for the given architecturearchat the given virtualadd_label_list(labels)add_label_listreturns a label list expression for the given list of LowLevelILLabel objects.add_operand_list(operands)add_operand_listreturns an operand list expression for the given list of integer operands.and_expr(size, a, b[, flags])and_exprbitwise and’s expressionaand expressionbpotentially setting flagsflagsappend(expr)appendadds the LowLevelILExprexprto the current LowLevelILFunction.arith_shift_right(size, a, b[, flags])arith_shift_rightshifts arithmatic right expressionaby expressionbpotentially setting flagsbreakpoint()breakpointreturns a processor breakpoint expression.call(dest)callreturns an expression which first pushes the address of the next instruction onto the stack then jumpscall_stack_adjust(dest, stack_adjust)call_stack_adjustreturns an expression which first pushes the address of the next instruction onto the stackceil(size, value[, flags])ceilrounds a floating point value to an integer towards positive infinityclear_indirect_branches()compare_equal(size, a, b)compare_equalreturns comparison expression of sizesizechecking if expressionais equal tocompare_not_equal(size, a, b)compare_not_equalreturns comparison expression of sizesizechecking if expressionais not equal tocompare_signed_greater_equal(size, a, b)compare_signed_greater_equalreturns comparison expression of sizesizechecking if expressionaiscompare_signed_greater_than(size, a, b)compare_signed_greater_thanreturns comparison expression of sizesizechecking if expressionaiscompare_signed_less_equal(size, a, b)compare_signed_less_equalreturns comparison expression of sizesizechecking if expressionaiscompare_signed_less_than(size, a, b)compare_signed_less_thanreturns comparison expression of sizesizechecking if expressionaiscompare_unsigned_greater_equal(size, a, b)compare_unsigned_greater_equalreturns comparison expression of sizesizechecking if expressionacompare_unsigned_greater_than(size, a, b)compare_unsigned_greater_thanreturns comparison expression of sizesizechecking if expressionaiscompare_unsigned_less_equal(size, a, b)compare_unsigned_less_equalreturns comparison expression of sizesizechecking if expressionaiscompare_unsigned_less_than(size, a, b)compare_unsigned_less_thanreturns comparison expression of sizesizechecking if expressionaisconst(size, value)constreturns an expression for the constant integervaluewith sizesizeconst_pointer(size, value)const_pointerreturns an expression for the constant pointervaluewith sizesizediv_double_prec_signed(size, a, b[, flags])div_double_prec_signedsigned double precision divide using expressionaas adiv_double_prec_unsigned(size, a, b[, flags])div_double_prec_unsignedunsigned double precision divide using expressionaasdiv_signed(size, a, b[, flags])div_signedsigned divide expressionaby expressionbpotentially setting flagsflagsdiv_unsigned(size, a, b[, flags])div_unsignedunsigned divide expressionaby expressionbpotentially setting flagsflagsexpr(operation[, a, b, c, d, size, flags])finalize()finalizeends the function and computes the list of basic blocks.flag(reg)flagreturns a flag expression for the given flag name.flag_bit(size, reg, bit)flag_bitsets the flag namedregand sizesizeto the constant integer valuebitflag_condition(cond[, sem_class])flag_conditionreturns a flag_condition expression for the given LowLevelILFlagConditionflag_group(sem_group)flag_groupreturns a flag_group expression for the given semantic flag groupfloat_abs(size, value[, flags])float_absreturns absolute value of floating point expressionvalueof sizesizepotentially setting flagsfloat_add(size, a, b[, flags])float_addadds floating point expressionato expressionbpotentially setting flagsflagsfloat_compare_equal(size, a, b)float_compare_equalreturns floating point comparison expression of sizesizechecking iffloat_compare_greater_equal(size, a, b)float_compare_greater_equalreturns floating point comparison expression of sizesizechecking iffloat_compare_greater_than(size, a, b)float_compare_greater_thanreturns floating point comparison expression of sizesizechecking iffloat_compare_less_equal(size, a, b)float_compare_less_equalreturns floating point comparison expression of sizesizechecking iffloat_compare_less_than(size, a, b)float_compare_less_thanreturns floating point comparison expression of sizesizechecking iffloat_compare_not_equal(size, a, b)float_compare_not_equalreturns floating point comparison expression of sizesizechecking iffloat_compare_unordered(size, a, b)float_compare_unorderedreturns floating point comparison expression of sizesizechecking iffloat_const_double(value)float_const_doublereturns an expression for the double precision floating point valuevaluefloat_const_raw(size, value)float_const_rawreturns an expression for the constant raw binary floating pointfloat_const_single(value)float_const_singlereturns an expression for the single precision floating point valuevaluefloat_convert(size, value[, flags])int_to_floatconverts floating point value of expressionvalueto sizesizepotentially setting flagsfloat_div(size, a, b[, flags])float_divdivides floating point expressionaby expressionbpotentially setting flagsflagsfloat_mult(size, a, b[, flags])float_multmultiplies floating point expressionaby expressionbpotentially setting flagsflagsfloat_neg(size, value[, flags])float_negreturns sign negation of floating point expressionvalueof sizesizepotentially setting flagsfloat_sqrt(size, value[, flags])float_sqrtreturns square root of floating point expressionvalueof sizesizepotentially setting flagsfloat_sub(size, a, b[, flags])float_subsubtracts floating point expressionbfrom expressionapotentially setting flagsflagsfloat_to_int(size, value[, flags])float_to_intreturns integer value of floating point expressionvalueof sizesizepotentially setting flagsfloat_trunc(size, value[, flags])float_truncrounds a floating point value to an integer towards zerofloor(size, value[, flags])floorrounds a floating point value to an integer towards negative infinityget_instruction_start(addr[, arch])get_label_for_address(arch, addr)get_label_for_addressreturns the LowLevelILLabel for the given Architecturearchand IL addressaddr.get_mapped_medium_level_il_expr_index(expr)get_mapped_medium_level_il_instruction_index(instr)get_medium_level_il_expr_index(expr)get_medium_level_il_instruction_index(instr)get_non_ssa_instruction_index(instr)get_ssa_flag_definition(flag_ssa)get_ssa_flag_uses(flag_ssa)get_ssa_flag_value(flag_ssa)get_ssa_instruction_index(instr)get_ssa_memory_definition(index)get_ssa_memory_uses(index)get_ssa_reg_definition(reg_ssa)get_ssa_reg_uses(reg_ssa)get_ssa_reg_value(reg_ssa)goto(label)gotoreturns a goto expression which jumps to the provided LowLevelILLabel.if_expr(operand, t, f)if_exprreturns theifexpression which depending on conditionoperandjumps to the LowLevelILLabelint_to_float(size, value[, flags])int_to_floatreturns floating point value of integer expressionvalueof sizesizepotentially setting flagsintrinsic(outputs, intrinsic, params[, flags])intrinsicreturn an intrinsic expression.jump(dest)jumpreturns an expression which jumps (branches) to the expressiondestload(size, addr)loadReadssizebytes from the expressionaddrlogical_shift_right(size, a, b[, flags])logical_shift_rightshifts logically right expressionaby expressionbpotentially setting flagslow_part(size, value[, flags])low_parttruncatesvaluetosizebytesmark_label(label)mark_labelassigns a LowLevelILLabel to the current IL address.mod_double_prec_signed(size, a, b[, flags])mod_double_prec_signedsigned double precision modulus using expressionaas a singlemod_double_prec_unsigned(size, a, b[, flags])mod_double_prec_unsignedunsigned double precision modulus using expressionaasmod_signed(size, a, b[, flags])mod_signedsigned modulus expressionaby expressionbpotentially setting flagsflagsmod_unsigned(size, a, b[, flags])mod_unsignedunsigned modulus expressionaby expressionbpotentially setting flagsflagsmult(size, a, b[, flags])multmultiplies expressionaby expressionbpotentially setting flagsflagsand returning anmult_double_prec_signed(size, a, b[, flags])mult_double_prec_signedmultiplies signed with double precision expressionaby expressionbmult_double_prec_unsigned(size, a, b[, flags])mult_double_prec_unsignedmultiplies unsigned with double precision expressionaby expressionbneg_expr(size, value[, flags])neg_exprtwo’s complement sign negation of expressionvalueof sizesizepotentially setting flagsno_ret()no_retreturns an expression halts disassemblynop()nopno operation, this instruction does nothingnot_expr(size, value[, flags])not_exprbitwise inverse of expressionvalueof sizesizepotentially setting flagsoperand(n, expr)operandsets the operand number of the expressionexprand passes backexprwithout modification.or_expr(size, a, b[, flags])or_exprbitwise or’s expressionaand expressionbpotentially setting flagsflagspop(size)popreadssizebytes from the stack, adjusting the stack bysize.push(size, value)pushwritessizebytes from expressionvalueto the stack, adjusting the stack bysize.reg(size, reg)regreturns a register of sizesizewith nameregreg_split(size, hi, lo)reg_splitcombines registers of sizesizewith nameshiandloreg_stack_pop(size, reg_stack)reg_stack_popreturns the top entry of sizesizein register stack with namereg_stack, andreg_stack_push(size, reg_stack, value[, flags])reg_stack_pushpushes the expressionvalueof sizesizeonto the top of the registerreg_stack_top_relative(size, reg_stack, entry)reg_stack_top_relativereturns a register stack entry of sizesizeat top-relativeret(dest)retreturns an expression which jumps (branches) to the expressiondest.retis a special alias forrotate_left(size, a, b[, flags])rotate_leftbitwise rotates left expressionaby expressionbpotentially setting flagsflagsrotate_left_carry(size, a, b, carry[, flags])rotate_left_carrybitwise rotates left with carry expressionaby expressionbpotentially settingrotate_right(size, a, b[, flags])rotate_rightbitwise rotates right expressionaby expressionbpotentially setting flagsflagsrotate_right_carry(size, a, b, carry[, flags])rotate_right_carrybitwise rotates right with carry expressionaby expressionbpotentially settinground_to_int(size, value[, flags])round_to_introunds a floating point value to the nearest integerset_current_address(value[, arch])set_flag(flag, value)set_flagsets the flagflagto the LowLevelILExprvalueset_indirect_branches(branches)set_reg(size, reg, value[, flags])set_regsets the registerregof sizesizeto the expressionvalueset_reg_split(size, hi, lo, value[, flags])set_reg_splituseshiandloas a single extended register settinghi:loto the expressionset_reg_stack_top_relative(size, reg_stack, ...)set_reg_stack_top_relativesets the top-relative entryentryof sizesizein registershift_left(size, a, b[, flags])shift_leftsubtracts with borrow expressionbfrom expressionapotentially setting flagsflagssign_extend(size, value[, flags])sign_extendtwo’s complement sign-extends the expression invaluetosizebytesstore(size, addr, value[, flags])storeWritessizebytes to expressionaddrread from expressionvaluesub(size, a, b[, flags])subsubtracts expressionbfrom expressionapotentially setting flagsflagsand returningsub_borrow(size, a, b, carry[, flags])sub_borrowsubtracts with borrow expressionbfrom expressionapotentially setting flagsflagssystem_call()system_callreturn a system call expression.tailcall(dest)tailcallreturns an expression which jumps (branches) to the expressiondesttest_bit(size, a, b)trap(value)trapreturns a processor trap (interrupt) expression of the given integervalue.undefined()undefinedreturns the undefined expression. This should be used for instructions which perform functions butunimplemented()unimplementedreturns the unimplemented expression. This should be used for all instructions which aren’tunimplemented_memory_ref(size, addr)unimplemented_memory_refa memory reference to expressionaddrof sizesizewith unimplemented operation.xor_expr(size, a, b[, flags])xor_exprxor’s expressionawith expressionbpotentially setting flagsflagszero_extend(size, value[, flags])zero_extendzero-extends the expression invaluetosizebytesAttributes
basic_blockslist of LowLevelILBasicBlock objects (read-only) current_addressCurrent IL Address (read/write) mapped_medium_level_ilMedium level IL with mappings between low level IL and medium level IL. medium_level_ilMedium level IL for this low level IL. non_ssa_formLow level IL in non-SSA (default) form (read-only) ssa_formLow level IL in SSA form (read-only) temp_flag_countNumber of temporary flags (read-only) temp_reg_countNumber of temporary registers (read-only)