Merge remote-tracking branch 'origin/develop' into ent-12152-generar-evento-de-encolamiento-excesivo-cuando-se-procesan-mas-de-xxx-xml-del-mismo-agente

This commit is contained in:
Ramon Novoa 2024-02-19 13:10:22 +01:00
commit 6ea6c77cac
209 changed files with 9176 additions and 2889 deletions

View File

@ -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+(.*)/) {

View File

@ -467,7 +467,7 @@ fi
# Script banner at start
echo " "
echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2015 ArticaST"
echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2024 PandoraFMS"
echo "This program is licensed under GPL2 Terms. http://pandorafms.com"
echo " "

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.775-240123
Version: 7.0NG.775-240219
Architecture: all
Priority: optional
Section: admin

View File

@ -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-240123"
pandora_version="7.0NG.775-240219"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1039,7 +1039,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.775';
use constant AGENT_BUILD => '240123';
use constant AGENT_BUILD => '240219';
# 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+(.*)/) {
@ -3678,9 +3678,21 @@ sub write_module_xml ($@) {
return;
}
if ($module->{'func'} == \&module_logger) {
$Xml .= $data[0];
return
# Is it an extraction log module?
if($module->{'type'} eq "log"){
my $output = join('', @data);
if ($output eq "") {
return;
}
$Xml .="<log_module>\n";
$Xml .= " <source><![CDATA[" . $module->{'name'} . "]]></source>\n";
$Xml .= " <type><![CDATA[" . $module->{'type'} . "]]></type>\n";
$Xml .= " <encoding>base64</encoding>\n";
$Xml .= " <data><![CDATA[" . $output . "]]></data>\n";
$Xml .= "</log_module>\n";
return;
}
# Critical section
@ -3690,7 +3702,7 @@ sub write_module_xml ($@) {
" <name><![CDATA[" . $module->{'name'} . "]]></name>\n" .
" <description><![CDATA[" . $module->{'description'} . "]]></description>\n" .
" <type>" . $module->{'type'} . "</type>\n";
# Interval
$Xml .= " <module_interval>" . $module->{'interval'} . "</module_interval>\n";
@ -3889,7 +3901,8 @@ sub module_logger ($) {
my $status = grep_logs(
$module->{'name'},
$module->{'params'},
$module->{'filter'}
$module->{'filter'},
$module->{'type'}
);
return $status;
@ -3926,20 +3939,25 @@ my $encode_sub = defined(&MIME::Base64::encode_base64) ? \&MIME::Base64::encode_
};
sub grep_logs {
my ($str_name, $str_file, $str_regex) = @_;
my ($module_name, $log_file, $reg_exp, $module_type) = @_;
if(!$str_name){
if(!$module_name){
log_message("module_logger", "Missing module name");
return;
}
if(!$str_file){
if(!$log_file){
log_message("module_logger", "Missing file name");
return;
}
if(!$str_regex){
$str_regex = '.*';
if(!$module_type){
log_message("module_logger", "Missing module type");
return;
}
if(!$reg_exp){
$reg_exp = '.*';
}
my $idx_dir = '/tmp/';
@ -3947,9 +3965,6 @@ sub grep_logs {
my $idx_pos = 0;
my $idx_size = 0;
my $idx_ino = '';
my $module_name = $str_name;
my $log_file = $str_file;
my $reg_exp = $str_regex;
# Check that log file exists
if (! -e $log_file) {
@ -3975,7 +3990,7 @@ sub grep_logs {
return if load_idx(\$idx_pos, \$idx_ino, \$idx_file, \$idx_size) == 1;
my @data = parse_log(\$idx_pos, \$idx_ino, \$idx_file, \$log_file, \$module_name, \$reg_exp, \$idx_size);
my $output = create_log($module_name, @data);
my $output = create_log($module_name, $module_type, @data);
return $output;
}
@ -4090,27 +4105,32 @@ sub grep_logs {
}
sub create_log {
my ($module_name, @data) = @_;
my ($module_name, $module_type, @data) = @_;
# No data
if ($#data < 0) {
return;
}
# Log module
my $output = "<log_module>\n";
$output .= "<source><![CDATA[" . $module_name . "]]></source>\n";
$output .= "<encoding>base64</encoding>\n";
$output .= "<data><![CDATA[";
$output .= &$encode_sub(join('', @data), '');
$output .= "]]></data>\n";
$output .= "</log_module>\n";
my $data_content = process_log_monitoring($module_type, @data);
return $output;
return $data_content;
}
}
sub process_log_monitoring {
my ($module_type, @data) = @_;
my $output = "";
if ($module_type eq "log"){
$output = &$encode_sub(join('', @data), '');
} elsif ($module_type eq "generic_data") {
$output = scalar @data;
} elsif ($module_type eq "generic_proc"){
$output = scalar @data > 0 ? 1 : 0;
} elsif ($module_type eq "generic_data_string" || $module_type eq "async_string"){
$output = join('', @data);
}
return $output;
}
################################################################################
# TERM Handler
################################################################################
@ -4283,6 +4303,10 @@ sub init_module ($) {
$module->{'alert_template'} = undef;
$module->{'filter'} = undef;
$module->{'absoluteinterval'} = undef;
$module->{'each_ff'} = undef;
$module->{'min_ff_event_normal'} = undef;
$module->{'min_ff_event_warning'} = undef;
$module->{'min_ff_event_critical'} = undef;
}
################################################################################

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.775
%define release 240123
%define release 240219
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.775
%define release 240123
%define release 240219
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.775
%define release 240123
%define release 240219
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version
@ -13,23 +13,22 @@ Name: %{name}
Version: %{version}
Release: %{release}
License: GPL
Vendor: ArticaST <http://www.artica.es>
Vendor: PandoraFMS <https://pandorafms.com>
Source0: %{source_name}-%{version}.tar.gz
URL: http://pandorafms.org
URL: https://pandorafms.com
Group: System/Monitoring
Packager: Sancho Lerena <slerena@artica.es>
Packager: PandoraFMS <info@pandorafms.com>
Prefix: /usr/share
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
BuildArch: x86_64
Requires(pre): shadow-utils
Requires(post): chkconfig /bin/ln
Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
Requires(post): /bin/ln
Requires(preun): /bin/rm /usr/sbin/userdel
Requires: coreutils unzip
Requires: util-linux procps grep
Requires: /sbin/ip /bin/awk
Requires: perl-interpreter
Requires: perl-IO-Compress
Requires: libnsl
Requires: libxcrypt-compat
AutoReq: 0
Provides: %{name}-%{version}
@ -50,7 +49,7 @@ mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_agent/
mkdir -p $RPM_BUILD_ROOT/usr/bin/
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
mkdir -p $RPM_BUILD_ROOT/etc/pandora/
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
#mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
@ -58,7 +57,7 @@ cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon
#cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
@ -119,21 +118,11 @@ then
cp -f /usr/share/pandora_agent/pandora_agent_daemon.service /usr/lib/systemd/system/
chmod -x /usr/lib/systemd/system/pandora_agent_daemon.service
# Enable the services on SystemD
systemctl daemon-reload
systemctl enable pandora_agent_daemon.service
else
/sbin/chkconfig --add pandora_agent_daemon
/sbin/chkconfig pandora_agent_daemon on
fi
if [ "$1" -gt 1 ]
then
echo "If Pandora Agent daemon was running with init.d script,"
echo "please stop it manually and start the service with systemctl"
fi
%preun
# Upgrading
@ -141,8 +130,7 @@ if [ "$1" = "1" ]; then
exit 0
fi
/sbin/chkconfig --del pandora_agent_daemon
/etc/rc.d/init.d/pandora_agent_daemon stop >/dev/null 2>&1 || :
systemctl stop pandora_agent_daemon.service > /dev/null 2>&1 || :
# Remove symbolic links
pushd /etc/pandora
@ -162,7 +150,6 @@ exit 0
%defattr(755,root,root)
/usr/bin/pandora_agent_exec
/usr/bin/tentacle_client
/etc/rc.d/init.d/pandora_agent_daemon
%defattr(644,root,root)
/usr/share/man/man1/pandora_agent.1.gz

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.775
%define release 240123
%define release 240219
Summary: Pandora FMS Linux agent, binary version
Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.775
%define release 240123
%define release 240219
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.775"
PI_BUILD="240123"
PI_BUILD="240219"
OS_NAME=`uname -s`
FORCE=0
@ -579,7 +579,7 @@ fi
# Script banner at start
echo " "
echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2015 ArticaST"
echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2024 PandoraFMS"
echo "This program is licensed under GPL2 Terms. http://pandorafms.com"
echo " "

View File

@ -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

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{240123}
{240219}
ViewReadme
{Yes}

View File

@ -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) {

View File

@ -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.

View File

@ -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 <iostream>
#include <stdexcept>
#include <sstream>
#include <string>
#include <vector>
#include <cstdio>
#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);
}

View File

@ -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 <code>util</code> 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

View File

@ -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<string> tokens;
list<string>::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);

View File

@ -48,7 +48,7 @@ Pandora_Module_Freedisk_Percent::Pandora_Module_Freedisk_Percent (string name, s
void
Pandora_Module_Freedisk_Percent::run () {
long res;
double res;
try {
Pandora_Module::run ();
@ -59,7 +59,7 @@ Pandora_Module_Freedisk_Percent::run () {
try {
res = Pandora_Wmi::getDiskFreeSpacePercent (this->disk_id);
this->setOutput (longtostr (res));
this->setOutput(std::to_string(res));
} catch (Pandora_Wmi::Pandora_Wmi_Exception e) {
this->has_output = false;
}

View File

@ -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;

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.775 Build 240123")
#define PANDORA_VERSION ("7.0NG.775 Build 240219")
string pandora_path;
string pandora_dir;

View File

@ -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 240123))"
VALUE "ProductVersion", "(7.0NG.775(Build 240219))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -188,11 +188,11 @@ Pandora_Wmi::getDiskFreeSpace (string disk_id) {
* @exception Pandora_Wmi_Exception Throwd if an error occured when reading
* from WMI database.
*/
unsigned long
double
Pandora_Wmi::getDiskFreeSpacePercent (string disk_id) {
CDhInitialize init;
CDispPtr wmi_svc, quickfixes;
double free_space = 0, size = 0;
double free_space = 0, size = 0;
string query;
query = "SELECT Size, FreeSpace FROM Win32_LogicalDisk WHERE DeviceID = \"" + disk_id + "\"";
@ -202,7 +202,7 @@ Pandora_Wmi::getDiskFreeSpacePercent (string disk_id) {
dhCheck (dhGetValue (L"%o", &quickfixes, wmi_svc,
L".ExecQuery(%T)",
query.c_str ()));
FOR_EACH (quickfix, quickfixes, NULL) {
dhGetValue (L"%e", &free_space, quickfix,
L".FreeSpace");
@ -213,7 +213,7 @@ Pandora_Wmi::getDiskFreeSpacePercent (string disk_id) {
return 0;
}
return (unsigned long) (free_space * 100 / size);
return (free_space * 100 / size);
} NEXT_THROW (quickfix);
} catch (string errstr) {
pandoraLog ("getDiskFreeSpace error. %s", errstr.c_str ());

View File

@ -44,7 +44,7 @@ namespace Pandora_Wmi {
int isProcessRunning (string process_name);
int isServiceRunning (string service_name);
unsigned long getDiskFreeSpace (string disk_id);
unsigned long getDiskFreeSpacePercent (string disk_id);
double getDiskFreeSpacePercent (string disk_id);
int getCpuUsagePercentage (int cpu_id);
long getFreememory ();
long getFreememoryPercent ();

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.775-240123
Version: 7.0NG.775-240219
Architecture: all
Priority: optional
Section: admin

View File

@ -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-240123"
pandora_version="7.0NG.775-240219"
package_pear=0
package_pandora=1

View File

@ -280,18 +280,17 @@ function dbmgr_extension_main()
if (is_array($result) === false) {
echo '<strong>Output: <strong>'.$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 "<div class='overflow'>";
$table = new stdClass();
$table->width = '100%';

View File

@ -23,6 +23,9 @@ if ($headers['Authorization']) {
list($user, $password) = explode(':', base64_decode($headers['Authorization']));
// Prevent sql injection.
$user = mysqli_real_escape_string($config['dbconnection'], $user);
// Check user login
$user_in_db = process_user_login($user, $password, true);

View File

@ -24,6 +24,9 @@ if ($headers['Authorization']) {
list($user, $password) = explode(':', base64_decode($headers['Authorization']));
// Prevent sql injection.
$user = mysqli_real_escape_string($config['dbconnection'], $user);
// Check user login
$user_in_db = process_user_login($user, $password, true);

View File

@ -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] .= '&nbsp;';
$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: '<?php echo __('Second'); ?>',
currentText: '<?php echo __('Now'); ?>',
closeText: '<?php echo __('Close'); ?>'});
$("#text-date").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
$('#text-date').datepicker ({
dateFormat: '<?php echo DATE_FORMAT_JS; ?>',
changeMonth: true,
changeYear: true,
showAnim: 'slideDown',
firstDay: "<?php echo $config['datepicker_first_day']; ?>",
});
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
});

View File

@ -394,7 +394,7 @@ function quickShellSettings()
__('Address'),
html_print_input_text(
'gotty_addr',
$config['gotty_addr'],
($config['gotty_addr'] ?? ''),
'',
30,
100,
@ -443,9 +443,8 @@ function quickShellSettings()
html_print_checkbox_switch(
'gotty_ssh_use_ssl',
1,
$config['gotty_ssh_use_ssl'],
true,
$disable_agentaccess
($config['gotty_ssh_use_ssl'] ?? false),
true
)
);
@ -497,7 +496,7 @@ function quickShellSettings()
html_print_checkbox_switch(
'gotty_telnet_use_ssl',
1,
$config['gotty_telnet_use_ssl'],
($config['gotty_telnet_use_ssl'] ?? false),
true
)
);

View File

@ -128,6 +128,6 @@ if (empty($data)) {
}
echo '{
"label": "'.htmlspecialchars($graph_title, ENT_QUOTES).'",
"data": [["'.time().'", '.htmlspecialchars($data, ENT_QUOTES).']]
"label": "'.htmlspecialchars(($graph_title ?? ''), ENT_QUOTES).'",
"data": [["'.time().'", '.htmlspecialchars(($data ?? ''), ENT_QUOTES).']]
}';

View File

@ -1,497 +0,0 @@
<?php
/**
* Resources exportation view.
*
* @category Extensions.
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* 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 for version 2.
* 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.
* ============================================================================
*/
// Load global vars.
if (isset($_GET['get_ptr'])) {
if ($_GET['get_ptr'] == 1) {
$ownDir = dirname(__FILE__).'/';
$ownDir = str_replace('\\', '/', $ownDir);
// Don't start a session before this import.
// The session is configured and started inside the config process.
include_once $ownDir.'../include/config.php';
// Login check
if (!isset($_SESSION['id_usuario'])) {
$config['id_user'] = null;
} else {
$config['id_user'] = $_SESSION['id_usuario'];
}
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php';
return;
}
$hook_enterprise = enterprise_include('extensions/resource_exportation/functions.php');
header('Content-type: binary');
header('Content-Disposition: attachment; filename="'.get_name_xml_resource($hook_enterprise)).'"';
header('Pragma: no-cache');
header('Expires: 0');
output_xml_resource($hook_enterprise);
}
} else {
extensions_add_godmode_menu_option(__('Resource exportation'), 'PM', 'gagente', '', 'v1r1');
extensions_add_godmode_function('resource_exportation_extension_main');
}
function output_xml_resource($hook_enterprise)
{
global $config;
$type = get_parameter('type');
$id = (int) get_parameter('id');
switch ($type) {
case 'report':
output_xml_report($id);
break;
case 'visual_console':
output_xml_visual_console($id);
break;
default:
if ($hook_enterprise === true) {
$include_agents = get_parameter('include_agents', 0);
return enterprise_output_xml_resource($type, $id, $include_agents);
}
break;
}
}
function output_xml_report($id)
{
global $config;
include_once $config['homedir'].'/include/functions_agents.php';
$report = db_get_row('treport', 'id_report', $id);
echo '<?xml version="1.0" encoding="UTF-8" ?>'."\n";
echo "<report>\n";
echo '<name><![CDATA['.io_safe_output($report['name'])."]]></name>\n";
if (isset($report['description'])) {
echo '<description><![CDATA['.io_safe_output($report['description'])."]]></description>\n";
}
$group = db_get_value('nombre', 'tgrupo', 'id_grupo', $report['id_group']);
echo '<group><![CDATA['.io_safe_output($group)."]]></group>\n";
$items = db_get_all_rows_field_filter(
'treport_content',
'id_report',
$report['id_report']
);
foreach ($items as $item) {
echo "<item>\n";
echo '<type>'.io_safe_output($item['type'])."</type>\n";
echo '<description>'.io_safe_output($item['description'])."</description>\n";
echo '<period>'.io_safe_output($item['period'])."</period>\n";
if ($item['id_agent'] != 0) {
$agent = db_get_value('alias', 'tagente', 'id_agente', $item['id_agent']);
}
if ($item['id_agent_module'] != 0) {
$module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $item['id_agent_module']);
$id_agent = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $item['id_agent_module']);
$agent = db_get_value('alias', 'tagente', 'id_agente', $item['id_agent']);
echo '<module><![CDATA['.io_safe_output($module)."]]></module>\n";
}
if (isset($agent)) {
echo '<agent><![CDATA['.$agent."]]></agent>\n";
}
$agent = null;
switch (io_safe_output($item['type'])) {
case 2:
case 'custom_graph':
case 'automatic_custom_graph':
$graph = db_get_value('name', 'tgraph', 'id_graph', $item['id_gs']);
echo '<graph><![CDATA['.io_safe_output($graph)."]]></graph>\n";
break;
case 3:
case 'SLA':
echo '<only_display_wrong>'.$item['only_display_wrong']."</only_display_wrong>\n";
echo '<monday>'.$item['monday']."</monday>\n";
echo '<tuesday>'.$item['tuesday']."</tuesday>\n";
echo '<wednesday>'.$item['wednesday']."</wednesday>\n";
echo '<thursday>'.$item['thursday']."</thursday>\n";
echo '<friday>'.$item['friday']."</friday>\n";
echo '<saturday>'.$item['saturday']."</saturday>\n";
echo '<sunday>'.$item['sunday']."</sunday>\n";
echo '<time_from>'.$item['time_from']."</time_from>\n";
echo '<time_to>'.$item['time_to']."</time_to>\n";
$slas = db_get_all_rows_field_filter('treport_content_sla_combined', 'id_report_content', $item['id_rc']);
if ($slas === false) {
$slas = [];
}
foreach ($slas as $sla) {
$module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $sla['id_agent_module']);
$id_agent = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $sla['id_agent_module']);
$agent = db_get_value('alias', 'tagente', 'id_agente', $item['id_agent']);
echo '<sla>';
echo '<agent><![CDATA['.$agent."]]></agent>\n";
echo '<module><![CDATA['.io_safe_output($module)."]]></module>\n";
echo '<sla_max>'.$sla['sla_max']."</sla_max>\n";
echo '<sla_min>'.$sla['sla_min']."</sla_min>\n";
echo '<sla_limit>'.$sla['sla_limit']."</sla_limit>\n";
echo '</sla>';
}
break;
case 'text':
echo '<text><![CDATA['.io_safe_output($item['text'])."]]></text>\n";
break;
case 'sql':
echo '<header_definition><![CDATA['.io_safe_output($item['header_definition'])."]]></header_definition>\n";
if (!empty($item['external_source'])) {
echo '<sql><![CDATA['.io_safe_output($item['external_source'])."]]></sql>\n";
} else {
$sql = db_get_value('sql', 'treport_custom_sql', 'id', $item['treport_custom_sql_id']);
echo '<sql>'.io_safe_output($sql)."</sql>\n";
}
break;
case 'sql_graph_pie':
case 'sql_graph_vbar':
case 'sql_graph_hbar':
echo '<header_definition>'.io_safe_output($item['header_definition'])."</header_definition>\n";
if (!empty($item['external_source'])) {
echo '<sql>'.io_safe_output($item['external_source'])."</sql>\n";
} else {
$sql = db_get_value('sql', 'treport_custom_sql', 'id', $item['treport_custom_sql_id']);
echo '<sql>'.io_safe_output($sql)."</sql>\n";
}
break;
case 'event_report_group':
$group = db_get_value('nombre', 'tgrupo', 'id_grupo', $item['id_agent']);
echo '<group><![CDATA['.io_safe_output($group)."]]></group>\n";
break;
case 'url':
echo '<url><![CDATA['.io_safe_output($values['external_source']).']]></url>';
break;
case 'database_serialized':
echo '<header_definition><![CDATA['.io_safe_output($item['header_definition']).']]></header_definition>';
echo '<line_separator><![CDATA['.io_safe_output($item['line_separator']).']]></line_separator>';
echo '<column_separator><![CDATA['.io_safe_output($item['header_definition']).']]></column_separator>';
break;
case 1:
case 'simple_graph':
case 'simple_baseline_graph':
case 6:
case 'monitor_report':
case 7:
case 'avg_value':
case 8:
case 'max_value':
case 9:
case 'min_value':
case 10:
case 'sumatory':
case 'agent_detailed_event':
case 'event_report_agent':
case 'event_report_module':
case 'alert_report_module':
case 'alert_report_agent':
case 'alert_report_group':
default:
// Do nothing.
break;
}
echo "</item>\n";
}
echo "</report>\n";
}
function output_xml_visual_console($id)
{
$visual_map = db_get_row('tlayout', 'id', $id);
echo '<?xml version="1.0" encoding="UTF-8" ?>'."\n";
echo "<visual_map>\n";
echo '<name><![CDATA['.io_safe_output($visual_map['name'])."]]></name>\n";
if ($visual_map['id_group'] != 0) {
$group = db_get_value('nombre', 'tgrupo', 'id_grupo', $visual_map['id_group']);
echo '<group><![CDATA['.io_safe_output($group)."]]></group>\n";
}
echo '<background><![CDATA['.io_safe_output($visual_map['background'])."]]></background>\n";
echo '<height>'.io_safe_output($visual_map['height'])."</height>\n";
echo '<width>'.io_safe_output($visual_map['width'])."</width>\n";
$items = db_get_all_rows_field_filter('tlayout_data', 'id_layout', $visual_map['id']);
if ($items === false) {
$items = [];
}
foreach ($items as $item) {
echo "<item>\n";
echo '<other_id>'.$item['id']."</other_id>\n";
// OLD ID USE FOR parent item
$agent = '';
if ($item['id_agent'] != 0) {
$agent = db_get_value('nombre', 'tagente', 'id_agente', $item['id_agent']);
}
if (!empty($item['label'])) {
echo '<label><![CDATA['.io_safe_output($item['label'])."]]></label>\n";
}
echo '<x>'.$item['pos_x']."</x>\n";
echo '<y>'.$item['pos_y']."</y>\n";
echo '<type>'.$item['type']."</type>\n";
if ($item['width'] != 0) {
echo '<width>'.$item['width']."</width>\n";
}
if ($item['height'] != 0) {
echo '<height>'.$item['height']."</height>\n";
}
if (!empty($item['image'])) {
echo '<image>'.$item['image']."</image>\n";
}
if ($item['period'] != 0) {
echo '<period>'.$item['period']."</period>\n";
}
if (isset($item['id_agente_modulo'])) {
if ($item['id_agente_modulo'] != 0) {
$module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $item['id_agente_modulo']);
$id_agent = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $item['id_agente_modulo']);
$agent = db_get_value('nombre', 'tagente', 'id_agente', $id_agent);
echo '<module><![CDATA['.io_safe_output($module)."]]></module>\n";
}
}
if (!empty($agent)) {
echo '<agent><![CDATA['.$agent."]]></agent>\n";
}
if ($item['id_layout_linked'] != 0) {
echo '<id_layout_linked>'.$item['id_layout_linked']."</id_layout_linked>\n";
}
if ($item['parent_item'] != 0) {
echo '<parent_item>'.$item['parent_item']."</parent_item>\n";
}
if (!empty($item['clock_animation'])) {
echo '<clock_animation>'.$item['clock_animation']."</clock_animation>\n";
}
if (!empty($item['fill_color'])) {
echo '<fill_color>'.$item['fill_color']."</fill_color>\n";
}
if (!empty($item['type_graph'])) {
echo '<type_graph>'.$item['type_graph']."</type_graph>\n";
}
if (!empty($item['time_format'])) {
echo '<time_format>'.$item['time_format']."</time_format>\n";
}
if (!empty($item['timezone'])) {
echo '<timezone>'.$item['timezone']."</timezone>\n";
}
if (!empty($item['border_width'])) {
echo '<border_width>'.$item['border_width']."</border_width>\n";
}
if (!empty($item['border_color'])) {
echo '<border_color>'.$item['border_color']."</border_color>\n";
}
echo "</item>\n";
}
echo "</visual_map>\n";
}
function get_name_xml_resource($hook_enterprise)
{
global $config;
$type = get_parameter('type');
$id = (int) get_parameter('id');
switch ($type) {
case 'report':
$name = db_get_value('name', 'treport', 'id_report', $id);
break;
case 'visual_console':
$name = db_get_value('name', 'tlayout', 'id', $id);
break;
default:
if ($hook_enterprise === true) {
return enterprise_get_name_xml_resource($type, $id);
}
break;
}
$file = io_safe_output($name).'.ptr';
return $file;
}
function get_xml_resource()
{
global $config;
$hook_enterprise = enterprise_include('extensions/resource_exportation/functions.php');
}
function resource_exportation_extension_main()
{
global $config;
check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php';
return;
}
$hook_enterprise = enterprise_include('extensions/resource_exportation/functions.php');
ui_print_standard_header(
__('Resource exportation'),
'images/extensions.png',
false,
'',
true,
[],
[
[
'link' => '',
'label' => __('Resources'),
],
[
'link' => '',
'label' => __('Resource exporting'),
],
]
);
ui_print_warning_message(
__('This extension makes exportation of resource template more easy.').'<br>'.__('You can export resource templates in .ptr format.')
);
$table = new stdClass();
$table->class = 'databox filter-table-adv';
$table->id = 'resource_exportation_table';
$table->style = [];
$table->style[0] = 'width: 30%';
$table->style[1] = 'vertical-align: bottom;';
$table->data = [];
$table->data[0][] = html_print_label_input_block(
__('Report'),
html_print_div(
[
'class' => 'flex-content-left',
'content' => html_print_select_from_sql('SELECT id_report, name FROM treport', 'report', '', '', '', 0, true),
],
true
)
);
$table->data[0][] = html_print_button(__('Export'), '', false, 'export_to_ptr("report");', '', true);
$table->data[1][] = html_print_label_input_block(
__('Visual console'),
html_print_div(
[
'class' => 'flex-content-left',
'content' => html_print_select_from_sql('SELECT id, name FROM tlayout', 'visual_console', '', '', '', 0, true),
],
true
)
);
$table->data[1][] = html_print_button(__('Export'), '', false, 'export_to_ptr("visual_console");', '', true);
if ($hook_enterprise === true) {
add_rows_for_enterprise($table->data);
}
html_print_table($table);
?>
<script type="text/javascript">
function export_to_ptr(type) {
id = $("select#" + type + " option:selected").val();
url = location.href.split('index');
if (type == "policy") {
var include_agents = $("#checkbox-export_agents").prop("checked")
url = url[0] + 'extensions/resource_exportation.php?get_ptr=1&type=' + type
+ '&id=' + id + '&include_agents=' + include_agents;
}
else {
url = url[0] + 'extensions/resource_exportation.php?get_ptr=1&type=' + type
+ '&id=' + id;
}
location.href=url;
}
</script>
<?php
}

