Implements example of simplified flow alerts

This commit is contained in:
Simone Mainardi 2020-11-10 15:10:54 +01:00
parent 683a4a727b
commit 93920ccdce
9 changed files with 132 additions and 7 deletions

View file

@ -0,0 +1,42 @@
--
-- (C) 2019-20 - ntop.org
--
local user_scripts = require("user_scripts")
local alert_consts = require("alert_consts")
local flow_consts = require "flow_consts"
local alerts_api = require "alerts_api"
-- #################################################################
local script = {
-- Script category
category = user_scripts.script_categories.security,
-- NOTE: hooks defined below
hooks = {},
gui = {
i18n_title = "New API Demo",
i18n_description = "Demonstrate the use of the new API for flow alerts",
}
}
-- #################################################################
function script.hooks.protocolDetected(now)
if true then -- TODO: set to true to execute
local cli_score, srv_score, flow_score = 10, 10, 10
local status_type = flow_consts.status_types.status_new_api_demo.create(
"one_param",
"another_param"
)
alerts_api.trigger_status(status_type, alert_consts.alert_severities.error, cli_score, srv_score, flow_score)
end
end
-- #################################################################
return script