Option<T> and Result<T, E> types for safe error handling, and all memory management is handled automatically.
Installation
Add libmem to yourCargo.toml:
fetch feature will automatically download and link the appropriate libmem binary for your platform. No manual installation required!
Cargo Features
fetch(default): Automatically downloads libmem binariesstatic: Links against statically installed libmem (requires system installation)
Importing
Basic Usage
Finding Processes and Modules
Memory Scanning
Reading and Writing Memory
Complete Example: God Mode Hack
Pointer Scans (Deep Pointers)
Assembly and Disassembly
Assembling Instructions
Disassembling Instructions
Function Hooking
Key Functions
Process Management
| Function | Return Type | Description |
|---|---|---|
find_process(name) | Option<Process> | Find process by name |
get_process() | Option<Process> | Get current process |
is_process_alive(&process) | bool | Check if process is alive |
enum_processes() | Option<Vec<Process>> | List all processes |
Module Management
| Function | Return Type | Description |
|---|---|---|
find_module(name) | Option<Module> | Find module in current process |
find_module_ex(&proc, name) | Option<Module> | Find module in target process |
enum_modules() | Option<Vec<Module>> | List modules in current process |
enum_modules_ex(&proc) | Option<Vec<Module>> | List modules in target process |
load_module(path) | Option<Module> | Load a module/library |
Memory Operations
| Function | Return Type | Description |
|---|---|---|
read_memory(addr, buf) | Option<usize> | Read memory in current process |
read_memory_ex(&proc, addr, buf) | Option<usize> | Read memory in target process |
write_memory(addr, data) | Option<usize> | Write memory in current process |
write_memory_ex(&proc, addr, data) | Option<usize> | Write memory in target process |
alloc_memory(size, prot) | Option<usize> | Allocate memory |
free_memory(addr, size) | bool | Free allocated memory |
prot_memory(addr, size, prot) | Option<Prot> | Change memory protection |
Scanning
| Function | Return Type | Description |
|---|---|---|
sig_scan(sig, addr, size) | Option<usize> | Signature scan in current process |
sig_scan_ex(&proc, sig, addr, size) | Option<usize> | Signature scan in target process |
pattern_scan(pattern, mask, addr, size) | Option<usize> | Pattern scan with mask |
data_scan(data, addr, size) | Option<usize> | Scan for exact bytes |
deep_pointer(base, offsets) | usize | Resolve pointer chain |
deep_pointer_ex(&proc, base, offsets) | Option<usize> | Resolve pointer chain in target process |
Assembly/Disassembly
| Function | Return Type | Description |
|---|---|---|
assemble(code) | Option<Inst> | Assemble single instruction |
assemble_ex(code, arch, addr) | Option<Vec<u8>> | Assemble multiple instructions |
disassemble(addr) | Option<Inst> | Disassemble single instruction |
disassemble_ex(addr, arch, max_size, count, runtime_addr) | Option<Vec<Inst>> | Disassemble multiple instructions |
Hooking
| Function | Return Type | Description |
|---|---|---|
hook_code(from, to) | Option<Trampoline> | Hook a function |
unhook_code(from, trampoline) | bool | Remove a hook |
Type Reference
Error Handling
Rust bindings useOption<T> for functions that may fail:
See Also
- C/C++ Bindings - C and C++ language bindings
- Python Bindings - Python language bindings
- API Reference - Complete API documentation