-- -- (C) 2017-18 - ntop.org -- local dirs = ntop.getDirs() package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path require "lua_utils" local template = require "template_utils" sendHTTPContentTypeHeader('text/html') local proto_filter = _GET["l7proto"] local ifId = interface.name2id(ifname) if not haveAdminPrivileges() then return end ntop.dumpFile(dirs.installdir .. "/httpdocs/inc/header.inc") dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua") if not table.empty(_POST) then local custom_categories = getCustomnDPIProtoCategories(ifname) for k, new_cat in pairs(_POST) do if starts(k, "proto_") then local id = split(k, "proto_")[2] local old_cat new_cat = tonumber(split(new_cat, "cat_")[2]) -- get the current category if custom_categories[id] ~= nil then old_cat = custom_categories[id] else old_cat = interface.getnDPIProtoCategory(tonumber(id)) old_cat = old_cat and old_cat.id or 0 end if old_cat ~= new_cat then -- io.write("Changing nDPI category for " .. id .. ": " .. old_cat .. " -> " .. new_cat .. "\n") setCustomnDPIProtoCategory(ifname, tonumber(id), new_cat) end end end end print [[
]] print(i18n("protocols")) print[[ | ]]
if not isEmptyString(proto_filter) then
local proto_name = interface.getnDPIProtoName(tonumber(proto_filter))
print[[]] end print[[ | ]] print( template.gen("typeahead_input.html", { typeahead={ base_id = "t_app", action = ntop.getHttpPrefix() .. "/lua/admin/edit_ndpi_applications.lua", parameters = { ifid = tostring(ifId), }, json_key = "key", query_field = "l7proto", query_url = ntop.getHttpPrefix() .. "/lua/find_app.lua", query_title = i18n("categories_page.search_application"), style = "margin-left:1em; width:25em;", } }) ) print[[ |