()
| 232 | |
| 233 | |
| 234 | def _init_plugins(): |
| 235 | global _enable_default_log |
| 236 | global _plugin_init |
| 237 | global _enterprise_license_checkout |
| 238 | |
| 239 | if not _plugin_init: |
| 240 | if not core_ui_enabled() and (core.BNGetProduct() == "Binary Ninja Enterprise Client" or core.BNGetProduct() == "Binary Ninja Ultimate"): |
| 241 | # Enterprise client needs to reserve a license or else BNInitPlugins will fail |
| 242 | _enterprise_license_checkout = enterprise.LicenseCheckout() |
| 243 | _enterprise_license_checkout.acquire() |
| 244 | |
| 245 | # The first call to BNInitCorePlugins returns True for successful initialization and True in this context indicates headless operation. |
| 246 | # The result is pulled from BNInitPlugins as that now wraps BNInitCorePlugins. |
| 247 | is_headless_init_once = core.BNInitPlugins(not os.environ.get('BN_DISABLE_USER_PLUGINS')) |
| 248 | min_level = Settings().get_string("python.log.minLevel") |
| 249 | if _enable_default_log and is_headless_init_once and min_level in LogLevel.__members__ and not core_ui_enabled( |
| 250 | ) and sys.stderr.isatty(): |
| 251 | log_to_stderr(LogLevel[min_level]) |
| 252 | core.BNInitRepoPlugins() |
| 253 | if core.BNIsLicenseValidated(): |
| 254 | _plugin_init = True |
| 255 | else: |
| 256 | raise RuntimeError("License is not valid. Please supply a valid license.") |
| 257 | |
| 258 | |
| 259 | _destruct_callbacks = _DestructionCallbackHandler() |
nothing calls this directly
no test coverage detected