Surely there's got to be a better way to dump out the JSON text that this?
...Stu
do
local json_fe = Field.new("json")
local tap = Listener.new("http", "http.content_type contains \"json\"")
function decode(c)
return string.char(tonumber(c, 16))
end
function tap.reset()
end
function tap.packet(pinfo, tvb, ip)
local json = json_fe()
-- The extra ()s in the next line is to discard the second returned value from gsub
-- We only want to output the json object
print((tostring(json.value):gsub("(%x%x)", decode)))
end
function tap.draw()
end
end
asked 08 Dec ‘11, 00:51
studog
16●2●2●4
accept rate: 0%