From 3452ee25b9aebdddf694f45b4273ab76ca1bc847 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Fri, 25 Oct 2024 12:09:57 -0400 Subject: Retrieve view from analysis context Makes it possible to write module workflows in plugins and scripts --- python/workflow.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'python') diff --git a/python/workflow.py b/python/workflow.py index 98e3118b..7989d6bd 100644 --- a/python/workflow.py +++ b/python/workflow.py @@ -31,6 +31,7 @@ from .log import log_error from . import _binaryninjacore as core from .flowgraph import FlowGraph, CoreFlowGraph +from . import binaryview from . import function as _function from . import lowlevelil from . import mediumlevelil @@ -48,6 +49,16 @@ class AnalysisContext: assert handle is not None self.handle = handle + @property + def view(self) -> 'binaryview.BinaryView': + """ + BinaryView for the current AnalysisContext (writable) + """ + result = core.BNAnalysisContextGetBinaryView(self.handle) + if not result: + return None + return binaryview.BinaryView(handle=result) + @property def function(self) -> '_function.Function': """ -- cgit v1.3.1