diff options
Diffstat (limited to 'python/highlevelil.py')
| -rw-r--r-- | python/highlevelil.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/python/highlevelil.py b/python/highlevelil.py index ce264e19..ef1b3de2 100644 --- a/python/highlevelil.py +++ b/python/highlevelil.py @@ -41,6 +41,7 @@ from . import highlight from . import flowgraph from . import variable from . import databuffer +from . import stringrecognizer from . import types as _types from .interaction import show_graph_report from .commonil import ( @@ -973,6 +974,13 @@ class HighLevelILInstruction(BaseILInstruction): hash ^= rotl(discriminator, 47) return hash + @property + def derived_string_reference(self) -> Optional['binaryview.DerivedString']: + str = core.BNDerivedString() + if not core.BNGetHighLevelILDerivedStringReferenceForExpr(self.function.handle, self.expr_index, str): + return None + return binaryview.DerivedString._from_core_struct(str, True) + @dataclass(frozen=True, repr=False, eq=False) class HighLevelILUnaryBase(HighLevelILInstruction, UnaryOperation): @@ -3003,6 +3011,22 @@ class HighLevelILFunction: result |= flag.value core.BNSetHighLevelILExprAttributes(self.handle, expr, result) + def set_derived_string_reference_for_expr(self, expr: InstructionOrExpression, str: 'binaryview.DerivedString'): + if isinstance(expr, HighLevelILInstruction): + expr = expr.expr_index + elif isinstance(expr, int): + expr = ExpressionIndex(expr) + + str_obj = str._to_core_struct(False) + core.BNSetHighLevelILDerivedStringReferenceForExpr(self.handle, expr, str_obj) + + def remove_derived_string_reference_for_expr(self, expr: InstructionOrExpression): + if isinstance(expr, HighLevelILInstruction): + expr = expr.expr_index + elif isinstance(expr, int): + expr = ExpressionIndex(expr) + core.BNRemoveHighLevelILDerivedStringReferenceForExpr(self.handle, expr) + def nop(self, loc: Optional['ILSourceLocation'] = None) -> ExpressionIndex: """ ``nop`` no operation, this instruction does nothing |
