Delete scan results. (#7730)

This commit is contained in:
Nicolo Maio 2023-08-08 18:00:07 +02:00
parent d812ae6043
commit d1de3afdf8

View file

@ -83,10 +83,15 @@ end
-- **********************************************************
local function get_report_path(scan_type, ip)
local function get_report_path(scan_type, ip, all)
local base_dir = dirs.workingdir .. "/-1/vulnerability_scan"
ntop.mkdir(base_dir)
local ret = base_dir .. "/"..ip.."_"..scan_type..".txt"
local ret = ""
if (not all or all == nil) then
ret = base_dir .. "/"..ip.."_"..scan_type..".txt"
else
ret = base_dir .. "/*.txt"
end
return(ret)
end
@ -380,9 +385,13 @@ function vs_utils.delete_host_to_scan(host, scan_type, all)
if all then
ntop.delCache(host_to_scan_key)
local path_to_s_result = get_report_path(scan_type, host, true)
os.execute("rm "..path_to_s_result)
else
local host_hash_key = vs_utils.get_host_hash_key(host, scan_type)
local path_to_s_result = get_report_path(scan_type, host, false)
os.remove(path_to_s_result)
ntop.delHashCache(host_to_scan_key, host_hash_key)
end