4 releases (2 breaking)
| 0.3.0 | Feb 24, 2026 |
|---|---|
| 0.2.0 | Feb 22, 2026 |
| 0.1.1 | May 30, 2025 |
| 0.1.0 | May 30, 2025 |
#123 in macOS and iOS APIs
Used in 2 crates
17KB
324 lines
fishhook
fishhook-rs
A Rust port of fishhook — a library that enables dynamically rebinding symbols
for Linux and Mach-O binaries at runtime. Useful for intercepting system functions like malloc, free, or open.
Platform support: Currently tested on Linux (x86_64) and macOS (aarch64-apple-darwin)
Installation
Add to your Cargo.toml:
[dependencies]
fishhook = "0.3"
Usage
Example below uses ctor for invoking init() first
use fishhook::{register, Rebinding};
#[ctor::ctor]
fn init() {
unsafe {
register(vec![
Rebinding {
name: "malloc".to_string(),
function: my_malloc as *const () as usize,
},
Rebinding {
name: "calloc".to_string(),
function: my_calloc as *const () as usize,
},
Rebinding {
name: "realloc".to_string(),
function: my_realloc as *const () as usize,
},
Rebinding {
name: "free".to_string(),
function: my_free as *const () as usize,
},
]);
}
}
License: MIT
Dependencies
~0–485KB