Optimized load port

This commit is contained in:
Luca Deri 2023-10-10 20:40:46 +02:00
parent 4577d4fe1e
commit ad3e4273a2

View file

@ -942,9 +942,9 @@ function vs_utils.load_module(name)
return(require(name):new())
end
-- **********************************************************
function vs_utils.discover_open_ports(host)
function vs_utils.discover_open_portsx(host)
local result,duration,scan_result,num_open_ports,num_vulnerabilities_found, cve, udp_ports, tcp_ports, scan_ports, network_alert_store,now
@ -968,14 +968,19 @@ function vs_utils.scan_host(scan_type, host, ports, scan_id)
end
end
local ports_scan_param = ports
if (isEmptyString(ports)) then
ports = vs_utils.discover_open_ports(host)
local ports_scan_param
if(string.contains(scan_type, '_openports') or string.contains(scan_type, '_portscan')) then
-- Nothing to do
else
if (isEmptyString(ports)) then
ports = vs_utils.discover_open_ports(host)
end
end
ports_scan_param = ports
vs_utils.set_status_scan(scan_type, host, ports_scan_param, id, nil, vs_utils.scan_status.scanning)
local scan_module = vs_utils.load_module(scan_type)
local now,result,duration,scan_result,num_open_ports,num_vulnerabilities_found, cve, udp_ports, tcp_ports = scan_module:scan_host(host, ports)