Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
727603a
add `is_loaded(ea)` and `is_mapped(ea)`
williballenthin Sep 9, 2025
8c94691
add tests for get byte/bytes/word/dword/qword
williballenthin Sep 9, 2025
19668dd
add `heads(start, end)` iterator
williballenthin Sep 9, 2025
a3043e2
add tests for heads() iterator
williballenthin Sep 8, 2025
cba6950
add `imports()` iterator
williballenthin Sep 9, 2025
9c20587
add tests for import enumeration
williballenthin Sep 9, 2025
6d871aa
add `get_name(ea)`
williballenthin Sep 9, 2025
8bcada1
add `get_string_at(ea)`
williballenthin Sep 9, 2025
f54994c
add tests for strings
williballenthin Sep 9, 2025
29920fa
add `is_code(ea)` and `is_data(ea)`
williballenthin Sep 9, 2025
3f071d3
add xref iterators
williballenthin Sep 9, 2025
5e2ba16
add tests for xrefs
williballenthin Sep 9, 2025
53e616f
add `Insn.mnemonic()`
williballenthin Sep 9, 2025
b46baba
add tests for `Insn.mnemomic()`
williballenthin Sep 8, 2025
7cfd268
add `find_bytes(pattern)` and `find_binary(bytes, mask)`
williballenthin Sep 9, 2025
f811fdb
add tests for `find_bytes` and `find_binary`
williballenthin Sep 8, 2025
945d9ee
add segment type helpers
williballenthin Sep 9, 2025
39a847f
add tests for segments
williballenthin Sep 8, 2025
7f92ca0
fix lints
williballenthin Oct 30, 2025
40a5448
operand: expose addr for OperandType::Frase
williballenthin Oct 31, 2025
14fc39e
add get_fileregion_{offset,ea}
williballenthin Oct 31, 2025
5df4f75
add entry_forwarder
williballenthin Nov 3, 2025
5c48619
add is_stkvar
williballenthin Nov 3, 2025
54285ea
add get_disasm_line
williballenthin Nov 3, 2025
9a292a0
add print_operand
williballenthin Nov 3, 2025
88f2a97
add tag_remove
williballenthin Nov 3, 2025
30c24e9
add tests for disassembly
williballenthin Nov 3, 2025
faa9b06
add x86 base/index/scale/sib accessors
williballenthin Nov 4, 2025
c19d2a9
add tests for x86 accessors
williballenthin Nov 4, 2025
372a591
add imagebase accessor
williballenthin Nov 4, 2025
522f967
add tests for imagebase
williballenthin Nov 4, 2025
90670d1
add OSType enum
williballenthin Nov 5, 2025
e873600
build: find installation path from ~/.idapro/ida-config.json
williballenthin Jan 29, 2026
5ce9480
add is_operand_offset and get_canon_features and friends
williballenthin Jan 29, 2026
c8edb18
idalib-build: fix auto-detected IDA installation path on macOS
williballenthin Jan 31, 2026
af7ef3f
idalib-build: Windows and $IDAUSR support for detecting IDA install dir
williballenthin Jan 31, 2026
d492e8b
Move XRef iterators to xref module
williballenthin Jan 31, 2026
3024915
Refactor address range parameters to use RangeBounds and consistent o…
williballenthin Jan 31, 2026
85938a1
imports: fix encapsulation
williballenthin Jan 31, 2026
d05a483
tests: linting
williballenthin Jan 31, 2026
7e7455c
tests: remove old IO routines
williballenthin Feb 1, 2026
b77f8ad
expose test resources only during tests
williballenthin Feb 1, 2026
90c4202
use rust::String() consistently
williballenthin Feb 1, 2026
add7876
impl OSType TryFrom<u16>
williballenthin Feb 1, 2026
3d3aa01
move get_fileregion_offset/ea to IDB
williballenthin Feb 1, 2026
ad4c786
operand: ensure valid index
williballenthin Feb 1, 2026
ac95d62
rename get_insn_operand
williballenthin Feb 1, 2026
f187e79
rename insn.addressing_mode()
williballenthin Feb 1, 2026
ff74649
add CanonFeature flags
williballenthin Feb 1, 2026
64ccba6
insn: move formatting to Display on insn/operand
williballenthin Feb 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions idalib-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ build = "build.rs"
[dependencies]
anyhow = "1"
idalib-sys = { version = "0.7", path = "../idalib-sys" }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
54 changes: 54 additions & 0 deletions idalib-build/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,61 @@
use std::env;
use std::fs;
use std::path::{Path, PathBuf};

use serde::Deserialize;

#[derive(Deserialize)]
struct IdaConfig {
#[serde(rename = "Paths")]
paths: Option<IdaConfigPaths>,
}

#[derive(Deserialize)]
struct IdaConfigPaths {
#[serde(rename = "ida-install-dir")]
ida_install_dir: Option<String>,
}

