Add details on email and report about new hosts detected on network (#8086).

This commit is contained in:
Nicolo Maio 2023-12-11 12:23:44 +01:00
parent ffd2c05eab
commit 8db0945eba
15 changed files with 184 additions and 42 deletions

View file

@ -29,7 +29,7 @@ end
-- NOTE: ports are comma separated (e.g 80,443)
function vs_module:scan_host(network_ip, ports, use_coroutines)
local secondary_scan_types, scan_frequency = vs_utils.get_network_pref_value(network_ip, self.name)
local secondary_scan_types, scan_frequency,net_scan_all, net_periodic_scan, net_single_scan = vs_utils.get_network_pref_value(network_ip, self.name)
local sub_scans_types = {}
if (secondary_scan_types and secondary_scan_types:find(",")) then
@ -40,7 +40,10 @@ function vs_module:scan_host(network_ip, ports, use_coroutines)
local discovered_hosts,scan_out,start_scan,scan_duration,scan_ok = vs_utils.exec_netscan(network_ip, self.cidr)
for _,host_ip in ipairs(discovered_hosts) do
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 _,d_scan_type in ipairs(sub_scans_types) do
@ -48,19 +51,19 @@ function vs_module:scan_host(network_ip, ports, use_coroutines)
------- host aleady configured case -------
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
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,false,false,false)
vs_utils.triggerHostNotConfiguredAlert(host_ip,d_scan_type)
-- add and scan new 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
end
end
return start_scan,scan_out,scan_duration,scan_ok,0--[[num_open_ports]],0--[[num_vulnerabilities_found]],{}--[[cve]],{}--[[udp_ports]],{}--[[tcp_ports]]
return start_scan,scan_out,scan_duration,scan_ok,0--[[num_open_ports]],0--[[num_vulnerabilities_found]],{}--[[cve]],{}--[[udp_ports]],{}--[[tcp_ports]], hosts_not_configured
end