summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Wiens <github@psifertex.com>2019-07-29 13:44:34 -0400
committerJordan Wiens <github@psifertex.com>2019-07-29 13:44:34 -0400
commit4280e92fc4bf8040ed927ce5aadfc33ae5c43d14 (patch)
treeed5a5ddeb32399fc80fb288ae3002ffcf1081505
parentede41e0ceb67494371030fbd5041852bf1900fdf (diff)
can now disable user plugins from headless via BN_DISABLE_USER_PLUGINS env var
-rw-r--r--docs/guide/plugins.md2
-rw-r--r--python/__init__.py7
2 files changed, 4 insertions, 5 deletions
diff --git a/docs/guide/plugins.md b/docs/guide/plugins.md
index eb1a4347..59b062af 100644
--- a/docs/guide/plugins.md
+++ b/docs/guide/plugins.md
@@ -69,6 +69,8 @@ Troubleshooting many Binary Ninja problems is helped by enabling debug logs and
And check `/tmp/bnlog.txt` when you're done.
+Additionally, running a python plugin with an environment variable of `BN_DISABLE_USER_PLUGINS` will prevent the API from initializing user-plugins which is helpful for root cause analysis.
+
## Writing Plugins
First, take a look at some of the [example] plugins, or some of the [community] plugins to get a feel for different APIs you might be interested in. Of course, the full [API] docs are online and available offline via the `Help`/`Open API Reference...`.
diff --git a/python/__init__.py b/python/__init__.py
index 25543dc9..1ae4d5d9 100644
--- a/python/__init__.py
+++ b/python/__init__.py
@@ -163,7 +163,8 @@ def _init_plugins():
global _plugin_init
if not _plugin_init:
core.BNInitCorePlugins()
- core.BNInitUserPlugins()
+ if not os.environ.get('BN_DISABLE_USER_PLUGINS'):
+ core.BNInitUserPlugins()
core.BNInitRepoPlugins()
if core.BNIsLicenseValidated():
_plugin_init = True
@@ -252,7 +253,3 @@ def get_memory_usage_info():
result[info[i].name] = info[i].value
core.BNFreeMemoryUsageInfo(info, count.value)
return result
-
-#if not valid_import("binaryninjaui") and not core_ui_enabled():
-# #Use print because we're headless and log_functions won't work yet
-# print("BINARYNINJAUI module not available.\nPlease re-run the install_api.py python script (with the appropriate version of python you plan to use) to properly set up your Binary Ninja python paths.") \ No newline at end of file