#hex #regex #byte #command-line-tool #leveraging #power #utility

app hexsearch

A CLI utility to search arbitrary bytes in files, by leveraging the power of regex crate in Rust

2 releases

0.1.1 Dec 11, 2022
0.1.0 Dec 4, 2022

#2 in #leveraging

Custom license

88KB
256 lines

hexsearch

A CLI utility to search arbitrary bytes in files, by leveraging the power of regex crate in Rust.

Install

This crate has been published onto crates.io, so you can use the following command to install hexsearch executable to ~/.cargo/bin directory:

cargo install hexsearch

Usage

hexsearch [OPTIONS] <bytes> <files>

The bytes to be searched can be in one of two formats:

  • individual bytes in hexadecimal separated by space: 1f 8b 08
  • hexadecimal value in one word prefixed with 0x: 0x1f8b08. This format will respect the --endian argument and it's big-endian by default

Multiple files can be searched in one go by passing in paths separated by space.

The search result will be printed in a style similar to hexdump(1) and you can set the line width by --width argument (default width: 16).

You can also print some extra lines before and after the search result by setting --context argument.

See hexsearch --help for full usage.

License

This project is licensed under MIT license.

Dependencies

~3–4MB
~69K SLoC