mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 07:59:35 +00:00
Created network configuration page (#8692)
* Fixed remediation links not working * Added network configuration page * Removed commend and updated component name * Added network config page
This commit is contained in:
parent
4a613a8bbf
commit
658887a47e
8 changed files with 280 additions and 5 deletions
41
scripts/lua/rest/v2/set/network/config.lua
Normal file
41
scripts/lua/rest/v2/set/network/config.lua
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
|
||||
--
|
||||
-- (C) 2021 - ntop.org
|
||||
--
|
||||
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
|
||||
require "lua_utils"
|
||||
local rest_utils = require "rest_utils"
|
||||
local json = require "dkjson"
|
||||
|
||||
local action = _GET["action"]
|
||||
local post_data = _POST["payload"]
|
||||
|
||||
local res = {}
|
||||
|
||||
local config = _POST["config"]
|
||||
tprint(_POST)
|
||||
|
||||
local data = json.decode(config)
|
||||
|
||||
-- data is:
|
||||
--[[
|
||||
asset_key = [ "gateway", "unexpected_dhcp", "unexpected_dns", "unexpected_ntp", "unexpected_smtp"]
|
||||
|
||||
{ "csrf":..., "config": [ {"asset_key": asset_key, "item": [ip1, ip2, ip3...]}, {"asset_key": asset_key_1, "item": [ip1, ip2, ip3...]}]}
|
||||
]]
|
||||
|
||||
-- local script_key = post_data["asset_key"] -- asset_key
|
||||
-- local redis_key = "ntopng.prefs." .. script_key .. "_ip_list"
|
||||
|
||||
-- for each element in respone: ntop.getCache(redis_key)
|
||||
|
||||
if isEmptyString(ifid) then
|
||||
rest_utils.answer(rest_utils.consts.err.invalid_interface)
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
rest_utils.answer(rest_utils.consts.success.ok, res)
|
||||
Loading…
Add table
Add a link
Reference in a new issue