1 unstable release

0.1.0 Mar 16, 2022

#5 in #pwn

Download history 9/week @ 2024-11-20 18/week @ 2024-11-27 39/week @ 2024-12-04 29/week @ 2024-12-11 25/week @ 2024-12-18 4/week @ 2024-12-25 12/week @ 2025-01-01 118/week @ 2025-01-08 99/week @ 2025-01-15 29/week @ 2025-01-22 107/week @ 2025-01-29 64/week @ 2025-02-05 155/week @ 2025-02-12 55/week @ 2025-02-19 38/week @ 2025-02-26 22/week @ 2025-03-05

274 downloads per month

Apache-2.0

7KB
69 lines

dobby-rs

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.

Quickstart

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);
}

Supported Target

  • Android

    • x86
    • x86_64
    • armv7
    • aarch64
  • MacOS

    • x86_64
    • aarch64
  • Linux

    • (WIP) x86
    • x86_64

lib.rs:

This crate is a rusty binding of Dobby.

Quickstart

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);
}

Dependencies

~3MB
~16K SLoC