summaryrefslogtreecommitdiff
path: root/hexdump.py
diff options
context:
space:
mode:
authoritsme <itsme@xs4all.nl>2021-07-06 22:50:59 +0200
committeritsme <itsme@xs4all.nl>2021-07-06 22:50:59 +0200
commitae5362ee71880cee2a986da15b47a5aa4c4368ce (patch)
tree259db509dcfb54d30d3e9f1f3c4f1e248d093996 /hexdump.py
parente9e4b7a5d53ca044f5efd325b9d25d2c72b1a2dc (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.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/hexdump.py b/hexdump.py
index c119b16..aeb8c88 100644
--- a/hexdump.py
+++ b/hexdump.py
@@ -1,9 +1,16 @@
1import struct 1import struct
2from binascii import b2a_hex 2from binascii import b2a_hex, a2b_hex
3""" 3"""
4Simple hexdump, 16 bytes per line with offset. 4Simple hexdump, 16 bytes per line with offset.
5""" 5"""
6 6
7def 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
7def ashex(line): 14def ashex(line):
8 return " ".join("%02x" % _ for _ in line) 15 return " ".join("%02x" % _ for _ in line)
9def aschr(b): 16def aschr(b):