Added number of ports scanned and vulneabilities found (work in progress)

This commit is contained in:
Luca Deri 2023-08-02 19:13:54 +02:00
parent 294696376d
commit 13e677924a
4 changed files with 20 additions and 10 deletions

View file

@ -92,7 +92,8 @@ end
-- **********************************************************
-- Function to save host configuration
function vs_utils.save_host_to_scan(scan_type, host, scan_result, last_scan_time, last_duration, is_ok_last_scan, ports, scan_frequency)
function vs_utils.save_host_to_scan(scan_type, host, scan_result, last_scan_time, last_duration,
is_ok_last_scan, ports, scan_frequency, num_open_ports,num_vulnerabilities_found)
local saved_hosts_string = ntop.getCache(host_to_scan_key)
local saved_hosts = {}
@ -112,9 +113,11 @@ function vs_utils.save_host_to_scan(scan_type, host, scan_result, last_scan_time
end
local new_item = {
host=host,
scan_type=scan_type,
ports=ports,
host = host,
scan_type = scan_type,
ports = ports,
num_open_ports = num_open_ports,
num_vulnerabilities_found = num_vulnerabilities_found
}
if last_scan_time or last_duration then
@ -259,9 +262,9 @@ end
-- Function to exec single host scan
function vs_utils.scan_host(scan_type, host, ports)
local scan_module = vs_utils.load_module(scan_type)
local result,duration,scan_result = scan_module:scan_host(host, ports)
local result,duration,scan_result,num_open_ports,num_vulnerabilities_found = scan_module:scan_host(host, ports)
vs_utils.save_host_to_scan(scan_type, host, result, now, duration, scan_result, ports)
vs_utils.save_host_to_scan(scan_type, host, result, now, duration, scan_result, ports, num_open_ports,num_vulnerabilities_found)
return true
end
@ -377,7 +380,10 @@ function vs_utils.get_active_hosts(host, cidr)
cidr = tonumber(cidr)
if((cidr == 32) or (cidr == 128) or (host:find('.') == nil)) then
if((cidr == 32) or (cidr == 128)
or (host:find('.') == nil) -- not dots in IP, it looks symbolic
or (string.sub(host, -1) ~= "0") -- last digit is not 0, so let's assume /32
) then
result[#result+1] = host -- return it as is
else
local s = string.split(host, '%.')