Fix save scan result VA.

This commit is contained in:
Nicolo Maio 2023-08-16 18:35:01 +02:00
parent 9c1facd49b
commit d9f8b327eb
2 changed files with 6 additions and 7 deletions

View file

@ -92,7 +92,6 @@ local function get_report_path(scan_type, ip, all)
else
ret = base_dir .. "/*.txt"
end
return(ret)
end
@ -243,7 +242,7 @@ end
-- Function to save host configuration
function vs_utils.save_host_to_scan(scan_type, host, scan_result, last_scan_time, last_duration,
is_ok_last_scan, ports, scan_frequency, num_open_ports,
num_vulnerabilities_found, cve, id)
num_vulnerabilities_found, cve, id, is_edit)
--local saved_hosts_string = ntop.getCache(host_to_scan_key)
--local saved_hosts = {}
--local host_hash_key = vs_utils.get_host_hash_key( id)
@ -286,7 +285,7 @@ function vs_utils.save_host_to_scan(scan_type, host, scan_result, last_scan_time
end
end
local epoch_id = ""
local epoch_id = 0
if isEmptyString(id) then
local key = "ntopng.prefs.last_host_id"
local res = ntop.incrCache(key)
@ -335,7 +334,7 @@ function vs_utils.save_host_to_scan(scan_type, host, scan_result, last_scan_time
handle:close()
end
if not isEmptyString(id) then
if not isEmptyString(id) and is_edit then
vs_utils.delete_host_to_scan_by_id(id)
end
@ -507,7 +506,7 @@ function vs_utils.scan_host(scan_type, host, ports, scan_id)
local result,duration,scan_result,num_open_ports,num_vulnerabilities_found, cve = scan_module:scan_host(host, ports)
vs_utils.save_host_to_scan(scan_type, host, result, now, duration, scan_result,
ports, nil, num_open_ports, num_vulnerabilities_found, cve, scan_id)
ports, nil, num_open_ports, num_vulnerabilities_found, cve, scan_id, false)
return true
end