Merge branch 'develop' into ent-13357-sql-horizontal-bar-graph-en-pdf-no-muestra-valor-del-porcentaje-del-elemento-mas-pequeno

This commit is contained in:
Pablo Aragon 2024-05-06 14:39:24 +02:00
commit 5bcbd5df88
250 changed files with 12291 additions and 9820 deletions

View File

@ -22,7 +22,7 @@ Pandora FMS is an open source monitoring application whose origin dates back to
It allows you to supervise systems and applications of all types, through remote monitoring or with software agents installed on the equipment to be monitored.
Pandora FMS monitors your hardware, software, your multilayer system and, of course, your operating system. Pandora FMS can detect if a network interface is down or the movement of the market value of any new NASDAQ technology. If desired, Pandora FMS can send an SMS message when your system or application fails or when the value of Tesla's stock drops below $180. Pandora FMS will adapt to your systems and requirements, because it has been designed to be open, modular, multiplatform and easy to customize.
Pandora FMS monitors your hardware, software, your multilayer system and, of course, your operating system. Pandora FMS can detect if a network interface is down or the movement of the market value of any new NASDAQ technology. If desired, Pandora FMS can send an SMS message when your system or application fails or when the value of Tesla's stock drops below \$180. Pandora FMS will adapt to your systems and requirements, because it has been designed to be open, modular, multiplatform and easy to customize.
Pandora FMS can be deployed over any OS, with specific agents for each platform. There are agents for Windows (2000, XP, 2003), GNU/Linux, Solaris, HP-UX, BSD, AIX, IPSO and OpenWRT. Pandora FMS not only gathers information through its agents, but it can also monitor any hardware system with TCP/IP connectivity, such as load balancing systems, routers, switches or printers, through SNMP and TCP/ICMP checks.

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.776-240422
Version: 7.0NG.776-240506
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.776-240422"
pandora_version="7.0NG.776-240506"
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.776';
use constant AGENT_BUILD => '240422';
use constant AGENT_BUILD => '240506';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.776
%define release 240422
%define release 240506
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.776
%define release 240422
%define release 240506
%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.776
%define release 240422
%define release 240506
%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.776
%define release 240422
%define release 240506
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.776
%define release 240422
%define release 240506
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.776"
PI_BUILD="240422"
PI_BUILD="240506"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{240422}
{240506}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.776 Build 240422")
#define PANDORA_VERSION ("7.0NG.776 Build 240506")
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.776(Build 240422))"
VALUE "ProductVersion", "(7.0NG.776(Build 240506))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.776-240422
Version: 7.0NG.776-240506
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.776-240422"
pandora_version="7.0NG.776-240506"
package_pear=0
package_pandora=1

View File

