3 stable releases

1.0.2 Sep 16, 2024
1.0.1 Sep 15, 2024

#1545 in Algorithms

22 downloads per month

0BSD license

84KB
2K SLoC

Overview

aob (array of bytes) is a library for string searching with wildcards. It supports IDA-style patterns, const compiling patterns, and accelerating searches using simd whenever possible/practical.

The latest development docs are available at: https://ryan-rsm-mckenzie.github.io/aob-rs/aob/index.html

The stable release docs are available at: https://docs.rs/aob/latest/aob/

Changelogs are available at: https://github.com/Ryan-rsm-McKenzie/aob-rs/releases

Example

use aob::Needle as _;
aob::aob! { const NEEDLE = ida("67 ? AB"); }
let haystack = [0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF];
let found = NEEDLE.find(&haystack).unwrap();
assert_eq!(found.range(), 3..6);

lib.rs:

If you're looking to construct a pattern:

  • See aob! to construct a pattern at compile-time.
  • See DynamicNeedle to construct a pattern at run-time.

You'll need to use Needle before you can do anything with a pattern:

use aob::Needle as _;
aob::aob! { const NEEDLE = ida("67 ? AB"); }
let haystack = [0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF];
let found = NEEDLE.find(&haystack).unwrap();
assert_eq!(found.range(), 3..6);

Dependencies

~4.5MB
~76K SLoC