diff options
| author | Glenn Smith <glenn@vector35.com> | 2024-06-12 21:59:50 -0400 |
|---|---|---|
| committer | Alexander Taylor <alex@vector35.com> | 2024-06-26 09:47:42 -0400 |
| commit | 015bb4fa79d01a1e2d4887cba96d150c7e1dd3bb (patch) | |
| tree | 8333733fca03ec373b63d7390096db986e0b8a3f /python/__init__.py | |
| parent | 17435e0df2dccb8f09ec26e54de017ee05ade8ee (diff) | |
[Enterprise] Clean up initialization flow
Diffstat (limited to 'python/__init__.py')
| -rw-r--r-- | python/__init__.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/python/__init__.py b/python/__init__.py index 3c440c8b..ec218d38 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -216,24 +216,18 @@ class _DestructionCallbackHandler: _enable_default_log = True _plugin_init = False +_enterprise_license_checkout = None def _init_plugins(): global _enable_default_log global _plugin_init + global _enterprise_license_checkout 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 enterprise.is_license_still_activated(): - try: - enterprise.authenticate_with_method("Keychain") - except RuntimeError: - pass - if 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." - ) + _enterprise_license_checkout = enterprise.LicenseCheckout() + _enterprise_license_checkout.acquire() if not _plugin_init: # The first call to BNInitCorePlugins returns True for successful initialization and True in this context indicates headless operation. |
