Implements custom nDPI proto categories changes

This commit is contained in:
Simone Mainardi 2017-09-15 19:48:49 +02:00
parent 7ba223bdac
commit 4ac6c92b9c
10 changed files with 390 additions and 0 deletions

View file

@ -0,0 +1,27 @@
--
-- (C) 2013-17 - ntop.org
--
local dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
require "lua_utils"
local json = require "dkjson"
sendHTTPContentTypeHeader('application/json')
interface.select(ifname)
if(haveAdminPrivileges()) then
local app_id = tonumber(_GET["l7proto"])
local new_cat_id = tonumber(_GET["ndpi_new_cat_id"])
local old_cat_id = tonumber(_GET["ndpi_old_cat_id"])
if new_cat_id ~= nil and old_cat_id ~= nil and new_cat_id ~= old_cat_id then
setCustomnDPIProtoCategory(ifname, app_id, new_cat_id)
end
local res = {status = "OK"}
print(json.encode(res))
else
print({status = "ERROR"})
end