Skip to content

Commit e35002f

Browse files
committed
Start of addon enforcement.
1 parent 905bf92 commit e35002f

5 files changed

Lines changed: 22 additions & 0 deletions

File tree

binaryninjaapi.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,12 @@ vector<LicenseAddon> BinaryNinja::GetLicenseAddons()
293293
}
294294

295295

296+
bool BinaryNinja::HasCollaborationEntitlement()
297+
{
298+
return BNHasCollaborationEntitlement();
299+
}
300+
301+
296302
int BinaryNinja::GetLicenseCount()
297303
{
298304
return BNGetLicenseCount();

binaryninjaapi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2060,6 +2060,7 @@ namespace BinaryNinja {
20602060
std::string GetProductType();
20612061
std::string GetSerialNumber();
20622062
std::vector<LicenseAddon> GetLicenseAddons();
2063+
bool HasCollaborationEntitlement();
20632064
int GetLicenseCount();
20642065
bool IsUIEnabled();
20652066
uint32_t GetBuildId();

binaryninjacore.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4347,6 +4347,7 @@ extern "C"
43474347
BINARYNINJACOREAPI char* BNGetProductType(void);
43484348
BINARYNINJACOREAPI BNLicenseAddon* BNGetLicenseAddons(size_t* count);
43494349
BINARYNINJACOREAPI void BNFreeLicenseAddons(BNLicenseAddon* addons, size_t count);
4350+
BINARYNINJACOREAPI bool BNHasCollaborationEntitlement(void);
43504351
BINARYNINJACOREAPI int BNGetLicenseCount(void);
43514352
BINARYNINJACOREAPI bool BNIsUIEnabled(void);
43524353
BINARYNINJACOREAPI void BNSetLicense(const char* licenseData);

python/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,15 @@ def core_license_addons() -> List[LicenseAddon]:
414414
core.BNFreeLicenseAddons(addons, count.value)
415415

416416

417+
def core_has_collaboration_entitlement() -> bool:
418+
'''Whether the active license permits access to collaboration services.'''
419+
try:
420+
_init_plugins()
421+
except RuntimeError:
422+
return core.BNHasCollaborationEntitlement()
423+
return core.BNHasCollaborationEntitlement()
424+
425+
417426
def core_ui_enabled() -> bool:
418427
'''Indicates that a UI exists and the UI has invoked BNInitUI'''
419428
return core.BNIsUIEnabled()

rust/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,11 @@ pub fn license_addons() -> Vec<LicenseAddon> {
584584
result
585585
}
586586

587+
/// Returns whether the active license permits access to collaboration services.
588+
pub fn has_collaboration_entitlement() -> bool {
589+
unsafe { BNHasCollaborationEntitlement() }
590+
}
591+
587592
/// Set the license that will be used once the core initializes. You can reset the license by passing `None`.
588593
///
589594
/// If not set, the normal license retrieval will occur:

0 commit comments

Comments
 (0)