summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2019-04-22 20:27:18 -0400
committerPeter LaFosse <peter@vector35.com>2019-04-25 20:38:18 -0400
commit893e730742452a041f26501b30e95e46d4363ec1 (patch)
treea59a2651c4a7ae0f53cb340505f053819126c9ad
parent89f9cb476aa02276a196e9a79ac675f7d15f9d3d (diff)
Add SetLicense API
-rw-r--r--binaryninjacore.h1
-rw-r--r--python/__init__.py10
2 files changed, 9 insertions, 2 deletions
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 1a60badc..8e355ab1 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -2002,6 +2002,7 @@ extern "C"
BINARYNINJACOREAPI char* BNGetProductType(void);
BINARYNINJACOREAPI int BNGetLicenseCount(void);
BINARYNINJACOREAPI bool BNIsUIEnabled(void);
+ BINARYNINJACOREAPI void BNSetLicense(const char* licenseData);
BINARYNINJACOREAPI void BNRegisterObjectDestructionCallbacks(BNObjectDestructionCallbacks* callbacks);
BINARYNINJACOREAPI void BNUnregisterObjectDestructionCallbacks(BNObjectDestructionCallbacks* callbacks);
diff --git a/python/__init__.py b/python/__init__.py
index 03154991..711a178a 100644
--- a/python/__init__.py
+++ b/python/__init__.py
@@ -225,11 +225,12 @@ _plugin_init = False
def _init_plugins():
global _plugin_init
if not _plugin_init:
- _plugin_init = True
core.BNInitCorePlugins()
core.BNInitUserPlugins()
core.BNInitRepoPlugins()
- if not core.BNIsLicenseValidated():
+ if core.BNIsLicenseValidated():
+ _plugin_init = True
+ else:
raise RuntimeError("License is not valid. Please supply a valid license.")
@@ -299,3 +300,8 @@ def core_license_count():
def core_ui_enabled():
'''Indicates that a UI exists and the UI has invoked BNInitUI'''
return core.BNIsUIEnabled()
+
+
+def core_set_license(licenseData):
+ '''Set the Binary Ninja license data, an alternative to storing a ``license.dat`` file'''
+ core.BNSetLicense(licenseData) \ No newline at end of file