[VS] Add multiselect on ipv4_netscan.

This commit is contained in:
Nicolo Maio 2023-12-05 17:40:49 +01:00
parent 2d0d7afaa9
commit 3e5b3a8218
7 changed files with 147 additions and 66 deletions

View file

@ -73,8 +73,7 @@ local vs_rest_utils = require("vs_rest_utils")
-- Enable debug with:
-- redis-cli set "ntopng.prefs.vs.debug_enabled" "1"
-- systemctl restart ntopng
local debug_me = ntop.getCache("ntopng.prefs.vs.debug_enabled") == "1"
local test_me = false
local debug_me = true--ntop.getCache("ntopng.prefs.vs.debug_enabled") == "1"
local verbose = false
local vs_utils = {}
@ -1056,9 +1055,10 @@ end
-- **********************************************************
-- Function to trigger alert when an host is not configured
local function trigger_alert_host_not_configured(host)
local function trigger_alert_host_not_configured(host,scan_type)
local host_info_to_cache = {
host = host,
scan_type = scan_type,
is_host_not_configured = true,
}
ntop.rpushCache(scanned_hosts_changes_queue_key, json.encode(host_info_to_cache))
@ -2638,12 +2638,12 @@ function vs_utils.get_network_pref_value(network_ip, scan_type)
end
-- **********************************************************
-- Function to find if an ip is configured
-- Function to find if an ip is configured with the scan_type
function vs_utils.isVSConfiguredHost(ip)
function vs_utils.isVSConfiguredHost(ip,scan_type)
local hosts_scanned = ntop.getHashKeysCache(prefs_host_values_key) or {}
for key, _ in pairs(hosts_scanned) do
if key:find(ip) then
if key:find(ip) and key:find(scan_type) then
return true
end
end
@ -2654,8 +2654,8 @@ end
-- Function to trigger an alert if the host
-- is not configured
function vs_utils.triggerHostNotConfiguredAlert(host)
trigger_alert_host_not_configured(host)
function vs_utils.triggerHostNotConfiguredAlert(host, scan_type)
trigger_alert_host_not_configured(host, scan_type)
end
-- **********************************************************