Using grep to search for hex strings in a file

后端 未结 6 2071
野趣味
野趣味 2020-12-04 17:46

I have been trying all day to get this to work. Does anyone know how to get grep, or something of the like, to retrieve offsets of hex strings in a file?

I have a bu

6条回答
  •  余生分开走
    2020-12-04 18:49

    There's also a pretty handy tool called binwalk, written in python, which provides for binary pattern matching (and quite a lot more besides). Here's how you would search for a binary string, which outputs the offset in decimal and hex (from the docs):

    $ binwalk -R "\x00\x01\x02\x03\x04" firmware.bin
    DECIMAL     HEX         DESCRIPTION
    --------------------------------------------------------------------------
    377654      0x5C336     Raw string signature
    

提交回复
热议问题