summaryrefslogtreecommitdiff
path: root/python/examples
diff options
context:
space:
mode:
authorAndrew Lamoureux <andrew@vector35.com>2019-03-21 20:43:40 -0400
committerAndrew Lamoureux <andrew@vector35.com>2019-03-21 20:43:40 -0400
commit86cea24d2bd727324a458a4ed282175353427028 (patch)
tree85848eab67528dbc12a49f8bb1bcb7207ed54f7e /python/examples
parenta6355074d451e9ba9b85f17bfcd7c273ec18ecfa (diff)
kaitai: recognize zip, rar, gzip
Diffstat (limited to 'python/examples')
-rw-r--r--python/examples/kaitai/kshelpers.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/python/examples/kaitai/kshelpers.py b/python/examples/kaitai/kshelpers.py
index d2e2f441..43b8e525 100644
--- a/python/examples/kaitai/kshelpers.py
+++ b/python/examples/kaitai/kshelpers.py
@@ -48,6 +48,12 @@ def idData(dataSample, length):
result = 'gif'
if dataSample[0:2] in [b'BM', b'BA', b'CI', b'CP', b'IC', b'PT'] and struct.unpack('<I', dataSample[2:6])[0]==length:
result = 'bmp'
+ if dataSample[0:2] == b'PK' and dataSample[2:4] in [b'\x01\x02', b'\x03\x04', b'\x05\x06']:
+ result = 'zip'
+ if dataSample[0:6] == b'Rar!\x1a\x07':
+ result = 'rar'
+ if dataSample[0:2] == b'\x1f\x8b' and dataSample[2:3]==b'\x08':
+ result = 'gzip'
#print('idData() returning \'%s\'' % result)
return result