ntopng/scripts/lua/vulnerability_scan.lua
2023-08-09 11:17:17 +02:00

55 lines
1.7 KiB
Lua

--
-- (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/vulnerability_scan/?.lua;" .. package.path
require "lua_utils"
local page_utils = require("page_utils")
local template = require("template_utils")
local json = require("dkjson")
if not isAllowedSystemInterface() then return end
sendHTTPContentTypeHeader('text/html')
page_utils.print_header_and_set_active_menu_entry(page_utils.menu_entries.vulnerability_scan)
dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua")
local page = _GET["page"] or ('overview')
local ifid = getInterfaceId(ifname)
local host_result = _GET["host"]
local scan_type = _GET["scan_type"]
local scan_date = _GET["scan_date"]
-- #######################################################
if (page == "scan_hosts" or page == "overview") then
local json_context = {
csrf = ntop.getRandomCSRFValue(),
ifid = ifid,
is_enterprise_l = ntop.isEnterpriseL(),
host = host_result
}
template.render("pages/vue_page.template", { vue_page_name = "PageHostsToScan", page_context = json.encode(json_context) })
elseif (page == "show_result") then
local json_context = {
csrf = ntop.getRandomCSRFValue(),
ifid = ifid,
host = host_result,
scan_type = scan_type,
date = scan_date
}
template.render("pages/vue_page.template", { vue_page_name = "PageHostVsResult", page_context = json.encode(json_context) })
end
-- #######################################################
dofile(dirs.installdir .. "/scripts/lua/inc/footer.lua")