summaryrefslogtreecommitdiff
path: root/docs/dev/batch.md
diff options
context:
space:
mode:
authorJordan Wiens <jordan@psifertex.com>2023-09-26 13:19:12 -0400
committerJordan Wiens <jordan@psifertex.com>2023-09-26 13:19:12 -0400
commitddb717455a7543e944ae5eeb6808bc477eb4b689 (patch)
treedcfdc13d9e236e48a6edea9e644a8fc1139effb0 /docs/dev/batch.md
parent1cc203952e335afbe5f92fb26436a476d23a05ce (diff)
add example to batch docs on triggering plugin commands
Diffstat (limited to 'docs/dev/batch.md')
-rw-r--r--docs/dev/batch.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/dev/batch.md b/docs/dev/batch.md
index f6c2879a..3fb4ddfa 100644
--- a/docs/dev/batch.md
+++ b/docs/dev/batch.md
@@ -95,6 +95,18 @@ with load("/bin/ls", options={'analysis.limits.maxFunctionSize': 0}) as bv:
print(f"No MLIL entry function")
```
+### Running Plugins
+
+Want to trigger another plugin via headless? As long as the other plugin is registered via a [PluginCommand](https://api.binary.ninja/binaryninja.plugin-module.html#binaryninja.plugin.PluginCommand), you can use something like:
+
+```py
+import binaryninja
+bv = binaryninja.load("testfile")
+ctx = binaryninja.PluginCommandContext(bv);
+PluginCommand.get_valid_list(ctx)["BinExport"].execute(ctx)
+# Creates a .BinExport file in the same folder as testfile
+```
+
### Logging and Exceptions
By default, logging will follow whatever the setting is for [minimum log level](../guide/settings.md#python.log.minLevel) (`WarningLog` if not changed). However, for batch-process, it's often convenient to use the [`disable_default_log`](https://api.binary.ninja/index.html#binaryninja.disable_default_log) API to shut off logging entirely. Note that you may still need to handle python exceptions with a "try/except" pattern in the event of malformed files that do not process as expected.