bitgrep
It's grep for data types. Ever found yourself looking for a specific numerical value/range in a heap of binary files?
Now you can!
Useful for DFIR, security research and general debugging work, especially when you know what you're looking for but don't know where.
Usage
You can run the CLI binary either through cargo run
:
The above command finds all the doubles (f64
) with values 29.15 <= x <= 36.0
.
Alternatively, you can build a binary:
and then run the binary:
In order to find a single literal value you can use the --literal
or -l
flag.
Float comparison is approximate with a ULPS of 4 (will be configurable in the future):
Currently there is no native support for directory globbing or recursion, if you need to search multiple files you can use the find
command:
Supported Types
Currently bitgrep supports all rust numeric data types (use with --data-type
):
Rust | C |
---|---|
i16 | short |
i32 | long |
i64 | long long |
i128 | __int128 (GCC) |
u16 | unsigned short |
u32 | unsigned int |
u64 | unsigned long |
u128 | unsigned __int128 |
f32 | float |
f64 | double |
TODO
[!WARNING]
Everything below this point does not exist yet!
Feel free to send pull requests, hopefully I'll get to these before 2026
- Filter files by entropy
- Color output
- Hex dump output
- Literals search
- Hex search (e.g.
0AAD[33-4A]DF
) - Exclude zeros and special valus (
NaN
, Infinty) - Sane error messages
- Recursive file search / glob
- Date types
- 32-bit/64-bit Unix epoch (milliseconds, microseconds, seconds)
- Windows
- FILETIME
- SYSTEMTIME
- OLE automation
- CLR Time
- Apple timestamps
- String Search
- UTF-8
- UTF-16
- ASCII code pages
- Search string representations of number range: e.g. "10.2" .. "10.722"
- Regex
- Performance improvements
- Convert to static dispatch
- Rule engine, see below
- Misc
- GUIDs
- IP addresses
- Custom structs
Rule engine
TODO: An imagined JSON of a rules file that can be used as a search configuration.
The idea is to have predefined rules for specific scenarios and some level of boolean operators for better filtering.
For example, get me all IPs in binary or string form in the ranges 192.168.1.0 - 192.168.3.255
or 10.0.0.1 - 10.0.30.255