Fix various bugs and add ports in the host scan modal. (#7698)

This commit is contained in:
Nicolo Maio 2023-08-01 10:56:54 +00:00
parent a7c49205ef
commit a93201e42f
20 changed files with 540 additions and 109 deletions

View file

@ -13,6 +13,7 @@ local vs_utils = require "vs_utils"
local host = _GET["host"]
local scan_type = _GET["scan_type"]
local scan_return_result = toboolean(_GET["scan_return_result"]) or false
if isEmptyString(host) or isEmptyString(scan_type) then
rest_utils.answer(rest_utils.consts.err.invalid_args)
@ -20,7 +21,11 @@ end
local result = vs_utils.retrieve_hosts_scan_result(scan_type, host)
local extra_headers = {}
if scan_return_result then
rest_utils.answer(rest_utils.consts.success.ok, {rsp=result});
else
local extra_headers = {}
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)
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)
end