Crates.io | dobby-rs |
lib.rs | dobby-rs |
version | 0.1.0 |
source | src |
created_at | 2022-03-16 09:25:29.830817 |
updated_at | 2022-03-16 09:25:29.830817 |
description | A rust binding for Dobby |
homepage | |
repository | https://github.com/black-binary/dobby-rs/ |
max_upload_size | |
id | 551036 |
size | 18,164 |
Dobby is a lightweight, multi-platform, multi-architecture exploit hook framework.
This crate is a rusty binding of Dobby.
Caution: Hooking is NOT SAFE! Use at your own risk.
use dobby_rs::{resolve_symbol, hook, Address};
use std::mem::transmute;
#[inline(never)]
#[no_mangle]
extern "C" fn add(a: u64, b: u64) -> u64 {
a + b
}
#[inline(never)]
#[no_mangle]
extern "C" fn sub(a: u64, b: u64) -> u64 {
a - b
}
unsafe {
let addr = add as usize as Address;
let replace = sub as usize as Address;
let origin = hook(addr, replace).unwrap();
let origin: extern "C" fn(u64, u64) -> u64 = transmute(origin);
assert_eq!(origin(2, 1), 2 + 1);
assert_eq!(add(2, 1), 2 - 1);
}
Android
MacOS
Linux