How to decompress zlib format package in dissector? [closed]
I wrote a dissector. I need to decompress zlib format package when analyzing data. I have tried:
- local zlib = require("zlib") - got an error saying the package was not found;
- local zlib = require("zlib1") - got an error saying it was not a valid dll.
Currently, I am using a solution of calling Python code, but this is very inefficient. Some of my code is as follows:
local compressed_data = buffer(40, data_length - 36)
local compressed_hex = tostring(compressed_data:bytes():tohex())
local handle = io.popen("python -c \"import zlib,binascii,sys;print(zlib.decompress(binascii.unhexlify(sys.argv[1])).decode('utf-8'))\" " .. compressed_hex, "r")
local content = handle:read("*a")
handle:close()
Could you please tell me how to solve this problem?