Skip to content

Memory

Reading and writing is memory.readU32, memory.writeF32 and co. This page is the bigger tools.

Like Cheat Engine. memory.scan looks on a worker and gives the scan, then next narrows it.

import { memory } from "wraith";
const scan = await memory.scan({ type: "i32", value: 100 });
// Take a hit, then
await scan.next("decreased");
await scan.next("exact", 90);
const [health] = scan.results(1);

type is u8 to u64, i8 to i64, f32, f64, string, utf16 or bytes for a pattern like "48 8B ?? C3". Pass module or start and length to look in less. next takes exact, changed, unchanged, increased, decreased, greater, less or between with a low and a high. count says how many are left. Results are freed when the plugin stops, or with scan.destroy().

for (const r of memory.regions({ module: "game.exe" })) log.info(r.start, r.length, r.writable);
const old = memory.protect(address, 16, "read_write");

regions({ all: true }) lists memory you can’t read too. Wraith puts protection back when the plugin stops.

memory.watch uses one of the CPU’s four debug registers. The callback runs at the start of the next frame, with where the instruction is.

const watch = await memory.watch(health, 4, "write", (hit) => {
log.info("written by", hit.instruction, code.disassemble(hit.instruction)[0].text);
});
await watch.stop();

"read" only counts loads, and "access" is either.

Made with ♥ by Asgard