Compatibility fixes checks

This commit is contained in:
Luca Deri 2023-10-27 15:22:02 +02:00
parent 25856f4776
commit 4412c9c3a3

View file

@ -68,11 +68,12 @@ local vs_utils = {}
-- **********************************************************
function vs_utils.get_host_hash_key(host, scan_type)
return string.format("%s-%s",host,scan_type)
-- retro-compatibility
if (scan_type == "tcp_openports") then scan_type = "tcp_portscan" end
return string.format("%s-%s", host, scan_type)
end
-- **********************************************************
vs_utils.scan_status = {
@ -120,10 +121,15 @@ end
-- **********************************************************
local function get_report_path(scan_type, ip, all)
local base_dir = dirs.workingdir .. "/-1/vulnerability_scan"
ntop.mkdir(base_dir)
local base_dir
local ret = ""
base_dir = dirs.workingdir .. "/-1/vulnerability_scan"
ntop.mkdir(base_dir)
-- retro-compatibility
if (scan_type == "tcp_openports") then scan_type = "tcp_portscan" end
if (not all or all == nil) then
ret = base_dir .. "/"..ip.."_"..scan_type..".txt"
else
@ -295,11 +301,15 @@ end
-- and return a table containing those differences
local function check_differences(host, host_name, scan_type, old_data, new_data)
local rsp = {}
-- security checks
-- security checks
if host == nil or scan_type == nil then
return nil
end
-- retro-compatibility
if (scan_type == "tcp_openports") then scan_type = "tcp_portscan" end
if tonumber(old_data.ports or 0) ~= tonumber(new_data.ports or 0) then
rsp["num_ports"] = {
old_num_ports = old_data.ports or 0,
@ -1244,7 +1254,7 @@ function vs_utils.retrieve_hosts_scan_result(scan_type, host)
return result
else
return ""
return("Unable to read file "..path)
end
end
@ -1853,6 +1863,9 @@ function vs_utils.nmap_scan_host(command, host_ip, ports, use_coroutines, module
return nil
end
-- retro-compatibility
if (module_name == "tcp_openports") then module_name = "tcp_portscan" end
-- IPv6 check
if(string.contains(host_ip, ':')) then command = command .. " -6 " end