summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--binaryninjaapi.cpp18
-rw-r--r--binaryninjaapi.h4
-rw-r--r--binaryninjacore.h8
-rw-r--r--python/__init__.py7
-rw-r--r--python/update.py2
-rw-r--r--update.cpp4
6 files changed, 37 insertions, 6 deletions
diff --git a/binaryninjaapi.cpp b/binaryninjaapi.cpp
index 6f488788..b774cf2b 100644
--- a/binaryninjaapi.cpp
+++ b/binaryninjaapi.cpp
@@ -173,6 +173,15 @@ string BinaryNinja::GetVersionString()
}
+string BinaryNinja::GetLicensedUserEmail()
+{
+ char* str = BNGetLicensedUserEmail();
+ string result = str;
+ BNFreeString(str);
+ return result;
+}
+
+
string BinaryNinja::GetProduct()
{
char* str = BNGetProduct();
@@ -191,6 +200,15 @@ string BinaryNinja::GetProductType()
}
+string BinaryNinja::GetSerialNumber()
+{
+ char* str = BNGetSerialNumber();
+ string result = str;
+ BNFreeString(str);
+ return result;
+}
+
+
int BinaryNinja::GetLicenseCount()
{
return BNGetLicenseCount();
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 9d4a7257..a6276b00 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -575,8 +575,10 @@ namespace BinaryNinja
std::string& output, std::string& errors, bool stdoutIsText=false, bool stderrIsText=true);
std::string GetVersionString();
+ std::string GetLicensedUserEmail();
std::string GetProduct();
std::string GetProductType();
+ std::string GetSerialNumber();
int GetLicenseCount();
bool IsUIEnabled();
uint32_t GetBuildId();
@@ -2969,7 +2971,7 @@ namespace BinaryNinja
static std::vector<UpdateChannel> GetList();
- bool AreUpdatesAvailable();
+ bool AreUpdatesAvailable(uint64_t* expireTime, uint64_t* serverTime);
BNUpdateResult UpdateToVersion(const std::string& version);
BNUpdateResult UpdateToVersion(const std::string& version,
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 1bb4c726..870c2de3 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -1203,7 +1203,8 @@ extern "C"
{
UpdateFailed = 0,
UpdateSuccess = 1,
- AlreadyUpToDate = 2
+ AlreadyUpToDate = 2,
+ UpdateAvailable = 3
};
struct BNUpdateChannel
@@ -1603,7 +1604,10 @@ extern "C"
BINARYNINJACOREAPI char* BNGetVersionString(void);
BINARYNINJACOREAPI uint32_t BNGetBuildId(void);
+ BINARYNINJACOREAPI char* BNGetSerialNumber(void);
+ BINARYNINJACOREAPI uint64_t BNGetLicenseExpirationTime(void);
BINARYNINJACOREAPI bool BNIsLicenseValidated(void);
+ BINARYNINJACOREAPI char* BNGetLicensedUserEmail(void);
BINARYNINJACOREAPI char* BNGetProduct(void);
BINARYNINJACOREAPI char* BNGetProductType(void);
BINARYNINJACOREAPI int BNGetLicenseCount(void);
@@ -2769,7 +2773,7 @@ extern "C"
BINARYNINJACOREAPI BNUpdateVersion* BNGetUpdateChannelVersions(const char* channel, size_t* count, char** errors);
BINARYNINJACOREAPI void BNFreeUpdateChannelVersionList(BNUpdateVersion* list, size_t count);
- BINARYNINJACOREAPI bool BNAreUpdatesAvailable(const char* channel, char** errors);
+ BINARYNINJACOREAPI bool BNAreUpdatesAvailable(const char* channel, uint64_t* expireTime, uint64_t* serverTime, char** errors);
BINARYNINJACOREAPI BNUpdateResult BNUpdateToVersion(const char* channel, const char* version, char** errors,
bool (*progress)(void* ctxt, uint64_t progress, uint64_t total),
diff --git a/python/__init__.py b/python/__init__.py
index f4a8fac8..729e4f8a 100644
--- a/python/__init__.py
+++ b/python/__init__.py
@@ -21,6 +21,7 @@
import atexit
import sys
+from time import gmtime
# Binary Ninja components
import _binaryninjacore as core
@@ -147,6 +148,12 @@ core_version = core.BNGetVersionString()
core_build_id = core.BNGetBuildId()
'''Build ID'''
+core_serial = core.BNGetSerialNumber()
+'''Serial Number'''
+
+core_expires = gmtime(core.BNGetLicenseExpirationTime())
+'''License Expiration'''
+
core_product = core.BNGetProduct()
'''Product string from the license file'''
diff --git a/python/update.py b/python/update.py
index be6962d7..1eb8ea61 100644
--- a/python/update.py
+++ b/python/update.py
@@ -154,7 +154,7 @@ class UpdateChannel(object):
def updates_available(self):
"""Whether updates are available (read-only)"""
errors = ctypes.c_char_p()
- result = core.BNAreUpdatesAvailable(self.name, errors)
+ result = core.BNAreUpdatesAvailable(self.name, None, None, errors)
if errors:
error_str = errors.value
core.BNFreeString(ctypes.cast(errors, ctypes.POINTER(ctypes.c_byte)))
diff --git a/update.cpp b/update.cpp
index 135fee5e..0ec69892 100644
--- a/update.cpp
+++ b/update.cpp
@@ -67,10 +67,10 @@ vector<UpdateChannel> UpdateChannel::GetList()
}
-bool UpdateChannel::AreUpdatesAvailable()
+bool UpdateChannel::AreUpdatesAvailable(uint64_t* expireTime, uint64_t* serverTime)
{
char* errors;
- bool result = BNAreUpdatesAvailable(name.c_str(), &errors);
+ bool result = BNAreUpdatesAvailable(name.c_str(), expireTime, serverTime, &errors);
if (errors)
{