User Guide

Lua Support in Wireshark
167
ips[tostring(pinfo.dst)] = dst + 1
end
-- this function will be called once every few seconds to update our window
function tap.draw(t)
tw:clear()
for ip,num in pairs(ips) do
tw:append(ip .. "\t" .. num .. "\n");
end
end
-- this function will be called whenever a reset is needed
-- e.g. when reloading the capture file
function tap.reset()
tw:clear()
ips = {}
end
end
-- using this function we register our function
-- to be called when the user selects the Tools->Test->Packets menu
register_menu("Test/Packets", menuable_tap, MENU_TOOLS)
end
11.4. Wireshark's Lua API Reference Manual
This Part of the User Guide describes the Wireshark specific functions in the embedded Lua.
11.5. Saving capture files
11.5.1. Dumper
11.5.1.1. Dumper.new(filename, [filetype], [encap])
Creates a file to write packets. Dumper:new_for_current() will probably be a better choice.
11.5.1.1.1. Arguments
filename The name of the capture file to be created
filetype (optional) The type of the file to be created
encap (optional) The encapsulation to be used in the file to be created
11.5.1.1.2. Returns
The newly created Dumper object
11.5.1.1.3. Errors
Not every filetype handles every encap
11.5.1.2. dumper:close()
Closes a dumper