File diff suppressed because it is too large Load Diff

View File

@ -1736,3 +1736,5 @@ extensions/files_repo/sql/files_repo.oracle.sql
extensions/files_repo/sql/files_repo.postgreSQL.sql
extensions/files_repo/sql/files_repo.sql
extensions/files_repo
extensions/resource_exportation.php
extensions/resource_registration.php

View File

@ -1,14 +1,97 @@
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;
ALTER TABLE `tevent_sound` MODIFY COLUMN `name` text NULL;
ALTER TABLE `tevent_sound` MODIFY COLUMN `sound` text NULL;
ALTER TABLE `treport_content` MODIFY COLUMN `use_prefix_notation` tinyint unsigned NOT NULL DEFAULT 1;
ALTER TABLE `treport_content_template` MODIFY COLUMN `use_prefix_notation` tinyint unsigned NOT NULL DEFAULT 1;
ALTER TABLE `tsesion_filter` MODIFY COLUMN `id_name` text NULL;
ALTER TABLE `tsesion_filter` MODIFY COLUMN `ip` text NULL;
ALTER TABLE `tsesion_filter` MODIFY COLUMN `type` text NULL;
ALTER TABLE `tsesion_filter` MODIFY COLUMN `user` text NULL;
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`;
UPDATE `tncm_template` SET `vendors` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM vendors))), '"]'), `models` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM models))), '"]');
UPDATE `tncm_agent_data_template` SET `vendors` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM vendors))), '"]'), `models` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM models))), '"]');
-- 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`;
SET @widget_id = NULL;
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = 'GisMap';
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,'GisMap','GisMap','Gis map','','GisMap.php');
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`;
SET @class_name = 'ITSMIncidences';
SET @unique_name = 'ITSMIncidences';
SET @description = 'Pandora ITSM tickets';
SET @page = 'ITSMIncidences.php';
SET @widget_id = NULL;
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
-- Create SNMPv3 credentials for recon tasks and update them
SET @creds_name = 'Recon-SNMP-creds-';
INSERT IGNORE INTO `tcredential_store` (`identifier`, `id_group`, `product`, `extra_1`)
SELECT
CONCAT(@creds_name,`id_rt`) AS `identifier`,
`id_group`,
'SNMP' AS `product`,
CONCAT(
'{',
'"community":"',`snmp_community`,'",',
'"version":"',`snmp_version`,'",',
'"securityLevelV3":"',`snmp_security_level`,'",',
'"authUserV3":"',`snmp_auth_user`,'",',
'"authMethodV3":"',`snmp_auth_method`,'",',
'"authPassV3":"',`snmp_auth_pass`,'",',
'"privacyMethodV3":"',`snmp_privacy_method`,'",',
'"privacyPassV3":"',`snmp_privacy_pass`,'"',
'}'
) AS `extra1`
FROM `trecon_task` WHERE `snmp_version` = 3 AND `snmp_enabled` = 1
;
UPDATE `trecon_task` SET `auth_strings` = IF(`auth_strings` = '',CONCAT(@creds_name,`id_rt`),CONCAT(@creds_name,`id_rt`,',',`auth_strings`)) WHERE `snmp_version` = 3 AND `snmp_enabled` = 1;
COMMIT;

View File

@ -54,7 +54,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
// ======= Servers List ===============================================
if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) {
$servers = [];
$servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver');
$servers['all'] = (int) count((servers_get_info() ?? []));
if ($servers['all'] != 0) {
$servers['up'] = (int) servers_check_status();
$servers['down'] = ($servers['all'] - $servers['up']);
@ -1021,11 +1021,14 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
modal: {
title: "<?php echo __('Welcome to').' '.io_safe_output(get_product_name()); ?>",
cancel: '<?php echo __('Do not show anymore'); ?>',
ok: '<?php echo __('Close'); ?>'
ok: '<?php echo __('Close'); ?>',
overlay: true,
overlayExtraClass: 'welcome-overlay',
},
onshow: {
page: 'include/ajax/welcome_window',
method: 'loadWelcomeWindow',
width: 1000,
},
oncancel: {
page: 'include/ajax/welcome_window',
@ -1043,6 +1046,34 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
}
})
}
},
onload: () => {
$(document).ready(function () {
var buttonpane = $("div[aria-describedby='welcome_modal_window'] .ui-dialog-buttonpane.ui-widget-content.ui-helper-clearfix");
$(buttonpane).append(`
<div class="welcome-wizard-buttons">
<label>
<input type="checkbox" class="welcome-wizard-do-not-show" value="1" />
<?php echo __('Do not show anymore'); ?>
</label>
<button class="close-wizard-button"><?php echo __('Close wizard'); ?></button>
</div>
`);
var closeWizard = $("button.close-wizard-button");
$(closeWizard).click(function (e) {
var close = $("div[aria-describedby='welcome_modal_window'] button.sub.ok.submit-next.ui-button");
var cancel = $("div[aria-describedby='welcome_modal_window'] button.sub.upd.submit-cancel.ui-button");
var checkbox = $("div[aria-describedby='welcome_modal_window'] .welcome-wizard-do-not-show:checked").length;
if (checkbox === 1) {
$(cancel).click();
} else {
$(close).click()
}
});
});
}
});
});

View File

@ -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);

View File

@ -357,7 +357,18 @@ if ($new_agent === false) {
$tableAgent->data['caption_name'][0] = __('Agent name');
$tableAgent->rowclass['name'] = 'w540px';
$tableAgent->cellstyle['name'][0] = 'width: 100%;';
$tableAgent->data['name'][0] = html_print_input_text('agente', $nombre_agente, '', 76, 100, true, false, false, '', 'w100p');
$tableAgent->data['name'][0] = html_print_input_text(
'agente',
$nombre_agente,
'',
76,
100,
true,
true,
false,
'',
'w100p'
);
$tableAgent->data['name'][0] .= html_print_div(
[
'class' => 'moduleIdBox',
@ -365,6 +376,29 @@ if ($new_agent === false) {
],
true
);
// Other than Linux, Solaris, AIX, BSD, HPUX, MacOs, and Windows.
if ($id_os !== LINUX && $id_os !== SOLARIS && $id_os !== AIX
&& $id_os !== BSD && $id_os !== HPUX && $id_os !== MACOS
&& $id_os !== WINDOWS
) {
$tableAgent->data['name'][0] .= html_print_anchor(
[
'content' => html_print_image(
'images/edit.svg',
true,
[
'border' => 0,
'title' => __('Edit agent name'),
'class' => 'main_menu_icon invert_filter after_input_icon forced_title clickable',
'onclick' => 'editAgent()',
]
),
],
true
);
}
// Agent options for QR code.
$agent_options_update = 'agent_options_update';
}
@ -500,21 +534,42 @@ $tableAgent->data['primary_group'][0] .= ui_print_group_icon(
);
$tableAgent->data['primary_group'][0] .= '</span>';
$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'];
if (empty($file_name) === false) {
$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');
@ -653,6 +708,19 @@ if (enterprise_installed()) {
}
}
if ($id_os === '1') {
$modules = $agent_plugin->getModules();
foreach ($modules as $key => $row) {
if (preg_match('/Syslog/', $row['raw']) === 1) {
if ($row['disabled'] === 1) {
$enable_log_collector = 0;
} else {
$enable_log_collector = 1;
}
}
}
}
if ($id_os === '9') {
$modules = $agent_plugin->getModules();
foreach ($modules as $key => $row) {
@ -1457,7 +1525,6 @@ ui_require_jquery_file('bgiframe');
128
);
}
$("#text-agente").prop('readonly', true);
$("#text-direccion").on('change',function(e){
@ -1504,6 +1571,39 @@ ui_require_jquery_file('bgiframe');
}
}
function editAgent() {
$(`#text-agente`).attr(`readonly`, false);
const title = '<?php echo __('Warning'); ?>';
const text = '<?php echo __('Change the internal name of the agent may cause duplicity and malfunction'); ?>';
const id = uniqId();
$("body").append('<div title="' + title + '" id="' + id + '"></div>');
$("#" + id).empty();
$("#" + id).append(text);
$("#" + id).dialog({
height: 150,
width: 528,
opacity: 1,
modal: true,
position: {
my: "center",
at: "center",
of: window,
collision: "fit"
},
title: title,
closeOnEscape: true,
buttons: [{
text: "OK",
click: function() {
$(this).dialog("close");
}
}],
open: function(event, ui) {
$(".ui-dialog-titlebar-close").hide();
},
}).show();
}
function check_unique_ip() {
const direccion = $('#text-direccion').val();

View File

@ -949,6 +949,13 @@ if ($update_agent) {
$mssg_warning = 0;
$id_agente = (int) get_parameter_post('id_agente');
$nombre_agente = str_replace('`', '&lsquo;', (string) get_parameter_post('agente', ''));
$repeated_name = db_get_row_sql(
sprintf(
'SELECT nombre FROM tagente WHERE id_agente <> %s AND nombre like "%s"',
$id_agente,
$nombre_agente
)
);
$alias_safe_output = strip_tags(io_safe_output(get_parameter('alias', '')));
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output)));
$alias_as_name = (int) get_parameter_post('alias_as_name', 0);
@ -1077,14 +1084,17 @@ if ($update_agent) {
}
}
// Verify if there is another agent with the same name but different ID.
if (empty($repeated_name) === false) {
ui_print_error_message(__('Agent with repeated name'));
}
if ($mssg_warning) {
ui_print_warning_message(__('The ip or dns name entered cannot be resolved'));
}
// Verify if there is another agent with the same name but different ID.
if ($alias == '') {
ui_print_error_message(__('No agent alias specified'));
// If there is an agent with the same name, but a different ID.
}
$old_group = agents_get_agent_group($id_agente);
@ -1139,13 +1149,16 @@ if ($update_agent) {
'ignore_unknown' => $ignore_unknown,
];
if (empty($repeated_name) === true) {
$values['nombre'] = $nombre_agente;
}
if ($config['metaconsole_agent_cache'] == 1) {
$values['update_module_count'] = 1;
// Force an update of the agent cache.
}
$result = db_process_sql_update('tagente', $values, ['id_agente' => $id_agente]);
$result = (bool) db_process_sql_update('tagente', $values, ['id_agente' => $id_agente]);
if ($result === false && $update_custom_result == false) {
ui_print_error_message(
__('There was a problem updating the agent')
@ -1299,8 +1312,11 @@ if ($update_agent) {
}
$modules = $agent->getModules();
foreach ($modules as $key => $row) {
if (preg_match('/PandoraAgent_log/', $row['raw']) === 1) {
if (preg_match('/PandoraAgent_log/', $row['raw']) === 1
|| ($id_os === 1 && preg_match('/Syslog/', $row['raw']) === 1)
) {
if ($enable_log_collector === 1) {
if ($row['disabled'] === 1) {
$agent->enableModule($row['module_name'], $row);

View File

@ -697,7 +697,7 @@ if ($agents !== false) {
$tableAgents->head = [];
$tableAgents->data = [];
// Header.
$tableAgents->head[0] = '<span>'.__('Agent name').'</span>';
$tableAgents->head[0] = '<span>'.__('Agent alias').'</span>';
$tableAgents->head[0] .= ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectNameUp, $selectNameDown);
$tableAgents->head[1] = '<span title=\''.__('Remote agent configuration').'\'>'.__('R').'</span>';
$tableAgents->head[1] .= ui_get_sorting_arrows($url_up_remote, $url_down_remote, $selectRemoteUp, $selectRemoteDown);

View File

@ -575,7 +575,7 @@ $where = sprintf('delete_pending = 0 AND id_agente = %s', $id_agente);
$search_string_entities = io_safe_input($search_string);
$basic_where = sprintf(
"(REPLACE(nombre, '&#x20;', ' ') LIKE '%%%s%%' OR REPLACE(nombre, '&#x20;', ' ') LIKE '%%%s%%' OR REPLACE(descripcion, '&#x20;', ' ') LIKE '%%%s%%' OR REPLACE(descripcion, '&#x20;', ' ') LIKE '%%%s%%') AND",
"(nombre LIKE '%%%s%%' OR nombre LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%') AND",
$search_string,
$search_string_entities,
$search_string,

View File

@ -150,7 +150,7 @@ if (is_ajax()) {
$component = db_get_row('tlocal_component', 'id', $id_component);
foreach ($component as $index => $element) {
$component[$index] = html_entity_decode(
$element,
(isset($element) === true) ? $element : '',
ENT_QUOTES,
'UTF-8'
);

View File

@ -505,7 +505,7 @@ $tableBasicThresholds->data['caption_switch_warning_inverse_string'][0] = html_p
$tableBasicThresholds->data['caption_warning_threshold'][0] .= '<span class="font_11" id="caption_str_warning">('.__('Str.').')</span>';
$tableBasicThresholds->data['warning_threshold'][0] .= html_print_input_text(
'str_warning',
str_replace('"', '', $str_warning),
str_replace('"', '', (isset($str_warning) === true) ? $str_warning : ''),
'',
10,
1024,
@ -602,7 +602,7 @@ $tableBasicThresholds->data['switch_critical_threshold'][0] .= html_print_div(
$tableBasicThresholds->data['caption_critical_threshold'][0] .= '<span class="font_11" id="caption_str_critical">('.__('Str.').')</span>';
$tableBasicThresholds->data['critical_threshold'][0] .= html_print_input_text(
'str_critical',
str_replace('"', '', $str_critical),
str_replace('"', '', (isset($str_critical) === true) ? $str_critical : ''),
'',
10,
1024,

View File

@ -60,7 +60,12 @@ $data[1] = html_print_select_from_sql(
$disabledBecauseInPolicy
);
// Store the macros in base64 into a hidden control to move between pages
$data[1] .= html_print_input_hidden('macros', base64_encode($macros), true);
$data[1] .= html_print_input_hidden(
'macros',
(isset($macros) === true) ? base64_encode($macros) : '',
true
);
$table_simple->colspan['plugin_1'][2] = 2;
if (!empty($id_plugin)) {

View File

@ -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'];

View File

@ -285,20 +285,25 @@ if (enterprise_installed()) {
$data = [];
$data[0] = html_print_label_input_block(
'<div id="server_to_exec_label" class="labels invisible">'.__('Server to execute command').'</div>',
'<div id="server_to_exec_value" class="invisible" >'.html_print_select(
'<div id="server_to_exec_value" class="w100p margin-top-10 invisible" >'.html_print_select(
$servers_to_exec,
'server_to_exec',
$event_response['server_to_exec'],
'',
'',
'',
true
true,
false,
true,
'w100p',
false,
'width: 100%'
).'</div>'
);
$data[1] = html_print_label_input_block(
'<div id="command_timeout_label" class="labels invisible">'.__('Command timeout (s)'),
'<div id="command_timeout_value" class="invisible">'.html_print_input_text(
'<div id="command_timeout_value" class=" w100p margin-top-10 invisible">'.html_print_input_text(
'command_timeout',
$event_response['command_timeout'],
'',
@ -358,18 +363,18 @@ $('#type').change(function() {
$('#new_window option[value="0"]')
.prop('selected', true);
$('#new_window').attr('disabled','disabled');
$('#server_to_exec_label').css('display','');
$('#server_to_exec_value').css('display','');
$('#command_timeout_label').css('display','');
$('#command_timeout_value').css('display','');
$('#server_to_exec_label').show();
$('#server_to_exec_value').show();
$('#command_timeout_label').show();
$('#command_timeout_value').show();
break;
case 'url':
$('#new_window').removeAttr('disabled');
$('#server_to_exec_label').css('display','none');
$('#server_to_exec_value').css('display','none');
$('#command_timeout_label').css('display','none');
$('#command_timeout_value').css('display','none');
$('#server_to_exec_label').hide();
$('#server_to_exec_value').hide();
$('#command_timeout_label').hide();
$('#command_timeout_value').hide();
break;
}

View File

@ -560,13 +560,13 @@ if ($is_management_allowed === true && $update_group === true) {
}
}
$id_group = (int) get_parameter('id_group');
// Delete group.
if ($is_management_allowed === true
&& $delete_group === true
&& ((bool) check_acl($config['id_user'], 0, 'PM') === true)
&& ((bool) check_acl($config['id_user'], $id_group, 'PM') === true)
) {
$id_group = (int) get_parameter('id_group');
$usedGroup = groups_check_used($id_group);
if (!$usedGroup['return']) {
@ -880,6 +880,28 @@ if ($tab == 'tree') {
echo "<div id='tree-controller-recipient'></div>";
if (users_can_manage_group_all('AR') === false) {
$user_groups_acl = users_get_groups(false, 'AR');
$groups_acl = implode('","', $user_groups_acl);
if (empty($groups_acl) === true) {
$is_management_allowed = false;
}
}
html_print_div(
[
'content' => ui_print_info_message(
[
'no_close' => true,
'message' => __('There are no defined groups'),
],
'',
true
),
'class' => 'invisible',
'id' => 'message-tree-info',
]
);
} else {
/*
* Group list view.
@ -1246,7 +1268,7 @@ $tab = 'group_edition';
treeController.init({
recipient: $("div#tree-controller-recipient"),
page: parameters['page'],
emptyMessage: "<?php echo __('No data found'); ?>",
emptyMessage: $("#message-tree-info").html(),
foundMessage: "<?php echo __('Found groups'); ?>",
tree: data.tree,
baseURL: "<?php echo ui_get_full_url(false, false, false, is_metaconsole()); ?>",

View File

@ -319,9 +319,8 @@ if ($update_agents) {
$secondary_groups_removed
);
$agents_values = agents_get_agent((int) $array_id[1]);
$agents_values = db_get_row_filter('tagente', ['id_agente' => (int) $array_id[1]]);
$node->disconnect();
if (empty($values) === false) {
update_agents_in_metaconsole(
(int) $array_id[1],

View File

@ -768,7 +768,7 @@ $table_critical->tdid[0][0] = 'edit1-3-min';
$table_critical->data[0][0] = html_print_label_input_block(
__('Min.'),
html_print_input_text(
'min_warning',
'min_critical',
'',
'',
false,
@ -781,7 +781,7 @@ $table_critical->tdid[0][1] = 'edit1-3-max';
$table_critical->data[0][1] = html_print_label_input_block(
__('Max.'),
html_print_input_text(
'max_warning',
'max_critical',
'',
'',
false,
@ -1500,7 +1500,7 @@ $table->data[39][0] = html_print_label_input_block(
'',
'',
true
).html_print_input_hidden('macros', base64_encode($macros), true)
).html_print_input_hidden('macros', base64_encode(($macros ?? '')), true)
);
require_once $config['homedir'].'/include/class/CredentialStore.class.php';

View File

@ -208,6 +208,9 @@ if ($access_console_node === true) {
$sub['godmode/setup/os']['text'] = __('Operating systems');
$sub['godmode/setup/os']['id'] = 'edit_OS';
$sub['godmode/resources/resources_export_import']['text'] = __('Resources export/import');
$sub['godmode/resources/resources_export_import']['id'] = 'resources_export_import';
}
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
@ -518,7 +521,18 @@ if ($access_console_node === true) {
}
if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($config['id_user'], 0, 'DM') === true) {
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
$show_ipam = false;
$ipam = db_get_all_rows_sql('SELECT users_operator FROM tipam_network');
foreach ($ipam as $row) {
if (str_contains($row['users_operator'], '-1') || str_contains($row['users_operator'], $config['id_user'])) {
$show_ipam = true;
break;
}
}
}
if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($config['id_user'], 0, 'DM') === true || $show_ipam === true) {
$menu_godmode['gextensions']['text'] = __('Admin tools');
$menu_godmode['gextensions']['sec2'] = 'godmode/extensions';
$menu_godmode['gextensions']['id'] = 'god-extensions';
@ -535,8 +549,6 @@ if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($
$sub['tools/diagnostics']['text'] = __('Diagnostic info');
$sub['tools/diagnostics']['id'] = 'diagnostic_info';
enterprise_hook('omnishell');
enterprise_hook('ipam_submenu');
$sub['godmode/setup/news']['text'] = __('Site news');
$sub['godmode/setup/news']['id'] = 'site_news';
}
@ -558,9 +570,15 @@ if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($
}
}
$sub['godmode/events/configuration_sounds']['text'] = __('Acoustic console setup');
$sub['godmode/events/configuration_sounds']['id'] = 'Acoustic console setup';
$sub['godmode/events/configuration_sounds']['pages'] = ['godmode/events/configuration_sounds'];
if (((bool) check_acl($config['id_user'], 0, 'PM') === true && $access_console_node === true) || $show_ipam === true) {
enterprise_hook('ipam_submenu');
}
if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($config['id_user'], 0, 'DM') === true) {
$sub['godmode/events/configuration_sounds']['text'] = __('Acoustic console setup');
$sub['godmode/events/configuration_sounds']['id'] = 'Acoustic console setup';
$sub['godmode/events/configuration_sounds']['pages'] = ['godmode/events/configuration_sounds'];
}
$menu_godmode['gextensions']['sub'] = $sub;
}
@ -638,16 +656,18 @@ if ($access_console_node === true) {
}
// Complete the submenu.
$extension_view = [];
$extension_view['godmode/extensions']['id'] = 'extension_manager_view';
$extension_view['godmode/extensions']['text'] = __('Extension manager view');
$extension_submenu = array_merge($extension_view, $sub2);
if (users_is_admin($config['id_user']) === true) {
$extension_view = [];
$extension_view['godmode/extensions']['id'] = 'extension_manager_view';
$extension_view['godmode/extensions']['text'] = __('Extension manager view');
$extension_submenu = array_merge($extension_view, $sub2);
$sub['godmode/extensions']['sub2'] = $extension_submenu;
$sub['godmode/extensions']['text'] = __('Extension manager');
$sub['godmode/extensions']['id'] = 'extension_manager';
$sub['godmode/extensions']['type'] = 'direct';
$sub['godmode/extensions']['subtype'] = 'nolink';
$sub['godmode/extensions']['sub2'] = $extension_submenu;
$sub['godmode/extensions']['text'] = __('Extension manager');
$sub['godmode/extensions']['id'] = 'extension_manager';
$sub['godmode/extensions']['type'] = 'direct';
$sub['godmode/extensions']['subtype'] = 'nolink';
}
if (is_array($menu_godmode['gextensions']['sub']) === true) {
$submenu = array_merge($menu_godmode['gextensions']['sub'], $sub);

View File

@ -250,6 +250,12 @@ if ($delete_layout || $copy_layout) {
$result = db_process_sql_insert('tlayout', $values);
$auditMessage = ((bool) $result !== false) ? 'Copy visual console' : 'Fail try to copy visual console';
db_pandora_audit(
AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT,
sprintf('%s %s #%s', $auditMessage, $visualConsoleName, $id_layout)
);
$idNewVisualConsole = $result;
if ($result) {

View File

@ -1058,7 +1058,11 @@ switch ($action) {
$resolution = $item['top_n'];
// Interval resolution.
$max_values = $item['top_n_value'];
// Max values.
$es = json_decode($item['external_source'], true);
$top_n_type = $es['top_n_type'];
$display_graph = $es['display_graph'];
$display_summary = $es['display_summary'];
$display_data_table = $es['display_data_table'];
break;
case 'permissions_report':
@ -1703,6 +1707,75 @@ if (is_metaconsole() === true) {
</td>
</tr>
<tr id="row_top_n_type" class="datos">
<td class="bolder"><?php echo __('Type'); ?></td>
<td >
<?php
$types = [
0 => __('Show aggregate by destination port'),
1 => __('Show InBound/Outbound traffic per SrcIP/DestIP'),
];
html_print_select(
$types,
'top_n_type',
$top_n_type,
''
);
?>
</td>
</tr>
<tr id="row_display_graph" class="datos">
<td class="bolder">
<?php
echo __('Display graph');
?>
</td>
<td >
<?php
html_print_checkbox_switch(
'display_graph',
1,
($display_graph ?? true)
);
?>
</td>
</tr>
<tr id="row_display_summary_table" class="datos">
<td class="bolder">
<?php
echo __('Display summary table');
?>
</td>
<td >
<?php
html_print_checkbox_switch(
'display_summary',
1,
($display_summary ?? true)
);
?>
</td>
</tr>
<tr id="row_display_data_table" class="datos">
<td class="bolder">
<?php
echo __('Display data table');
?>
</td>
<td >
<?php
html_print_checkbox_switch(
'display_data_table',
1,
($display_data_table ?? true)
);
?>
</td>
</tr>
<tr id="row_period_service_level" class="datos">
<td class="bolder">
<?php
@ -5868,6 +5941,7 @@ ui_require_javascript_file('pandora');
?>
<script type="text/javascript">
const ACTION = '<?php echo $actionParameter; ?>';
$(document).ready (function () {
chooseType();
chooseSQLquery();
@ -7420,6 +7494,10 @@ function chooseType() {
$("#row_alert_templates").hide();
$("#row_alert_actions").hide();
$("#row_servers").hide();
$("#row_top_n_type").hide();
$("#row_display_graph").hide();
$("#row_display_summary_table").hide();
$("#row_display_data_table").hide();
$("#row_servers_all_opt").hide();
$("#row_servers_all").hide();
$("#row_multiple_servers").hide();
@ -7524,6 +7602,12 @@ function chooseType() {
$("#row_ncm_group").hide();
$("#row_ncm_agent").hide();
if (ACTION !== 'update') {
// Set default period value, this value will be change for each report.
period_set_value($("#hidden-period").attr('class'), 300);
$("#row_period").find('select').val('300').trigger('change');
}
switch (type) {
case 'event_report_group':
$("#row_description").show();
@ -7686,8 +7770,10 @@ function chooseType() {
$("#row_agent").show();
$("#row_module").show();
$("#row_historical_db_check").hide();
period_set_value($("#hidden-period").attr('class'), 3600);
$("#row_period").find('select').val('3600').trigger('change');
if (ACTION !== 'update') {
period_set_value($("#hidden-period").attr('class'), 3600);
$("#row_period").find('select').val('3600').trigger('change');
}
break;
case 'SLA_monthly':
@ -8374,6 +8460,10 @@ function chooseType() {
$("#row_max_values").show();
$("#row_resolution").show();
$("#row_servers").show();
$("#row_top_n_type").show();
$("#row_display_graph").show();
$("#row_display_summary_table").show();
$("#row_display_data_table").show();
$("#row_historical_db_check").hide();
break;

View File

@ -626,7 +626,7 @@ switch ($action) {
db_pandora_audit(
AUDIT_LOG_REPORT_MANAGEMENT,
sprintf('%s #%s', $auditMessage, $idReport)
sprintf('%s %s #%s', $auditMessage, $report['name'], $idReport)
);
ui_print_result_message(
@ -1465,7 +1465,7 @@ switch ($action) {
$auditMessage = ($resultOperationDB === true) ? 'Update report' : 'Fail try to update report';
db_pandora_audit(
AUDIT_LOG_REPORT_MANAGEMENT,
sprintf('%s #%s', $auditMessage, $idReport)
sprintf('%s %s #%s', $auditMessage, $new_values['name'], $idReport),
);
} else {
$resultOperationDB = false;
@ -1517,7 +1517,7 @@ switch ($action) {
]
);
$auditMessage = ((bool) $idOrResult === true) ? sprintf('Create report #%s', $idOrResult) : 'Fail try to create report';
$auditMessage = ((bool) $idOrResult === true) ? sprintf('Create report %s #%s', $reportName, $idOrResult) : 'Fail try to create report';
db_pandora_audit(
AUDIT_LOG_REPORT_MANAGEMENT,
$auditMessage
@ -1878,6 +1878,13 @@ switch ($action) {
$values['top_n_value'] = get_parameter(
'max_values'
);
$es['top_n_type'] = get_parameter('top_n_type', '');
$es['display_graph'] = get_parameter('display_graph', '');
$es['display_summary'] = get_parameter('display_summary', '');
$es['display_data_table'] = get_parameter('display_data_table', '');
$values['external_source'] = json_encode($es);
$good_format = true;
break;
@ -2962,6 +2969,12 @@ switch ($action) {
$values['top_n_value'] = get_parameter(
'max_values'
);
$es['top_n_type'] = get_parameter('top_n_type', '');
$es['display_graph'] = get_parameter('display_graph', '');
$es['display_summary'] = get_parameter('display_summary', '');
$es['display_data_table'] = get_parameter('display_data_table', '');
$values['external_source'] = json_encode($es);
$good_format = true;
break;

View File

@ -300,7 +300,7 @@ switch ($activeTab) {
ui_update_name_fav_element($idVisualConsole, 'Visual_Console', $values['name']);
db_pandora_audit(
AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT,
sprintf('Update visual console #%s', $idVisualConsole)
sprintf('Update visual console %s #%s', io_safe_output($values['name']), $idVisualConsole)
);
$action = 'edit';
$statusProcessInDB = [
@ -320,7 +320,7 @@ switch ($activeTab) {
} else {
db_pandora_audit(
AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT,
sprintf('Fail update visual console #%s', $idVisualConsole)
sprintf('Fail update visual console %s #%s', $values['name'], $idVisualConsole)
);
$statusProcessInDB = [
'flag' => false,
@ -339,7 +339,7 @@ switch ($activeTab) {
if ($idVisualConsole !== false) {
db_pandora_audit(
AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT,
sprintf('Create visual console #%s', $idVisualConsole)
sprintf('Create visual console %s #%s', io_safe_output($values['name']), $idVisualConsole)
);
$action = 'edit';
$statusProcessInDB = [
@ -359,7 +359,7 @@ switch ($activeTab) {
} else {
db_pandora_audit(
AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT,
'Fail try to create visual console'
sprintf('Fail try to create visual console %s #%s', io_safe_output($values['name']), $idVisualConsole)
);
$statusProcessInDB = [
'flag' => false,

View File

@ -247,7 +247,7 @@ if ($favorite_array == false) {
$url = 'index.php?sec=network&sec2=operation/visual_console/render_view&id='.$favourite_v['id'];
}
echo "<a href='".$url."' title='Visual console".$favourite_v['name']."' alt='".$favourite_v['name']."'><li>";
echo "<a href='".$url."' title='".io_safe_output($favourite_v['name'])."' alt='".io_safe_output($favourite_v['name'])."'><li>";
echo "<div class='icon_img'>";
echo html_print_image(
'images/'.groups_get_icon($favourite_v['id_group']),
@ -256,7 +256,7 @@ if ($favorite_array == false) {
);
echo '</div>';
echo "<div class='text'>";
echo $favourite_v['name'];
echo io_safe_output($favourite_v['name']);
echo '</div>';
echo '</li></a>';
}

View File

@ -0,0 +1,404 @@
<?php
/**
* Server list view.
*
* @category Server
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2024 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* 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 for version 2.
* 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.
* ============================================================================
*/
// Load global vars.
global $config;
check_login();
if (check_acl($config['id_user'], 0, 'PM') === false) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access resources exportation and importation'
);
include 'general/noaccess.php';
exit;
}
require_once $config['homedir'].'/include/class/Prd.class.php';
// Instance of the prd class.
$prd = new Prd();
$msg = '';
if (isset($_FILES['resource_import']) === true) {
if (empty($_FILES['resource_import']['tmp_name']) === false) {
$data = parse_ini_file($_FILES['resource_import']['tmp_name'], true);
if ($data !== false) {
if (isset($data['prd_data']['name']) === true
&& isset($data['prd_data']['type']) === true
) {
$name = $data['prd_data']['name'];
$type = $data['prd_data']['type'];
}
$msg = $prd->importPrd($data);
} else {
$msg = [
'status' => false,
'items' => [],
'errors' => ['Unexpected error: Unable to parse PRD file.'],
];
}
} else {
$msg = [
'status' => false,
'items' => [],
'errors' => ['No files have selected'],
];
}
}
$msg = json_encode($msg);
echo '<div class="div-import-export">';
// Import section.
$label_import = html_print_label(
__('Import resources to').' '.get_product_name(),
'label_import',
true,
['style' => 'font-size: 13px; line-height: 16px'],
);
$div_label_import = html_print_div(
[
'style' => 'padding-bottom: 20px;',
'content' => $label_import,
],
true
);
$input_file = '<input class="input-file-style" style="padding-top: 1px; width: 100%;" type="file" value name="resource_import" id="file-resource_import" >';
$div_input_file = html_print_div(
[
'style' => 'padding-top: 20px;display: flex; justify-content: left;width:100%; height: 60px;',
'content' => $input_file,
],
true
);
$button_import = html_print_submit_button(
__('Import'),
'upload',
false,
[
'icon' => 'import',
'class' => 'disabled',
'disabled' => '',
],
true
);
$div_button_import = html_print_div(
[
'style' => 'padding-bottom: 20px',
'content' => $button_import,
],
true
);
$div_import = html_print_div(
[
'style' => 'width: 80%',
'content' => $div_label_import.$div_input_file.$div_button_import,
],
true
);
$img_import = html_print_image(
'images/import_to.svg',
true,
[
'border' => '0',
'width' => '100%',
]
);
$div_img_import = html_print_div(
[
'style' => 'margin-left: 40px; margin-right: 20px',
'content' => $img_import,
],
true
);
echo '<form class="form-import" name="submit_import" method="POST" enctype="multipart/form-data">';
echo html_print_div(
[
'class' => 'div-import',
'content' => $div_import.$div_img_import,
],
true
);
echo '</form>';
// Export section.
$label_export = html_print_label(
__('Export resources from').' '.get_product_name(),
'label_export',
true,
['style' => 'font-size: 13px; line-height: 16px'],
);
$div_label_export = html_print_div(
[
'style' => 'padding-bottom: 20px',
'content' => $label_export,
],
true
);
$export_type = $prd->getTypesPrd();
$select_export_type = html_print_label_input_block(
__('Export type'),
html_print_select(
$export_type,
'export_type',
'',
'',
__('None'),
0,
true,
false,
true,
'w90p'
),
['div_style' => 'display: flex; flex-direction: column; width: 50%'],
);
$div_select_export = html_print_div(
[
'id' => 'div_select_export',
'style' => 'padding-bottom: 20px;display: flex; flex-direction: row; height: 60px',
'content' => $select_export_type,
],
true
);
$button_export = html_print_button(
__('Export'),
'export_button',
false,
'',
[
'class' => 'flex_justify disabled',
'icon' => 'export',
'disabled' => '',
],
true
);
$div_button_export = html_print_div(
[
'style' => '',
'content' => $button_export,
],
true
);
$div_export = html_print_div(
[
'style' => 'padding-bottom: 20px; width: 80%',
'content' => $div_label_export.$div_select_export.$div_button_export,
],
true
);
$img_export = html_print_image(
'images/export_to.svg',
true,
[
'border' => '0',
'width' => '100%',
]
);
$div_img_export = html_print_div(
[
'style' => 'margin-left: 40px; margin-right: 20px',
'content' => $img_export,
],
true
);
echo html_print_div(
[
'class' => 'div-export',
'content' => $div_export.$div_img_export,
],
true
);
echo '</div>';
?>
<script type="text/javascript">
let msg = <?php echo $msg; ?>;
if (typeof msg === 'object' && Object.keys(msg).length > 0) {
let title = "";
let message = "";
if (msg.status === true) {
title = "<?php echo __('Importation successfully completed'); ?>";
message = "<?php echo __('PRD import successfull:'); ?>";
const name = "<?php echo $name; ?>";
const type = "<?php echo $type; ?>";
message += ` ${type} - ${name}`;
} else {
title = "<?php echo __('Import failure'); ?>";
Object.entries(msg.errors).forEach(([key, value]) => {
message += value + "<br>";
});
}
if (typeof msg.info === 'object' && Object.keys(msg.info).length > 0) {
message += "<br><br>";
Object.entries(msg.info).forEach(([key, value]) => {
message += value + "<br>";
});
}
confirmDialog({
title: title,
message: message,
hideCancelButton: true
},
"ResultDialog"
);
}
$('input[type="file"]').change(function() {
console.log($(this).val());
if ($(this).val() === '') {
$("#button-upload").addClass("disabled");
$('#button-upload').prop('disabled', true);
} else {
$("#button-upload").removeClass("disabled");
$('#button-upload').prop('disabled', false);
}
});
$("#export_type").change(function(e) {
if ($(this).val() === '0') {
$("#resource_type").remove();
$("#button-export_button").addClass("disabled");
$('#button-export_button').prop('disabled', true);
} else {
$.ajax({
type: "GET",
url: "ajax.php",
dataType: "html",
data: {
page: 'include/ajax/resources.ajax',
getResource: 1,
type: $(this).val(),
},
success: function(data) {
$("#resource_type").remove();
$("#div_select_export").append(`${data}`);
$('#select_value').select2();
$("#button-export_button").removeClass("disabled");
$('#button-export_button').prop('disabled', false);
},
error: function(data) {
console.error("Fatal error in AJAX call to interpreter order", data)
}
});
}
});
$("#button-export_button").click(function(e) {
const value = $("#select_value").val();
if (value !== '0') {
//Show dialog.
confirmDialog({
title: "<?php echo __('Exporting resource'); ?>",
message: "<?php echo __('Exporting resource and downloading, please wait'); ?>",
hideCancelButton: true
},
"downloadDialog"
);
const filename = '<?php echo uniqid().'.prd'; ?>';
$.ajax({
type: "GET",
url: "ajax.php",
dataType: 'json',
data: {
page: 'include/ajax/resources.ajax',
exportPrd: 1,
type: $("#export_type").val(),
value: value,
name: $("#select_value option:selected").text(),
filename: filename
},
success: function(data) {
if (data.error === -1 || data.error === -2) {
console.error("Failed to create file");
$("#confirm_downloadDialog").dialog("close");
} else {
let a = document.createElement('a');
const url = '<?php echo $config['homeurl'].'/attachment/'; ?>' + filename;
a.href = url;
a.download = data.name_download;
a.click();
setTimeout(() => {
$.ajax({
type: "DELETE",
url: "ajax.php",
data: {
page: 'include/ajax/resources.ajax',
deleteFile: 1,
filename: filename,
},
});
$("#confirm_downloadDialog").dialog("close");
}, 3000);
}
},
error: function(data) {
console.error("Fatal error in AJAX call to interpreter order", data);
$.ajax({
type: "DELETE",
url: "ajax.php",
data: {
page: 'include/ajax/resources.ajax',
deleteFile: 1,
filename: filename,
},
});
$("#confirm_downloadDialog").dialog("close");
}
});
}
});
</script>

View File

@ -215,7 +215,7 @@ if ($create != '') {
// =====================================================================
if ($filemanager) {
if ($edit_file) {
$location_file = get_parameter('location_file', '');
$location_file = io_safe_output(get_parameter('location_file', ''));
$filename = array_pop(explode('/', $location_file));
$file = file_get_contents($location_file);
echo '<h4>'.__('Edit file').' '.$filename.'</h4>';
@ -250,7 +250,7 @@ if ($filemanager) {
echo '</form>';
} else {
if ($update_file) {
$location_file = get_parameter('location_file', '');
$location_file = io_safe_output(get_parameter('location_file', ''));
$contentFile = io_safe_output(get_parameter('content_file', ''));
$compatibility = get_parameter('compatibility', 'unix');
$is_win_compatible = strpos($contentFile, "\r\n");
@ -262,7 +262,12 @@ if ($filemanager) {
$contentFile = str_replace("\n", "\r\n", $contentFile);
}
$result = file_put_contents($location_file, $contentFile);
if (empty($location_file) === false
&& strpos($location_file, realpath('attachment/plugin')) !== false
&& file_exists($location_file) === true
) {
$result = file_put_contents($location_file, $contentFile);
}
}
$id_plugin = (int) get_parameter('id_plugin', 0);

View File

@ -115,7 +115,7 @@ foreach ($servers as $server) {
$table->cellclass[] = [
3 => 'progress_bar',
8 => 'table_action_buttons',
9 => 'table_action_buttons',
];
$data[0] = '<span title="'.$server['version'].'">'.strip_tags($server['name']).'</span>';

View File

@ -48,7 +48,7 @@ if ($idOS > 0) {
} else {
$name = io_safe_input(strip_tags(trim(io_safe_output((string) get_parameter('name')))));
$description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
$icon = get_parameter('icon', 0);
$icon = get_parameter('icon', 'os@svg.svg');
}
$icon_upload = get_parameter('icon_upload', null);
@ -246,7 +246,7 @@ $iconData[] = html_print_select(
'icon',
$icon,
'show_icon_OS();',
__('None'),
'',
0,
true
);
@ -356,6 +356,8 @@ function get_list_os_icons_dir()
}
}
$return['os@svg.svg'] = __('None');
return $return;
}

View File

@ -88,6 +88,14 @@ switch ($tab) {
break;
case 'manage_os':
$id_os = get_parameter('id_os', '');
if ($id_os !== '') {
$headerTitle = __('Edit OS');
} else {
$headerTitle = __('Create OS');
}
break;
case 'list':
if ($action === 'edit') {
$headerTitle = __('Edit OS');

View File

@ -960,60 +960,6 @@ echo '<legend>'.__('Mail configuration').'</legend>';
);
echo '</form>';
/**
* Print the modal window for the summary of each alerts group
*
* @param string $id Id.
*
* @return void
*/
function print_email_test_modal_window($id)
{
// Email config table.
$table_mail_test = new stdClass();
$table_mail_test->width = '100%';
$table_mail_test->class = 'filter-table-adv';
$table_mail_test->data = [];
$table_mail_test->data[0][] = html_print_label_input_block(
__('Address'),
html_print_input_text(
'email_test_address',
'',
'',
35,
100,
true
)
);
$table_mail_test->data[1][] = '&nbsp&nbsp<span id="email_test_sent_message" class="invisible"><b>Email sent</b></span><span id="email_test_failure_message" class=invisible"><b>Email could not be sent</b></span>';
// $table_mail_test->colspan[2][0] = 2;
$submitButton = html_print_div(
[
'class' => 'action-buttons-right-forced',
'content' => html_print_button(
__('Send'),
'email_test',
false,
'',
[
'icon' => 'cog',
'mode' => 'mini',
],
true
),
],
true
);
echo '<div id="email_test_'.$id.'" title="'.__('Check mail configuration').'" class="invisible">'.html_print_table($table_mail_test, true).$submitButton.'</div>';
}
?>
<script type="text/javascript">
function show_timezone () {
@ -1033,62 +979,6 @@ function show_timezone () {
});
}
function show_email_test(id) {
$('#email_test_sent_message').hide();
$('#email_test_failure_message').hide();
$("#email_test_"+id).dialog({
resizable: true,
draggable: true,
modal: true,
width: 450,
overlay: {
opacity: 0.5,
background: "black"
}
});
}
function perform_email_test () {
$('#email_test_sent_message').hide();
$('#email_test_failure_message').hide();
var test_address = $('#text-email_test_address').val();
params = {
email_smtpServer : $('#text-email_smtpServer').val(),
email_smtpPort : $('#text-email_smtpPort').val(),
email_username : $('#text-email_username').val(),
email_password : $('#password-email_password').val(),
email_encryption : $( "#email_encryption option:selected" ).val(),
email_from_dir : $('#text-email_from_dir').val(),
email_from_name : $('#text-email_from_name').val()
};
$.ajax({
type: "POST",
url: "ajax.php",
data : {
page: "godmode/setup/setup_general",
test_address: test_address,
params: params
},
dataType: "json",
success: function(data) {
if (parseInt(data) === 1) {
$('#email_test_sent_message').show();
$('#email_test_failure_message').hide();
} else {
$('#email_test_failure_message').show();
$('#email_test_sent_message').hide();
}
},
error: function() {
$('#email_test_failure_message').show();
$('#email_test_sent_message').hide();
},
});
}
$(document).ready (function () {
$("#zone").attr("hidden", true);
@ -1146,8 +1036,6 @@ $(document).ready (function () {
}
})
$('#button-email_test').click(perform_email_test);
$("#right_iblacklist").click (function () {
jQuery.each($("select[name='inventory_changes_blacklist_out[]'] option:selected"), function (key, value) {
imodule_name = $(value).html();

View File

@ -83,6 +83,23 @@ $table->data[3][] = html_print_label_input_block(
html_print_checkbox_switch_extended('netflow_get_ip_hostname', 1, $config['netflow_get_ip_hostname'], false, $onclick, '', true)
);
$table->data[4][] = html_print_label_input_block(
__('Netflow interval').ui_print_help_tip(__('It is necessary to restart the server if the value is changed.'), true),
html_print_select(
[
'600' => __('10 min'),
'1800' => __('30 min'),
'3600' => __('60 min'),
],
'netflow_interval',
$config['netflow_interval'],
'',
'',
0,
true
)
);
$table->data[4][] = html_print_label_input_block(
__('Enable Sflow'),
html_print_checkbox_switch_extended(

View File

@ -386,7 +386,7 @@ if (empty($result) === false) {
$data[4] = $output;
$phone_large = io_safe_output($tag['phone']);
$phone_small = substr($phone_large, 0, 24);
$phone_small = substr(($phone_large ?? ''), 0, 24);
if ($phone_large == $phone_small) {
$output = $phone_large;
} else {

View File

@ -770,7 +770,7 @@ if ($update_user) {
$id_user = (string) get_parameter('id_user', '');
if ($password_new != '') {
if ($config['auth'] !== 'mysql') {
if ($config['auth'] !== 'mysql' && $values['local_user'] === false) {
ui_print_error_message(__('It is not possible to change the password because external authentication is being used'));
} else {
$correct_password = false;
@ -1557,6 +1557,7 @@ if (empty($doubleAuthElementsContent) === false) {
$autorefresh_list_out = [];
if (is_metaconsole() === false || is_centralized() === true) {
$autorefresh_list_out['operation/agentes/estado_agente'] = 'Agent detail';
$autorefresh_list_out['operation/agentes/ver_agente'] = 'Agent view';
$autorefresh_list_out['operation/agentes/alerts_status'] = 'Alert detail';
$autorefresh_list_out['enterprise/operation/cluster/cluster'] = 'Cluster view';
$autorefresh_list_out['operation/gis_maps/render_view'] = 'Gis Map';
@ -1580,7 +1581,7 @@ $autorefresh_list_out['operation/events/events'] = 'Events';
if (isset($autorefresh_list) === false || empty($autorefresh_list) === true || empty($autorefresh_list[0]) === true) {
$select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '".$id."'");
$autorefresh_list = json_decode($select[0]['autorefresh_white_list']);
$autorefresh_list = json_decode(($select[0]['autorefresh_white_list'] ?? ''));
if ($autorefresh_list === null || $autorefresh_list === 0) {
$autorefresh_list = [];
$autorefresh_list[0] = __('None');

View File

@ -985,7 +985,7 @@ html_print_table($userManagementTable);
$vcard_data = [];
$vcard_data['version'] = '3.0';
$vcard_data['firstName'] = $user_info['fullname'];
$vcard_data['firstName'] = io_safe_output($user_info['fullname']);
$vcard_data['lastName'] = '';
$vcard_data['middleName'] = '';
$vcard_data['workPhone'] = $user_info['phone'];

View File

@ -37,6 +37,20 @@ class Applications extends Wizard
*/
public $mode;
/**
* Task properties.
*
* @var array
*/
public $task;
/**
* Class of styles.
*
* @var string
*/
public $class;
/**
* Constructor.

View File

@ -37,6 +37,20 @@ class Custom extends Wizard
*/
public $mode;
/**
* Task properties.
*
* @var array
*/
public $task;
/**
* Class of styles.
*
* @var string
*/
public $class;
/**
* Constructor.

View File

@ -47,6 +47,13 @@ ui_require_javascript_file('simTree');
class DiscoveryTaskList extends HTML
{
/**
* Task properties.
*
* @var array
*/
public $task;
/**
* Constructor.
@ -1418,7 +1425,7 @@ class DiscoveryTaskList extends HTML
$table = new StdClasS();
$table->class = 'databox data';
$table->width = '75%';
$table->styleTable = 'margin: 2em auto 0;border: 1px solid #ddd;background: white;';
$table->styleTable = 'margin: 2em auto 0;border: 1px solid #ddd;background: white; overflow-wrap: anywhere';
$table->rowid = [];
$table->data = [];
@ -1426,7 +1433,7 @@ class DiscoveryTaskList extends HTML
$tableErrors = new StdClasS();
$tableErrors->class = 'databox data';
$tableErrors->width = '75%';
$tableErrors->styleTable = 'margin: 2em auto 0;border: 1px solid #ddd;background: white;';
$tableErrors->styleTable = 'margin: 2em auto 0;border: 1px solid #ddd;background: white; overflow-wrap: anywhere';
$tableErrors->rowid = [];
$tableErrors->data = [];

View File

@ -450,6 +450,35 @@ class HostDevices extends Wizard
if (isset($this->task['id_rt']) === false) {
// Create.
$default_templates = [
io_safe_input('Linux System'),
io_safe_input('Windows System'),
io_safe_input('Windows Hardware'),
io_safe_input('Network Management'),
];
$default_templates_ids = db_get_all_rows_sql(
'SELECT id_np
FROM tnetwork_profile
WHERE name IN ('.implode(
',',
array_map(
function ($template) {
return "'".$template."'";
},
$default_templates
)
).')
ORDER BY name'
);
if ($default_templates_ids !== false) {
$this->task['id_network_profile'] = implode(
',',
array_column($default_templates_ids, 'id_np'),
);
}
$this->task['id_rt'] = db_process_sql_insert(
'trecon_task',
$this->task
@ -1100,16 +1129,13 @@ class HostDevices extends Wizard
'arguments' => [
'name' => 'id_network_profile[]',
'type' => 'select_from_sql',
'sql' => 'SELECT tn.id_np, tn.name
FROM tnetwork_profile tn
LEFT JOIN `tnetwork_profile_pen` tp
ON tp.id_np = tn.id_np
WHERE tp.id_np IS NULL
ORDER BY tn.name',
'sql' => 'SELECT id_np, name
FROM tnetwork_profile
ORDER BY name',
'return' => true,
'selected' => explode(
',',
$this->task['id_network_profile']
(isset($this->task['id_network_profile']) === true) ? $this->task['id_network_profile'] : ''
),
'nothing_value' => 0,
'nothing' => __('None'),
@ -1273,114 +1299,86 @@ class HostDevices extends Wizard
],
];
// SNMP Options pack v3.
$form['inputs'][] = [
'hidden' => 1,
'block_id' => 'snmp_options_v3',
'class' => 'indented',
'block_content' => [
[
'label' => '<b>'.__('Context').'</b>',
'arguments' => [
'name' => 'snmp_context',
'type' => 'text',
'value' => $this->task['snmp_community'],
'size' => 15,
'return' => true,
$show_snmp_auth = false;
if (isset($this->task['snmp_enabled']) && $this->task['snmp_enabled'] > 0
&& isset($this->task['snmp_version']) && $this->task['snmp_version'] == 3
) {
$show_snmp_auth = true;
}
],
],
[
'label' => '<b>'.__('Auth user').'</b>',
'arguments' => [
'name' => 'snmp_auth_user',
'type' => 'text',
'value' => $this->task['snmp_auth_user'],
'size' => 15,
'return' => true,
],
],
[
'label' => '<b>'.__('Security level').'</b>',
'arguments' => [
'name' => 'snmp_security_level',
'type' => 'select',
'fields' => [
'noAuthNoPriv' => __('Not auth and not privacy method'),
'authNoPriv' => __('Auth and not privacy method'),
'authPriv' => __('Auth and privacy method'),
],
'selected' => $this->task['snmp_security_level'],
'size' => 15,
'return' => true,
],
],
[
'label' => '<b>'.__('Auth method').'</b>',
'arguments' => [
'name' => 'snmp_auth_method',
'type' => 'select',
'fields' => [
'MD5' => __('MD5'),
'SHA' => __('SHA'),
],
'selected' => $this->task['snmp_auth_method'],
'size' => 15,
'return' => true,
],
],
[
'label' => '<b>'.__('Auth password').'</b>'.ui_print_help_tip(
__(
'The pass length must be eight character minimum.'
),
true
),
'arguments' => [
'name' => 'snmp_auth_pass',
'type' => 'password',
'value' => $this->task['snmp_auth_pass'],
'size' => 15,
'return' => true,
],
],
[
'label' => '<b>'.__('Privacy method').'</b>',
'arguments' => [
'name' => 'snmp_privacy_method',
'type' => 'select',
'fields' => [
'DES' => __('DES'),
'AES' => __('AES'),
],
'selected' => $this->task['snmp_privacy_method'],
'size' => 15,
'return' => true,
],
],
[
'label' => '<b>'.__('Privacy pass').'</b>'.ui_print_help_tip(
__(
'The pass length must be eight character minimum.'
),
true
),
'arguments' => [
'name' => 'snmp_privacy_pass',
'type' => 'password',
'value' => $this->task['snmp_privacy_pass'],
'size' => 15,
'return' => true,
],
],
include_once $config['homedir'].'/include/class/CredentialStore.class.php';
$all_snmp_keys = CredentialStore::getAll(
[
'cs.*',
'tg.nombre as `group`',
],
];
['product' => 'SNMP']
);
if (is_array($all_snmp_keys) === true) {
// Improve usage and decode output.
$snmp_available_keys = array_reduce(
$all_snmp_keys,
function ($carry, $item) {
$item['extra_1'] = io_output_password($item['extra_1']);
$extra1 = json_decode($item['extra_1'], true);
if ($extra1 !== null && $extra1['version'] == 3) {
$carry[$item['identifier']] = $item['identifier'];
}
return $carry;
},
[]
);
}
if (check_acl($config['id_user'], 0, 'UM')) {
$link_to_cs = '<a class="ext_link" href="'.ui_get_full_url(
'index.php?sec=gmodules&sec2=godmode/groups/group_list&tab=credbox'
).'" >';
$link_to_cs .= __('No credentials available').', ';
$link_to_cs .= strtolower(__('Manage credentials')).'</a>';
} else {
$link_to_cs = __('No credentials available');
}
if (count($snmp_available_keys) > 0) {
$form['inputs'][] = [
'block_id' => 'auth_block_snmp',
'class' => 'indented',
'hidden' => !$show_snmp_auth,
'block_content' => [
[
'label' => __('Credentials to try with'),
'arguments' => [
'type' => 'select',
'name' => 'auth_strings[]',
'fields' => $snmp_available_keys,
'selected' => explode(
',',
$this->task['auth_strings']
),
'multiple' => true,
'class' => 'select_multiple',
],
],
],
];
} else {
$form['inputs'][] = [
'block_id' => 'auth_block_snmp',
'class' => 'indented',
'hidden' => !$show_snmp_auth,
'block_content' => [
[
'label' => __('Credentials to try with'),
'extra' => $link_to_cs,
],
],
];
}
// Input: Enforce os detection.
$form['inputs'][] = [
@ -1453,14 +1451,12 @@ class HostDevices extends Wizard
// AUTH CONFIGURATION.
$show_auth = false;
if ((isset($this->task['wmi_enabled']) && $this->task['wmi_enabled'] > 0)
|| (isset($this->task['rcmd_enabled']) && $this->task['rcmd_enabled'] > 0)
) {
if (isset($this->task['wmi_enabled']) && $this->task['wmi_enabled'] > 0) {
$show_auth = true;
}
include_once $config['homedir'].'/include/class/CredentialStore.class.php';
$available_keys = CredentialStore::getKeys('WMI');
$wmi_available_keys = CredentialStore::getKeys('WMI');
if (check_acl($config['id_user'], 0, 'UM')) {
$link_to_cs = '<a class="ext_link" href="'.ui_get_full_url(
'index.php?sec=gmodules&sec2=godmode/groups/group_list&tab=credbox'
@ -1471,9 +1467,9 @@ class HostDevices extends Wizard
$link_to_cs = __('No credentials available');
}
if (count($available_keys) > 0) {
if (count($wmi_available_keys) > 0) {
$form['inputs'][] = [
'block_id' => 'auth_block',
'block_id' => 'auth_block_wmi',
'class' => 'indented',
'hidden' => !$show_auth,
'block_content' => [
@ -1482,7 +1478,7 @@ class HostDevices extends Wizard
'arguments' => [
'type' => 'select',
'name' => 'auth_strings[]',
'fields' => CredentialStore::getKeys('WMI'),
'fields' => $wmi_available_keys,
'selected' => explode(
',',
$this->task['auth_strings']
@ -1496,12 +1492,12 @@ class HostDevices extends Wizard
];
} else {
$form['inputs'][] = [
'block_id' => 'auth_block',
'block_id' => 'auth_block_wmi',
'class' => 'indented',
'hidden' => !$show_auth,
'block_content' => [
[
'label' => __('Credentials'),
'label' => __('Credentials to try with'),
'extra' => $link_to_cs,
],
],
@ -1520,11 +1516,11 @@ class HostDevices extends Wizard
function SNMPExtraShow(target) {
$("#snmp_options_basic").hide();
$("#snmp_options_skip_non_enabled_ifs").hide();
$("#snmp_options_v3").hide();
$("#auth_block_snmp").hide();
if (document.getElementsByName("snmp_enabled")[0].checked) {
$("#snmp_extra").show();
if (target == 3) {
$("#snmp_options_v3").show();
$("#auth_block_snmp").show();
} else {
$("#snmp_options_basic").show();
$("#snmp_options_skip_non_enabled_ifs").show();
@ -1554,7 +1550,7 @@ class HostDevices extends Wizard
$("#snmp_extra").hide();
$("#snmp_options_basic").hide();
$("#snmp_options_skip_non_enabled_ifs").hide();
$("#snmp_options_v3").hide();
$("#auth_block_snmp").hide();
// Disable snmp dependant checks
if (document.getElementsByName("parent_recursion")[0].checked)
@ -1572,13 +1568,17 @@ class HostDevices extends Wizard
}
function toggleAuth() {
if (document.getElementsByName("wmi_enabled")[0].checked
|| (typeof document.getElementsByName("rcmd_enabled")[0] != "undefined"
&& document.getElementsByName("rcmd_enabled")[0].checked)
) {
$("#auth_block").show();
if (document.getElementsByName("wmi_enabled")[0].checked) {
$("#auth_block_wmi").show();
} else {
$("#auth_block").hide();
$("#auth_block_wmi").hide();
}
if (typeof document.getElementsByName("rcmd_enabled")[0] != "undefined"
&& document.getElementsByName("rcmd_enabled")[0].checked) {
$("#auth_block_rcmd").show();
} else {
$("#auth_block_rcmd").hide();
}
}

View File

@ -97,6 +97,13 @@ class Wizard
*/
public $access = 'AR';
/**
* Root url.
*
* @var string
*/
public $rootUrl;
/**
* Setter for breadcrum
@ -550,7 +557,7 @@ class Wizard
}
echo '<ul class="bigbuttonlist">';
array_map('self::printBigButtonElement', $list_data);
array_map(['Wizard', 'printBigButtonElement'], $list_data);
echo '</ul>';
if ($return === true) {

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="14px" height="14px" viewBox="0 0 14 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>E1DA0B54-BDFA-427E-9BFB-1315DFA5936F</title>
<g id="Import-/-Export" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Mockup---Import-&amp;-Export-expandido-1300" transform="translate(-406, -540)" fill="#FFFFFF" fill-rule="nonzero">
<g id="Right" transform="translate(310, 380)">
<g id="Group" transform="translate(20, 63)">
<g id="Acciones" transform="translate(0, 83)">
<g id="Export-Copy" transform="translate(76, 13.999)">
<path d="M13,7.00200086 C13.5522847,7.00200086 14,7.44971619 14,8.00200086 L14,13.0020009 C14,13.5542875 13.5522847,14.0020009 13,14.0020009 L1,14.0020009 C0.44771525,14.0020009 0,13.5542875 0,13.0020009 L0,8.00201259 C0,7.44972773 0.44771525,7.00200086 1,7.00200086 C1.55228475,7.00200086 2,7.44973046 2,8.00201532 L2,12.0020009 L12,12.0020009 L12,8.00200086 C12,7.48917088 12.3860402,7.06649675 12.8833789,7.00873163 L13,7.00200086 Z" id="Path-2"></path>
<path d="M7.42761656,0.098000218 L7.4722276,0.120228468 C7.48541492,0.127297151 7.4984771,0.134682814 7.51140295,0.142385459 C7.6034078,0.196864662 7.68458638,0.263207322 7.75402558,0.34146022 L8.64094412,1.22873471 C8.69800231,1.28579287 8.75962403,1.34741457 8.82669975,1.41449025 L10.1954614,2.78325124 C10.4003199,2.98810964 10.6267161,3.21450572 10.8776552,3.46544474 L11.4849524,4.07274159 L11.7071068,4.29489588 C12.0976311,4.68541998 12.0976311,5.31858465 11.7071068,5.70910875 C11.3165825,6.09963285 10.6834175,6.09963285 10.2928932,5.70910875 L10.1805423,5.59675789 L9.46344168,4.87965762 C9.21250254,4.62871859 8.98610634,4.40232251 8.78124784,4.19746411 L8,3.416 L8,10.0020035 C8,10.5542882 7.55228475,11.0020034 7,11.0020034 C6.44771525,11.0020034 6,10.5542882 6,10.0020035 L6,3.41600434 L3.70710678,5.70911084 C3.34662282,6.06959476 2.77939176,6.09732429 2.38710056,5.79229943 L2.29289322,5.70911084 C1.90236893,5.31858659 1.90236893,4.68542169 2.29289322,4.29489745 L6.29289322,0.294897937 C6.54710458,0.0406866046 6.87413362,-0.0382890141 7.1738163,0.0164817894 C7.17680504,0.0176633808 7.18016721,0.0182701476 7.18352681,0.0188942086 C7.21466801,0.0243205099 7.24513844,0.0316757505 7.2751983,0.0403969286 C7.28707112,0.0438108231 7.29913038,0.0474948538 7.31113021,0.0514117815 C7.32967787,0.0576595805 7.3480221,0.0642976796 7.3661634,0.0714484962 C7.37897252,0.0762161528 7.39150205,0.0814382808 7.40394259,0.0869264154 L7.42761656,0.098000218 Z" id="Path-4-Copy" transform="translate(7, 5.501) scale(1, -1) translate(-7, -5.501)"></path>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="111px" height="111px" viewBox="0 0 111 111" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>868E520D-AB8E-4FB9-B511-A43C58B7C144</title>
<g id="Import-/-Export" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Mockup---Import-&amp;-Export-expandido-1300" transform="translate(-1140, -400)">
<g id="Right" transform="translate(310, 380)">
<g id="Export-to-PFMS" transform="translate(830, 21)">
<g id="Carpeta" transform="translate(50, 0)" fill="#FFFFFF" stroke="#C1CCDC" stroke-linejoin="round">
<path d="M30.24,10.8 C30.24,13.5952941 27.9846,15.8823529 25.2,15.8823529 L12.6,15.8823529 L5.04,15.8823529 C2.256408,15.8823529 0,18.1694118 0,20.9647059 L0,41.2941176 L0,48.9176471 C0,51.7129412 2.2564836,54 5.04,54 L55.44,54 C58.2246,54 60.48,51.7129412 60.48,48.9176471 L60.48,41.2941176 L60.48,15.8823529 C60.48,13.0870588 58.2246,10.8 55.44,10.8 L30.24,10.8 Z" id="Path"></path>
<path d="M5.04,0 C2.256408,0 0,2.28327 0,5.1 L0,17.85 L25.2,17.85 L25.2,20.4 L60.48,20.4 L60.48,7.65 C60.48,4.83327 58.2246,2.55 55.44,2.55 L29.53188,2.55 C28.65996,1.027905 27.0648,0 25.2,0 L5.04,0 Z" id="Path"></path>
<path d="M30.2012804,7.8 C30.2012804,10.4702795 27.9487682,12.6550537 25.1677337,12.6550537 L12.5838668,12.6550537 L5.03354673,12.6550537 C2.25351887,12.6550537 0,14.8398278 0,17.5101073 L0,36.9303219 L0,45.5682628 C0,48.2385423 2.33103356,50.4 5.11098592,50.4 L55.4464533,50.4 C58.2274878,50.4 60.48,48.2152259 60.48,45.5449463 L60.4025608,36.9303219 L60.4025608,12.6550537 C60.4025608,9.98477414 58.1500487,7.8 55.3690141,7.8 L30.2012804,7.8 Z" id="Path"></path>
</g>
<circle id="Oval" fill="#FFFFFF" cx="35" cy="74" r="32"></circle>
<path d="M54.3088808,87.6772425 C52.1910624,89.4538282 49.4009606,90.9797575 46.396587,91.7689771 C43.0303728,92.6582798 39.2495496,92.9008577 35.650332,92.4338784 C28.8630793,91.5566934 22.7682123,87.3527581 18.6666667,83.4113724 C19.1347294,82.3207818 19.2699628,81.9265086 19.7510463,80.8496064 C20.5585631,81.6760766 21.9897067,82.7738481 22.625669,83.2060452 C27.0292053,86.2139212 32.7855321,88.809123 40.4090843,88.3753552 C44.2696313,88.1675595 47.8530869,86.8543627 50.393738,84.850234 C52.8530663,82.9143234 54.9142328,80.131522 54.8683175,76.2630667 C54.8198893,72.1672929 52.7706013,68.8241613 50.5442764,66.5873284 C49.7769642,65.8178561 48.9509442,64.9958739 48.116929,64.389317 C46.7936066,63.4302255 45.3272841,62.687457 43.8481692,61.9841831 C42.3478099,61.2611618 40.8054186,60.5323062 39.0151756,60.1555363 C41.9656386,58.3102838 49.8973493,56.0487668 50.8341601,56.578354 C51.4180393,56.9050824 52.052631,57.4290596 52.5433088,57.8181716 C54.161312,59.093669 55.5481392,60.8882068 56.7296036,62.5510209 C58.4280159,64.9498716 59.8616722,67.7277362 60.3861584,70.8529741 C61.6553417,78.5710349 58.4405798,84.2228078 54.3088808,87.6772425 M7,75.782883 L7,75.7734567 C10.537516,70.0360569 14.6286486,64.8419341 19.4789374,60.4347927 C22.8258824,57.3887174 26.7653177,54.6679645 31.1310245,52.6946485 C31.8627009,52.3539221 32.5749405,51.9357161 33.365151,51.6710899 C34.1446378,51.4069235 34.9625515,51.1418375 35.8012426,50.8588185 C38.9895647,49.7768629 43.3820809,49.228298 46.9044049,49.6333991 C49.5377698,49.9403288 52.1590705,50.7197231 53.9097321,52.1203337 C54.5006586,52.5884301 55.2108874,53.1004393 55.5942636,53.6611894 C55.8138782,53.9853622 56.1228579,54.7344085 55.9490429,55.1808933 C55.7312155,55.7193421 54.9289407,55.7726812 54.2656285,55.7563576 C52.0051392,55.7126748 49.9296356,55.4641422 47.7422023,55.7393443 C44.6354259,56.1313406 42.0677443,57.0238505 39.8503736,57.9830343 C35.16474,59.9869283 31.143759,63.2941812 27.9737568,66.629713 C24.7778387,69.9861665 21.8236532,74.214668 19.4755862,78.5558254 C16.8565196,83.3878402 14.8822219,88.484941 13.2481818,93.8333333 C9.50624318,88.8098036 7.19012417,82.5918924 7,75.782883 M34.9998875,39 C15.6689898,39 0,54.666808 0,73.9997751 C0,93.3298184 15.6689898,109 34.9998875,109 C54.3319099,109 70,93.3298184 70,73.9997751 C70,54.666808 54.3319099,39 34.9998875,39" id="Fill-694" fill="#82B92E"></path>
<g id="Group-2" transform="translate(11, 8.5)" stroke="#C1CCDC" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
<g id="Group-4">
<polygon id="Triangle" fill="#C1CCDC" transform="translate(31, 5) rotate(90) translate(-31, -5)" points="31 2.5 36 7.5 26 7.5"></polygon>
<path d="M0,39.5 C0,36.5833333 0,33.6666667 0,30.75 C-1.75851975e-15,16.3905965 11.6405965,4.75 26,4.75 L26,4.75 L26,4.75" id="Path-3" stroke-dasharray="2,4"></path>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="14px" height="14px" viewBox="0 0 14 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>6AE8E7E7-D5F8-4670-BCBD-08A30E381B8F</title>
<g id="Import-/-Export" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Mockup---Import-&amp;-Export-expandido-1300" transform="translate(-408, -309)" fill="#FFFFFF" fill-rule="nonzero">
<g id="Left" transform="translate(310, 150)">
<g id="Group" transform="translate(20, 63)">
<g id="Acciones" transform="translate(0, 83)">
<g id="Import" transform="translate(78, 12.998)">
<path d="M13,7.00200171 C13.5522847,7.00200171 14,7.4497171 14,8.00200171 L14,13.0020017 C14,13.5542892 13.5522847,14.0020017 13,14.0020017 L1,14.0020017 C0.44771525,14.0020017 0,13.5542892 0,13.0020017 L0,8.00201357 C0,7.44972864 0.44771525,7.00200171 1,7.00200171 C1.55228475,7.00200171 2,7.44973137 2,8.00201629 L2,12.0020017 L12,12.0020017 L12,8.00200171 C12,7.4891718 12.3860402,7.06649761 12.8833789,7.00873249 L13,7.00200171 Z" id="Path-2"></path>
<path d="M7.42761656,0.09800023 L7.4722276,0.120228483 C7.48541492,0.127297166 7.4984771,0.134682831 7.51140295,0.142385477 C7.6034078,0.196864686 7.68458638,0.263207354 7.75402558,0.341460261 L8.64094412,1.22873487 C8.69800231,1.28579303 8.75962403,1.34741473 8.82669975,1.41449043 L10.1954614,2.78325158 C10.4003199,2.98811 10.6267161,3.21450611 10.8776552,3.46544517 L11.4849524,4.07274209 L11.7071068,4.2948964 C12.0976311,4.68542055 12.0976311,5.3185853 11.7071068,5.70910945 C11.3165825,6.0996336 10.6834175,6.0996336 10.2928932,5.70910945 L10.1805423,5.59675858 L9.46344168,4.87965821 C9.21250254,4.62871916 8.98610634,4.40232305 8.78124784,4.19746462 L8,3.416 L8,10.0020048 C8,10.5542895 7.55228475,11.0020048 7,11.0020048 C6.44771525,11.0020048 6,10.5542895 6,10.0020048 L6,3.41600475 L3.70710678,5.70911154 C3.34662282,6.0695955 2.77939176,6.09732503 2.38710056,5.79230014 L2.29289322,5.70911154 C1.90236893,5.31858724 1.90236893,4.68542227 2.29289322,4.29489797 L6.29289322,0.294897973 C6.54710458,0.0406866095 6.87413362,-0.0382890188 7.1738163,0.0164817914 C7.17680504,0.017663383 7.18016721,0.0182701498 7.18352681,0.0188942109 C7.21466801,0.0243205129 7.24513844,0.0316757544 7.2751983,0.0403969336 C7.28707112,0.0438108284 7.29913038,0.0474948597 7.31113021,0.0514117877 C7.32967787,0.0576595875 7.3480221,0.0642976875 7.3661634,0.0714485049 C7.37897252,0.0762161621 7.39150205,0.0814382908 7.40394259,0.086926426 L7.42761656,0.09800023 Z" id="Path-4-Copy"></path>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="111px" height="110px" viewBox="0 0 111 110" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>A981FD90-8ED5-4170-8C6A-8F4DFD0DCCD4</title>
<g id="Import-/-Export" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Mockup---Import-&amp;-Export-expandido-1300" transform="translate(-1139, -171)">
<g id="Left" transform="translate(310, 150)">
<g id="Import-to-PFMS" transform="translate(830, 21)">
<path d="M96.5504693,41.7233507 C94.7351964,43.2461384 92.3436805,44.5540779 89.7685032,45.2305518 C86.8831767,45.9928112 83.6424711,46.2007351 80.5574274,45.8004672 C74.7397823,45.0485944 69.5156105,41.4452213 66,38.0668907 C66.4011967,37.1320987 66.517111,36.7941502 66.9294683,35.8710912 C67.6216255,36.5794943 68.84832,37.5204413 69.3934306,37.8908959 C73.1678902,40.4690753 78.1018846,42.693534 84.636358,42.321733 C87.9453982,42.1436224 91.0169316,41.0180252 93.1946325,39.3002006 C95.3026282,37.6408486 97.0693424,35.2555903 97.0299864,31.9397715 C96.9884765,28.4291082 95.231944,25.5635668 93.3236655,23.6462815 C92.6659693,22.9867338 91.9579522,22.2821776 91.243082,21.7622717 C90.1088057,20.9401933 88.8519578,20.3035345 87.584145,19.7007283 C86.2981227,19.0809959 84.9760731,18.4562624 83.4415791,18.1333168 C85.9705473,16.5516718 92.7691565,14.6132287 93.5721372,15.0671606 C94.0726051,15.3472135 94.6165408,15.7963368 95.0371218,16.1298614 C96.4239817,17.2231448 97.6126908,18.7613201 98.6253745,20.1865894 C100.081156,22.2427471 101.310005,24.6237739 101.759564,27.3025492 C102.847436,33.9180299 100.091926,38.7624067 96.5504693,41.7233507 M56,31.5281854 L56,31.5201057 C59.0321566,26.6023345 62.5388416,22.1502293 66.696232,18.3726794 C69.565042,15.7617578 72.9417009,13.4296839 76.6837353,11.7382701 C77.3108865,11.446219 77.9213775,11.0877567 78.5987009,10.8609342 C79.2668324,10.6345059 79.9679013,10.4072893 80.6867794,10.1647016 C83.4196269,9.23731103 87.1846408,8.76711259 90.2037756,9.11434212 C92.4609456,9.37742465 94.7077748,10.0454769 96.2083418,11.2460003 C96.7148502,11.6472258 97.3236178,12.0860908 97.6522259,12.5667338 C97.840467,12.8445962 98.1053068,13.4866358 97.9563224,13.8693371 C97.7696133,14.3308647 97.0819491,14.3765839 96.5133958,14.3625923 C94.5758336,14.3251498 92.7968305,14.1121219 90.9218877,14.3480094 C88.2589365,14.6840062 86.0580665,15.4490147 84.1574631,16.2711723 C80.1412057,17.9887957 76.6946506,20.8235839 73.9775058,23.6826111 C71.2381475,26.5595713 68.7059884,30.1840012 66.6933596,33.9049932 C64.4484454,38.0467202 62.7561902,42.4156638 61.3555844,47 C58.1482084,42.6941174 56.1629636,37.3644792 56,31.5281854 M79.9999036,0 C63.4305627,0 50,13.4286926 50,29.9998072 C50,46.5684158 63.4305627,60 79.9999036,60 C96.5702085,60 110,46.5684158 110,29.9998072 C110,13.4286926 96.5702085,0 79.9999036,0" id="Fill-694" fill="#82B92E"></path>
<g id="Carpeta" transform="translate(0, 39)" fill="#FFFFFF" stroke="#C1CCDC" stroke-linejoin="round">
<path d="M39,14 C39,17.6235294 36.09125,20.5882353 32.5,20.5882353 L16.25,20.5882353 L6.5,20.5882353 C2.91005,20.5882353 0,23.5529412 0,27.1764706 L0,53.5294118 L0,63.4117647 C0,67.0352941 2.9101475,70 6.5,70 L71.5,70 C75.09125,70 78,67.0352941 78,63.4117647 L78,53.5294118 L78,20.5882353 C78,16.9647059 75.09125,14 71.5,14 L39,14 Z" id="Path"></path>
<path d="M6.5,0 C2.91005,0 0,2.95979444 0,6.61111111 L0,23.1388889 L32.5,23.1388889 L32.5,26.4444444 L78,26.4444444 L78,9.91666667 C78,6.26535 75.09125,3.30555556 71.5,3.30555556 L38.08675,3.30555556 C36.96225,1.33246944 34.905,0 32.5,0 L6.5,0 Z" id="Path"></path>
<path d="M38.950064,10.1111111 C38.950064,13.5725845 36.0450384,16.4046992 32.4583867,16.4046992 L16.2291933,16.4046992 L6.49167734,16.4046992 C2.90632394,16.4046992 0,19.2368138 0,22.6982872 L0,47.8726395 L0,59.0699703 C0,62.5314438 3.00629328,65.3333333 6.5915493,65.3333333 L71.5083227,65.3333333 C75.0949744,65.3333333 78,62.5012187 78,59.0397453 L77.900128,47.8726395 L77.900128,16.4046992 C77.900128,12.9432257 74.9951024,10.1111111 71.4084507,10.1111111 L38.950064,10.1111111 Z" id="Path"></path>
</g>
<g id="Group-2" transform="translate(11, 8.5)" stroke="#C1CCDC" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
<g id="Group-4">
<polygon id="Triangle" fill="#C1CCDC" transform="translate(31, 5) rotate(90) translate(-31, -5)" points="31 2.5 36 7.5 26 7.5"></polygon>
<path d="M0,39.5 C0,36.5833333 0,33.6666667 0,30.75 C-1.75851975e-15,16.3905965 11.6405965,4.75 26,4.75 L26,4.75 L26,4.75" id="Path-3" stroke-dasharray="2,4"></path>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@ -117,12 +117,25 @@ if ($method === 'draw') {
$where_name = 'name LIKE "%'.$filter['free_search'].'%"';
}
if (is_user_admin($config['id_user']) === false) {
$group_list = \users_get_groups(
$config['id_ser'],
'RR',
true
);
}
$where_group = '';
if (empty($filter['group']) === false && $filter['group'] !== '0') {
$where_group = sprintf('id_group = %s', $filter['group']);
if (empty($where_name) === false) {
$where_group = 'AND '.$where_group;
}
} else if (empty($group_list) === false) {
$where_group = sprintf('id_group IN (%s)', implode(',', array_keys($group_list)));
if (empty($where_name) === false) {
$where_group = 'AND '.$where_group;
}
}
$where = '';

View File

@ -1335,6 +1335,15 @@ if ($perform_event_response === true) {
}
$command = $event_response['target'];
// Prevent OS command injection.
$prev_command = get_events_get_response_target($event_id, $event_response, $server_id);
if ($command !== $prev_command) {
echo __('unauthorized');
return;
}
$command_timeout = ($event_response !== false) ? $event_response['command_timeout'] : 90;
if (enterprise_installed() === true) {
if ($event_response !== false
@ -2040,7 +2049,9 @@ if ($get_extended_event) {
$js .= '});';
$js .= '$("#link_comments").click(get_table_events_tabs(\''.base64_encode(json_encode($event)).'\',\''.base64_encode(json_encode($filter)).'\'));';
$js .= '$("#link_comments").on("click", () => {
get_table_events_tabs(\''.base64_encode(json_encode($event)).'\',\''.base64_encode(json_encode($filter)).'\')
});';
if (events_has_extended_info($event['id_evento']) === true) {
$js .= '
@ -2533,15 +2544,12 @@ if ($drawConsoleSound === true) {
$output .= '<div id="progressbar_time"></div>';
$output .= '<div class="buttons-sound-modal">';
$output .= '<div class="container-button-play">';
$output .= html_print_input(
[
'label' => __('Start'),
'type' => 'button',
'name' => 'start-search',
'attributes' => [ 'class' => 'play secondary' ],
'return' => true,
],
'div',
$output .= html_print_button(
__('Start'),
'start-search',
false,
'',
['icon' => 'play'],
true
);
$output .= '</div>';

View File

@ -250,6 +250,7 @@ if (is_ajax() === true) {
if ($getInfo === true) {
enterprise_include_once('include/functions_agents.php');
include_once $config['homedir'].'/include/functions_graph.php';
$id = get_parameter('id', 0);
$id_server = get_parameter('id_server', 0);
if (empty($id_server) === false) {

View File

@ -26,7 +26,8 @@
* ============================================================================
*/
check_login();
require_once $config['homedir'].'/include/functions_inventory.php';
check_login();
if (is_ajax() === true) {
$id_agent = get_parameter('id_agent', '0');

View File

@ -1875,6 +1875,8 @@ if (check_login()) {
$table_id = get_parameter('table_id', '');
$search = get_parameter('search', '');
$search_agent = get_parameter('search_agent', '');
$groupId = (int) get_parameter('groupId', 0);
$module_name = get_parameter('module_name', '');
$status = get_parameter('status', '');
$start = get_parameter('start', 0);
@ -1886,13 +1888,36 @@ if (check_login()) {
$nodes = get_parameter('nodes', 0);
$disabled_modules = (bool) get_parameter('disabled_modules', false);
$groups_array = [];
if ($groupId === 0) {
if (users_can_manage_group_all('AR') === false) {
$groups_array = users_get_groups(false, 'AR', false);
}
} else {
$groups_array = [$groupId];
}
$where = '1=1';
$recordsTotal = 0;
if (empty($groups_array) === false) {
$where .= sprintf(
' AND (tagente.id_grupo IN (%s)
OR tagent_secondary_group.id_group IN(%s))',
implode(',', $groups_array),
implode(',', $groups_array)
);
}
if (empty($search) === false) {
$where .= ' AND tagente_modulo.nombre LIKE "%%'.$search.'%%"';
}
if (empty($search_agent) === false) {
$where .= ' AND tagente.alias LIKE "%%'.$search_agent.'%%"';
}
if (str_contains($status, '6') === true) {
$expl = explode(',', $status);
$exist = array_search('6', $expl);
@ -1900,12 +1925,24 @@ if (check_login()) {
unset($expl[$exist]);
}
array_push($expl, '1', '2');
array_push($expl, '1', '2', '3', '4', '5');
$status = implode(',', $expl);
}
if (empty($status) === false) {
if (str_contains($status, '5') === true) {
$expl = explode(',', $status);
$exist = array_search('5', $expl);
if (isset($exist) === true) {
unset($expl[$exist]);
}
array_push($expl, '4', '5');
$status = implode(',', $expl);
}
if (empty($status) === false || $status === '0') {
$where .= sprintf(
' AND tagente_estado.estado IN (%s)
AND tagente_modulo.delete_pending = 0',
@ -1967,6 +2004,8 @@ if (check_login()) {
ON tagente_modulo.id_agente = tagente.id_agente
INNER JOIN tagente_estado
ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
LEFT JOIN tagent_secondary_group
ON tagente.id_agente = tagent_secondary_group.id_agent
WHERE %s
ORDER BY %s
LIMIT %d, %d',
@ -1984,6 +2023,8 @@ if (check_login()) {
ON tagente_modulo.id_agente = tagente.id_agente
INNER JOIN tagente_estado
ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
LEFT JOIN tagent_secondary_group
ON tagente.id_agente = tagent_secondary_group.id_agent
WHERE %s',
$where
);
@ -2011,6 +2052,8 @@ if (check_login()) {
ON tagente_modulo.id_agente = tagente.id_agente
INNER JOIN tagente_estado
ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
LEFT JOIN tagent_secondary_group
ON tagente.id_agente = tagent_secondary_group.id_agent
WHERE %s',
$where
);
@ -2043,6 +2086,8 @@ if (check_login()) {
ON tagente_modulo.id_agente = tagente.id_agente
INNER JOIN tagente_estado
ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
LEFT JOIN tagent_secondary_group
ON tagente.id_agente = tagent_secondary_group.id_agent
WHERE %s',
$where
);
@ -2148,24 +2193,25 @@ if (check_login()) {
);
switch ((int) $row['estado']) {
case 0:
case AGENT_MODULE_STATUS_NORMAL:
$status_img = ui_print_status_image(STATUS_MODULE_OK, __('Normal'), true);
break;
case 1:
case 6:
case AGENT_MODULE_STATUS_CRITICAL_BAD:
case AGENT_MODULE_STATUS_NOT_NORMAL:
$status_img = ui_print_status_image(STATUS_MODULE_CRITICAL, __('Critical'), true);
break;
case 2:
case AGENT_MODULE_STATUS_WARNING:
$status_img = ui_print_status_image(STATUS_MODULE_WARNING, __('Warning'), true);
break;
case 3:
case AGENT_MODULE_STATUS_UNKNOWN:
$status_img = ui_print_status_image(STATUS_MODULE_UNKNOWN, __('Unknown'), true);
break;
case 5:
case AGENT_MODULE_STATUS_NO_DATA:
case AGENT_MODULE_STATUS_NOT_INIT:
$status_img = ui_print_status_image(STATUS_MODULE_NO_DATA, __('Not init'), true);
break;

View File

@ -0,0 +1,115 @@
<?php
/**
* Pandora FMS- https://pandorafms.com.
* ==================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; version 2
* 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.
*/
global $config;
if ((bool) is_ajax() === true) {
include_once $config['homedir'].'/include/class/Prd.class.php';
$getResource = (bool) get_parameter('getResource', false);
$exportPrd = (bool) get_parameter('exportPrd', false);
$deleteFile = (bool) get_parameter('deleteFile', false);
$prd = new Prd();
if ($getResource === true) {
$type = (string) get_parameter('type', '');
$result = false;
$data = $prd->getOnePrdData($type);
if (empty($data) === false) {
$sql = sprintf(
'SELECT %s FROM %s',
reset($data['items']['value']).', '.reset($data['items']['show']),
$data['items']['table']
);
$result = html_print_label_input_block(
$data['label'],
io_safe_output(
html_print_select_from_sql(
$sql,
'select_value',
'',
'',
'',
0,
true,
false,
true,
false,
false,
false,
GENERIC_SIZE_TEXT,
'w90p',
),
),
[
'div_style' => 'display: flex; flex-direction: column; width: 50%',
'div_id' => 'resource_type',
],
);
}
echo $result;
return;
}
if ($exportPrd === true) {
$type = (string) get_parameter('type', '');
$value = (int) get_parameter('value', 0);
$name = (string) get_parameter('name', '');
$filename = (string) get_parameter('filename', '');
try {
$data = $prd->exportPrd($type, $value, $name);
} catch (\Exception $e) {
$data = '';
}
$return = [];
if (empty($data) === false) {
$filename_download = date('YmdHis').'-'.$type.'-'.$name.'.prd';
$file = $config['attachment_store'].'/'.$filename;
$file_pointer = fopen($file, 'a');
if ($file_pointer !== false) {
$write = fwrite($file_pointer, $data);
if ($write === false) {
$return['error'] = -2;
unlink($config['attachment_store'].'/'.$filename);
} else {
$return['name'] = $filename;
$return['name_download'] = $filename_download;
}
fclose($file_pointer);
} else {
$return['error'] = -1;
}
}
echo json_encode($return);
return;
}
if ($deleteFile === true) {
$filename = (string) get_parameter('filename', '');
unlink($config['attachment_store'].'/'.$filename);
}
}

View File

@ -129,7 +129,12 @@ if ($check_connectivity) {
if ($create_net_scan) {
$ip_target = get_parameter('ip_target', '192.168.10.0/24');
$id_net_scan = create_net_scan($ip_target);
$snmp_version = get_parameter('snmp_version', '1');
$snmp_communities = get_parameter('snmp_communities', 'public');
$wmi_credentials = get_parameter('wmi_credentials', []);
$rcmd_credentials = get_parameter('rcmd_credentials', []);
$id_net_scan = create_net_scan($ip_target, $snmp_version, $snmp_communities, $wmi_credentials, $rcmd_credentials);
if ($id_net_scan > 0) {
$id_recon_server = db_get_row_filter('tserver', ['server_type' => SERVER_TYPE_DISCOVERY], 'id_server')['id_server'];
ui_print_success_message(__('Basic net created and scan in progress. <a href='.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&server_id='.$id_recon_server.'&force='.$id_net_scan).'>Click here to view the data</a>. Please note that it may take a few seconds to see data if your server is busy'));

View File

@ -380,5 +380,7 @@ if (session_status() !== PHP_SESSION_DISABLED) {
// Could give a warning if no session file is created. Ignore.
@session_destroy();
header_remove('Set-Cookie');
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
if (isset($_COOKIE[session_name()]) === true) {
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
}
}

View File

@ -172,12 +172,12 @@ function process_user_login_local($login, $pass, $api=false, $passAlreadyEncrypt
$credentials_check = $pass === $row['password'];
} else {
// Perform password check whether it is MD5-hashed (old hashing) or Bcrypt-hashed.
if (strlen($row['password']) === 32) {
if (strlen(($row['password'] ?? '')) === 32) {
// MD5.
$credentials_check = $row !== false && $row['password'] !== md5('') && $row['password'] == md5($pass);
} else {
// Bcrypt.
$credentials_check = password_verify($pass, $row['password']);
$credentials_check = password_verify($pass, ($row['password'] ?? ''));
}
}
@ -572,10 +572,10 @@ function get_user_info($user)
*
* @return array An array of user information
*/
function get_users($order='fullname', $filter=false, $fields=false)
function get_users($order='fullname', $filter=[], $fields=false)
{
if (is_array($order) === true) {
$filter['order'] = $order['field'].' '.$order['order'];
$filter['order'] = (string) $order['field'].' '.(string) $order['order'];
} else {
if ($order !== 'registered' || $order !== 'last_connect' || $order !== 'fullname') {
$order = 'fullname';

View File

@ -53,6 +53,48 @@ class AuditLog extends HTML
*/
private $ajaxController;
/**
* TableId
*
* @var integer
*/
public $tableId;
/**
* FilterIp
*
* @var array
*/
public $filterIp;
/**
* FilterPeriod
*
* @var integer
*/
public $filterPeriod;
/**
* FilterText
*
* @var string
*/
public $filterText;
/**
* FilterType
*
* @var string
*/
public $filterType;
/**
* FilterUser
*
* @var string
*/
public $filterUser;
/**
* Class constructor

View File

@ -66,6 +66,13 @@ class CalendarManager
*/
private $message;
/**
* Access
*
* @var string
*/
public $access;
/**
* Allowed methods to be called using AJAX request.
*

View File

@ -27,6 +27,7 @@
*/
use PandoraFMS\Tools\Files;
use PandoraFMS\Agent;
global $config;
@ -1214,6 +1215,7 @@ class ConsoleSupervisor
'',
$config['num_files_attachment']
);
if ($filecount > $config['num_files_attachment']) {
$this->notify(
[
@ -1331,17 +1333,28 @@ class ConsoleSupervisor
$MAX_FILES_DATA_IN = 1000;
$MAX_BADXML_FILES_DATA_IN = 150;
$filecount = $this->countFiles(
$remote_config_dir,
'',
$MAX_FILES_DATA_IN
);
$filecount = 0;
$agentId = db_get_value('id_agente', 'tagente', 'nombre', 'pandora.internals');
if ($agentId !== false) {
$agent = new Agent($agentId);
$moduleId = $agent->searchModules(
['nombre' => 'Data_in_files'],
1
)->toArray()['id_agente_modulo'];
if ($moduleId > 0) {
$filecount = (int) modules_get_last_value($moduleId);
}
}
// If cannot open directory, count is '-1', skip.
if ($filecount > $MAX_FILES_DATA_IN) {
$this->notify(
[
'type' => 'NOTIF.FILES.DATAIN',
'title' => __('There are too much files in spool').'.',
'title' => __('There are too many files in spool').'.',
'message' => __(
'There are more than %d files in %s. Consider checking DataServer performance',
$MAX_FILES_DATA_IN,
@ -1497,17 +1510,42 @@ class ConsoleSupervisor
{
global $config;
$types_sql = sprintf(
' AND (
`server_type` != %d AND
`server_type` != %d
)',
SERVER_TYPE_AUTOPROVISION,
SERVER_TYPE_MIGRATION
);
if (is_metaconsole() === true && isset($config['ndbh']) === false) {
$types_sql = sprintf(
' AND (
`server_type` = %d OR
`server_type` = %d OR
`server_type` = %d OR
`server_type` = %d
)',
SERVER_TYPE_AUTOPROVISION,
SERVER_TYPE_EVENT,
SERVER_TYPE_MIGRATION,
SERVER_TYPE_PREDICTION
);
}
$servers = db_get_all_rows_sql(
'SELECT
id_server,
name,
server_type,
server_keepalive,
status,
unix_timestamp() - unix_timestamp(keepalive) as downtime
FROM tserver
WHERE
unix_timestamp() - unix_timestamp(keepalive) > server_keepalive'
sprintf(
'SELECT id_server,
`name`,
server_type,
server_keepalive,
`status`,
unix_timestamp() - unix_timestamp(keepalive) as downtime
FROM tserver
WHERE unix_timestamp() - unix_timestamp(keepalive) > server_keepalive
%s',
$types_sql
)
);
if ($servers === false) {
@ -1671,6 +1709,10 @@ class ConsoleSupervisor
ini_get('upload_max_filesize')
);
$PHPpost_max_size = config_return_in_bytes(
ini_get('post_max_size')
);
// PHP configuration.
$PHPmax_input_time = ini_get('max_input_time');
$PHPmemory_limit = config_return_in_bytes(ini_get('memory_limit'));
@ -1678,6 +1720,7 @@ class ConsoleSupervisor
$PHPsafe_mode = ini_get('safe_mode');
$PHPdisable_functions = ini_get('disable_functions');
$PHPupload_max_filesize_min = config_return_in_bytes('800M');
$PHPpost_max_size_min = config_return_in_bytes('800M');
$PHPmemory_limit_min = config_return_in_bytes('800M');
$PHPSerialize_precision = ini_get('serialize_precision');
@ -1728,7 +1771,7 @@ class ConsoleSupervisor
'message' => sprintf(
__('Recommended value is %s'),
'-1 ('.__('Unlimited').')'
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Do not forget to restart Apache process after)'),
).'<br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Do not forget to restart Apache process after)'),
'url' => $url,
'icon_notification' => self::ICON_INFORMATION,
]
@ -1753,7 +1796,7 @@ class ConsoleSupervisor
'message' => sprintf(
__('Recommended value is: %s'),
'0 ('.__('Unlimited').')'
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'),
).'<br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'),
'url' => $url,
'icon_notification' => self::ICON_INFORMATION,
]
@ -1778,7 +1821,7 @@ class ConsoleSupervisor
'message' => sprintf(
__('Recommended value is: %s'),
sprintf(__('%s or greater'), '800M')
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'),
).'<br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'),
'url' => $url,
'icon_notification' => self::ICON_INFORMATION,
]
@ -1808,7 +1851,7 @@ class ConsoleSupervisor
'message' => sprintf(
__('Recommended value is: %s'),
sprintf(__('%s or greater'), $recommended_memory)
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator'),
).'<br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator'),
'url' => $url,
'icon_notification' => self::ICON_INFORMATION,
]
@ -1915,6 +1958,25 @@ class ConsoleSupervisor
} else {
$this->cleanNotifications('NOTIF.PHP.VERSION.SUPPORT');
}
if ($PHPpost_max_size < $PHPpost_max_size_min && (int) $PHPpost_max_size !== -1) {
$url = 'https://www.php.net/manual/en/ini.core.php#ini.post-max-size';
$this->notify(
[
'type' => 'NOTIF.PHP.POST_MAX_SIZE',
'title' => __('PHP POST MAX SIZE'),
'message' => sprintf(
__('Recommended value is: %s'),
sprintf(__('%sM or greater'), ($PHPpost_max_size_min / 1024 / 1024))
).'<br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator'),
'url' => $url,
'icon_notification' => self::ICON_HEADSUP,
]
);
} else {
$this->cleanNotifications('NOTIF.PHP.POST_MAX_SIZE');
}
}

View File

@ -850,7 +850,7 @@ class CredentialStore extends Wizard
'privilege' => 'AR',
'type' => 'select_groups',
'nothing' => false,
'selected' => (defined($id_group_filter) ? $id_group_filter : 0),
'selected' => ((isset($id_group_filter) === true) ? $id_group_filter : 0),
'return' => true,
'size' => '80%',
],
@ -1637,7 +1637,7 @@ class CredentialStore extends Wizard
$(".ui-dialog-content").dialog("close");
$('.info').hide();
cleanupDOM();
dt_keystore.draw(false);
window.location.reload();
} else {
$(this).dialog('close');
}

View File

@ -54,6 +54,13 @@ class Diagnostics extends Wizard
*/
public $pdf;
/**
* Product name.
*
* @var string
*/
public $product_name;
/**
* Constructor.
@ -483,7 +490,7 @@ class Diagnostics extends Wizard
],
'isEnterprise' => [
'name' => __('Enterprise installed'),
'value' => (enterprise_installed()) ? __('true') : __('false'),
'value' => $this->getStatusLicense(),
],
'customerKey' => [
'name' => __('Update Key'),
@ -505,6 +512,29 @@ class Diagnostics extends Wizard
}
/**
* Return status of license.
*
* @return string
*/
private function getStatusLicense():string
{
global $config;
if (enterprise_installed() === true) {
if (isset($config['license_mode'])
&& (int) $config['license_mode'] === 1
) {
return __('FREE/TRIAL');
} else {
return __('LICENSED');
}
} else {
return __('OpenSource');
}
}
/**
* PHP Status.
*
@ -517,23 +547,31 @@ class Diagnostics extends Wizard
$result = [
'error' => false,
'data' => [
'phpVersion' => [
'phpVersion' => [
'name' => __('PHP Version'),
'value' => phpversion(),
],
'maxExecutionTime' => [
'maxExecutionTime' => [
'name' => __('PHP Max execution time'),
'value' => ini_get('max_execution_time'),
],
'maxInputTime' => [
'maxInputTime' => [
'name' => __('PHP Max input time'),
'value' => ini_get('max_input_time'),
],
'memoryLimit' => [
'memoryLimit' => [
'name' => __('PHP Memory limit'),
'value' => ini_get('memory_limit'),
],
'sessionLifetime' => [
'postMaxSize' => [
'name' => __('PHP Post max size'),
'value' => ini_get('post_max_size'),
],
'uploadMaxFilesize' => [
'name' => __('PHP Upload max file size'),
'value' => ini_get('upload_max_filesize'),
],
'sessionLifetime' => [
'name' => __('Session cookie lifetime'),
'value' => ini_get('session.cookie_lifetime'),
],

View File

@ -452,6 +452,7 @@ class ExtensionsDiscovery extends Wizard
*/
public function run()
{
ui_require_javascript_file('select2.min');
ui_require_javascript_file('extensions_discovery');
$_iniFile = $this->loadIni();
if ($_iniFile === false) {

View File

@ -38,6 +38,62 @@ require_once $config['homedir'].'/include/class/HTML.class.php';
class ExternalTools extends HTML
{
/**
* Origin
*
* @var string
*/
public $origin;
/**
* PathCustomComm
*
* @var string
*/
public $pathCustomComm;
/**
* PathDig
*
* @var string
*/
public $pathDig;
/**
* PathNmap
*
* @var string
*/
public $pathNmap;
/**
* PathPing
*
* @var string
*/
public $pathPing;
/**
* PathSnmpget
*
* @var string
*/
public $pathSnmpget;
/**
* PathTraceroute
*
* @var string
*/
public $pathTraceroute;
/**
* UpdatePaths
*
* @var string
*/
public $updatePaths;
/**
* Constructor.

View File

@ -706,7 +706,7 @@ class NetworkMap
*/
public function setNodes($nodes)
{
$this->nodes = $nodes;
$this->nodes = (array) $nodes;
}

View File

@ -52,6 +52,13 @@ class OrderInterpreter extends Wizard
*/
public $ajaxController;
/**
* Pages menu
*
* @var array
*/
public $pages_menu;
/**
* Generates a JSON error.

File diff suppressed because it is too large Load Diff

View File

@ -67,6 +67,34 @@ class SatelliteAgent extends HTML
*/
private $ajaxController;
/**
* Satellite_name
*
* @var string
*/
public $satellite_name;
/**
* Satellite_server
*
* @var string
*/
public $satellite_server;
/**
* TableId
*
* @var integer
*/
public $tableId;
/**
* Satellite_config
*
* @var string
*/
public $satellite_config;
/**
* Class constructor

View File

@ -107,7 +107,7 @@ class Tree
$userGroupsACL = users_get_groups(false, $this->access);
$this->userGroupsACL = empty($userGroupsACL) ? false : $userGroupsACL;
$this->userGroupsACL = empty($userGroupsACL) ? [0] : $userGroupsACL;
$this->userGroups = $this->userGroupsACL;
$this->userGroupsArray = array_keys($this->userGroups);

View File

@ -848,13 +848,22 @@ class WelcomeWindow extends Wizard
</div>
<div id="dialog_basic_net" class="invisible">
<?php
$serverIP = $_SERVER['SERVER_ADDR'];
$ipParts = explode('.', $serverIP);
if (count($ipParts) === 4) {
$ipParts[3] = '0/24';
$network = implode('.', $ipParts);
} else {
$network = '192.168.10.0/24';
}
echo html_print_input_hidden('create_net_scan', 1);
echo html_print_label_input_block(
__('Ip target'),
html_print_input_text(
'ip_target_discovery',
'192.168.10.0/24',
'192.168.10.0/24',
$network,
$network,
false,
18,
true,
@ -874,8 +883,320 @@ class WelcomeWindow extends Wizard
)
);
echo html_print_div(
[
'class' => '',
'content' => '<br>To detect and find systems on your network we will need access credentials. The SNMP community for network devices, and at least one set of credentials for Linux and Windows environments (they do not need to be super administrators, but they do need to be able to connect remotely). Without the credentials, we will only be able to detect if the devices are connected to the network.<br><br>',
],
true
);
// SNMP Communities
echo html_print_label_input_block(
__('SNMP communities to try with').ui_print_help_tip(
__(
'You can specify several values, separated by commas, for example: public,mysecret,1234'
),
true
),
html_print_input(
[
'name' => 'community',
'type' => 'text',
'value' => 'public',
'size' => 25,
'return' => true,
],
'div',
true
),
['div_id' => 'snmp-communities-div']
);
ui_require_jquery_file('tag-editor.min', 'include/javascript/', true);
ui_require_jquery_file('caret.min', 'include/javascript/', true);
ui_require_css_file('jquery.tag-editor', 'include/styles/', true);
echo '<br>';
$spacing = '';
for ($i = 0; $i < 12; $i++) {
$spacing .= '&nbsp;';
}
// WMI Credentials
echo '<fieldset style="padding: 10px; padding-top: 0px">';
echo '<legend>'.__('WMI credentials').'</legend>';
echo html_print_div(
[
'id' => 'wmi-creds',
'content' => '',
],
true
);
echo html_print_div(
[
'id' => 'wmi-cred-form',
'hidden' => true,
'style' => 'margin: 10px; display: flex; align-items: center;',
'content' => html_print_div(
[
'id' => 'wmi-cred-user-div',
'style' => 'width: 260px;',
'content' => html_print_label_input_block(
__('User').'&nbsp;',
html_print_input_text(
'wmi-cred-user',
'',
'',
false,
50,
// Max length
true,
false,
true,
'',
'w100p',
'',
'off',
false,
'',
'',
'',
false,
'',
'Username'
),
['div_style' => 'display: flex; align-items: center;']
),
],
true
).html_print_div(
[
'id' => 'wmi-cred-pass-div',
'style' => 'width: 260px;',
'content' => html_print_label_input_block(
$spacing.__('Password').'&nbsp;',
html_print_input_password(
'wmi-cred-pass',
'',
'',
false,
50,
// Max length
true,
false,
true,
'w100p',
'off',
false,
''
),
['div_style' => 'display: flex; align-items: center;']
),
],
true
).html_print_div(
[
'id' => 'wmi-cred-namespace-div',
'style' => 'width: 260px;',
'content' => html_print_label_input_block(
$spacing.__('Namespace').'&nbsp;',
html_print_input_text(
'wmi-cred-namespace',
'',
'',
false,
50,
// Max length
true,
false,
true,
'',
'w100p',
'',
'off',
false,
'',
'',
'',
false,
'',
'Namespace'
),
['div_style' => 'display: flex; align-items: center;']
),
],
true
).'<a onClick="delete_discovery_credential(this);">'.html_print_image(
'images/delete.svg',
true,
[
'title' => __('Delete'),
'style' => 'cursor: pointer;',
'class' => 'main_menu_icon invert_filter',
]
).'</a>',
],
true
);
echo '<div style="height: 10px;"></div>';
echo html_print_button(
__('Add'),
'add-wmi-cred',
false,
'add_discovery_credential("wmi-cred-form","wmi-creds");',
[
'icon' => 'plus',
'mode' => 'secondary',
'class' => 'mini',
],
true,
false,
false,
''
);
echo '</fieldset>';
echo '<br>';
// RCM Credentials
echo '<fieldset style="padding: 10px; padding-top: 0px">';
echo '<legend>'.__('Remote commands credentials').'</legend>';
echo html_print_div(
[
'id' => 'rcmd-creds',
'content' => '',
],
true
);
echo html_print_div(
[
'id' => 'rcmd-cred-form',
'hidden' => true,
'style' => 'margin: 10px; display: flex; align-items: center;',
'content' => html_print_div(
[
'id' => 'rcmd-cred-user-div',
'style' => 'width: 260px;',
'content' => html_print_label_input_block(
__('User').'&nbsp;',
html_print_input_text(
'rcmd-cred-user',
'',
'',
false,
50,
// Max length
true,
false,
true,
'',
'w100p',
'',
'off',
false,
'',
'',
'',
false,
'',
'Username'
),
['div_style' => 'display: flex; align-items: center;']
),
],
true
).html_print_div(
[
'id' => 'rcmd-cred-pass-div',
'style' => 'width: 260px;',
'content' => html_print_label_input_block(
$spacing.__('Password').'&nbsp;',
html_print_input_password(
'rcmd-cred-pass',
'',
'',
false,
50,
// Max length
true,
false,
true,
'w100p',
'off',
false,
''
),
['div_style' => 'display: flex; align-items: center;']
),
],
true
).'<a onClick="delete_discovery_credential(this);">'.html_print_image(
'images/delete.svg',
true,
[
'title' => __('Delete'),
'style' => 'cursor: pointer;',
'class' => 'main_menu_icon invert_filter',
]
).'</a>',
],
true
);
echo '<div style="height: 10px;"></div>';
echo html_print_button(
__('Add'),
'add-rcmd-cred',
false,
'add_discovery_credential("rcmd-cred-form","rcmd-creds");',
[
'icon' => 'plus',
'mode' => 'secondary',
'class' => 'mini',
],
true,
false,
false,
''
);
echo '</fieldset>';
echo html_print_submit_button(__('Create'), 'basic_net', false, ['icon' => 'next', 'style' => 'margin-top:15px; float:right;']);
?>
<script type="text/javascript">
$(document).ready(function() {
$('#snmp-communities-div .tag-editor').remove();
$('#text-community').tagEditor({
forceLowercase: false
});
});
var credentialCounters = {};
function add_discovery_credential(sourceFormId, targetDivId) {
// Increment the counter for this type of credential
credentialCounters[targetDivId] = (credentialCounters[targetDivId] || 0) + 1;
// Clone the source form
var newCredential = $("#" + sourceFormId).clone();
// Generate a unique ID for the new credential
var uniqueId = targetDivId + "-" + credentialCounters[targetDivId];
// Set a new ID for the cloned form
newCredential.attr("id", uniqueId);
// Append the cloned form to the target div
$("#" + targetDivId).append(newCredential);
// Ensure the cloned div is visible
newCredential.show().css("display", "flex");
}
function delete_discovery_credential(clickedElement) {
$(clickedElement).parent().remove();
}
</script>
</div>
<div id="dialog_alert_mail" class="invisible">
<?php
@ -1257,8 +1578,8 @@ class WelcomeWindow extends Wizard
draggable: true,
modal: true,
close: false,
height: 375,
width: 480,
height: 400,
width: 500,
overlay: {
opacity: 0.5,
background: "black"
@ -1274,7 +1595,7 @@ class WelcomeWindow extends Wizard
draggable: true,
modal: true,
close: false,
height: 265,
height: 300,
width: 480,
overlay: {
opacity: 0.5,
@ -1308,8 +1629,8 @@ class WelcomeWindow extends Wizard
draggable: true,
modal: true,
close: false,
height: 200,
width: 480,
height: 590,
width: 925,
overlay: {
opacity: 0.5,
background: "black"
@ -1407,6 +1728,35 @@ class WelcomeWindow extends Wizard
});
$('#button-basic_net').click(function(){
var wmi_credentials = [];
$("#wmi-creds [id^='wmi-creds-']").each(function() {
var credentialId = $(this).attr("id");
var credentialValues = {
user: $(this).find('[name="wmi-cred-user"]').val(),
pass: $(this).find('[name="wmi-cred-pass"]').val(),
namespace: $(this).find('[name="wmi-cred-namespace"]').val()
};
wmi_credentials.push({
id: credentialId,
credential: credentialValues
});
});
var rcmd_credentials = [];
$("#rcmd-creds [id^='rcmd-creds-']").each(function() {
var credentialId = $(this).attr("id");
var credentialValues = {
user: $(this).find('[name="rcmd-cred-user"]').val(),
pass: $(this).find('[name="rcmd-cred-pass"]').val()
};
rcmd_credentials.push({
id: credentialId,
credential: credentialValues
});
});
$.ajax({
async: false,
type: "POST",
@ -1414,6 +1764,10 @@ class WelcomeWindow extends Wizard
data: {
create_net_scan: 1,
ip_target: $('#text-ip_target_discovery').val(),
snmp_version: 1,
snmp_communities: $('#text-community').val(),
wmi_credentials: wmi_credentials,
rcmd_credentials: rcmd_credentials
},
success: function(data) {
if (data !== 0) {

View File

@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC240123';
$build_version = 'PC240219';
$pandora_version = 'v7.0NG.775';
// Do not overwrite default timezone set if defined.

View File

@ -819,6 +819,7 @@ define('AUDIT_LOG_INCIDENT_MANAGEMENT', 'Incident management');
define('AUDIT_LOG_UMC', 'Warp Manager');
define('AUDIT_LOG_NMS_VIOLATION', 'NMS Violation');
define('AUDIT_LOG_ENTERPRISE_VIOLATION', 'Enterprise Violation');
define('AUDIT_LOG_CRON_TASK', 'Cron task');
// MIMEs.
define(
@ -906,3 +907,16 @@ define('DEMO_SERVICE', 6);
define('DEMO_DASHBOARD', 7);
define('DEMO_VISUAL_CONSOLE', 8);
define('DEMO_PLUGIN', 9);
// Export resources.
define('LINE_BREAK', "\n");
// OS.
define('LINUX', '1');
define('SOLARIS', '2');
define('AIX', '3');
define('BSD', '4');
define('HPUX', '5');
define('CISCO', '7');
define('MACOS', '8');
define('WINDOWS', '9');

Some files were not shown because too many files have changed in this diff Show More