Skip to main content

Crate idax

Crate idax 

Source
Expand description

Safe, idiomatic Rust bindings for the IDA SDK via idax.

This crate mirrors the complete API surface of the idax C++ wrapper library, providing an intuitive, concept-driven interface to IDA Pro’s analysis capabilities.

§Architecture

The crate is organized into modules that mirror the C++ ida:: namespace hierarchy:

ModuleC++ NamespacePurpose
errorida::ErrorError types, Result<T>, Status
addressida::addressAddress primitives, predicates, range iteration
databaseida::databaseDatabase lifecycle, metadata, imports, snapshots
segmentida::segmentSegment CRUD, traversal, properties
functionida::functionFunction CRUD, chunks, frames, register variables
instructionida::instructionInstruction decode, operands, text rendering
dataida::dataByte-level read, write, patch, and define
nameida::nameNaming and demangling
xrefida::xrefCross-reference enumeration and mutation
commentida::commentComments (regular, repeatable, anterior/posterior)
searchida::searchText, binary, and immediate value searches
analysisida::analysisAuto-analysis control
luminaida::luminaLumina metadata pull/push
typesida::typeType system: construction, introspection, application
entryida::entryProgram entry points
fixupida::fixupFixup/relocation information
eventida::eventIDB event subscriptions
pluginida::pluginPlugin lifecycle, action registration
loaderida::loaderLoader module helpers
processorida::processorProcessor module data types
debuggerida::debuggerDebugger control, breakpoints, memory, appcall
decompilerida::decompilerDecompiler facade, pseudocode, ctree, microcode
storageida::storageLow-level persistent key-value storage (netnodes)
graphida::graphCustom graphs, flow charts
uiida::uiUI utilities: messages, dialogs, widgets, events
linesida::linesColor tag manipulation
diagnosticsida::diagnosticsLogging and performance counters

§Quick Start

use idax::{database, address, function, segment};

fn main() -> idax::error::Result<()> {
    // Initialize IDA library
    database::init()?;

    // Open a binary for analysis
    database::open("/path/to/binary", true)?;

    // Query metadata
    let path = database::input_file_path()?;
    let md5 = database::input_md5()?;
    println!("Analyzing: {path} (MD5: {md5})");

    // Iterate over functions
    let count = function::count()?;
    for i in 0..count {
        let func = function::by_index(i)?;
        println!("  {:#x}: {}", func.start(), func.name());
    }

    // Iterate over segments
    let seg_count = segment::count()?;
    for i in 0..seg_count {
        let seg = segment::by_index(i)?;
        println!("  {}: {:#x}-{:#x}", seg.name(), seg.start(), seg.end());
    }

    // Clean up
    database::close(false)?;
    Ok(())
}

§Error Handling

All fallible operations return error::Result<T> or error::Status, which are type aliases for std::result::Result<T, error::Error> and std::result::Result<(), error::Error> respectively. The error::Error type carries a category, code, message, and context — mirroring the C++ ida::Error exactly.

§RAII / Drop

Types that hold SDK resources implement Drop:

§Safety

All unsafe FFI calls are encapsulated within safe Rust functions. Users of this crate never need to write unsafe code.

Re-exports§

pub use address::Address;
pub use address::AddressDelta;
pub use address::AddressSize;
pub use address::BAD_ADDRESS;
pub use error::Error;
pub use error::Result;
pub use error::Status;

Modules§

address
Address primitives, predicates, and range iteration for idax.
analysis
Auto-analysis control: scheduling, waiting, enable/disable.
comment
Comment access and mutation (regular, repeatable, anterior/posterior).
data
Byte-level read, write, patch, and define operations.
database
Database lifecycle and metadata operations.
debugger
Debugger control: process/thread lifecycle, breakpoints, memory, appcall, and events.
decompiler
Decompiler facade: availability, decompilation, pseudocode access, ctree traversal, and user comment management.
diagnostics
Shared diagnostics, logging, and lightweight counters.
entry
Program entry points.
error
Core error and result types for idax.
event
Typed event subscription and RAII scoped subscriptions.
fixup
Fixup / relocation information.
function
Function operations: creation, query, traversal, chunks, frames.
graph
Graph API: custom graphs, flow charts, node/edge manipulation.
instruction
Instruction decode, operand access, and text rendering.
lines
Color tag manipulation for IDA’s tagged text format.
loader
Loader module development helpers.
lumina
Lumina metadata pull/push wrappers.
name
Naming, demangling, and name property operations.
plugin
Plugin lifecycle, action registration, and export helpers.
processor
Processor module development helpers.
search
Text, binary, and immediate value searches.
segment
Segment operations: creation, query, traversal, properties.
storage
Low-level persistent key-value storage (advanced).
types
Type system: construction, introspection, and application.
ui
UI utilities: messages, warnings, dialogs, navigation, widgets, timers, event subscriptions, and view refresh.
xref
Cross-reference enumeration and mutation.