summaryrefslogtreecommitdiff
path: root/docs/dev/cookbook.md
diff options
context:
space:
mode:
authorJackson <jrmoffet@gmail.com>2024-03-09 19:26:36 -0500
committerJordan <github@psifertex.com>2024-03-25 21:33:54 -0400
commitcc22a52907a052f37dad319f843f218fe69e1b9a (patch)
treeeb249a4463846b1f1c579b0b5aed44264598f561 /docs/dev/cookbook.md
parentb1d4d336ad66273982ddd2fd8e9e1e950dd4c89a (diff)
Update cookbook.md
Document how to call plugins headless
Diffstat (limited to 'docs/dev/cookbook.md')
-rw-r--r--docs/dev/cookbook.md15
1 files changed, 15 insertions, 0 deletions
diff --git a/docs/dev/cookbook.md b/docs/dev/cookbook.md
index 9f5164e9..4d9f0d77 100644
--- a/docs/dev/cookbook.md
+++ b/docs/dev/cookbook.md
@@ -272,3 +272,18 @@ UIActionHandler.globalActions().bindAction("Trigger Range", UIAction(new_range_a
Menu.mainMenu("Plugins").addAction("Trigger Range", "Plugins")
```
+### Invoke plugin from the API
+```python
+from binaryninja import BinaryView, PluginCommand, PluginCommandContext
+
+
+def invoke_plugin(name: str, bv: BinaryView, address=0, length = 0,function=None, instruction=None):
+ ctx = PluginCommandContext(bv)
+ ctx.address = address
+ ctx.length = length
+ ctx.function = function
+ ctx.instruction = instruction
+
+ cmds = PluginCommand.get_valid_list(ctx)
+ cmds[name].execute(ctx)
+```