Any way to use cmd tshark for a gns3 wire?
I have a basic lua script that I need to use on a gns3 wire, but I can't get there from the windows cmd. Any advise?
packets = 0;
retrans = 0;
local function init_listener()
local tap = Listener.new("tcp")
function tap.reset()
packets = 0;
end
function tap.packet(pinfo,tvb,ip)
packets = packets + 1
end
-- retransmission, total
local retrans_tap = Listener.new("frame", "tcp.analysis.retransmission")
function retrans_tap.reset()
retrans = 0
end
function retrans_tap.packet(pinfo, tvb, ip)
retrans = retrans + 1
end
function retrans_tap.draw()
file = io.open("log.txt", "a")
file:write("packets ",packets,"\n","retrans ",retrans, "\n","ratio ",retrans/packets, "\n")
io.close(file)
-- change "> n" for tcp retransmission threshold
if retrans/packets > .03 then
alert_file = io.open("alert.txt","a")
alert_file:write(retrans/packets," @ ",os.time(os.date("!*t")), "\n")
io.close(alert_file)
end
end
end
init_listener()
My batch file
> set loopcount=5 :loop tshark -X
> lua_script:hello2.lua -i 3 -a
> duration:10 -J "tcp" > temp.txt set /a
> loopcount=loopcount-1 if
> %loopcount%==0 goto exitloop goto loop
> :exitloop
I might be able to run in from a ubuntu VM in GNS3. Need to test that, but I would appreciate another way.