[VS] Fix in ipv4_netscan the host not detected case. (#8086)

This commit is contained in:
Nicolo Maio 2023-12-11 19:50:27 +01:00
parent 8db0945eba
commit 98bea0a032
4 changed files with 28 additions and 18 deletions

View file

@ -43,19 +43,23 @@ function vs_module:scan_host(network_ip, ports, use_coroutines)
local hosts_not_configured = {}
-- [[ exec sub scan for every hosts discovered and for every sub scan type selected ]]
for _,host_ip in ipairs(discovered_hosts) do
for _,host_ip in ipairs(discovered_hosts) do
for _,d_scan_type in ipairs(sub_scans_types) do
if (vs_utils.isVSConfiguredHost(host_ip,d_scan_type)) then
------- host aleady configured case -------
local found_host_and_scan_type = vs_utils.isVSConfiguredHostScanType(host_ip,d_scan_type)
if (found_host_and_scan_type) then
-- nothing to do
else
------- new host not found case -------
hosts_not_configured[#hosts_not_configured+1] = host_ip
-- trigger alert host not configured
vs_utils.triggerHostNotConfiguredAlert(host_ip,d_scan_type)
-- add and scan new host
if (vs_utils.isVSConfiguredHost(host_ip)) then
-- the host was already detected
else
-- NEW HOST detected
hosts_not_configured[#hosts_not_configured+1] = host_ip
vs_utils.triggerHostNotConfiguredAlert(host_ip,d_scan_type)
end
-- configure and scan host
local result,id = vs_utils.add_host_pref(d_scan_type, host_ip, ports, scan_frequency, nil)
vs_utils.schedule_ondemand_single_host_scan(d_scan_type,host_ip,ports,id,net_periodic_scan,net_scan_all,net_single_scan)
end