Finds part of one binary file inside another
- gcc
- make
- libboost-dev
- libboost-iostreams-dev
- libboost-program-options-dev
make
$ findbytes
Allowed options:
--help produce help message
--pf arg pattern file name
--tf arg file to search
--ps arg (=0) offset into pattern file to start
--pe arg (=18446744073709551615) offset into pattern file to end
--ts arg (=0) offset into target file to begin search
--te arg (=18446744073709551615) offset into target file to end search
--verbose describe what is happening
Example:
$ echo "foo" > foo.txt
$ echo "12341234ooxyzzy" > tgt.txt
$ findbytes foo.txt tgt.txt # "foo" does not exist in tgt.txt
$ findbytes foo.txt tgt.txt --ps 1 # still no match on "oo\n" due to newline at the end
$ findbytes foo.txt tgt.txt --ps 1 --pe 3 # now we match on "oo"
8
$ echo -n "foo" > foo.txt
$ findbytes foo.txt tgt.txt --ps 1 # no longer a newline in foo.txt, so we match on "oo"
8
Most credit goes to dubnde's stackexchange posting