mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 23:49:33 +00:00
Pops-up a window to download flows (and prevents page changes to be lost)
This commit is contained in:
parent
7b1e38cc6e
commit
05c1209310
3 changed files with 26 additions and 8 deletions
|
|
@ -57,7 +57,24 @@ res = getInterfaceTopFlows(ifId, ip_version, host, (l7proto or ""), (l4proto or
|
|||
|
||||
if(format == "txt") then
|
||||
-- TXT
|
||||
sendHTTPHeader('text/plain; charset=iso-8859-1')
|
||||
local filename="ntopng_flows"
|
||||
if ip_version ~= nil then filename = filename.."_IPv"..ip_version end
|
||||
if host then filename = filename .."_host_"..getPathFromKey(host) end
|
||||
if l4proto then filename = filename .."_l4proto_"..l4ProtoToName(l4proto) end
|
||||
if l7proto then
|
||||
local protos = {}
|
||||
for proto_name, proto_id in pairs(interface.getnDPIProtocols()) do
|
||||
protos[proto_id] = proto_name
|
||||
end
|
||||
local l7proto_label = l4proto
|
||||
if protos[l7proto] ~= nil then l7proto_label = protos[l7proto] end
|
||||
filename = filename .."_l7proto_"..l7proto_label
|
||||
end
|
||||
if port then filename = filename .."_port_"..tostring(port) end
|
||||
if epoch_begin ~= nil then filename = filename.."_from_"..string.gsub(formatEpoch(epoch_begin), ' ', '-') end
|
||||
if epoch_end ~= nil then filename = filename.."_to_"..string.gsub(formatEpoch(epoch_end), ' ', '-') end
|
||||
filename = filename..".txt"
|
||||
sendHTTPHeader('text/plain; charset=iso-8859-1', 'attachment; filename="'..filename..'"')
|
||||
local num = 0
|
||||
for _,flow in pairs(res) do
|
||||
if(num == 0) then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue