Mat reads another process's memory without attaching to it. It finds values, follows pointer chains and turns them into module-relative addresses that survive a restart. Mat supports Linux and Windows, including Windows programs under Wine.
mat write changes one value at a time and nothing else in the command modifies the target.
Writes only go to memory the target already has mapped writable, and the target is never stopped.
Caution
Anti-cheat software may detect mat and programs built on its library.
Avoid using it on protected programs, because even a fully sandboxed one can still be detected.
Use this program and library at your own discretion, because it comes with no warranty and its authors are not liable for what you do with it.
git clone https://github.com/HoppouDev/mat
cd mat
cargo build --releaseThe binary is target/release/mat.
Shell completions: mat completions bash (or zsh, fish, elvish, powershell).
On Linux the kernel checks a memory read like a ptrace attach, so with kernel.yama.ptrace_scope=1 reading a process that is not your child needs root or CAP_SYS_PTRACE, as the Yama documentation and process_vm_readv(2) describe:
sudo setcap cap_sys_ptrace=ep target/release/matRebuilding replaces the binary and drops the capability.
On Windows, processes of another user or a higher integrity level need mat to run elevated.
A target is a pid or a process name. Start a session with the value you can see, then narrow it as the value changes:
mat scan app eq 100 # f32 by default; -t i32, u8, f64, ...
mat filter eq 95 # after the value changed in the program
mat filter decreased
mat filter gt 0 # also ne, lt, range, changed, delta …
mat status # how many candidates are left
mat undo # step back if a filter went wrongFor a value you can't see, snapshot first and compare later:
mat scan app -t i32 unknown
mat filter changed
mat filter delta -1Sessions live in cands.txt (-c to choose another file).
Long scans log their progress to stderr each second.
A first scan stops at 10 million hits, so start a value that is everywhere (such as 0) with unknown and narrow it with filter.
A session refuses to continue if the process restarted and its pid was reused.
A value's address usually changes on every run. Find a pointer chain from a static address to it, then keep the chains that still work after a restart:
mat ptrscan app 0x7f12345678 --depth 4 # saves chains to paths.txt
# restart the program, find the value again, then:
mat ptrscan app 0x7f87654321 --verify # keeps only chains that still lead there
mat watch app '[[module.dll+0x1234]+0x10]+0x48' -n 3
mat watch app '[module.dll+0x1234]+0x10' '[module.dll+0x1234]+0x14' -t i32 # several at onceAddress expressions work everywhere an address is taken: 0x7f00, module.dll+0x10, and [x] to read the pointer at x.
mat resolve app '<expr>' prints each pointer the expression follows.
Code signatures survive rebuilds of the target better than offsets.
mat makesig makes them for a chain's static root from the code that uses it, and prints the mat sig command that finds the static again:
mat makesig app module.dll+0x1234 # a static: signatures at the code that names it
mat sig app module.dll "48 8B 05 ?? ?? ?? ?? 48 85 C0" --rip 3,7
mat disasm app module.dll+0x5678 -n 10 # read the code around a referenceSignatures wildcard displacements, branch offsets and addresses, and grow one instruction at a time until they match only once in the module (at most 100 bytes for code, 250 at a reference).
Every printed signature was checked to match once and lead back to the address.
32-bit code names statics by absolute address, so its signatures use --abs <offset> instead of --rip.
| Command | Use |
|---|---|
mat maps <target> |
Readable regions with permissions |
mat modules <target> |
Loaded modules with base and size |
mat ps [name] |
Processes with their command lines, or only those name matches |
mat read <target> <addr> |
Hex dump (?? where unreadable), or values with -t |
mat inspect <target> <addr> |
Each pointer-sized slot as its likely pointer, floats, integers or text |
mat disasm <target> <addr> |
x86 instructions with branch and data targets labelled |
mat write <target> <addr> <value> |
Write one value of -t type (default f32) |
mat find <target> <pattern> |
Byte patterns with ?? wildcards, or --text/--utf16 |
mat refs <target> <addr> |
Pointers into the bytes before addr |
mat dump <target> |
Every readable region to one file |
mat offset <file> <offset> |
Hex-editor offset in a dump to a process address |
--json prints results as JSON and logs go to stderr.
Caution
Dump and snapshot files contain the target's memory, which can include credentials.
Add it to your Cargo.toml from this repository:
[dependencies]
mat = { git = "https://github.com/HoppouDev/mat" }use mat::{Expr, Process};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let p = Process::open("4242".parse()?)?;
let expr: Expr = "[module.dll+0x1234]+0x10".parse()?;
let addr = p.resolve(&expr)?.addr;
let value: f32 = p.read(addr)?;
println!("{value}");
// Refused unless the target already has it mapped writable.
p.write(addr, &100.0f32)?;
Ok(())
}To decode a C struct, mirror its layout and derive Pod from mat::bytemuck:
use mat::Process;
use mat::bytemuck::{Pod, Zeroable};
#[repr(C)]
#[derive(Clone, Copy, Pod, Zeroable)]
#[bytemuck(crate = "mat::bytemuck")]
struct Entity {
pos: [f32; 3],
// A C bool.
alive: u8,
// Padding the C compiler adds must be spelled out.
_pad: [u8; 3],
// A pointer, which is u32 on 32-bit targets (`p.ptr_size()`).
next: u64,
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
let p = Process::open("4242".parse()?)?;
let e: Entity = p.read(0x7f00_0000_1000)?;
println!("{:?} {}", e.pos, e.alive);
Ok(())
}Use integers for bool, enums and pointers, since they aren't valid for every byte pattern, such as in the example crates/mat/examples/read_struct.rs.
Process is a cheap Clone + Send + Sync value, so run long operations on a worker thread and share an Arc<Progress> that the UI polls and cancels:
use std::sync::Arc;
use mat::{Cond, Process, Progress, ScanOptions, Value, ValueType};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let p = Process::open("4242".parse()?)?;
let progress = Arc::new(Progress::default());
let opts = ScanOptions {
progress: Some(Arc::clone(&progress)),
..Default::default()
};
let worker = std::thread::spawn(move || p.scan(ValueType::I32, &Cond::Eq(Value::I32(100)), &opts));
// Each frame shows progress.done() of progress.total(), and progress.cancel() stops the scan.
println!("{} of {} bytes", progress.done(), progress.total());
let hits = worker.join().expect("the scan thread does not panic")?;
println!("{} hits", hits.len());
Ok(())
}- Refresh a table of addresses with
p.read_values(&addrs, ty), which givesNonewhere an address is unreadable. - Draw hex views from
p.read_runs(addr, len), which also returns the readable runs. mat::processes()lists processes for a picker.- A GUI binary needs the same
setcapasmat(see Permissions).
mat-mcp lets an MCP client, such as an AI agent, use mat's reads, scans, pointer scans, disassembly and signatures: list_processes, list_modules, list_regions, read_memory, read_values, resolve, inspect, scan_start, scan_filter, scan_undo, scan_results, find, find_refs, pointer_scan, pointer_verify, disassemble, find_code_refs and make_signature.
It never writes to the target.
cargo build --release
sudo setcap cap_sys_ptrace=ep target/release/mat-mcpAdd it to your client as a stdio server, for example {"command": "/path/to/mat/target/release/mat-mcp"}.
It speaks MCP 2026-07-28 and also serves 2025-11-25 clients.
Check that it can read a target when your client starts it, because a sandbox that sets no_new_privs drops file capabilities.
Caution
Everything a tool returns goes to the model provider. A call returns at most 4 KiB of target memory and there is no dump tool, but that memory can still hold secrets, so only point it at programs whose memory you would share.
See AGENTS.md for the rules every change follows and the layout, and STYLE.md for how code, comments and docs are written.
cargo test runs on Linux and on Windows.
On Linux, cargo test --target x86_64-pc-windows-gnu runs the Windows build under Wine.
It needs that Rust target and x86_64-w64-mingw32-gcc.