--
-- (C) 2013-17 - ntop.org
--
dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
if((dirs.scriptdir ~= nil) and (dirs.scriptdir ~= "")) then package.path = dirs.scriptdir .. "/lua/modules/?.lua;" .. package.path end
require "lua_utils"
require "prefs_utils"
require "blacklist_utils"
if(ntop.isPro()) then
package.path = dirs.installdir .. "/scripts/lua/pro/?.lua;" .. package.path
end
sendHTTPHeader('text/html; charset=iso-8859-1')
local show_advanced_prefs = false
local show_advanced_prefs_key = "ntopng.prefs.show_advanced_prefs"
if(haveAdminPrivileges()) then
ntop.dumpFile(dirs.installdir .. "/httpdocs/inc/header.inc")
active_page = "admin"
dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua")
prefs = ntop.getPrefs()
print [[
Runtime Preferences
]]
if(false) then
io.write("------- SERVER ----------------\n")
tprint(_SERVER)
io.write("-------- GET ---------------\n")
tprint(_GET)
io.write("-------- POST ---------------\n")
tprint(_POST)
io.write("-----------------------\n")
end
tab = _GET["tab"]
if toboolean(_POST["show_advanced_prefs"]) ~= nil then
ntop.setPref(show_advanced_prefs_key, _POST["show_advanced_prefs"])
show_advanced_prefs = toboolean(_POST["show_advanced_prefs"])
notifyNtopng(show_advanced_prefs_key, _POST["show_advanced_prefs"])
else
show_advanced_prefs = toboolean(ntop.getPref(show_advanced_prefs_key))
if isEmptyString(show_advanced_prefs) then show_advanced_prefs = false end
end
local menu_subpages = {
{id="users", label="Users", advanced=false, pro_only=false, disabled=false},
{id="auth", label="Authentication", advanced=false, pro_only=true, disabled=false},
{id="ifaces", label="Network Interfaces", advanced=true, pro_only=false, disabled=false},
{id="in_memory", label="In-Memory Data", advanced=true, pro_only=false, disabled=false},
{id="on_disk_rrds", label="On-Disk Timeseries", advanced=false, pro_only=false, disabled=false},
{id="on_disk_dbs", label="On-Disk Databases", advanced=true, pro_only=false, disabled=false},
{id="alerts", label="Alerts", advanced=false, pro_only=false, disabled=(prefs.has_cmdl_disable_alerts == true)},
{id="protocols", label="Protocols", advanced=false, pro_only=false, disabled=false},
{id="report", label="Units of Measurement", advanced=false, pro_only=false, disabled=false},
{id="logging", label="Logging", advanced=false, pro_only=false, disabled=(prefs.has_cmdl_trace_lvl == true)},
{id="snmp", label="SNMP", advanced=true, pro_only=true, disabled=false},
{id="nbox", label="nBox Integration", advanced=false, pro_only=true, disabled=false},
}
if(info["version.enterprise_edition"]) then
table.insert(menu_subpages, {id="bridging", label="Traffic Bridging", advanced=false, pro_only=true, disabled=false})
end
for _, subpage in ipairs(menu_subpages) do
if((subpage.disabled) or
((subpage.advanced) and (not show_advanced_prefs)) or -- restore default in case of simple preferences
((subpage.pro_only) and (not ntop.isPro()))) then -- restore default in case of non pro
subpage.disabled = true
if subpage.id == tab then
-- will set to default
tab = nil
end
end
end
-- default subpage
if isEmptyString(tab) then
tab = "users"
end
-- ================================================================================
function printReportVisualization()
print(' ]]
end
-- ================================================================================
function printInterfaces()
print(' ]]
end
-- ================================================================================
function printTopTalkers()
print(' ]]
end
-- ================================================================================
function printStatsDatabases()
print(' ]]
end
-- ================================================================================
function printAlerts()
if prefs.has_cmdl_disable_alerts then return end
print(' ]]
end
-- ================================================================================
function printProtocolPrefs()
print(' ]]
end
-- ================================================================================
function printBridgingPrefs()
local show
local label
label = "Enable the web captive portal for authenticating network users."
if((prefs["http.port"] == 80) and (prefs["http.alt_port"] ~= 0)) then
show = true
else
show = false
label = label.."This button is disabled as the ntopng web GUI has NOT been started on port 80 that is required by the captive portal (-w command line parameter)."
end
print('
]]
end
-- ================================================================================
function printNbox()
print(' ]]
end
-- ================================================================================
function printUsers()
print(']]
end
-- ================================================================================
function printAuthentication()
if not ntop.isPro() then return end
print('')
end
-- ================================================================================
function printInMemory()
print(' ]]
end
-- ================================================================================
function printStatsRrds()
print(' ]]
end
-- ================================================================================
function printLogging()
if prefs.has_cmdl_trace_lvl then return end
print('