diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/function.py | 30 | ||||
| -rw-r--r-- | python/highlevelil.py | 7 | ||||
| -rw-r--r-- | python/lowlevelil.py | 7 | ||||
| -rw-r--r-- | python/mediumlevelil.py | 7 |
4 files changed, 51 insertions, 0 deletions
diff --git a/python/function.py b/python/function.py index d571bc55..cf8bafdd 100644 --- a/python/function.py +++ b/python/function.py @@ -2213,6 +2213,16 @@ class Function: self, graph_type: FunctionViewTypeOrName = FunctionGraphType.NormalFunctionGraph, settings: Optional['DisassemblySettings'] = None ) -> flowgraph.CoreFlowGraph: + """ + Create a flow graph with the disassembly of this function. + + .. note:: This graph waits for function analysis, so Workflow Activities should instead use + :py:func:`create_graph_immediate` to create graphs with the function contents as-is. + + :param graph_type: IL form of the disassembly in the graph + :param settings: Optional settings for the disassembly text renderer + :return: Flow graph object + """ if settings is not None: settings_obj = settings.handle else: @@ -2220,6 +2230,26 @@ class Function: graph_type = FunctionViewType(graph_type)._to_core_struct() return flowgraph.CoreFlowGraph(core.BNCreateFunctionGraph(self.handle, graph_type, settings_obj)) + def create_graph_immediate( + self, graph_type: FunctionViewTypeOrName = FunctionGraphType.NormalFunctionGraph, + settings: Optional['DisassemblySettings'] = None + ) -> flowgraph.CoreFlowGraph: + """ + Create a flow graph with the disassembly of this function, specifically using the + instructions as they are in the function when this is called. You probably want to use + this if you are creating a Debug Report in a Workflow Activity. + + :param graph_type: IL form of the disassembly in the graph + :param settings: Optional settings for the disassembly text renderer + :return: Flow graph object + """ + if settings is not None: + settings_obj = settings.handle + else: + settings_obj = None + graph_type = FunctionViewType(graph_type)._to_core_struct() + return flowgraph.CoreFlowGraph(core.BNCreateImmediateFunctionGraph(self.handle, graph_type, settings_obj)) + def apply_imported_types(self, sym: 'types.CoreSymbol', type: Optional[StringOrType] = None) -> None: if isinstance(type, str): (type, _) = self.view.parse_type_string(type) diff --git a/python/highlevelil.py b/python/highlevelil.py index 101b2e9f..1ac81617 100644 --- a/python/highlevelil.py +++ b/python/highlevelil.py @@ -4608,6 +4608,13 @@ class HighLevelILFunction: settings_obj = None return flowgraph.CoreFlowGraph(core.BNCreateHighLevelILFunctionGraph(self.handle, settings_obj)) + def create_graph_immediate(self, settings: Optional['function.DisassemblySettings'] = None) -> 'flowgraph.CoreFlowGraph': + if settings is not None: + settings_obj = settings.handle + else: + settings_obj = None + return flowgraph.CoreFlowGraph(core.BNCreateHighLevelILImmediateFunctionGraph(self.handle, settings_obj)) + @property def il_form(self) -> FunctionGraphType: if len(list(self.basic_blocks)) < 1: diff --git a/python/lowlevelil.py b/python/lowlevelil.py index 09786cd9..6cd87227 100644 --- a/python/lowlevelil.py +++ b/python/lowlevelil.py @@ -6128,6 +6128,13 @@ class LowLevelILFunction: settings_obj = None return flowgraph.CoreFlowGraph(core.BNCreateLowLevelILFunctionGraph(self.handle, settings_obj)) + def create_graph_immediate(self, settings: Optional['function.DisassemblySettings'] = None) -> flowgraph.CoreFlowGraph: + if settings is not None: + settings_obj = settings.handle + else: + settings_obj = None + return flowgraph.CoreFlowGraph(core.BNCreateLowLevelILImmediateFunctionGraph(self.handle, settings_obj)) + class LowLevelILBasicBlock(basicblock.BasicBlock): """ diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py index 7d60abd1..1026df7d 100644 --- a/python/mediumlevelil.py +++ b/python/mediumlevelil.py @@ -5518,6 +5518,13 @@ class MediumLevelILFunction: settings_obj = None return flowgraph.CoreFlowGraph(core.BNCreateMediumLevelILFunctionGraph(self.handle, settings_obj)) + def create_graph_immediate(self, settings: Optional['function.DisassemblySettings'] = None) -> flowgraph.CoreFlowGraph: + if settings is not None: + settings_obj = settings.handle + else: + settings_obj = None + return flowgraph.CoreFlowGraph(core.BNCreateMediumLevelILImmediateFunctionGraph(self.handle, settings_obj)) + @property def arch(self) -> 'architecture.Architecture': return self._arch |
