mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 16:09:32 +00:00
Implemented multiple-pcap file download and monitor
This commit is contained in:
parent
c5fec0d13e
commit
30e22c3a71
13 changed files with 157 additions and 109 deletions
|
|
@ -3,23 +3,43 @@
|
|||
--
|
||||
|
||||
dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
-- io.write ("Session:".._SESSION["session"].."\n")
|
||||
require "lua_utils"
|
||||
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
require "lua_utils"
|
||||
local format_utils = require "format_utils"
|
||||
local json = require "dkjson"
|
||||
|
||||
interface.select(ifname)
|
||||
|
||||
sendHTTPContentTypeHeader('text/html')
|
||||
sendHTTPHeader('application/json')
|
||||
|
||||
ntop.dumpFile(dirs.installdir .. "/httpdocs/inc/header.inc")
|
||||
local result = {}
|
||||
|
||||
active_page = "home"
|
||||
dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua")
|
||||
local perPage = 5
|
||||
local currentPage = 1
|
||||
local total_rows = 1
|
||||
|
||||
result["perPage"] = perPage
|
||||
result["currentPage"] = currentPage
|
||||
local lc = interface.dumpLiveCaptures()
|
||||
local res = {}
|
||||
|
||||
|
||||
local rc = interface.dumpLiveCaptures()
|
||||
for k,v in pairs(lc) do
|
||||
local host = ""
|
||||
local num_captured_packets = format_utils.formatValue(v.num_captured_packets)
|
||||
local capture_max_pkts = v.capture_max_pkts
|
||||
local diff = v.capture_until - os.time()
|
||||
local capture_until = format_utils.formatEpoch(v.capture_until).." [ - "..diff.." sec ]"
|
||||
local stop_href = "<A HREF=".. ntop.getHttpPrefix() .."/lua/stop_live_capture.lua?capture_id="..v.id.."><span class=\"label label-danger\">Stop <i class=\"fa fa-download\"></i></span></A>"
|
||||
|
||||
if(v.host ~= nil) then host = v.host end
|
||||
res[#res + 1] = { host = host, num_captured_packets = num_captured_packets, capture_until = capture_until, stop_href = stop_href }
|
||||
end
|
||||
|
||||
result["data"] = res
|
||||
result["totalRows"] = #res
|
||||
|
||||
ntop.dumpFile(dirs.installdir .. "/httpdocs/inc/footer.inc")
|
||||
result["sort"] = {{sortColumn, sortOrder}}
|
||||
|
||||
print(json.encode(result))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue