mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-01 00:19:33 +00:00
Implement host MUD recording and dump
This commit is contained in:
parent
ca56f94cef
commit
c97ef3d908
6 changed files with 475 additions and 0 deletions
30
scripts/lua/rest/get/host/mud.lua
Normal file
30
scripts/lua/rest/get/host/mud.lua
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
--
|
||||
-- (C) 2019 - ntop.org
|
||||
--
|
||||
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
require "lua_utils"
|
||||
local mud_utils = require("mud_utils")
|
||||
local json = require("dkjson")
|
||||
|
||||
local host = _GET["host"]
|
||||
|
||||
if(_GET["ifid"] ~= nil) then
|
||||
interface.select(_GET["ifid"])
|
||||
end
|
||||
|
||||
sendHTTPHeader('application/json')
|
||||
|
||||
if(host == nil) then
|
||||
print("{}")
|
||||
return
|
||||
end
|
||||
|
||||
local mud = mud_utils.getHostMUD(host)
|
||||
|
||||
if(mud ~= nil) then
|
||||
print(json.encode(mud, {indent=true}))
|
||||
else
|
||||
print("{}")
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue