mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-06 12:15:15 +00:00
69 lines
2.1 KiB
Lua
69 lines
2.1 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")
|
|
local page = _GET["page"]
|
|
|
|
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 base_url = ntop.getHttpPrefix() .. "/lua/vulnerability_scan.lua"
|
|
|
|
page_utils.print_navbar(i18n("scan_hosts"), base_url .. "?", {{
|
|
active = page == "overview" or page == nil,
|
|
page_name = "overview",
|
|
label = "<i class=\"fas fa-lg fa-home\"></i>"
|
|
}, {
|
|
active = page == "show_result",
|
|
hidden = page == "overview" or page == nil, -- disable the entry when the user is in the overview page
|
|
page_name = "show_result",
|
|
label = i18n('scan_details')
|
|
}})
|
|
|
|
|
|
local page = _GET["page"] or ('overview')
|
|
local ifid = interface.getId()
|
|
|
|
|
|
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")
|