From 448f40be71dffa86a6581c3696627ccc1bdf74f2 Mon Sep 17 00:00:00 2001 From: Jordan Wiens Date: Mon, 19 Feb 2024 15:04:00 -0500 Subject: 4.0 documentation - Refactored Type Documentation - Added Projects - Added Type Archives - Added New Sidebar Documentation - Added String Concepts - Added Light/Dark Mode - Added New Tab Documentation - Added BNIL Guide: HLIL docs - Added new cookbook examples - Added migration guide - Added script for building docsets - Added documentation for themes - Updated all images to Ninja Edit - API Docs : Documents BasicBlockEdge and BasicBlock - API Docs : Documents CoreVariable, Variable, and VariableNameAndType - API Docs : Corrects note on `BinaryView.update_analysis` and `BinaryView.update_analysis_and_wait` to represent that analysis is run by default for you now. - Many, many other changes --- python/__init__.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'python/__init__.py') diff --git a/python/__init__.py b/python/__init__.py index 144d022a..9e31f906 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -94,6 +94,8 @@ if core.BNGetProduct() == "Binary Ninja Enterprise Client": def shutdown(): """ ``shutdown`` cleanly shuts down the core, stopping all workers and closing all log files. + + .. note:: This will be called automatically on script exit if you import the binaryninja module. """ core.BNShutdown() @@ -103,13 +105,30 @@ atexit.register(shutdown) @dataclass class CoreVersionInfo: + """ + Structure representing the Binary Ninja Version. + + Use :py:func:`core_version_info` to look up the current version of Binary Ninja loaded. + """ + major: int + """Major version number, e.g. 4.0.5000-dev would be 4""" + minor: int + """Minor version number, e.g. 4.0.5000-dev would be 0""" + build: int + """Build version number, e.g. 4.0.5000-dev would be 5000""" + channel: str + """Release channel name, e.g. "dev" or "Stable" """ def get_unique_identifier(): + """ + Generate a GUID + :return: A GUID string + """ return core.BNGetUniqueIdentifierString() @@ -299,6 +318,10 @@ def core_set_license(licenseData: str) -> None: def get_memory_usage_info() -> Mapping[str, int]: + """ + Get counts of various Binary Ninja objects in memory. + :return: Dictionary of {class name: count} for objects in memory + """ count = ctypes.c_ulonglong() info = core.BNGetMemoryUsageInfo(count) assert info is not None, "core.BNGetMemoryUsageInfo returned None" @@ -341,7 +364,7 @@ def load(*args, **kwargs) -> BinaryView: return bv -@deprecation.deprecated(deprecated_in="3.5.4378", details='Use :py:func:`BinaryView.load` instead') +@deprecation.deprecated(deprecated_in="3.5.4378", details='Use :py:func:`load` instead') def open_view(*args, **kwargs) -> BinaryView: return load(*args, **kwargs) @@ -383,6 +406,9 @@ def connect_vscode_debugger(port=5678): class UIPluginInHeadlessError(Exception): + """ + Error thrown when trying to load a UI plugin in a headless Binary Ninja installation. + """ def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) -- cgit v1.3.1