8 个版本 (4 个重大更新)

0.8.0 2022 年 5 月 5 日
0.7.1 2022 年 4 月 26 日
0.6.1 2022 年 2 月 18 日
0.4.0 2022 年 2 月 7 日
0.3.1 2022 年 2 月 4 日

#35 in #hacking

Download history 1/week @ 2024-03-10 28/week @ 2024-03-31 2/week @ 2024-04-07

每月 79 次下载

MIT 许可证

79KB
2K SLoC

Faithe

适用于 Windows 的内存黑客库。

安装

# Latest version
[dependencies]
faithe = "0.7.0"

# Development version
[dependencies.faithe]
git = "https://github.com/sy1ntexx/faithe"

打开进程

use faithe::types::access_rights::PROCESS_ALL_ACCESS;
use faithe::process as ps;

let process = ps::Processes::new()?
    .find(|p| p.sz_exe_file == "Process name.exe")
    .unwrap()
    .open(false, PROCESS_ALL_ACCESS)?;

模块迭代

let process = get_process();
process
    .modules()?
    .for_each(|m| dbg!(m));

读取 / 写入内存

let process = get_process();
let mut value = process.read::<u32>(0xFF)?;
value += 100;

process.write(0xFF, value)?;

分配 / 释放 / 保护 / 查询内存

use faithe::types::allocation_types::{MEM_COMMIT, MEM_RESERVE};
use faithe::types::free_types::MEM_RELEASE;
use faithe::memory::MemoryProtection;

let process = get_process();
let mut chunk = process.allocate(
    0,
    1000,
    MEM_COMMIT | MEM_RESERVE,
    MemoryProtection::READ_WRITE_EXECUTE
)?;
let info = process.query(chunk)?;

process.protect(chunk, 1000, MemoryProtection::Read)?;
process.free(chunk, 0, MEM_RELEASE)?;

搜索模式

use faithe::pattern::Pattern;

let process = get_process();
let address = process.find_pattern(
    "Something.exe",
    // Available styles: IDA, Code, PiDB
    Pattern::from_ida_style("48 89 85 F0 00 00 00 4C 8B ? ? ? ? ? 48 8D")
)?;

use faithe::{interface, xstruct};

// Creates a trait that will emulate behavior of virtual functions in C++.
struct CPlayer;
interface! {
    trait IEntity(CPlayer) {
        extern "C" fn get_health() -> i32 = 0;
        extern "C" fn set_health(new: i32) = 1;
    }
}
/*
class CPlayer {
    virtual int get_health() = 0;
    virtual void set_health(int new_value) = 0;
};
*/

// Creates a function with explicitly defined RVA relative to some module.
function! {
    // Explicitly defined RVA offset relative to `01-hello` module.
    extern FUNC: extern "C" fn(a: i32) = "01-hello.exe"@0x1900;
}
FUNC.call(5);

依赖项

~14–52MB
~842K SLoC