bmatcher

Crates.iobmatcher
lib.rsbmatcher
version
sourcesrc
created_at2024-11-30 19:47:56.819961
updated_at2024-12-10 16:32:26.739218
descriptionbmatcher is a flexible and efficient binary pattern matching library designed to help you search and match binary data.
homepage
repositoryhttps://github.com/WolverinDEV/bmatcher
max_upload_size
id1466928
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
(WolverinDEV)

documentation

README

bmatcher - Your Easy Binary Pattern Matcher   Latest Version License: GPL v3 GitHub build status

bmatcher is a flexible and efficient binary pattern matching library designed to help you search and match binary data.

Motivation

Reverse engineering is challenging. When you identify an interesting address, such as a function or global variable, you don't want to lose all that effort when the program is updated.

The good news is that, during updates, programs usually don't change drastically. While some functions and data may be altered, much of the program remains unchanged. However, this means that the unchanged parts might be moved to different addresses.

This is where patterns come in. Patterns allow you to track these interesting parts of a program, even as it evolves and updates. By using patterns, you can identify specific functions, data references, or other critical locations, regardless of where they end up after a program update.

Getting Started

To use bmatcher, add it as a dependency in your Cargo.toml:

[dependencies]
bmatcher = "0.1"

Creating a pattern

An exhausive overview of the pattern syntax and operads can be found here.

Basic Usage

Here's a simple example demonstrating how to use bmatcher to match a call signature binary pattern:

let data: &[u8] = ...;
let pattern = pattern!("
    /*
     * call my_function
     * $ = follow 4 byte relative jump
     * ' = save cursor position to the matched stack
     */
    E8 $ { ' }

    /* mov QWORD PTR [rsp], rax */
    48 89 04 24

    /* jmp somewhere */
    E9 [4]
");

let mut matcher = BinaryMatcher::new(&pattern, &data);
let Some(match_stack) = matcher.next_match() else {
    panic!("failed to find pattern");
};

println!("Matched at location 0x{:X}", match_stack[0]);
println!("Target function located at 0x{:X}", match_stack[1]);
Commit count: 27

cargo fmt