diff --git a/pandora_agents/pc/pandora_agent b/pandora_agents/pc/pandora_agent index 88f78e31ac..50e901f0ce 100644 --- a/pandora_agents/pc/pandora_agent +++ b/pandora_agents/pc/pandora_agent @@ -585,7 +585,7 @@ sub write_broker_conf($){ # Change the agent name if ($line =~ m/^\s*#*\s*agent_name\s+/) { - $line = "agent_name $broker_agent\n"; + $line = "agent_name $broker_agent\n#broker active\n"; } # Change the logfile elsif ($line =~ m/^\s*logfile\s+(.*)/) { diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 6b114a5e6c..c8ee8180a7 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.775-240103 +Version: 7.0NG.775-240126 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 10fcb6b9fe..fa783cc923 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.775-240103" +pandora_version="7.0NG.775-240126" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index dd4f1ee46f..112e0419da 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1039,7 +1039,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.775'; -use constant AGENT_BUILD => '240103'; +use constant AGENT_BUILD => '240126'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; @@ -1860,7 +1860,7 @@ sub write_broker_conf($){ # Change the agent name if ($line =~ m/^\s*#*\s*agent_name\s+/) { - $line = "agent_name $broker_agent\n"; + $line = "agent_name $broker_agent\n#broker active\n"; } # Change the logfile elsif ($line =~ m/^\s*logfile\s+(.*)/) { diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 23bea4dabc..5c05e6110e 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.775 -%define release 240103 +%define release 240126 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec index 8717ff4456..78383784e9 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.775 -%define release 240103 +%define release 240126 %define debug_package %{nil} Summary: Pandora FMS Linux agent, binary version diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec index fe7550cf7f..b21d106a96 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.775 -%define release 240103 +%define release 240126 %define debug_package %{nil} Summary: Pandora FMS Linux agent, binary version diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.spec b/pandora_agents/unix/pandora_agent.redhat_bin.spec index 2d8844c007..7a15966693 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.775 -%define release 240103 +%define release 240126 Summary: Pandora FMS Linux agent, binary version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 68b9b8e6c7..337a0ec5f3 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.775 -%define release 240103 +%define release 240126 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 6239b276a6..2f6e9c4d3d 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.775" -PI_BUILD="240103" +PI_BUILD="240126" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/Makefile.am b/pandora_agents/win32/Makefile.am index 4641081570..94e77312c4 100644 --- a/pandora_agents/win32/Makefile.am +++ b/pandora_agents/win32/Makefile.am @@ -1,9 +1,9 @@ bin_PROGRAMS = PandoraAgent if DEBUG -PandoraAgent_SOURCES = misc/cron.cc misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc debug_new.cpp +PandoraAgent_SOURCES = misc/cron.cc misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_exec_powershell.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc debug_new.cpp PandoraAgent_CXXFLAGS=-g -O0 else -PandoraAgent_SOURCES = misc/cron.cc misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_logchannel.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc +PandoraAgent_SOURCES = misc/cron.cc misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_exec_powershell.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_logchannel.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc PandoraAgent_CXXFLAGS=-O2 endif diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index a06c92148e..95fa0dd4a3 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{240103} +{240126} ViewReadme {Yes} diff --git a/pandora_agents/win32/modules/pandora_module.cc b/pandora_agents/win32/modules/pandora_module.cc index 2df46ad9d5..69a801e96b 100644 --- a/pandora_agents/win32/modules/pandora_module.cc +++ b/pandora_agents/win32/modules/pandora_module.cc @@ -236,6 +236,8 @@ Module_Kind Pandora_Module::parseModuleKindFromString (string kind) { if (kind == module_exec_str) { return MODULE_EXEC; + } else if (kind == module_exec_powershell_str) { + return MODULE_EXEC_POWERSHELL; } else if (kind == module_proc_str) { return MODULE_PROC; } else if (kind == module_service_str) { diff --git a/pandora_agents/win32/modules/pandora_module.h b/pandora_agents/win32/modules/pandora_module.h index 111fc79c79..bb19b266b2 100644 --- a/pandora_agents/win32/modules/pandora_module.h +++ b/pandora_agents/win32/modules/pandora_module.h @@ -94,7 +94,8 @@ namespace Pandora_Modules { MODULE_REGEXP, /**< The module searches a file for matches of a regular expression */ MODULE_PLUGIN, /**< Plugin */ MODULE_PING, /**< Ping module */ - MODULE_SNMPGET /**< SNMP get module */ + MODULE_SNMPGET, /**< SNMP get module */ + MODULE_EXEC_POWERSHELL /**< The module run a custom powershell command */ } Module_Kind; /** @@ -109,24 +110,25 @@ namespace Pandora_Modules { regex_t regexp; } Condition; - const string module_exec_str = "module_exec"; - const string module_proc_str = "module_proc"; - const string module_service_str = "module_service"; - const string module_freedisk_str = "module_freedisk"; - const string module_freedisk_percent_str = "module_freedisk_percent"; - const string module_freememory_str = "module_freememory"; - const string module_freememory_percent_str = "module_freememory_percent"; - const string module_cpuusage_str = "module_cpuusage"; - const string module_inventory_str = "module_inventory"; - const string module_logevent_str = "module_logevent"; - const string module_logchannel_str = "module_logchannel"; - const string module_wmiquery_str = "module_wmiquery"; - const string module_perfcounter_str = "module_perfcounter"; - const string module_tcpcheck_str = "module_tcpcheck"; - const string module_regexp_str = "module_regexp"; - const string module_plugin_str = "module_plugin"; - const string module_ping_str = "module_ping"; - const string module_snmpget_str = "module_snmpget"; + const string module_exec_str = "module_exec"; + const string module_proc_str = "module_proc"; + const string module_service_str = "module_service"; + const string module_freedisk_str = "module_freedisk"; + const string module_freedisk_percent_str = "module_freedisk_percent"; + const string module_freememory_str = "module_freememory"; + const string module_freememory_percent_str = "module_freememory_percent"; + const string module_cpuusage_str = "module_cpuusage"; + const string module_inventory_str = "module_inventory"; + const string module_logevent_str = "module_logevent"; + const string module_logchannel_str = "module_logchannel"; + const string module_wmiquery_str = "module_wmiquery"; + const string module_perfcounter_str = "module_perfcounter"; + const string module_tcpcheck_str = "module_tcpcheck"; + const string module_regexp_str = "module_regexp"; + const string module_plugin_str = "module_plugin"; + const string module_ping_str = "module_ping"; + const string module_snmpget_str = "module_snmpget"; + const string module_exec_powershell_str = "module_exec_powershell"; /** * Pandora module super-class exception. diff --git a/pandora_agents/win32/modules/pandora_module_exec_powershell.cc b/pandora_agents/win32/modules/pandora_module_exec_powershell.cc new file mode 100644 index 0000000000..99d37b7822 --- /dev/null +++ b/pandora_agents/win32/modules/pandora_module_exec_powershell.cc @@ -0,0 +1,91 @@ +/* Pandora exec module. These modules exec a powershell command. + + Copyright (c) 2006-2023 Pandora FMS. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "pandora_module_exec_powershell.h" +#include "../pandora_strutils.h" + +#include +#include +#include +#include +#include +#include + +#define EXEC_OK 0 +#define EXEC_ERR -1 +#define BUFSIZE 4096 + +using namespace Pandora; +using namespace Pandora_Strutils; +using namespace Pandora_Modules; + +/** + * Creates a Pandora_Module_Exec_Powershell object. + * + * @param name Module name + * @param exec Command to be executed. + */ +Pandora_Module_Exec_Powershell::Pandora_Module_Exec_Powershell(string name, string exec) + : Pandora_Module (name) { + + string escaped_exec; + + for (char c : exec) { + if (c == '"' || c == '\\') { + escaped_exec += '\\'; + } + escaped_exec += c; + } + + this->module_exec = "powershell -C \"" + escaped_exec + "\""; + + this->setKind (module_exec_powershell_str); +} + +void Pandora_Module_Exec_Powershell::run() { + string output_result; + + this->has_output = false; + + FILE* pipe = popen(this->module_exec.c_str(), "r"); + if (!pipe) { + pandoraLog ("Error while executing command.", GetLastError ()); + return; + } + + char buffer[BUFSIZE]; + while (fgets(buffer, BUFSIZE, pipe) != NULL) { + output_result += buffer; + } + + int result = pclose(pipe); + + if (result == EXEC_ERR) { + pandoraLog ("Error while closing command process.", GetLastError ()); + return; + } + + if (result != EXEC_OK) { + pandoraLog ("Error invalid powershell command.", GetLastError ()); + return; + } + + this->has_output = true; + this->setOutput (output_result); +} \ No newline at end of file diff --git a/pandora_agents/win32/modules/pandora_module_exec_powershell.h b/pandora_agents/win32/modules/pandora_module_exec_powershell.h new file mode 100644 index 0000000000..d3c9785c29 --- /dev/null +++ b/pandora_agents/win32/modules/pandora_module_exec_powershell.h @@ -0,0 +1,43 @@ +/* Pandora exec module. These modules exec a powershell command + + Copyright (c) 2006-2023 Pandora FMS. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef __PANDORA_MODULE_EXEC_POWERWSHELL_H__ +#define __PANDORA_MODULE_EXEC_POWERWSHELL_H__ + +#include "pandora_module.h" + +namespace Pandora_Modules { + /** + * Module to execute a powershell command. + * + * Any custom order that want to be executed can be put in + * the util directory into the Pandora agent path. + */ + class Pandora_Module_Exec_Powershell : public Pandora_Module { + + private: + string module_exec; + + public: + Pandora_Module_Exec_Powershell (string name, string exec); + void run (); + }; +} + +#endif diff --git a/pandora_agents/win32/modules/pandora_module_factory.cc b/pandora_agents/win32/modules/pandora_module_factory.cc index de149293ff..dd71dc2dd8 100644 --- a/pandora_agents/win32/modules/pandora_module_factory.cc +++ b/pandora_agents/win32/modules/pandora_module_factory.cc @@ -22,6 +22,7 @@ #include "pandora_module_factory.h" #include "pandora_module.h" #include "pandora_module_exec.h" +#include "pandora_module_exec_powershell.h" #include "pandora_module_proc.h" #include "pandora_module_service.h" #include "pandora_module_freedisk.h" @@ -129,6 +130,7 @@ using namespace Pandora_Strutils; #define TOKEN_ALERT_TEMPLATE ("module_alert_template") #define TOKEN_USER_SESSION ("module_user_session ") #define TOKEN_WAIT_TIMEOUT ("module_wait_timeout ") +#define TOKEN_EXEC_POWERSHELL ("module_exec_powershell ") string parseLine (string line, string token) { @@ -158,7 +160,7 @@ Pandora_Module * Pandora_Module_Factory::getModuleFromDefinition (string definition) { list tokens; list::iterator iter; - string module_name, module_type, module_exec; + string module_name, module_type, module_exec, module_exec_powershell; string module_min, module_max, module_description; string module_interval, module_absoluteinterval; string module_proc, module_service; @@ -268,6 +270,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { module_user_session = ""; macro = ""; module_wait_timeout = ""; + module_exec_powershell = ""; stringtok (tokens, definition, "\n"); @@ -302,6 +305,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { if (module_exec == "") { module_exec = parseLine (line, TOKEN_EXEC); } + if (module_exec_powershell == "") { + module_exec_powershell = parseLine (line, TOKEN_EXEC_POWERSHELL); + } if (module_wait_timeout == "") { module_wait_timeout = parseLine (line, TOKEN_WAIT_TIMEOUT); } @@ -626,6 +632,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { } } + if (module_exec_powershell != "") { + pos_macro = module_exec_powershell.find(macro_name); + if (pos_macro != string::npos){ + module_exec_powershell.replace(pos_macro, macro_name.size(), macro_value); + } + } + if (module_proc != "") { pos_macro = module_proc.find(macro_name); if (pos_macro != string::npos){ @@ -1155,6 +1168,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { module->setWaitTimeout (atoi (module_wait_timeout.c_str ())); } + } else if (module_exec_powershell != "") { + module = new Pandora_Module_Exec_Powershell (module_name, module_exec_powershell); + } else if (module_proc != "") { module = new Pandora_Module_Proc (module_name, module_proc); diff --git a/pandora_agents/win32/modules/pandora_module_list.cc b/pandora_agents/win32/modules/pandora_module_list.cc index be5cc32d45..b0612902a3 100644 --- a/pandora_agents/win32/modules/pandora_module_list.cc +++ b/pandora_agents/win32/modules/pandora_module_list.cc @@ -21,6 +21,7 @@ #include "pandora_module_factory.h" #include "pandora_module_list.h" #include "pandora_module_exec.h" +#include "pandora_module_exec_powershell.h" #include "pandora_module_proc.h" #include "pandora_module_service.h" #include "pandora_module_freedisk.h" @@ -235,6 +236,7 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition) Pandora_Module_Plugin *module_plugin; Pandora_Module_Ping *module_ping; Pandora_Module_SNMPGet *module_snmpget; + Pandora_Module_Exec_Powershell *module_exec_powershell; module = Pandora_Module_Factory::getModuleFromDefinition (definition); @@ -244,6 +246,11 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition) module_exec = (Pandora_Module_Exec *) module; modules->push_back (module_exec); + break; + case MODULE_EXEC_POWERSHELL: + module_exec_powershell = (Pandora_Module_Exec_Powershell *) module; + modules->push_back (module_exec_powershell); + break; case MODULE_PROC: module_proc = (Pandora_Module_Proc *) module; diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 8e8c4d29e5..f3961807fe 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.775 Build 240103") +#define PANDORA_VERSION ("7.0NG.775 Build 240126") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index ef6e710289..1bb160a879 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Pandora FMS" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.775(Build 240103))" + VALUE "ProductVersion", "(7.0NG.775(Build 240126))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 23cceaa27d..466722a50b 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.775-240103 +Version: 7.0NG.775-240126 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index b48c14a6d6..a47efa89c2 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.775-240103" +pandora_version="7.0NG.775-240126" package_pear=0 package_pandora=1 diff --git a/pandora_console/extensions/dbmanager.php b/pandora_console/extensions/dbmanager.php index acaaadd12c..38bb7c2d8b 100644 --- a/pandora_console/extensions/dbmanager.php +++ b/pandora_console/extensions/dbmanager.php @@ -280,18 +280,17 @@ function dbmgr_extension_main() if (is_array($result) === false) { echo 'Output: '.$result; - - db_pandora_audit( - AUDIT_LOG_SYSTEM, - 'DB Interface Extension. SQL', - false, - false, - $sql - ); - return; } + db_pandora_audit( + AUDIT_LOG_SYSTEM, + 'DB Interface Extension. SQL', + false, + false, + $sql + ); + echo "
"; $table = new stdClass(); $table->width = '100%'; diff --git a/pandora_console/extensions/grafana/index.php b/pandora_console/extensions/grafana/index.php index e925e56233..8a02e644cc 100644 --- a/pandora_console/extensions/grafana/index.php +++ b/pandora_console/extensions/grafana/index.php @@ -3,7 +3,7 @@ // Allow Grafana proxy header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Methods: GET, POST, OPTIONS'); -header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization'); +header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization, Authorization'); // Get all request headers $headers = apache_request_headers(); @@ -23,7 +23,10 @@ if ($headers['X-DS-Authorization']) { list($user, $password) = explode(':', base64_decode($headers['X-DS-Authorization'])); - // Check user login + // Prevent sql injection. + $user = mysqli_real_escape_string($config['dbconnection'], $user); + + // Check user login. $user_in_db = process_user_login($user, $password, true); if ($user_in_db !== false) { diff --git a/pandora_console/extensions/grafana/query.php b/pandora_console/extensions/grafana/query.php index c5812a32c9..3c7a843542 100644 --- a/pandora_console/extensions/grafana/query.php +++ b/pandora_console/extensions/grafana/query.php @@ -2,7 +2,7 @@ // Allow Grafana proxy. header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Methods: GET, POST, OPTIONS'); -header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization'); +header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization, Authorization'); // Get all request headers. $headers = apache_request_headers(); @@ -38,7 +38,7 @@ if ($headers['Authorization']) { $result_data = []; // Decode target data sent by datasource plugin in Grafana - $target_data = json_decode($target['target'], true); + $target_data = $target['target']; if ($target_data['module']) { // Get module name as target if not defined in Grafana. diff --git a/pandora_console/extensions/grafana/search.php b/pandora_console/extensions/grafana/search.php index 48a4f819a9..9193dd290e 100644 --- a/pandora_console/extensions/grafana/search.php +++ b/pandora_console/extensions/grafana/search.php @@ -3,7 +3,7 @@ // Allow Grafana proxy header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Methods: GET, POST, OPTIONS'); -header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization'); +header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization, Authorization'); // Get all request headers $headers = apache_request_headers(); diff --git a/pandora_console/extensions/insert_data.php b/pandora_console/extensions/insert_data.php index 6f09d889f7..98e8886733 100644 --- a/pandora_console/extensions/insert_data.php +++ b/pandora_console/extensions/insert_data.php @@ -223,7 +223,7 @@ function mainInsertData() '', empty($agent_id) ); - $table->data[1][2] = html_print_input_text('data', ($save === true) ? date(DATE_FORMAT) : $data, __('Data'), 10, 60, true); + $table->data[1][2] = html_print_input_text('date', ($save === true) ? date(DATE_FORMAT) : $data, __('Data'), 10, 60, true); $table->data[1][2] .= ' '; $table->data[1][2] .= html_print_input_text('time', ($save === true) ? date(TIME_FORMAT) : $time, '', 10, 7, true); @@ -283,8 +283,14 @@ function mainInsertData() secondText: '', currentText: '', closeText: ''}); - - $("#text-date").datepicker({dateFormat: ""}); + + $('#text-date').datepicker ({ + dateFormat: '', + changeMonth: true, + changeYear: true, + showAnim: 'slideDown', + firstDay: "", + }); $.datepicker.setDefaults($.datepicker.regional[ ""]); }); diff --git a/pandora_console/extras/discovery/DiscoveryApplicationsMigrateCodes.ini b/pandora_console/extras/discovery/DiscoveryApplicationsMigrateCodes.ini index c0cee7d03f..d05611a6b5 100644 --- a/pandora_console/extras/discovery/DiscoveryApplicationsMigrateCodes.ini +++ b/pandora_console/extras/discovery/DiscoveryApplicationsMigrateCodes.ini @@ -1,11 +1,11 @@ pandorafms.vmware=248788e0fb2cd4e11623e4a52ee7d05b pandorafms.mysql=fadb4750d18285c0eca34f47c6aa3cfe pandorafms.mssql=1cc215409741d19080269ffba112810e -pandorafms.oracle=2d9320a514d1e48a0b2804e1653c31c6 +pandorafms.oracle=abdfd7280f76276f696115cabdac731e pandorafms.db2=122f2abff0ec1d668c35ee0911483021 pandorafms.sap.deset=9bb72b7f7497a8b543f25cd71f96878f pandorafms.gcp.ce=6743d39452f8e1ad85d0d56a30843973 pandorafms.aws.ec2=07416081f11d92a7d5d9441dabb5c5cb pandorafms.aws.s3=eff053a212ea112e2a37efd9debbe6a0 pandorafms.aws.rds=47d7b02019329e1698f96db4959f9516 -pandorafms.azure.mc=04a1072d1ece8583645ad88204fbeed3 \ No newline at end of file +pandorafms.azure.mc=04a1072d1ece8583645ad88204fbeed3 diff --git a/pandora_console/extras/mr/68.sql b/pandora_console/extras/mr/68.sql new file mode 100644 index 0000000000..ea4bf2a2a1 --- /dev/null +++ b/pandora_console/extras/mr/68.sql @@ -0,0 +1,54 @@ +START TRANSACTION; + +CREATE TABLE IF NOT EXISTS `tmerge_error` ( + `id` int(10) NOT NULL auto_increment, + `id_node` int(10) default 0, + `phase` int(10) default 0, + `step` int(10) default 0, + `msg` LONGTEXT default "", + `action` text default "", + `utimestamp` int(20) unsigned NOT NULL default 0, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; + +ALTER TABLE `tmerge_error` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci; + +CREATE TABLE IF NOT EXISTS `tmerge_steps` ( + `id` int(10) NOT NULL auto_increment, + `id_node` int(10) default 0, + `phase` int(10) default 0, + `total` int(10) default 0, + `step` int(10) default 0, + `debug` varchar(1024) default "", + `action` varchar(100) default "", + `affected` varchar(100) default "", + `query` mediumtext default "", + `utimestamp` int(20) unsigned NOT NULL default 0, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; + +ALTER TABLE `tmerge_steps` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci; + +CREATE TABLE IF NOT EXISTS `tmerge_queries` ( + `steps` int(10) NOT NULL auto_increment, + `action` varchar(100) default "", + `affected` varchar(100) default "", + `utimestamp` int(20) unsigned NOT NULL default 0, + `query` LONGTEXT NOT NULL default "", + PRIMARY KEY (`steps`) +) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; + +ALTER TABLE `tmerge_queries` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci; + +-- Update version for plugin oracle +UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.oracle'; + +ALTER TABLE `tncm_agent_data` +ADD COLUMN `id_agent_data` int not null default 0 AFTER `script_type`; + +ALTER TABLE `tusuario` CHANGE COLUMN `metaconsole_data_section` `metaconsole_data_section` TEXT NOT NULL DEFAULT '' ; + +ALTER TABLE `tmensajes` ADD COLUMN `icon_notification` VARCHAR(250) NULL DEFAULT NULL AFTER `url`; + + +COMMIT; diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 82da1a66dd..5ad89d8d31 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -397,21 +397,23 @@ echo sprintf('
', $menuTypeClass); $modal_box .= ''.__('Join discord community').''; $modal_box .= '
'; - $modal_help = html_print_div( - [ - 'id' => 'modal-help-content', - 'content' => html_print_image( - 'images/help@header.svg', - true, - [ - 'title' => __('Help'), - 'class' => 'main_menu_icon bot invert_filter', - 'alt' => 'user', - ] - ).$modal_box, - ], - true, - ); + if ($config['activate_feedback'] === '1') { + $modal_help = html_print_div( + [ + 'id' => 'modal-help-content', + 'content' => html_print_image( + 'images/help@header.svg', + true, + [ + 'title' => __('Help'), + 'class' => 'main_menu_icon bot invert_filter', + 'alt' => 'user', + ] + ).$modal_box, + ], + true, + ); + } // User. diff --git a/pandora_console/general/register.php b/pandora_console/general/register.php index 759e319dbd..ed583c7ed4 100644 --- a/pandora_console/general/register.php +++ b/pandora_console/general/register.php @@ -100,7 +100,7 @@ if ($initial && users_is_admin()) { ); } -if (check_acl($config['id_user'], 0, 'AW')) { +if (check_acl($config['id_user'], 0, 'AW') && empty($sec2)) { $welcome = !$initial; try { $welcome_window = new WelcomeWindow($welcome); diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 1af5e3d780..80a480dd12 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -399,12 +399,12 @@ if ($new_agent === true) { // Ip adress. $tableAgent->data['caption_ip_address'] = __('IP Address'); -$tableAgent->rowclass['ip_address'] = 'w540px'; +$tableAgent->rowclass['ip_address'] = 'w400px'; $tableAgent->data['ip_address'][0] = html_print_input_text('direccion', $direccion_agente, '', 16, 100, true, false, false, '', 'w540px'); +$tableAgent->data['ip_address'][1] = html_print_button(__('Check unique IP'), 'check_unique_ip', false, '', ['class' => 'secondary w130px'], true); +$tableAgent->data['message_check_ip'][0] = html_print_div(['id' => 'message_check_ip'], true); $tableAgent->rowclass['additional_ip_address'] = 'subinput'; -$tableAgent->data['additional_ip_address'][0] = html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true); -$tableAgent->data['additional_ip_address'][1] = __('Unique IP'); $tableAgent->cellclass['additional_ip_address'][1] = 'w120px'; $tableAgent->data['additional_ip_address'][2] = html_print_input( [ @@ -500,21 +500,40 @@ $tableAgent->data['primary_group'][0] .= ui_print_group_icon( ); $tableAgent->data['primary_group'][0] .= ''; -$tableAgent->data['caption_interval'][0] = __('Interval'); -// $tableAgent->rowstyle['interval'] = 'width: 260px'; -$tableAgent->rowclass['interval'] = 'w540px'; -$tableAgent->data['interval'][0] = html_print_extended_select_for_time( - 'intervalo', - $intervalo, - '', - '', - '0', - 10, - true, - false, - true, - 'w33p' -); +$broker = false; +if (enterprise_installed()) { + // CHECK BROKER FOR SHOW INTERVAL. + enterprise_include('include/functions_config_agents.php'); + // Read configuration file. + $files = config_agents_get_agent_config_filenames($id_agente); + $file_name = $files['conf']; + $agent_config = file_get_contents($file_name); + $encoding = 'UTF-8'; + $agent_config_utf8 = mb_convert_encoding($agent_config, 'UTF-8', $encoding); + if ($agent_config_utf8 !== false) { + $agent_config = $agent_config_utf8; + } + + $broker = str_contains($agent_config, '#broker active'); +} + +if ($broker === false) { + $tableAgent->data['caption_interval'][0] = __('Interval'); + // $tableAgent->rowstyle['interval'] = 'width: 260px'; + $tableAgent->rowclass['interval'] = 'w540px'; + $tableAgent->data['interval'][0] = html_print_extended_select_for_time( + 'intervalo', + $intervalo, + '', + '', + '0', + 10, + true, + false, + true, + 'w33p' + ); +} if ($intervalo < SECONDS_5MINUTES) { $tableAgent->data['interval'][0] .= clippy_context_help('interval_agent_min'); @@ -1130,17 +1149,12 @@ foreach ($fields as $field) { } if ((bool) $field['is_password_type'] === true) { - $customContent = html_print_input_text_extended( + $customContent = html_print_input_password( 'customvalue_'.$field['id_field'], $custom_value, - 'customvalue_'.$field['id_field'], '', - 30, - 100, - $view_mode, - '', - '', - true, + 45, + 255, true ); } else if ($field['is_link_enabled']) { @@ -1301,6 +1315,7 @@ ui_require_jquery_file('bgiframe'); ?> diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 3da403ef80..c2e3a2f4f6 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -102,7 +102,6 @@ $alias_as_name = 0; $direccion_agente = get_parameter('direccion', ''); $direccion_agente = trim(io_safe_output($direccion_agente)); $direccion_agente = io_safe_input($direccion_agente); -$unique_ip = 0; $intervalo = SECONDS_5MINUTES; $ff_interval = 0; $quiet_module = 0; @@ -186,7 +185,6 @@ if ($create_agent) { $alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output))); $alias_as_name = (int) get_parameter_post('alias_as_name', 0); $direccion_agente = (string) get_parameter_post('direccion', ''); - $unique_ip = (int) get_parameter_post('unique_ip', 0); // Safe_output only validate ip. $direccion_agente = trim(io_safe_output($direccion_agente)); @@ -269,12 +267,7 @@ if ($create_agent) { $nombre_agente = $alias; } - if ($unique_ip && $direccion_agente != '') { - $sql = 'SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"'; - $exists_ip = db_get_row_sql($sql); - } - - if (!$exists_alias && !$exists_ip) { + if (!$exists_alias) { $id_agente = db_process_sql_insert( 'tagente', [ @@ -371,8 +364,6 @@ if ($create_agent) { $agent_creation_error = __('Could not be created'); if ($exists_alias) { $agent_creation_error = __('Could not be created, because name already exists'); - } else if ($exists_ip) { - $agent_creation_error = __('Could not be created, because IP already exists'); } } } @@ -962,7 +953,6 @@ if ($update_agent) { $alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output))); $alias_as_name = (int) get_parameter_post('alias_as_name', 0); $direccion_agente = (string) get_parameter_post('direccion', ''); - $unique_ip = (int) get_parameter_post('unique_ip', 0); // Safe_output only validate ip. $direccion_agente = trim(io_safe_output($direccion_agente)); @@ -1097,18 +1087,11 @@ if ($update_agent) { // If there is an agent with the same name, but a different ID. } - if ($direccion_agente !== $address_list && (bool) $unique_ip === true && $direccion_agente != '') { - $sql = 'SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"'; - $exists_ip = db_get_row_sql($sql); - } - $old_group = agents_get_agent_group($id_agente); if ($grupo <= 0) { ui_print_error_message(__('The group id %d is incorrect.', $grupo)); } else if ($old_group !== $grupo && group_allow_more_agents($grupo, true, 'update') === false) { ui_print_error_message(__('Agent cannot be updated due to the maximum agent limit for this group')); - } else if ($exists_ip) { - ui_print_error_message(__('Duplicate main IP address')); } else { // If different IP is specified than previous, add the IP. if ($direccion_agente != '' diff --git a/pandora_console/godmode/agentes/configure_field.php b/pandora_console/godmode/agentes/configure_field.php index 839040cb00..904b807bbd 100755 --- a/pandora_console/godmode/agentes/configure_field.php +++ b/pandora_console/godmode/agentes/configure_field.php @@ -275,21 +275,27 @@ $(document).ready (function () { $('#configure_field-3').show(); dialog_message("#message_no_set_password"); $('#configure_field-1').hide(); + $('#configure_field-2-0').hide(); } else{ $('#configure_field-3').hide(); $('#configure_field-1').show(); + $('#configure_field-2-0').show(); } }); $('input[type=checkbox][name=is_password_type]').change(function () { if( $('input[type=checkbox][name=is_password_type]').prop('checked')){ + $('#configure_field-1').hide(); dialog_message("#message_no_set_combo"); $('#configure_field-3').hide(); + $('#configure_field-2-1').hide(); } else{ if($('input[type=checkbox][name=is_combo_enable]').prop('checked') === true) { $('#configure_field-3').show(); } + $('#configure_field-1').show(); + $('#configure_field-2-1').show(); } }); }); diff --git a/pandora_console/godmode/agentes/inventory_manager.php b/pandora_console/godmode/agentes/inventory_manager.php index 3f27c3a6b3..d989b7d560 100644 --- a/pandora_console/godmode/agentes/inventory_manager.php +++ b/pandora_console/godmode/agentes/inventory_manager.php @@ -131,9 +131,13 @@ if ($add_inventory_module) { } } -// Load inventory module data for updating +// Load inventory module data for updating. if ($load_inventory_module) { - $sql = 'SELECT * FROM tagent_module_inventory WHERE id_module_inventory = '.$load_inventory_module; + $sql = sprintf( + 'SELECT * FROM tagent_module_inventory WHERE id_module_inventory = %s AND id_agente = %d', + $load_inventory_module, + $id_agente + ); $row = db_get_row_sql($sql); if (!empty($row)) { diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 15620240cd..47c843f2d9 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -1131,13 +1131,13 @@ if (isset($id_agente) === true && (int) $moduletype === MODULE_DATA) { $tableCron->data['cron_to_select'][0] = html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, $disabledBecauseInPolicy, true); } -$table_advanced->rowclass['cron_section'] = 'table_section full_section'; +$table_advanced->rowclass['cron_section'] = 'table_section full_section mrgn_top_mod_0px'; $table_advanced->data['cron_section'] = html_print_table($tableCron, true); $table_advanced->data['title_3'] = html_print_subtitle_table(__('Thresholds and state changes')); $table_advanced->rowclass['caption_min_max_values'] = 'w50p pdd_t_10px'; -$table_advanced->rowclass['min_max_values'] = 'w50p'; +$table_advanced->rowclass['min_max_values'] = 'w50p pdd_b_10px'; $table_advanced->data['caption_min_max_values'][0] = __('Min. Value'); $table_advanced->data['caption_min_max_values'][1] = __('Max. Value'); @@ -1214,7 +1214,7 @@ $tableDynamicThreshold->data['adv_dynamic_threshold_twotailed'][0] = html_print_ $disabledBecauseInPolicy ); -$table_advanced->rowclass['dynamic_threshold_table'] = 'table_section full_section'; +$table_advanced->rowclass['dynamic_threshold_table'] = 'table_section full_section mrgn_top_mod_0px'; $table_advanced->data['dynamic_threshold_table'] = html_print_table($tableDynamicThreshold, true); $tableFFThreshold = new stdClass(); @@ -1304,10 +1304,15 @@ $tableFFThreshold->data['ff_thresholds_each'][2] = html_print_input_text( $classdisabledBecauseInPolicy ); +$table_advanced->rowclass['gap_flipflop'] = 'mrgn_top_btn_10px_imp'; +$table_advanced->data['gap_flipflop'] = html_print_input_hidden('gap_flipflop', 0); -$table_advanced->rowclass['flipflop_thresholds_table'] = 'table_section full_section'; +$table_advanced->rowclass['flipflop_thresholds_table'] = 'table_section full_section mrgn_top_mod_0px'; $table_advanced->data['flipflop_thresholds_table'] = html_print_table($tableFFThreshold, true); +$table_advanced->rowclass['gap_ff'] = 'mrgn_top_btn_10px_imp'; +$table_advanced->data['gap_ff'] = html_print_input_hidden('gap_ff', 0); + $table_advanced->rowclass['caption_ff_interval_timeout'] = 'w50p'; $table_advanced->rowclass['ff_interval_timeout'] = 'w50p'; $table_advanced->cellclass['caption_ff_interval_timeout'][0] = 'w50p'; diff --git a/pandora_console/godmode/alerts/alert_actions.php b/pandora_console/godmode/alerts/alert_actions.php index e8915b05eb..7ba527b61e 100644 --- a/pandora_console/godmode/alerts/alert_actions.php +++ b/pandora_console/godmode/alerts/alert_actions.php @@ -497,7 +497,12 @@ foreach ($actions as $action) { $pagination = ''; if (isset($data)) { html_print_table($table); - $pagination = ui_pagination($total_actions, $url, 0, 0, true, 'offset', false, ''); + $show_count = false; + if (is_metaconsole() === true) { + $show_count = true; + } + + $pagination = ui_pagination($total_actions, $url, 0, 0, true, 'offset', $show_count, ''); } else { ui_print_info_message(['no_close' => true, 'message' => __('No alert actions configured') ]); } diff --git a/pandora_console/godmode/alerts/alert_commands.php b/pandora_console/godmode/alerts/alert_commands.php index a59de7f5e2..a5b4de7c80 100644 --- a/pandora_console/godmode/alerts/alert_commands.php +++ b/pandora_console/godmode/alerts/alert_commands.php @@ -1080,7 +1080,12 @@ foreach ($commands as $command) { if (isset($data) === true && count($table->data) > 0) { html_print_table($table); - $pagination = ui_pagination($total_commands, $url, 0, 0, true, 'offset', false, ''); + $show_count = false; + if (is_metaconsole() === true) { + $show_count = true; + } + + $pagination = ui_pagination($total_commands, $url, 0, 0, true, 'offset', $show_count, ''); } else { ui_print_info_message( [ diff --git a/pandora_console/godmode/alerts/alert_templates.php b/pandora_console/godmode/alerts/alert_templates.php index 8236d1e69c..537c346bac 100644 --- a/pandora_console/godmode/alerts/alert_templates.php +++ b/pandora_console/godmode/alerts/alert_templates.php @@ -493,6 +493,11 @@ foreach ($templates as $template) { $pagination = ''; if (isset($data) === true) { + $show_count = false; + if (is_metaconsole() === true) { + $show_count = true; + } + html_print_table($table); $pagination = ui_pagination( $total_templates, @@ -501,7 +506,7 @@ if (isset($data) === true) { 0, true, 'offset', - false, + $show_count, '' ); } else { diff --git a/pandora_console/godmode/alerts/alert_view.php b/pandora_console/godmode/alerts/alert_view.php index 7809742221..499bbded5e 100644 --- a/pandora_console/godmode/alerts/alert_view.php +++ b/pandora_console/godmode/alerts/alert_view.php @@ -308,13 +308,18 @@ $table->head[0] = __('Actions'); $table->style[0] = 'font-weight: bold; text-align: left;'; if (count($actions) == 1 && isset($actions[0])) { - $table->head[1] = __('Every time that the alert is fired'); - $table->data[0][0] = $actions[0]['name']; - $table->data[0][1] = html_print_image( - 'images/tick.png', - true, - ['class' => 'invert_filter'] - ); + if (!empty($actions[0]['name'])) { + $table->head[1] = __('Every time that the alert is fired'); + $table->data[0][0] = $actions[0]['name']; + $table->data[0][1] = html_print_image( + 'images/tick.png', + true, + ['class' => 'invert_filter'] + ); + } else { + $table->colspan[0] = 2; + $table->data[0] = __('No action defined.'); + } } else { foreach ($actions as $kaction => $action) { $table->data[$kaction][0] = $action['name']; diff --git a/pandora_console/godmode/events/event_filter.php b/pandora_console/godmode/events/event_filter.php index c4f1860e6f..a2ed2c72d5 100644 --- a/pandora_console/godmode/events/event_filter.php +++ b/pandora_console/godmode/events/event_filter.php @@ -88,7 +88,17 @@ if ($multiple_delete) { ['id_filter' => $id] ); - if ($result === false) { + if ($result !== false) { + db_process_sql_delete( + 'tfavmenu_user', + [ + 'id_element' => $id, + 'section' => 'Events', + 'id_user' => $config['id_user'], + ] + ); + $result = true; + } else { break; } } @@ -210,7 +220,7 @@ foreach ($filters as $filter) { true, [ 'title' => __('Delete'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ).''; } diff --git a/pandora_console/godmode/events/event_responses.editor.php b/pandora_console/godmode/events/event_responses.editor.php index ae31e10ad1..52d5a48ad1 100644 --- a/pandora_console/godmode/events/event_responses.editor.php +++ b/pandora_console/godmode/events/event_responses.editor.php @@ -285,20 +285,25 @@ if (enterprise_installed()) { $data = []; $data[0] = html_print_label_input_block( '', - '