/src/ntopng/include/host_checks/CustomHostLuaScript.h
Line | Count | Source |
1 | | /* |
2 | | * |
3 | | * (C) 2013-24 - ntop.org |
4 | | * |
5 | | * |
6 | | * This program is free software; you can redistribute it and/or modify |
7 | | * it under the terms of the GNU General Public License as published by |
8 | | * the Free Software Foundation; either version 3 of the License, or |
9 | | * (at your option) any later version. |
10 | | * |
11 | | * This program is distributed in the hope that it will be useful, |
12 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | | * GNU General Public License for more details. |
15 | | * |
16 | | * You should have received a copy of the GNU General Public License |
17 | | * along with this program; if not, write to the Free Software Foundation, |
18 | | * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | | * |
20 | | */ |
21 | | |
22 | | #ifndef _CUSTOM_HOST_LUA_SCRIPT_H_ |
23 | | #define _CUSTOM_HOST_LUA_SCRIPT_H_ |
24 | | |
25 | | #include "ntop_includes.h" |
26 | | |
27 | | class CustomHostLuaScript : public HostCheck { |
28 | | private: |
29 | | LuaEngine* initVM(); |
30 | | bool disabled; |
31 | | |
32 | | HostAlert* allocAlert(HostCheck* c, Host* h, risk_percentage cli_pctg, |
33 | 0 | u_int32_t _score, const std::string &_msg) { |
34 | 0 | CustomHostLuaScriptAlert* alert = |
35 | 0 | new CustomHostLuaScriptAlert(c, h, cli_pctg, _score, _msg); |
36 | |
|
37 | 0 | if (cli_pctg != CLIENT_NO_RISK_PERCENTAGE) alert->setAttacker(); |
38 | |
|
39 | 0 | return alert; |
40 | 0 | }; |
41 | | |
42 | | public: |
43 | | CustomHostLuaScript(); |
44 | | ~CustomHostLuaScript(); |
45 | | |
46 | | void periodicUpdate(Host* h, HostAlert* engaged_alert); |
47 | | bool loadConfiguration(json_object* config); |
48 | | |
49 | 0 | HostCheckID getID() const { return host_check_custom_lua_script; } |
50 | 0 | std::string getName() const { |
51 | 0 | return (std::string("custom_host_lua_script")); |
52 | 0 | } |
53 | | }; |
54 | | |
55 | | #endif |