Scan byte slices for patterns using IDA-style signatures or code-style byte/mask pairs. Zero dependencies. Designed to compose with procmod-core but works standalone on any &[u8].
Install
[]
= "1"
Quick start
Find a function signature in a game's memory after an update moves everything around:
use Pattern;
// the function starts with a known prologue, but the offset has changed
let sig = from_ida.unwrap;
let code_section: & = /* read from process memory */;
if let Some = sig.scan_first
Usage
IDA-style patterns
The most common format in game modding. Exact bytes as hex, ? or ?? for wildcards:
use Pattern;
let pattern = from_ida.unwrap;
let data = b"\x00\x48\x8B\xAA\xBB\x89\x05\x00";
assert_eq!;
Code-style patterns
Byte array with a separate mask string. x for exact, ? for wildcard:
use Pattern;
let pattern = from_code.unwrap;
Find all matches
scan returns every offset where the pattern matches, including overlapping matches:
use Pattern;
let nop_sled = from_ida.unwrap;
let data = b"\x90\x90\x90\x90";
assert_eq!;
Composing with procmod-core
Read a module's memory and scan for a known signature to find a function after a game update:
use Pattern;
// use procmod_core::Process;
Performance
Patterns with an exact byte prefix (no leading wildcards) use a fast-path scan that filters candidate positions by the first byte before verifying the full pattern. This is the common case for real-world signatures and provides significant speedup on large memory regions.
For best performance, prefer patterns that start with exact bytes rather than wildcards.
License
MIT