Binary Ninja Python API Documentation

bundled_plugin_path()[source]

bundled_plugin_path returns a string containing the current plugin path inside the install path

Returns

current bundled plugin path

Return type

str, or None on failure

core_build_id()[source]

core_build_id returns a integer containing the current build id

Returns

current build id

Return type

int

core_expires()[source]

License Expiration

core_license_count()[source]

License count from the license file

core_product()[source]

Product string from the license file

core_product_type()[source]

Product type from the license file

core_serial()[source]

core_serial returns a string containing the current serial number

Returns

current serial

Return type

str, or None on failure

core_set_license(licenseData)[source]

core_set_license is used to initialize the core with a license file that doesn’t necessarily reside on a file system. This is especially useful for headless environments such as docker where loading the license file via an environment variable allows for greater security of the license file itself.

Parameters

licenseData (str) – string containing the full contents of a license file

Returns

user plugin path

Return type

None

Example
>>> import os
>>> core_set_license(os.environ['BNLICENSE']) #Do this before creating any BinaryViews
>>> with open_view("/bin/ls") as bv:
...             print(len(bv.functions))
128
core_ui_enabled()[source]

Indicates that a UI exists and the UI has invoked BNInitUI

core_version()[source]

core_version returns a string containing the current version

Returns

current version

Return type

str, or None on failure

disable_default_log()[source]

Disable default logging in headless mode for the current session. By default, logging in headless operation is controlled by the ‘python.log.minLevel’ settings.

get_install_directory()[source]

get_install_directory returns a string pointing to the installed binary currently running

Warning

ONLY for use within the Binary Ninja UI, behavior is undefined and unreliable if run headlessly

get_memory_usage_info()[source]
get_unique_identifier()[source]
open_view(*args, **kwargs)[source]

open_view is a convenience wrapper for get_view_of_file_with_options that opens a BinaryView object.

Note

If attempting to open a BNDB, the file MUST have the suffix .bndb, or else the file will not be loaded as a database.

Parameters
  • filename (str) – path to filename or bndb to open

  • update_analysis (bool) – whether or not to run update_analysis_and_wait after opening a BinaryView, defaults to True

  • progress_func (callback) – optional function to be called with the current progress and total count

  • options (dict) – a dictionary in the form {setting identifier string : object value}

Returns

returns a BinaryView object for the given filename or None

Return type

BinaryView or None

Example
>>> from binaryninja import *
>>> with open_view("/bin/ls") as bv:
...     print(len(bv.functions))
...
128
shutdown()[source]

shutdown cleanly shuts down the core, stopping all workers and closing all log files.

user_directory()[source]

user_directory returns a string containing the path to the user directory

Returns

current user path

Return type

str, or None on failure

user_plugin_path()[source]

user_plugin_path returns a string containing the current plugin path inside the user directory

Returns

current user plugin path

Return type

str, or None on failure