local tap =Listener.new("frame", "tcp.port == 443")
--frame是监听器的名称,tcp是wireshark过滤器规则
function tap.reset()
print("tap reset")
end
function tap.packet(pinfo,tvb)
--回调函数,每收到一个包执行一次。
local tcpStream = getTcpStream()
local srcIp = getSrcIp()
local dstIp = getDstIp()
local srcPort = getSrcPort()
local dstPort = getDstPort()
local ipVersion = getIpVersion()
local tcpStreamNumber =tonumber(tostring(tcpStream))
if(tcpStreamTable[tcpStreamNumber])
then
dataWriterTable[tcpStreamNumber]:dump_current()
else
local packetTuple4 =tostring(tcpStream).."_"..tostring(srcIp).."_"..tostring(srcPort).."_"..tostring(dstIp).."_"..tostring(dstPort).."_"..tostring(ipVersion)..".pcap"