enterprise module¶
- class LicenseCheckout(duration=900, _cache=True, release=True)[source]¶
Bases:
object
Helper class for scripts to make use of a license checkout in a scope.
- Parameters:
duration – Duration between refreshes
_cache – Deprecated but left in for compatibility
release – If the license should be released at the end of scope. If False, you can either manually release it later or it will expire after duration.
- Example:
>>> enterprise.connect() >>> enterprise.authenticate_with_credentials("username", "password") >>> with enterprise.LicenseCheckout(): ... # Do some operation ... with load("/bin/ls") as bv: # e.g. ... print(hex(bv.start)) # License is released at end of scope
- authenticate_with_credentials(username: str, password: str, remember: bool = True)[source]¶
Authenticate to the Enterprise Server with username/password credentials.
- authenticate_with_method(method: str, remember: bool = True)[source]¶
Authenticate to the Enterprise Server with a non-password method. Note that many of these will open a URL for a browser-based login prompt, which may not be usable on headless installations. See
authentication_methods
for a list of accepted methods.
- authentication_methods() List[Tuple[str, str]] [source]¶
Get a list of authentication methods accepted by the Enterprise Server.
- cancel_authentication()[source]¶
Cancel a call to
authenticate_with_credentials
orauthenticate_with_method
. Note those functions are blocking, so this must be called on a separate thread.
- deauthenticate()[source]¶
Deauthenticate from the Enterprise server, clearing any cached credentials.
- is_authenticated() bool [source]¶
Determine if you have authenticated to the Enterprise Server.
- Returns:
True if you are authenticated
- Return type:
- is_connected() bool [source]¶
Determine if the Enterprise Server is currently connected.
- Returns:
True if connected
- Return type:
- is_floating_license() bool [source]¶
Determine if a floating license is currently active
- Returns:
True if a floating license is active
- Return type:
- is_initialized() bool [source]¶
Determine if the Enterprise Client has been initialized yet.
- Returns:
True if
initialize
has been called- Return type:
- is_license_still_activated() bool [source]¶
Determine if your current license checkout is still valid.
- Returns:
True if your current checkout is still valid.
- Return type:
- last_error() str [source]¶
Get a text representation the last error encountered by the Enterprise Client
- Returns:
Last error message, or empty string if there is none.
- Return type:
- license_duration() int [source]¶
Get the duration of the current license checkout.
- Returns:
Duration, in seconds, of the total time of the current checkout.
- Return type:
- license_expiration_time() int [source]¶
Get the expiry time of the current license checkout.
- Returns:
Expiry time as a Unix epoch, or 0 if no license is checked out.
- Return type:
- release_license()[source]¶
Release the currently checked out license back to the Enterprise Server.
Note
You must authenticate with the Enterprise Server before calling this.
Note
This will deactivate the Binary Ninja Enterprise client. You must call
acquire_license
again to continue using Binary Ninja Enterprise in the current process.
- reservation_time_limit() int [source]¶
Get the maximum checkout duration allowed by the Enterprise Server.
Note
You must authenticate with the Enterprise Server before calling this.
- Returns:
Duration, in seconds, of the maximum time you are allowed to checkout a license.
- Return type:
- server_build_id() str [source]¶
Get the build id string of the server
- Returns:
Build id of the server
- Return type:
- server_name() str [source]¶
Get the display name of the server
- Returns:
Display name of the server
- Return type:
- server_url() str [source]¶
Get the url of the Enterprise Server.
- Returns:
The current url
- Return type:
- server_version() int [source]¶
Get the version number of the server
- Returns:
Version of the server
- Return type:
- set_server_url(url: str)[source]¶
Set the url of the Enterprise Server.
Note
This will raise an Exception if the server is already initialized
- Parameters:
url (str) – New Enterprise Server url
- token() str | None [source]¶
Get the token of the currently authenticated user to the Enterprise Server.
- Returns:
Token, if authenticated. None, otherwise.
- Return type:
str | None