Reworked live packet capture for both hosts and interfaces

This commit is contained in:
Luca 2018-07-24 11:57:31 +02:00
parent 31e86bdcd3
commit f16a39ef04
10 changed files with 170 additions and 256 deletions

View file

@ -20,17 +20,23 @@ local function send_error(error_type)
print(json.encode({error = msg}))
end
local host = _GET["host"]
if isEmptyString(host) then
send_error("not_found")
interface.select(ifname)
local granted = true -- interface.requestLiveTraffic(host)
if not granted then
send_error("not_granted")
else
local granted = true -- interface.requestLiveTraffic(host)
if not granted then
send_error("not_granted")
else
sendHTTPContentTypeHeader('application/vnd.tcpdump.pcap', 'attachment; filename="'..host..'_live.pcap"')
interface.liveCapture(host)
local host = _GET["host"]
local fname = ifname
if(host ~= nil) then
fname = fname .. "_"..host
end
fname = fname .."_live.pcap"
sendHTTPContentTypeHeader('application/vnd.tcpdump.pcap', 'attachment; filename="'..fname..'"')
interface.liveCapture(host)
end