diff options
| author | Jordan Wiens <jordan@psifertex.com> | 2018-12-12 13:26:52 -0500 |
|---|---|---|
| committer | Jordan Wiens <jordan@psifertex.com> | 2018-12-12 13:26:52 -0500 |
| commit | 01a9eb27ea90e62476bb368f1e418745777f24b5 (patch) | |
| tree | 6cfb365b8208f9f39137db77d54473b5599a5310 /python | |
| parent | ce132a1c7937b494711eee2a5596b16ecfa1993d (diff) | |
deprecate current_function.medium_level_il in favor of .mlil and move .instructions to mlil instead of main function -- likewise for llil
Diffstat (limited to 'python')
| -rw-r--r-- | python/binaryview.py | 2 | ||||
| -rw-r--r-- | python/function.py | 32 | ||||
| -rw-r--r-- | python/lowlevelil.py | 7 | ||||
| -rw-r--r-- | python/mediumlevelil.py | 7 | ||||
| -rw-r--r-- | python/scriptingprovider.py | 4 |
5 files changed, 36 insertions, 16 deletions
diff --git a/python/binaryview.py b/python/binaryview.py index fd15de76..6ecca2dc 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -874,7 +874,7 @@ class BinaryView(object): def mlil_basic_blocks(self): """A generator of all MediumLevelILBasicBlock objects in the BinaryView""" for func in self: - for il_block in func.medium_level_il.basic_blocks: + for il_block in func.mlil.basic_blocks: yield il_block @property diff --git a/python/function.py b/python/function.py index dce57975..bda06091 100644 --- a/python/function.py +++ b/python/function.py @@ -503,6 +503,11 @@ class Function(object): @property def low_level_il(self): + """Deprecated property provided for compatibility. Use llil instead.""" + return binaryninja.lowlevelil.LowLevelILFunction(self.arch, core.BNGetFunctionLowLevelIL(self.handle), self) + + @property + def llil(self): """returns LowLevelILFunction used to represent Function low level IL (read-only)""" return binaryninja.lowlevelil.LowLevelILFunction(self.arch, core.BNGetFunctionLowLevelIL(self.handle), self) @@ -513,6 +518,11 @@ class Function(object): @property def medium_level_il(self): + """Deprecated property provided for compatibility. Use mlil instead.""" + return binaryninja.mediumlevelil.MediumLevelILFunction(self.arch, core.BNGetFunctionMediumLevelIL(self.handle), self) + + @property + def mlil(self): """Function medium level IL (read-only)""" return binaryninja.mediumlevelil.MediumLevelILFunction(self.arch, core.BNGetFunctionMediumLevelIL(self.handle), self) @@ -786,13 +796,13 @@ class Function(object): @property def llil_basic_blocks(self): """A generator of all LowLevelILBasicBlock objects in the current function""" - for block in self.low_level_il: + for block in self.llil: yield block @property def mlil_basic_blocks(self): """A generator of all MediumLevelILBasicBlock objects in the current function""" - for block in self.medium_level_il: + for block in self.mlil: yield block @property @@ -806,17 +816,13 @@ class Function(object): @property def llil_instructions(self): - """A generator of llil instructions of the current function""" - for block in self.llil_basic_blocks: - for i in block: - yield i + """Deprecated method provided for compatibility. Use llil.instructions instead. Was: A generator of llil instructions of the current function""" + return self.llil.instructions @property def mlil_instructions(self): - """A generator of mlil instructions of the current function""" - for block in self.mlil_basic_blocks: - for i in block: - yield i + """Deprecated method provided for compatibility. Use mlil.instructions instead. Was: A generator of mlil instructions of the current function""" + return self.mlil.instructions @property def too_large(self): @@ -886,7 +892,7 @@ class Function(object): return core.BNGetCommentForAddress(self.handle, addr) def set_comment(self, addr, comment): - """Deprecated use set_comment_at instead""" + """Deprecated method provided for compatibility. Use set_comment_at instead.""" core.BNSetCommentForAddress(self.handle, addr, comment) def set_comment_at(self, addr, comment): @@ -921,10 +927,10 @@ class Function(object): idx = core.BNGetLowLevelILForInstruction(self.handle, arch.handle, addr) - if idx == len(self.low_level_il): + if idx == len(self.llil): return None - return self.low_level_il[idx] + return self.llil[idx] def get_low_level_il_exits_at(self, addr, arch=None): if arch is None: diff --git a/python/lowlevelil.py b/python/lowlevelil.py index c8db74b6..a98de6d3 100644 --- a/python/lowlevelil.py +++ b/python/lowlevelil.py @@ -792,6 +792,13 @@ class LowLevelILFunction(object): return result @property + def instructions(self): + """A generator of llil instructions of the current llil function""" + for block in self.basic_blocks: + for i in block: + yield i + + @property def ssa_form(self): """Low level IL in SSA form (read-only)""" result = core.BNGetLowLevelILSSAForm(self.handle) diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py index e7059918..c88ab6b8 100644 --- a/python/mediumlevelil.py +++ b/python/mediumlevelil.py @@ -673,6 +673,13 @@ class MediumLevelILFunction(object): return result @property + def instructions(self): + """A generator of mlil instructions of the current function""" + for block in self.basic_blocks: + for i in block: + yield i + + @property def ssa_form(self): """Medium level IL in SSA form (read-only)""" result = core.BNGetMediumLevelILSSAForm(self.handle) diff --git a/python/scriptingprovider.py b/python/scriptingprovider.py index 52584ec7..4183f136 100644 --- a/python/scriptingprovider.py +++ b/python/scriptingprovider.py @@ -551,8 +551,8 @@ class PythonScriptingInstance(ScriptingInstance): self.locals["current_llil"] = None self.locals["current_mlil"] = None else: - self.locals["current_llil"] = self.active_func.low_level_il - self.locals["current_mlil"] = self.active_func.medium_level_il + self.locals["current_llil"] = self.active_func.llil + self.locals["current_mlil"] = self.active_func.mlil for line in code.split(b'\n'): self.interpreter.push(line.decode('charmap')) |