@ -75,23 +75,19 @@ if (empty($_REQUEST) === true) {
}
// Hash login process.
if (isset($_GET['loginhash']) === true) {
$loginhash_data = get_parameter('loginhash_data', '');
$loginhash_user = str_rot13(get_parameter('loginhash_user', ''));
if ($config['loginhash_pwd'] != ''
&& $loginhash_data == md5(
$loginhash_user.io_output_password($config['loginhash_pwd'])
)
) {
db_logon($loginhash_user, $_SERVER['REMOTE_ADDR']);
$_SESSION['id_usuario'] = $loginhash_user;
$config['id_user'] = $loginhash_user;
if (isset($_POST['auth_token']) === true && (bool) $config['JWT_signature'] !== false) {
include_once $config['homedir'].'/include/class/JWTRepository.class.php';
$jwt = new JWTRepository($config['JWT_signature']);
if ($jwt->setToken($_POST['auth_token']) && $jwt->validate()) {
$id_user = $jwt->payload()->get('id_user');
db_logon($id_user, $_SERVER['REMOTE_ADDR']);
$_SESSION['id_usuario'] = $id_user;
$config['id_user'] = $id_user;
} else {
include_once 'general/login_page.php';
db_pandora_audit(
AUDIT_LOG_USER_REGISTRATION,
'Loginhash failed',
'Login token failed',
'system'
);
while (ob_get_length() > 0) {

View File

@ -28,7 +28,9 @@
"php-di/php-di": "^7.0",
"zircote/swagger-php": "^4.8",
"doctrine/annotations": "^2.0",
"ramsey/uuid": "^4.7"
"ramsey/uuid": "^4.7",
"lcobucci/jwt": "^5.2",
"lcobucci/clock": "^3.2"
},
"repositories": {
"phpchartjs": {

View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "0d777bd9c0ca68c9ec0fe911e71b1b2a",
"content-hash": "c7549451bb31a635714731144a995123",
"packages": [
{
"name": "amphp/amp",
@ -1553,6 +1553,143 @@
},
"time": "2023-11-08T14:08:06+00:00"
},
{
"name": "lcobucci/clock",
"version": "3.2.0",
"source": {
"type": "git",
"url": "https://github.com/lcobucci/clock.git",
"reference": "6f28b826ea01306b07980cb8320ab30b966cd715"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/lcobucci/clock/zipball/6f28b826ea01306b07980cb8320ab30b966cd715",
"reference": "6f28b826ea01306b07980cb8320ab30b966cd715",
"shasum": ""
},
"require": {
"php": "~8.2.0 || ~8.3.0",
"psr/clock": "^1.0"
},
"provide": {
"psr/clock-implementation": "1.0"
},
"require-dev": {
"infection/infection": "^0.27",
"lcobucci/coding-standard": "^11.0.0",
"phpstan/extension-installer": "^1.3.1",
"phpstan/phpstan": "^1.10.25",
"phpstan/phpstan-deprecation-rules": "^1.1.3",
"phpstan/phpstan-phpunit": "^1.3.13",
"phpstan/phpstan-strict-rules": "^1.5.1",
"phpunit/phpunit": "^10.2.3"
},
"type": "library",
"autoload": {
"psr-4": {
"Lcobucci\\Clock\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Luís Cobucci",
"email": "lcobucci@gmail.com"
}
],
"description": "Yet another clock abstraction",
"support": {
"issues": "https://github.com/lcobucci/clock/issues",
"source": "https://github.com/lcobucci/clock/tree/3.2.0"
},
"funding": [
{
"url": "https://github.com/lcobucci",
"type": "github"
},
{
"url": "https://www.patreon.com/lcobucci",
"type": "patreon"
}
],
"time": "2023-11-17T17:00:27+00:00"
},
{
"name": "lcobucci/jwt",
"version": "5.2.0",
"source": {
"type": "git",
"url": "https://github.com/lcobucci/jwt.git",
"reference": "0ba88aed12c04bd2ed9924f500673f32b67a6211"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/lcobucci/jwt/zipball/0ba88aed12c04bd2ed9924f500673f32b67a6211",
"reference": "0ba88aed12c04bd2ed9924f500673f32b67a6211",
"shasum": ""
},
"require": {
"ext-openssl": "*",
"ext-sodium": "*",
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"psr/clock": "^1.0"
},
"require-dev": {
"infection/infection": "^0.27.0",
"lcobucci/clock": "^3.0",
"lcobucci/coding-standard": "^11.0",
"phpbench/phpbench": "^1.2.9",
"phpstan/extension-installer": "^1.2",
"phpstan/phpstan": "^1.10.7",
"phpstan/phpstan-deprecation-rules": "^1.1.3",
"phpstan/phpstan-phpunit": "^1.3.10",
"phpstan/phpstan-strict-rules": "^1.5.0",
"phpunit/phpunit": "^10.2.6"
},
"suggest": {
"lcobucci/clock": ">= 3.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Lcobucci\\JWT\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Luís Cobucci",
"email": "lcobucci@gmail.com",
"role": "Developer"
}
],
"description": "A simple library to work with JSON Web Token and JSON Web Signature",
"keywords": [
"JWS",
"jwt"
],
"support": {
"issues": "https://github.com/lcobucci/jwt/issues",
"source": "https://github.com/lcobucci/jwt/tree/5.2.0"
},
"funding": [
{
"url": "https://github.com/lcobucci",
"type": "github"
},
{
"url": "https://www.patreon.com/lcobucci",
"type": "patreon"
}
],
"time": "2023-11-20T21:17:42+00:00"
},
{
"name": "monolog/monolog",
"version": "3.5.0",
@ -2307,6 +2444,54 @@
},
"time": "2021-02-03T23:26:27+00:00"
},
{
"name": "psr/clock",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/clock.git",
"reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d",
"reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Psr\\Clock\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for reading the clock.",
"homepage": "https://github.com/php-fig/clock",
"keywords": [
"clock",
"now",
"psr",
"psr-20",
"time"
],
"support": {
"issues": "https://github.com/php-fig/clock/issues",
"source": "https://github.com/php-fig/clock/tree/1.0.0"
},
"time": "2022-11-25T14:36:26+00:00"
},
{
"name": "psr/container",
"version": "2.0.2",
@ -4338,5 +4523,5 @@
"platform-overrides": {
"php": "8.2"
},
"plugin-api-version": "2.3.0"
"plugin-api-version": "2.2.0"
}

View File

@ -69,6 +69,10 @@ function api_execute(
if (empty($url) === true) {
$url = 'http://'.$ip.$pandora_url.'/include/api.php?';
} else {
$url_schema = parse_url($url);
$url = $url_schema['scheme'].'://'.$url_schema['host'].$pandora_url.'/include/api.php?';
}
if (empty($op) === false) {
$data['op'] = $op;
@ -101,7 +105,6 @@ function api_execute(
$data['user'] = $user;
$data['pass'] = $password;
}
}
$url_protocol = parse_url($url)['scheme'];

View File

@ -50,14 +50,7 @@ function extension_db_status()
}
ui_print_info_message(
" - " .
__('This extension checks the DB is correct. Because sometimes the old DB from a migration has not some fields in the tables or the data is changed.') .
"<br>" .
" - " .
__('At the moment the checks is for MySQL/MariaDB.') .
"<br>" .
" - " .
__('User must have Select, Drop, Create and References privileges.')
' - '.__('This extension checks the DB is correct. Because sometimes the old DB from a migration has not some fields in the tables or the data is changed.').'<br>'.' - '.__('At the moment the checks is for MySQL/MariaDB.').'<br>'.' - '.__('User must have Select, Drop, Create and References privileges.')
);
echo "<form method='post' class='max_floating_element_size'>";
@ -231,13 +224,13 @@ function extension_db_status_execute_checks($db_user, $db_password, $db_host, $d
if (check_ref_privileges($connection_test) == 0) {
drop_database($connection_test, $db_name);
ui_print_error_message(__("Unable to <b>create references</b> with the provided user please check its privileges"));
ui_print_error_message(__('Unable to <b>create references</b> with the provided user please check its privileges'));
return;
}
if (check_explain_privileges($connection_test) == 0) {
drop_database($connection_test, $db_name);
ui_print_error_message(__("Unable to <b>explain</b> with the provided user please check its privileges"));
ui_print_error_message(__('Unable to <b>explain</b> with the provided user please check its privileges'));
return;
}
@ -348,7 +341,7 @@ function extension_db_check_tables_differences(
if ($config['mysqli'] === true) {
mysqli_select_db($connection_test, $db_name_test);
$result = mysqli_query($connection_test, 'SHOW CREATE TABLE '.$table);
$create_query = mysqli_fetch_assoc($result)["Create Table"];
$create_query = mysqli_fetch_assoc($result)['Create Table'];
mysqli_free_result($result);
ui_print_info_message(
__('You can execute this SQL query for to fix.').'<br />'.'<pre>'.$create_query.'</pre>'
@ -356,7 +349,7 @@ function extension_db_check_tables_differences(
} else {
mysql_select_db($db_name_test, $connection_test);
$result = mysql_query('SHOW CREATE TABLE '.$table, $connection_test);
$create_query = mysqli_fetch_assoc($result)["Create Table"];
$create_query = mysqli_fetch_assoc($result)['Create Table'];
mysql_free_result($result);
ui_print_info_message(
__('You can execute this SQL query for to fix.').'<br />'.'<pre>'.$create_query.'</pre>'
@ -539,6 +532,7 @@ function extension_db_status_execute_sql_file($url, $connection)
} else {
$result = mysql_query($query, $connection);
}
if (!$result) {
echo mysqli_error($connection);
// Uncomment for debug
@ -563,19 +557,19 @@ function check_explain_privileges($connection)
global $config;
$has_privileges = 1;
$explain_check= "EXPLAIN tb1";
$explain_check = 'EXPLAIN tb1';
$create_tb1= "CREATE TABLE tb1 (
$create_tb1 = 'CREATE TABLE tb1 (
id INT AUTO_INCREMENT PRIMARY KEY
)";
)';
drop_database($connection, 'pandora_tmp_privilege_check');
try {
if ($config['mysqli']) {
mysqli_query($connection, "CREATE DATABASE `pandora_tmp_privilege_check`");
mysqli_query($connection, 'CREATE DATABASE `pandora_tmp_privilege_check`');
} else {
mysql_query("CREATE DATABASE `pandora_tmp_privilege_check`", $connection);
mysql_query('CREATE DATABASE `pandora_tmp_privilege_check`', $connection);
}
} catch (Exception $e) {
ui_print_error_message(__('There was an error creating the DB during reference check'));
@ -584,9 +578,9 @@ function check_explain_privileges($connection)
try {
if ($config['mysqli'] === true) {
mysqli_select_db($connection, "pandora_tmp_privilege_check");
mysqli_select_db($connection, 'pandora_tmp_privilege_check');
} else {
mysql_select_db("reference_check", $connection);
mysql_select_db('reference_check', $connection);
}
} catch (Exception $e) {
ui_print_error_message(__('There was an error selecting the DB during reference check'));
@ -600,8 +594,8 @@ function check_explain_privileges($connection)
$result = mysql_query($create_tb1, $connection);
}
if(!$result){
throw new Exception("Error on explain check: " . $connection->error);
if (!$result) {
throw new Exception('Error on explain check: '.$connection->error);
}
if ($config['mysqli'] === true) {
@ -610,10 +604,9 @@ function check_explain_privileges($connection)
$result = mysql_query($explain_check, $connection);
}
if(!$result){
throw new Exception("Error on explain check: " . $connection->error);
if (!$result) {
throw new Exception('Error on explain check: '.$connection->error);
}
} catch (Exception $e) {
$has_privileges = 0;
} finally {
@ -630,19 +623,19 @@ function check_drop_privileges($connection)
try {
if ($config['mysqli']) {
$create_db = mysqli_query($connection, "CREATE DATABASE IF NOT EXISTS`pandora_tmp_privilege_check`");
$create_db = mysqli_query($connection, 'CREATE DATABASE IF NOT EXISTS`pandora_tmp_privilege_check`');
} else {
$create_db = mysql_query("CREATE DATABASE IF NOT EXISTS `pandora_tmp_privilege_check`", $connection);
$create_db = mysql_query('CREATE DATABASE IF NOT EXISTS `pandora_tmp_privilege_check`', $connection);
}
} catch (Exception $e) {
$error_message = $e->getMessage();
}
if (!$create_db) {
if (stripos($error_message, "access denied for user") !== false) {
if (stripos($error_message, 'access denied for user') !== false) {
preg_match("/'.+?'\@'.+?'/", $error_message, $error_user);
$error_user = $error_user[0];
ui_print_error_message(__("Unable to <b>create databases</b> with the provided user please check its privileges"));
ui_print_error_message(__('Unable to <b>create databases</b> with the provided user please check its privileges'));
return 0;
}
@ -652,9 +645,9 @@ function check_drop_privileges($connection)
try {
if ($config['mysqli'] === true) {
mysqli_select_db($connection, "pandora_tmp_privilege_check");
mysqli_select_db($connection, 'pandora_tmp_privilege_check');
} else {
mysql_select_db("reference_check", $connection);
mysql_select_db('reference_check', $connection);
}
} catch (Exception $e) {
ui_print_error_message(__('There was an error selecting the DB during drop check'));
@ -666,9 +659,7 @@ function check_drop_privileges($connection)
} catch (Exception $e) {
$has_privileges = 0;
ui_print_error_message(
__("Unable to <b>drop databases</b> with the provided user please check its privileges.") .
"<br>" .
__("Test databases may have been left over due to lack of drop privileges.")
__('Unable to <b>drop databases</b> with the provided user please check its privileges.').'<br>'.__('Test databases may have been left over due to lack of drop privileges.')
);
} finally {
return $has_privileges;
@ -683,21 +674,21 @@ function check_ref_privileges($connection)
drop_database($connection, 'pandora_tmp_privilege_check');
$create_tb1= "CREATE TABLE tb1 (
$create_tb1 = 'CREATE TABLE tb1 (
id INT AUTO_INCREMENT PRIMARY KEY
)";
)';
$create_tb2 = "CREATE TABLE tb2 (
$create_tb2 = 'CREATE TABLE tb2 (
id INT AUTO_INCREMENT PRIMARY KEY,
id_tb1 INT,
FOREIGN KEY (id_tb1) REFERENCES tb2(id)
)";
)';
try {
if ($config['mysqli']) {
mysqli_query($connection, "CREATE DATABASE `pandora_tmp_privilege_check`");
mysqli_query($connection, 'CREATE DATABASE `pandora_tmp_privilege_check`');
} else {
mysql_query("CREATE DATABASE `pandora_tmp_privilege_check`", $connection);
mysql_query('CREATE DATABASE `pandora_tmp_privilege_check`', $connection);
}
} catch (Exception $e) {
ui_print_error_message(__('There was an error creating the DB during reference check'));
@ -706,9 +697,9 @@ function check_ref_privileges($connection)
try {
if ($config['mysqli'] === true) {
mysqli_select_db($connection, "pandora_tmp_privilege_check");
mysqli_select_db($connection, 'pandora_tmp_privilege_check');
} else {
mysql_select_db("reference_check", $connection);
mysql_select_db('reference_check', $connection);
}
} catch (Exception $e) {
ui_print_error_message(__('There was an error selecting the DB during reference check'));
@ -722,8 +713,8 @@ function check_ref_privileges($connection)
$result = mysql_query($create_tb1, $connection);
}
if(!$result){
throw new Exception("Error on reference check: " . $connection->error);
if (!$result) {
throw new Exception('Error on reference check: '.$connection->error);
}
if ($config['mysqli'] === true) {
@ -732,10 +723,9 @@ function check_ref_privileges($connection)
$result = mysql_query($create_tb2, $connection);
}
if(!$result){
throw new Exception("Error on reference check: " . $connection->error);
if (!$result) {
throw new Exception('Error on reference check: '.$connection->error);
}
} catch (Exception $e) {
$has_privileges = 0;
} finally {

View File

@ -27,7 +27,7 @@ switch ($graph) {
if ($os == 'windows') {
$data = exec('wmic cpu get loadpercentage|find /I /V "Loadpercentage" | findstr /r "[0-9]" ');
} else {
$data = exec("top -bn 2 -d 0.01 | grep '^Cpu' | tail -n 1 | awk '{ print $2+$4+$6 }'");
$data = exec("top -bn 2 -d 0.01 | grep 'Cpu' | tail -n 1 | awk '{ print $2+$4+$6 }'");
}
break;
@ -55,7 +55,8 @@ switch ($graph) {
if ($os == 'windows') {
$data = exec('(FOR /F "skip=2 tokens=2 delims=\," %P IN (\'typeperf "\\Process(httpd)\\% processor time" -sc 1\') DO @echo %P)|find /V /I "..."');
} else {
$data = exec("ps aux | grep apache2 | grep -v safe | grep -v grep | awk '{ sum+=$3 } END { print sum }'");
$apache = exec('ps aux | grep apache2 | grep -v safe | grep -v grep && echo 1 || echo 0') == 1 ? 'apache2' : 'apache';
$data = exec("ps aux | grep $apache | grep -v safe | grep -v grep | awk '{ sum+=$3 } END { print sum }'");
}
break;
@ -63,7 +64,7 @@ switch ($graph) {
if ($os == 'windows') {
$data = exec('(FOR /F "skip=2 tokens=2 delims=\," %P IN (\'typeperf "\\Process(pandora_server)\\% processor time" -sc 1\') DO @echo %P)|find /V /I "..."');
} else {
$data = exec("ps aux | grep pandora_server | grep -v grep | awk '{ print $3 }'");
$data = exec("ps aux | grep pandora_server | grep -v grep | awk '{ sum+=$3 } END { print sum }'");
}
break;

View File

@ -1,4 +1,4 @@
pandorafms.vmware=a272ee00a9b5f201bb708bef72bbe276
pandorafms.vmware=999bbda7bbcc313aee81d6816f8a5c0e
pandorafms.mysql=33d470c7492214d4b384ed307e81adf4
pandorafms.vmware=1deafce1d55d3574645d8b136104e9ad
pandorafms.mysql=ca7dd8b80a1a03a25eb0fb077818ad63

View File

@ -64,7 +64,7 @@ ALTER TABLE `tmerge_queries` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_09
-- Update version for plugin oracle
UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.oracle';
-- Update version for plugin oracle
UPDATE `tdiscovery_apps` SET `version` = '1.3' WHERE `short_name` = 'pandorafms.vmware';
UPDATE `tdiscovery_apps` SET `version` = '1.4' WHERE `short_name` = 'pandorafms.vmware';
ALTER TABLE `tevent_sound` MODIFY COLUMN `name` text NULL;
ALTER TABLE `tevent_sound` MODIFY COLUMN `sound` text NULL;

View File

@ -1,5 +1,11 @@
START TRANSACTION;
-- Remove column id_usuario_destino from tmensajes --
SET @exist = (SELECT count(*) FROM information_schema.columns WHERE TABLE_NAME='tmensajes' AND COLUMN_NAME='id_usuario_destino' AND table_schema = DATABASE());
SET @sqlstmt = IF (@exist>0, 'ALTER TABLE `tmensajes` DROP COLUMN `id_usuario_destino`', 'SELECT ""');
prepare stmt from @sqlstmt;
execute stmt;
DROP TABLE IF EXISTS tskin;
ALTER TABLE tfavmenu_user CONVERT TO CHARACTER SET UTF8MB4;
@ -7748,4 +7754,14 @@ ALTER TABLE `tdeployment_hosts` DROP COLUMN `arch`;
-- Update all deployment recon tasks port
UPDATE `trecon_task` SET `field4` = 41121 WHERE `type` = 9;
-- Update execution in proxmox discovery plugin
SET @short_name = 'pandorafms.proxmox';
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
UPDATE `tdiscovery_apps_executions` SET `execution` = '&#039;_exec1_&#039;&#x20;--conf&#x20;&#039;_tempfileProxmox_&#039;' WHERE `id_app` = @id_app;
INSERT INTO `tconfig` (`token`, `value`) VALUES ('JWT_signature', 1);
DELETE FROM tconfig WHERE `token` = 'loginhash_pwd';
UPDATE `tdiscovery_apps` SET `version` = '1.5' WHERE `short_name` = 'pandorafms.vmware';
COMMIT;

View File

@ -52,7 +52,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
}
// ======= Servers List ===============================================
if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) {
if ((bool) check_acl($config['id_user'], 0, 'PM') !== false) {
$servers = [];
$servers_info = servers_get_info();
@ -363,20 +363,6 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$display_counter = 'display:none';
}
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$header_setup .= '<div id="header_logout"><a class="white" href="'.ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=general').'">';
$header_setup .= html_print_image(
'images/configuration@svg.svg',
true,
[
'alt' => __('Setup'),
'class' => 'bot invert_filter main_menu_icon',
'title' => __('Setup'),
]
);
$header_setup .= '</a></div>';
}
$header_autorefresh = '<div id="header_autorefresh">';
$header_autorefresh .= $autorefresh_link_open_img;
$header_autorefresh .= $autorefresh_img;
@ -391,6 +377,20 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$header_autorefresh_counter .= '</div>';
}
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$header_setup .= '<div id="header_logout"><a class="white" href="'.ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=general').'">';
$header_setup .= html_print_image(
'images/configuration@svg.svg',
true,
[
'alt' => __('Setup'),
'class' => 'bot invert_filter main_menu_icon',
'title' => __('Setup'),
]
);
$header_setup .= '</a></div>';
}
$modal_box = '<div id="modal_help" class="invisible">
<div id="modal-feedback-form" class="invisible"></div>
<div id="msg-header" class="invisible"></div>

View File

@ -1065,6 +1065,7 @@ if ($update_agent) {
}
$field_values = [];
$update_custom_result = false;
foreach ($fields as $field) {
$field_value = get_parameter_post('customvalue_'.$field['id_field'], '');
@ -1115,7 +1116,7 @@ if ($update_agent) {
);
if ($update_custom == 1) {
$update_custom_result = 1;
$update_custom_result = true;
}
}
}
@ -1157,6 +1158,7 @@ if ($update_agent) {
}
}
$agent_data = agents_get_agent($id_agente);
$values = [
'disabled' => $disabled,
'id_parent' => $id_parent,
@ -1184,6 +1186,14 @@ if ($update_agent) {
'vul_scan_enabled' => $vul_scan_enabled,
'ignore_unknown' => $ignore_unknown,
];
// Update change fix on ticket 13501 to no show errors when press button update with out change anything.
$update_change = false;
foreach ($values as $key => $value) {
if (isset($agent_data[$key]) === true && $agent_data[$key] !== $value) {
$update_agent = true;
break;
}
}
if (empty($repeated_name) === true) {
$values['nombre'] = $nombre_agente;
@ -1195,7 +1205,7 @@ if ($update_agent) {
}
$result = (bool) db_process_sql_update('tagente', $values, ['id_agente' => $id_agente]);
if ($result === false && $update_custom_result == false) {
if ($result === false && $update_custom_result === false && $update_change === true) {
ui_print_error_message(
__('There was a problem updating the agent')
);

View File

@ -566,10 +566,10 @@ if ($search != '') {
if ($id != '') {
$aux = $id[0]['id_agent'];
$search_sql = sprintf(
' AND ( REPLACE(nombre, "&#x20;", " ") LIKE "%%%s%%"
OR REPLACE(alias, "&#x20;", " ") LIKE "%%%s%%"
OR REPLACE(comentarios, "&#x20;", " ") LIKE "%%%s%%"
OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND REPLACE(description, "&#x20;", " ") LIKE "%%%s%%")
' AND ( nombre LIKE "%%%s%%"
OR alias LIKE "%%%s%%"
OR comentarios LIKE "%%%s%%"
OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND description LIKE "%%%s%%")
OR tagente.id_agente = %d',
$search,
$search,
@ -591,10 +591,10 @@ if ($search != '') {
$search_sql .= ')';
} else {
$search_sql = sprintf(
' AND ( REPLACE(nombre, "&#x20;", " ")
LIKE "%%%s%%" OR REPLACE(alias, "&#x20;", " ")
LIKE "%%%s%%" OR REPLACE(comentarios, "&#x20;", " ") LIKE "%%%s%%"
OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND REPLACE(description, "&#x20;", " ") LIKE "%%%s%%"))',
' AND ( nombre
LIKE "%%%s%%" OR alias
LIKE "%%%s%%" OR comentarios LIKE "%%%s%%"
OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND description LIKE "%%%s%%"))',
$search,
$search,
$search,
@ -763,7 +763,7 @@ if ($agents !== false) {
$agent['id_agente']
);
$agentViewUrl = sprintf(
'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=%s',
'index.php?sec=estado&sec2=godmode/agentes/configurar_agente&id_agente=%s',
$agent['id_agente']
);
$agentAlertUrl = sprintf(

View File

@ -906,7 +906,8 @@ $table->data[0][] = html_print_label_input_block(
false,
true,
'',
$disabled_in_execution
$disabled_in_execution,
'width: 100%;'
)
);
@ -939,8 +940,9 @@ $table->data[1][] = html_print_label_input_block(
true,
false,
true,
'',
$disabled_in_execution
'w100p',
$disabled_in_execution,
'width: 100%;'
).ui_print_input_placeholder(
__('Quiet: Modules will not generate events or fire alerts.').'<br>'.__('Disable Agents: Disables the selected agents.').'<br>'.__('Disable Alerts: Disable alerts for the selected agents.'),
true
@ -964,7 +966,8 @@ $table->data[2][] = html_print_label_input_block(
false,
true,
'',
$disabled_in_execution
$disabled_in_execution,
'width: 100%;'
)
);

View File

@ -294,10 +294,14 @@ $(document).ready (function () {
// configure your validation
$("form.add_alert_form").validate({
rules: {
id_agent_module: { valueNotEquals: "0" }
id_agent_module: { valueNotEquals: "0" },
template: { valueNotEquals: "0" },
id_agent: { valueNotEquals: "" },
},
messages: {
id_agent_module: { valueNotEquals: "Please select an item!" }
id_agent_module: { valueNotEquals: "<?php echo __('Please select an item'); ?>!"},
template: { valueNotEquals: "<?php echo __('Please select a templete'); ?>!"},
id_agent: { valueNotEquals: "<?php echo __('Please select an agent'); ?>!"},
}
});
$("select#template").change (function () {

View File

@ -220,7 +220,6 @@ if ($create_alert) {
if (is_metaconsole()) {
// Restore db connection.
metaconsole_restore_db();
echo '<script>window.location.assign("index.php?sec=estado&sec2=operation/agentes/alerts_status")</script>';
}
}

View File

@ -473,6 +473,13 @@ if ($access_console_node === true) {
enterprise_hook('translate_string_submenu');
$menu_godmode['gsetup']['sub'] = $sub;
} else if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
$menu_godmode['gservers']['text'] = __('Servers');
$menu_godmode['gservers']['sec2'] = 'godmode/servers/modificar_server';
$menu_godmode['gservers']['id'] = 'god-servers';
$sub = [];
enterprise_hook('manage_satellite_submenu');
$menu_godmode['gservers']['sub'] = $sub;
}
}

View File

@ -154,14 +154,16 @@ $table->data[0][1] = html_print_label_input_block(
echo '<span id ="none_text" class="invisible">'.__('None').'</span>';
echo "<form id='agentmodules' method='post' action='index.php?sec=reporting&sec2=godmode/reporting/graph_builder&tab=graph_editor&add_module=1&edit_graph=1&id=".$id_graph."'>";
echo "<table width='100%' cellpadding='4' cellpadding='4' class='databox filters max_floating_element_size'>";
echo "<table width='100%' cellpadding='4' cellpadding='4' class='databox filters max_floating_element_size custom-graph-editor'>";
echo '<tr>';
echo '<td class="w50p pdd_50px" id="select_multiple_modules_filtered">'.html_print_input(
[
'type' => 'select_multiple_modules_filtered',
'uniqId' => 'modules',
'class' => 'flex flex-row',
'searchBar' => false,
'searchBar' => true,
'searchBarAgents' => false,
'searchBarModules' => true,
'placeholderAgents' => __('Search agent name'),
]
).'</td>';

View File

@ -1459,7 +1459,7 @@ $class = 'databox filters';
<td class="bolder">
<?php
echo __('Module').ui_print_help_tip(
__('Case insensitive regular expression or string for module name. For example: if you use this field with "Module exact match" enabled then this field has to be fulfilled with the literally string of the module name, if not you can use a regular expression. Example: %s will match: cpu_usage, vram usage in matchine 1.', '.*usage.*'),
__('Case insensitive regular expression or string for module name. For example: if you use this field with "Module exact match" enabled then this field has to be fulfilled with the literally string of the module name, if not you can use a regular expression. Example: %s will match: cpu_usage, vram usage in machine 1.', '.*usage.*'),
true
);
?>
@ -2318,7 +2318,9 @@ if (is_metaconsole() === true) {
$params['add_none_module'] = true;
$params['use_hidden_input_idagent'] = true;
$params['hidden_input_idagent_id'] = 'hidden-id_agent';
$params['size'] = 40;
if ($meta) {
$params['size'] = 44;
$params['use_input_id_server'] = true;
$params['input_id_server_id'] = 'hidden-server_id';
$params['metaconsole_enabled'] = true;
@ -2343,7 +2345,7 @@ if (is_metaconsole() === true) {
if ($idAgent) {
$sql = 'SELECT id_agente_modulo, nombre
FROM tagente_modulo
WHERE id_agente = "'.$idAgent["id_agent"].'" AND delete_pending = 0';
WHERE id_agente = "'.$idAgent.'" AND delete_pending = 0';
if ($meta) {
$connection = metaconsole_get_connection($server_name);
@ -6645,26 +6647,6 @@ function create_custom_graph() {
$("#meta_target_servers").css('display', 'inline');
}
else {
var hash_data;
var params1 = [];
params1.push("get_metaconsole_hash_data=1");
params1.push("server_name=" + target_server);
params1.push("page=include/ajax/reporting.ajax");
jQuery.ajax ({
data: params1.join ("&"),
type: 'POST',
url: action=
<?php
echo '"'.ui_get_full_url(false, false, false, false).'"';
?>
+ "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
hash_data = data;
}
});
var server_url;
var params1 = [];
params1.push("get_metaconsole_server_url=1");
@ -6690,7 +6672,7 @@ function create_custom_graph() {
}
});
window.location.href = server_url + "/index.php?sec=reporting&sec2=godmode/reporting/graph_builder&create=Create graph" + hash_data;
redirectNode(server_url + "/index.php?sec=reporting&sec2=godmode/reporting/graph_builder&create=Create graph", "_self");
}
<?php
} else {
@ -6719,31 +6701,6 @@ function edit_custom_graph() {
id_server = agent_server_temp[1];
}
var hash_data;
var params1 = [];
params1.push("get_metaconsole_hash_data=1");
params1.push("server_name=" + id_server);
params1.push("page=include/ajax/reporting.ajax");
jQuery.ajax ({
data: params1.join ("&"),
type: 'POST',
url: action=
<?php
echo '"'.ui_get_full_url(
false,
false,
false,
false
).'"';
?>
+ "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
hash_data = data;
}
});
var server_url;
var params1 = [];
params1.push("get_metaconsole_server_url=1");
@ -6769,7 +6726,7 @@ function edit_custom_graph() {
}
});
window.location.href = server_url + "index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id=" + id_element_graph + hash_data;
redirectNode(server_url + "index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id=" + id_element_graph, "_self");
<?php
} else {
?>

View File

@ -870,7 +870,7 @@ switch ($action) {
// ui_pagination($total_reports, $url, $offset, $pagination);
$table = new stdClass();
$table->id = 'report_list';
$table->styleTable = 'margin: 0 10px;';
$table->styleTable = '';
$table->class = 'info_table';
$table->cellpadding = 0;
$table->cellspacing = 0;
@ -1328,6 +1328,25 @@ switch ($action) {
],
true
);
} else if (check_acl($config['id_user'], 0, 'RR')) {
$tablePagination = ui_pagination(
$total_reports,
$url,
$offset,
$pagination,
true,
'offset',
$show_count
);
echo html_print_action_buttons(
'',
[
'type' => 'form_action',
'right_content' => $tablePagination,
],
true
);
}
return;
@ -2407,7 +2426,7 @@ switch ($action) {
$values['top_n_value'] = get_parameter('max_items');
$values['server_name'] = get_parameter('combo_server_sql');
if ($sql !== '') {
if ($sql !== '' && $sql !== null) {
// Replaces possible macros to check the validity of the query
$macros_sql = $sql;
$macros_sql = str_replace('_start_date_', '0', $macros_sql);
@ -3357,7 +3376,7 @@ switch ($action) {
$values['server_name'] = get_parameter('combo_server_sql');
if ($sql !== '') {
if ($sql !== '' && $sql !== null) {
// Replaces possible macros to check the validity of the query
$macros_sql = $sql;
$macros_sql = str_replace('_start_date_', '0', $macros_sql);

View File

@ -260,9 +260,8 @@ $layoutSizeElements[] = html_print_button(
false,
'',
[
'icon' => 'cog',
'mode' => 'link',
'value' => 'modsize',
'class' => 'buttonButton mini',
],
true
);
@ -275,9 +274,8 @@ $layoutSizeElements[] = html_print_button(
false,
'',
[
'icon' => 'cog',
'mode' => 'link',
'value' => 'modsize',
'class' => 'buttonButton mini',
],
true
);
@ -287,7 +285,7 @@ $table->data[4][] = html_print_label_input_block(
__('Layout size'),
html_print_div(
[
'class' => 'flex flex-items-center',
'class' => 'flex flex-space-around w600px',
'content' => implode('', $layoutSizeElements),
],
true

View File

@ -34,7 +34,7 @@ require_once $config['homedir'].'/include/functions_graph.php';
check_login();
if (! check_acl($config['id_user'], 0, 'PM')) {
if (! check_acl($config['id_user'], 0, 'PM') && ((bool) check_acl($config['id_user'], 0, 'AW') === true && $_GET['server_remote'] === null)) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Server Management'
@ -286,9 +286,10 @@ if (isset($_GET['server']) === true) {
$id_server
);
$buttons = '';
$buttons = [];
// Buttons.
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$buttons = [
'standard_editor' => [
'active' => false,
@ -299,6 +300,7 @@ if (isset($_GET['server']) === true) {
'text' => '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$id_server.'&ext='.$ext.'&tab=advanced_editor&pure='.$pure.'">'.html_print_image('images/pen.png', true, ['title' => __('Advanced editor')]).'</a>',
],
];
}
if ($server_type === SERVER_TYPE_ENTERPRISE_SATELLITE) {
$buttons['agent_editor'] = [

View File

@ -28,7 +28,9 @@
// Begin.
require_once 'include/functions_clippy.php';
require_once 'pending_alerts_list.php';
if ((bool) check_acl($config['id_user'], 0, 'LM') === true) {
include 'pending_alerts_list.php';
}
global $config;

View File

@ -121,6 +121,7 @@ if ($upload_file === true) {
MIME_TYPES['jpg'],
MIME_TYPES['png'],
MIME_TYPES['gif'],
MIME_TYPES['svg'],
]
);
}

View File

@ -219,7 +219,9 @@ echo '<div id="aux" class="invisible"></div>';
$('#aux').text('<?php echo __('Not deleted. Error deleting data'); ?>');
} else {
$('#aux').dialog('close');
location.reload();
let url = new URL(window.location.href);
url.searchParams.set('message', r.url_message)
window.location.href = url.href;
}
},
error: function(e) {

View File

@ -196,14 +196,20 @@ if (is_ajax() === true) {
$row['name'] = __('Admin LDAP password');
$row['control'] = html_print_input_password(
'ldap_admin_pass',
io_output_password($config['ldap_admin_pass']),
(empty(io_output_password($config['ldap_admin_pass'])) === false) ? '*****' : '',
$alt = '',
60,
100,
true,
false,
false,
'w400px-important'
'w400px-important',
'on',
false,
'',
true,
false,
true
);
$table->data['ldap_admin_pass'] = $row;
@ -356,14 +362,20 @@ if (is_ajax() === true) {
$row['name'] = __('Admin secondary LDAP password');
$row['control'] = html_print_input_password(
'ldap_admin_pass_secondary',
io_output_password($config['ldap_admin_pass_secondary']),
(empty(io_output_password($config['ldap_admin_pass_secondary'])) === false) ? '*****' : '',
$alt = '',
60,
100,
true,
false,
false,
'w400px-important'
'w400px-important',
'on',
false,
'',
true,
false,
true
);
$table->data['ldap_admin_pass_secondary'] = $row;
break;

View File

@ -267,18 +267,6 @@ $table->data[$i][] = html_print_label_input_block(
);
$table->data[$i++][] = html_print_label_input_block(
__('Auto login (hash) password'),
html_print_input_password(
'loginhash_pwd',
io_output_password($config['loginhash_pwd']),
'',
15,
15,
true
)
);
$table->data[$i][] = html_print_label_input_block(
__('Time source'),
html_print_select(
$sources,

View File

@ -328,23 +328,6 @@ if (check_login()) {
if (isset($array_nodes) && is_array($array_nodes)) {
$hash_array_nodes = [];
foreach ($array_nodes as $key => $server) {
$pwd = $server['auth_token'];
$auth_serialized = json_decode($pwd, true);
if (is_array($auth_serialized)) {
$pwd = $auth_serialized['auth_token'];
$api_password = $auth_serialized['api_password'];
$console_user = $auth_serialized['console_user'];
$console_password = $auth_serialized['console_password'];
}
$user = $config['id_user'];
$user_rot13 = str_rot13($config['id_user']);
$hashdata = $user.$pwd;
$hashdata = md5($hashdata);
$url_hash = '&amp;loginhash=auto&amp;loginhash_data='.$hashdata.'&amp;loginhash_user='.$user_rot13;
$hash_array_nodes[$server['id']]['hashurl'] = $url_hash;
$hash_array_nodes[$server['id']]['server_url'] = $server['server_url'];
}
}
@ -355,7 +338,7 @@ if (check_login()) {
$image_status = agents_get_image_status($values['status']);
// Link nodes.
if (is_metaconsole() === true) {
$agent_link = '<a href="'.$hash_array_nodes[$values['id_tmetaconsole_setup']]['server_url'].'/index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$values['id_tagente'].$hash_array_nodes[$values['id_tmetaconsole_setup']]['hashurl'].'">';
$agent_link = '<a href="#" onclick="redirectNode(\''.$hash_array_nodes[$values['id_tmetaconsole_setup']]['server_url'].'/index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$values['id_tagente'].'\')">';
$agent_alias = ui_print_truncate_text(
$values['alias'],
'agent_small',

View File

@ -2541,7 +2541,7 @@ if ($drawConsoleSound === true) {
true,
[
'title' => __('No alerts discovered'),
'class' => 'invert_filter',
'class' => '',
]
);
$output .= '<span class="text-discovered-alerts">';

View File

@ -55,6 +55,7 @@ if (check_login()) {
$get_id_tag = (bool) get_parameter('get_id_tag', 0);
$get_type = (bool) get_parameter('get_type', 0);
$list_modules = (bool) get_parameter('list_modules', 0);
$list_snmp_modules = (bool) get_parameter('list_snmp_modules', 0);
$get_agent_modules_json_by_name = (bool) get_parameter(
'get_agent_modules_json_by_name',
0
@ -1538,6 +1539,133 @@ if (check_login()) {
unset($table_data);
}
if ($list_snmp_modules) {
include_once $config['homedir'].'/include/functions_graph.php';
$agent = get_parameter('agent');
$id_agente = $agent;
$paginate_module = false;
if (isset($config['paginate_module']) === true) {
$paginate_module = (bool) $config['paginate_module'];
}
$network_interfaces_by_agents = agents_get_network_interfaces([$agent], false, $paginate_module, get_parameter('offset', 0));
$count_network_incerfaces = agents_get_network_interfaces([$agent], false, false, 0, true);
$network_interfaces = [];
if (empty($network_interfaces_by_agents) === false && empty($network_interfaces_by_agents[$id_agente]) === false) {
$network_interfaces = $network_interfaces_by_agents[$id_agente]['interfaces'];
}
if (empty($network_interfaces) === false) {
$table_interface = new stdClass();
$table_interface->id = 'agent_interface_info';
$table_interface->class = 'info_table';
$table_interface->width = '100%';
$table_interface->style = [];
$table_interface->style['interface_event_graph'] = 'width: 35%;';
$table_interface->head = [];
$options = [
'class' => 'closed',
'style' => 'cursor:pointer;',
];
$table_interface->data = [];
$event_text_cont = 0;
foreach ($network_interfaces as $interface_name => $interface) {
if (empty($interface['traffic']) === false) {
$permission = check_acl_one_of_groups($config['id_user'], $all_groups, 'RR');
if ($permission) {
$params = [
'interface_name' => $interface_name,
'agent_id' => $id_agente,
'traffic_module_in' => $interface['traffic']['in'],
'traffic_module_out' => $interface['traffic']['out'],
];
$params_json = json_encode($params);
$params_encoded = base64_encode($params_json);
$win_handle = dechex(crc32($interface['status_module_id'].$interface_name));
$graph_link = "<a href=\"javascript:winopeng_var('operation/agentes/interface_traffic_graph_win.php?params=";
$graph_link .= $params_encoded."','";
$graph_link .= $win_handle."', 800, 480)\">";
$graph_link .= html_print_image(
'images/chart.png',
true,
[
'title' => __('Interface traffic'),
'class' => 'invert_filter',
]
).'</a>';
} else {
$graph_link = '';
}
} else {
$graph_link = '';
}
$content = [
'id_agent_module' => $interface['status_module_id'],
'id_group' => $id_group,
'period' => SECONDS_1DAY,
'time_from' => '00:00:00',
'time_to' => '00:00:00',
'sizeForTicks' => 250,
'height_graph' => 40,
[
['id_agent_module' => $interface['status_module_id']],
]
];
$e_graph = \reporting_module_histogram_graph(
['datetime' => time()],
$content
);
$sqlLast_contact = sprintf(
'
SELECT timestamp
FROM tagente_estado
WHERE id_agente_modulo = '.$interface['status_module_id']
);
$last_contact = db_get_all_rows_sql($sqlLast_contact);
$last_contact = array_shift($last_contact);
$last_contact = array_shift($last_contact);
$data = [];
$data['interface_name'] = '<strong>'.$interface_name.'</strong>';
$data['interface_status'] = $interface['status_image'];
$data['interface_graph'] = $graph_link;
$data['interface_ip'] = $interface['ip'];
$data['interface_mac'] = $interface['mac'];
$data['last_contact'] = __('Last contact: ').$last_contact;
$data['interface_event_graph'] = $e_graph['chart'];
$table_interface->data[] = $data;
}
if ($paginate_module === true) {
ui_pagination(
$count_network_incerfaces,
false,
0,
0,
false,
'offset',
true,
'',
'change_page_snmp(offset_param)',
[
'count' => '',
'offset' => 'offset_param',
]
);
}
html_print_table($table_interface);
}
}
if ($get_type === true) {
$id_module = (int) get_parameter('id_module');
$module = modules_get_agentmodule($id_module);

View File

@ -60,7 +60,12 @@ if ($method === 'deleteOS') {
) {
echo json_encode(['deleted' => false]);
} else {
echo json_encode(['deleted' => true]);
echo json_encode(
[
'deleted' => true,
'url_message' => 6,
]
);
}
}

View File

@ -37,7 +37,6 @@ $add_sla = get_parameter('add_sla', 0);
$add_general = get_parameter('add_general', 0);
$id = get_parameter('id', 0);
$truncate_text = get_parameter('truncate_text', 0);
$get_metaconsole_hash_data = get_parameter('get_metaconsole_hash_data', 0);
$get_metaconsole_server_url = get_parameter('get_metaconsole_server_url', 0);
$change_custom_fields_macros_report = (bool) get_parameter(
'change_custom_fields_macros_report',
@ -186,37 +185,6 @@ if ($truncate_text) {
return ui_print_truncate_text($text, GENERIC_SIZE_TEXT, true, false);
}
if ($get_metaconsole_hash_data) {
$server_name = get_parameter('server_name');
enterprise_include_once('include/functions_metaconsole.php');
$server = enterprise_hook('metaconsole_get_connection', [$server_name]);
// Bad data
if (empty($server)) {
echo '';
return;
}
// Deserialization of auth_token
$auth_serialized = json_decode($server['auth_token'], true);
$auth_token = '';
if (is_array($auth_serialized)) {
$auth_token = $auth_serialized['auth_token'];
$api_password = $auth_serialized['api_password'];
$console_user = $auth_serialized['console_user'];
$console_password = $auth_serialized['console_password'];
}
$url_hash = metaconsole_get_servers_url_hash($server);
echo $url_hash;
return;
}
if ($get_metaconsole_server_url) {
$server_name = get_parameter('server_name');

View File

@ -26,11 +26,14 @@
* ============================================================================
*/
global $config;
require_once $config['homedir'].'/include/class/JWTRepository.class.php';
$list_user_tokens = (bool) get_parameter('list_user_tokens');
$get_jwt_for_login = (bool) get_parameter('get_jwt_for_login', false);
// Tokens for api 2.0.
if ($list_user_tokens === true) {
global $config;
// Datatables offset, limit and order.
$filter = get_parameter('filter', []);
$page = (int) get_parameter('start', 0);
@ -162,3 +165,20 @@ if ($list_user_tokens === true) {
return;
}
// Token for JWT auth in metaconsole.
if ($get_jwt_for_login === true) {
if (is_metaconsole() === true
&& ((bool) users_is_admin($config['id_user']) === true || (bool) can_user_access_node() === true)
&& empty($config['JWT_signature']) === false
) {
$jwtRepository = new JWTRepository($config['JWT_signature']);
$token = $jwtRepository->create();
echo json_encode(['success' => true, 'data' => $token]);
} else {
echo json_encode(['success' => false, 'error' => 'User does not have permission or is not a metaconsole.']);
}
return;
}

View File

@ -234,18 +234,18 @@ class ExtensionsDiscovery extends Wizard
url_str = `<a target="_blank" class="link-important" href="${url}">'.__('here').'</a>`;
}
var markup = "<ul class=\'\'>";
var markup = "<ul class=\'\' style=\'padding: 15px 0px 0px 25px;\'>";
if (msgs_json.includes('.NOT_FOUND_MSG.')) {
markup += "<li>&nbsp;&nbsp;&nbsp;'.__('The required files for the application were not found.').'</li>";
markup += \'<li class="lato font_10pt bolder">&nbsp;&nbsp;&nbsp;'.__('The required files for the application were not found.').'</li>\';
}
if (msgs_json.includes('.ENTERPRISE_MSG.')) {
markup += "<li>&nbsp;&nbsp;&nbsp;'.__('This discovery application is for Enterprise customers only.').'</li>";
markup += \'<li class="lato font_10pt bolder">&nbsp;&nbsp;&nbsp;'.__('This discovery application is for Enterprise customers only.').'</li>\';
}
if (msgs_json.includes('.URL_MSG.')) {
markup += \'<li>&nbsp;&nbsp;&nbsp;'.__('You can download this application from').' \'+url_str+\'.</li>\';
markup += \'<li class="lato font_10pt bolder">&nbsp;&nbsp;&nbsp;'.__('You can download this application from').' \'+url_str+\'.</li>\';
}
markup += "</ul>";

View File

@ -0,0 +1,225 @@
<?php
/**
* Class to JWT.
*
* @category Class
* @package Pandora FMS
* @subpackage Token
* @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.
* ============================================================================
*/
// Begin.
use Lcobucci\JWT\Configuration;
use Lcobucci\JWT\Encoding\JoseEncoder;
use Lcobucci\JWT\Signer\Hmac\Sha256;
use Lcobucci\JWT\Signer\Key\InMemory;
use Lcobucci\JWT\Token\Parser;
use Lcobucci\JWT\Validation\Constraint\SignedWith;
use Lcobucci\Clock\SystemClock;
use Lcobucci\JWT\Validation\Constraint\StrictValidAt;
enterprise_include_once('include/functions_metaconsole.php');
/**
* JWT Repository.
*/
final class JWTRepository
{
/**
* Allowed methods to be called using AJAX request.
*
* @var array
*/
public $AJAXMethods = ['create'];
/**
* Signature
*
* @var string
*/
private $signature;
/**
* Token
*
* @var Token
*/
private $token;
/**
* Constructor
*
* @param string $_signature Signature of JWT.
*/
public function __construct(string $_signature)
{
$this->signature = $_signature;
}
/**
* Checks if target method is available to be called using AJAX.
*
* @param string $method Target method.
*
* @return boolean True allowed, false not.
*/
public function ajaxMethod($method)
{
// Check access.
check_login();
return in_array($method, $this->AJAXMethods);
}
/**
* Create token
*
* @return string
*/
public function create(): string
{
global $config;
try {
$sha = new Sha256();
$configJWT = Configuration::forSymmetricSigner(
$sha,
InMemory::plainText($this->signature)
);
$now = new DateTimeImmutable();
$token = $configJWT->builder()->issuedAt($now)->canOnlyBeUsedAfter($now)->expiresAt($now->modify('+1 minute'))->withClaim('id_user', $config['id_user'])->getToken($configJWT->signer(), $configJWT->signingKey());
return $token->toString();
} catch (Exception $e) {
return '';
}
}
/**
* Validate a JWT, USE FIRST setToken().
*
* @return boolean
*/
public function validate():bool
{
try {
$sha = new Sha256();
$configJWT = Configuration::forSymmetricSigner(
$sha,
InMemory::plainText($this->signature)
);
$signed = new SignedWith($sha, InMemory::plainText($this->signature));
$now = new DateTimeZone('UTC');
$strictValid = new StrictValidAt(SystemClock::fromUTC());
$constraints = [
$signed,
$strictValid,
];
return $configJWT->validator()->validate($this->token, ...$constraints);
} catch (Exception $e) {
return false;
}
}
/**
* Get payload of token.
*
* @return object
*/
public function payload():object
{
return $this->token->claims();
}
/**
* Setting token.
*
* @param string $tokenString String token to setting.
*
* @return boolean
*/
public function setToken(string $tokenString):bool
{
try {
$encoder = new JoseEncoder();
$parser = new Parser($encoder);
$this->token = $parser->parse($tokenString);
return true;
} catch (Exception $e) {
return false;
}
}
/**
* Generate random signature.
*
* @return string
*/
public static function generateSignature(): string
{
return bin2hex(random_bytes(32));
}
/**
* Sync the signature with nodes for jwt.
*
* @param string|null $signature Signature to send nodes.
*
* @return void
*/
public static function syncSignatureWithNodes(?string $signature):void
{
if (function_exists('metaconsole_get_servers') === true
&& function_exists('metaconsole_push_conf_to_node') === true
) {
$sync_server = 0;
$servers = metaconsole_get_servers();
foreach ($servers as $server) {
$ok_sync = metaconsole_push_conf_to_node(
$server,
[ 'JWT_signature' => $signature],
true
);
if ($ok_sync === true) {
$sync_server++;
}
}
if (is_array($servers) === true
&& count($servers) === $sync_server
&& count($servers) > 0
) {
config_update_value('JWT_signature', $signature, true);
}
}
}
}

View File

@ -553,7 +553,6 @@ class SatelliteCollection extends HTML
},
datatype: "json",
success: function(data) {
console.log(data);
showMsg(data);
},
error: function(e) {
@ -596,7 +595,6 @@ class SatelliteCollection extends HTML
},
datatype: "json",
success: function(data) {
console.log(data);
showMsg(data);
},
error: function(e) {
@ -615,7 +613,7 @@ class SatelliteCollection extends HTML
function showMsg(data) {
var title = "<?php echo __('Success'); ?>";
var dt_satellite_agents = $("#satellite_collections").DataTable();
dt_<?php echo $this->tableId; ?>.draw(false);
dt_satellite_agents.draw(false);
var text = '';
var failed = 0;

View File

@ -521,7 +521,7 @@ class SnmpConsole extends HTML
$legend .= '<div style=" display : flex;align-items : center;">';
$legend .= html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon invert_filter']).' - '.__('Delete');
$legend .= '</div>';
$legend .= '</div></div></td>';
$legend .= '</div></div></td></table>';
echo '<br>';
@ -554,6 +554,10 @@ class SnmpConsole extends HTML
$filters = get_parameter('filter', []);
// Build ranges.
if (empty($filters['filter_hours_ago']) === true) {
$filters['filter_hours_ago'] = 8;
}
$now_timestamp = time();
$interval_seconds = ($filters['filter_hours_ago'] * 3600);
$ago_timestamp = ($now_timestamp - $interval_seconds);
@ -637,42 +641,25 @@ class SnmpConsole extends HTML
$whereSubquery .= ' AND alerted = '.$filters['filter_alert'];
}
$filters['filter_severity'] = (int) $filters['filter_severity'];
if ($filters['filter_severity'] != -1) {
// There are two special severity values aimed to match two different trap standard severities
// in database: warning/critical and critical/normal.
if ($filters['filter_severity'] != EVENT_CRIT_OR_NORMAL
&& $filters['filter_severity'] != EVENT_CRIT_WARNING_OR_CRITICAL
if ($filters['filter_severity'] !== EVENT_CRIT_OR_NORMAL
&& $filters['filter_severity'] !== EVENT_CRIT_WARNING_OR_CRITICAL
&& $filters['filter_severity'] !== EVENT_CRIT_NOT_NORMAL
) {
// Test if enterprise is installed to search oid in text or oid field in ttrap.
if ($config['enterprise_installed']) {
$whereSubquery .= ' AND (
(alerted = 0 AND severity = '.$filters['filter_severity'].') OR
(alerted = 1 AND priority = '.$filters['filter_severity'].'))';
} else {
$whereSubquery .= ' AND (
(alerted = 0 AND 1 = '.$filters['filter_severity'].') OR
(alerted = 1 AND priority = '.$filters['filter_severity'].'))';
}
$whereSubquery .= ' AND severity = '.$filters['filter_severity'];
} else if ($filters['filter_severity'] === EVENT_CRIT_WARNING_OR_CRITICAL) {
// Test if enterprise is installed to search oid in text or oid field in ttrap.
if ($config['enterprise_installed']) {
$whereSubquery .= ' AND (
(alerted = 0 AND (severity = '.EVENT_CRIT_WARNING.' OR severity = '.EVENT_CRIT_CRITICAL.')) OR
(alerted = 1 AND (priority = '.EVENT_CRIT_WARNING.' OR priority = '.EVENT_CRIT_CRITICAL.')))';
} else {
$whereSubquery .= ' AND (
(alerted = 1 AND (priority = '.EVENT_CRIT_WARNING.' OR priority = '.EVENT_CRIT_CRITICAL.')))';
}
$whereSubquery .= ' AND (severity = '.EVENT_CRIT_WARNING.' OR severity = '.EVENT_CRIT_CRITICAL.' OR severity = '.EVENT_CRIT_WARNING_OR_CRITICAL.')';
} else if ($filters['filter_severity'] === EVENT_CRIT_OR_NORMAL) {
// Test if enterprise is installed to search oid in text or oid field in ttrap.
if ($config['enterprise_installed']) {
$whereSubquery .= ' AND (
(alerted = 0 AND (severity = '.EVENT_CRIT_NORMAL.' OR severity = '.EVENT_CRIT_CRITICAL.')) OR
(alerted = 1 AND (priority = '.EVENT_CRIT_NORMAL.' OR priority = '.EVENT_CRIT_CRITICAL.')))';
} else {
$whereSubquery .= ' AND (
(alerted = 1 AND (priority = '.EVENT_CRIT_NORMAL.' OR priority = '.EVENT_CRIT_CRITICAL.')))';
}
$whereSubquery .= ' AND (severity = '.EVENT_CRIT_NORMAL.' OR severity = '.EVENT_CRIT_CRITICAL.' OR severity = '.EVENT_CRIT_OR_NORMAL.')';
} else if ($filters['filter_severity'] === EVENT_CRIT_NOT_NORMAL) {
// Test if enterprise is installed to search oid in text or oid field in ttrap.
$whereSubquery .= ' AND (severity = '.EVENT_CRIT_WARNING.' OR severity = '.EVENT_CRIT_CRITICAL.' OR severity = '.EVENT_CRIT_NOT_NORMAL.')';
}
}
@ -791,11 +778,11 @@ class SnmpConsole extends HTML
// SNMP Agent.
$agent = agents_get_agent_with_ip($tmp->source);
if ($agent === false) {
$tmp->snmp_agent .= '<a class="'.$severity_class.' href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&new_agent=1&direccion='.$tmp->source.'" title="'.__('Create agent').'">'.$tmp->source.'</a>';
$tmp->snmp_agent .= '<a class="'.$severity_class.'" href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&new_agent=1&direccion='.$tmp->source.'" title="'.__('Create agent').'">'.$tmp->source.'</a>';
} else {
$tmp->snmp_agent .= '<div class="'.$severity_class.' snmp-div"><a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'" title="'.__('View agent details').'">';
$tmp->snmp_agent .= '<strong>'.$agent['alias'].ui_print_help_tip($tmp->source, true);
'</strong></a></div>';
$tmp->snmp_agent .= '<strong>'.$agent['alias'].'</strong></a>'.ui_print_help_tip($tmp->source, true);
'</div>';
}
// Enterprise string.
@ -1142,42 +1129,25 @@ class SnmpConsole extends HTML
$whereSubquery .= ' AND alerted = '.$$alert;
}
if ($severity != -1) {
$severity = (int) $severity;
if ($severity !== -1) {
// There are two special severity values aimed to match two different trap standard severities
// in database: warning/critical and critical/normal.
if ($severity != EVENT_CRIT_OR_NORMAL
&& $severity != EVENT_CRIT_WARNING_OR_CRITICAL
if ($severity !== EVENT_CRIT_OR_NORMAL
&& $severity !== EVENT_CRIT_WARNING_OR_CRITICAL
&& $severity !== EVENT_CRIT_NOT_NORMAL
) {
// Test if enterprise is installed to search oid in text or oid field in ttrap.
if ($config['enterprise_installed']) {
$whereSubquery .= ' AND (
(alerted = 0 AND severity = '.$severity.') OR
(alerted = 1 AND priority = '.$severity.'))';
} else {
$whereSubquery .= ' AND (
(alerted = 0 AND 1 = '.$severity.') OR
(alerted = 1 AND priority = '.$severity.'))';
}
$whereSubquery .= ' AND severity = '.$severity;
} else if ($severity === EVENT_CRIT_WARNING_OR_CRITICAL) {
// Test if enterprise is installed to search oid in text or oid field in ttrap.
if ($config['enterprise_installed']) {
$whereSubquery .= ' AND (
(alerted = 0 AND (severity = '.EVENT_CRIT_WARNING.' OR severity = '.EVENT_CRIT_CRITICAL.')) OR
(alerted = 1 AND (priority = '.EVENT_CRIT_WARNING.' OR priority = '.EVENT_CRIT_CRITICAL.')))';
} else {
$whereSubquery .= ' AND (
(alerted = 1 AND (priority = '.EVENT_CRIT_WARNING.' OR priority = '.EVENT_CRIT_CRITICAL.')))';
}
$whereSubquery .= ' AND (severity = '.EVENT_CRIT_WARNING.' OR severity = '.EVENT_CRIT_CRITICAL.' OR severity = '.EVENT_CRIT_WARNING_OR_CRITICAL.')';
} else if ($severity === EVENT_CRIT_OR_NORMAL) {
// Test if enterprise is installed to search oid in text or oid field in ttrap.
if ($config['enterprise_installed']) {
$whereSubquery .= ' AND (
(alerted = 0 AND (severity = '.EVENT_CRIT_NORMAL.' OR severity = '.EVENT_CRIT_CRITICAL.')) OR
(alerted = 1 AND (priority = '.EVENT_CRIT_NORMAL.' OR priority = '.EVENT_CRIT_CRITICAL.')))';
} else {
$whereSubquery .= ' AND (
(alerted = 1 AND (priority = '.EVENT_CRIT_NORMAL.' OR priority = '.EVENT_CRIT_CRITICAL.')))';
}
$whereSubquery .= ' AND (severity = '.EVENT_CRIT_NORMAL.' OR severity = '.EVENT_CRIT_CRITICAL.' OR severity = '.EVENT_CRIT_OR_NORMAL.')';
} else if ($severity === EVENT_CRIT_NOT_NORMAL) {
// Test if enterprise is installed to search oid in text or oid field in ttrap.
$whereSubquery .= ' AND (severity = '.EVENT_CRIT_WARNING.' OR severity = '.EVENT_CRIT_CRITICAL.' OR severity = '.EVENT_CRIT_NOT_NORMAL.')';
}
}

View File

@ -22,7 +22,7 @@ use DI\ContainerBuilder;
/*
* Pandora build version and version
*/
$build_version = 'PC240422';
$build_version = 'PC240506';
$pandora_version = 'v7.0NG.776';
// Do not overwrite default timezone set if defined.
@ -185,6 +185,7 @@ if (session_status() === PHP_SESSION_NONE) {
config_process_config();
config_prepare_session();
config_prepare_jwt_signature();
if ((bool) $config['console_log_enabled'] === true) {
error_reporting(E_ALL ^ E_NOTICE);

View File

@ -1006,10 +1006,10 @@ function get_parameter($name, $default='')
function get_parameter_date($name, $default='', $date_format='Y/m/d')
{
// TODO: Configure default value.
$date_end = get_parameter('date_end', 0);
$time_end = get_parameter('time_end');
$datetime_end = strtotime($date_end.' '.$time_end);
$date_none = get_parameter($name, $default);
$custom_date = get_parameter('custom_date', 0);
$range = get_parameter($name, SECONDS_1DAY);
@ -1055,6 +1055,9 @@ function get_parameter_date($name, $default='', $date_format='Y/m/d')
$date_init = $first_of_week;
$period = (strtotime($date_end) - strtotime($first_of_week));
}
} else if ($date_none === 'none') {
// Prioritize the report item period based on the current local date/time.
$date_end = date('Y/m/d H:i:s');
} else {
$date_end = date('Y/m/d H:i:s');
$date_init = date('Y/m/d H:i:s', (strtotime($date_end) - $range));

View File

@ -1544,7 +1544,9 @@ function agents_get_modules(
$indexed=true,
$get_not_init_modules=true,
$force_tags=false,
$filter_include_sql=true
$filter_include_sql=true,
$pagination=false,
$offset=0,
) {
global $config;
@ -1717,7 +1719,17 @@ function agents_get_modules(
$sql_tags_join,
$where
);
$result = db_get_all_rows_sql($sql);
$limit = '';
if ($pagination === true && isset($config['paginate_module']) === true) {
if ($offset === 0) {
$limit = ' LIMIT '.$config['block_size'].' OFFSET 0';
} else {
$limit = ' LIMIT '.$config['block_size'].' OFFSET '.$offset;
}
}
$result = db_get_all_rows_sql($sql.$limit);
if (empty($result)) {
return [];
@ -3333,7 +3345,7 @@ function agents_update_gis(
*
* @return array A list of network interfaces information by agents.
*/
function agents_get_network_interfaces($agents=false, $agents_filter=false)
function agents_get_network_interfaces($agents=false, $agents_filter=false, $pagination=false, $offset=0, $count=false)
{
global $config;
@ -3432,8 +3444,17 @@ function agents_get_network_interfaces($agents=false, $agents_filter=false)
$columns,
$filter,
true,
false
false,
false,
true,
$pagination,
$offset
);
if ($count === true) {
return (count($modules) ?? 0);
}
if (!empty($modules)) {
$interfaces = [];
@ -4755,7 +4776,10 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
'force_checks',
false,
'window.location.assign("'.$url.'&amp;flag_agent=1")',
[ 'mode' => 'link' ],
[
'mode' => 'link',
'class' => 'mrgn_lft_20px ',
],
true
);
}
@ -4934,7 +4958,7 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
$module_score = modules_get_agentmodule_id(io_safe_input('Hardening - Score'), $agent['id_agente']);
$hardening = '';
if (is_array($module_score) === true && key_exists('id_agente_modulo', $module_score) == true) {
$raw_data_score = modules_get_raw_data($module_score['id_agente_modulo'], 0, time());
$raw_data_score = modules_get_raw_data($module_score['id_agente_modulo'], 0, time(), false);
$hardening = format_numeric($raw_data_score[0]['datos'], 2);
$data = [];
$data[0] = '<b>'.__('Hardening').'</b>';

View File

@ -13175,11 +13175,13 @@ function api_set_create_event($id, $trash1, $other, $returnType)
$values['id_extra'] = '';
}
if (empty($values['event_custom_id']) === true) {
if ($other['data'][21] != '') {
$values['event_custom_id'] = $other['data'][21];
} else {
$values['event_custom_id'] = '';
}
}
$custom_data = base64_decode($values['custom_data']);
$custom_data = mysql_escape_string_sql($custom_data);

View File

@ -30,6 +30,7 @@
// Config functions.
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/functions.php';
require_once __DIR__.'/class/JWTRepository.class.php';
enterprise_include_once('include/functions_config.php');
use PandoraFMS\Core\DBMaintainer;
@ -207,10 +208,6 @@ function config_update_config()
$error_update[] = __('Chromium config directory');
}
if (config_update_value('loginhash_pwd', (string) get_parameter('loginhash_pwd'), true, true) === false) {
$error_update[] = __('Auto login (hash) password');
}
if (config_update_value('timesource', (string) get_parameter('timesource'), true) === false) {
$error_update[] = __('Time source');
}
@ -706,9 +703,11 @@ function config_update_config()
$error_update[] = __('Admin LDAP login');
}
if ((bool) get_parameter('ldap_admin_pass_password_changed', false) === true) {
if (config_update_value('ldap_admin_pass', get_parameter('ldap_admin_pass'), true, true) === false) {
$error_update[] = __('Admin LDAP password');
}
}
if (config_update_value('ldap_search_timeout', (int) get_parameter('ldap_search_timeout', 5), true) === false) {
$error_update[] = __('Ldap search timeout');
@ -742,8 +741,10 @@ function config_update_config()
$error_update[] = __('Admin secondary LDAP login');
}
if ((bool) get_parameter('ldap_admin_pass_secondary_password_changed', false) === true) {
if (config_update_value('ldap_admin_pass_secondary', get_parameter('ldap_admin_pass_secondary'), true, true) === false) {
$error_update[] = __('Admin secondary LDAP password');
$error_update[] = __('Admin LDAP password secondary');
}
}
if (config_update_value('fallback_local_auth', get_parameter('fallback_local_auth'), true) === false) {
@ -2224,10 +2225,6 @@ function config_process_config()
config_update_value('events_per_query', 5000);
}
if (!isset($config['loginhash_pwd'])) {
config_update_value('loginhash_pwd', (rand(0, 1000) * rand(0, 1000)).'pandorahash', false, true);
}
if (!isset($config['trap2agent'])) {
config_update_value('trap2agent', 0);
}
@ -2491,6 +2488,10 @@ function config_process_config()
config_update_value('number_modules_queue', 500);
}
if (!isset($config['JWT_signature'])) {
config_update_value('JWT_signature', 1);
}
if (!isset($config['eastern_eggs_disabled'])) {
config_update_value('eastern_eggs_disabled', 1);
}
@ -4224,3 +4225,13 @@ function config_prepare_session()
ini_set('post_max_size', $config['max_file_size']);
ini_set('upload_max_filesize', $config['max_file_size']);
}
function config_prepare_jwt_signature()
{
global $config;
if (is_metaconsole() === true && $config['JWT_signature'] == 1) {
$signature = JWTRepository::generateSignature();
JWTRepository::syncSignatureWithNodes($signature);
}
}

View File

@ -1119,11 +1119,13 @@ function events_get_all(
}
}
if (!$user_is_admin && users_can_manage_group_all('ER') === false) {
$ER_groups = users_get_groups($config['id_user'], 'ER', true);
if (!$user_is_admin && users_can_manage_group_all('EM') === false) {
$EM_groups = users_get_groups($config['id_user'], 'EM', true, true);
$EW_groups = users_get_groups($config['id_user'], 'EW', true, true);
}
if (!$user_is_admin && users_can_manage_group_all('ER') === false) {
$ER_groups = users_get_groups($config['id_user'], 'ER', true);
// Get groups where user have ER grants.
if ((bool) $filter['search_secondary_groups'] === true) {
$sql_filters[] = sprintf(
@ -1155,7 +1157,7 @@ function events_get_all(
}
// Free search.
if (empty($filter['search']) === false && (bool) $filter['regex'] === false) {
if (empty($filter['search']) === false) {
if (isset($config['dbconnection']->server_version) === true
&& $config['dbconnection']->server_version > 50600
) {
@ -1185,6 +1187,21 @@ function events_get_all(
$array_search[] = 'lower(ta.alias)';
}
if ((bool) $filter['regex'] === true) {
$sql_search = ' AND (';
foreach ($array_search as $key => $field) {
$sql_search .= sprintf(
'%s %s %s REGEXP "%s" ',
($key === 0) ? '' : $nexo,
$field,
$not_search,
preg_replace('/(?<!\\\\)"/', '', io_safe_output($filter['search'])),
);
$sql_search .= ' ';
}
$sql_search .= ' )';
} else {
// Disregard repeated whitespaces when searching.
$collapsed_spaces_search = preg_replace('/(&#x20;)+/', '&#x20;', $filter['search']);
@ -1201,6 +1218,7 @@ function events_get_all(
}
$sql_search .= ' )';
}
$sql_filters[] = $sql_search;
}
@ -1674,7 +1692,7 @@ function events_get_all(
}
}
if (!$user_is_admin && users_can_manage_group_all('ER') === false) {
if (!$user_is_admin && users_can_manage_group_all('EM') === false) {
$exists_id_grupo = false;
foreach ($fields as $field) {
if (str_contains($field, 'te.id_grupo') === true || str_contains($field, 'te.*') === true) {
@ -1798,7 +1816,7 @@ function events_get_all(
return $sql;
}
if (!$user_is_admin && users_can_manage_group_all('ER') === false) {
if (!$user_is_admin && users_can_manage_group_all('EM') === false) {
$can_manage = '0 as user_can_manage';
if (empty($EM_groups) === false) {
$can_manage = sprintf(
@ -4375,12 +4393,9 @@ function events_page_details($event, $server_id=0)
global $config;
// If metaconsole switch to node to get details and custom fields.
$hashstring = '';
$serverstring = '';
if (is_metaconsole() === true && empty($server_id) === false) {
$server = metaconsole_get_connection_by_id($server_id);
$hashdata = metaconsole_get_server_hashdata($server);
$hashstring = '&amp;loginhash=auto&loginhash_data='.$hashdata.'&loginhash_user='.str_rot13($config['id_user']);
$serverstring = $server['server_url'].'/';
if (metaconsole_connect($server) !== NOERR) {
@ -4421,28 +4436,7 @@ function events_page_details($event, $server_id=0)
true
).ui_print_help_tip(__('This agent belongs to metaconsole, is not possible display it'), true);
} else if (can_user_access_node() && is_metaconsole()) {
// Workaround to pass login hash data in POST body instead of directly in the URL.
parse_str($hashstring, $url_hash_array);
$redirection_form = "<form id='agent-redirection' method='POST' action='".$serverstring.'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$event['id_agente']."'>";
$redirection_form .= html_print_input_hidden(
'loginhash',
$url_hash_array['loginhash'],
true
);
$redirection_form .= html_print_input_hidden(
'loginhash_data',
$url_hash_array['loginhash_data'],
true
);
$redirection_form .= html_print_input_hidden(
'loginhash_user',
$url_hash_array['loginhash_user'],
true
);
$redirection_form .= '</form>';
$data[1] = $redirection_form;
$data[1] .= "<a target=_blank onclick='event.preventDefault(); document.getElementById(\"agent-redirection\").submit();' href='#'>";
$data[1] = '<a target=_blank onclick="redirectNode(\''.$serverstring.'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$event['id_agente'].'\')" href="#">';
$data[1] .= '<b>'.$agent['alias'].'</b>';
$data[1] .= '</a>';
} else if (can_user_access_node()) {
@ -4453,7 +4447,7 @@ function events_page_details($event, $server_id=0)
'',
false,
$serverstring,
$hashstring,
'',
$agent['alias']
);
} else {
@ -4586,7 +4580,7 @@ function events_page_details($event, $server_id=0)
'id_mg',
$id_module_group
);
$data[1] = '<a href="'.$serverstring.'index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;status=-1&amp;modulegroup='.$id_module_group.$hashstring.'">';
$data[1] = '<a href="#" onclick="redirectNode(\''.$serverstring.'index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;status=-1&amp;modulegroup='.$id_module_group.'\')">';
$data[1] .= $module_group;
$data[1] .= '</a>';
}
@ -4652,7 +4646,7 @@ function events_page_details($event, $server_id=0)
if ($event['id_alert_am'] != 0) {
$data = [];
$data[0] = '<div class="normal_weight mrgn_lft_20px">'.__('Source').'</div>';
$data[1] = '<a href="'.$serverstring.'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$event['id_agente'].'&amp;tab=alert'.$hashstring.'">';
$data[1] = '<a href="#" onclick="redirectNode(\''.$serverstring.'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$event['id_agente'].'&amp;tab=alert\')">';
$standby = db_get_value('standby', 'talert_template_modules', 'id', $event['id_alert_am']);
if (!$standby) {
$data[1] .= html_print_image(
@ -5928,17 +5922,30 @@ function events_get_instructions($event, $max_text_length=300)
return $value;
}
$event_name = ui_print_truncate_text(
io_safe_output($event['evento']),
GENERIC_SIZE_TEXT,
false,
true,
false,
'...'
);
$over_event_name = base64_encode($event_name);
$output = '<div id="hidden_event_instructions_'.$event['id_evento'].'"';
$output .= ' class="event_instruction">';
$output .= $value;
$output .= '</div>';
$output .= '<span id="value_event_'.$event['id_evento'].'" class="nowrap">';
$output .= '<span id="value_event_text_'.$event['id_evento'].'"></span>';
$output .= '<a href="javascript:show_instructions('.$event['id_evento'].')">';
$output .= '<a href="javascript:show_instructions('.$event['id_evento'].',\''.$over_event_name.'\')">';
$output .= html_print_image(
'images/default_list.png',
true,
['title' => $over_text]
[
'title' => $over_text,
'class' => 'invert_filter',
]
).'</a></span>';
return $output;

View File

@ -1032,7 +1032,7 @@ function filemanager_file_explorer(
false,
'show_form_create_folder()',
[
'class' => 'margin-right-2 invert_filter secondary',
'class' => 'margin-right-2 primary buttonButton',
'icon' => 'create_directory',
],
true,
@ -1047,7 +1047,7 @@ function filemanager_file_explorer(
false,
'show_create_text_file()',
[
'class' => 'margin-right-2 invert_filter secondary',
'class' => 'margin-right-2 primary buttonButton',
'icon' => 'create_file',
],
true,
@ -1061,7 +1061,7 @@ function filemanager_file_explorer(
false,
'show_upload_file()',
[
'class' => 'margin-right-2 invert_filter secondary',
'class' => 'margin-right-2 primary buttonButton',
'icon' => 'upload_file',
],
true,

View File

@ -134,11 +134,14 @@ function forecast_projection_graph(
// 3.1 Standard deviation for X: sqrt((Sum(Xi²)/Obs) - (avg X)²)
// 3.2 Standard deviation for Y: sqrt((Sum(Yi²)/Obs) - (avg Y)²)
// Linear correlation coefficient:
// Agent interval could be zero, 300 is the predefined
// Agent interval could be zero, 300 is the predefined.
if ($sum_obs == 0) {
$agent_interval = SECONDS_5MINUTES;
} else {
$agent_interval = ($sum_diff_dates / $sum_obs);
if ($agent_interval < 60) {
$agent_interval = SECONDS_1MINUTE;
}
}
// Could be a inverse correlation coefficient
@ -170,7 +173,7 @@ function forecast_projection_graph(
$a = 0;
}
// Data inicialization
// Data inicialization.
$output_data = [];
if ($prediction_period != false) {
$limit_timestamp = ($last_timestamp + $prediction_period);
@ -199,13 +202,14 @@ function forecast_projection_graph(
$time_format = 'M d';
}
// Aplying linear regression to module data in order to do the prediction
try {
// Aplying linear regression to module data in order to do the prediction.
$idx = 0;
// Create data in graph format like
// Create data in graph format like.
while ($in_range) {
$now = time();
// Check that exec time is not greater than half max exec server time
// Check that exec time is not greater than half max exec server time.
if ($max_exec_time != false) {
if (($begin_time + ($max_exec_time / 2)) < $now) {
return false;
@ -222,16 +226,16 @@ function forecast_projection_graph(
$output_data[$idx][1] = ($a + ($b * $current_ts));
}
// Using this function for prediction_date
// Using this function for prediction_date.
if ($prediction_period == false) {
// These statements stop the prediction when interval is greater than 2 years
// These statements stop the prediction when interval is greater than 2 years.
if (($current_ts - $last_timestamp) >= 94608000
|| $max_value == $min_value
) {
return false;
}
// Found it
// Found it.
if (($max_value >= $output_data[$idx][1])
&& ($min_value <= $output_data[$idx][0])
) {
@ -244,6 +248,9 @@ function forecast_projection_graph(
$current_ts = ($current_ts + $agent_interval);
$idx++;
}
} catch (\Exception $e) {
return false;
}
return $output_data;
}

View File

@ -3308,7 +3308,8 @@ function graph_custom_sql_graph(
$only_image=false,
$homeurl='',
$ttl=1,
$max_num_elements=8
$max_num_elements=8,
$layout=false
) {
global $config;

View File

@ -2662,7 +2662,20 @@ function tactical_groups_get_agents_and_monitoring($id_groups, $data='')
$tdata[1] = '<a class="big_data" href="'.$urls['total_agents'].'">'.$tdata[1].'</a>';
if ($data['total_agents'] > 500 && !enterprise_installed()) {
$tdata[2] = "<div id='agentsmodal' class='publienterprise' title='".__('Enterprise version not installed')."'><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
$tdata[2] = "<div id='agentsmodal' class='publienterprise' title='Community version' >";
$tdata[2] .= html_print_image(
'images/alert_enterprise.png',
true,
[
'title' => __('Enterprise version not installed'),
'class' => 'img_help'
],
false,
false,
false,
true
);
$tdata[2] .= '</div>';
}
$tdata[3] = html_print_image('images/module.png', true, ['title' => __('Monitor checks'), 'class' => 'invert_filter'], false, false, false, true);
@ -2676,7 +2689,20 @@ function tactical_groups_get_agents_and_monitoring($id_groups, $data='')
*/
if ($data['total_agents']) {
if (($data['monitor_total'] / $data['total_agents'] > 100) && !enterprise_installed()) {
$tdata[5] = "<div id='monitorcheckmodal' class='publienterprise' title='Community version' ><img data-title='".__('Enterprise version not installed')."' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
$tdata[5] = "<div id='monitorcheckmodal' class='publienterprise' title='Community version' >";
$tdata[5] .= html_print_image(
'images/alert_enterprise.png',
true,
[
'title' => __('Enterprise version not installed'),
'class' => 'img_help'
],
false,
false,
false,
true
);
$tdata[5] .= '</div>';
}
}
@ -2728,7 +2754,20 @@ function tactical_groups_get_stats_alerts($id_groups, $data='')
*/
if ($data['monitor_alerts'] > $data['total_agents'] && !enterprise_installed()) {
$tdata[2] = "<div id='alertagentmodal' class='publienterprise' title='Community version' ><img data-title='".__('Enterprise version not installed')."' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
$tdata[2] = "<div id='alertagentmodal' class='publienterprise' title='Community version' >";
$tdata[2] .= html_print_image(
'images/alert_enterprise.png',
true,
[
'title' => __('Enterprise version not installed'),
'class' => 'img_help'
],
false,
false,
false,
true
);
$tdata[2] .= '</div>';
}
$tdata[3] = html_print_image(

View File

@ -1686,13 +1686,25 @@ function html_print_select_multiple_modules_filtered(array $data):string
);
$output .= '</div>';
$agent_class = '';
if (empty($data['searchBar']) === false && $data['searchBar'] === true) {
$output .= '<div>';
$output .= '<div class="agents-modules-multiple-search-bar">';
if (isset($data['searchBarAgents']) === false) {
$data['searchBarAgents'] = true;
}
if (isset($data['searchBarModules']) === false) {
$data['searchBarModules'] = true;
}
if ($data['searchBarAgents'] === true) {
$output .= '<div>';
$output .= html_print_input(
[
'type' => 'text',
'label_class' => 'font-title-font',
'label' => __('Filter agent'),
'name' => 'agent-searchBar-'.$uniqId,
'onKeyUp' => 'searchAgent(\''.$uniqId.'\')',
'placeholder' => __('Type to search agents'),
@ -1701,11 +1713,18 @@ function html_print_select_multiple_modules_filtered(array $data):string
);
$output .= '</div>';
} else {
$agent_class = 'custom-graph-editor-agents-module-filter';
$output .= '<div></div>';
}
if ($data['searchBarModules'] === true) {
$output .= '<div>';
$output .= html_print_input(
[
'type' => 'text',
'label_class' => 'font-title-font',
'label' => __('Filter module'),
'name' => 'module-searchBar-'.$uniqId,
'onKeyUp' => 'searchModule(\''.$uniqId.'\')',
'return' => true,
@ -1714,6 +1733,9 @@ function html_print_select_multiple_modules_filtered(array $data):string
);
$output .= '</div>';
} else {
$output .= '<div></div>';
}
$output .= '</div>';
}
@ -1770,6 +1792,7 @@ function html_print_select_multiple_modules_filtered(array $data):string
'style' => 'min-width: 200px;max-width:200px;',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
'placeholder' => (isset($data['placeholderAgents']) === true) ? $data['placeholderAgents'] : '',
'input_class' => $agent_class,
]
);
} else {
@ -1786,6 +1809,7 @@ function html_print_select_multiple_modules_filtered(array $data):string
'style' => 'min-width: 200px;max-width:200px;',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
'placeholder' => (isset($data['placeholderAgents']) === true) ? $data['placeholderAgents'] : '',
'input_class' => $agent_class,
]
);
}
@ -1929,7 +1953,7 @@ function html_print_select_multiple_modules_filtered_formated(array $data):strin
'return' => true,
'nothing' => __('All'),
'nothing_value' => 0,
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().', true)',
]
);
$output .= '</div>';
@ -1965,7 +1989,7 @@ function html_print_select_multiple_modules_filtered_formated(array $data):strin
'name' => 'filtered-module-show-common-modules-'.$uniqId,
'id' => 'filtered-module-show-common-modules-'.$uniqId,
'return' => true,
'onchange' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
'onchange' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().', true)',
]
);
@ -2053,7 +2077,7 @@ function html_print_select_multiple_modules_filtered_formated(array $data):strin
'return' => true,
'multiple' => true,
'style' => 'min-width: 200px;max-width:200px;',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().', true)',
'placeholder' => (isset($data['placeholderAgents']) === true) ? $data['placeholderAgents'] : '',
'truncate_size' => 300,
]
@ -2070,7 +2094,7 @@ function html_print_select_multiple_modules_filtered_formated(array $data):strin
'return' => true,
'multiple' => true,
'style' => 'min-width: 200px;max-width:200px;',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().', true)',
'placeholder' => (isset($data['placeholderAgents']) === true) ? $data['placeholderAgents'] : '',
'truncate_size' => 300,
]
@ -2505,7 +2529,8 @@ function html_print_extended_select_for_time(
$no_change=false,
$allow_zero=0,
$units=null,
$script_input=''
$script_input='',
$units_select2=false
) {
global $config;
$admin = is_user_admin($config['id_user']);
@ -2595,7 +2620,19 @@ function html_print_extended_select_for_time(
echo '</div>';
echo '<div id="'.$uniq_name.'_manual" class="inline_flex">';
html_print_input_text($uniq_name.'_text', $selected, '', $size, 255, false, $readonly, false, '', $class, $script_input);
html_print_input_text(
$uniq_name.'_text',
$selected,
'',
$size,
255,
false,
$readonly,
false,
'',
$class.(($units_select2 === true) ? ' w100p' : ''),
$script_input
);
html_print_input_hidden($name, $selected, false, $uniq_name);
html_print_select(
@ -2619,7 +2656,7 @@ function html_print_extended_select_for_time(
false,
false,
false,
false
$units_select2
);
echo '&nbsp&nbsp<a href="javascript:">'.html_print_image(
'images/logs@svg.svg',
@ -2632,6 +2669,7 @@ function html_print_extended_select_for_time(
]
).'</a>';
echo '</div>';
echo "<script type='text/javascript'>
$(document).ready (function () {
period_select_init('".$uniq_name."', ".(($allow_zero) ? 1 : 0).");
@ -2652,6 +2690,18 @@ function html_print_extended_select_for_time(
}, 100);
}
</script>";
if ($units_select2 === true) {
echo '
<script>
$(document).ready (function () {
$("#'.$uniq_name.'_units").select2();
$("#'.$uniq_name.'_units").data("select2").$container.addClass("mrgn_lft_10px_imp");
});
</script>
';
}
$returnString = ob_get_clean();
if ($return) {
@ -3447,6 +3497,12 @@ function html_print_anchor(
* @param integer $maxlength Maximum length allowed (optional).
* @param boolean $return Whether to return an output string or echo now (optional, echo by default).
* @param boolean $disabled Disable the button (optional, button enabled by default).
* @param boolean $required Whether the input is required (optional, not required by default).
* @param string $class Additional CSS classes for the input (optional).
* @param string $autocomplete Autocomplete attribute value (optional, off by default).
* @param boolean $hide_div_eye Whether to hide the div with the eye icon (optional, false by default).
* @param string $div_class Additional CSS classes for the div (optional).
* @param boolean $not_show_value Whether to not show the value in the input (optional, false by default), FOR USE THIS VALUE YOU NEED CONTROL THE INPUT 'password_changed'.
*
* @return string HTML code if return parameter is true.
*/
@ -3462,7 +3518,8 @@ function html_print_input_password(
$class='',
$autocomplete='off',
$hide_div_eye=false,
$div_class=''
$div_class='',
$not_show_value=false,
) {
if ($maxlength == 0) {
$maxlength = 255;
@ -3493,7 +3550,40 @@ function html_print_input_password(
}
}
return '<div class="relative container-div-input-password '.$div_class.'">'.html_print_input_text_extended($name, $value, 'password-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, true, '', $autocomplete, false, $hide_div_eye).'</div>';
$extra_output = '';
if ($not_show_value === true) {
$unique_id = 'flag_password_'.uniqid();
$extra_output = html_print_input_hidden($name.'_password_changed', 0, true, false, false, $unique_id);
$attr['class'] .= ' bg-image-none';
$extra_output .= '<script>
$("#show-hide-password-'.$name.'").hide();
const exist_'.$unique_id.' = '.((empty($value) === false) ? 'true' : 'false').';
$("#password-'.$name.'").on("focus", function(e) {
if ($("#'.$unique_id.'").val() === "0") {
$(this).val("");
}
});
$("#password-'.$name.'").on("focusout", function(e) {
if ($("#'.$unique_id.'").val() === "0" && $(this).val() === "" && exist_'.$unique_id.' === true) {
$(this).val("*****");
}
});
$("#password-'.$name.'").on("keyup", function(e) {
$("#'.$unique_id.'").val(1);
if ($(this).val() === "") {
$(this).addClass("bg-image-none");
$("#show-hide-password-'.$name.'").hide();
} else {
$(this).removeClass("bg-image-none");
$("#show-hide-password-'.$name.'").show();
}
});
</script>';
}
return '<div class="relative container-div-input-password '.$div_class.'">'.html_print_input_text_extended($name, $value, 'password-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, true, '', $autocomplete, false, $hide_div_eye).'</div>'.$extra_output;
}
@ -3535,7 +3625,8 @@ function html_print_input_text(
$disabled=false,
$list='',
$placeholder=null,
$pattern=null
$pattern=null,
$id=false
) {
if ($maxlength == 0) {
$maxlength = 255;
@ -3593,7 +3684,7 @@ function html_print_input_text(
return html_print_input_text_extended(
$name,
$value,
'text-'.$name,
(($id === false) ? 'text-'.$name : $id),
$alt,
$size,
$maxlength,
@ -6334,7 +6425,8 @@ function html_print_input($data, $wrapper='div', $input_only=false)
((isset($data['no_change']) === true) ? $data['no_change'] : ''),
((isset($data['allow_zero']) === true) ? $data['allow_zero'] : ''),
((isset($data['units']) === true) ? $data['units'] : null),
((isset($data['script_input']) === true) ? $data['script_input'] : '')
((isset($data['script_input']) === true) ? $data['script_input'] : ''),
((isset($data['units_select2']) === true) ? $data['units_select2'] : '')
);
break;
@ -6861,6 +6953,11 @@ function html_print_input($data, $wrapper='div', $input_only=false)
(isset($data['time_end']) === true) ? $data['time_end'] : '',
(isset($data['date_text']) === true) ? $data['date_text'] : SECONDS_1DAY,
(isset($data['class']) === true) ? $data['class'] : 'w100p',
(isset($data['date_format_php']) === true) ? $data['date_format_php'] : 'Y/m/d',
(isset($data['time_format_php']) === true) ? $data['time_format_php'] : 'H:i:s',
(isset($data['date_format_js']) === true) ? $data['date_format_js'] : 'yy/mm/dd',
(isset($data['time_format_js']) === true) ? $data['time_format_js'] : 'HH/mm/ss',
(isset($data['id']) === true) ? $data['id'] : '',
);
break;
@ -7843,7 +7940,8 @@ function html_print_select_date_range(
$date_format_php='Y/m/d',
$time_format_php='H:i:s',
$date_format_js='yy/mm/dd',
$time_format_js='HH:mm:ss'
$time_format_js='HH:mm:ss',
$id='',
) {
global $config;
@ -7894,7 +7992,7 @@ function html_print_select_date_range(
$fields['chose_range'] = __('Chose start/end date period');
$fields['none'] = __('None');
$output = html_print_input_hidden('custom_date', $custom_date, true);
$output = html_print_input_hidden('custom_date', $custom_date, true, false, false, 'hidden-custom_date'.$id);
$output .= '<div id="'.$name.'_default" class="wauto inline_flex" '.$display_default.'>';
$output .= html_print_select(
$fields,
@ -7914,13 +8012,101 @@ function html_print_select_date_range(
$table->data = [];
$table->class = 'table-adv-filter';
$table->data[0][0] = '<div><div><div><span class="font-title-font">'.__('From').':</span></div>';
$table->data[0][0] .= html_print_input_text('date_init', $date_init, '', 12, 10, true).' ';
$table->data[0][0] .= html_print_input_text('time_init', $time_init, '', 10, 7, true).' ';
$table->data[0][0] .= html_print_input_text(
'date_init',
$date_init,
'',
12,
10,
true,
false,
false,
'',
'',
'',
'off',
false,
'',
'',
'',
false,
'',
null,
null,
(empty($id) === false) ? 'text-date_init'.$id : false,
).' ';
$table->data[0][0] .= html_print_input_text(
'time_init',
$time_init,
'',
10,
7,
true,
false,
false,
'',
'',
'',
'off',
false,
'',
'',
'',
false,
'',
null,
null,
(empty($id) === false) ? 'text-time_init'.$id : false,
).' ';
$table->data[0][0] .= '</div>';
$table->data[0][0] .= '<div><div><span class="font-title-font">'.__('to').':</span></div>';
$table->data[0][0] .= html_print_input_text('date_end', $date_end, '', 12, 10, true).' ';
$table->data[0][0] .= html_print_input_text(
'date_end',
$date_end,
'',
12,
10,
true,
false,
false,
'',
'',
'',
'off',
false,
'',
'',
'',
false,
'',
null,
null,
(empty($id) === false) ? 'text-date_end'.$id : false,
).' ';
$table->data[0][0] .= '<div id="'.$name.'_manual" class="w100p inline_line">';
$table->data[0][0] .= html_print_input_text('time_end', $time_end, '', 10, 7, true).' ';
$table->data[0][0] .= html_print_input_text(
'time_end',
$time_end,
'',
10,
7,
true,
false,
false,
'',
'',
'',
'off',
false,
'',
'',
'',
false,
'',
null,
null,
(empty($id) === false) ? 'text-time_end'.$id : false,
).' ';
$table->data[0][0] .= ' <a href="javascript:">'.html_print_image(
'images/logs@svg.svg',
true,
@ -7991,13 +8177,13 @@ function html_print_select_date_range(
$('#".$name."_range').show();
$('#".$name."_default').hide();
$('#".$name."_extend').hide();
$('#hidden-custom_date').val('1');
$('#hidden-custom_date".$id."').val('1');
$('.filter_label_position_before').addClass('filter_label_position_after');
} else if ($(this).val() === 'custom') {
$('#".$name."_range').hide();
$('#".$name."_default').hide();
$('#".$name."_extend').show();
$('#hidden-custom_date').val('2');
$('#hidden-custom_date".$id."').val('2');
$('.filter_label_position_before').removeClass('filter_label_position_after');
} else {
$('.filter_label_position_before').removeClass('filter_label_position_after');
@ -8015,8 +8201,8 @@ function html_print_select_date_range(
$('#".$name."_range').show();
$('#".$name."_default').hide();
$('#".$name."_extend').hide();
position_top_init = $('#text-date_init').offset().top + $('#text-date_init').outerHeight();
position_top_end = $('#text-date_end').offset().top + $('#text-date_end').outerHeight();
position_top_init = $('[id^=text-date_init".$id."]').offset().top + $('[id^=text-date_init".$id."]').outerHeight();
position_top_end = $('[id^=text-date_end".$id."]').offset().top + $('[id^=text-date_end".$id."]').outerHeight();
if(def_state_range){
$('#".$name."_range').show();
} else {
@ -8042,7 +8228,7 @@ function html_print_select_date_range(
$('#".$name."_range').hide();
$('#".$name."_extend').hide();
$('#".$name."').val('".SECONDS_1DAY."').trigger('change');
$('#hidden-custom_date').val('0');
$('#hidden-custom_date".$id."').val('0');
}
$('#text-date').datepicker({
@ -8052,7 +8238,7 @@ function html_print_select_date_range(
showAnim: 'slideDown'
});
$('[id^=text-time_init]').timepicker({
$('[id^=text-time_init".$id."]').timepicker({
showSecond: true,
timeFormat: '".$time_format_js."',
timeOnlyTitle: '".__('Choose time')."',
@ -8064,7 +8250,7 @@ function html_print_select_date_range(
closeText: '".__('Close')."'
});
$('[id^=text-date_init]').datepicker ({
$('[id^=text-date_init".$id."]').datepicker ({
dateFormat: '".$date_format_js."',
changeMonth: true,
changeYear: true,
@ -8073,9 +8259,9 @@ function html_print_select_date_range(
beforeShowDay: function (date) {
show_datepicker = 'date_init';
var date_now = date.getTime();
var date_ini_split = $('[id^=text-date_init]').val().split('/');
var date_ini_split = $('[id^=text-date_init".$id."]').val().split('/');
var date_ini = new Date(date_ini_split[1]+'/'+date_ini_split[2]+'/'+date_ini_split[0]).getTime();
var date_end_split = $('[id^=text-date_end]').val().split('/');
var date_end_split = $('[id^=text-date_end".$id."]').val().split('/');
var date_end = new Date(date_end_split[1]+'/'+date_end_split[2]+'/'+date_end_split[0]).getTime();
if (date_now > date_ini && date_now < date_end) {
return [true, 'ui-date-range-in', 'prueba'];
@ -8086,7 +8272,7 @@ function html_print_select_date_range(
}
});
$('[id^=text-date_end]').datepicker ({
$('[id^=text-date_end".$id."]').datepicker ({
dateFormat: '".$date_format_js."',
changeMonth: true,
changeYear: true,
@ -8095,9 +8281,9 @@ function html_print_select_date_range(
beforeShowDay: function (date) {
show_datepicker = 'date_end';
var date_now = date.getTime();
var date_ini_split = $('[id^=text-date_init]').val().split('/');
var date_ini_split = $('[id^=text-date_init".$id."]').val().split('/');
var date_ini = new Date(date_ini_split[1]+'/'+date_ini_split[2]+'/'+date_ini_split[0]).getTime();
var date_end_split = $('[id^=text-date_end]').val().split('/');
var date_end_split = $('[id^=text-date_end".$id."]').val().split('/');
var date_end = new Date(date_end_split[1]+'/'+date_end_split[2]+'/'+date_end_split[0]).getTime();
if (date_now > date_ini && date_now < date_end) {
return [true, 'ui-date-range-in', 'prueba'];
@ -8105,10 +8291,10 @@ function html_print_select_date_range(
return [true, 'ui-datepicker-current-day', ''];
}
return [true, '', ''];
}
},
});
$('[id^=text-time_end]').timepicker({
$('[id^=text-time_end".$id."]').timepicker({
showSecond: true,
timeFormat: '".$time_format_js."',
timeOnlyTitle: '".__('Choose time')."',

View File

@ -418,12 +418,10 @@ function inventory_get_data(
// Setting for link the agent with the proper server.
if (is_metaconsole() === true && empty($node) === false) {
$loginHash = metaconsole_get_servers_url_hash($node);
$urlToAgent = sprintf(
'%sindex.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=%s%s',
'%sindex.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=%s',
$node['server_url'],
$row['id_agente'],
$loginHash
$row['id_agente']
);
} else {
$urlToAgent = sprintf(
@ -440,8 +438,9 @@ function inventory_get_data(
$table->data[$rowTable][0] = html_print_anchor(
[
'href' => $urlToAgent,
'href' => (is_metaconsole() === true) ? '#' : $urlToAgent,
'content' => '<strong>'.$agent_name.'</strong>',
'onClick' => (is_metaconsole() === true) ? 'redirectNode(\''.$urlToAgent.'\')' : '',
],
true
);

View File

@ -169,6 +169,10 @@ function menu_print_menu(&$menu)
$sec2 = 'godmode/users/profile_list';
} else if ($sec2 === 'godmode/users/configure_token') {
$sec2 = 'godmode/users/token_list';
} else if ($sec2 === 'godmode/servers/modificar_server' && check_acl($config['id_user'], 0, 'AW') && (bool) check_acl($config['id_user'], 0, 'PM') === false) {
$sec2 = 'enterprise/godmode/servers/list_satellite';
} else if ($sec2 === 'enterprise/godmode/snmpconsole/snmp_trap_editor_form') {
$sec2 = 'enterprise/godmode/snmpconsole/snmp_trap_editor';
} else {
$sec2 = (string) get_parameter('sec2');
}

View File

@ -1148,12 +1148,12 @@ function modules_get_table_data(?int $id_agent_module, ?int $id_type)
}
function modules_get_raw_data($id_agent_module, $date_init, $date_end)
function modules_get_raw_data($id_agent_module, $date_init, $date_end, $search_in_history_db=true)
{
$table = modules_get_table_data($id_agent_module, null);
$datelimit = ($date_init - $date_end);
$search_in_history_db = db_search_in_history_db($datelimit);
$search_in_history_db = (($search_in_history_db === true) ? db_search_in_history_db($datelimit) : false);
$data = db_get_all_rows_sql(
'

View File

@ -1389,6 +1389,7 @@ function netflow_draw_item(
$show_summary=true,
$show_table=true
) {
global $config;
$aggregate = $filter['aggregate'];
$interval = ($end_date - $start_date);
if (is_metaconsole() === true) {
@ -1568,13 +1569,24 @@ function netflow_draw_item(
$data_top_n
);
// Theme.
$user_info = get_user_info($config['id_user']);
if (isset($user_info['id_skin']) === true && (int) $user_info['id_skin'] === 2) {
$text_color = '#ffffff';
} else {
$text_color = '#333333';
}
$graph_output = pie_graph(
$pie_data,
[
'width' => 200,
'height' => 200,
'ttl' => ($output === 'PDF') ? 2 : 1,
'dataLabel' => ['display' => 'auto'],
'dataLabel' => [
'display' => 'auto',
'color' => $text_color,
],
'layout' => [
'padding' => [
'top' => 15,

View File

@ -773,13 +773,11 @@ function networkmap_create_agent_node(
if (empty($server_data) === true) {
$server_name = '';
$server_id = '';
$url_hash = '';
$console_url = '';
} else {
$server_name = $server_data['server_name'];
$server_id = $server_data['id'];
$console_url = $server_data['server_url'].'/';
$url_hash = metaconsole_get_servers_url_hash($server_data);
}
// Set node status.
@ -870,7 +868,7 @@ function networkmap_create_agent_node(
}
if (can_user_access_node()) {
$url_node_link = ', URL="'.$console_url.'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].$url_hash.'"';
$url_node_link = ', URL="'.$console_url.'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'"';
} else {
$url_node_link = '';
}

View File

@ -961,7 +961,7 @@ function planned_downtimes_items($filter)
function delete_planned_downtimes($filter)
{
$downtime_execute = db_get_row_filter('tplanned_downtime', ['id' => $filter['id_downtime']], 'execute');
$downtime_execute = db_get_row_filter('tplanned_downtime', ['id' => $filter['id_downtime']], 'executed');
if ($downtime_execute) {
$return = __("This scheduled downtime are executed now. Can't delete in this moment.");

View File

@ -2736,7 +2736,8 @@ function reporting_event_report_module(
$ttl,
$id_server,
$metaconsole_dbtable,
$filter_event_filter_exclude
$filter_event_filter_exclude,
$content['id_agent_module']
);
if (empty($data)) {
@ -6686,6 +6687,7 @@ function reporting_sql_graph(
$type_sql_graph
) {
global $config;
$layout = false;
switch ($type_sql_graph) {
case 'sql_graph_hbar':
@ -6695,6 +6697,7 @@ function reporting_sql_graph(
break;
case 'sql_graph_vbar':
$layout = ['padding' => ['top' => '40']];
$return['type'] = 'sql_graph_vbar';
break;
@ -6769,7 +6772,8 @@ function reporting_sql_graph(
$only_image,
ui_get_full_url(false, false, false, false),
$ttl,
$content['top_n_value']
$content['top_n_value'],
$layout
);
break;
@ -11726,7 +11730,8 @@ function reporting_get_module_detailed_event(
$ttl=1,
$id_server=false,
$metaconsole_dbtable=false,
$filter_event_filter_exclude=false
$filter_event_filter_exclude=false,
$id_agent=false
) {
global $config;
@ -11749,7 +11754,7 @@ function reporting_get_module_detailed_event(
foreach ($id_modules as $id_module) {
$event['data'] = events_get_agent(
false,
$id_agent,
(int) $period,
(int) $date,
$history,

View File

@ -112,8 +112,8 @@ function reporting_html_header(
}
$data[] = $title.$sizhfin;
$data[] = $sizh.$subtitle.$sizhfin;
$data[] = "<div class='right'>".$sizh.$date_text.$sizhfin.'</div>';
$data[] = $sizh.__('Group').': '.$subtitle.$sizhfin;
$data[] = '<div class="flex-content-right flex-items-center">'.$sizh.__('Data time').': '.$sizhfin."<div class='right mrgn_lft_15px'>".$sizh.$date_text.$sizhfin.'</div></div>';
}
array_push($table->data, $data);
@ -194,6 +194,9 @@ function reporting_html_print_report($report, $mini=false, $report_info=1, $cust
$table->head = [];
$table->colspan = [];
$table->rowstyle = ['background-color: #686868'];
$table->size[0] = '33%';
$table->size[1] = '33%';
$table->size[2] = '33%';
if (isset($item['label']) && $item['label'] != '') {
$id_agent = $item['id_agent'];
@ -1709,7 +1712,7 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
$table1->head[3] = __('Name');
$table1->head[4] = __('Agent');
$table1->head[5] = __('Severity');
$table1->head[6] = __('Val. by');
$table1->head[6] = __('Validated by');
$table1->head[7] = __('Timestamp');
} else {
$table1->head[0] = __('Status');
@ -1717,7 +1720,7 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
$table1->head[2] = __('Name');
$table1->head[3] = __('Agent');
$table1->head[4] = __('Severity');
$table1->head[5] = __('Val. by');
$table1->head[5] = __('Validated by');
$table1->head[6] = __('Timestamp');
}
@ -1798,7 +1801,11 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
'id_user',
$event['id_usuario']
);
$data[] = io_safe_output($user_name);
if (isset($event['id_usuario']) === true && empty($event['id_usuario']) === false) {
$data[] = io_safe_output($user_name).' ('.$event['id_usuario'].')';
} else {
$data[] = '';
}
}
if ($item['show_summary_group']) {
@ -3606,7 +3613,7 @@ function reporting_html_group_report($table, $item, $pdf=0)
}
$graph_width = 280;
$graph_height = 250;
$graph_height = 300;
$out = '<table width="100%" class="info_table">';
$out .= '<tbody>';
@ -3688,7 +3695,7 @@ function reporting_html_group_report($table, $item, $pdf=0)
$out .= '<div id="events_per_agent_pie" style="height: '.$graph_height.'px">';
if ((int) $ttl === 2) {
$out .= '<img src="data:image/png;base64,';
$out .= '<img width="350" src="data:image/png;base64,';
} else {
$out .= '<div id="status_pie" style="margin: auto;">';
}
@ -3730,7 +3737,7 @@ function reporting_html_group_report($table, $item, $pdf=0)
$out .= '<div id="group_os_pie" style="height: '.$graph_height.'px">';
if ((int) $ttl === 2) {
$out .= '<img src="data:image/png;base64,';
$out .= '<img width="350" src="data:image/png;base64,';
} else {
$out .= '<div id="status_pie" style="margin: auto;">';
}
@ -3842,7 +3849,7 @@ function reporting_html_event_report_agent($table, $item, $pdf=0)
$table1->head[2] = __('Name');
$table1->head[4] = __('Severity');
$table1->head[5] = __('Val. by');
$table1->head[5] = __('Validated by');
$table1->head[6] = __('Timestamp');
if ((bool) $item['show_custom_data'] === true) {
$table1->head[7] = __('Custom data');
@ -3901,7 +3908,11 @@ function reporting_html_event_report_agent($table, $item, $pdf=0)
$data[] = '<i>'.__('System').'</i>';
} else {
$user_name = db_get_value('fullname', 'tusuario', 'id_user', $event['validated_by']);
$data[] = io_safe_output($user_name);
if (isset($event['id_usuario']) === true && empty($event['id_usuario']) === false) {
$data[] = io_safe_output($user_name).' ('.$event['id_usuario'].')';
} else {
$data[] = '';
}
}
if ($item['show_summary_group']) {
@ -4104,7 +4115,7 @@ function reporting_html_historical_data($table, $item, $pdf=0)
// Center every row
foreach ($table1->data[0] as $k => $v) {
for ($i = 0; $i < count($table1->data); $i++){
for ($i = 0; $i < count($table1->data); $i++) {
$table1->cellstyle[$i][$k] = 'text-align: center;';
}
}
@ -4187,7 +4198,7 @@ function reporting_html_database_serialized($table, $item, $pdf=0)
// Center every row
foreach ($table1->data[0] as $k => $v) {
for ($i = 0; $i < count($table1->data); $i++){
for ($i = 0; $i < count($table1->data); $i++) {
$table1->cellstyle[$i][$k] = 'text-align: center;';
}
}
@ -6432,7 +6443,7 @@ function reporting_html_sql($table, $item, $pdf=0)
// Center every row
foreach ($table2->data[0] as $k => $v) {
for ($i = 0; $i < count($table2->data); $i++){
for ($i = 0; $i < count($table2->data); $i++) {
$table2->cellstyle[$i][$k] = 'text-align: center;';
}
}
@ -7883,6 +7894,12 @@ function reporting_html_ncm_list($table, $item, $pdf=0)
*/
function reporting_html_ncm_backups($table, $item, $pdf=0)
{
global $config;
if ($config['style'] === 'pandora_black') {
ui_require_css_file('pandora_black');
}
ui_require_css_file('diff2html.min');
ui_require_css_file('highlight.min');
ui_require_css_file('highlight/vs.min');

View File

@ -1588,10 +1588,15 @@ function snmp_browser_create_modules_snmp(
enterprise_include_once('include/functions_policies.php');
foreach ($id_target as $policy) {
$exist = db_get_row_filter('tpolicy_modules', ['name' => $oid['oid'], 'id_policy' => $policy], '*');
if ($exist !== false) {
$ids[] = false;
} else {
$ids[] = policies_create_module($oid['oid'], $policy, 2, $values);
}
}
}
}
if (isset($ids) === true && is_array($ids) === true) {
foreach ($ids as $id) {

View File

@ -18,13 +18,11 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
if (empty($server_data)) {
$server_name = '';
$server_id = '';
$url_hash = '';
$console_url = ui_get_full_url('/');
} else {
$server_name = $server_data['server_name'];
$server_id = $server_data['id'];
$console_url = $server_data['server_url'].'/';
$url_hash = metaconsole_get_servers_url_hash($server_data);
}
include_once $config['homedir'].'/include/functions_agents.php';
@ -69,10 +67,11 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
$row['title'] = __('Name');
$row['data'] = html_print_anchor(
[
'href' => $console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$module['id_agente'].'&tab=module&edit_module=1&id_agent_module='.$module['id_agente_modulo'].$url_hash,
'href' => '#',
'title' => __('Click here for view this module'),
'class' => 'font_11',
'content' => $cellName,
'onClick' => 'redirectNode(\''.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$module['id_agente'].'&tab=module&edit_module=1&id_agent_module='.$module['id_agente_modulo'].'\');',
],
true
);
@ -325,45 +324,9 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
echo '<div class="actions_treeview flex flex-evenly">';
if (is_metaconsole() === true) {
echo "<form id='module-table-redirection' method='POST' action='".$console_url."index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module'>";
parse_str($url_hash, $url_hash_array);
html_print_input_hidden(
'id_agente',
$module['id_agente'],
false
);
html_print_input_hidden(
'edit_module',
1,
false
);
html_print_input_hidden(
'id_agent_module',
$module['id_agente_modulo'],
false
);
html_print_input_hidden(
'loginhash',
$url_hash_array['loginhash'],
false
);
html_print_input_hidden(
'loginhash_data',
$url_hash_array['loginhash_data'],
false
);
html_print_input_hidden(
'loginhash_user',
$url_hash_array['loginhash_user'],
false
);
echo '</form>';
echo "<a target=_blank onclick='event.preventDefault(); document.getElementById(\"module-table-redirection\").submit();' href='#'>";
echo '<a target=_blank onclick="redirectNode(\''.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&edit_module=1&id_agente='.$module['id_agente'].'&id_agent_module='.$module['id_agente_modulo'].'\')" href="#">';
} else {
echo '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$module['id_agente'].'&tab=module&edit_module=1&id_agent_module='.$module['id_agente_modulo'].$url_hash.'">';
echo '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$module['id_agente'].'&tab=module&edit_module=1&id_agent_module='.$module['id_agente_modulo'].'">';
}
html_print_submit_button(
@ -399,13 +362,11 @@ function treeview_printAlertsTable($id_module, $server_data=[], $no_head=false)
if (empty($server_data)) {
$server_name = '';
$server_id = '';
$url_hash = '';
$console_url = '';
} else {
$server_name = $server_data['server_name'];
$server_id = $server_data['id'];
$console_url = $server_data['server_url'].'/';
$url_hash = metaconsole_get_servers_url_hash($server_data);
}
$user_access_node = can_user_access_node();
@ -512,7 +473,7 @@ function treeview_printAlertsTable($id_module, $server_data=[], $no_head=false)
__('Go to alerts edition'),
'upd_button',
false,
'window.location.assign("'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&search=1&module_name='.$module_name.'&id_agente='.$agent_id.$url_hash.'")',
'redirectNode("'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&search=1&module_name='.$module_name.'&id_agente='.$agent_id.'")',
['icon' => 'alert'],
true
),
@ -533,15 +494,11 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
global $config;
if (empty($server_data)) {
$server_name = '';
$server_id = '';
$url_hash = '';
$console_url = ui_get_full_url('/');
} else {
$server_name = $server_data['server_name'];
$server_id = $server_data['id'];
$console_url = $server_data['server_url'].'/';
$url_hash = metaconsole_get_servers_url_hash($server_data);
}
include_once $config['homedir'].'/include/functions_agents.php';
@ -623,15 +580,6 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
$cellName = ((bool) $agent['disabled'] === true) ? '<em>' : '';
if (is_metaconsole() === true) {
$pwd = $server_data['auth_token'];
// Create HASH login info.
$user = $config['id_user'];
// Extract auth token from serialized field.
$pwd_deserialiced = json_decode($pwd, true);
$hashdata = $user.$pwd_deserialiced['auth_token'];
$hashdata = md5($hashdata);
if ((bool) $grants_on_node === true && (bool) $user_access_node !== false) {
$urlAgent = $server_data['server_url'].'/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'];
} else {
@ -657,7 +605,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
'title' => __('Click here for view this agent'),
'class' => 'font_11',
'content' => $cellName,
'onClick' => "sendHash('".$urlAgent."')",
'onClick' => "redirectNode('".$urlAgent."')",
],
true
);
@ -998,7 +946,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
$cluster = PandoraFMS\Cluster::loadFromAgentId(
$agent['id_agente']
);
$buttons_act .= '<a target=_blank href="'.$console_url.'index.php?sec=reporting&sec2=operation/cluster/cluster&op=update&id='.$cluster->id().'">';
$buttons_act .= '<a target=_blank href="#" onclick="redirectNode(\''.$console_url.'index.php?sec=reporting&sec2=operation/cluster/cluster&op=update&id='.$cluster->id().'\')">';
$buttons_act .= html_print_submit_button(
__('Go to cluster edition'),
'upd_button',
@ -1007,7 +955,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
true
);
} else {
$buttons_act .= '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$ent.'&tab=module&show_dialog_create=1">';
$buttons_act .= '<a target=_blank href="#" onclick="redirectNode(\''.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&show_dialog_create=1\')">';
$buttons_act .= html_print_submit_button(
__('Go to module creation'),
'upd_button',
@ -1016,7 +964,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
true
);
$buttons_act .= '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$ent.'">';
$buttons_act .= '<a target=_blank href="#" onclick="redirectNode(\''.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'\')">';
$buttons_act .= html_print_submit_button(
__('Go to agent edition'),
'upd_button',
@ -1038,11 +986,6 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
echo "
<script>
function sendHash(url) {
window.open(url+'&loginhash=auto&loginhash_data=".$hashdata.'&loginhash_user='.str_rot13(($user ?? ''))."', '_blank');
}
$('.max-graph-tree-view').ready(function() {
widthGraph();
});

View File

@ -301,8 +301,7 @@ function ui_print_message($message, $class='', $attributes='', $return=false, $t
if (empty($message['no_close']) === false) {
// Workaround.
$no_close_bool = false;
// $no_close_bool = (bool) $message['no_close'];
$no_close_bool = (bool) $message['no_close'];
}
if (empty($message['force_style']) === false) {
@ -1165,16 +1164,10 @@ function ui_format_alert_row(
global $config;
if (!isset($alert['server_data'])) {
$server_name = '';
$server_id = '';
$url_hash = '';
$console_url = '';
} else {
$server_data = $alert['server_data'];
$server_name = $server_data['server_name'];
$server_id = $server_data['id'];
$console_url = $server_data['server_url'].'/';
$url_hash = metaconsole_get_servers_url_hash($server_data);
}
$actionText = '';
@ -1445,13 +1438,13 @@ function ui_format_alert_row(
if (is_metaconsole() === true) {
// Do not show link if user cannot access node
if ((bool) can_user_access_node() === true) {
$hashdata = metaconsole_get_server_hashdata($server);
$url = $server['server_url'].'/index.php?sec=estado&sec2=operation/agentes/ver_agente&amp;loginhash=auto&loginhash_data='.$hashdata.'&loginhash_user='.str_rot13($config['id_user']).'&id_agente='.$agente['id_agente'];
$url = $server['server_url'].'/index.php?sec=estado&sec2=operation/agentes/ver_agente&amp;&id_agente='.$agente['id_agente'];
$data[$index['agent_name']] .= html_print_anchor(
[
'href' => $url,
'href' => '#',
'content' => '<span class="bolder" title="'.$agente['nombre'].'">'.$agente['alias'].'</span>',
'target' => '_blank',
'onClick' => 'redirectNode(\''.$url.'\');',
],
true
);
@ -2955,14 +2948,14 @@ function ui_print_help_tip(
$text_title = (strlen($text) >= 60) ? substr($text, 0, 60).'...' : $text;
$id = random_int(1, 99999);
$output = '<div id="div_tip_'.$id.'" class="tip" style="'.$style.'" >';
$output = '<div id="div_tip_'.$id.'" class="tip" style="'.$style.'" onclick="open_tip('.$id.')">';
$output .= '<div id="tip_dialog_'.$id.'" class="invisible margin-15" data-title="'.__('Help').'"><span class="font_13px">'.io_safe_output($text).'</span></div>';
$output .= html_print_image(
$img,
true,
[
'title' => $text_title,
'class' => $blink === true ? 'blink' : '',
'title' => io_safe_output($text_title),
'class' => ($blink === true) ? 'blink' : '',
'style' => 'width: 16px; height: 16px;',
],
false,
@ -5874,7 +5867,7 @@ function ui_print_agent_autocomplete_input($parameters)
$hidden_input_idagent_value = $parameters['hidden_input_idagent_value'];
}
$size = 30;
$size = 100;
// Default value.
if (isset($parameters['size'])) {
$size = $parameters['size'];
@ -6300,14 +6293,14 @@ function ui_print_agent_autocomplete_input($parameters)
$javascript_function_change .= '
function setInputBackground(inputId, image) {
$("#"+inputId)
.attr("style", "background-image: url(\'"+image+"\'); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:100%; '.$inputStyles.'");
.attr("style", "background-image: url(\'"+image+"\'); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:'.$size.'%; '.$inputStyles.'");
}
$(document).ready(function () {
$("#'.$input_id.'").focusout(function (e) {
setTimeout(() => {
let iconImage = "'.$icon_image.'";
$("#'.$input_id.'").attr("style", "background-image: url(\'"+iconImage+"\'); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:100%; '.$inputStyles.'");
$("#'.$input_id.'").attr("style", "background-image: url(\'"+iconImage+"\'); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:'.$size.'%; '.$inputStyles.'");
}, 100);
});
});
@ -6581,7 +6574,7 @@ function ui_print_agent_autocomplete_input($parameters)
if (select_item_click) {
select_item_click = 0;
$("#'.$input_id.'")
.attr("style", "background-image: url(\"'.$spinner_image.'\"); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:100%; '.$inputStyles.'");
.attr("style", "background-image: url(\"'.$spinner_image.'\"); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:'.$size.'%; '.$inputStyles.'");
return;
} else {
// Clear selectbox if item is not selected.
@ -6596,7 +6589,7 @@ function ui_print_agent_autocomplete_input($parameters)
//Set loading
$("#'.$input_id.'")
.attr("style", "background-image: url(\"'.$spinner_image.'\"); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:100%; '.$inputStyles.'");
.attr("style", "background-image: url(\"'.$spinner_image.'\"); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:'.$size.'%; '.$inputStyles.'");
var term = input_value; //Word to search
'.$javascript_change_ajax_params_text.'
@ -6613,7 +6606,7 @@ function ui_print_agent_autocomplete_input($parameters)
success: function (data) {
if (data.length < 2) {
//Set icon
$("#'.$input_id.'").attr("style", "background-image: url(\"'.$spinner_image.'\"); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:100%; '.$inputStyles.'");
$("#'.$input_id.'").attr("style", "background-image: url(\"'.$spinner_image.'\"); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:'.$size.'%; '.$inputStyles.'");
return;
}
@ -6663,7 +6656,7 @@ function ui_print_agent_autocomplete_input($parameters)
//Set icon
$("#'.$input_id.'")
.attr("style", "background: url(\"'.$icon_image.'\") 97% center no-repeat; background-size: 20px; width:100%; '.$inputStyles.'")
.attr("style", "background: url(\"'.$icon_image.'\") 97% center no-repeat; background-size: 20px; width:'.$size.'%; '.$inputStyles.'")
return;
}
});
@ -6682,7 +6675,7 @@ function ui_print_agent_autocomplete_input($parameters)
}
$attrs = [];
$attrs['style'] = 'background-image: url('.$icon_image.'); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:100%; '.$text_color.' '.$inputStyles.'';
$attrs['style'] = 'background-image: url('.$icon_image.'); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:'.$size.'%; '.$text_color.' '.$inputStyles.'';
if (!$disabled_javascript_on_blur_function) {
$attrs['onblur'] = $javascript_on_blur_function_name.'()';

View File

@ -1664,7 +1664,7 @@ function visual_map_print_item(
echo '<div id="'.$id.'" class="'.$class.'" '.'style="z-index: '.$z_index.';'.'position: absolute; '.'top: '.$top.'px; '.'left: '.$left.'px;'.'display: inline-block; '.$sizeStyle.'">';
if ($link) {
echo "<a href=\"$url\">";
echo '<a href="#" onClick="redirectNode(\''.$url.'\')">';
}
// for clean link text from bbdd only edit_visualmap

View File

@ -92,7 +92,7 @@ if (empty($file) === true || empty($hash) === true || $hash !== md5($file_raw.$c
break;
case $main_collections:
$downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/attachment/collection/'.$file;
$downloadable_file = io_safe_output($config['attachment_store']).'/collection/'.$file;
break;
case 'godmode/setup/file_manager':

View File

@ -547,6 +547,7 @@ function line_graph(
function get_build_setup_charts($type, $options, $data)
{
global $config;
$user_info = get_user_info($config['id_user']);
$factory = new Factory();
@ -1294,6 +1295,10 @@ function get_build_setup_charts($type, $options, $data)
}
}
if (isset($user_info['id_skin']) === true) {
$chart->options()->setTheme($user_info['id_skin']);
}
// Add Datasets.
$setData = $chart->createDataSet();
switch ($type) {

View File

@ -12,12 +12,11 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/**
* @package Include
* @subpackage Clippy
*/
function clippy_agent_module_interval()
{
$return_tours = [];

View File

@ -12,12 +12,11 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/**
* @package Include
* @subpackage Clippy
*/
function clippy_data_configuration_module()
{
$return_tours = [];

View File

@ -1,4 +1,6 @@
<?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
@ -26,8 +28,6 @@
* GNU General Public License for more details.
* ============================================================================
*/
function clippy_modules_not_learning_mode()
{
$return_tours = [];

View File

@ -216,7 +216,7 @@ $(document).ready(function() {
});
$("#ok_buttom").click(function() {
$("#license_error_msg_dialog").dialog("close");
$(".ui-dialog-content").dialog("close");
});
}
}

View File

@ -211,7 +211,7 @@ function fmAgentChange(uniqId) {
}
// eslint-disable-next-line no-unused-vars
function fmModuleChange(uniqId, isMeta) {
function fmModuleChange(uniqId, isMeta, valueID = false) {
var idModuleGroup = $("#filtered-module-module-group-" + uniqId).val();
var idAgents = $("#filtered-module-agents-" + uniqId).val();
var commonSelectorType = $(
@ -253,7 +253,7 @@ function fmModuleChange(uniqId, isMeta) {
.html(value["nombre"]);
} else {
option
.attr("value", id)
.attr("value", valueID === false ? value : id)
.attr("title", value)
.html(value);
}

View File

@ -2364,6 +2364,29 @@ var formatterDataVerticalBar = function(value, ctx) {
}
};
function open_tip(id) {
$("#tip_dialog_" + id).dialog({
title: $("#tip_dialog_" + id).data("title"),
modal: true,
maxWidth: 600,
minWidth: 400,
show: {
effect: "fade",
duration: 200
},
hide: {
effect: "fade",
duration: 200
},
closeOnEscape: true,
buttons: {
Close: function() {
$(this).dialog("close");
}
}
});
}
// Show about section
$(document).ready(function() {
$("[id^='icon_about']").click(function() {
@ -2457,33 +2480,6 @@ $(document).ready(function() {
});
}
}
$("[id^='div_tip_']").click(function() {
var id = $(this)
.attr("id")
.split("_")[2];
$("#tip_dialog_" + id).dialog({
title: $("#tip_dialog_" + id).data("title"),
modal: true,
maxWidth: 600,
minWidth: 400,
show: {
effect: "fade",
duration: 200
},
hide: {
effect: "fade",
duration: 200
},
closeOnEscape: true,
buttons: {
Close: function() {
$(this).dialog("close");
}
}
});
});
});
function close_info_box(id) {
@ -2566,19 +2562,13 @@ function menuActionButtonResizing() {
function check_period_warning(time, title, message) {
var period = time.value;
var times = 0;
if (period >= 2592000 && period < 7776000) {
WarningPeriodicityModal(title, message);
} else if (period >= 7776000 && period < 15552000) {
do {
WarningPeriodicityModal(title, message);
times = times + 1;
} while (times < 2);
} else if (period >= 15552000) {
do {
WarningPeriodicityModal(title, message);
times = times + 1;
} while (times < 3);
}
}
@ -2685,7 +2675,6 @@ function perform_email_test() {
$("#email_test_sent_message").show();
$("#email_test_failure_message").hide();
} else {
console.log($("#email_test_failure_message"));
$("#email_test_failure_message").show();
$("#email_test_sent_message").hide();
}
@ -2759,3 +2748,53 @@ function closeAboutModal() {
$("#icon_about").removeClass("selected");
$("#icon_about_div").removeClass("selected");
}
function redirectNode(url, target = "_blank") {
if (
typeof event !== "undefined" &&
typeof event.preventDefault === "function"
) {
event.preventDefault();
}
let pathAjax = "";
// Detect if view is phone.
if (window.configHomeUrl && window.settings && !window.settings.mobile) {
pathAjax += window.configHomeUrl;
} else if (window.settings && window.settings.mobile) {
pathAjax += "../";
} else {
pathAjax += "../../";
}
pathAjax += "ajax.php";
$.ajax({
method: "POST",
url: pathAjax,
dataType: "json",
data: {
page: "include/ajax/token",
get_jwt_for_login: 1
},
success: function(data) {
const unique_id = "token_form_" + uniqId();
var $form = $(
`<form class="invisible" id="${unique_id}" target="${target}"></form>`
);
$form.attr("method", "post");
$form.attr("action", url);
if (data.success) {
var $input = $("<input>")
.attr("type", "hidden")
.attr("name", "auth_token")
.val(data.data);
$form.append($input);
}
$("body").append($form);
$form.submit();
$("#" + unique_id).remove();
}
});
}

View File

@ -24,12 +24,6 @@ function show_option_dialog(settings) {
method: "updateDashboard",
dataType: "json"
},
oncancel: {
reload: true
},
onclose: {
reload: true
},
ajax_callback: update_dashboard
});
}
@ -238,6 +232,9 @@ function initialiceLayout(data) {
});
if (!$("#checkbox-edit-mode").is(":checked")) {
$("#add-widget")
.parent()
.addClass("invisible_important");
$(".add-widget").hide();
} else {
$(".new-widget-message").hide();
@ -483,10 +480,6 @@ function initialiceLayout(data) {
function configurationWidget(cellId, widgetId, size) {
var reload = 0;
var overlay = false;
if (widgetId == 46) {
reload = 1;
overlay = true;
}
title = $("#hidden-widget_name_" + cellId).val();
load_modal({
target: $("#modal-config-widget"),
@ -559,6 +552,9 @@ function initialiceLayout(data) {
grid.resizable(".grid-stack-item", true);
grid.float(false);
$(".header-options").show();
$("#add-widget")
.parent()
.removeClass("invisible_important");
$(".add-widget").show();
$(".new-widget-message").hide();
$("#container-layout").addClass("container-layout");
@ -568,6 +564,9 @@ function initialiceLayout(data) {
grid.resizable(".grid-stack-item", false);
grid.float(true);
$(".header-options").hide();
$("#add-widget")
.parent()
.addClass("invisible_important");
$(".add-widget").hide();
$(".new-widget-message").show();
$("#container-layout").removeClass("container-layout");
@ -786,6 +785,9 @@ function initialiceLayout(data) {
});
if (!$("#checkbox-edit-mode").is(":checked")) {
$("#add-widget")
.parent()
.addClass("invisible_important");
$(".add-widget").hide();
} else {
$(".new-widget-message").hide();

View File

@ -1066,7 +1066,7 @@ function openSoundEventsDialog(settings, dialog_parameters) {
resizable: false,
modal: false,
width: 600,
height: 600,
height: 700,
dialogClass: "modal-sound",
open: function() {
$.ajax({
@ -1102,24 +1102,8 @@ function openSoundEventsDialog(settings, dialog_parameters) {
if (mode == 0) {
action = true;
}
if ($("#button-start-search").hasClass("play")) {
$("#modal-sound").css({
height: "500px"
});
$("#modal-sound")
.parent()
.css({
height: "550px"
});
} else {
$("#modal-sound").css({
height: "450px"
});
$("#modal-sound")
.parent()
.css({
height: "500px"
});
if (!$("#button-start-search").hasClass("play")) {
$("#progressbar_time").empty();
}
action_events_sound(action, settings);
@ -1338,7 +1322,6 @@ function listen_event_sound(settings) {
);
}
let sound_listener;
function check_event_sound(settings) {
// Update elements time.
$(".elements-discovered-alerts ul li").each(function() {
@ -1382,7 +1365,7 @@ function check_event_sound(settings) {
},
function(data) {
if (data != false) {
clearTimeout(sound_listener);
clearTimeout(window.sound_listener);
// Hide empty.
$("#tabs-sound-modal .empty-discovered-alerts").addClass(
"invisible_important"
@ -1434,7 +1417,7 @@ function check_event_sound(settings) {
});
// -100 delay sound.
sound_listener = setTimeout(
window.sound_listener = setTimeout(
remove_audio,
parseInt($("#tabs-sound-modal #time_sound").val()) * 1000 - 100
);

View File

@ -625,6 +625,10 @@ var TreeController = {
$("#fixed-bottom-box-head-title").html(
$("#fixedBottomHeadTitle").html()
);
$("#fixed-bottom-box-head-title")
.closest(".fixed-bottom-box")
.addClass("tree-view-bottom-modal");
},
error: function(xhr, textStatus, errorThrown) {
callback(errorThrown);
@ -1543,7 +1547,7 @@ var TreeController = {
} else if (controller.tree.length == 0) {
controller.recipient.empty();
controller.recipient.html(
"<div>" + controller.emptyMessage + "</div>"
"<div class='recipent'>" + controller.emptyMessage + "</div>"
);
return;
}

File diff suppressed because it is too large Load Diff

View File

@ -363,6 +363,27 @@ class Manager implements PublicLogin
}
/**
* Generates a hash to authenticate in public dashboards with user form url.
*
* @param string|null $other_secret To authenticate some parts
* of public dashboards (like visual consoles or wux widgets)
* another hash is needed. Other secret avoid
* to reuse the main hash to view other components.
*
* @return string Returns a hash with the authenticaction.
*/
public static function generatePublicHashUser(?string $other_secret='', $id_user=''):string
{
global $config;
$str = $config['dbpass'];
$str .= ($id_user ?? $config['id_user']);
$str .= $other_secret;
return hash('sha256', $str);
}
/**
* Validates a hash to authenticate in public dashboards.
*
@ -411,6 +432,33 @@ class Manager implements PublicLogin
$config['public_dashboard'] = true;
$config['force_instant_logout'] = true;
return true;
} else {
$dashboards = self::getDashboards();
$dashboards = array_reduce(
$dashboards,
function ($carry, $item) {
$carry[$item['id']] = $item['name'];
return $carry;
},
[]
);
foreach ($dashboards as $key => $layout) {
$hash_compare = self::generatePublicHash($key);
if (hash_equals($hash, $hash_compare)) {
// "Log" user in.
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start();
}
$_SESSION['id_usuario'] = get_parameter('id_user');
session_write_close();
$config['public_dashboard'] = true;
$config['force_instant_logout'] = true;
return true;
}
}
}
// Remove id user from config array if authentication has failed.
@ -1013,6 +1061,17 @@ class Manager implements PublicLogin
break;
}
}
if (empty($this->dashboardId) === true) {
$id_user_url = get_parameter('id_user', $config['id_user']);
foreach ($dashboards as $key => $layout) {
$hash_compare = self::generatePublicHashUser($key, $id_user_url);
if (hash_equals($hash_aux, $hash_compare)) {
$this->dashboardId = $key;
break;
}
}
}
}
if ($this->dashboardId === 0

View File

@ -423,6 +423,7 @@ class BasicChart extends Widget
'style_icon' => 'flex-grow: 0',
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'units_select2' => true,
],
];

View File

@ -306,6 +306,7 @@ class BlockHistogram extends Widget
'style_icon' => 'flex-grow: 0',
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'units_select2' => true,
],
];

View File

@ -317,6 +317,7 @@ class DataMatrix extends Widget
'style_icon' => 'flex-grow: 0',
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'units_select2' => true,
],
];
@ -335,6 +336,7 @@ class DataMatrix extends Widget
'style_icon' => 'flex-grow: 0',
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'slice\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'units_select2' => true,
],
];

View File

@ -394,6 +394,7 @@ class CustomGraphWidget extends Widget
'style_icon' => 'flex-grow: 0',
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'units_select2' => true,
],
];

View File

@ -373,6 +373,7 @@ class GraphModuleHistogramWidget extends Widget
'style_icon' => 'flex-grow: 0',
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'units_select2' => true,
],
];

View File

@ -447,25 +447,18 @@ class ModuleValueWidget extends Widget
$sizeLabel = (isset($this->values['sizeLabel']) === true) ? $this->values['sizeLabel'] : 40;
$sizeValue = (isset($this->values['sizeValue']) === true) ? $this->values['sizeValue'] : 40;
$sql = 'SELECT min_warning,
max_warning,
min_critical,
max_critical,
str_warning,
str_critical
FROM tagente_modulo
WHERE id_agente_modulo = '.(int) $this->values['moduleId'];
$sql_data = db_get_row_sql($sql);
$last = modules_get_last_value($this->values['moduleId']);
if (($last >= $sql_data['min_warning']) && ($last < $sql_data['max_warning'])) {
$color = COL_WARNING;
}
if ($last >= $sql_data['max_warning']) {
$color = COL_CRITICAL;
}
$db_status = modules_get_agentmodule_status($this->values['moduleId']);
$module_value = modules_get_last_value($this->values['moduleId']);
$status = 0;
$title = '';
modules_get_status($this->values['moduleId'], $db_status, $module_value, $status, $title);
$color = match ($status) {
STATUS_MODULE_NO_DATA => COL_NOTINIT,
STATUS_MODULE_CRITICAL => COL_CRITICAL,
STATUS_MODULE_WARNING => COL_WARNING,
STATUS_MODULE_OK => COL_NORMAL,
STATUS_MODULE_UNKNOWN => COL_UNKNOWN,
};
$uuid = uniqid();
$output .= '<div class="container-center" id="container-'.$uuid.'">';

View File

@ -207,6 +207,7 @@ class Netflow extends Widget
'style_icon' => 'flex-grow: 0',
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'units_select2' => true,
],
];
$chart_types = netflow_get_chart_types();
@ -366,8 +367,8 @@ class Netflow extends Widget
'',
'HTML',
0,
($size['width'] - 50),
($size['height'] - 20),
($size['width'] + 120),
($size['height'] + 120),
),
],
true
@ -388,29 +389,6 @@ class Netflow extends Widget
{
return '
$(document).ready(function(){
//Limit 1 week
$("#period_select option").each(function(key, element){
if(element.value > 604800){
$(element).remove();
}
})
$("#period_manual option").each(function(key, element){
if(element.value > 604800){
$(element).remove();
}
});
$("#period_manual input").on("change", function(e){
if($("#hidden-period").val() > 604800) {
$(this).val(1);
$("#hidden-period").val(604800);
$("#period_manual select option").removeAttr("selected");
setTimeout(() => {
$("#period_default select option[value=\'604800\']").attr("selected", "selected");
$("#period_manual select option[value=\'604800\']").attr("selected", "selected");
$("#period_manual select").val(604800);
}, 500);
}
});
if($("#chart_type").val() === "usage_map") {
$("#data_to_show").show();
$("#aggregated").hide();
@ -462,7 +440,7 @@ class Netflow extends Widget
public function getSizeModalConfiguration(): array
{
$size = [
'width' => 400,
'width' => 600,
'height' => 530,
];

View File

@ -270,8 +270,8 @@ class SecurityHardening extends Widget
'id' => 'row_date',
'class' => 'row_input',
'arguments' => [
'id' => 'range',
'name' => 'range',
'id' => '_range_vulnerability',
'name' => 'range_vulnerability',
'type' => 'date_range',
'selected' => 'chose_range',
'date_init' => date('Y/m/d', $values['date_init']),
@ -301,7 +301,7 @@ class SecurityHardening extends Widget
$values['limit'] = \get_parameter('limit', 10);
$values['category'] = \get_parameter('category', 6);
$values['ignore_skipped'] = \get_parameter_switch('ignore_skipped', 0);
$date = $this->getDateParameter();
$date = \get_parameter_date('range_vulnerability', '', 'U');
$values['date_init'] = $date['date_init'];
$values['date_end'] = $date['date_end'];
return $values;
@ -366,75 +366,6 @@ class SecurityHardening extends Widget
}
/**
* Returns the date in an object obtained by parameter.
*
* @return object Object with date_init, date_end and period.
*/
private function getDateParameter()
{
$date_end = get_parameter('date_end', 0);
$time_end = get_parameter('time_end');
$datetime_end = strtotime($date_end.' '.$time_end);
$custom_date = get_parameter('custom_date', 0);
$range = get_parameter('range', SECONDS_1DAY);
$date_text = get_parameter('range_text', SECONDS_1DAY);
$date_init_less = (strtotime(date('Y/m/d')) - SECONDS_1DAY);
$date_init = get_parameter('date_init', date(DATE_FORMAT, $date_init_less));
$time_init = get_parameter('time_init', date(TIME_FORMAT, $date_init_less));
$datetime_init = strtotime($date_init.' '.$time_init);
if ($custom_date === '1') {
if ($datetime_init >= $datetime_end) {
$datetime_init = $date_init_less;
}
$date_init = date('Y/m/d H:i:s', $datetime_init);
$date_end = date('Y/m/d H:i:s', $datetime_end);
$period = ($datetime_end - $datetime_init);
} else if ($custom_date === '2') {
$date_units = get_parameter('range_units');
$date_end = date('Y/m/d H:i:s');
$date_init = date('Y/m/d H:i:s', (strtotime($date_end) - ((int) $date_text * (int) $date_units)));
$period = (strtotime($date_end) - strtotime($date_init));
} else if (in_array($range, ['this_week', 'this_month', 'past_week', 'past_month'])) {
if ($range === 'this_week') {
$monday = date('Y/m/d', strtotime('last monday'));
$sunday = date('Y/m/d', strtotime($monday.' +6 days'));
$period = (strtotime($sunday) - strtotime($monday));
$date_init = $monday;
$date_end = $sunday;
} else if ($range === 'this_month') {
$date_end = date('Y/m/d', strtotime('last day of this month'));
$first_of_month = date('Y/m/d', strtotime('first day of this month'));
$date_init = $first_of_month;
$period = (strtotime($date_end) - strtotime($first_of_month));
} else if ($range === 'past_month') {
$date_end = date('Y/m/d', strtotime('last day of previous month'));
$first_of_month = date('Y/m/d', strtotime('first day of previous month'));
$date_init = $first_of_month;
$period = (strtotime($date_end) - strtotime($first_of_month));
} else if ($range === 'past_week') {
$date_end = date('Y/m/d', strtotime('sunday', strtotime('last week')));
$first_of_week = date('Y/m/d', strtotime('monday', strtotime('last week')));
$date_init = $first_of_week;
$period = (strtotime($date_end) - strtotime($first_of_week));
}
} else {
$date_end = date('Y/m/d H:i:s');
$date_init = date('Y/m/d H:i:s', (strtotime($date_end) - $range));
$period = (strtotime($date_end) - strtotime($date_init));
}
return [
'date_init' => strtotime($date_init),
'date_end' => strtotime($date_end),
'period' => $period,
];
}
/**
* Check user's acl using group.
*
@ -692,6 +623,7 @@ class SecurityHardening extends Widget
*/
private function vulnerabilitiesByCategory($group, $category, $ignore_skipped=true)
{
global $config;
$labels = [
__('Passed'),
__('Failed'),
@ -749,7 +681,7 @@ class SecurityHardening extends Widget
$total = (count($vulnerabilities['pass']) + count($vulnerabilities['fail']));
if ($ignore_skipped === false) {
if ($ignore_skipped === false && isset($vulnerabilities['skipped']) === true) {
$data[] = count($vulnerabilities['skipped']);
$total += count($vulnerabilities['skipped']);
$labels[] = __('Skipped');
@ -763,18 +695,19 @@ class SecurityHardening extends Widget
'display' => true,
'position' => 'right',
'align' => 'center',
'fonts' => [ 'size' => '12' ],
],
'elements' => [
'center' => [
'text' => $total,
'color' => '#2c3e50',
'color' => ($config['style'] === 'pandora_black') ? '#ffffff' : '#2c3e50',
],
],
'labels' => $labels,
'colors' => [
'#82b92e',
'#e63c52',
'#E4E4E4',
($config['style'] === 'pandora_black') ? '#666' : '#E4E4E4',
],
]
);

View File

@ -449,6 +449,7 @@ class SingleGraphWidget extends Widget
'style_icon' => 'flex-grow: 0',
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'units_select2' => true,
],
];
@ -532,6 +533,7 @@ class SingleGraphWidget extends Widget
'value' => $values['period_projection'],
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'units_select2' => true,
],
];
@ -597,6 +599,7 @@ class SingleGraphWidget extends Widget
SECONDS_1WEEK => __('1 week'),
SECONDS_1MONTH => __('1 month'),
],
'units_select2' => true,
],
];

View File

@ -383,6 +383,7 @@ class SLAPercentWidget extends Widget
'style_icon' => 'flex-grow: 0',
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'units_select2' => true,
],
];

View File

@ -262,6 +262,7 @@ class TopNWidget extends Widget
'style_icon' => 'flex-grow: 0',
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'units_select2' => true,
],
];

View File

@ -684,7 +684,7 @@ class TreeViewWidget extends Widget
'dateFormat' => DATE_FORMAT_JS,
'userLanguage' => get_user_language(),
'translate' => [
'emptyMessage' => __('No data found'),
'emptyMessage' => ui_print_info_message(['no_close' => true, 'message' => __('No data found.')], '', true),
'foundMessage' => $foundMessage,
'total' => [
'agents' => __('Total agents'),

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