[VS] Fix alert generation.

This commit is contained in:
Nicolo Maio 2023-10-12 16:58:55 +02:00
parent 5e37771d8b
commit be6c2e0d4f
2 changed files with 22 additions and 12 deletions

View file

@ -348,7 +348,9 @@ local function check_differences(host, host_name, scan_type, old_data, new_data)
rsp["tcp_open_ports"] = rsp_tcp_diff.open_ports
rsp["tcp_closed_ports"] = rsp_tcp_diff.closed_ports
rsp["tcp_ports_case"] = rsp_tcp_diff.ports_case
end
rsp["triggered"] = rsp_tcp_diff.triggered
rsp["measurement"] = "ports_changes_detected"
elseif (scan_type == "udp_portscan") then
@ -370,6 +372,8 @@ local function check_differences(host, host_name, scan_type, old_data, new_data)
rsp["udp_closed_ports"] = rsp_udp_diff.closed_ports
rsp["udp_ports_case"] = rsp_udp_diff.ports_case
end
rsp["triggered"] = rsp_udp_diff.triggered
rsp["measurement"] = "ports_changes_detected"
end
@ -390,7 +394,7 @@ local function check_differences(host, host_name, scan_type, old_data, new_data)
end
if table.empty(rsp) then
if table.empty(rsp) or rsp.triggered == false then
rsp = nil
else
rsp["host"] = host
@ -1044,7 +1048,8 @@ function vs_utils.scan_host(scan_type, host, ports, scan_id)
end
end
local ports_scan_param
-- to save on redis the user input
local ports_scan_param = ports
if(string.contains(scan_type, '_openports') or string.contains(scan_type, '_portscan')) then
-- Nothing to do
@ -1054,7 +1059,6 @@ function vs_utils.scan_host(scan_type, host, ports, scan_id)
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)