mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-08 14:50:54 +00:00
Reworked live packet capture for both hosts and interfaces
This commit is contained in:
parent
31e86bdcd3
commit
f16a39ef04
10 changed files with 170 additions and 256 deletions
|
|
@ -592,7 +592,11 @@ end
|
|||
end
|
||||
|
||||
if(host["json"] ~= nil) then
|
||||
print("<tr><th>"..i18n("download").." <i class=\"fa fa-download fa-lg\"></i></th><td colspan=2><A HREF='"..ntop.getHttpPrefix().."/lua/host_get_json.lua?ifid="..ifId.."&"..hostinfo2url(host_info).."'>JSON<A> / <A HREF='"..ntop.getHttpPrefix().."/lua/live_traffic.lua?ifid="..ifId.."&"..hostinfo2url(host_info).."'>pcap<A></td></tr>\n")
|
||||
print("<tr><th>"..i18n("download").." <i class=\"fa fa-download fa-lg\"></i></th><td colspan=2><A HREF='"..ntop.getHttpPrefix().."/lua/host_get_json.lua?ifid="..ifId.."&"..hostinfo2url(host_info).."'>JSON<A> ")
|
||||
|
||||
if(isAdministrator()) then
|
||||
print("/ <A HREF='"..ntop.getHttpPrefix().."/lua/live_traffic.lua?ifid="..ifId.."&"..hostinfo2url(host_info).."'>pcap<A></td></tr>\n")
|
||||
end
|
||||
end
|
||||
|
||||
if(host["ssdp"] ~= nil) then
|
||||
|
|
|
|||
|
|
@ -593,8 +593,10 @@ print("</script>\n")
|
|||
print("<td colspan=3> </td>")
|
||||
print("</tr>")
|
||||
end
|
||||
|
||||
|
||||
if (isAdministrator() and ifstats.isView == false and ifstats.isDynamic == false) then
|
||||
print("<tr><th>"..i18n("download").." <i class=\"fa fa-download fa-lg\"></i></th><td colspan=2><A HREF='"..ntop.getHttpPrefix().."/lua/live_traffic.lua?ifid="..ifId.."'>pcap<A></td></tr>\n")
|
||||
|
||||
print("<tr><th width=250>"..i18n("if_stats_overview.reset_counters").."</th>")
|
||||
print("<td colspan=5>")
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue