-- -- (C) 2013-18 - ntop.org -- local dirs = ntop.getDirs() package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path require "lua_utils" sendHTTPContentTypeHeader('text/html') ntop.dumpFile(dirs.installdir .. "/httpdocs/inc/header.inc") dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua") select = _GET["select_clause"] where = _GET["where_clause"] maxhits = _GET["maxhits_clause"] begin_time = _GET["begin_time_clause"] end_time = _GET["end_time_clause"] if(_GET["flow_clause"] == "aggregated_flows") then aggregated_flows = true else aggregated_flows = false end if(where == nil) then where = "" end if((select == nil) or (select == "")) then select = "*" end if((maxhits == nil) or (maxhits == "")) then maxhits = "10" end if((begin_time == nil) or (begin_time == "")) then begin_time = "now-1h" end if((end_time == nil) or (end_time == "")) then end_time = "now" end -- Zap spaces select = select:gsub("%s+", "") -- where = where:gsub("%s+", "") print('
') print [[ ]] res = interface.nIndexSelect(aggregated_flows, begin_time, end_time, select, where, 0, tonumber(maxhits)) --tprint(res) if(res) then if(type(res) == "string") then print("ERROR: "..res.."") else if(res.info.duration == 0) then res.info.duration = " < 1" end print("
Query perfomed in "..res.info.duration.." msec
")
print("
| "..row.." | ") end print("|
|---|---|
| "..k.." | ") for k, v in pairs(row) do print(""..v.." | ") end print("