summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2016-12-21 19:54:17 +0100
committerPeter Wu <peter@lekensteyn.nl>2016-12-21 19:54:17 +0100
commitd38853303b006c5589ca6c6bf95552c445811d4a (patch)
tree465cec7c724fcb3635d719b47077c0ebc75aac03
parent4cf5244930314aa1051ed1a473bef601d6ba9ba6 (diff)
downloadwireshark-notes-d38853303b006c5589ca6c6bf95552c445811d4a.tar.gz
file-zip: Deflate decompression support
-rw-r--r--lua/file-zip.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/lua/file-zip.lua b/lua/file-zip.lua
index 70b866d..94be826 100644
--- a/lua/file-zip.lua
+++ b/lua/file-zip.lua
@@ -86,6 +86,7 @@ make_fields("zip_archive", {
filename = {ProtoField.string},
extra = extra_def,
data = {ProtoField.bytes},
+ data_uncomp = {ProtoField.bytes},
data_desc = {
_ = {ProtoField.none, "Data descriptor"},
crc32 = {ProtoField.uint32, base.HEX},
@@ -222,6 +223,7 @@ local function dissect_one(tvb, offset, pinfo, tree)
subtree:add_le(hf.entry.size_uncomp, tvb(offset + 22, 4))
subtree:add_le(hf.entry.filename_len, tvb(offset + 26, 2))
subtree:add_le(hf.entry.extra_len, tvb(offset + 28, 2))
+ local comp_method = tvb(offset + 8, 2):le_uint()
local flag = tvb(offset + 6, 2):le_uint()
local data_len = tvb(offset + 18, 4):le_uint()
local filename_len = tvb(offset + 26, 2):le_uint()
@@ -245,6 +247,13 @@ local function dissect_one(tvb, offset, pinfo, tree)
end
if data_len and data_len > 0 then
subtree:add(hf.entry.data, tvb(offset, data_len))
+ -- Try to decompress Deflate
+ if comp_method == 8 then
+ local data_tvb = tvb(offset, data_len):uncompress("Decompressed data")
+ if data_tvb then
+ subtree:add(hf.entry.data_uncomp, data_tvb)
+ end
+ end
offset = offset + data_len
end
-- Optional data descriptor header