/// Try to read the IDA installation path from the IDA configuration file
fn read_ida_config() -> Option<PathBuf> {
let config_dir = if let Ok(ida_usr) = env::var("IDAUSR") {
PathBuf::from(ida_usr)
} else {
#[cfg(target_os = "windows")]
{
PathBuf::from(env::var("APPDATA").ok()?)
.join("Hex-Rays")
.join("IDA Pro")
}
#[cfg(any(target_os = "linux", target_os = "macos"))]
{
PathBuf::from(env::var("HOME").ok()?).join(".idapro")
}
#[cfg(not(any(target_os = "windows", target_os = "linux", target_os = "macos")))]
{
return None;
}
};

let config_path = config_dir.join("ida-config.json");
let contents = fs::read_to_string(&config_path).ok()?;
let config: IdaConfig = serde_json::from_str(&contents).ok()?;
let path_str = config.paths?.ida_install_dir?;
Some(PathBuf::from(path_str))
}

fn link_path() -> PathBuf {
// First try to read from ida-config.json
if let Some(mut path) = read_ida_config() {
#[cfg(target_os = "macos")]
if path.extension().map_or(false, |ext| ext == "app") {
path.push("Contents");
path.push("MacOS");
}
return path;
}

// Fall back to platform-specific defaults
#[cfg(target_os = "macos")]
return PathBuf::from("/Applications/IDA Professional 9.2.app/Contents/MacOS");

Expand Down
22 changes: 22 additions & 0 deletions idalib-sys/src/bytes_extras.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "bytes.hpp"
#include "segment.hpp"

#include "cxx.h"

Expand All @@ -17,3 +18,24 @@ std::size_t idalib_get_bytes(ea_t ea, rust::Vec<rust::u8> &buf) {
return 0;
}
}

bool idalib_is_loaded(ea_t ea) {
return is_loaded(ea);
}

bool idalib_is_mapped(ea_t ea) {
return getseg(ea) != nullptr;
}

bool idalib_is_stkvar(flags64_t flags, int operand_index) {
if (operand_index == 0) {
return is_stkvar0(flags);
} else if (operand_index == 1) {
return is_stkvar1(flags);
}
return false;
}

bool idalib_is_off(flags64_t flags, int operand_index) {
return is_off(flags, operand_index);
}
11 changes: 11 additions & 0 deletions idalib-sys/src/entry_extras.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,14 @@ rust::String idalib_entry_name(uval_t ord) {
return rust::String();
}
}

rust::String idalib_entry_forwarder(uval_t ord) {
auto forwarder = qstring();

ssize_t result = get_entry_forwarder(&forwarder, ord);
if (result > 0 && !forwarder.empty()) {
return rust::String(forwarder.c_str());
} else {
return rust::String();
}
}
2 changes: 2 additions & 0 deletions idalib-sys/src/inf_extras.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,3 +393,5 @@ rust::String idalib_inf_get_strlit_pref() {
bool idalib_inf_get_cc(compiler_info_t *out) { return inf_get_cc(out); }

bool idalib_inf_get_privrange(range_t *out) { return inf_get_privrange(out); }

ea_t idalib_inf_get_imagebase() { return get_imagebase(); }
67 changes: 67 additions & 0 deletions idalib-sys/src/insn_extras.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#pragma once

#include "intel.hpp"
#include "ua.hpp"
#include "idp.hpp"

#include "cxx.h"

// SIB Decoding Functions (from intel.hpp)
// These extract individual fields from the SIB byte

int idalib_sib_base(const insn_t *insn, const op_t *op) {
return sib_base(*insn, *op);
}

int idalib_sib_index(const insn_t *insn, const op_t *op) {
return sib_index(*insn, *op);
}

int idalib_sib_scale(const op_t *op) {
return sib_scale(*op);
}

// High-level Helper Functions (also from intel.hpp)
// These handle both SIB and non-SIB cases automatically

int idalib_x86_base_reg(const insn_t *insn, const op_t *op) {
return x86_base_reg(*insn, *op);
}

int idalib_x86_index_reg(const insn_t *insn, const op_t *op) {
return x86_index_reg(*insn, *op);
}

int idalib_x86_scale(const op_t *op) {
return x86_scale(*op);
}

bool idalib_has_displ(const op_t *op) {
return has_displ(*op);
}

// Check for SIB byte presence
bool idalib_has_sib(const op_t *op) {
return op->hasSIB;
}

// Get the raw SIB byte value
uint8_t idalib_get_sib_byte(const op_t *op) {
return op->sib;
}

// Get instruction features from processor using itype
uint32_t idalib_get_canon_feature(uint16_t itype) {
processor_t *ph = (processor_t*)get_ph();
return ph->get_canon_feature(itype);
}

// Check if instruction modifies operand (wrapper for has_cf_chg)
bool idalib_has_cf_chg(uint32_t feature, uint32_t opnum) {
return has_cf_chg(feature, opnum);
}

// Check if instruction uses operand (wrapper for has_cf_use)
bool idalib_has_cf_use(uint32_t feature, uint32_t opnum) {
return has_cf_use(feature, opnum);
}
Loading