mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 23:49:33 +00:00
Vulnerability scan improvements
This commit is contained in:
parent
883d3faee9
commit
5dc8770918
20 changed files with 353 additions and 263 deletions
|
|
@ -0,0 +1,43 @@
|
|||
--
|
||||
-- (C) 2013-23 - ntop.org
|
||||
--
|
||||
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/host/?.lua;" .. package.path
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/vulnerability_scan/?.lua;" .. package.path
|
||||
|
||||
local rest_utils = require "rest_utils"
|
||||
local json = require("dkjson")
|
||||
local vs_utils = require "vs_utils"
|
||||
|
||||
local host = _GET["host"]
|
||||
local scan_type = _GET["scan_type"]
|
||||
local single_host = toboolean(_GET["scan_single_host"]) or false
|
||||
|
||||
|
||||
|
||||
if single_host then
|
||||
if isEmptyString(host) or isEmptyString(scan_type) then
|
||||
rest_utils.answer(rest_utils.consts.err.invalid_args)
|
||||
end
|
||||
|
||||
local res = vs_utils.schedule_host_scan(scan_type, host, ports)
|
||||
|
||||
if res then
|
||||
rest_utils.answer(rest_utils.consts.success.ok)
|
||||
else
|
||||
rest_utils.answer(rest_utils.consts.err.internal_error)
|
||||
|
||||
end
|
||||
else
|
||||
local res = vs_utils.schedule_all_hosts_scan()
|
||||
|
||||
if res then
|
||||
rest_utils.answer(rest_utils.consts.success.ok)
|
||||
else
|
||||
rest_utils.answer(rest_utils.consts.err.internal_error)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue