This commit is contained in:
Nicolo Maio 2023-08-02 13:46:43 +00:00
parent cef5d72b8d
commit ec5d112ab5
4 changed files with 62 additions and 3 deletions

View file

@ -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)