From 3ee274ac9111829d2abe2c051c694466a7d0d477 Mon Sep 17 00:00:00 2001 From: Jordan Wiens Date: Tue, 14 Jan 2025 09:28:37 -0500 Subject: add example to plugincommandcontext --- python/plugin.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'python/plugin.py') diff --git a/python/plugin.py b/python/plugin.py index 1536b3bc..0250007e 100644 --- a/python/plugin.py +++ b/python/plugin.py @@ -37,7 +37,17 @@ from . import mediumlevelil from . import highlevelil -class PluginCommandContext: +class PluginCommandContext: """ + The ``class PluginCommandContext`` is used to access loaded plugins and their exposed methods with the context of a specific Binary VIew. + + :Example: + # To trigger a registered plugin with a BinaryView, for example: + >>> bv = load("/tmp/file1") + >>> ctx = PluginCommandContext(bv); + >>> binexport = PluginCommand.get_valid_list(ctx)["BinExport"] + >>> binexport.execute(ctx) + """ + def __init__(self, view): self._view = view self._address = 0 @@ -834,7 +844,7 @@ class PluginCommand(metaclass=_PluginCommandMetaClass): def execute(self, context): r""" - ``execute`` Execute a Plugin + ``execute`` Execute a plugin. See the example in :class:`~PluginCommandContext` :param str context: PluginCommandContext to pass the PluginCommand :rtype: None -- cgit v1.3.1