#read-write #memory #read-memory #reading #internal #external #function

easyrw

EasyRW — Rust 中的易用读写函数,外部和内部

13 个版本

0.2.2 2023年11月15日
0.2.1 2023年11月14日
0.1.9 2023年11月13日

6#read-memory

每月 49 次下载

MIT 许可证

14KB
246

EasyRW

在 Rust 中轻松读写内存。

安装

在您的项目目录中运行以下命令

cargo add easyrw

或者

将以下行添加到您的 Cargo.toml 中

easyrw = "0.2.2"

Assault Cube R/W 示例

use easyrw::memory::init;

fn main() {
    let proc = init("ac_client.exe", false).expect("Failed to attach to process"); //attach to process with false argument, means it will write memory externally, not internally, if ur making a dll then put it to true r/w internally
    let assault_cube = proc.get_assault_cube(proc.getbase("ac_client.exe")); // get assaultcube offsets, there is only 3 of them in this library just for example

    println!("HP: {}", proc.read::<i32>(assault_cube.hp)); // print hp
    println!("Nades: {}", proc.read::<i32>(assault_cube.nades)); // print grenades
    println!("Armor: {}", proc.read::<i32>(assault_cube.armor)); // print armor
}

总体 R/W 示例

use easyrw::memory::init;

fn main()  {
    let proc = init("ac_client.exe", false).expect("Failed to attach to process"); //attach to process with false argument, means it will write memory externally, not internally, if ur making a dll then put it to true r/w internally
    let base = proc.getbase("ac_client.exe"); // get module base
    proc.write(proc.get_ptr(base + 0x17E0A8, &[0xEC]), 104); // assault cube example: write 104 to hp address
}

一个糟糕的读取范围示例

use easyrw::memory::init;

fn main()  {
    let proc = init("ac_client.exe", false).expect("Failed to attach to process"); //attach to process with false argument, means it will write memory externally, not internally, if ur making a dll then put it to true r/w internally
    let base = proc.getbase("ac_client.exe"); // get module base
    if let Some(data) = proc.read_range::<i32>(
        proc.get_ptr(base + 0x17E0A8, &[0x108]),
        proc.get_ptr(base + 0x17E0A8, &[0x140]),
    ) {
        println!("data: {:?}", data);
    } else {
        println!("failed to read memory range");
    }
}

一个糟糕的写入范围示例

use easyrw::memory::init;

fn main()  {
    let proc = init("ac_client.exe", false).expect("Failed to attach to process"); //attach to process with false argument, means it will write memory externally, not internally, if ur making a dll then put it to true r/w internally
    let base = proc.getbase("ac_client.exe"); // get module base
    proc.write_range(proc.get_ptr(base + 0x17E0A8, &[0x108]), &[999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999]); // this is cursed but it will write from base + 0x17E0A8, &[0x108] to base + 0x17E0A8, &[0x140]
}

依赖项

~225KB