mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
[VS] Fix the CIDR input field and its usage with IPv4 NetScan. (#7943)
This commit is contained in:
parent
e58c60867e
commit
e7aec4bd37
12 changed files with 89 additions and 78 deletions
|
|
@ -1037,7 +1037,7 @@ end
|
|||
-- **********************************************************
|
||||
|
||||
--Function to save
|
||||
function vs_utils.add_host_pref(scan_type, host, ports, scan_frequency, discovered_host_scan_type)
|
||||
function vs_utils.add_host_pref(scan_type, host, ports, scan_frequency, discovered_host_scan_type, cidr)
|
||||
|
||||
local host_hash_key = vs_utils.get_host_hash_key(host, scan_type)
|
||||
|
||||
|
|
@ -1046,6 +1046,7 @@ function vs_utils.add_host_pref(scan_type, host, ports, scan_frequency, discover
|
|||
host_name = host_name,
|
||||
scan_type = scan_type,
|
||||
ports = ports,
|
||||
cidr = cidr,
|
||||
discovered_host_scan_type = discovered_host_scan_type
|
||||
}
|
||||
if not isEmptyString(scan_frequency) then
|
||||
|
|
@ -2206,7 +2207,7 @@ end
|
|||
-- **********************************************************
|
||||
|
||||
-- Function to exec single host scan
|
||||
function vs_utils.scan_host(scan_type, host, ports, scan_id, use_coroutines)
|
||||
function vs_utils.scan_host(scan_type, host, ports, scan_id, use_coroutines, cidr)
|
||||
if(ntop.isShuttingDown()) then return(false) end
|
||||
|
||||
if(use_coroutines == nil) then use_coroutines = false end
|
||||
|
|
@ -2245,7 +2246,7 @@ function vs_utils.scan_host(scan_type, host, ports, scan_id, use_coroutines)
|
|||
|
||||
-- Scan host
|
||||
local scan_module = vs_utils.load_module(scan_type)
|
||||
local now,result,duration,scan_result,num_open_ports,num_vulnerabilities_found, cve, udp_ports, tcp_ports, discovered_hosts = scan_module:scan_host(host, ports, use_coroutines)
|
||||
local now,result,duration,scan_result,num_open_ports,num_vulnerabilities_found, cve, udp_ports, tcp_ports, discovered_hosts = scan_module:scan_host(host, ports, use_coroutines, cidr)
|
||||
|
||||
if(ntop.isShuttingDown()) then
|
||||
return false
|
||||
|
|
@ -2330,8 +2331,8 @@ end
|
|||
|
||||
-- **********************************************************
|
||||
|
||||
function vs_utils.schedule_ondemand_single_host_scan(scan_type, host, ports, scan_id, is_periodicity, is_all, is_single_scan)
|
||||
local scan = { scan_type = scan_type, host = host, ports = ports, id= scan_id}
|
||||
function vs_utils.schedule_ondemand_single_host_scan(scan_type, host, ports, scan_id, is_periodicity, is_all, is_single_scan, cidr)
|
||||
local scan = { scan_type = scan_type, host = host, ports = ports, id= scan_id, cidr = cidr}
|
||||
|
||||
|
||||
vs_utils.set_status_scan(scan_type, host, ports, scan_id, is_periodicity, is_all, is_single_scan, vs_utils.scan_status.scheduled)
|
||||
|
|
@ -2349,7 +2350,7 @@ function vs_utils.schedule_ondemand_all_hosts_scan()
|
|||
local is_scanning_almost_one = false
|
||||
if #host_to_scan_list > 0 then
|
||||
for _,scan_info in ipairs(host_to_scan_list) do
|
||||
vs_utils.schedule_ondemand_single_host_scan(scan_info.scan_type, scan_info.host, scan_info.ports, scan_info.id, false, true, false)
|
||||
vs_utils.schedule_ondemand_single_host_scan(scan_info.scan_type, scan_info.host, scan_info.ports, scan_info.id, false, true, false, scan_info.cidr)
|
||||
is_scanning_almost_one = true
|
||||
end
|
||||
end
|
||||
|
|
@ -2385,7 +2386,7 @@ function vs_utils.schedule_periodic_scan(periodicity)
|
|||
for _,scan_info in ipairs(host_to_scan_list) do
|
||||
local frequency = scan_info.scan_frequency
|
||||
if(frequency == periodicity) then
|
||||
vs_utils.schedule_ondemand_single_host_scan(scan_info.scan_type, scan_info.host, scan_info.ports, scan_info.id, true, false, false)
|
||||
vs_utils.schedule_ondemand_single_host_scan(scan_info.scan_type, scan_info.host, scan_info.ports, scan_info.id, true, false, false, scan_info.cidr)
|
||||
is_scanning_almost_one = true
|
||||
end
|
||||
end
|
||||
|
|
@ -2428,9 +2429,9 @@ function vs_utils.process_oldest_scheduled_scan(use_coroutines)
|
|||
|
||||
if(use_coroutines) then
|
||||
if(debug_me) then traceError(TRACE_NORMAL, TRACE_CONSOLE, "Starting scan on host "..elem.host.."["..elem.scan_type .."]") end
|
||||
return(coroutine.create(function () vs_utils.scan_host(elem.scan_type, elem.host, elem.ports, elem.id, use_coroutines) end))
|
||||
return(coroutine.create(function () vs_utils.scan_host(elem.scan_type, elem.host, elem.ports, elem.id, use_coroutines, elem.cidr) end))
|
||||
else
|
||||
vs_utils.scan_host(elem.scan_type, elem.host, elem.ports, elem.id, use_coroutines)
|
||||
vs_utils.scan_host(elem.scan_type, elem.host, elem.ports, elem.id, use_coroutines, elem.cidr)
|
||||
|
||||
return true
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue