tmbinc / bgrep

Binary Grep
http://debugmo.de/2009/04/bgrep-a-binary-grep/
368 stars 57 forks source link

Add argument to invert query endianess #11

Open cirosantilli opened 7 years ago

cirosantilli commented 7 years ago

E.g.:

bgrep -i 4 0102030405060708

would invert endianess and be equivalent to:

bgrep 00403020108070605

The magic case -i 0 could invert the entire string to: 0807060504030201.

tmbinc commented 3 years ago

I think searching for numbers is an intriguing enough use-case to justify special treatment, however such an "-i" option has corner cases (non-multiple search string length) that makes the behavior a bit non-obvious.

I wonder if we should instead support something like "-i ", which adds "number" to the search string, and be something like {B,H,I,Q}, possible with a prefix to indicate endianness. We could then support multiple search strings (which are concatenated), so one could search for

bgrep -iI 0x12345 -iI 0x5678 

but also

bgrep -iI 0x12345 08070605

etc.