A program to find regex patterns in binary files.
This solution includes:
- My own binary regex pattern and binary regex matcher
- A
Main.pyfile for handling tthe program - A utilities file
The RegEx are binary and in Hexadecimal, this means that characters come in groups of two.
For Example: Unlike in normal RegEx, in the pattern "AA+" the "+" character relates to the preceding "AA".
All Regex expressions passed as arguments to the program must be in that format.
XX?-XXdoesn't have tto appear, butt can appear onceXX*- Matches at least 0 repetitions ofXXXX+- Matches at least 1 repetition ofXXXX{a}- Matches exactlyaoccurrences ofXXXX{a,b}- Matches betweenaandboccurrences ofXX.- Matches any byte[]- Capture group[XXYY]- next byte can be eitherXXorYY[XX-YY]- next byte can be antything betweenXXandYY[ZZXX-YY]- next byte can be antything betweenXXandYY, or it can beZZ[^XX]- negated set, acceptts all possible values but those in the set (here every byte butXXwill be acceptted)
()- Sub-pattern, a nestted regex patttern. Modifiers after this pattern relate to the entire sub-pattern.
The output format is a list of objects.
Each object represents one occurence of a regular expression in the format:
{
"length": "int",
"name": "string",
"indices": {
"start": "int",
"end": "int"
}
}