summaryrefslogtreecommitdiff
path: root/python/__init__.py
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2021-08-23 19:05:09 -0400
committerGlenn Smith <glenn@vector35.com>2021-11-18 21:37:52 -0500
commit994a42659dc500f602e83f91501ec4a959481fa5 (patch)
treeca783900c9a6d41dbdd98a1cd66a083d3e886578 /python/__init__.py
parent60f2ecd9d1961f7cd700e01f802bcf640c9d50e0 (diff)
Enterprise apis and support
Also secrets provider + openUrl
Diffstat (limited to 'python/__init__.py')
-rw-r--r--python/__init__.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/python/__init__.py b/python/__init__.py
index 711ed550..1cf00773 100644
--- a/python/__init__.py
+++ b/python/__init__.py
@@ -72,6 +72,9 @@ from .log import (redirect_output_to_log, is_output_redirected_to_log,
log_debug, log_info, log_warn, log_error, log_alert,
log_to_stdout, log_to_stderr, log_to_file, close_logs)
from .log import log as log_at_level
+# Only load Enterprise Client support on Enterprise builds
+if core.BNGetProduct() == "Binary Ninja Enterprise Client":
+ from .enterprise import *
def shutdown():
@@ -123,6 +126,14 @@ _plugin_init = False
def _init_plugins():
global _enable_default_log
global _plugin_init
+
+ if not core_ui_enabled() and core.BNGetProduct() == "Binary Ninja Enterprise Client":
+ # Enterprise client needs to checkout a license reservation or else BNInitPlugins will fail
+ if not core.BNAuthenticateEnterpriseServerWithMethod("Keychain") and (not core.BNIsLicenseValidated() or not enterprise.is_license_still_activated()):
+ raise RuntimeError(
+ "To use Binary Ninja Enterprise from a headless python script, you must check out a license first.\n"
+ "You can either check out a license for an extended time with the UI, or use the binaryninja.enterprise module.")
+
if not _plugin_init:
# The first call to BNInitCorePlugins returns True for successful initialization and True in this context indicates headless operation.
# The result is pulled from BNInitPlugins as that now wraps BNInitCorePlugins.