mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-01 00:19:33 +00:00
Add CIDR. (#7625)
This commit is contained in:
parent
cef5d72b8d
commit
ec5d112ab5
4 changed files with 62 additions and 3 deletions
|
|
@ -15,12 +15,23 @@ local scan_type = _GET["scan_type"]
|
|||
local scan_ports = _GET["scan_ports"]
|
||||
local scan_frequency = _GET["auto_scan_frequency"]
|
||||
|
||||
local cidr = _GET["cidr"]
|
||||
|
||||
if isEmptyString(host) or isEmptyString(scan_type) then
|
||||
rest_utils.answer(rest_utils.consts.err.bad_content)
|
||||
return
|
||||
end
|
||||
local result = nil
|
||||
|
||||
local result = vs_utils.save_host_to_scan(scan_type, host, nil, nil, nil, 5, scan_ports, scan_frequency)
|
||||
if isEmptyString(cidr) then
|
||||
result = vs_utils.save_host_to_scan(scan_type, host, nil, nil, nil, 5, scan_ports, scan_frequency)
|
||||
else
|
||||
local hosts_to_save = vs_utils.get_active_hosts(host, cidr)
|
||||
|
||||
for _,item in ipairs(hosts_to_save) do
|
||||
result = vs_utils.save_host_to_scan(scan_type, item, nil, nil, nil, 5, scan_ports, scan_frequency)
|
||||
end
|
||||
end
|
||||
|
||||
if result == 1 then
|
||||
rest_utils.answer(rest_utils.consts.success.ok)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue