mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 23:49:33 +00:00
Implemented clean host delete in VS
This commit is contained in:
parent
b98a100871
commit
75ccb84b31
2 changed files with 22 additions and 10 deletions
|
|
@ -38,8 +38,8 @@ package.path = dirs.installdir .. "/scripts/lua/modules/vulnerability_scan/?.lua
|
|||
|
||||
require "lua_utils" -- used by tprint (debug)
|
||||
|
||||
local host_to_scan_key = "ntopng.prefs.host_to_scan"
|
||||
local host_scan_queue_key = "ntopng.vs_scan_queue"
|
||||
local host_to_scan_key = "ntopng.prefs.host_to_scan"
|
||||
local host_scan_queue_key = "ntopng.vs_scan_queue"
|
||||
local scanned_hosts_changes_key = "ntopng.alerts.scanned_hosts_changes"
|
||||
|
||||
local json = require("dkjson")
|
||||
|
|
@ -426,6 +426,25 @@ function vs_utils.delete_host_to_scan(host, scan_type, all)
|
|||
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)
|
||||
|
||||
-- Remove this host from active schedules
|
||||
local elems = {}
|
||||
while(true) do
|
||||
local e = ntop.lpopCache(host_scan_queue_key)
|
||||
|
||||
if(e == nil) then
|
||||
break
|
||||
else
|
||||
local r = json.decode(e)
|
||||
if(not((r.scan_type == "cve") and (r.host == "127.0.0.1"))) then
|
||||
table.insert(elems, e)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for _,i in pairs(elems) do
|
||||
ntop.lpushCache(host_scan_queue_key, i)
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue