diff options
| author | itsme <itsme@xs4all.nl> | 2021-07-06 22:50:59 +0200 |
|---|---|---|
| committer | itsme <itsme@xs4all.nl> | 2021-07-06 22:50:59 +0200 |
| commit | ae5362ee71880cee2a986da15b47a5aa4c4368ce (patch) | |
| tree | 259db509dcfb54d30d3e9f1f3c4f1e248d093996 /hexdump.py | |
| parent | e9e4b7a5d53ca044f5efd325b9d25d2c72b1a2dc (diff) | |
crodump: added verbose dump, which prints all unreferenced datablocks. added --increment to scan for KOD shifts. support hex stdin data. added --struonly option.
Diffstat (limited to 'hexdump.py')
| -rw-r--r-- | hexdump.py | 9 |
1 files changed, 8 insertions, 1 deletions
| @@ -1,9 +1,16 @@ | |||
| 1 | import struct | 1 | import struct |
| 2 | from binascii import b2a_hex | 2 | from binascii import b2a_hex, a2b_hex |
| 3 | """ | 3 | """ |
| 4 | Simple hexdump, 16 bytes per line with offset. | 4 | Simple hexdump, 16 bytes per line with offset. |
| 5 | """ | 5 | """ |
| 6 | 6 | ||
| 7 | def unhex(data): | ||
| 8 | if type(data)==bytes: | ||
| 9 | data = data.decode('ascii') | ||
| 10 | data = data.replace(' ', '') | ||
| 11 | data = data.strip() | ||
| 12 | return a2b_hex(data) | ||
| 13 | |||
| 7 | def ashex(line): | 14 | def ashex(line): |
| 8 | return " ".join("%02x" % _ for _ in line) | 15 | return " ".join("%02x" % _ for _ in line) |
| 9 | def aschr(b): | 16 | def aschr(b): |
