-- -- (C) 2013-20 - ntop.org -- local dirs = ntop.getDirs() package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path require "lua_utils" local host_pools_utils = require "host_pools_utils" local page_utils = require("page_utils") local custom_column_utils = require("custom_column_utils") local discover = require("discover_utils") local have_nedge = ntop.isnEdge() sendHTTPContentTypeHeader('text/html') page_utils.set_active_menu_entry(page_utils.menu_entries.hosts) local protocol = _GET["protocol"] local asn = _GET["asn"] local vlan = _GET["vlan"] local network = _GET["network"] local cidr = _GET["network_cidr"] local country = _GET["country"] local mac = _GET["mac"] local os_ = _GET["os"] local community = _GET["community"] local pool = _GET["pool"] local ipversion = _GET["version"] local traffic_type = _GET["traffic_type"] local base_url = ntop.getHttpPrefix() .. "/lua/hosts_stats.lua" local page_params = {} local charts_icon = "" local mode = _GET["mode"] if isEmptyString(mode) then mode = "all" else page_params["mode"] = mode end local hosts_filter = '' if ((mode ~= "all") or (not isEmptyString(pool))) then hosts_filter = '' end function getPageTitle() local mode_label = "" if mode == "remote" then mode_label = i18n("hosts_stats.remote") elseif mode == "local" then mode_label = i18n("hosts_stats.local") elseif mode == "filtered" then mode_label = i18n("hosts_stats.filtered") elseif mode == "blacklisted" then mode_label = i18n("hosts_stats.blacklisted") elseif mode == "dhcp" then mode_label = i18n("nedge.network_conf_dhcp") end -- Note: we must use the empty string as fallback. Multiple spaces will be collapsed into one automatically. return i18n("hosts_stats.hosts_page_title", { all = isEmptyString(mode_label) and i18n("hosts_stats.all") or "", traffic_type = traffic_type_title or "", local_remote = mode_label, protocol = protocol_name or "", network = not isEmptyString(network_name) and i18n("hosts_stats.in_network", {network=network_name}) or "", network_cidr = not isEmptyString(cidr) and i18n("hosts_stats.in_network", {network=cidr}) or "", ip_version = ipver_title or "", ["os"] = discover.getOsName(os_), country_asn_or_mac = country or asninfo or mac or pool_ or "", vlan = vlan_title or "", }) .. charts_icon end dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua") page_utils.print_page_title(getPageTitle()) prefs = ntop.getPrefs() ifstats = interface.getStats() if (_GET["page"] ~= "historical") then if(asn ~= nil) then print [[