Find HEX patterns and number of occurrences

I would like to find the templates and sort them by the number of occurrences in the HEX file that I have.

I'm not looking for any specific template, just to make some statistics about the events happening there and sort them.

DB0DDAEEDAF7DAF5DB1FDB1DDB20DB1BDAFCDAFBDB1FDB18DB23DB06DB21DB15DB25DB1DDB2EDB36DB43DB59DB32DB28DB2ADB46DB6FDB32DB44DB40DB50DB87DBB0DBA1DBABDBA0DB9ADBA6DBACDBA0DB96DB95DBB7DBCFDBCBDBD6DB9CDBB5DB9DDB9FDBA3DB88DB89DB93DBA5DB9CDBC1DBC1DBC6DBC3DBC9DBB3DBB8DBB6DBC8DBA8DBB6DBA2DB98DBA9DBB9DBDBDBD5DBD9DBC3DB9BDBA2DB84DB83DB7DDB6BDB58DB4EDB42DB16DB0DDB01DB02DAFCDAE9DAE5DAD9DAE2DAB7DA9BDAA6DA9EDAAADAC9DACADAC4DA92DA90DA84DA89DA93DAA9DA8CDA7FDA62DA53DA6EDA

This is an excerpt from a HEX file, and as an example I would like to get:

XX occurrences of BDBDBD

XX occurrences of B93D

Is there a way to open a file to create this output?

+3
source share
3 answers

. ( Perl, , , ). N-gram. .

+2

CS. , , / . . .

- , .

, , .

+1

You can use regular expressions to create a search pattern.

The necessary regular expression would be very simple. Just use the exact phrase you are looking for. Then there should be a regular expression function in the language you use (you did not specify) that can count the number of matches.

Use this to create a simple counter.

0
source

Source: https://habr.com/ru/post/1725662/


All Articles