-- -- (C) 2013-23 - ntop.org -- local dirs = ntop.getDirs() package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path package.path = dirs.installdir .. "/scripts/lua/modules/pools/?.lua;" .. package.path local snmp_utils local snmp_location local host_sites_update local sites_granularities = {} local auth = require "auth" if(ntop.isPro()) then package.path = dirs.installdir .. "/pro/scripts/lua/modules/?.lua;" .. package.path snmp_utils = require "snmp_utils" snmp_location = require "snmp_location" shaper_utils = require("shaper_utils") host_sites_update = require("host_sites_update") end require "lua_utils" local graph_utils = require "graph_utils" local json = require ("dkjson") local discover = require "discover_utils" local ui_utils = require "ui_utils" local page_utils = require "page_utils" local template = require "template_utils" local fingerprint_utils = require "fingerprint_utils" local am_utils = require "am_utils" local behavior_utils = require "behavior_utils" local host_pools_nedge if ntop.isnEdge() then host_pools_nedge = require "host_pools_nedge" end local host_pools = require "host_pools" -- Instantiate host pools local host_pools_instance = host_pools:create() local info = ntop.getInfo() local have_nedge = ntop.isnEdge() local debug_hosts = false local page = _GET["page"] local host_info = url2hostinfo(_GET) local host_ip = host_info["host"] local host_vlan = host_info["vlan"] or 0 local format_utils = require("format_utils") if not isEmptyString(_GET["ifid"]) then interface.select(_GET["ifid"]) else interface.select(ifname) end local ifstats = interface.getStats() ifId = ifstats.id local charts_available = areHostTimeseriesEnabled(ifId, host_info) local is_pcap_dump = interface.isPcapDumpInterface() local host = nil local family = nil local prefs = ntop.getPrefs() local hostkey = hostinfo2hostkey(host_info, nil, true --[[ force show vlan --]]) local hostkey_compact = hostinfo2hostkey(host_info) -- do not force vlan if not host_ip then sendHTTPContentTypeHeader('text/html') page_utils.print_header() dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua") print("
" .. i18n("host_details.host_parameter_missing_message") .. "
") dofile(dirs.installdir .. "/scripts/lua/inc/footer.lua") return end -- print(">>>") print(host_info["host"]) print("<<<") if(debug_hosts) then traceError(TRACE_DEBUG,TRACE_CONSOLE, i18n("host_details.trace_debug_host_info",{hostinfo=host_info["host"],vlan=host_vlan}).."\n") end local host = interface.getHostInfo(host_info["host"], host_vlan) local tskey if _GET["tskey"] then tskey = _GET["tskey"] elseif host then tskey = host["tskey"] else tskey = host_key end local restoreFailed = false local restoreInProgress = false if((host == nil) and ((_GET["mode"] == "restore"))) then restoreFailed = not interface.restoreHost(host_info["host"], host_vlan) if(not restoreFailed) then restoreInProgress = true end end local function printPorts(ports) if(table.len(ports) == 0) then print(""..i18n("none").."") else local udp = {} local tcp = {} print("UDPTCP\n") for k,v in pairs(ports) do local res = split(k, ":") if tonumber(res[2]) then if(res[1] == "udp") then udp[tonumber(res[2]) ] = v else tcp[tonumber(res[2])] = v end end end print("