mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-03 09:20:10 +00:00
Initial changes for MUD recording
This commit is contained in:
parent
0d133d102e
commit
94f175194b
17 changed files with 381 additions and 51 deletions
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
local mud_utils = require "mud_utils"
|
||||
local user_scripts = require("user_scripts")
|
||||
local discover = require("discover_utils")
|
||||
|
||||
local enabled_device_types
|
||||
local max_recording
|
||||
|
||||
-- #################################################################
|
||||
|
||||
|
|
@ -15,16 +19,44 @@ local script = {
|
|||
hooks = {},
|
||||
default_enabled = false,
|
||||
|
||||
default_value = {
|
||||
device_types = {'printer', 'video', 'iot'},
|
||||
max_recording = 3600,
|
||||
},
|
||||
|
||||
gui = {
|
||||
i18n_title = "flow_callbacks_config.mud",
|
||||
i18n_description = "flow_callbacks_config.mud_description",
|
||||
input_builder = "flow_mud",
|
||||
}
|
||||
}
|
||||
|
||||
-- #################################################################
|
||||
|
||||
function script.hooks.protocolDetected(now)
|
||||
mud_utils.handleFlow(now)
|
||||
function script.setup()
|
||||
enabled_device_types = nil
|
||||
|
||||
return(true)
|
||||
end
|
||||
|
||||
-- #################################################################
|
||||
|
||||
function script.hooks.protocolDetected(now, conf)
|
||||
if(enabled_device_types == nil) then
|
||||
local device_types = conf.device_types or script.default_value.device_types
|
||||
max_recording = conf.max_recording or script.default_value.max_recording
|
||||
|
||||
enabled_device_types = {}
|
||||
|
||||
-- Convert the device type into an ID
|
||||
for _, devtype in pairs(device_types) do
|
||||
local id = discover.devtype2id(devtype)
|
||||
|
||||
enabled_device_types[id] = true
|
||||
end
|
||||
end
|
||||
|
||||
mud_utils.handleFlow(now, enabled_device_types, max_recording)
|
||||
end
|
||||
|
||||
-- #################################################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue