Vulnerability scan improvements

This commit is contained in:
Luca Deri 2023-07-28 23:14:39 +02:00
parent 883d3faee9
commit 5dc8770918
20 changed files with 353 additions and 263 deletions

View file

@ -4,15 +4,12 @@
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
require "lua_utils"
local rest_utils = require "rest_utils"
local vulnerability_scan_utils = require "vulnerability_scan_utils"
local function retrieve_host_scan_result(host, scan_type)
return vulnerability_scan_utils.retrieve_hosts_scan_result(host, scan_type)
end
local vs_utils = require "vs_utils"
local host = _GET["host"]
local scan_type = _GET["scan_type"]
@ -21,8 +18,9 @@ if isEmptyString(host) or isEmptyString(scan_type) then
rest_utils.answer(rest_utils.consts.err.invalid_args)
end
local result = retrieve_host_scan_result(host, scan_type)
local result = vs_utils.retrieve_hosts_scan_result(scan_type, host)
local extra_headers = {}
extra_headers["Content-Disposition"] = "attachment;filename=\"scan_result_export_"..os.time()..".txt\""
extra_headers["Content-Disposition"] = "attachment;filename=\"scan_result_export_"..os.time().."_".. host .."_".. scan_type..".txt\""
rest_utils.vanilla_payload_response(rest_utils.consts.success.ok, result, "application/octet-stream", extra_headers)