diff --git a/scripts/lua/modules/vulnerability_scan/vs_utils.lua b/scripts/lua/modules/vulnerability_scan/vs_utils.lua index 810dfb23ad..e83adcf6a3 100644 --- a/scripts/lua/modules/vulnerability_scan/vs_utils.lua +++ b/scripts/lua/modules/vulnerability_scan/vs_utils.lua @@ -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