[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

@ -29,23 +29,35 @@ end
-- NOTE: ports are comma separated (e.g 80,443)
function vs_module:scan_host(network_ip, ports, use_coroutines)
local secondary_scan_type, scan_frequency = vs_utils.get_network_pref_value(network_ip, self.name)
local secondary_scan_types, scan_frequency = vs_utils.get_network_pref_value(network_ip, self.name)
local sub_scans_types = {}
if (secondary_scan_types and secondary_scan_types:find(",")) then
sub_scans_types = string.split(secondary_scan_types,",")
else
sub_scans_types[#sub_scans_types + 1] = secondary_scan_types
end
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
if (vs_utils.isVSConfiguredHost(host_ip)) then
------- host aleady configured case -------
else
------- new host not found case -------
for _,d_scan_type in ipairs(sub_scans_types) do
-- trigger alert host not configured
vs_utils.triggerHostNotConfiguredAlert(host_ip)
-- add and scan new host
local result,id = vs_utils.add_host_pref(secondary_scan_type, host_ip, ports, scan_frequency, nil)
vs_utils.schedule_ondemand_single_host_scan(secondary_scan_type,host_ip,ports,id,false,false,false)
if (vs_utils.isVSConfiguredHost(host_ip,d_scan_type)) then
------- host aleady configured case -------
else
------- new host not found case -------
-- 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)
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]]