| Crates.io | fishhook |
| lib.rs | fishhook |
| version | 0.1.1 |
| created_at | 2025-05-30 09:19:09.218714+00 |
| updated_at | 2025-05-30 09:25:48.718864+00 |
| description | A library that enables dynamically rebinding symbols in Mach-O binaries at runtime |
| homepage | https://github.com/blkmlk/fishhook-rs |
| repository | https://github.com/blkmlk/fishhook-rs |
| max_upload_size | |
| id | 1694853 |
| size | 13,749 |
A Rust port of fishhook — a library that enables dynamically rebinding symbols
in Mach-O binaries at runtime. Useful for intercepting system functions like malloc, free, or open on Apple
platforms.
Platform support: Currently tested only on macOS (aarch64-apple-darwin)
Add to your Cargo.toml:
[dependencies]
fishhook = "0.1"
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 c_void,
},
Rebinding {
name: "calloc".to_string(),
function: my_calloc as *const c_void,
},
Rebinding {
name: "realloc".to_string(),
function: my_realloc as *const c_void,
},
Rebinding {
name: "free".to_string(),
function: my_free as *const c_void,
},
Rebinding {
name: "atexit".to_string(),
function: my_exit as *const c_void,
},
]);
}
}
License: MIT