-- -- (C) 2013-26 - ntop.org -- local dirs = ntop.getDirs() package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path package.path = dirs.installdir .. "/scripts/lua/modules/active_scan/?.lua;" .. package.path if(ntop.isPro and ntop.isPro()) then package.path = dirs.installdir .. "/pro/scripts/lua/modules/?.lua;" .. package.path end require "lua_utils" local page_utils = require("page_utils") local template = require("template_utils") local graph_utils = require("graph_utils") local json = require("dkjson") local auth = require "auth" local ascan_utils = require "ascan_utils" local format_utils = require "format_utils" if not isAllowedSystemInterface() then return end sendHTTPContentTypeHeader('text/html') page_utils.print_header_and_set_active_menu_entry(page_utils.menu_entries.active_scan) local base_url = ntop.getHttpPrefix() .. "/lua/active_scan.lua" local charts_available = areHostTimeseriesEnabled(ifId, nil) local page = _GET["page"] or ('overview') local host_ip = _GET["host"] local printable = toboolean(_GET["printable"]) local scan_type = _GET["scan_type"] local scan_date = _GET["scan_date"] local ifid = _GET["ifid"] local epoch = tonumber(_GET["epoch"] or 0) local navbar_title = i18n("scan_hosts") if host_ip ~= nil then navbar_title = "" .. navbar_title .. ": " .. "" .. host_ip end local is_host_defined = host_ip ~= nil if isEmptyString(ifid) then ifid = interface.getId() end if not printable then dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua") page_utils.print_navbar(navbar_title, base_url .. "?", {{ active = page == "overview" or page == nil, page_name = "overview", label = "" },{ hidden = not areAlertsEnabled() or not auth.has_capability(auth.capabilities.alerts) or is_host_defined, active = page == "alerts", page_name = "alerts", label = "", url = ntop.getHttpPrefix() .."/lua/alert_stats.lua?page=am_host&alert_id=4184%3Beq&is_va=true" }, { hidden = not (ntop.isPro and ntop.isPro()) or is_host_defined,--not charts_available or page == "overview" or page == nil, active = page == "va_historical", page_name = "va_historical", label = "" }, { active = page == "open_ports", hidden = not (ntop.isEnterpriseL and ntop.isEnterpriseL()) or is_host_defined, -- disable the entry when the user is in the overview page page_name = "open_ports", label = i18n('hosts_stats.page_scan_hosts.num_open_ports') }, { active = page == "show_result", hidden = page ~= "show_result", -- disable the entry when the user is in the overview page, host's ip is needed to jump to this page page_name = "show_result", label = i18n('scan_details') }, { active = page == "report", page_name = "report", hidden = not(ntop.isEnterpriseL and ntop.isEnterpriseL() and not ntop.isClickHouseEnabled()) or not is_host_defined, url = ntop.getHttpPrefix() .."/lua/active_scan.lua?page=report&report_template=ascan_result&ifid="..ifid, label = i18n('hosts_stats.page_scan_hosts.download_page') }, { active = page == "reports", hidden = not(ntop.isEnterpriseL and ntop.isEnterpriseL() and ntop.isClickHouseEnabled()) or is_host_defined, page_name = "reports", label = i18n('hosts_stats.page_scan_hosts.reports_page.reports') } }) if not ascan_utils.is_nmap_installed() then print("