### Get Start Address of Analysis Context (Rust) Source: https://dev-rust.binary.ninja/binaryninja/core_sys/fn.BNAnalysisContextGetStart_search= The BNAnalysisContextGetStart function retrieves the starting address (as a u64) of a given Binary Ninja analysis context. It is an unsafe C-style function requiring a mutable pointer to BNAnalysisContext. No specific dependencies are mentioned beyond the binaryninjacore_sys crate itself. ```rust pub unsafe extern "C" fn BNAnalysisContextGetStart( analysisContext: *mut BNAnalysisContext, ) -> u64 ``` -------------------------------- ### Get Guided Source Blocks (Rust) Source: https://dev-rust.binary.ninja/binaryninja/function/struct.Function Retrieves the current list of guided source block start locations for this function. These blocks have their direct outgoing branch targets analyzed. ```rust pub fn guided_source_blocks(&self) -> HashSet ``` -------------------------------- ### Installation and Configuration Source: https://dev-rust.binary.ninja/binaryninja/core_sys/all Functions for retrieving the installation directory of Binary Ninja. ```APIDOC ## Installation and Configuration ### Description Retrieve the installation directory path for Binary Ninja. ### Method GET ### Endpoint N/A (These are function calls within the Rust API) ### Parameters None. ### Request Example ```rust let install_dir = BNGetInstallDirectory(); ``` ### Response - **String**: The path to the Binary Ninja installation directory. ### Response Example ```json { "path": "/opt/binaryninja/" } ``` ``` -------------------------------- ### Start Offset and String Functions Source: https://dev-rust.binary.ninja/binaryninja/core_sys/index_search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Functions for getting the start offset of -------------------------------- ### BNGetInstallDirectory Source: https://dev-rust.binary.ninja/binaryninja/core_sys/index_search= Retrieves the installation directory. ```APIDOC ## BNGetInstallDirectory ### Description Retrieves the installation directory. ### Method GET ### Endpoint /BNGetInstallDirectory ### Parameters ### Request Example {} ### Response #### Success Response (200) - **directory** (string) - The installation directory. #### Response Example { "directory": "/usr/bin/binaryninja" } ``` -------------------------------- ### Get TypeLibrary GUID (Rust) Source: https://dev-rust.binary.ninja/binaryninja/types/library/struct.TypeLibrary_search= Returns the globally unique identifier (GUID) associated with the TypeLibrary. ```rust pub fn guid(&self) -> String ``` -------------------------------- ### Installation and Configuration Functions Source: https://dev-rust.binary.ninja/binaryninja/core_sys/index_search=u32+-%3E+bool Functions for retrieving the installation directory. ```APIDOC ## BNGetInstallDirectory ### Description Gets the installation directory of Binary Ninja. ### Method GET ### Endpoint /BNGetInstallDirectory ### Response #### Success Response (200) - **directory** (string) - The installation directory path. ``` -------------------------------- ### Load File with Options in Rust Source: https://dev-rust.binary.ninja/binaryninja/headless/struct.Session_search= This example demonstrates loading a file with specific options. It uses a HashMap to set analysis settings before loading the file. This allows for customized analysis behavior during the loading process. ```rust use binaryninja::{metadata::Metadata, rc::Ref}; use std::collections::HashMap; let settings: Ref = HashMap::from([("analysis.linearSweep.autorun", false.into())]).into(); let headless_session = binaryninja::headless::Session::new().unwrap(); let bv = headless_session .load_with_options("/bin/cat", true, Some(settings)) .expect("Couldn't open `/bin/cat`"); ``` -------------------------------- ### Get Basic Blocks Starting at Address Source: https://dev-rust.binary.ninja/binaryninja/binary_view/trait.BinaryViewExt Retrieves all basic blocks that start at the specified memory address. ```rust fn basic_blocks_starting_at(&self, addr: u64) -> Array> ``` -------------------------------- ### BNAnalysisContextGetStart Source: https://dev-rust.binary.ninja/binaryninja/core_sys/fn.BNAnalysisContextGetStart_search= Retrieves the starting address of the analysis context. ```APIDOC ## BNAnalysisContextGetStart ### Description Retrieves the starting address of the analysis context. ### Method GET ### Endpoint `/analysisContext/start` ### Parameters #### Path Parameters - **analysisContext** (*BNAnalysisContext*) - Required - A pointer to the analysis context. ### Response #### Success Response (200) - **startAddress** (*u64*) - The starting address of the analysis context. #### Response Example ```json { "startAddress": 18446744073709551615 } ``` ``` -------------------------------- ### Get Binary Ninja Install Directory (Rust) Source: https://dev-rust.binary.ninja/binaryninja/fn.install_directory The `install_directory` function returns the installation path of Binary Ninja as a `PathBuf`. This is useful for locating plugin directories or other installation-specific resources. ```rust pub fn install_directory() -> PathBuf ``` -------------------------------- ### Get Comment Start String (Rust) Source: https://dev-rust.binary.ninja/binaryninja/language_representation/struct.CoreLanguageRepresentationFunction_search= Retrieves the string used to start comments in the associated language. This is useful for generating commented disassembly. ```rust pub fn comment_start_string(&self) -> BnString ``` -------------------------------- ### Example Searches for Binary Ninja Core Sys Source: https://dev-rust.binary.ninja/binaryninja/architecture/register/struct.CoreRegisterStack_search= These are example search queries demonstrating common patterns for finding types and functions within the Binary Ninja core_sys crate. They cover standard library types like `std::vec`, type conversions such as `u32 -> bool`, and generic type transformations like `Option, (T -> U) -> Option`. ```text * std::vec ``` ```text * u32 -> bool ``` ```text * Option, (T -> U) -> Option ``` -------------------------------- ### Navigate to Offset Example Source: https://dev-rust.binary.ninja/binaryninja/file_metadata/struct.FileMetadata Example demonstrating how to use the `navigate_to` method to change the current view and offset within the Binary Ninja interface. ```rust use binaryninja::file_metadata::FileMetadata; file.navigate_to("Linear:Raw", 0x0).expect("Linear:Raw should always be present"); ``` -------------------------------- ### Get Component GUID (Rust) Source: https://dev-rust.binary.ninja/binaryninja/core_sys/fn.BNComponentGetGuid_search= Retrieves the GUID of a Binary Ninja component. This function is unsafe and requires a pointer to a BNComponent. It returns a C-style string (char pointer) representing the GUID. ```rust pub unsafe extern "C" fn BNComponentGetGuid( component: *mut BNComponent, ) -> *mut c_char ``` -------------------------------- ### Initialize Binary Ninja Headless Session Source: https://dev-rust.binary.ninja/binaryninja/headless/struct.Session Demonstrates how to initialize the headless session for Binary Ninja. This is typically done at the beginning of a script to ensure proper setup and cleanup. It requires the license to be retrievable via environment variables or the default user directory. ```rust use binaryninja::headless::Session; // Initialize the headless session. // This will panic if initialization fails (e.g., due to license issues). let headless_session = Session::new().unwrap(); // The session will be automatically shut down when it goes out of scope. ``` -------------------------------- ### Get Annotation Start String (Rust) Source: https://dev-rust.binary.ninja/binaryninja/language_representation/struct.CoreLanguageRepresentationFunction_search= Retrieves the string used to start annotations in the associated language. Annotations can provide extra metadata or hints. ```rust pub fn annotation_start_string(&self) -> BnString ``` -------------------------------- ### Get Function Start Address (Rust) Source: https://dev-rust.binary.ninja/binaryninja/core_sys/fn.BNGetFunctionStart Retrieves the starting address of a Binary Ninja function. This function is unsafe as it deals with raw pointers and assumes the provided BNFunction pointer is valid. It returns the starting address as a u64. ```rust pub unsafe extern "C" fn BNGetFunctionStart( func: *mut BNFunction, ) -> u64 ``` -------------------------------- ### Project Creation and Opening Source: https://dev-rust.binary.ninja/binaryninja/project/struct.Project APIs for creating new projects and opening existing ones. ```APIDOC ## POST /projects/create ### Description Creates a new Binary Ninja project. ### Method POST ### Endpoint /projects/create ### Parameters #### Query Parameters - **path** (string) - Required - Path to the project directory (.bnpr). - **name** (string) - Required - Name of the new project. ### Request Example ```json { "path": "/path/to/new/project.bnpr", "name": "MyNewProject" } ``` ### Response #### Success Response (200) - **project_ref** (Ref) - A reference to the newly created project. #### Response Example ```json { "project_ref": "" } ``` ## POST /projects/open ### Description Opens an existing Binary Ninja project. ### Method POST ### Endpoint /projects/open ### Parameters #### Query Parameters - **path** (string) - Required - Path to the project directory (.bnpr) or project metadata file (.bnpm). ### Request Example ```json { "path": "/path/to/existing/project.bnpr" } ``` ### Response #### Success Response (200) - **project_ref** (Ref) - A reference to the opened project. #### Response Example ```json { "project_ref": "" } ``` ``` -------------------------------- ### Get Binary Ninja Component by GUID (Rust) Source: https://dev-rust.binary.ninja/binaryninja/core_sys/fn.BNGetComponentByGuid Retrieves a BNComponent from a BNBinaryView using its globally unique identifier (GUID). This function is unsafe and requires a valid view and GUID. It returns a pointer to the BNComponent or null if not found. ```rust pub unsafe extern "C" fn BNGetComponentByGuid( view: *mut BNBinaryView, guid: *const c_char, ) -> *mut BNComponent ``` -------------------------------- ### Headless Initialization and Session Management Source: https://dev-rust.binary.ninja/binaryninja/headless/index_search= This section covers the core functions for initializing and shutting down the Binary Ninja headless environment, as well as managing session options. ```APIDOC ## Module headless ### Description Provides functionality for interacting with Binary Ninja in a headless (non-GUI) environment. ### Functions #### `init()` ##### Description Loads plugins, core architecture, platform, etc. ##### Method `GET` (Conceptual - this is a function call, not an HTTP endpoint) ##### Endpoint N/A #### `init_with_opts(options: InitializationOptions)` ##### Description Initializes the core with the given `InitializationOptions`. ##### Method `GET` (Conceptual - this is a function call, not an HTTP endpoint) ##### Endpoint N/A ##### Parameters ###### Request Body - **options** (`InitializationOptions`) - Required - Options to configure the initialization process. #### `is_shutdown_requested()` ##### Description Checks if a shutdown has been requested for the headless environment. ##### Method `GET` (Conceptual - this is a function call, not an HTTP endpoint) ##### Endpoint N/A #### `license_location()` ##### Description Attempts to identify the license location type, following the same order as core initialization. ##### Method `GET` (Conceptual - this is a function call, not an HTTP endpoint) ##### Endpoint N/A #### `shutdown()` ##### Description Unloads plugins, stops all worker threads, and closes open logs. ##### Method `GET` (Conceptual - this is a function call, not an HTTP endpoint) ##### Endpoint N/A ### Structs #### `Session` ##### Description Wrapper for `init` and `shutdown`. Instantiating this at the top of your script will initialize everything correctly and then clean itself up at exit as well. ### Enums #### `InitializationError` ##### Description Represents possible errors during initialization. #### `LicenseLocation` ##### Description Represents the type of license location found. ``` -------------------------------- ### Get Linear View Object Start Address (Rust) Source: https://dev-rust.binary.ninja/binaryninja/core_sys/fn.BNGetLinearViewObjectStart Retrieves the starting address (offset) of a given BNLinearViewObject. This function is unsafe as it operates on raw pointers and requires a valid BNLinearViewObject pointer. It returns a u64 representing the starting address. ```rust pub unsafe extern "C" fn BNGetLinearViewObjectStart( obj: *mut BNLinearViewObject, ) -> u64 ``` -------------------------------- ### FileMetadata Navigation Example Source: https://dev-rust.binary.ninja/binaryninja/file_metadata/struct.FileMetadata_search= An example demonstrating how to use the `navigate_to` method on a `FileMetadata` object to move to a specific offset within the 'Linear:Raw' view. ```rust use binaryninja::file_metadata::FileMetadata; // Assuming 'file' is an instance of FileMetadata file.navigate_to("Linear:Raw", 0x0).expect("Linear:Raw should always be present"); ``` -------------------------------- ### Rust: Get Start Address from AnalysisContext Source: https://dev-rust.binary.ninja/binaryninja/workflow/struct.AnalysisContext_search= Retrieves the start address (the lowest address) from the cached `MemoryMap` within the AnalysisContext. This function serves as a lock-free alternative to `BinaryView::start`. ```rust pub fn start(&self) -> u64 Get the start address (the lowest address) from the cached `MemoryMap`. NOTE: This is a lock-free alternative to `BinaryView::start`. ``` -------------------------------- ### Installation and Directory Information Source: https://dev-rust.binary.ninja/binaryninja/all Functions to retrieve information about the Binary Ninja installation directory and user-specific directories. ```APIDOC ## Installation and Directory API ### Description Provides access to paths related to the Binary Ninja installation and user data. ### Endpoints #### `install_directory` ##### Description Returns the installation directory of Binary Ninja. ##### Method GET ##### Endpoint `/install_directory` ##### Parameters None ##### Response - **path** (string) - The absolute path to the installation directory. #### `repositories_directory` ##### Description Returns the directory where repositories are stored. ##### Method GET ##### Endpoint `/repositories_directory` ##### Parameters None ##### Response - **path** (string) - The absolute path to the repositories directory. #### `user_directory` ##### Description Returns the user's home directory for Binary Ninja settings and data. ##### Method GET ##### Endpoint `/user_directory` ##### Parameters None ##### Response - **path** (string) - The absolute path to the user directory. #### `user_plugin_directory` ##### Description Returns the directory for user-installed plugins. ##### Method GET ##### Endpoint `/user_plugin_directory` ##### Parameters None ##### Response - **path** (string) - The absolute path to the user plugin directory. #### `settings_file_path` ##### Description Returns the path to the main settings file. ##### Method GET ##### Endpoint `/settings_file_path` ##### Parameters None ##### Response - **path** (string) - The absolute path to the settings file. #### `set_bundled_plugin_directory` ##### Description Sets the directory for bundled plugins. ##### Method POST ##### Endpoint `/set_bundled_plugin_directory` ##### Parameters - **path** (string) - Required - The path to the bundled plugin directory. ##### Response None ``` -------------------------------- ### System and License Information Functions Source: https://dev-rust.binary.ninja/binaryninja/index_search=u32+-%3E+bool Functions to retrieve system-specific information and license details. This includes build ID, installation paths, license status, user information, and product details. `set_license` allows dynamically setting the license. ```rust /// Returns the build ID of the core. fn build_id() -> String; /// Returns the directory where bundled plugins are located. fn bundled_plugin_directory() -> PathBuf; /// Returns the core's installation directory. fn install_directory() -> PathBuf; /// Checks if the current database is valid. fn is_database() -> bool; /// Checks if the license is validated. fn is_license_validated() -> bool; /// Returns the number of licenses. fn license_count() -> u32; /// Returns the expiration time of the license. fn license_expiration_time() -> Option; /// Returns the path to the license file. fn license_path() -> Option; /// Returns the email of the licensed user. fn licensed_user_email() -> Option; /// Returns information about the memory usage. fn memory_info() -> MemoryInfo; /// Returns the relative path to a file within the bundled plugin directory. fn path_relative_to_bundled_plugin_directory(path: &str) -> PathBuf; /// Returns the relative path to a file within the user directory. fn path_relative_to_user_directory(path: &str) -> PathBuf; /// Returns the relative path to a file within the user plugin directory. fn path_relative_to_user_plugin_directory(path: &str) -> PathBuf; /// Returns the name of the product. fn product() -> String; /// Returns the type of the product. fn product_type() -> ProductType; /// Returns the directory where repositories are located. fn repositories_directory() -> PathBuf; /// Writes the installation directory of the currently running core instance to disk. fn save_last_run(); /// Returns the serial number of the product. fn serial_number() -> Option; /// Sets the directory for bundled plugins. fn set_bundled_plugin_directory(path: &Path); /// Sets the license that will be used once the core initializes. You can reset the license by passing `None`. fn set_license(license: Option<&str>); /// Returns the path to the settings file. fn settings_file_path() -> PathBuf; /// Returns the user's directory. fn user_directory() -> PathBuf; /// Returns the user plugin directory. fn user_plugin_directory() -> PathBuf; /// Returns the version of the core. fn version() -> String; /// Returns detailed version information. fn version_info() -> VersionInfo; ``` -------------------------------- ### Get Segment Start Address (Rust) Source: https://dev-rust.binary.ninja/binaryninja/core_sys/fn.BNSegmentGetStart Retrieves the starting address of a Binary Ninja segment. This function is unsafe as it operates on raw pointers and requires a valid BNSegment pointer. It returns a u64 representing the segment's start address. ```rust pub unsafe extern "C" fn BNSegmentGetStart( segment: *mut BNSegment, ) -> u64 ``` -------------------------------- ### Rust: Nightly-Only Experimental API for Cloning Source: https://dev-rust.binary.ninja/binaryninja/headless/struct.InitializationOptions Demonstrates a nightly-only experimental API `clone_to_uninit` for performing copy-assignment from `self` to a raw pointer `dest`. This API is unstable and requires a nightly Rust toolchain. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) { // ... implementation ... } ``` -------------------------------- ### Get BNComponent GUID (Rust) Source: https://dev-rust.binary.ninja/binaryninja/core_sys/fn.BNComponentGetGuid Retrieves the globally unique identifier (GUID) for a given Binary Ninja component. This function is unsafe as it deals with raw pointers and requires a valid BNComponent pointer as input. It returns a C-style string representing the GUID. ```rust use binaryninjacore_sys::BNComponent; use std::os::raw::c_char; pub unsafe extern "C" fn BNComponentGetGuid( component: *mut BNComponent, ) -> *mut c_char { // Implementation details would go here, interacting with the core Binary Ninja API unimplemented!("BNComponentGetGuid not fully implemented in this example"); } ``` -------------------------------- ### Plugin Management API Source: https://dev-rust.binary.ninja/binaryninja/core_sys/all Functions for managing plugins, including getting their status, types, and handling installation and uninstallation. ```APIDOC ## Plugin Management API ### Description Provides functions to interact with and manage Binary Ninja plugins. This includes retrieving information about installed plugins, their status, and controlling their installation and uninstallation processes. ### Endpoints - **BNPluginGetPlatforms**: Retrieves the platforms supported by a plugin. - **BNPluginGetPluginStatus**: Gets the current status of a plugin. - **BNPluginGetPluginTypes**: Returns the types of a plugin. - **BNPluginGetProjectData**: Retrieves project-specific data for a plugin. - **BNPluginGetProjectUrl**: Gets the URL associated with a plugin's project. - **BNPluginGetRepository**: Retrieves the repository information for a plugin. - **BNPluginGetSubdir**: Gets the subdirectory of a plugin within its installation path. - **BNPluginGetVersion**: Retrieves the version of a plugin. - **BNPluginGetViewOnly**: Checks if a plugin is in view-only mode. - **BNPluginInstall**: Installs a plugin. - **BNPluginInstallDependencies**: Installs the dependencies for a plugin. - **BNPluginIsBeingDeleted**: Checks if a plugin is currently being deleted. - **BNPluginIsBeingUpdated**: Checks if a plugin is currently being updated. - **BNPluginIsDeletePending**: Checks if a plugin deletion is pending. - **BNPluginIsDisablePending**: Checks if a plugin disablement is pending. - **BNPluginIsEnabled**: Checks if a plugin is enabled. - **BNPluginIsInstalled**: Checks if a plugin is installed. - **BNPluginIsRunning**: Checks if a plugin is currently running. - **BNPluginIsUpdateAvailable**: Checks if an update is available for a plugin. - **BNPluginIsUpdatePending**: Checks if a plugin update is pending. - **BNPluginUninstall**: Uninstalls a plugin. - **BNPluginUpdate**: Updates a plugin. ``` -------------------------------- ### BNGetInstallDirectory Source: https://dev-rust.binary.ninja/binaryninja/core_sys/fn.BNGetInstallDirectory Retrieves the installation directory of Binary Ninja. ```APIDOC ## BNGetInstallDirectory ### Description Retrieves the installation directory of Binary Ninja. ### Method GET ### Endpoint /binaryninja/install-directory ### Parameters #### Query Parameters None ### Request Example None ### Response #### Success Response (200) - **install_directory** (string) - The absolute path to the Binary Ninja installation directory. #### Response Example { "install_directory": "/opt/binaryninja/" } ``` -------------------------------- ### Get Section Start Address (Rust) Source: https://dev-rust.binary.ninja/binaryninja/core_sys/fn.BNSectionGetStart Retrieves the starting address (offset) of a given Binary Ninja section. This function is unsafe as it operates on raw pointers and requires a valid BNSection pointer. It returns a u64 representing the section's start address. ```rust pub unsafe extern "C" fn BNSectionGetStart( section: *mut BNSection, ) -> u64 ``` -------------------------------- ### Settings Initialization and Schema Management (Rust) Source: https://dev-rust.binary.ninja/binaryninja/settings/struct.Settings Provides methods for creating new `Settings` instances and managing their schema. `new()` creates a default instance, `new_with_id()` creates an instance with a specific ID, and `serialize_schema`/`deserialize_schema` handle schema serialization and deserialization. ```rust pub fn new() -> Ref pub fn new_with_id(instance_id: &str) -> Ref pub fn serialize_schema(&self) -> String pub fn deserialize_schema(&self, schema: &str) -> bool pub fn deserialize_schema_with_scope( &self, schema: &str, scope: SettingsScope, ) -> bool ``` -------------------------------- ### Get Start Address of View in Rust (BinaryViewBase) Source: https://dev-rust.binary.ninja/binaryninja/binary_view/struct.BinaryView_search= Implements the `start` method for BinaryView in Rust, returning the lowest address within the binary view. It mentions that `AnalysisContext::start` should be used within a workflow. ```rust fn start(&self) -> u64 ``` -------------------------------- ### Get Functions at Address Source: https://dev-rust.binary.ninja/binaryninja/binary_view/trait.BinaryViewExt Lists all functions that start at the specified memory address. ```rust fn functions_at(&self, addr: u64) -> Array ``` -------------------------------- ### Initialize Headless Session with Options Source: https://dev-rust.binary.ninja/binaryninja/headless/struct.Session Initializes the headless session with custom initialization options. This method is useful when the license is not discoverable by default and needs to be explicitly managed. Refer to `InitializationOptions::default` for standard options. ```rust use binaryninja::headless::{Session, InitializationOptions}; // Define custom initialization options (example: using defaults). let options = InitializationOptions::default(); // Initialize the headless session with the specified options. // This method expects the license to be explicitly provided or discoverable by the caller. let headless_session = Session::new_with_opts(options).unwrap(); // The session will be automatically shut down when it goes out of scope. ``` -------------------------------- ### Example Search Queries for Binary Ninja Source: https://dev-rust.binary.ninja/binaryninja/low_level_il/operation/struct.JumpTo_search= Provides example search queries that can be used within the Binary Ninja tool. These examples illustrate how to search for specific types, type conversions, and generic type manipulations. ```text Example searches: * std::vec * u32 -> bool * Option, (T -> U) -> Option ``` -------------------------------- ### Get Type Name by GUID (Rust) Source: https://dev-rust.binary.ninja/binaryninja/core_sys/fn.BNBinaryViewGetTypeNameByGuid Retrieves the qualified name of a type within a Binary Ninja view using its globally unique identifier (GUID). This function is unsafe and requires a valid BNBinaryView pointer and a null-terminated C-style string for the GUID. It returns a BNQualifiedName structure. ```rust pub unsafe extern "C" fn BNBinaryViewGetTypeNameByGuid( view: *mut BNBinaryView, guid: *const c_char, ) -> BNQualifiedName ``` -------------------------------- ### Get Product Type Source: https://dev-rust.binary.ninja/binaryninja/fn.product_type_search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Retrieves the product type of the Binary Ninja installation. ```APIDOC ## GET /product_type ### Description Retrieves the product type of the Binary Ninja installation. ### Method GET ### Endpoint /product_type ### Parameters #### Path Parameters None #### Query Parameters None ### Request Example None ### Response #### Success Response (200) - **product_type** (String) - The product type of Binary Ninja. #### Response Example { "product_type": "binaryninja" } ``` -------------------------------- ### BNSectionGetStart Source: https://dev-rust.binary.ninja/binaryninja/core_sys/fn.BNSectionGetStart_search= Retrieves the starting address of a given Binary Ninja section. ```APIDOC ## BNSectionGetStart ### Description Retrieves the starting address of a given Binary Ninja section. ### Method GET (Conceptual - this is a function call, not a web request) ### Endpoint N/A (Function within the Binary Ninja Core Sys library) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```c // Assuming 'section' is a valid *mut BNSection pointer unsigned long long start_address = BNSectionGetStart(section); ``` ### Response #### Success Response (200) - **start_address** (u64) - The starting address of the section. #### Response Example ```json { "start_address": 18446744073709551615 } ``` ``` -------------------------------- ### Get Firmware Relationship by GUID (Rust) Source: https://dev-rust.binary.ninja/binaryninja/core_sys/fn.BNFirmwareNinjaGetRelationshipByGuid_search= Retrieves a firmware relationship object from the Binary Ninja firmware analysis API using its unique GUID. This function is unsafe and requires a valid `BNFirmwareNinja` context and a C-style string for the GUID. It returns a pointer to a `BNFirmwareNinjaRelationship` object. ```rust pub unsafe extern "C" fn BNFirmwareNinjaGetRelationshipByGuid( fn_: *mut BNFirmwareNinja, guid: *const c_char, ) -> *mut BNFirmwareNinjaRelationship ``` -------------------------------- ### Headless Initialization and Session Management Source: https://dev-rust.binary.ninja/binaryninja/headless/index_search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Provides functions for initializing and shutting down the Binary Ninja core, along with options for custom initialization. ```APIDOC ## Module headless ### Description Provides access to the core Binary Ninja functionality in a headless (non-GUI) environment. ## Structs ### Struct: InitializationOptions **Description:** Options for initializing the Binary Ninja core. ### Struct: Session **Description:** Wrapper for `init` and `shutdown`. Instantiating this at the top of your script will initialize everything correctly and then clean itself up at exit as well. ## Enums ### Enum: InitializationError **Description:** Errors that can occur during initialization. ### Enum: LicenseLocation **Description:** Represents possible locations for the Binary Ninja license. ## Functions ### Function: init **Description:** Loads plugins, core architecture, platform, etc. **Method:** GET **Endpoint:** N/A (Function call) ### Function: init_with_opts **Description:** This initializes the core with the given `InitializationOptions`. **Method:** GET **Endpoint:** N/A (Function call) **Parameters:** #### Query Parameters - **opts** (InitializationOptions) - Required - The initialization options to use. ### Function: is_shutdown_requested **Description:** Checks if a shutdown has been requested. **Method:** GET **Endpoint:** N/A (Function call) ### Function: license_location **Description:** Attempts to identify the license location type, this follows the same order as core initialization. **Method:** GET **Endpoint:** N/A (Function call) ### Function: shutdown **Description:** Unloads plugins, stops all worker threads, and closes open logs. **Method:** GET **Endpoint:** N/A (Function call) ``` -------------------------------- ### Get Unicode Block Range in C Source: https://dev-rust.binary.ninja/binaryninja/architecture/register/trait.RegisterStackInfo_search=u32+-%3E+bool Retrieves the start and end range of a Unicode block given its name. Populates the provided pointers with the start and end values. Returns true on success, false otherwise. ```c extern "C" fn BNUnicodeGetBlockRange(name: *const c_char, start: *mut u32, end: *mut u32) -> bool; ``` -------------------------------- ### Example Searches in Rust (Binary Ninja) Source: https://dev-rust.binary.ninja/binaryninja/function/struct.ConstantReference_search= These are example search queries demonstrating common patterns for finding types and functions within the Binary Ninja Rust environment. They cover basic types, type conversions, and generic function signatures. ```rust // Example: Search for std::vec // std::vec ``` ```rust // Example: Search for u32 -> bool // u32 -> bool ``` ```rust // Example: Search for Option, (T -> U) -> Option // Option, (T -> U) -> Option ``` -------------------------------- ### Get Type Library GUID (Rust) Source: https://dev-rust.binary.ninja/binaryninja/core_sys/fn.BNGetTypeLibraryGuid Retrieves the GUID of a Binary Ninja type library. This function is unsafe as it deals with raw pointers and external C functions. It takes a pointer to a BNTypeLibrary and returns a C-style string (char*) representing the GUID. Ensure the library pointer is valid before calling. ```rust pub unsafe extern "C" fn BNGetTypeLibraryGuid( lib: *mut BNTypeLibrary, ) -> *mut c_char ``` -------------------------------- ### BNAnalysisContextGetStart Source: https://dev-rust.binary.ninja/binaryninja/core_sys/fn.BNAnalysisContextGetStart Retrieves the starting address of the analysis context. ```APIDOC ## BNAnalysisContextGetStart ### Description Retrieves the starting address of the analysis context. ### Method Not applicable (This is a function signature, not a REST endpoint). ### Endpoint Not applicable. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **u64** (unsigned 64-bit integer) - The starting address of the analysis context. #### Response Example ``` // Example usage (conceptual): let start_address = BNAnalysisContextGetStart(analysis_context_ptr); ``` ``` -------------------------------- ### Rust Crate Search Examples Source: https://dev-rust.binary.ninja/binaryninja/section/struct.Section_search= Provides example search queries for Rust crates, demonstrating common patterns for finding functions, types, and generic transformations. These examples are useful for navigating Rust libraries. ```rust // Example: Search for vector types std::vec // Example: Search for functions returning bool from u32 u32 -> bool // Example: Search for Option transformations Option, (T -> U) -> Option ``` -------------------------------- ### Get Instruction Start Address in Binary Ninja IL (Rust) Source: https://dev-rust.binary.ninja/binaryninja/core_sys/fn.BNMediumLevelILGetInstructionStart_search= This function retrieves the starting address of an instruction within the Binary Ninja Medium Level IL. It requires a pointer to the IL function, the architecture, and the address. The function returns a usize representing the instruction's start address. ```rust pub unsafe extern "C" fn BNMediumLevelILGetInstructionStart( func: *mut BNMediumLevelILFunction, arch: *mut BNArchitecture, addr: u64, ) -> usize ``` -------------------------------- ### Get Next Basic Block Start Address (Rust) Source: https://dev-rust.binary.ninja/binaryninja/core_sys/fn.BNGetNextBasicBlockStartAfterAddress Retrieves the starting address of the next basic block following a specified address within a given `BNBinaryView`. This function is unsafe and requires a valid `BNBinaryView` pointer and an address. It returns the `u64` address of the next basic block's start. ```rust pub unsafe extern "C" fn BNGetNextBasicBlockStartAfterAddress( view: *mut BNBinaryView, addr: u64, ) -> u64 ``` -------------------------------- ### Example Searches Source: https://dev-rust.binary.ninja/binaryninja/architecture/flag/struct.CoreFlag_search= Provides examples of search queries that can be performed within the Binary Ninja environment. ```APIDOC ## Example Searches ### Description Demonstrates various formats for performing searches within the Binary Ninja tool. ### Method GET ### Endpoint /websites/dev-rust_binary_ninja_binaryninja/example_searches ### Parameters #### Query Parameters - **query** (string) - Required - The search query string. ### Request Example ```json { "query": "std::vec" } ``` ### Response #### Success Response (200) - **results** (array) - A list of search results. #### Response Example ```json { "results": [ "std::vec::Vec", "std::vec::vec! macro" ] } ``` ``` -------------------------------- ### Get Next Data Variable Start Address (Rust) Source: https://dev-rust.binary.ninja/binaryninja/core_sys/fn.BNGetNextDataVariableStartAfterAddress The BNGetNextDataVariableStartAfterAddress function finds the starting address of the next data variable in a Binary Ninja view after a specified address. It requires a valid BNBinaryView and a starting address. The function returns a u64 representing the address of the next data variable, or 0 if none is found. ```rust pub unsafe extern "C" fn BNGetNextDataVariableStartAfterAddress( view: *mut BNBinaryView, addr: u64, ) -> u64 ``` -------------------------------- ### Remote Initialization and Connection Source: https://dev-rust.binary.ninja/binaryninja/collaboration/struct.Remote APIs for creating, connecting to, and disconnecting from remote Binary Ninja instances. ```APIDOC ## POST /remote/new ### Description Creates a new Remote instance and adds it to the list of known remotes, saving the configuration to settings. ### Method POST ### Endpoint /remote/new ### Parameters #### Query Parameters - **name** (string) - Required - The name of the remote. - **address** (string) - Required - The network address of the remote. ### Response #### Success Response (200) - **remote_ref** (Ref) - A reference to the newly created Remote object. #### Response Example ```json { "remote_ref": "" } ``` ## POST /remote/connect ### Description Connects to the Remote instance, loading metadata and optionally acquiring an authentication token. This operation is not thread-safe. ### Method POST ### Endpoint /remote/connect ### Parameters #### Request Body - **remote_ref** (Ref) - Required - A reference to the Remote instance to connect. ### Response #### Success Response (200) - **status** (string) - "Connected successfully." #### Response Example ```json { "status": "Connected successfully." } ``` ## POST /remote/disconnect ### Description Disconnects from the Remote instance. This operation is not thread-safe. ### Method POST ### Endpoint /remote/disconnect ### Parameters #### Request Body - **remote_ref** (Ref) - Required - A reference to the Remote instance to disconnect. ### Response #### Success Response (200) - **status** (string) - "Disconnected successfully." #### Response Example ```json { "status": "Disconnected successfully." } ``` ``` -------------------------------- ### System and Build Information Source: https://dev-rust.binary.ninja/binaryninja/index_search=std%3A%3Avec Retrieves build ID, installation paths, and system information. ```APIDOC ## build_id ### Description Returns the build ID of the Binary Ninja core. ### Method GET ### Endpoint /system/build_id ### Parameters None ### Response #### Success Response (200) - **build_id** (string) - The build ID of the core. #### Response Example ```json { "build_id": "12345-abcdef" } ``` ## install_directory ### Description Returns the installation directory of the Binary Ninja core. ### Method GET ### Endpoint /system/install_directory ### Parameters None ### Response #### Success Response (200) - **path** (string) - The installation path. #### Response Example ```json { "path": "/opt/binaryninja" } ``` ## bundled_plugin_directory ### Description Returns the directory where bundled plugins are located. ### Method GET ### Endpoint /system/bundled_plugin_directory ### Parameters None ### Response #### Success Response (200) - **path** (string) - The path to the bundled plugin directory. #### Response Example ```json { "path": "/opt/binaryninja/plugins" } ``` ## repositories_directory ### Description Returns the directory where plugin repositories are stored. ### Method GET ### Endpoint /system/repositories_directory ### Parameters None ### Response #### Success Response (200) - **path** (string) - The path to the repositories directory. #### Response Example ```json { "path": "~/.binaryninja/repositories" } ``` ## user_directory ### Description Returns the user's home directory for Binary Ninja configurations and data. ### Method GET ### Endpoint /system/user_directory ### Parameters None ### Response #### Success Response (200) - **path** (string) - The user directory path. #### Response Example ```json { "path": "~/.binaryninja" } ``` ## user_plugin_directory ### Description Returns the directory where user-installed plugins are located. ### Method GET ### Endpoint /system/user_plugin_directory ### Parameters None ### Response #### Success Response (200) - **path** (string) - The path to the user plugin directory. #### Response Example ```json { "path": "~/.binaryninja/plugins" } ``` ## version ### Description Returns the version string of the Binary Ninja core. ### Method GET ### Endpoint /system/version ### Parameters None ### Response #### Success Response (200) - **version** (string) - The version string. #### Response Example ```json { "version": "3.0.0-rc1" } ``` ## version_info ### Description Returns detailed version information about the Binary Ninja core. ### Method GET ### Endpoint /system/version_info ### Parameters None ### Response #### Success Response (200) - **version_info** (object) - Detailed version information. - **major** (integer) - Major version number. - **minor** (integer) - Minor version number. - **patch** (integer) - Patch version number. - **build_number** (integer) - Build number. - **commit_hash** (string) - Git commit hash. - **branch** (string) - Git branch name. - **build_os** (string) - Operating system the build was created on. - **build_arch** (string) - Architecture the build was created for. #### Response Example ```json { "version_info": { "major": 3, "minor": 0, "patch": 0, "build_number": 1234, "commit_hash": "abcdef1234567890", "branch": "main", "build_os": "linux", "build_arch": "x86_64" } } ``` ``` -------------------------------- ### Get Register Value At Address (Rust) Source: https://dev-rust.binary.ninja/binaryninja/function/struct.Function_search= Retrieves the value of a specified register at a given virtual address. It requires the virtual address, a RegisterId, and an optional architecture. The example shows how to get the 'rdi' register's value. ```rust pub fn register_value_at( &self, addr: u64, reg: RegisterId, arch: Option, ) -> RegisterValue ``` ```rust let reg = fun.arch().register_by_name("rdi").unwrap(); let value = fun.register_value_at(0x400dbe, reg.id(), None); ``` -------------------------------- ### Example Searches Source: https://dev-rust.binary.ninja/binaryninja/headless/enum.LicenseLocation_search= Demonstrates example search queries for various Rust types and patterns within the Binary Ninja environment. ```APIDOC ## Example Searches ### Description Provides examples of common search queries that can be performed within the Binary Ninja environment, illustrating how to search for specific types, type conversions, and generic patterns. ### Method (N/A - These are illustrative search queries, not API endpoints) ### Endpoint (N/A) ### Parameters (N/A) ### Request Example ``` Example searches: * std::vec * u32 -> bool * Option, (T -> U) -> Option ``` ### Response (N/A - These are search query examples, not API responses) ``` -------------------------------- ### Rust BasicBlock: Instruction Index and Address Range Source: https://dev-rust.binary.ninja/binaryninja/basic_block/struct.BasicBlock_search=std%3A%3Avec Provides methods to get the start and end instruction indices within the function, as well as the raw start and end addresses of the basic block in memory. The indices are also context-dependent. ```rust pub fn start_index(&self) -> C::InstructionIndex pub fn end_index(&self) -> C::InstructionIndex pub fn start(&self) -> u64 pub fn end(&self) -> u64 ``` -------------------------------- ### Get Unicode Block Range - Rust Source: https://dev-rust.binary.ninja/binaryninja/architecture/branches/enum.BranchKind_search=u32+-%3E+bool Retrieves the start and end code points for a given Unicode block. This function is part of the binaryninjacore_sys crate and requires the block name and mutable pointers to store the start and end code points. ```rust extern "C" { fn BNUnicodeGetBlockRange(name: *const c_char, start: *mut u32, end: *mut u32) -> bool; } ``` -------------------------------- ### Create File from Path Source: https://dev-rust.binary.ninja/binaryninja/project/struct.Project Endpoints for creating a project file from a path on disk. Includes options for progress callbacks and unsafe creation with specific IDs and timestamps. ```APIDOC ## POST /projects/files/from-path ### Description Creates a new project file by copying content from a specified path on disk. This method allows for optional folder placement, a custom name, and description for the file within the project. It returns a `Ref` on success or an error. ### Method POST ### Endpoint /projects/files/from-path ### Parameters #### Query Parameters - **path** (string) - Required - Path on disk to the source file. - **folder** (string) - Optional - Identifier for the project folder where the file should be placed. If not provided, it defaults to the root. - **name** (string) - Required - The desired name for the project file. - **description** (string) - Optional - A description for the project file. ### Request Example ```json { "path": "/path/to/local/file.exe", "folder": "src", "name": "my_binary.exe", "description": "Main executable file" } ``` ### Response #### Success Response (200) - **ProjectFile** (object) - A reference to the newly created project file. #### Response Example ```json { "id": "unique-file-id", "name": "my_binary.exe", "description": "Main executable file", "path": "/src/my_binary.exe" } ``` ## POST /projects/files/from-path/progress ### Description Creates a new project file from a path on disk, with support for a progress callback. This is useful for long-running operations where progress updates are desired. It takes the file path, optional folder, name, description, and a `ProgressCallback`. ### Method POST ### Endpoint /projects/files/from-path/progress ### Parameters #### Query Parameters - **path** (string) - Required - Path on disk to the source file. - **folder** (string) - Optional - Identifier for the project folder. - **name** (string) - Required - Name for the project file. - **description** (string) - Optional - Description for the project file. - **progress** (ProgressCallback) - Required - Callback function to report progress. ### Request Example ```json { "path": "/path/to/local/file.exe", "folder": "src", "name": "my_binary.exe", "description": "Main executable file", "progress": "callback_function_name" } ``` ### Response #### Success Response (200) - **ProjectFile** (object) - A reference to the newly created project file. #### Response Example ```json { "id": "unique-file-id", "name": "my_binary.exe", "description": "Main executable file", "path": "/src/my_binary.exe" } ``` ## POST /projects/files/from-path/unsafe ### Description Creates a project file from a path on disk using unsafe parameters. This method requires a unique `id` and `creation_time` for the file. Use with caution as it bypasses some safety checks. ### Method POST ### Endpoint /projects/files/from-path/unsafe ### Parameters #### Query Parameters - **path** (string) - Required - Path on disk to the source file. - **folder** (string) - Optional - Identifier for the project folder. - **name** (string) - Required - Name for the project file. - **description** (string) - Optional - Description for the project file. - **id** (string) - Required - Unique identifier for the file. - **creation_time** (SystemTime) - Required - The creation timestamp of the file. ### Request Example ```json { "path": "/path/to/local/file.exe", "folder": "src", "name": "my_binary.exe", "description": "Main executable file", "id": "custom-id-123", "creation_time": "2023-10-27T10:00:00Z" } ``` ### Response #### Success Response (200) - **ProjectFile** (object) - A reference to the newly created project file. #### Response Example ```json { "id": "custom-id-123", "name": "my_binary.exe", "description": "Main executable file", "path": "/src/my_binary.exe" } ``` ## POST /projects/files/from-path/unsafe/progress ### Description Creates a project file from a path on disk using unsafe parameters and a progress callback. This method requires a unique `id`, `creation_time`, and a `ProgressCallback`. ### Method POST ### Endpoint /projects/files/from-path/unsafe/progress ### Parameters #### Query Parameters - **path** (string) - Required - Path on disk to the source file. - **folder** (string) - Optional - Identifier for the project folder. - **name** (string) - Required - Name for the project file. - **description** (string) - Optional - Description for the project file. - **id** (string) - Required - Unique identifier for the file. - **creation_time** (SystemTime) - Required - The creation timestamp of the file. - **progress** (ProgressCallback) - Required - Callback function to report progress. ### Request Example ```json { "path": "/path/to/local/file.exe", "folder": "src", "name": "my_binary.exe", "description": "Main executable file", "id": "custom-id-123", "creation_time": "2023-10-27T10:00:00Z", "progress": "callback_function_name" } ``` ### Response #### Success Response (200) - **ProjectFile** (object) - A reference to the newly created project file. #### Response Example ```json { "id": "custom-id-123", "name": "my_binary.exe", "description": "Main executable file", "path": "/src/my_binary.exe" } ``` ```