-- (C) 2013-24 - ntop.org -- local dirs = ntop.getDirs() package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path package.path = dirs.installdir .. "/scripts/lua/modules/timeseries/?.lua;" .. package.path package.path = dirs.installdir .. "/scripts/lua/modules/pools/?.lua;" .. package.path package.path = dirs.installdir .. "/scripts/lua/modules/vulnerability_scan/?.lua;" .. package.path package.path = dirs.installdir .. "/scripts/lua/modules/timeseries/?.lua;" .. package.path local snmp_utils local snmp_location local host_sites_update local sites_granularities = {} local auth = require "auth" local ts_utils = require "ts_utils_core" local vs_utils = require "vs_utils" local cve_utils = require "cve_utils" 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(host) then tprint(host.mac_meaningful) end 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_ip and isAdministrator()) then if (_POST["drop_host_policy"] == "true") then interface.dropHostTraffic(host_ip) end end -- ##################################################### local function takeHistoricalBaseUrl(port) local extra_params = { srv_ip = { value = host_ip, operator = "eq" }, srv_port = { value = port, operator = "eq" } } if host_vlan ~= 0 then extra_params.vlan_id = { value = host_vlan, operator = "eq" } end return add_historical_flow_explorer_button_ref(extra_params, true) end -- ##################################################### local function printPort(port, proto, is_server_port) if is_server_port then local historical_base_url = takeHistoricalBaseUrl(port) if (historical_base_url and (historical_base_url ~= "")) then print('
  • ' .. port .. " (" .. proto .. ")" .. "
  • \n") else print('
  • ' .. port .. " (" .. proto .. ")" .. "
  • \n") end else print( '
  • ' .. port .. " (" .. proto .. ")" .. "
  • \n") end end -- ##################################################### local function printPorts(ports, is_server_port) 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("