I have a program which makes binary substitutions to a file. As part of this program a regular expression match object is created to match the binary to be substituted. This is in the form:
a = re.compile(b"|".join([list_of_hex_to_be_substituted])
This object is then printed for debugging purposes. However, when it is printed I encounter the issue that python substitutes some hex values for their ascii equivalents and leaves some alone. In an extreme example this can result in issues like
print(b"\x01\x00\x5C\x78\x33\x34")
--> b"\x01\x00\\x34
as 5C 78 33 34 in ascii is \x34. This is extremely confusing when debugging the script. What I am looking for is a way to simply print the hex as hex (no ascii substiution)