Crate idalib

Source
Expand description

§idalib

idalib is a Rust library providing idiomatic bindings for the IDA SDK, enabling the development of standalone analysis tools using IDA v9.x’s idalib.

§Usage

To use idalib, add it as a dependency in your Cargo.toml and include a build.rs file in your project to properly link against IDA:

[dependencies]
idalib = "0.7"

[build-dependencies]
idalib-build = "0.7"

Here is a basic example of a build.rs file:

fn main() -> Result<(), Box<dyn std::error::Error>> {
    idalib_build::configure_linkage()?;
    Ok(())
}

This script uses the idalib-build crate to automatically configure the linkage against IDA. If IDA is installed in a non-default location, ensure that IDADIR is set to point to your installation directory, if you are linking against IDA’s shared libraries, as opposed to the stub libraries distributed with the SDK.

§Setting Environment Variables

§On Linux/macOS

You can set the environment variables in your terminal session or add them to your shell configuration file (e.g., .bashrc, .zshrc):

export IDADIR=/path/to/ida/installation

§On Windows

Set environment variables using Command Prompt, PowerShell, or System Properties.

Command Prompt:

set IDADIR=C:\path\to\ida\installation

PowerShell:

$env:IDADIR = "C:\path\to\ida\installation"

System Properties: Go to “Environment Variables” in System Properties and add IDADIR.

§Example

Here’s a simple example of how to use idalib:

use idalib::idb::IDB;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let idb = IDB::open("/path/to/binary")?;
    // Perform analysis...
    Ok(())
}

Re-exports§

pub use idb::IDB;
pub use idb::IDBOpenOptions;
pub use license::LicenseId;
pub use license::is_valid_license;
pub use license::license_id;
pub use idalib_sys as ffi;

Modules§

bookmarks
decompiler
func
idb
insn
license
meta
name
plugin
processor
segment
strings
xref

Structs§

AddressFlags
IDAVersion

Enums§

IDAError

Functions§

enable_console_messages
force_batch_mode
init_library
version

Type Aliases§

Address