diff options
| author | Rusty Wagner <rusty@vector35.com> | 2019-08-03 22:40:57 -0400 |
|---|---|---|
| committer | Rusty Wagner <rusty@vector35.com> | 2020-04-17 14:20:37 -0400 |
| commit | 620dd96217a49803fe04c6bc286291ddd857dcba (patch) | |
| tree | c416e88ecd9ac0d15e1864bbd17a6eb70548965f /python/highlevelil.py | |
| parent | c9845e5a200228f20809336d9e9afee45e776d19 (diff) | |
Expand support for HLIL switch/case and data flow access
Diffstat (limited to 'python/highlevelil.py')
| -rw-r--r-- | python/highlevelil.py | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/python/highlevelil.py b/python/highlevelil.py index a5d0b661..feac146b 100644 --- a/python/highlevelil.py +++ b/python/highlevelil.py @@ -85,7 +85,7 @@ class HighLevelILInstruction(object): HighLevelILOperation.HLIL_DO_WHILE: [("body", "expr"), ("condition", "expr")], HighLevelILOperation.HLIL_FOR: [("init", "expr"), ("condition", "expr"), ("update", "expr"), ("body", "expr")], HighLevelILOperation.HLIL_SWITCH: [("condition", "expr"), ("default", "expr"), ("cases", "expr_list")], - HighLevelILOperation.HLIL_CASE: [("condition", "expr"), ("body", "expr")], + HighLevelILOperation.HLIL_CASE: [("values", "expr_list"), ("body", "expr")], HighLevelILOperation.HLIL_BREAK: [], HighLevelILOperation.HLIL_CONTINUE: [], HighLevelILOperation.HLIL_JUMP: [("dest", "expr")], @@ -448,6 +448,36 @@ class HighLevelILInstruction(object): """IL basic block object containing this expression (read-only) (only available on finalized functions)""" return HighLevelILBasicBlock(self._function.source_function.view, core.BNGetHighLevelILBasicBlockForInstruction(self._function.handle, self._instr_index), self._function) + @property + def value(self): + """Value of expression if constant or a known value (read-only)""" + mlil = self.mlil + if mlil is None: + return function.RegisterValue() + return mlil.value + + @property + def possible_values(self): + """Possible values of expression using path-sensitive static data flow analysis (read-only)""" + mlil = self.mlil + if mlil is None: + return function.PossibleValueSet() + return mlil.possible_values + + @property + def expr_type(self): + """Type of expression""" + mlil = self.mlil + if mlil is None: + return None + return mlil.expr_type + + def get_possible_values(self, options = []): + mlil = self.mlil + if mlil is None: + return function.RegisterValue() + return mlil.get_possible_values(options) + class HighLevelILExpr(object): """ |
