mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-09-26 03:19:05 +02:00
Merge remote-tracking branch 'origin/develop' into ent-9640-agrupacion-de-graficas-en-periodos-de-tiempo
Conflicts: pandora_console/include/styles/pandora.css
This commit is contained in:
commit
77cf0ce6ca
@ -1,5 +1,5 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.774-231128
|
||||
Version: 7.0NG.774-231205
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.774-231128"
|
||||
pandora_version="7.0NG.774-231205"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
@ -1039,7 +1039,7 @@ my $Sem = undef;
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.774';
|
||||
use constant AGENT_BUILD => '231128';
|
||||
use constant AGENT_BUILD => '231205';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -4,7 +4,7 @@
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.774
|
||||
%define release 231128
|
||||
%define release 231205
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -5,7 +5,7 @@
|
||||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.774
|
||||
%define release 231128
|
||||
%define release 231205
|
||||
%define debug_package %{nil}
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
|
@ -5,7 +5,7 @@
|
||||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.774
|
||||
%define release 231128
|
||||
%define release 231205
|
||||
%define debug_package %{nil}
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
|
@ -5,7 +5,7 @@
|
||||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.774
|
||||
%define release 231128
|
||||
%define release 231205
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
Name: %{name}
|
||||
|
@ -4,7 +4,7 @@
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.774
|
||||
%define release 231128
|
||||
%define release 231205
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -10,7 +10,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.774"
|
||||
PI_BUILD="231128"
|
||||
PI_BUILD="231205"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{231128}
|
||||
{231205}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.774 Build 231128")
|
||||
#define PANDORA_VERSION ("7.0NG.774 Build 231205")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Pandora FMS"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.774(Build 231128))"
|
||||
VALUE "ProductVersion", "(7.0NG.774(Build 231205))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.774-231128
|
||||
Version: 7.0NG.774-231205
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.774-231128"
|
||||
pandora_version="7.0NG.774-231205"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -1720,3 +1720,4 @@ include/functions_integriaims.php
|
||||
include/ajax/integria_incidents.ajax.php
|
||||
enterprise/operation/log/log_source.php
|
||||
enterprise/include/class/LogSource.class.php
|
||||
include/chart_generator.php
|
@ -1,8 +1,50 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `tevento`
|
||||
ADD COLUMN `event_custom_id` TEXT NULL AFTER `module_status`;
|
||||
|
||||
-- Telegram and vonage default alerts
|
||||
UPDATE talert_actions
|
||||
SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_'
|
||||
WHERE id=9;
|
||||
UPDATE talert_actions
|
||||
SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_'
|
||||
WHERE id=11;
|
||||
-- Delete table tagent_access
|
||||
DROP TABLE tagent_access;
|
||||
|
||||
ALTER TABLE `tevent_rule` DROP COLUMN `user_comment`;
|
||||
ALTER TABLE `tevent_rule` DROP COLUMN `operator_user_comment`;
|
||||
|
||||
ALTER TABLE treport_content ADD check_unknowns_graph tinyint DEFAULT 0 NULL;
|
||||
|
||||
ALTER TABLE `tevent_filter`
|
||||
ADD COLUMN `regex` TEXT NULL AFTER `private_filter_user`;
|
||||
-- Update macros for plugin oracle
|
||||
|
||||
UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.oracle';
|
||||
|
||||
SET @id_app := (SELECT `id_app` FROM `tdiscovery_apps` WHERE `short_name` = 'pandorafms.oracle');
|
||||
|
||||
UPDATE `tdiscovery_apps_tasks_macros` SET `value` = 'agents_group_id=__taskGroupID__ interval=__taskInterval__ user=_dbuser_ password=_dbpass_ thick_mode=_thickMode_ client_path=_clientPath_ threads=_threads_ modules_prefix=_prefixModuleName_ execute_custom_queries=_executeCustomQueries_ analyze_connections=_checkConnections_ engine_uptime=_checkUptime_ query_stats=_queryStats_ cache_stats=_checkCache_ fragmentation_ratio=_checkFragmentation_ check_tablescpaces=_checkTablespaces_' WHERE `macro` = '_tempfileConf_' AND `id_task` IN (SELECT `id_rt` FROM `trecon_task` WHERE `id_app` = @id_app);
|
||||
|
||||
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT id_rt, '_thickMode_', 'custom', 0, 0 FROM `trecon_task` WHERE `id_app` = @id_app;
|
||||
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT id_rt, '_clientPath_', 'custom', '', 0 FROM `trecon_task` WHERE `id_app` = @id_app;
|
||||
UPDATE `trecon_task` SET `setup_complete` = 1 WHERE `id_app` = @id_app;
|
||||
|
||||
-- Update lts updates
|
||||
UPDATE tconfig SET value='1' WHERE token='lts_updates';
|
||||
|
||||
ALTER TABLE `tdashboard`
|
||||
ADD COLUMN `date_range` TINYINT NOT NULL DEFAULT 0 AFTER `cells_slideshow`,
|
||||
ADD COLUMN `date_from` INT NOT NULL DEFAULT 0 AFTER `date_range`,
|
||||
ADD COLUMN `date_to` INT NOT NULL DEFAULT 0 AFTER `date_from`;
|
||||
|
||||
SELECT @generic_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_data";
|
||||
SELECT @generic_proc := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_proc";
|
||||
SELECT @async_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "async_data";
|
||||
SELECT @async_proc := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "async_proc";
|
||||
UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_data WHERE `tagente_modulo`.`id_tipo_modulo` = @async_data;
|
||||
UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_proc WHERE `tagente_modulo`.`id_tipo_modulo` = @async_proc;
|
||||
|
||||
COMMIT;
|
||||
|
@ -600,43 +600,176 @@ html_print_div(
|
||||
'content' => html_print_table($tableAgent, true).$CodeQRTable,
|
||||
]
|
||||
);
|
||||
/*
|
||||
TODO REVIEW
|
||||
$table_satellite = '';
|
||||
if ($remote_agent === true) {
|
||||
// Satellite server selector.
|
||||
$satellite_servers = db_get_all_rows_filter(
|
||||
'tserver',
|
||||
['server_type' => SERVER_TYPE_ENTERPRISE_SATELLITE],
|
||||
[
|
||||
'id_server',
|
||||
'name',
|
||||
]
|
||||
);
|
||||
|
||||
$satellite_names = [];
|
||||
if (empty($satellite_servers) === false) {
|
||||
foreach ($satellite_servers as $s_server) {
|
||||
$satellite_names[$s_server['id_server']] = $s_server['name'];
|
||||
// Basic Options.
|
||||
$tableBasicAgent = new stdClass();
|
||||
$tableBasicAgent->class = 'filter-table-adv';
|
||||
$tableBasicAgent->data = [];
|
||||
$disabledBasic = false;
|
||||
$tableClassDisabled = '';
|
||||
if ($new_agent === true || $remote_agent === false || $has_remote_conf === false) {
|
||||
$disabledBasic = true;
|
||||
$tableClassDisabled = ' basic-options-disabled';
|
||||
}
|
||||
|
||||
if (enterprise_installed()) {
|
||||
// Get all plugins (BASIC OPTIONS).
|
||||
$agent_plugin = new PandoraFMS\Agent($id_agente);
|
||||
$plugins = $agent_plugin->getPlugins();
|
||||
// Check if some plugin was enabled/disabled in conf.
|
||||
foreach ($plugins as $key => $row) {
|
||||
if (preg_match('/pandora_hardening/', $row['raw']) === 1) {
|
||||
if ($row['disabled'] === 1) {
|
||||
$security_hardening = 0;
|
||||
} else {
|
||||
$security_hardening = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$table_satellite = '<div class="label_select"><p class="input_label">'.__('Satellite').'</p>';
|
||||
$table_satellite .= '<div class="label_select_parent">';
|
||||
if ($id_os === '1' || $id_os === '8') {
|
||||
if (preg_match('/(module_plugin grep_log_module ).*/', $row['raw']) === 1) {
|
||||
if ($row['disabled'] === 1) {
|
||||
$enable_log_collector = 0;
|
||||
} else {
|
||||
$enable_log_collector = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$table_satellite .= html_print_input(
|
||||
if (preg_match('/(module_plugin inventory).*/', $row['raw']) === 1) {
|
||||
if ($row['disabled'] === 1) {
|
||||
$enable_inventory = 0;
|
||||
} else {
|
||||
$enable_inventory = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (preg_match('/.vbs/', $row['raw']) === 1 && preg_match('/nettraffic.vbs/', $row['raw']) === 0 && preg_match('/software_installed.vbs/', $row['raw']) === 0 && preg_match('/df.vbs/', $row['raw']) === 0 && preg_match('/win_cf.vbs/', $row['raw']) === 0) {
|
||||
if ($row['disabled'] === 1) {
|
||||
$enable_inventory = 0;
|
||||
} else {
|
||||
$enable_inventory = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($id_os === '9') {
|
||||
$modules = $agent_plugin->getModules();
|
||||
foreach ($modules as $key => $row) {
|
||||
if (preg_match('/PandoraAgent_log/', $row['raw']) === 1) {
|
||||
if ($row['disabled'] === 1) {
|
||||
$enable_log_collector = 0;
|
||||
} else {
|
||||
$enable_log_collector = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($agent_plugin, $plugins);
|
||||
if (($new_agent === true && $config['current_package'] >= 774) || ($agent_version >= 774 && $new_agent === false)) {
|
||||
if ($disabledBasic === true || $has_remote_conf === false) {
|
||||
$message = __('Remote config disabled, please activate to enable agent basic options');
|
||||
$tableBasicAgent->data[] = '<span>'.$message.'</span>';
|
||||
}
|
||||
|
||||
$tableBasicAgent->data[] = html_print_label_input_block(
|
||||
__('Enable security hardening monitoring'),
|
||||
html_print_input(
|
||||
[
|
||||
'type' => 'select',
|
||||
'fields' => $satellite_names,
|
||||
'name' => 'satellite_server',
|
||||
'selected' => $satellite_server,
|
||||
'nothing' => __('None'),
|
||||
'nothinf_value' => 0,
|
||||
'return' => true,
|
||||
'type' => 'switch',
|
||||
'id' => 'security_hardening',
|
||||
'name' => 'security_hardening',
|
||||
'value' => $security_hardening,
|
||||
'disabled' => $disabledBasic,
|
||||
]
|
||||
).'<div class="label_select_child_icons"></div></div></div>';
|
||||
).html_print_input_hidden('options_package', '1', true)
|
||||
);
|
||||
|
||||
$tableBasicAgent->data[] = html_print_label_input_block(
|
||||
__('Enable log collection'),
|
||||
html_print_input(
|
||||
[
|
||||
'type' => 'switch',
|
||||
'id' => 'enable_log_collector',
|
||||
'name' => 'enable_log_collector',
|
||||
'value' => $enable_log_collector,
|
||||
'disabled' => $disabledBasic,
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$tableBasicAgent->data[] = html_print_label_input_block(
|
||||
__('Enable inventory'),
|
||||
html_print_input(
|
||||
[
|
||||
'type' => 'switch',
|
||||
'id' => 'enable_inventory',
|
||||
'name' => 'enable_inventory',
|
||||
'value' => $enable_inventory,
|
||||
'disabled' => $disabledBasic,
|
||||
]
|
||||
).html_print_input_hidden('enable_basic_options', '1', true)
|
||||
);
|
||||
|
||||
if ($config['ehorus_enabled'] === '1') {
|
||||
$pandoraRC_Id = html_print_image(
|
||||
'images/alert_recovered@svg.svg',
|
||||
true,
|
||||
[
|
||||
'class' => 'invert_filter main_menu_icon',
|
||||
'title' => __('Pandora RC connected with id ').$config['ehorus_custom_field'],
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$pandoraRC_Id = html_print_image(
|
||||
'images/alerts.svg',
|
||||
true,
|
||||
[
|
||||
'class' => 'invert_filter main_menu_icon',
|
||||
'title' => __('This agent do not have a Pandora RC agent installed, install one.'),
|
||||
]
|
||||
);
|
||||
}
|
||||
*/
|
||||
|
||||
$tableBasicAgent->data[] = html_print_label_input_block(
|
||||
__('Enable remote control'),
|
||||
$pandoraRC_Id
|
||||
);
|
||||
|
||||
$WarningPackage = '';
|
||||
if (($new_agent === true && $config['current_package'] < 774) || ($agent_version < 774 && $new_agent === false)) {
|
||||
$WarningPackage = html_print_image(
|
||||
'images/alert-yellow@svg.svg',
|
||||
true,
|
||||
[
|
||||
'title' => __('Only available for agents 774 or higher'),
|
||||
'alt' => __('Only available for agents 774 or higher'),
|
||||
'class' => 'main_menu_icon mrgn_lft_5px',
|
||||
]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$tableBasicAgent->data[] = '<span>'.__('Remote config is enabled only in the Enteprise version').'</span>';
|
||||
$tableBasicAgent->data[] .= html_print_input_hidden(
|
||||
'enable_basic_options',
|
||||
'0',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
ui_toggle(
|
||||
html_print_table($tableBasicAgent, true),
|
||||
'<span class="subsection_header_title">'.__('Basic options').$WarningPackage.'</span>',
|
||||
'',
|
||||
'basic_options',
|
||||
true,
|
||||
false,
|
||||
'white_box_content',
|
||||
'no-border white_table_graph'.$tableClassDisabled,
|
||||
'box-flat white_table_graph invisible'
|
||||
);
|
||||
|
||||
// Advanced options.
|
||||
$tableAdvancedAgent = new stdClass();
|
||||
@ -922,22 +1055,25 @@ $tableAdvancedAgent->data['safe_operation'][] = html_print_label_input_block(
|
||||
)
|
||||
);
|
||||
|
||||
$tableAdvancedAgent->data['vul_scan_enabled'][] = html_print_label_input_block(
|
||||
__('Vulnerability scanning'),
|
||||
html_print_select(
|
||||
[
|
||||
0 => __('Disabled'),
|
||||
1 => __('Enabled'),
|
||||
2 => __('Use global settings'),
|
||||
],
|
||||
'vul_scan_enabled',
|
||||
$vul_scan_enabled,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true
|
||||
)
|
||||
);
|
||||
if (enterprise_installed() === true) {
|
||||
$tableAdvancedAgent->data['vul_scan_enabled'][] = html_print_label_input_block(
|
||||
__('Vulnerability scanning'),
|
||||
html_print_select(
|
||||
[
|
||||
0 => __('Disabled'),
|
||||
1 => __('Enabled'),
|
||||
2 => __('Use global settings'),
|
||||
],
|
||||
'vul_scan_enabled',
|
||||
$vul_scan_enabled,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
ui_toggle(
|
||||
html_print_table($tableAdvancedAgent, true),
|
||||
@ -1253,7 +1389,8 @@ ui_require_jquery_file('bgiframe');
|
||||
});
|
||||
|
||||
$("#checkbox-cascade_protection").change(function () {
|
||||
var checked = $("#checkbox-cascade_protection").is(":checked"); if (checked) {
|
||||
var checked = $("#checkbox-cascade_protection").is(":checked");
|
||||
if (checked) {
|
||||
$("#cascade_protection_module").removeAttr("disabled");
|
||||
$("#text-id_parent").attr("required", "required");
|
||||
}
|
||||
@ -1308,5 +1445,17 @@ ui_require_jquery_file('bgiframe');
|
||||
}
|
||||
});
|
||||
|
||||
check_basic_options();
|
||||
$('#id_os').on('change', function(){
|
||||
check_basic_options();
|
||||
})
|
||||
});
|
||||
|
||||
function check_basic_options(){
|
||||
if ($('#id_os').val() == 1 || $('#id_os').val() == 8 || $('#id_os').val() == 9) {
|
||||
$('#basic_options').removeClass('invisible');
|
||||
} else {
|
||||
$('#basic_options').addClass('invisible');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -232,7 +232,7 @@ if ($create_agent) {
|
||||
$cps = (int) get_parameter_switch('cps', -1);
|
||||
$fixed_ip = (int) get_parameter_switch('fixed_ip', 0);
|
||||
$vul_scan_enabled = (int) get_parameter_switch('vul_scan_enabled', 2);
|
||||
|
||||
$agent_version = $config['current_package'];
|
||||
$secondary_groups = (array) get_parameter('secondary_groups_selected', '');
|
||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||
|
||||
@ -300,6 +300,7 @@ if ($create_agent) {
|
||||
'cps' => $cps,
|
||||
'fixed_ip' => $fixed_ip,
|
||||
'vul_scan_enabled' => $vul_scan_enabled,
|
||||
'agent_version' => $agent_version,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
@ -1015,6 +1016,13 @@ if ($update_agent) {
|
||||
$satellite_server = (int) get_parameter('satellite_server', 0);
|
||||
$fixed_ip = (int) get_parameter_switch('fixed_ip', 0);
|
||||
$vul_scan_enabled = (int) get_parameter_switch('vul_scan_enabled', 2);
|
||||
$security_vunerability = (int) get_parameter_switch('security_vunerability', 0);
|
||||
$security_hardening = (int) get_parameter_switch('security_hardening', 0);
|
||||
$security_monitoring = (int) get_parameter_switch('security_monitoring', 0);
|
||||
$enable_log_collector = (int) get_parameter_switch('enable_log_collector', 0);
|
||||
$enable_inventory = (int) get_parameter_switch('enable_inventory', 0);
|
||||
$enable_basic_options = get_parameter('enable_basic_options');
|
||||
$options_package = get_parameter('options_package', '0');
|
||||
|
||||
if ($fields === false) {
|
||||
$fields = [];
|
||||
@ -1243,6 +1251,81 @@ if ($update_agent) {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($enable_basic_options === '1') {
|
||||
// Get all plugins (BASIC OPTIONS).
|
||||
$agent = new PandoraFMS\Agent($id_agente);
|
||||
$plugins = $agent->getPlugins();
|
||||
foreach ($plugins as $key => $row) {
|
||||
// Only check plugins when agent package is bigger than 774.
|
||||
if ($options_package === '1') {
|
||||
if (preg_match('/pandora_hardening/', $row['raw']) === 1) {
|
||||
if ($security_hardening === 1) {
|
||||
if ($row['disabled'] === 1) {
|
||||
$agent->enablePlugins($row['raw']);
|
||||
}
|
||||
} else {
|
||||
if ($row['disabled'] !== 1) {
|
||||
$agent->disablePlugins($row['raw']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match('/(module_plugin grep_log_module ).*/', $row['raw']) === 1) {
|
||||
if ($enable_log_collector === 1) {
|
||||
if ($row['disabled'] === 1) {
|
||||
$agent->enablePlugins($row['raw']);
|
||||
}
|
||||
} else {
|
||||
if ($row['disabled'] !== 1) {
|
||||
$agent->disablePlugins($row['raw']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Inventory switch enable when basic options are enabled.
|
||||
if (preg_match('/(module_plugin inventory).*/', $row['raw']) === 1) {
|
||||
if ($enable_inventory === 1) {
|
||||
if ($row['disabled'] === 1) {
|
||||
$agent->enablePlugins($row['raw']);
|
||||
}
|
||||
} else {
|
||||
if ($row['disabled'] !== 1) {
|
||||
$agent->disablePlugins($row['raw']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Inventory switch enable when basic options are enabled.
|
||||
if (preg_match('/.vbs/', $row['raw']) === 1 && preg_match('/nettraffic.vbs/', $row['raw']) === 0 && preg_match('/software_installed.vbs/', $row['raw']) === 0 && preg_match('/df.vbs/', $row['raw']) === 0 && preg_match('/win_cf.vbs/', $row['raw']) === 0) {
|
||||
if ($enable_inventory === 1) {
|
||||
if ($row['disabled'] === 1) {
|
||||
$agent->enablePlugins($row['raw']);
|
||||
}
|
||||
} else {
|
||||
if ($row['disabled'] !== 1) {
|
||||
$agent->disablePlugins($row['raw']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$modules = $agent->getModules();
|
||||
foreach ($modules as $key => $row) {
|
||||
if (preg_match('/PandoraAgent_log/', $row['raw']) === 1) {
|
||||
if ($enable_log_collector === 1) {
|
||||
if ($row['disabled'] === 1) {
|
||||
$agent->enableModule($row['module_name'], $row);
|
||||
}
|
||||
} else {
|
||||
if ($row['disabled'] !== 1) {
|
||||
$agent->disableModule($row['module_name'], $row);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Read agent data
|
||||
@ -1300,6 +1383,19 @@ if ($id_agente) {
|
||||
$satellite_server = (int) $agent['satellite_server'];
|
||||
$fixed_ip = (int) $agent['fixed_ip'];
|
||||
$vul_scan_enabled = (int) $agent['vul_scan_enabled'];
|
||||
if (strpos($agent['agent_version'], '(')) {
|
||||
$agent_version = (int) explode('.', explode('(', $agent['agent_version'])[0])[2];
|
||||
} else {
|
||||
if (strpos($agent['agent_version'], 'build') || strpos($agent['agent_version'], 'Build')) {
|
||||
$agent_version = (int) explode('.', explode('build', $agent['agent_version'])[0])[2];
|
||||
} else {
|
||||
if (strpos($agent['agent_version'], '.')) {
|
||||
$agent_version = (int) explode('.', $agent['agent_version'])[2];
|
||||
} else {
|
||||
$agent_version = $agent['agent_version'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$update_module = (bool) get_parameter('update_module');
|
||||
|
@ -38,6 +38,7 @@ $isFunctionPolicies = enterprise_include_once('include/functions_policies.php');
|
||||
require_once $config['homedir'].'/include/functions_modules.php';
|
||||
require_once $config['homedir'].'/include/functions_agents.php';
|
||||
require_once $config['homedir'].'/include/functions_servers.php';
|
||||
require_once $config['homedir'].'/include/functions_macros.php';
|
||||
|
||||
$search_string = get_parameter('search_string');
|
||||
|
||||
@ -949,7 +950,23 @@ if ($modules !== false) {
|
||||
);
|
||||
|
||||
if (strlen($module['ip_target']) !== 0) {
|
||||
$title .= '<br/>IP: '.$module['ip_target'];
|
||||
// Check if value is custom field.
|
||||
if ($module['ip_target'][0] == '_' && $module['ip_target'][(strlen($module['ip_target']) - 1)] == '_') {
|
||||
$custom_field_name = substr($module['ip_target'], 1, -1);
|
||||
$custom_value = agents_get_agent_custom_field($id_agente, $custom_field_name);
|
||||
if (isset($custom_value) && $custom_value !== false) {
|
||||
$title .= '<br/>IP: '.$custom_value;
|
||||
} else {
|
||||
$array_macros = return_agent_macros($id_agente);
|
||||
if (isset($array_macros[$module['ip_target']])) {
|
||||
$title .= '<br/>IP: '.$array_macros[$module['ip_target']];
|
||||
} else {
|
||||
$title .= '<br/>IP: '.$module['ip_target'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$title .= '<br/>IP: '.$module['ip_target'];
|
||||
}
|
||||
}
|
||||
|
||||
// This module is initialized ? (has real data).
|
||||
|
@ -2003,23 +2003,14 @@ ui_require_jquery_file('json');
|
||||
var type_names = jQuery.parseJSON(Base64.decode($('#hidden-type_names').val()));
|
||||
var type_name_selected = type_names[type_selected];
|
||||
|
||||
if ($('#radius-percentage_warning').prop('checked') === true || $('#radius-percentage_critical').prop('checked') === true || type_name_selected == 'generic_data_string') {
|
||||
if (($('#radius-percentage_warning').prop('checked') === true && $('#radius-percentage_critical').prop('checked') === true) || type_name_selected == 'generic_data_string') {
|
||||
paint_graph_values();
|
||||
$("#svg_dinamic").hide();
|
||||
} else {
|
||||
paint_graph_values();
|
||||
$("#svg_dinamic").show();
|
||||
}
|
||||
|
||||
if ($('#radius-percentage_warning').prop('checked') === true) {
|
||||
$('#radius-warning_inverse').hide();
|
||||
$('#label-radius-warning_inverse').hide();
|
||||
}
|
||||
|
||||
if ($('#radius-warning_inverse').prop('checked') === true) {
|
||||
$('#radius-percentage_warning').hide();
|
||||
$('#label-radius-percentage_warning').hide();
|
||||
}
|
||||
|
||||
if ($('#radius-normal_warning').prop('checked') === true) {
|
||||
$('#radius-warning_inverse').show();
|
||||
$('#label-radius-warning_inverse').show();
|
||||
@ -2027,17 +2018,6 @@ ui_require_jquery_file('json');
|
||||
$('#label-radius-percentage_warning').show();
|
||||
}
|
||||
|
||||
|
||||
if ($('#radius-percentage_critical').prop('checked') === true) {
|
||||
$('#radius-critical_inverse').hide();
|
||||
$('#label-radius-critical_inverse').hide();
|
||||
}
|
||||
|
||||
if ($('#radius-critical_inverse').prop('checked') === true) {
|
||||
$('#radius-percentage_critical').hide();
|
||||
$('#label-radius-percentage_critical').hide();
|
||||
}
|
||||
|
||||
if ($('#radius-normal_critical').prop('checked') === true) {
|
||||
$('#radius-critical_inverse').show();
|
||||
$('#label-radius-critical_inverse').show();
|
||||
@ -2354,30 +2334,48 @@ ui_require_jquery_file('json');
|
||||
var message_error_percentage = '<?php echo __('Please introduce a positive percentage value'); ?>';
|
||||
|
||||
//if haven't error
|
||||
if (max_w == 0 || max_w > min_w) {
|
||||
if (max_c == 0 || max_c > min_c) {
|
||||
paint_graph_status(
|
||||
min_w, max_w, min_c, max_c, inverse_w,
|
||||
inverse_c, error_w, error_c,
|
||||
legend_normal, legend_warning, legend_critical,
|
||||
message_error_warning, message_error_critical
|
||||
);
|
||||
if (max_w == 0 || max_w > min_w || $('#radius-percentage_warning').is(':checked') === true) {
|
||||
if (max_c == 0 || max_c > min_c || $('#radius-percentage_critical').is(':checked') === true) {
|
||||
error_c = 0;
|
||||
error_w = 0;
|
||||
} else {
|
||||
error_c = 1;
|
||||
paint_graph_status(
|
||||
0, 0, 0, 0, 0, 0, error_w, error_c,
|
||||
legend_normal, legend_warning, legend_critical,
|
||||
message_error_warning, message_error_critical
|
||||
);
|
||||
min_w = 0;
|
||||
max_w = 0;
|
||||
min_c = 0;
|
||||
max_c = 0;
|
||||
inverse_w = 0;
|
||||
inverse_c = 0;
|
||||
}
|
||||
} else {
|
||||
if (max_c !== 0 && max_c < min_c && $('#radius-percentage_critical').is(':checked') === false) {
|
||||
error_c = 2;
|
||||
}
|
||||
error_w = 1;
|
||||
paint_graph_status(
|
||||
0, 0, 0, 0, 0, 0, error_w, error_c,
|
||||
legend_normal, legend_warning, legend_critical,
|
||||
message_error_warning, message_error_critical
|
||||
);
|
||||
min_w = 0;
|
||||
max_w = 0;
|
||||
min_c = 0;
|
||||
max_c = 0;
|
||||
inverse_w = 0;
|
||||
inverse_c = 0;
|
||||
}
|
||||
|
||||
if ($('#radius-percentage_warning').is(':checked') === true){
|
||||
min_w = 0;
|
||||
max_w = 0;
|
||||
}
|
||||
|
||||
if ($('#radius-percentage_critical').is(':checked') === true){
|
||||
min_c = 0;
|
||||
max_c = 0;
|
||||
}
|
||||
|
||||
paint_graph_status(
|
||||
min_w, max_w, min_c, max_c, inverse_w,
|
||||
inverse_c, error_w, error_c,
|
||||
legend_normal, legend_warning, legend_critical,
|
||||
message_error_warning, message_error_critical
|
||||
);
|
||||
}
|
||||
|
||||
/* ]]> */
|
||||
|
@ -171,7 +171,7 @@ foreach ($password_fields as $k => $p) {
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
if ($("#id_plugin").val() === 0) {
|
||||
if ($("#id_plugin").val() !== 0) {
|
||||
changePluginSelect();
|
||||
}
|
||||
});
|
||||
|
@ -256,7 +256,7 @@ $schedule = io_safe_output(
|
||||
|
||||
$data[0] = '';
|
||||
$data[0] .= html_print_input_hidden('schedule', $schedule, true);
|
||||
$data[0] .= '<div id="calendar_map"></div>';
|
||||
$data[0] .= '<div id="calendar_map" class="alert_view_calendar"></div>';
|
||||
|
||||
$data[1] = '';
|
||||
$table_conditions->data[] = $data;
|
||||
|
@ -115,6 +115,7 @@ $fields_available['module_status'] = __('Module Status');
|
||||
$fields_available['mini_severity'] = __('Severity mini');
|
||||
$fields_available['module_custom_id'] = __('Module custom ID');
|
||||
$fields_available['custom_data'] = __('Custom data');
|
||||
$fields_available['event_custom_id'] = __('Event Custom ID');
|
||||
|
||||
|
||||
// Remove fields already selected.
|
||||
|
@ -84,6 +84,9 @@ if (is_ajax() === true) {
|
||||
}
|
||||
|
||||
$group = db_get_row('tgrupo', 'id_grupo', $id_group);
|
||||
if (str_contains($group['icon'], '.png') === true) {
|
||||
$group['folder'] = 'groups_small/';
|
||||
}
|
||||
|
||||
echo json_encode($group);
|
||||
return;
|
||||
|
@ -1102,6 +1102,50 @@ switch ($action) {
|
||||
$period = $item['period'];
|
||||
break;
|
||||
|
||||
case 'vuls_severity_graph':
|
||||
$group = $item['id_group'];
|
||||
break;
|
||||
|
||||
case 'vuls_attack_complexity':
|
||||
$group = $item['id_group'];
|
||||
break;
|
||||
|
||||
case 'vuls_by_packages':
|
||||
$group = $item['id_group'];
|
||||
break;
|
||||
|
||||
case 'vuls_by_agent':
|
||||
$group = $item['id_group'];
|
||||
$es = json_decode($item['external_source'], true);
|
||||
$selected_agent_custom_field_filter = $es['agent_custom_field_filter'];
|
||||
$security_hardening_score = $es['security_hardening_score'];
|
||||
$vulnerabilities_status = $es['vulnerabilities_status'];
|
||||
$secmon_status = $es['secmon_status'];
|
||||
break;
|
||||
|
||||
case 'vuls_info_agent':
|
||||
$idAgent = $item['id_agent'];
|
||||
$es = json_decode($item['external_source'], true);
|
||||
$vul_package = $es['vul_package'];
|
||||
$vul_severity = $es['vul_severity'];
|
||||
$vul_ac = $es['vul_ac'];
|
||||
$vul_pr = $es['vul_pr'];
|
||||
$vul_ui = $es['vul_ui'];
|
||||
$vul_av = (empty($es['vul_av']) === true) ? 'all' : $es['vul_av'];
|
||||
break;
|
||||
|
||||
case 'top_n_agents_vuls':
|
||||
$group = $item['id_group'];
|
||||
$recursion = $item['recursion'];
|
||||
$top_n_value = (empty($item['top_n_value']) === true) ? 10 : $item['top_n_value'];
|
||||
break;
|
||||
|
||||
case 'top_n_vuls_count':
|
||||
$group = $item['id_group'];
|
||||
$recursion = $item['recursion'];
|
||||
$top_n_value = (empty($item['top_n_value']) === true) ? 10 : $item['top_n_value'];
|
||||
break;
|
||||
|
||||
default:
|
||||
// It's not possible.
|
||||
break;
|
||||
@ -4102,6 +4146,217 @@ if (is_metaconsole() === true) {
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_secmon_status" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
echo __('Secmon status');
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_select(
|
||||
[
|
||||
'all' => __('All'),
|
||||
'critical' => __('Critical'),
|
||||
'warning' => __('Warning'),
|
||||
],
|
||||
'secmon_status',
|
||||
$secmon_status,
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_security_hardening_score" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
echo __('Security hardening score');
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_select(
|
||||
[
|
||||
'all' => __('All'),
|
||||
'90' => __('< 90%'),
|
||||
'80' => __('< 80%'),
|
||||
'70' => __('< 70%'),
|
||||
'60' => __('< 60%'),
|
||||
'50' => __('< 50%'),
|
||||
'40' => __('< 40%'),
|
||||
'30' => __('< 30%'),
|
||||
'20' => __('< 20%'),
|
||||
'10' => __('< 10%'),
|
||||
],
|
||||
'security_hardening_score',
|
||||
(empty($security_hardening_score) === false) ? $security_hardening_score : 'all',
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_vulnerabilities_status" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
echo __('Vulnerabilities status');
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_select(
|
||||
[
|
||||
'all' => __('All'),
|
||||
'crit' => __('Critical'),
|
||||
'warn' => __('Warning'),
|
||||
],
|
||||
'vulnerabilities_status',
|
||||
$vulnerabilities_status,
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_vulnerabilities_packages" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
echo __('Package').ui_print_help_tip(__('Select a agent for load his packages.'), true);
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_select(
|
||||
[
|
||||
'all' => __('All'),
|
||||
],
|
||||
'vul_package',
|
||||
$vul_package,
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_vulnerabilities_severity" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
echo __('Severity');
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_select(
|
||||
[
|
||||
'all' => __('All'),
|
||||
'high' => __('High'),
|
||||
'low' => __('Low'),
|
||||
'none' => __('None'),
|
||||
],
|
||||
'vul_severity',
|
||||
$vul_severity,
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_vulnerabilities_ac" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
echo __('Attack Complexity');
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_select(
|
||||
[
|
||||
'all' => __('All'),
|
||||
'H' => __('High'),
|
||||
'L' => __('Low'),
|
||||
],
|
||||
'vul_ac',
|
||||
$vul_ac,
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_vulnerabilities_pr" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
echo __('Privileges Required');
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_select(
|
||||
[
|
||||
'all' => __('All'),
|
||||
'H' => __('High'),
|
||||
'L' => __('Low'),
|
||||
'N' => __('None'),
|
||||
],
|
||||
'vul_pr',
|
||||
$vul_pr,
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_vulnerabilities_ui" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
echo __('User Interaction');
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_select(
|
||||
[
|
||||
'all' => __('All'),
|
||||
'R' => __('Required'),
|
||||
'N' => __('None'),
|
||||
],
|
||||
'vul_ui',
|
||||
$vul_ui,
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_vulnerabilities_av" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
echo __('Attack vector');
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_select(
|
||||
[
|
||||
'all' => __('All'),
|
||||
'A' => __('Adjacent Network'),
|
||||
'L' => __('Local'),
|
||||
'N' => __('Network'),
|
||||
'P' => __('Physical'),
|
||||
],
|
||||
'vul_av',
|
||||
(empty($vul_av) === true) ? 'all' : $vul_av,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<tr id="row_status_check" class="datos">
|
||||
@ -5829,6 +6084,27 @@ $(document).ready (function () {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 'vuls_info_agent':
|
||||
if ($("#hidden-id_agent").val() == 0) {
|
||||
dialog_message('#message_no_agent');
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'top_n_agents_vuls':
|
||||
if ($("#text-max_items").val() == '') {
|
||||
dialog_message('#message_no_max_item');
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'top_n_vuls_count':
|
||||
if ($("#text-max_items").val() == '') {
|
||||
dialog_message('#message_no_max_item');
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -5983,7 +6259,24 @@ $(document).ready (function () {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'vuls_info_agent':
|
||||
if ($("#hidden-id_agent").val() == 0) {
|
||||
dialog_message('#message_no_agent');
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 'top_n_agents_vuls':
|
||||
if ($("#text-max_items").val() == '') {
|
||||
dialog_message('#message_no_max_item');
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 'top_n_vuls_count':
|
||||
if ($("#text-max_items").val() == '') {
|
||||
dialog_message('#message_no_max_item');
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -7047,6 +7340,15 @@ function chooseType() {
|
||||
$("#row_cat_security_hardening").hide();
|
||||
$("#row_ignore_skipped").hide();
|
||||
$("#row_status_check").hide();
|
||||
$("#row_secmon_status").hide();
|
||||
$("#row_security_hardening_score").hide();
|
||||
$("#row_vulnerabilities_status").hide();
|
||||
$("#row_vulnerabilities_packages").hide();
|
||||
$("#row_vulnerabilities_severity").hide();
|
||||
$("#row_vulnerabilities_ac").hide();
|
||||
$("#row_vulnerabilities_pr").hide();
|
||||
$("#row_vulnerabilities_ui").hide();
|
||||
$("#row_vulnerabilities_av").hide();
|
||||
|
||||
// SLA list default state.
|
||||
$("#sla_list").hide();
|
||||
@ -7958,6 +8260,50 @@ function chooseType() {
|
||||
$("#row_group").show();
|
||||
$('#row_period').show();
|
||||
break;
|
||||
|
||||
case 'vuls_severity_graph':
|
||||
$("#row_group").show();
|
||||
break;
|
||||
|
||||
case 'vuls_attack_complexity':
|
||||
$("#row_group").show();
|
||||
break;
|
||||
|
||||
case 'vuls_by_packages':
|
||||
$("#row_group").show();
|
||||
break;
|
||||
|
||||
case 'vuls_by_agent':
|
||||
$("#row_group").show();
|
||||
$("#row_custom_field_filter").show();
|
||||
$("#row_secmon_status").show();
|
||||
$("#row_security_hardening_score").show();
|
||||
$("#row_vulnerabilities_status").show();
|
||||
break;
|
||||
|
||||
case 'vuls_info_agent':
|
||||
$("#row_agent").show();
|
||||
$("#row_vulnerabilities_packages").show();
|
||||
$("#row_vulnerabilities_severity").show();
|
||||
$("#row_vulnerabilities_ac").show();
|
||||
$("#row_vulnerabilities_pr").show();
|
||||
$("#row_vulnerabilities_ui").show();
|
||||
$("#row_vulnerabilities_av").show();
|
||||
updatePackages();
|
||||
$('#row_agent input[type=text]').change(function(e) {
|
||||
updatePackages();
|
||||
});
|
||||
break;
|
||||
|
||||
case 'top_n_agents_vuls':
|
||||
$("#row_group").show();
|
||||
$("#row_max_items").show();
|
||||
break;
|
||||
|
||||
case 'top_n_vuls_count':
|
||||
$("#row_group").show();
|
||||
$("#row_max_items").show();
|
||||
break;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
@ -8200,6 +8546,46 @@ function control_period_range() {
|
||||
}, 800);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function updateSelect(element, fields, selected) {
|
||||
if (typeof fields === "object") {
|
||||
$(element).find("select").empty();
|
||||
$(element).find(".select2-container .select2-selection__rendered").empty();
|
||||
Object.keys(fields).forEach(function(key) {
|
||||
if (key === selected) {
|
||||
$(element).find(".select2-container .select2-selection__rendered").append(`${fields[key]}`);
|
||||
$(element).find("select").append(`<option value="${key}" selected>${fields[key]}</option>`);
|
||||
} else {
|
||||
$(element).find("select").append(`<option value="${key}">${fields[key]}</option>`);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function updatePackages() {
|
||||
let id_agent = $('#hidden-id_agent').val();
|
||||
let server_id = $('#hidden-server_id').val();
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "<?php echo ui_get_full_url('ajax.php'); ?>",
|
||||
data: {
|
||||
page: "<?php echo ENTERPRISE_DIR.'/include/ajax/vulnerabilities.ajax'; ?>",
|
||||
action: "updatePackages",
|
||||
id_agent: id_agent,
|
||||
server_id: server_id,
|
||||
},
|
||||
success: function(data) {
|
||||
const json = JSON.parse(data);
|
||||
if (json.success) {
|
||||
updateSelect("#row_vulnerabilities_packages", json.data, '<?php echo $vul_package; ?>');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$('[id^=period], #combo_graph_options, #combo_sla_sort_options').next().css('z-index', 0);
|
||||
|
||||
|
@ -2046,6 +2046,56 @@ switch ($action) {
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'vuls_severity_graph':
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'vuls_attack_complexity':
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'vuls_by_packages':
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'vuls_by_agent':
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
$es['agent_custom_field_filter'] = get_parameter('agent_custom_field_filter');
|
||||
$es['secmon_status'] = get_parameter('secmon_status');
|
||||
$es['security_hardening_score'] = get_parameter('security_hardening_score');
|
||||
$es['vulnerabilities_status'] = get_parameter('vulnerabilities_status');
|
||||
$values['external_source'] = json_encode($es);
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'vuls_info_agent':
|
||||
$values['id_agent'] = get_parameter('id_agent');
|
||||
$es['server_id'] = get_parameter('server_id');
|
||||
$es['vul_package'] = get_parameter('vul_package');
|
||||
$es['vul_severity'] = get_parameter('vul_severity');
|
||||
$es['vul_ac'] = get_parameter('vul_ac');
|
||||
$es['vul_pr'] = get_parameter('vul_pr');
|
||||
$es['vul_ui'] = get_parameter('vul_ui');
|
||||
$es['vul_av'] = get_parameter('vul_av');
|
||||
$values['external_source'] = json_encode($es);
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'top_n_agents_vuls':
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
$values['top_n_value'] = get_parameter('max_items');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'top_n_vuls_count':
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
$values['top_n_value'] = get_parameter('max_items');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
$values['period'] = get_parameter('period');
|
||||
$values['top_n'] = get_parameter(
|
||||
@ -2988,6 +3038,56 @@ switch ($action) {
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'vuls_severity_graph':
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'vuls_attack_complexity':
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'vuls_by_packages':
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'vuls_by_agent':
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
$es['agent_custom_field_filter'] = get_parameter('agent_custom_field_filter');
|
||||
$es['secmon_status'] = get_parameter('secmon_status');
|
||||
$es['security_hardening_score'] = get_parameter('security_hardening_score');
|
||||
$es['vulnerabilities_status'] = get_parameter('vulnerabilities_status');
|
||||
$values['external_source'] = json_encode($es);
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'vuls_info_agent':
|
||||
$values['id_agent'] = get_parameter('id_agent');
|
||||
$es['server_id'] = get_parameter('server_id');
|
||||
$es['vul_package'] = get_parameter('vul_package');
|
||||
$es['vul_severity'] = get_parameter('vul_severity');
|
||||
$es['vul_ac'] = get_parameter('vul_ac');
|
||||
$es['vul_pr'] = get_parameter('vul_pr');
|
||||
$es['vul_ui'] = get_parameter('vul_ui');
|
||||
$es['vul_av'] = get_parameter('vul_av');
|
||||
$values['external_source'] = json_encode($es);
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'top_n_agents_vuls':
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
$values['top_n_value'] = get_parameter('max_items');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'top_n_vuls_count':
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
$values['top_n_value'] = get_parameter('max_items');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
$values['period'] = get_parameter('period');
|
||||
$values['top_n'] = get_parameter(
|
||||
|
@ -163,7 +163,10 @@ switch ($activeTab) {
|
||||
$background_color = (string) get_parameter('background_color');
|
||||
$width = (int) get_parameter('width');
|
||||
$height = (int) get_parameter('height');
|
||||
$visualConsoleName = (string) io_safe_input(get_parameter('name'));
|
||||
$visualConsoleName = (string) get_parameter('name');
|
||||
$visualConsoleName = str_replace('<', '', $visualConsoleName);
|
||||
$visualConsoleName = str_replace('>', '', $visualConsoleName);
|
||||
$visualConsoleName = (string) io_safe_input($visualConsoleName);
|
||||
$is_favourite = (int) get_parameter('is_favourite_sent');
|
||||
$auto_adjust = (int) get_parameter('auto_adjust_sent');
|
||||
|
||||
|
@ -860,8 +860,10 @@ if (empty($create) === false || empty($view) === false) {
|
||||
if ($management_allowed === false) {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'This console is not manager of this environment,
|
||||
please manage this feature from centralized manager console (Metaconsole).'
|
||||
'This console is not manager of this environment, please manage this feature from feature from %s.',
|
||||
'<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=godmode/servers/plugin_registration&tab=plugin_registration&pure=0'
|
||||
).'">'.__('metaconsole').'</a>'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ foreach ($servers as $server) {
|
||||
}
|
||||
|
||||
$data[7] = '';
|
||||
if ($server['queued_modules'] > 500) {
|
||||
if ($server['queued_modules'] >= $config['number_modules_queue']) {
|
||||
$data[7] .= '<div class="inline"><a onclick="show_dialog();" >'.html_print_image(
|
||||
'images/info-warning.svg',
|
||||
true,
|
||||
@ -276,7 +276,7 @@ foreach ($servers as $server) {
|
||||
$data[9] .= '</a>';
|
||||
|
||||
if (($names_servers[$safe_server_name] === true) && ($ext === '_server' || $server['type'] === 'enterprise satellite')) {
|
||||
$data[9] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext.'&tab=agent_editor').'">';
|
||||
$data[9] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext.'&tab=advanced_editor').'">';
|
||||
$data[9] .= html_print_image(
|
||||
'images/agents@svg.svg',
|
||||
true,
|
||||
|
@ -54,8 +54,12 @@ if (isset($_POST['create'])) {
|
||||
if (! $result) {
|
||||
ui_print_error_message(__('There was a problem creating link'));
|
||||
} else {
|
||||
ui_print_success_message(__('Successfully created'));
|
||||
$id_link = $result;
|
||||
ui_print_result_message(
|
||||
$id_link,
|
||||
__('Successfully created'),
|
||||
__('Could not be created')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,8 +115,8 @@ if ((isset($_GET['form_add'])) or (isset($_GET['form_edit']))) {
|
||||
$link = '';
|
||||
}
|
||||
|
||||
echo '<table class="databox filters filter-table-adv max_floating_element_size" cellpadding="4" cellspacing="4" width="100%">';
|
||||
echo '<form name="ilink" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/links">';
|
||||
echo '<table class="databox filters filter-table-adv max_floating_element_size" cellpadding="4" cellspacing="4" width="100%">';
|
||||
if ($creation_mode == 1) {
|
||||
echo "<input type='hidden' name='create' value='1'>";
|
||||
} else {
|
||||
@ -179,10 +183,10 @@ if ((isset($_GET['form_add'])) or (isset($_GET['form_edit']))) {
|
||||
)
|
||||
);
|
||||
|
||||
echo '</form></td></tr></table>';
|
||||
echo '</td></tr></table></form>';
|
||||
} else {
|
||||
// Main list view for Links editor
|
||||
$rows = db_get_all_rows_in_table('tlink', 'name');
|
||||
// Main list view for Links editor.
|
||||
$rows = db_get_all_fields_in_table('tlink', '', '', 'name');
|
||||
if ($rows === false) {
|
||||
$rows = [];
|
||||
}
|
||||
|
@ -187,7 +187,8 @@ $button_test .= ' <span id="ITSM-message" class="invisible"></span>';
|
||||
|
||||
$row['control'] = html_print_label_input_block(
|
||||
__('Test connection pandora to ITSM'),
|
||||
$button_test
|
||||
$button_test,
|
||||
['div_class' => 'ITSM-remote-setup-ITSM_token']
|
||||
);
|
||||
$table_remote->data['ITSM_test'] = $row;
|
||||
|
||||
|
@ -405,19 +405,6 @@ $table->data[$i++][] = html_print_label_input_block(
|
||||
|
||||
|
||||
$table->data[$i][] = html_print_label_input_block(
|
||||
__('Enable Sflow'),
|
||||
html_print_checkbox_switch_extended(
|
||||
'activate_sflow',
|
||||
1,
|
||||
$config['activate_sflow'],
|
||||
$rbt_disabled,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
),
|
||||
);
|
||||
|
||||
$table->data[$i++][] = html_print_label_input_block(
|
||||
__('General network path'),
|
||||
html_print_input_text(
|
||||
'general_network_path',
|
||||
@ -733,7 +720,7 @@ $table->data[$i++][] = html_print_label_input_block(
|
||||
);
|
||||
|
||||
$help_tip = ui_print_help_tip(
|
||||
__('If there are any "In process" events with a specific Extra ID and a New event with that Extra ID is received, it will be created as "In process" instead.'),
|
||||
__('If there are any "In process" events with a specific Extra ID and a New event with that Extra ID is received, it will be created as "In process" instead. The new events also inherit Event Custom ID'),
|
||||
true
|
||||
);
|
||||
|
||||
@ -766,6 +753,16 @@ $table->data[$i][] = html_print_label_input_block(
|
||||
true
|
||||
)
|
||||
);
|
||||
$table->data[$i++][] = html_print_label_input_block(
|
||||
__('Number of modules in queue'),
|
||||
html_print_input_number(
|
||||
[
|
||||
'name' => 'number_modules_queue',
|
||||
'min' => 0,
|
||||
'value' => $config['number_modules_queue'],
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
echo '<form class="max_floating_element_size" id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&section=general&pure='.$config['pure'].'">';
|
||||
|
@ -83,6 +83,19 @@ $table->data[3][] = html_print_label_input_block(
|
||||
html_print_checkbox_switch_extended('netflow_get_ip_hostname', 1, $config['netflow_get_ip_hostname'], false, $onclick, '', true)
|
||||
);
|
||||
|
||||
$table->data[4][] = html_print_label_input_block(
|
||||
__('Enable Sflow'),
|
||||
html_print_checkbox_switch_extended(
|
||||
'activate_sflow',
|
||||
1,
|
||||
$config['activate_sflow'],
|
||||
$rbt_disabled,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
),
|
||||
);
|
||||
|
||||
echo '<form class="max_floating_element_size" id="netflow_setup" method="post">';
|
||||
html_print_table($table);
|
||||
html_print_input_hidden('update_config', 1);
|
||||
|
@ -61,7 +61,7 @@ $license = db_get_value(
|
||||
);
|
||||
|
||||
if (isset($config['lts_updates']) === false) {
|
||||
$config['lts_updates'] = false;
|
||||
$config['lts_updates'] = true;
|
||||
}
|
||||
|
||||
if (empty($license) === true) {
|
||||
|
111
pandora_console/godmode/update_manager/modal_lts_update.php
Normal file
111
pandora_console/godmode/update_manager/modal_lts_update.php
Normal file
@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/**
|
||||
* Modal LTS versions update manager.
|
||||
*
|
||||
* @category Update Manager
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2023 Pandora FMS
|
||||
* Please see https://pandorafms.com/community/ for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
// The ajax is in include/ajax/update_manager.php.
|
||||
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access Setup Management'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
require_once $config['homedir'].'/vendor/autoload.php';
|
||||
|
||||
$php_version = phpversion();
|
||||
$php_version_array = explode('.', $php_version);
|
||||
if ($php_version_array[0] < 7) {
|
||||
include_once 'general/php_message.php';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- Lts Updates. -->
|
||||
<div id="lts-updates" title="
|
||||
<?php echo __('LTS versions'); ?>
|
||||
" class="invisible">
|
||||
<div style="display: flex; justify-content: space-between">
|
||||
<div style="width: 250px; padding: 36px">
|
||||
<?php
|
||||
echo html_print_image(
|
||||
'images/info-warning.svg',
|
||||
true,
|
||||
[ 'style' => 'padding-top: 30px' ]
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<div style="padding: 5px 90px 5px 5px;">
|
||||
<p class="lato font_10pt bolder">
|
||||
<?php
|
||||
echo __('There are two types of versions in Pandora FMS: the LTS versions (Long-Term Support), e.g: 772 LTS, and the RRR (Regular Rolling Release) versions, e.g: 771, 773, 774, 775.');
|
||||
?>
|
||||
</p>
|
||||
<p class="lato font_10pt bolder">
|
||||
<?php
|
||||
echo __('LTS versions have frequent, periodic updates (fixes), correcting both security problems and critical bugs detected in the tool. These are the versions we recommend to use in production environments.');
|
||||
?>
|
||||
</p>
|
||||
<p class="lato font_10pt bolder">
|
||||
<?php
|
||||
echo __('RRR versions incorporate new features in each version, as well as bug fixes, but due to their dynamic nature, errors are more likely.');
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
// Lts Updates.
|
||||
$("#lts-updates").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
width: 740,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
closeOnEscape: true,
|
||||
buttons: [{
|
||||
text: "OK",
|
||||
click: function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}],
|
||||
open: function(event, ui) {
|
||||
$(".ui-dialog-titlebar-close").hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
@ -119,11 +119,13 @@ switch ($tab) {
|
||||
|
||||
case 'setup':
|
||||
include $config['homedir'].'/godmode/update_manager/update_manager.setup.php';
|
||||
include $config['homedir'].'/godmode/update_manager/modal_lts_update.php';
|
||||
break;
|
||||
|
||||
case 'offline':
|
||||
$mode = \UpdateManager\UI\Manager::MODE_OFFLINE;
|
||||
include $config['homedir'].'/godmode/um_client/index.php';
|
||||
include $config['homedir'].'/godmode/update_manager/modal_lts_update.php';
|
||||
break;
|
||||
|
||||
case 'online':
|
||||
@ -163,5 +165,6 @@ switch ($tab) {
|
||||
|
||||
$mode = \UpdateManager\UI\Manager::MODE_ONLINE;
|
||||
include $config['homedir'].'/godmode/um_client/index.php';
|
||||
include $config['homedir'].'/godmode/update_manager/modal_lts_update.php';
|
||||
break;
|
||||
}
|
||||
|
@ -63,6 +63,10 @@ if (users_is_admin()) {
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($config['lts_updates']) === false) {
|
||||
config_update_value('lts_updates', 1);
|
||||
}
|
||||
|
||||
if (!$action_update_url_update_manager) {
|
||||
$url_update_manager = get_parameter(
|
||||
'url_update_manager',
|
||||
|
@ -424,8 +424,10 @@ if ($create_user === true) {
|
||||
$values['data_section'] = $dashboard;
|
||||
} else if (io_safe_output($values['section']) === HOME_SCREEN_VISUAL_CONSOLE) {
|
||||
$values['data_section'] = $visual_console;
|
||||
} else if ($values['section'] === HOME_SCREEN_OTHER || io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) {
|
||||
$values['data_section'] = get_parameter('data_section');
|
||||
} else if ($values['section'] === HOME_SCREEN_OTHER) {
|
||||
$values['data_section'] = get_parameter('data_section_other');
|
||||
} else if (io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) {
|
||||
$values['data_section'] = get_parameter('data_section_external');
|
||||
}
|
||||
|
||||
// $values['section'] = $homeScreenValues[$values['section']];
|
||||
@ -672,8 +674,11 @@ if ($update_user) {
|
||||
$values['email'] = (string) get_parameter('email');
|
||||
$values['phone'] = (string) get_parameter('phone');
|
||||
$values['comments'] = io_safe_input(strip_tags(io_safe_output((string) get_parameter('comments'))));
|
||||
$values['allowed_ip_active'] = ((int) get_parameter('allowed_ip_active', -1) === 0);
|
||||
$values['allowed_ip_list'] = io_safe_input(strip_tags(io_safe_output((string) get_parameter('allowed_ip_list'))));
|
||||
if (users_is_admin($config['id_user']) === true || (bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
$values['allowed_ip_active'] = ((int) get_parameter('allowed_ip_active', -1) === 0);
|
||||
$values['allowed_ip_list'] = io_safe_input(strip_tags(io_safe_output((string) get_parameter('allowed_ip_list'))));
|
||||
}
|
||||
|
||||
$values['is_admin'] = (get_parameter('is_admin', 0) === 0) ? 0 : 1;
|
||||
$values['language'] = (string) get_parameter('language');
|
||||
$values['timezone'] = (string) get_parameter('timezone');
|
||||
@ -719,8 +724,10 @@ if ($update_user) {
|
||||
$values['data_section'] = $dashboard;
|
||||
} else if (io_safe_output($values['section']) === HOME_SCREEN_VISUAL_CONSOLE) {
|
||||
$values['data_section'] = $visual_console;
|
||||
} else if ($values['section'] === HOME_SCREEN_OTHER || io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) {
|
||||
$values['data_section'] = get_parameter('data_section');
|
||||
} else if ($values['section'] === HOME_SCREEN_OTHER) {
|
||||
$values['data_section'] = get_parameter('data_section_other');
|
||||
} else if (io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) {
|
||||
$values['data_section'] = get_parameter('data_section_external');
|
||||
}
|
||||
|
||||
// $values['section'] = $homeScreenValues[$values['section']];
|
||||
|
@ -81,6 +81,11 @@ $customHomeScreenAddition[HOME_SCREEN_DASHBOARD] = html_print_select(
|
||||
false,
|
||||
'width: 100%'
|
||||
);
|
||||
// Home screen. Visual consoles.
|
||||
$customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select($layouts_aux, 'visual_console', $user_info['data_section'], '', '', '', true, false, true, 'w100p', false, 'width: 100%');
|
||||
// Home screen. External link and Other.
|
||||
$customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text('data_section_external', $user_info['data_section'], '', 60, 255, true);
|
||||
$customHomeScreenAddition[HOME_SCREEN_OTHER] = html_print_input_text('data_section_other', $user_info['data_section'], '', 60, 255, true);
|
||||
|
||||
$layouts = visual_map_get_user_layouts($config['id_user'], true);
|
||||
$layouts_aux = [];
|
||||
@ -859,50 +864,56 @@ $userManagementTable->data['fields_addSettings'][0] = html_print_textarea(
|
||||
''
|
||||
);
|
||||
|
||||
$userManagementTable->data['captions_addSettings'][1] = __('Login allowed IP list');
|
||||
$userManagementTable->data['fields_addSettings'][1] = html_print_div(
|
||||
[
|
||||
'class' => 'edit_user_allowed_ip',
|
||||
'content' => html_print_textarea(
|
||||
'allowed_ip_list',
|
||||
5,
|
||||
65,
|
||||
($user_info['allowed_ip_list'] ?? ''),
|
||||
(((bool) $view_mode === true) ? 'readonly="readonly"' : ''),
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
if (users_is_admin($config['id_user']) === true || (bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
$allowAllIpsContent = [];
|
||||
$allowAllIpsContent[] = '<span>'.__('Enable IP allowlist').'</span>';
|
||||
$allowAllIpsContent[] = html_print_div(
|
||||
[
|
||||
'content' => html_print_checkbox_switch(
|
||||
'allowed_ip_active',
|
||||
0,
|
||||
($user_info['allowed_ip_active'] ?? 0),
|
||||
true,
|
||||
false,
|
||||
'handleIpAllowlist(this)'
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$userManagementTable->data['fields_addSettings'][1] .= ui_print_input_placeholder(
|
||||
__('Add the source IPs that will allow console access. Each IP must be separated only by comma. * allows all.'),
|
||||
true
|
||||
);
|
||||
$userManagementTable->data['captions_addSettings'][1] = html_print_div(
|
||||
[
|
||||
'class' => 'margin-top-10',
|
||||
'style' => 'display: flex; flex-direction: row-reverse; align-items: center;',
|
||||
'content' => implode('', $allowAllIpsContent),
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$allowAllIpsContent = [];
|
||||
$allowAllIpsContent[] = '<span>'.__('Allow all IPs').'</span>';
|
||||
$allowAllIpsContent[] = html_print_div(
|
||||
[
|
||||
'content' => html_print_checkbox_switch(
|
||||
'allowed_ip_active',
|
||||
0,
|
||||
($user_info['allowed_ip_active'] ?? 0),
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$userManagementTable->data['fields_addSettings'][1] .= html_print_div(
|
||||
[
|
||||
'class' => 'margin-top-10',
|
||||
'style' => 'display: flex; flex-direction: row-reverse; align-items: center;',
|
||||
'content' => implode('', $allowAllIpsContent),
|
||||
],
|
||||
true
|
||||
);
|
||||
$userManagementTable->data['fields_addSettings'][1] .= html_print_div(
|
||||
[
|
||||
'class' => 'edit_user_allowed_ip '.(((int) $user_info['allowed_ip_active'] === 1) ? '' : 'invisible'),
|
||||
'content' => html_print_textarea(
|
||||
'allowed_ip_list',
|
||||
5,
|
||||
65,
|
||||
($user_info['allowed_ip_list'] ?? ''),
|
||||
(((bool) $view_mode === true) ? 'readonly="readonly"' : ''),
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$userManagementTable->data['fields_addSettings'][1] .= ui_print_input_placeholder(
|
||||
__('Add the source IPs that will allow console access. Each IP must be separated only by comma. * allows all.'),
|
||||
true,
|
||||
[
|
||||
'id' => 'info_allowed_ip',
|
||||
'class' => ((int) $user_info['allowed_ip_active'] === 1) ? 'input_sub_placeholder' : 'input_sub_placeholder invisible',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
if ($config['ITSM_enabled'] && $config['ITSM_user_level_conf']) {
|
||||
// Pandora ITSM user remote login.
|
||||
@ -1040,4 +1051,14 @@ $(document).ready(function () {
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
function handleIpAllowlist(e){
|
||||
if(e.checked === true) {
|
||||
$('.edit_user_allowed_ip').show();
|
||||
$('#info_allowed_ip').show();
|
||||
} else {
|
||||
$('.edit_user_allowed_ip').hide();
|
||||
$('#info_allowed_ip').hide();
|
||||
}
|
||||
}
|
||||
</script>
|
14
pandora_console/images/desacoplar-ventana.svg
Normal file
14
pandora_console/images/desacoplar-ventana.svg
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Icons/Dark/20/desacoplar-ventana</title>
|
||||
<g id="Icons/Dark/20/desacoplar-ventana" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="Back" transform="translate(3, 1)">
|
||||
<rect id="Rectangle-2" stroke="#3F3F3F" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x="0" y="0" width="20" height="16" rx="1"></rect>
|
||||
<path d="M3,4 C3.55228475,4 4,3.55228475 4,3 C4,2.44771525 3.55228475,2 3,2 C2.44771525,2 2,2.44771525 2,3 C2,3.55228475 2.44771525,4 3,4 Z M6,4 C6.55228475,4 7,3.55228475 7,3 C7,2.44771525 6.55228475,2 6,2 C5.44771525,2 5,2.44771525 5,3 C5,3.55228475 5.44771525,4 6,4 Z M9,4 C9.55228475,4 10,3.55228475 10,3 C10,2.44771525 9.55228475,2 9,2 C8.44771525,2 8,2.44771525 8,3 C8,3.55228475 8.44771525,4 9,4 Z" id="Oval-2" fill="#3F3F3F"></path>
|
||||
</g>
|
||||
<g id="Front" transform="translate(0, 8)">
|
||||
<rect id="Rectangle-2" fill="#3F3F3F" x="0" y="0" width="20" height="16" rx="1"></rect>
|
||||
<path d="M3,4 C3.55228475,4 4,3.55228475 4,3 C4,2.44771525 3.55228475,2 3,2 C2.44771525,2 2,2.44771525 2,3 C2,3.55228475 2.44771525,4 3,4 Z M6,4 C6.55228475,4 7,3.55228475 7,3 C7,2.44771525 6.55228475,2 6,2 C5.44771525,2 5,2.44771525 5,3 C5,3.55228475 5.44771525,4 6,4 Z M9,4 C9.55228475,4 10,3.55228475 10,3 C10,2.44771525 9.55228475,2 9,2 C8.44771525,2 8,2.44771525 8,3 C8,3.55228475 8.44771525,4 9,4 Z" id="Oval-2" fill="#FFFFFF"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.6 KiB |
7
pandora_console/images/minimizar.svg
Normal file
7
pandora_console/images/minimizar.svg
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Icons/Dark/20/minimizar</title>
|
||||
<g id="Icons/Dark/20/minimizar" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<rect id="Rectangle" fill="#3F3F3F" x="2" y="18" width="20" height="4" rx="2"></rect>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 436 B |
@ -435,6 +435,7 @@ if ($get_agent_alerts_datatable === true) {
|
||||
}
|
||||
|
||||
$idGroup = $filter_alert['ag_group'];
|
||||
$search_sg = $filter_alert['search_sg'];
|
||||
$tag_filter = $filter_alert['tag'];
|
||||
$action_filter = $filter_alert['action'];
|
||||
|
||||
@ -658,10 +659,9 @@ if ($get_agent_alerts_datatable === true) {
|
||||
$id_groups = array_keys(
|
||||
users_get_groups($config['id_user'], 'AR', false)
|
||||
);
|
||||
$alerts['alerts_simple'] = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter, $search_sg);
|
||||
|
||||
$alerts['alerts_simple'] = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter);
|
||||
|
||||
$countAlertsSimple = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter);
|
||||
$countAlertsSimple = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter, $search_sg);
|
||||
}
|
||||
} else {
|
||||
if ($idAgent !== 0) {
|
||||
@ -673,9 +673,9 @@ if ($get_agent_alerts_datatable === true) {
|
||||
users_get_groups($config['id_user'], $access, false)
|
||||
);
|
||||
|
||||
$alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter, false);
|
||||
$alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter, false, $search_sg);
|
||||
|
||||
$countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter, false);
|
||||
$countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter, false, $search_sg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,6 +92,7 @@ $get_id_source_event = get_parameter('get_id_source_event');
|
||||
$node_id = (int) get_parameter('node_id', 0);
|
||||
$settings_modal = get_parameter('settings', 0);
|
||||
$parameters_modal = get_parameter('parameters', 0);
|
||||
$update_event_custom_id = get_parameter('update_event_custom_id', 0);
|
||||
$draw_events_graph = get_parameter('drawEventsGraph', false);
|
||||
|
||||
// User private filter.
|
||||
@ -313,6 +314,7 @@ if ($save_event_filter) {
|
||||
$values['severity'] = implode(',', get_parameter('severity', -1));
|
||||
$values['status'] = get_parameter('status');
|
||||
$values['search'] = get_parameter('search');
|
||||
$values['regex'] = get_parameter('regex');
|
||||
$values['not_search'] = get_parameter('not_search');
|
||||
$values['text_agent'] = get_parameter('text_agent');
|
||||
$values['id_agent'] = get_parameter('id_agent');
|
||||
@ -381,6 +383,7 @@ if ($update_event_filter) {
|
||||
$values['severity'] = implode(',', get_parameter('severity', -1));
|
||||
$values['status'] = get_parameter('status');
|
||||
$values['search'] = get_parameter('search');
|
||||
$values['regex'] = get_parameter('regex');
|
||||
$values['not_search'] = get_parameter('not_search');
|
||||
$values['text_agent'] = get_parameter('text_agent');
|
||||
$values['id_agent'] = get_parameter('id_agent');
|
||||
@ -640,6 +643,8 @@ function load_form_filter() {
|
||||
$("#status").val(val);
|
||||
if (i == 'search')
|
||||
$('#text-search').val(val);
|
||||
if (i == 'regex')
|
||||
$('#text-regex').val(val);
|
||||
if (i == 'not_search')
|
||||
$('#checkbox-not_search').val(val);
|
||||
if (i == 'text_agent')
|
||||
@ -970,6 +975,7 @@ function save_new_filter() {
|
||||
"severity" : $("#severity").val(),
|
||||
"status" : $("#status").val(),
|
||||
"search" : $("#text-search").val(),
|
||||
"regex" : $('#text-regex').val(),
|
||||
"not_search" : $("#checkbox-not_search").val(),
|
||||
"text_agent" : $("#text_id_agent").val(),
|
||||
"id_agent" : $('input:hidden[name=id_agent]').val(),
|
||||
@ -1050,6 +1056,7 @@ function save_update_filter() {
|
||||
"severity" : $("#severity").val(),
|
||||
"status" : $("#status").val(),
|
||||
"search" : $("#text-search").val(),
|
||||
"regex" : $('#text-regex').val(),
|
||||
"not_search" : $("#checkbox-not_search").val(),
|
||||
"text_agent" : $("#text_id_agent").val(),
|
||||
"id_agent" : $('input:hidden[name=id_agent]').val(),
|
||||
@ -2644,6 +2651,8 @@ if ($get_events_fired) {
|
||||
$filter['date_to'] = date('Y-m-d', $end);
|
||||
$filter['time_from'] = date('H:i:s', $start);
|
||||
$filter['time_to'] = date('H:i:s', $end);
|
||||
$filter['severity'] = explode(',', $filter['severity']);
|
||||
|
||||
$data = events_get_all(
|
||||
['te.*'],
|
||||
$filter
|
||||
@ -2754,6 +2763,52 @@ if ($draw_row_response_info === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($update_event_custom_id) {
|
||||
$event_custom_id = get_parameter('event_custom_id');
|
||||
$event_id = get_parameter('event_id');
|
||||
$server_id = 0;
|
||||
if (is_metaconsole() === true) {
|
||||
$server_id = (int) get_parameter('server_id');
|
||||
}
|
||||
|
||||
// Safe custom fields for hacks.
|
||||
if (preg_match('/script/i', io_safe_output($event_custom_id))) {
|
||||
$return = false;
|
||||
} else {
|
||||
try {
|
||||
if (is_metaconsole() === true
|
||||
&& $server_id > 0
|
||||
) {
|
||||
$node = new Node($server_id);
|
||||
$node->connect();
|
||||
}
|
||||
|
||||
$return = events_event_custom_id(
|
||||
$event_id,
|
||||
$event_custom_id
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
// Unexistent agent.
|
||||
if (is_metaconsole() === true
|
||||
&& $server_id > 0
|
||||
) {
|
||||
$node->disconnect();
|
||||
}
|
||||
|
||||
$return = false;
|
||||
} finally {
|
||||
if (is_metaconsole() === true
|
||||
&& $server_id > 0
|
||||
) {
|
||||
$node->disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo ($return === true) ? 'update_ok' : 'update_error';
|
||||
return;
|
||||
}
|
||||
|
||||
if ((bool) $draw_events_graph === true) {
|
||||
$filter = get_parameter('filter');
|
||||
$output = event_print_graph($filter);
|
||||
|
@ -35,6 +35,7 @@ if (check_login()) {
|
||||
include_once $config['homedir'].'/include/functions_agents.php';
|
||||
include_once $config['homedir'].'/include/functions_modules.php';
|
||||
include_once $config['homedir'].'/include/functions_ui.php';
|
||||
include_once $config['homedir'].'/include/functions_macros.php';
|
||||
enterprise_include_once('include/functions_metaconsole.php');
|
||||
|
||||
$get_plugin_macros = get_parameter('get_plugin_macros');
|
||||
@ -1206,7 +1207,23 @@ if (check_login()) {
|
||||
);
|
||||
|
||||
if (strlen($module['ip_target']) !== 0) {
|
||||
$title .= '<br/>IP: '.$module['ip_target'];
|
||||
// Check if value is custom field.
|
||||
if ($module['ip_target'][0] == '_' && $module['ip_target'][(strlen($module['ip_target']) - 1)] == '_') {
|
||||
$custom_field_name = substr($module['ip_target'], 1, -1);
|
||||
$custom_value = agents_get_agent_custom_field($id_agente, $custom_field_name);
|
||||
if (isset($custom_value) && $custom_value !== false) {
|
||||
$title .= '<br/>IP: '.$custom_value;
|
||||
} else {
|
||||
$array_macros = return_agent_macros($id_agente);
|
||||
if (isset($array_macros[$module['ip_target']])) {
|
||||
$title .= '<br/>IP: '.$array_macros[$module['ip_target']];
|
||||
} else {
|
||||
$title .= '<br/>IP: '.$module['ip_target'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$title .= '<br/>IP: '.$module['ip_target'];
|
||||
}
|
||||
}
|
||||
|
||||
$last_status_change_text = __('Time elapsed since last status change: ');
|
||||
|
@ -1,324 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Generate charts with given parameters.
|
||||
*
|
||||
* @category ChartGenerator.
|
||||
* @package Pandora FMS
|
||||
* @subpackage Opensource.
|
||||
* @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.
|
||||
require_once __DIR__.'/config.php';
|
||||
require_once __DIR__.'/functions.php';
|
||||
require_once __DIR__.'/functions_db.php';
|
||||
require_once __DIR__.'/auth/mysql.php';
|
||||
require_once $config['homedir'].'/include/lib/User.php';
|
||||
require_once $config['homedir'].'/include/functions_reporting.php';
|
||||
require_once $config['homedir'].'/include/functions_graph.php';
|
||||
require_once $config['homedir'].'/include/functions_custom_graphs.php';
|
||||
require_once $config['homedir'].'/include/functions_modules.php';
|
||||
require_once $config['homedir'].'/include/functions_agents.php';
|
||||
require_once $config['homedir'].'/include/functions_tags.php';
|
||||
|
||||
$data_raw = get_parameter('data');
|
||||
$data_decoded = json_decode(io_safe_output($data_raw), true);
|
||||
if (json_last_error() === JSON_ERROR_NONE) {
|
||||
$data = $data_decoded['data'];
|
||||
$session_id = $data_decoded['session_id'];
|
||||
$type_graph_pdf = $data_decoded['type_graph_pdf'];
|
||||
$id_user = $data_decoded['id_user'];
|
||||
$slicebar = $data_decoded['slicebar'];
|
||||
$slicebar_value = $data_decoded['slicebar_value'];
|
||||
|
||||
$data_combined = [];
|
||||
if (isset($data_decoded['data_combined']) === true) {
|
||||
$data_combined = $data_decoded['data_combined'];
|
||||
}
|
||||
|
||||
$data_module_list = [];
|
||||
if (isset($data_decoded['data_module_list']) === true) {
|
||||
$data_module_list = $data_decoded['data_module_list'];
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize session.
|
||||
global $config;
|
||||
|
||||
// Care whit this!!! check_login not working if you remove this.
|
||||
$config['id_user'] = $id_user;
|
||||
$_SESSION['id_usuario'] = $id_user;
|
||||
|
||||
// Checks for server api req.
|
||||
$bypassLogin = false;
|
||||
if ($data_decoded['apipass'] !== null
|
||||
&& ($config['server_unique_identifier'] === $_SESSION['id_usuario'])
|
||||
) {
|
||||
$apiPassword = io_output_password(
|
||||
db_get_value_filter(
|
||||
'value',
|
||||
'tconfig',
|
||||
['token' => 'api_password']
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
if ($apiPassword === $data_decoded['apipass']) {
|
||||
$bypassLogin = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($config[$slicebar])) {
|
||||
$config[$slicebar] = $slicebar_value;
|
||||
}
|
||||
|
||||
// Try to initialize session using existing php session id.
|
||||
$user = new PandoraFMS\User(['phpsessionid' => $session_id]);
|
||||
|
||||
if (check_login(false) === false && $bypassLogin !== true) {
|
||||
// Error handler.
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Access denied</title>
|
||||
<link rel="stylesheet" href="styles/pandora.css?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
||||
<link rel="stylesheet" href="styles/pandora_minimal.css?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
||||
<link rel="stylesheet" href="styles/js/jquery-ui.min.css?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
||||
<link rel="stylesheet" href="styles/js/jquery-ui_custom.css?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
||||
<script language="javascript" type='text/javascript' src='javascript/pandora.js?v=<?php echo $config['current_package']; ?>'></script>
|
||||
<script language="javascript" type='text/javascript' src='javascript/pandora_ui.js?v=<?php echo $config['current_package']; ?>'></script>
|
||||
<script language="javascript" type='text/javascript' src='javascript/jquery.current.js?v=<?php echo $config['current_package']; ?>'></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Access is not granted</h1>
|
||||
<div id="container-chart-generator-item" style="display:none; margin:0px;width:100px;height:100px;">
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
exit;
|
||||
}
|
||||
|
||||
// Access granted.
|
||||
$params = $data;
|
||||
if (isset($params['backgroundColor']) === false) {
|
||||
$params['backgroundColor'] = 'inherit';
|
||||
}
|
||||
|
||||
// Metaconsole connection to the node.
|
||||
$server_id = 0;
|
||||
if (isset($params['server_id']) === true) {
|
||||
$server_id = $params['server_id'];
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true && empty($server_id) === false) {
|
||||
$server = metaconsole_get_connection_by_id($server_id);
|
||||
// Error connecting.
|
||||
if (metaconsole_connect($server) !== NOERR) {
|
||||
?>
|
||||
<html>
|
||||
<body>
|
||||
<?php
|
||||
ui_print_error_message(
|
||||
__('There was a problem connecting with the node')
|
||||
);
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$user_language = get_user_language($config['id_user']);
|
||||
if (file_exists('languages/'.$user_language.'.mo') === true) {
|
||||
$cfr = new CachedFileReader('languages/'.$user_language.'.mo');
|
||||
$l10n = new gettext_reader($cfr);
|
||||
$l10n->load_tables();
|
||||
}
|
||||
|
||||
$hack_metaconsole = (is_metaconsole() === true) ? '../../' : '';
|
||||
?>
|
||||
<!DOCTYPE>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Pandora FMS Graph</title>
|
||||
<link rel="stylesheet" href="<?php echo ui_get_full_url($hack_metaconsole.'include/styles/pandora.css'); ?>?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
||||
<link rel="stylesheet" href="<?php echo ui_get_full_url($hack_metaconsole.'include/styles/pandora_minimal.css'); ?>?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
||||
<link rel="stylesheet" href="<?php echo ui_get_full_url($hack_metaconsole.'include/styles/js/jquery-ui.min.css'); ?>?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
||||
<link rel="stylesheet" href="<?php echo ui_get_full_url($hack_metaconsole.'include/styles/js/jquery-ui_custom.css'); ?>?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
||||
<script language="javascript" type='text/javascript' src='<?php echo ui_get_full_url($hack_metaconsole.'include/javascript/pandora_ui.js'); ?>?v=<?php echo $config['current_package']; ?>'></script>
|
||||
<script language="javascript" type='text/javascript' src='<?php echo ui_get_full_url($hack_metaconsole.'include/javascript/jquery.current.js'); ?>?v=<?php echo $config['current_package']; ?>'></script>
|
||||
<script language="javascript" type='text/javascript' src='<?php echo ui_get_full_url($hack_metaconsole.'include/javascript/jquery.pandora.js'); ?>?v=<?php echo $config['current_package']; ?>'></script>
|
||||
<script language="javascript" type='text/javascript' src='<?php echo ui_get_full_url($hack_metaconsole.'include/javascript/jquery-ui.min.js'); ?>?v=<?php echo $config['current_package']; ?>'></script>
|
||||
<script language="javascript" type='text/javascript' src='<?php echo ui_get_full_url($hack_metaconsole.'include/javascript/pandora.js'); ?>?v=<?php echo $config['current_package']; ?>'></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.time.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.pie.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.crosshair.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.stack.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.selection.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.resize.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.threshold.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.threshold.multiple.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.symbol.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.exportdata.pandora.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.axislabels.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script type="text/javascript">
|
||||
var phpTimezone = "<?php echo date_default_timezone_get(); ?>";
|
||||
</script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/pandora.flot.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/chartjs/chart.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/chartjs/chartjs-plugin-datalabels.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
</head>
|
||||
<body style='width:794px; margin: 0px; background-color: <?php echo $params['backgroundColor']; ?>;'>
|
||||
<?php
|
||||
$params['only_image'] = false;
|
||||
$params['menu'] = false;
|
||||
|
||||
$params['disable_black'] = true;
|
||||
$params_combined = $data_combined;
|
||||
$module_list = $data_module_list;
|
||||
|
||||
$viewport = [
|
||||
'width' => 0,
|
||||
'height' => 0,
|
||||
];
|
||||
|
||||
$style = 'width:100%;';
|
||||
if (isset($params['options']['viewport']) === true) {
|
||||
$viewport = $params['options']['viewport'];
|
||||
if (empty($viewport['width']) === false) {
|
||||
$style .= 'width:'.$viewport['width'].'px;';
|
||||
}
|
||||
|
||||
if (empty($viewport['height']) === false) {
|
||||
$style .= 'height:'.$viewport['height'].'px;';
|
||||
}
|
||||
}
|
||||
|
||||
echo '<div id="container-chart-generator-item" style="'.$style.' margin:0px;">';
|
||||
switch ($type_graph_pdf) {
|
||||
case 'combined':
|
||||
$params['pdf'] = true;
|
||||
$result = graphic_combined_module(
|
||||
$module_list,
|
||||
$params,
|
||||
$params_combined
|
||||
);
|
||||
|
||||
echo $result;
|
||||
break;
|
||||
|
||||
case 'sparse':
|
||||
$params['pdf'] = true;
|
||||
echo grafico_modulo_sparse($params);
|
||||
break;
|
||||
|
||||
case 'pie_graph':
|
||||
$params['pdf'] = true;
|
||||
$chart = get_build_setup_charts(
|
||||
'PIE',
|
||||
$params['options'],
|
||||
$params['chart_data']
|
||||
);
|
||||
|
||||
echo $chart->render(true);
|
||||
break;
|
||||
|
||||
case 'vbar_graph':
|
||||
$params['pdf'] = true;
|
||||
$chart = get_build_setup_charts(
|
||||
'BAR',
|
||||
$params['options'],
|
||||
$params['chart_data']
|
||||
);
|
||||
|
||||
echo $chart->render(true);
|
||||
break;
|
||||
|
||||
case 'ring_graph':
|
||||
$params['pdf'] = true;
|
||||
$params['options']['width'] = 500;
|
||||
$params['options']['height'] = 500;
|
||||
|
||||
$chart = get_build_setup_charts(
|
||||
'DOUGHNUT',
|
||||
$params['options'],
|
||||
$params['chart_data']
|
||||
);
|
||||
|
||||
echo $chart->render(true);
|
||||
break;
|
||||
|
||||
case 'line_graph':
|
||||
$params['pdf'] = true;
|
||||
$params['options']['width'] = '100%';
|
||||
$params['options']['height'] = 200;
|
||||
$chart = get_build_setup_charts(
|
||||
'LINE',
|
||||
$params['options'],
|
||||
$params['chart_data']
|
||||
);
|
||||
echo $chart->render(true);
|
||||
break;
|
||||
|
||||
case 'slicebar':
|
||||
// TO-DO Cambiar esto para que se pase por POST, NO SE PUEDE PASAR POR GET.
|
||||
$params['graph_data'] = json_decode(io_safe_output($config[$params['tokem_config']]), true);
|
||||
delete_config_token($params['tokem_config']);
|
||||
echo flot_slicesbar_graph(
|
||||
$params['graph_data'],
|
||||
$params['period'],
|
||||
$params['width'],
|
||||
$params['height'],
|
||||
$params['legend'],
|
||||
$params['colors'],
|
||||
$params['fontpath'],
|
||||
$params['round_corner'],
|
||||
$params['homeurl'],
|
||||
$params['watermark'],
|
||||
$params['adapt_key'],
|
||||
$params['stat_winalse'],
|
||||
$params['id_agent'],
|
||||
$params['full_legend_daterray'],
|
||||
$params['not_interactive'],
|
||||
$params['ttl'],
|
||||
$params['sizeForTicks'],
|
||||
$params['show'],
|
||||
$params['date_to'],
|
||||
$params['server_id']
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Code...
|
||||
break;
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
?>
|
||||
</body>
|
||||
</html>
|
@ -2383,7 +2383,7 @@ class ConsoleSupervisor
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.UPDATEMANAGER.REGISTRATION',
|
||||
'title' => __('This instance is not registered in the Update manager section'),
|
||||
'title' => __('This instance is not registered in the Warp Update section'),
|
||||
'message' => __('Click here to start the registration process'),
|
||||
'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online',
|
||||
]
|
||||
@ -2404,13 +2404,17 @@ class ConsoleSupervisor
|
||||
{
|
||||
global $config;
|
||||
include_once $config['homedir'].'/include/functions_update_manager.php';
|
||||
|
||||
$server_name = db_get_value_filter(
|
||||
'name',
|
||||
'tserver',
|
||||
[ 'server_type' => '1' ]
|
||||
);
|
||||
if (update_manager_verify_api() === false) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.API.ACCESS',
|
||||
'title' => __('Cannot access the Pandora FMS API '),
|
||||
'message' => __('Please check the configuration, some components may fail due to this misconfiguration.'),
|
||||
'message' => __('Please check the configuration, some components may fail due to this misconfiguration in '.$server_name.' ('.$config['public_url'].')'),
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -737,7 +737,7 @@ class Diagnostics extends Wizard
|
||||
$cpuModelName = 'cat /proc/cpuinfo | grep "model name" | tail -1 | cut -f 2 -d ":"';
|
||||
$cpuProcessor = 'cat /proc/cpuinfo | grep "processor" | wc -l';
|
||||
$ramMemTotal = 'cat /proc/meminfo | grep "MemTotal"';
|
||||
|
||||
$distroInfo = 'cat /etc/os-release | grep "PRETTY_NAME" | cut -f 2 -d "="';
|
||||
exec(
|
||||
"ifconfig | awk '{ print $2}' | grep -E -o '([0-9]{1,3}[\.]){3}[0-9]{1,3}'",
|
||||
$output
|
||||
@ -756,6 +756,10 @@ class Diagnostics extends Wizard
|
||||
'name' => __('RAM'),
|
||||
'value' => exec($ramMemTotal),
|
||||
],
|
||||
'distroInfo' => [
|
||||
'name' => __('Distro'),
|
||||
'value' => str_replace('"', '', exec($distroInfo)),
|
||||
],
|
||||
'osInfo' => [
|
||||
'name' => __('Os'),
|
||||
'value' => exec('uname -a'),
|
||||
|
@ -20,7 +20,7 @@
|
||||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC231128';
|
||||
$build_version = 'PC231205';
|
||||
$pandora_version = 'v7.0NG.774';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
@ -990,6 +990,70 @@ function get_parameter($name, $default='')
|
||||
}
|
||||
|
||||
|
||||
function get_parameter_date($name, $default='', $date_format='Y/m/d')
|
||||
{
|
||||
$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' => date($date_format, strtotime($date_init)),
|
||||
'date_end' => date($date_format, strtotime($date_end)),
|
||||
'period' => $period,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a parameter from a get request.
|
||||
*
|
||||
@ -4311,48 +4375,22 @@ function generator_chart_to_pdf(
|
||||
$module_list=false
|
||||
) {
|
||||
global $config;
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$hack_metaconsole = '';
|
||||
if (is_metaconsole() === true) {
|
||||
$hack_metaconsole = '../..';
|
||||
} else {
|
||||
$hack_metaconsole = '';
|
||||
}
|
||||
|
||||
$url = ui_get_full_url(false).$hack_metaconsole.'/include/chart_generator.php';
|
||||
|
||||
if (!$params['return_img_base_64']) {
|
||||
$img_file = 'img_'.uniqid().'.png';
|
||||
$img_path = $config['homedir'].'/attachment/'.$img_file;
|
||||
$img_url = ui_get_full_url(false).$hack_metaconsole.'/attachment/'.$img_file;
|
||||
}
|
||||
|
||||
$session_id = session_id();
|
||||
if ($type_graph_pdf === 'combined') {
|
||||
$data = [
|
||||
'data' => $params,
|
||||
'session_id' => $session_id,
|
||||
'type_graph_pdf' => $type_graph_pdf,
|
||||
'data_module_list' => $module_list,
|
||||
'data_combined' => $params_combined,
|
||||
'id_user' => $config['id_user'],
|
||||
'slicebar' => $_SESSION['slicebar'],
|
||||
'slicebar_value' => $config[$_SESSION['slicebar']],
|
||||
'apipass' => get_parameter('apipass', null),
|
||||
|
||||
];
|
||||
} else {
|
||||
$data = [
|
||||
'data' => $params,
|
||||
'session_id' => $session_id,
|
||||
'type_graph_pdf' => $type_graph_pdf,
|
||||
'id_user' => $config['id_user'],
|
||||
'slicebar' => $_SESSION['slicebar'],
|
||||
'slicebar_value' => $config[$_SESSION['slicebar']],
|
||||
'apipass' => get_parameter('apipass', null),
|
||||
];
|
||||
if ($type_graph_pdf !== 'combined') {
|
||||
$params_combined = [];
|
||||
$module_list = [];
|
||||
}
|
||||
|
||||
unset($data['data']['graph_data']);
|
||||
// If not install chromium avoid 500 convert tu images no data to show.
|
||||
$chromium_dir = io_safe_output($config['chromium_path']);
|
||||
$result_ejecution = exec($chromium_dir.' --version');
|
||||
@ -4372,22 +4410,16 @@ function generator_chart_to_pdf(
|
||||
|
||||
// Creates a new page.
|
||||
$page = $browser->createPage();
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, ['data' => json_encode($data)]);
|
||||
// Generate Html.
|
||||
$html = chart_generator(
|
||||
$type_graph_pdf,
|
||||
$params,
|
||||
$params_combined,
|
||||
$module_list
|
||||
);
|
||||
|
||||
$response = curl_exec($curl);
|
||||
|
||||
curl_close($curl);
|
||||
|
||||
$page->setHtml($response);
|
||||
/*
|
||||
//For debug url with parameters.
|
||||
$navigation = $page->navigate($url.'?data='.urlencode(json_encode($data)));
|
||||
$navigation->waitForNavigation(Page::DOM_CONTENT_LOADED);
|
||||
*/
|
||||
$page->setHtml($html);
|
||||
|
||||
// Dynamic.
|
||||
$dynamic_height = $page->evaluate('document.getElementById("container-chart-generator-item").clientHeight')->getReturnValue();
|
||||
@ -4434,6 +4466,211 @@ function generator_chart_to_pdf(
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Html print chart for chromium
|
||||
*
|
||||
* @param string $type_graph_pdf Chart mode.
|
||||
* @param array $params Params.
|
||||
* @param array $params_combined Params Combined charts.
|
||||
* @param array $module_list Module list Combined charts.
|
||||
*
|
||||
* @return string Output Html.
|
||||
*/
|
||||
function chart_generator(
|
||||
string $type_graph_pdf,
|
||||
array $params,
|
||||
array $params_combined=[],
|
||||
array $module_list=[]
|
||||
) : string {
|
||||
global $config;
|
||||
|
||||
include_once $config['homedir'].'/include/graphs/functions_d3.php';
|
||||
|
||||
if (isset($params['backgroundColor']) === false) {
|
||||
$params['backgroundColor'] = 'inherit';
|
||||
}
|
||||
|
||||
$hack_metaconsole = (is_metaconsole() === true) ? '../../' : '';
|
||||
|
||||
$output = '<!DOCTYPE>';
|
||||
$output .= '<html>';
|
||||
$output .= '<head>';
|
||||
$output .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
|
||||
$output .= '<title>Pandora FMS Graph</title>';
|
||||
$output .= '<script type="text/javascript">';
|
||||
$output .= 'var phpTimezone = "'.date_default_timezone_get().'";';
|
||||
$output .= 'var configHomeurl = "'.((is_metaconsole() === false) ? $config['homeurl'] : '../../').'";';
|
||||
$output .= '</script>';
|
||||
|
||||
$css_files = [
|
||||
'pandora' => 'include/styles/',
|
||||
'pandora_minimal' => 'include/styles/',
|
||||
'jquery-ui.min' => 'include/styles/js/',
|
||||
'jquery-ui_custom' => 'include/styles/js/',
|
||||
];
|
||||
|
||||
foreach ($css_files as $name => $path) {
|
||||
$output .= ui_require_css_file($name, $path, true, true);
|
||||
}
|
||||
|
||||
$js_files = [
|
||||
'pandora_ui' => 'include/javascript/',
|
||||
'jquery.current' => 'include/javascript/',
|
||||
'jquery.pandora' => 'include/javascript/',
|
||||
'jquery-ui.min' => 'include/javascript/',
|
||||
'date' => 'include/javascript/timezone/src/',
|
||||
'pandora' => 'include/javascript/',
|
||||
'jquery.flot' => 'include/graphs/flot/',
|
||||
'jquery.flot.min' => 'include/graphs/flot/',
|
||||
'jquery.flot.time' => 'include/graphs/flot/',
|
||||
'jquery.flot.pie' => 'include/graphs/flot/',
|
||||
'jquery.flot.crosshair.min' => 'include/graphs/flot/',
|
||||
'jquery.flot.stack.min' => 'include/graphs/flot/',
|
||||
'jquery.flot.selection.min' => 'include/graphs/flot/',
|
||||
'jquery.flot.resize.min' => 'include/graphs/flot/',
|
||||
'jquery.flot.threshold' => 'include/graphs/flot/',
|
||||
'jquery.flot.threshold.multiple' => 'include/graphs/flot/',
|
||||
'jquery.flot.symbol.min' => 'include/graphs/flot/',
|
||||
'jquery.flot.exportdata.pandora' => 'include/graphs/flot/',
|
||||
'jquery.flot.axislabels' => 'include/graphs/flot/',
|
||||
'pandora.flot' => 'include/graphs/flot/',
|
||||
'chart' => 'include/graphs/chartjs/',
|
||||
'chartjs-plugin-datalabels.min' => 'include/graphs/chartjs/',
|
||||
];
|
||||
|
||||
foreach ($js_files as $name => $path) {
|
||||
$output .= ui_require_javascript_file($name, $path, true, true);
|
||||
}
|
||||
|
||||
$output .= include_javascript_d3(true, true);
|
||||
|
||||
$output .= '</head>';
|
||||
$output .= '<body style="width:794px; margin: 0px; background-color:'.$params['backgroundColor'].';">';
|
||||
$params['only_image'] = false;
|
||||
$params['menu'] = false;
|
||||
$params['disable_black'] = true;
|
||||
|
||||
$viewport = [
|
||||
'width' => 0,
|
||||
'height' => 0,
|
||||
];
|
||||
|
||||
$style = 'width:100%;';
|
||||
if (isset($params['options']['viewport']) === true) {
|
||||
$viewport = $params['options']['viewport'];
|
||||
if (empty($viewport['width']) === false) {
|
||||
$style .= 'width:'.$viewport['width'].'px;';
|
||||
}
|
||||
|
||||
if (empty($viewport['height']) === false) {
|
||||
$style .= 'height:'.$viewport['height'].'px;';
|
||||
}
|
||||
}
|
||||
|
||||
$output .= '<div id="container-chart-generator-item" style="'.$style.' margin:0px;">';
|
||||
switch ($type_graph_pdf) {
|
||||
case 'combined':
|
||||
$params['pdf'] = true;
|
||||
$result = graphic_combined_module(
|
||||
$module_list,
|
||||
$params,
|
||||
$params_combined
|
||||
);
|
||||
|
||||
$output .= $result;
|
||||
break;
|
||||
|
||||
case 'sparse':
|
||||
$params['pdf'] = true;
|
||||
$output .= grafico_modulo_sparse($params);
|
||||
break;
|
||||
|
||||
case 'pie_graph':
|
||||
$params['pdf'] = true;
|
||||
$chart = get_build_setup_charts(
|
||||
'PIE',
|
||||
$params['options'],
|
||||
$params['chart_data']
|
||||
);
|
||||
|
||||
$output .= $chart->render(true);
|
||||
break;
|
||||
|
||||
case 'vbar_graph':
|
||||
$params['pdf'] = true;
|
||||
$chart = get_build_setup_charts(
|
||||
'BAR',
|
||||
$params['options'],
|
||||
$params['chart_data']
|
||||
);
|
||||
|
||||
$output .= $chart->render(true);
|
||||
break;
|
||||
|
||||
case 'ring_graph':
|
||||
$params['pdf'] = true;
|
||||
$params['options']['width'] = 500;
|
||||
$params['options']['height'] = 500;
|
||||
|
||||
$chart = get_build_setup_charts(
|
||||
'DOUGHNUT',
|
||||
$params['options'],
|
||||
$params['chart_data']
|
||||
);
|
||||
|
||||
$output .= $chart->render(true);
|
||||
break;
|
||||
|
||||
case 'line_graph':
|
||||
$params['pdf'] = true;
|
||||
$params['options']['width'] = '100%';
|
||||
$params['options']['height'] = 200;
|
||||
$chart = get_build_setup_charts(
|
||||
'LINE',
|
||||
$params['options'],
|
||||
$params['chart_data']
|
||||
);
|
||||
$output .= $chart->render(true);
|
||||
break;
|
||||
|
||||
case 'slicebar':
|
||||
$output .= flot_slicesbar_graph(
|
||||
$params['graph_data'],
|
||||
$params['period'],
|
||||
$params['width'],
|
||||
$params['height'],
|
||||
$params['legend'],
|
||||
$params['colors'],
|
||||
$params['fontpath'],
|
||||
$params['round_corner'],
|
||||
$params['homeurl'],
|
||||
$params['watermark'],
|
||||
$params['adapt_key'],
|
||||
$params['stat_winalse'],
|
||||
$params['id_agent'],
|
||||
$params['full_legend_daterray'],
|
||||
$params['not_interactive'],
|
||||
$params['ttl'],
|
||||
$params['sizeForTicks'],
|
||||
$params['show'],
|
||||
$params['date_to'],
|
||||
$params['server_id']
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Code...
|
||||
break;
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
$output .= '</body>';
|
||||
$output .= '</html>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the product name.
|
||||
*
|
||||
|
@ -4752,7 +4752,7 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
|
||||
$secondary_groups = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
|
||||
$secondaryLinks = [];
|
||||
if (empty($secondary_groups['for_select']) === true) {
|
||||
$secondaryLinks[] = '<em>'.__('N/A').'</em>';
|
||||
$secondaryLinks = [];
|
||||
} else {
|
||||
foreach ($secondary_groups['for_select'] as $id => $name) {
|
||||
$secondaryLinks[] = html_print_anchor(
|
||||
@ -4811,22 +4811,22 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
|
||||
'content' => groups_get_name($agent['id_grupo']),
|
||||
],
|
||||
true
|
||||
);
|
||||
).' '.ui_print_group_icon($agent['id_grupo'], true, '', 'margin-left: 2%;', true, false, false, '', true);
|
||||
$table_contact->data[] = $data;
|
||||
|
||||
// Secondary groups.
|
||||
$data = [];
|
||||
$data[0] = '<b>'.__('Secondary groups').'</b>';
|
||||
$data[1] = implode(', ', $secondaryLinks);
|
||||
$table_contact->data[] = $data;
|
||||
if (!empty($secondaryLinks) === true) {
|
||||
$data[0] = '<b>'.__('Secondary groups').'</b>';
|
||||
$data[1] = implode(', ', $secondaryLinks);
|
||||
$table_contact->data[] = $data;
|
||||
}
|
||||
|
||||
// Parent agent line.
|
||||
if (enterprise_installed() === true) {
|
||||
$data = [];
|
||||
$data[0] = '<b>'.__('Parent').'</b>';
|
||||
if ((int) $agent['id_parent'] === 0) {
|
||||
$data[1] = '<em>'.__('N/A').'</em>';
|
||||
} else {
|
||||
if ((int) $agent['id_parent'] !== 0) {
|
||||
$data = [];
|
||||
$data[0] = '<b>'.__('Parent').'</b>';
|
||||
$data[1] = html_print_anchor(
|
||||
[
|
||||
'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_parent'],
|
||||
@ -4834,9 +4834,9 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
|
||||
],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$table_contact->data[] = $data;
|
||||
$table_contact->data[] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
// Last status change line.
|
||||
@ -4845,6 +4845,44 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
|
||||
$data[1] = $time_elapsed;
|
||||
$table_contact->data[] = $data;
|
||||
|
||||
$has_remote_conf = enterprise_hook(
|
||||
'config_agents_has_remote_configuration',
|
||||
[$agent['id_agente']]
|
||||
);
|
||||
|
||||
if ((bool) $has_remote_conf) {
|
||||
$data = [];
|
||||
$data[0] = __('Remote configuration');
|
||||
$data[1] = '<spam style="position: relative;top: -10%; margin-right: 10px;">'.__('Enabled').'</spam>';
|
||||
$data[1] .= html_print_menu_button(
|
||||
[
|
||||
'href' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=remote_configuration&id_agente='.$agent['id_agente'].'&disk_conf=1'),
|
||||
'image' => 'images/remote-configuration@svg.svg',
|
||||
'title' => __('Edit remote config'),
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$satellite_server = (int) db_get_value_filter(
|
||||
'satellite_server',
|
||||
'tagente',
|
||||
['id_agente' => $id_agente]
|
||||
);
|
||||
|
||||
if (empty($satellite_server) === false) {
|
||||
$satellite_name = db_get_value_filter(
|
||||
'name',
|
||||
'tserver',
|
||||
['id_server' => $satellite_server]
|
||||
);
|
||||
|
||||
$data[0] = __('Satellite server');
|
||||
$data[1] = $satellite_name;
|
||||
}
|
||||
|
||||
$table_contact->data[] = $data;
|
||||
}
|
||||
|
||||
if (enterprise_installed() === true) {
|
||||
// SecurityMon line.
|
||||
$id_module_group = db_get_value('id_mg', 'tmodule_group', 'name', 'Security');
|
||||
@ -4887,6 +4925,43 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
|
||||
}
|
||||
}
|
||||
|
||||
// Optional data
|
||||
// Position Information.
|
||||
if ((bool) $config['activate_gis'] === true) {
|
||||
$data = [];
|
||||
|
||||
$dataPositionAgent = gis_get_data_last_position_agent(
|
||||
$agent['id_agente']
|
||||
);
|
||||
if (is_array($dataPositionAgent) === true && $dataPositionAgent['stored_longitude'] !== '' && $dataPositionAgent['stored_latitude'] !== '') {
|
||||
$data[0] = __('Position (Long, Lat)');
|
||||
|
||||
$dataOptionalOutput = html_print_anchor(
|
||||
[
|
||||
'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=gis&id_agente='.$id_agente,
|
||||
'content' => $dataPositionAgent['stored_longitude'].', '.$dataPositionAgent['stored_latitude'],
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
if (empty($dataPositionAgent['description']) === false) {
|
||||
$dataOptionalOutput .= ' ('.$dataPositionAgent['description'].')';
|
||||
}
|
||||
|
||||
$data[1] = $dataOptionalOutput;
|
||||
}
|
||||
|
||||
$table_contact->data[] = $data;
|
||||
}
|
||||
|
||||
// Timezone Offset.
|
||||
if ((int) $agent['timezone_offset'] !== 0) {
|
||||
$data = [];
|
||||
$data[0] = __('Timezone Offset');
|
||||
$data[1] = $agent['timezone_offset'];
|
||||
$table_contact->data[] = $data;
|
||||
}
|
||||
|
||||
$agent_contact = html_print_div(
|
||||
[
|
||||
'class' => 'agent_details_header',
|
||||
|
@ -2169,13 +2169,16 @@ function get_group_alerts(
|
||||
$strict_user=false,
|
||||
$tag=false,
|
||||
$action_filter=false,
|
||||
$alert_action=true
|
||||
$alert_action=true,
|
||||
$search_sg=false
|
||||
) {
|
||||
global $config;
|
||||
|
||||
$group_query = '';
|
||||
if (!empty($idGroup)) {
|
||||
$group_query = ' AND id_grupo = '.$idGroup;
|
||||
if ((bool) $search_sg === true) {
|
||||
$group_query .= ' OR tasg.id_group = '.$idGroup;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($filter)) {
|
||||
|
@ -82,7 +82,7 @@ function parseOtherParameter($other, $otherType, $rawDecode)
|
||||
case 'url_encode':
|
||||
$returnVar = [
|
||||
'type' => 'string',
|
||||
'data' => urldecode($other),
|
||||
'data' => $rawDecode ? rawurldecode($other) : urldecode($other),
|
||||
];
|
||||
break;
|
||||
|
||||
@ -13132,7 +13132,7 @@ function api_set_create_event($id, $trash1, $other, $returnType)
|
||||
|
||||
if ($other['data'][18] != '') {
|
||||
$values['id_extra'] = $other['data'][18];
|
||||
$sql_validation = 'SELECT id_evento,estado,ack_utimestamp,id_usuario
|
||||
$sql_validation = 'SELECT id_evento,estado,ack_utimestamp,id_usuario,event_custom_id
|
||||
FROM tevento
|
||||
WHERE estado IN (0,2) AND id_extra ="'.$other['data'][18].'";';
|
||||
|
||||
@ -13147,6 +13147,7 @@ function api_set_create_event($id, $trash1, $other, $returnType)
|
||||
$values['status'] = 2;
|
||||
$ack_utimestamp = $val['ack_utimestamp'];
|
||||
$values['id_usuario'] = $val['id_usuario'];
|
||||
$values['event_custom_id'] = $val['event_custom_id'];
|
||||
}
|
||||
|
||||
api_set_validate_event_by_id($val['id_evento']);
|
||||
@ -13177,7 +13178,8 @@ function api_set_create_event($id, $trash1, $other, $returnType)
|
||||
$custom_data,
|
||||
$values['server_id'],
|
||||
$values['id_extra'],
|
||||
$ack_utimestamp
|
||||
$ack_utimestamp,
|
||||
$values['event_custom_id'] ?? null
|
||||
);
|
||||
|
||||
if ($other['data'][12] != '') {
|
||||
@ -17787,6 +17789,48 @@ function api_token_check(string $token)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set custom field value in tevento
|
||||
*
|
||||
* @param mixed $id_event Event id.
|
||||
* @param mixed $custom_field Custom field to set.
|
||||
* @return void
|
||||
*/
|
||||
function api_set_event_custom_id($id, $value)
|
||||
{
|
||||
// Get the event
|
||||
$event = events_get_event($id, false, is_metaconsole());
|
||||
// If event not exists, end the execution.
|
||||
if ($event === false) {
|
||||
returnError(
|
||||
'event_not_exists',
|
||||
'Event not exists'
|
||||
);
|
||||
$result = false;
|
||||
}
|
||||
|
||||
// Safe custom fields for hacks.
|
||||
if (preg_match('/script/i', io_safe_output($value))) {
|
||||
$result = false;
|
||||
}
|
||||
|
||||
$result = events_event_custom_id(
|
||||
$id,
|
||||
$value
|
||||
);
|
||||
|
||||
// If update results failed
|
||||
if (empty($result) === true || $result === false) {
|
||||
returnError(
|
||||
'The event could not be updated'
|
||||
);
|
||||
return false;
|
||||
} else {
|
||||
returnData('string', ['data' => 'Event updated.']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extract info Agents for inventories ITSM.
|
||||
*
|
||||
|
@ -249,10 +249,6 @@ function config_update_config()
|
||||
$error_update[] = __('Enable Netflow');
|
||||
}
|
||||
|
||||
if (config_update_value('activate_sflow', (bool) get_parameter('activate_sflow'), true) === false) {
|
||||
$error_update[] = __('Enable Sflow');
|
||||
}
|
||||
|
||||
if (config_update_value('activate_feedback', (bool) get_parameter('activate_feedback'), true) === false) {
|
||||
$error_update[] = __('Enable Feedback');
|
||||
}
|
||||
@ -371,6 +367,10 @@ function config_update_config()
|
||||
$error_update[] = __('show_experimental_features');
|
||||
}
|
||||
|
||||
if (config_update_value('number_modules_queue', get_parameter('number_modules_queue'), true) === false) {
|
||||
$error_update[] = __('number_modules_queue');
|
||||
}
|
||||
|
||||
if (config_update_value('console_log_enabled', get_parameter('console_log_enabled'), true) === false) {
|
||||
$error_update[] = __('Console log enabled');
|
||||
}
|
||||
@ -1619,6 +1619,10 @@ function config_update_config()
|
||||
if (config_update_value('netflow_get_ip_hostname', (int) get_parameter('netflow_get_ip_hostname'), true) === false) {
|
||||
$error_update[] = __('Name resolution for IP address');
|
||||
}
|
||||
|
||||
if (config_update_value('activate_sflow', (bool) get_parameter('activate_sflow'), true) === false) {
|
||||
$error_update[] = __('Enable Sflow');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'sflow':
|
||||
@ -2441,6 +2445,10 @@ function config_process_config()
|
||||
config_update_value('show_experimental_features', 0);
|
||||
}
|
||||
|
||||
if (!isset($config['number_modules_queue'])) {
|
||||
config_update_value('number_modules_queue', 500);
|
||||
}
|
||||
|
||||
if (!isset($config['agent_vulnerabilities'])) {
|
||||
config_update_value('agent_vulnerabilities', 1);
|
||||
}
|
||||
|
@ -219,6 +219,7 @@ function events_get_all_fields()
|
||||
$columns['module_status'] = __('Module status');
|
||||
$columns['module_custom_id'] = __('Module custom id');
|
||||
$columns['custom_data'] = __('Custom data');
|
||||
$columns['event_custom_id'] = __('Event Custom ID');
|
||||
|
||||
return $columns;
|
||||
}
|
||||
@ -322,6 +323,9 @@ function events_get_column_name($field, $table_alias=false)
|
||||
case 'custom_data':
|
||||
return __('Custom data');
|
||||
|
||||
case 'event_custom_id':
|
||||
return __('Event Custom ID');
|
||||
|
||||
default:
|
||||
return __($field);
|
||||
}
|
||||
@ -2356,7 +2360,8 @@ function events_create_event(
|
||||
$custom_data='',
|
||||
$server_id=0,
|
||||
$id_extra='',
|
||||
$ack_utimestamp=0
|
||||
$ack_utimestamp=0,
|
||||
$event_custom_id=null
|
||||
) {
|
||||
if ($source === false) {
|
||||
$source = get_product_name();
|
||||
@ -2388,6 +2393,7 @@ function events_create_event(
|
||||
'custom_data' => $custom_data,
|
||||
'data' => '',
|
||||
'module_status' => 0,
|
||||
'event_custom_id' => $event_custom_id,
|
||||
];
|
||||
|
||||
return (int) db_process_sql_insert('tevento', $values);
|
||||
@ -2611,7 +2617,6 @@ function events_print_type_img(
|
||||
$urlImage = ui_get_full_url(false);
|
||||
$icon = '';
|
||||
$style = 'main_menu_icon';
|
||||
|
||||
switch ($type) {
|
||||
case 'alert_recovered':
|
||||
$icon = 'images/alert_recovered@svg.svg';
|
||||
@ -2677,16 +2682,6 @@ function events_print_type_img(
|
||||
if ($only_url) {
|
||||
$output = $urlImage.'/'.$icon;
|
||||
} else {
|
||||
/*
|
||||
$output .= html_print_div(
|
||||
[
|
||||
'title' => events_print_type_description($type, true),
|
||||
'class' => $style,
|
||||
'style' => ((empty($icon) === false) ? 'background-image: url('.$icon.'); background-repeat: no-repeat;' : ''),
|
||||
],
|
||||
true
|
||||
);
|
||||
*/
|
||||
$output .= html_print_image(
|
||||
$icon,
|
||||
true,
|
||||
@ -4658,6 +4653,30 @@ function events_page_details($event, $server_id=0)
|
||||
$data[1] = '<i>'.__('N/A').'</i>';
|
||||
}
|
||||
|
||||
$table_details->data[] = $data;
|
||||
$readonly = true;
|
||||
if (check_acl($config['id_user'], 0, 'EW')) {
|
||||
$readonly = false;
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Event Custom ID');
|
||||
$data[1] = '<div class="flex-row-center">'.html_print_input_text('event_custom_id', $event['event_custom_id'], '', false, 255, true, $readonly, false, '', 'w60p');
|
||||
if ($readonly === false) {
|
||||
$data[1] .= html_print_button(
|
||||
__('Update'),
|
||||
'update_event_custom_id',
|
||||
false,
|
||||
'update_event_custom_id('.$event['id_evento'].', '.$event['server_id'].');',
|
||||
[
|
||||
'icon' => 'next',
|
||||
'mode' => 'link',
|
||||
],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$data[1] .= '</div>';
|
||||
$table_details->data[] = $data;
|
||||
|
||||
$details = '<div id="extended_event_details_page" class="extended_event_pages">'.html_print_table($table_details, true).'</div>';
|
||||
@ -6260,6 +6279,63 @@ function event_get_counter_extraId(array $event, ?array $filters)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update event detail custom field
|
||||
*
|
||||
* @param mixed $id_event Event ID or array of events.
|
||||
* @param string $event_custom_id Event custom ID to be update.
|
||||
*
|
||||
* @return boolean Whether or not it was successful
|
||||
*/
|
||||
function events_event_custom_id(
|
||||
$id_event,
|
||||
$event_custom_id,
|
||||
) {
|
||||
global $config;
|
||||
// Cleans up the selection for all unwanted values also casts any single
|
||||
// values as an array.
|
||||
if (![$id_event]) {
|
||||
$id_event = (array) safe_int($id_event, 1);
|
||||
}
|
||||
|
||||
// Check ACL.
|
||||
foreach ($id_event as $k => $id) {
|
||||
$event_group = events_get_group($id);
|
||||
if (check_acl($config['id_user'], $event_group, 'EW') == 0) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Attempted updating event #'.$id
|
||||
);
|
||||
|
||||
unset($id_event[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($id_event) === true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the current event comments.
|
||||
$first_event = $id_event;
|
||||
if (is_array($id_event) === true) {
|
||||
$first_event = reset($id_event);
|
||||
}
|
||||
|
||||
// Update comment.
|
||||
$ret = db_process_sql_update(
|
||||
'tevento',
|
||||
['event_custom_id' => $event_custom_id],
|
||||
['id_evento' => $first_event]
|
||||
);
|
||||
|
||||
if (($ret === false) || ($ret === 0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function event_print_graph(
|
||||
$filter,
|
||||
$graph_height=100,
|
||||
|
@ -1745,20 +1745,37 @@ function html_print_select_multiple_modules_filtered(array $data):string
|
||||
}
|
||||
}
|
||||
|
||||
$output .= html_print_input(
|
||||
[
|
||||
'label' => __('Agents'),
|
||||
'label_class' => 'font-title-font',
|
||||
'type' => 'select_from_sql',
|
||||
'sql' => 'SELECT `id_agente`,`alias` FROM tagente',
|
||||
'name' => 'filtered-module-agents-'.$uniqId,
|
||||
'selected' => explode(',', $data['mAgents']),
|
||||
'return' => true,
|
||||
'multiple' => true,
|
||||
'style' => 'min-width: 200px;max-width:200px;',
|
||||
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
|
||||
]
|
||||
);
|
||||
if (is_metaconsole() === true) {
|
||||
$output .= html_print_input(
|
||||
[
|
||||
'label' => __('Agents'),
|
||||
'label_class' => 'font-title-font',
|
||||
'type' => 'select',
|
||||
'fields' => $agents,
|
||||
'name' => 'filtered-module-agents-'.$uniqId,
|
||||
'selected' => explode(',', $data['mAgents']),
|
||||
'return' => true,
|
||||
'multiple' => true,
|
||||
'style' => 'min-width: 200px;max-width:200px;',
|
||||
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$output .= html_print_input(
|
||||
[
|
||||
'label' => __('Agents'),
|
||||
'label_class' => 'font-title-font',
|
||||
'type' => 'select_from_sql',
|
||||
'sql' => 'SELECT `id_agente`,`alias` FROM tagente',
|
||||
'name' => 'filtered-module-agents-'.$uniqId,
|
||||
'selected' => explode(',', $data['mAgents']),
|
||||
'return' => true,
|
||||
'multiple' => true,
|
||||
'style' => 'min-width: 200px;max-width:200px;',
|
||||
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$commonModules = 0;
|
||||
if (empty($data['mShowCommonModules']) === false) {
|
||||
|
61
pandora_console/include/functions_macros.php
Normal file
61
pandora_console/include/functions_macros.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
// Pandora FMS - https://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2023 Pandora FMS
|
||||
// Please see https://pandorafms.com/community/ for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU 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.
|
||||
|
||||
|
||||
/**
|
||||
* Return array with macros of agent like core.pm
|
||||
*
|
||||
* @param interger $id_agente Id agent to return data.
|
||||
*
|
||||
* @return array Array with all macros.
|
||||
*/
|
||||
function return_agent_macros($id_agente)
|
||||
{
|
||||
global $config;
|
||||
$array_macros = [];
|
||||
$grupo = [];
|
||||
$agente = db_get_row_sql(
|
||||
'SELECT * FROM tagente WHERE id_agente = '.$id_agente
|
||||
);
|
||||
if (isset($agente['id_grupo'])) {
|
||||
$grupo = db_get_row_sql(
|
||||
'SELECT * FROM tgrupo WHERE id_grupo = '.$agente['id_grupo']
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($agente['server_name'])) {
|
||||
$server_ip = db_get_row_sql(
|
||||
'SELECT ip_address FROM tserver WHERE name = "'.$agente['server_name'].'"'
|
||||
)['id_address'];
|
||||
}
|
||||
|
||||
$array_macros = [
|
||||
'_agentname_' => ($agente['nombre']) ?: '',
|
||||
'_agentalias_' => ($agente['alias']) ?: '',
|
||||
'_agent_' => ($agente['alias']) ?: (($agente['nombre']) ?: ''),
|
||||
'_agentcustomid_' => ($agente['custom_id']) ?: '',
|
||||
'_agentdescription_' => ($agente['comentarios']) ?: '',
|
||||
'_agentgroup_' => ($grupo['nombre']) ?: '',
|
||||
'_agentos_' => ($agente['id_os']) ?: '',
|
||||
'_address_' => ($agente['direccion']) ?: '',
|
||||
'_homeurl_' => ($config['public_url']) ?: '',
|
||||
'_groupcontact_' => ($agente['contact']) ?: '',
|
||||
'_groupcustomid_' => ($agente['custom_id']) ?: '',
|
||||
'_groupother_' => ($agente['other']) ?: '',
|
||||
'_server_ip_' => ($server_ip) ?: '',
|
||||
'_server_name_' => ($agente['server_name']) ?: '',
|
||||
];
|
||||
|
||||
return $array_macros;
|
||||
}
|
@ -1003,7 +1003,7 @@ if (is_ajax()) {
|
||||
$dialogButtons = [];
|
||||
|
||||
$dialogButtons[] = html_print_button(
|
||||
__('Update manager'),
|
||||
__('Warp update'),
|
||||
'update_manager',
|
||||
false,
|
||||
'location.href="'.ui_get_full_url('/index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=history', false, false, false).'"',
|
||||
@ -1170,6 +1170,14 @@ if (is_ajax()) {
|
||||
<p style="font-size: 10pt;">'.$sys_info->data->ramInfo->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 15%;">
|
||||
<p><span>'.$sys_info->data->distroInfo->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$sys_info->data->distroInfo->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 15%;">
|
||||
<p><span>'.$sys_info->data->osInfo->name.'</span></p>
|
||||
|
@ -251,6 +251,11 @@ function modules_copy_agent_module_to_agent($id_agent_module, $id_destiny_agent,
|
||||
unset($new_module['id_agente_modulo']);
|
||||
unset($new_module['id_agente']);
|
||||
|
||||
// Set debug content.
|
||||
if (empty($new_module['debug_content']) === false) {
|
||||
$new_module['debug_content'] = str_replace("'", '"', $new_module['debug_content']);
|
||||
}
|
||||
|
||||
$id_new_module = modules_create_agent_module(
|
||||
$id_destiny_agent,
|
||||
$new_module['nombre'],
|
||||
|
@ -1066,7 +1066,7 @@ function notification_filter()
|
||||
break;
|
||||
|
||||
case 'UPDATEMANAGER':
|
||||
$type_name = 'UPDATE MANAGER';
|
||||
$type_name = 'WARP UPDATE';
|
||||
break;
|
||||
|
||||
case 'ALLOWOVERRIDE':
|
||||
|
@ -1024,6 +1024,62 @@ function reporting_make_reporting_data(
|
||||
);
|
||||
break;
|
||||
|
||||
case 'vuls_severity_graph':
|
||||
$report['contents'][] = reporting_vuls_severity_graph(
|
||||
$report,
|
||||
$content,
|
||||
$type
|
||||
);
|
||||
break;
|
||||
|
||||
case 'vuls_attack_complexity':
|
||||
$report['contents'][] = reporting_vuls_attack_complexity_graph(
|
||||
$report,
|
||||
$content,
|
||||
$type
|
||||
);
|
||||
break;
|
||||
|
||||
case 'vuls_by_packages':
|
||||
$report['contents'][] = reporting_vuls_by_packages_graph(
|
||||
$report,
|
||||
$content,
|
||||
$type
|
||||
);
|
||||
break;
|
||||
|
||||
case 'vuls_by_agent':
|
||||
$report['contents'][] = reporting_vuls_by_agent(
|
||||
$report,
|
||||
$content,
|
||||
$type
|
||||
);
|
||||
break;
|
||||
|
||||
case 'vuls_info_agent':
|
||||
$report['contents'][] = reporting_vuls_info_agent(
|
||||
$report,
|
||||
$content,
|
||||
$type
|
||||
);
|
||||
break;
|
||||
|
||||
case 'top_n_agents_vuls':
|
||||
$report['contents'][] = reporting_top_n_agents_vuls(
|
||||
$report,
|
||||
$content,
|
||||
$type
|
||||
);
|
||||
break;
|
||||
|
||||
case 'top_n_vuls_count':
|
||||
$report['contents'][] = reporting_top_n_vuls_count(
|
||||
$report,
|
||||
$content,
|
||||
$type
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
@ -13695,38 +13751,47 @@ function reporting_tiny_stats(
|
||||
}
|
||||
|
||||
if ($modern === true) {
|
||||
$out .= '<div id="bullets_modules">';
|
||||
if (isset($fired_count) && $fired_count > 0) {
|
||||
$out .= '<div class="bullets_modules">';
|
||||
$out .= '<div><div id="fired_count_'.$uniq_id.'" class="forced_title bullet_modules orange_background"></div>';
|
||||
$out .= '<span class="font_12pt">'.$fired_count.'</span></div>';
|
||||
$out .= '</div>';
|
||||
}
|
||||
|
||||
if (isset($critical_count) && $critical_count > 0) {
|
||||
$out .= '<div class="bullets_modules">';
|
||||
$out .= '<div><div id="critical_count_'.$uniq_id.'" class="forced_title bullet_modules red_background"></div>';
|
||||
$out .= '<span class="font_12pt">'.$critical_count.'</span></div>';
|
||||
$out .= '</div>';
|
||||
}
|
||||
|
||||
if (isset($warning_count) && $warning_count > 0) {
|
||||
$out .= '<div class="bullets_modules">';
|
||||
$out .= '<div><div id="warning_count_'.$uniq_id.'" class="forced_title bullet_modules yellow_background"></div>';
|
||||
$out .= '<span class="font_12pt">'.$warning_count.'</span></div>';
|
||||
$out .= '</div>';
|
||||
}
|
||||
|
||||
if (isset($unknown_count) && $unknown_count > 0) {
|
||||
$out .= '<div class="bullets_modules">';
|
||||
$out .= '<div><div id="unknown_count_'.$uniq_id.'" class="forced_title bullet_modules grey_background"></div>';
|
||||
$out .= '<span class="font_12pt">'.$unknown_count.'</span></div>';
|
||||
$out .= '</div>';
|
||||
}
|
||||
|
||||
if (isset($not_init_count) && $not_init_count > 0) {
|
||||
$out .= '<div class="bullets_modules">';
|
||||
$out .= '<div><div id="not_init_count_'.$uniq_id.'" class="forced_title bullet_modules blue_background"></div>';
|
||||
$out .= '<span class="font_12pt">'.$not_init_count.'</span></div>';
|
||||
$out .= '</div>';
|
||||
}
|
||||
|
||||
if (isset($normal_count) && $normal_count > 0) {
|
||||
$out .= '<div class="bullets_modules">';
|
||||
$out .= '<div><div id="normal_count_'.$uniq_id.'" class="forced_title bullet_modules green_background"></div>';
|
||||
$out .= '<span class="font_12pt">'.$normal_count.'</span></div>';
|
||||
$out .= '</div>';
|
||||
}
|
||||
|
||||
$out .= '</div>';
|
||||
} else {
|
||||
// Classic ones.
|
||||
$out .= '<b><span id="total_count_'.$uniq_id.'" class="forced_title" >'.$total_count.'</span>';
|
||||
|
@ -507,6 +507,34 @@ function reporting_html_print_report($report, $mini=false, $report_info=1, $cust
|
||||
case 'evolution':
|
||||
reporting_evolution_graph($table, $item);
|
||||
break;
|
||||
|
||||
case 'vuls_severity_graph':
|
||||
reporting_html_vuls_severity_graph($table, $item);
|
||||
break;
|
||||
|
||||
case 'vuls_attack_complexity':
|
||||
reporting_html_vuls_attack_complexity($table, $item);
|
||||
break;
|
||||
|
||||
case 'vuls_by_packages':
|
||||
reporting_html_vuls_by_packages($table, $item);
|
||||
break;
|
||||
|
||||
case 'vuls_by_agent':
|
||||
reporting_html_vuls_by_agent($table, $item);
|
||||
break;
|
||||
|
||||
case 'vuls_info_agent':
|
||||
reporting_html_vuls_info_agent($table, $item);
|
||||
break;
|
||||
|
||||
case 'top_n_agents_vuls':
|
||||
reporting_html_top_n_agents_vuls($table, $item);
|
||||
break;
|
||||
|
||||
case 'top_n_vuls_count':
|
||||
reporting_html_top_n_vuls_count($table, $item);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($item['type'] == 'agent_module') {
|
||||
@ -522,6 +550,300 @@ function reporting_html_print_report($report, $mini=false, $report_info=1, $cust
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to print top vulnerabiries more common.
|
||||
*
|
||||
* @param object $table Head table or false if it comes from pdf.
|
||||
* @param array $item Items data.
|
||||
* @param integer $pdf Flag for return table.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function reporting_html_top_n_vuls_count($table, $item, $pdf=0)
|
||||
{
|
||||
global $config;
|
||||
$table->width = '99%';
|
||||
$table->styleTable = 'border: 0px;';
|
||||
$table->colspan[2][0] = 3;
|
||||
$table1 = new stdClass();
|
||||
$table1->headstyle = [];
|
||||
$table1->width = '99%';
|
||||
$table1->class = 'info_table';
|
||||
$table1->titleclass = 'title_table_pdf';
|
||||
$table1->rowclass[0] = '';
|
||||
$table1->head[0] = __('Vulnerability');
|
||||
$table1->head[2] = __('Total');
|
||||
|
||||
$row = 2;
|
||||
foreach ($item['data'] as $key => $vul) {
|
||||
$table1->data[$row][0] = $vul['cve_id'];
|
||||
$table1->data[$row][2] = $vul['count'];
|
||||
$row++;
|
||||
}
|
||||
|
||||
if ($pdf === 1) {
|
||||
$table1->title = $item['title'];
|
||||
$table1->titleclass = 'title_table_pdf';
|
||||
$table1->titlestyle = 'text-align:left;';
|
||||
}
|
||||
|
||||
$table->data[2][0] = html_print_table($table1, true);
|
||||
if ($pdf === 1) {
|
||||
return html_print_table($table, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to print top agents with worst score.
|
||||
*
|
||||
* @param object $table Head table or false if it comes from pdf.
|
||||
* @param array $item Items data.
|
||||
* @param integer $pdf Flag for return table.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function reporting_html_top_n_agents_vuls($table, $item, $pdf=0)
|
||||
{
|
||||
global $config;
|
||||
$table->width = '99%';
|
||||
$table->styleTable = 'border: 0px;';
|
||||
$table->colspan[2][0] = 3;
|
||||
$table1 = new stdClass();
|
||||
$table1->headstyle = [];
|
||||
$table1->width = '99%';
|
||||
$table1->class = 'info_table';
|
||||
$table1->titleclass = 'title_table_pdf';
|
||||
$table1->rowclass[0] = '';
|
||||
$table1->head[0] = __('Agent');
|
||||
$table1->head[2] = __('Risk');
|
||||
|
||||
$row = 2;
|
||||
foreach ($item['data'] as $key => $agent) {
|
||||
$table1->data[$row][0] = $agent['alias'];
|
||||
$table1->data[$row][2] = $agent['score'];
|
||||
$row++;
|
||||
}
|
||||
|
||||
if ($pdf === 1) {
|
||||
$table1->title = $item['title'];
|
||||
$table1->titleclass = 'title_table_pdf';
|
||||
$table1->titlestyle = 'text-align:left;';
|
||||
}
|
||||
|
||||
$table->data[2][0] = html_print_table($table1, true);
|
||||
if ($pdf === 1) {
|
||||
return html_print_table($table, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to print vulnerabilities of agent.
|
||||
*
|
||||
* @param object $table Head table or false if it comes from pdf.
|
||||
* @param array $item Items data.
|
||||
* @param integer $pdf Flag for return table.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function reporting_html_vuls_info_agent($table, $item, $pdf=0)
|
||||
{
|
||||
$table->width = '99%';
|
||||
$table->styleTable = 'border: 0px;';
|
||||
$table->colspan[2][0] = 3;
|
||||
$table1 = new stdClass();
|
||||
$table1->headstyle[0] = 'text-align: left';
|
||||
$table1->headstyle[1] = 'text-align: left';
|
||||
$table1->headstyle[2] = 'text-align: left';
|
||||
$table1->width = '99%';
|
||||
$table1->class = 'info_table';
|
||||
$table1->titleclass = 'title_table_pdf';
|
||||
$table1->rowclass[0] = '';
|
||||
$table1->head[0] = __('Name');
|
||||
$table1->head[1] = __('CVE');
|
||||
$table1->head[2] = __('Version');
|
||||
$table1->head[3] = __('Score');
|
||||
$table1->head[4] = __('Detection time');
|
||||
$table1->head[5] = __('Severity');
|
||||
$table1->head[6] = __('Version');
|
||||
$table1->head[7] = __('Attack Vector');
|
||||
$table1->head[8] = __('Attack Complexity');
|
||||
$table1->head[9] = __('Privileges Required');
|
||||
$table1->head[10] = __('User Interaction');
|
||||
$table1->head[11] = __('Scope');
|
||||
$table1->head[12] = __('Confidentiality');
|
||||
$table1->head[13] = __('Integrity');
|
||||
$table1->head[14] = __('Availability');
|
||||
|
||||
$row = 1;
|
||||
foreach ($item['data'] as $key => $vul) {
|
||||
$table1->data[$row][0] = (key_exists('name', $vul) === true) ? $vul['name'] : '';
|
||||
$table1->data[$row][1] = (key_exists('cve', $vul) === true) ? $vul['cve'] : '';
|
||||
$table1->data[$row][2] = (key_exists('version', $vul) === true) ? $vul['version'] : '';
|
||||
$table1->data[$row][3] = (key_exists('score', $vul) === true) ? $vul['score'] : '';
|
||||
$table1->data[$row][4] = (key_exists('detection_time', $vul) === true) ? $vul['detection_time'] : '';
|
||||
$table1->data[$row][5] = (key_exists('severity', $vul) === true) ? $vul['severity'] : '';
|
||||
$table1->data[$row][6] = (key_exists('CVSS', $vul) === true) ? $vul['CVSS'] : '';
|
||||
$table1->data[$row][7] = (key_exists('AV', $vul) === true) ? $vul['AV'] : '';
|
||||
$table1->data[$row][8] = (key_exists('AC', $vul) === true) ? $vul['AC'] : '';
|
||||
$table1->data[$row][9] = (key_exists('PR', $vul) === true) ? $vul['PR'] : '';
|
||||
$table1->data[$row][10] = (key_exists('UI', $vul) === true) ? $vul['UI'] : '';
|
||||
$table1->data[$row][11] = (key_exists('S', $vul) === true) ? $vul['S'] : '';
|
||||
$table1->data[$row][12] = (key_exists('C', $vul) === true) ? $vul['C'] : '';
|
||||
$table1->data[$row][13] = (key_exists('I', $vul) === true) ? $vul['I'] : '';
|
||||
$table1->data[$row][14] = (key_exists('A', $vul) === true) ? $vul['A'] : '';
|
||||
|
||||
$row++;
|
||||
}
|
||||
|
||||
$table->data[2][0] = html_print_table($table1, true);
|
||||
|
||||
if ($pdf === 1) {
|
||||
$table1->title = $item['title'];
|
||||
$table1->titleclass = 'title_table_pdf';
|
||||
$table1->titlestyle = 'text-align:left;';
|
||||
return html_print_table($table1, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to print total vulnerabilities by packages in graph.
|
||||
*
|
||||
* @param object $table Head table or false if it comes from pdf.
|
||||
* @param array $item Items data.
|
||||
* @param integer $pdf Flag for return table.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function reporting_html_vuls_by_packages($table, $item, $pdf=0)
|
||||
{
|
||||
$table->rowclass[0] = '';
|
||||
$table->colspan['chart']['cell'] = 3;
|
||||
$table->cellstyle['chart']['cell'] = 'text-align: center;';
|
||||
$table->data['chart']['cell'] = $item['chart'];
|
||||
|
||||
if ($pdf === 1) {
|
||||
return html_print_table($table, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to print attack complexity in graph
|
||||
*
|
||||
* @param object $table Head table or false if it comes from pdf.
|
||||
* @param array $item Items data.
|
||||
* @param integer $pdf Flag for return table.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function reporting_html_vuls_attack_complexity($table, $item, $pdf=0)
|
||||
{
|
||||
$table->rowclass[0] = '';
|
||||
$table->colspan['chart']['cell'] = 3;
|
||||
$table->cellstyle['chart']['cell'] = 'text-align: center;';
|
||||
$table->data['chart']['cell'] = html_print_div(
|
||||
[
|
||||
'content' => $item['chart'],
|
||||
'style' => 'width: 450px; height: 300px; margin: 0 auto;',
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
if ($pdf === 1) {
|
||||
return html_print_table($table, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to print the severity vuls in graph.
|
||||
*
|
||||
* @param object $table Head table or false if it comes from pdf.
|
||||
* @param array $item Items data.
|
||||
* @param integer $pdf Flag for return table.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function reporting_html_vuls_severity_graph($table, $item, $pdf=0)
|
||||
{
|
||||
$table->rowclass[0] = '';
|
||||
$table->colspan['chart']['cell'] = 3;
|
||||
$table->cellstyle['chart']['cell'] = 'text-align: center;';
|
||||
$table->data['chart']['cell'] = $item['chart'];
|
||||
|
||||
if ($pdf === 1) {
|
||||
return html_print_table($table, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to print the all vulnerabilities by agent.
|
||||
*
|
||||
* @param object $table Head table or false if it comes from pdf.
|
||||
* @param array $item Items data.
|
||||
* @param integer $pdf Flag for return table.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function reporting_html_vuls_by_agent($table, $item, $pdf=0)
|
||||
{
|
||||
$table->width = '99%';
|
||||
$table->styleTable = 'border: 0px;';
|
||||
$table->colspan[2][0] = 3;
|
||||
$table1 = new stdClass();
|
||||
$table1->headstyle[0] = 'text-align: left';
|
||||
$table1->headstyle[1] = 'text-align: left';
|
||||
$table1->headstyle[2] = 'text-align: left';
|
||||
$table1->width = '99%';
|
||||
$table1->class = 'info_table';
|
||||
$table1->titleclass = 'title_table_pdf';
|
||||
$table1->rowclass[0] = '';
|
||||
$table1->head[0] = __('Agent');
|
||||
$table1->head[1] = __('OS');
|
||||
$table1->head[2] = __('OS Version');
|
||||
$table1->head[3] = __('Group');
|
||||
$table1->head[4] = __('Ip');
|
||||
$table1->head[5] = __('Status');
|
||||
$table1->head[6] = __('SecMon');
|
||||
$table1->head[7] = __('Hardening');
|
||||
$table1->head[8] = __('Vulnerability');
|
||||
$table1->head[9] = __('Last contact');
|
||||
$table1->head[10] = __('L.S. Change');
|
||||
|
||||
$row = 1;
|
||||
foreach ($item['data'] as $key => $vul) {
|
||||
$table1->data[$row][0] = $vul['alias'];
|
||||
$table1->data[$row][2] = $vul['name'];
|
||||
$table1->data[$row][3] = $vul['os_version'];
|
||||
$table1->data[$row][4] = $vul['nombre_gr'];
|
||||
$table1->data[$row][5] = $vul['direccion'];
|
||||
$table1->data[$row][6] = $vul['status'];
|
||||
$table1->data[$row][7] = $vul['secmon'];
|
||||
$table1->data[$row][8] = $vul['hardening'];
|
||||
$table1->data[$row][9] = $vul['vulnerabilities'];
|
||||
$table1->data[$row][10] = $vul['ultimo_contacto'];
|
||||
$table1->data[$row][11] = $vul['last_status_c'];
|
||||
$row++;
|
||||
}
|
||||
|
||||
if ($pdf === 1) {
|
||||
$table1->title = $item['title'];
|
||||
$table1->titleclass = 'title_table_pdf';
|
||||
$table1->titlestyle = 'text-align:left;';
|
||||
}
|
||||
|
||||
$table->data[2][0] = html_print_table($table1, true);
|
||||
|
||||
if ($pdf === 1) {
|
||||
return html_print_table($table1, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to print the security hardening evolution.
|
||||
*
|
||||
|
@ -1003,6 +1003,41 @@ function reports_get_report_types($template=false, $not_editor=false)
|
||||
'optgroup' => __('Security hardening'),
|
||||
'name' => __('Evolution'),
|
||||
];
|
||||
|
||||
$types['vuls_severity_graph'] = [
|
||||
'optgroup' => __('Vulnerabilities'),
|
||||
'name' => __('Severity graph bar'),
|
||||
];
|
||||
|
||||
$types['vuls_attack_complexity'] = [
|
||||
'optgroup' => __('Vulnerabilities'),
|
||||
'name' => __('Attack complexity doughnut chart'),
|
||||
];
|
||||
|
||||
$types['vuls_by_packages'] = [
|
||||
'optgroup' => __('Vulnerabilities'),
|
||||
'name' => __('By packages in pie chart'),
|
||||
];
|
||||
|
||||
$types['vuls_by_agent'] = [
|
||||
'optgroup' => __('Vulnerabilities'),
|
||||
'name' => __('Detailed security report'),
|
||||
];
|
||||
|
||||
$types['vuls_info_agent'] = [
|
||||
'optgroup' => __('Vulnerabilities'),
|
||||
'name' => __('Vulnerabilities of agent'),
|
||||
];
|
||||
|
||||
$types['top_n_agents_vuls'] = [
|
||||
'optgroup' => __('Vulnerabilities'),
|
||||
'name' => __('Top-N agents with more risk'),
|
||||
];
|
||||
|
||||
$types['top_n_vuls_count'] = [
|
||||
'optgroup' => __('Vulnerabilities'),
|
||||
'name' => __('Top-N common vulnerabilities'),
|
||||
];
|
||||
}
|
||||
|
||||
return $types;
|
||||
|
@ -1978,15 +1978,21 @@ function ui_print_help_icon(
|
||||
*
|
||||
* @return boolean True if the file was added. False if the file doesn't exist.
|
||||
*/
|
||||
function ui_require_css_file($name, $path='include/styles/', $echo_tag=false)
|
||||
function ui_require_css_file($name, $path='include/styles/', $echo_tag=false, $return=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$filename = $path.$name.'.css';
|
||||
|
||||
if ($echo_tag === true) {
|
||||
echo '<link type="text/css" rel="stylesheet" href="'.ui_get_full_url($filename, false, false, false).'">';
|
||||
return null;
|
||||
$filename .= '?v='.$config['current_package'];
|
||||
$tag_name = '<link type="text/css" rel="stylesheet" href="'.ui_get_full_url($filename, false, false, false).'">';
|
||||
if ($return === false) {
|
||||
echo $tag_name;
|
||||
return null;
|
||||
} else {
|
||||
return $tag_name;
|
||||
}
|
||||
}
|
||||
|
||||
if (! isset($config['css'])) {
|
||||
@ -2035,15 +2041,20 @@ function ui_require_css_file($name, $path='include/styles/', $echo_tag=false)
|
||||
*
|
||||
* @return boolean True if the file was added. False if the file doesn't exist.
|
||||
*/
|
||||
function ui_require_javascript_file($name, $path='include/javascript/', $echo_tag=false)
|
||||
function ui_require_javascript_file($name, $path='include/javascript/', $echo_tag=false, $return=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$filename = $path.$name.'.js';
|
||||
|
||||
if ($echo_tag) {
|
||||
echo '<script type="text/javascript" src="'.ui_get_full_url($filename, false, false, false).'"></script>';
|
||||
return null;
|
||||
if ($echo_tag === true) {
|
||||
$filename .= '?v='.$config['current_package'];
|
||||
$tag_name = '<script type="text/javascript" src="'.ui_get_full_url($filename, false, false, false).'"></script>';
|
||||
if ($return === false) {
|
||||
echo $tag_name;
|
||||
return null;
|
||||
} else {
|
||||
return $tag_name;
|
||||
}
|
||||
}
|
||||
|
||||
if (! isset($config['js'])) {
|
||||
|
@ -1005,6 +1005,13 @@ function get_build_setup_charts($type, $options, $data)
|
||||
}
|
||||
}
|
||||
|
||||
// Set display grid true or false.
|
||||
if (isset($options['grid']) === true) {
|
||||
$scales = $chart->options()->getScales();
|
||||
$scales->getX()->grid()->setDrawOnChartArea($options['grid']);
|
||||
$scales->getY()->grid()->setDrawOnChartArea($options['grid']);
|
||||
}
|
||||
|
||||
// Radius is null maximum possible.
|
||||
if (isset($options['radius']) === true
|
||||
&& empty($options['radius']) === false
|
||||
|
@ -11,14 +11,14 @@
|
||||
// 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.
|
||||
function include_javascript_d3($return=false)
|
||||
function include_javascript_d3($return=false, $force=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
static $is_include_javascript = false;
|
||||
|
||||
$output = '';
|
||||
if (!$is_include_javascript) {
|
||||
if (!$is_include_javascript || $force === true) {
|
||||
$is_include_javascript = true;
|
||||
|
||||
$output .= '<script type="text/javascript" src="';
|
||||
|
@ -754,9 +754,8 @@ function flot_slicesbar_graph(
|
||||
global $config;
|
||||
|
||||
if ($ttl == 2) {
|
||||
$tokem_config = uniqid('slicebar');
|
||||
$params = [
|
||||
'tokem_config' => $tokem_config,
|
||||
'graph_data' => $graph_data,
|
||||
'period' => $period,
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
@ -779,9 +778,6 @@ function flot_slicesbar_graph(
|
||||
'server_id' => $server_id,
|
||||
];
|
||||
|
||||
update_check_config_token($tokem_config, json_encode($graph_data));
|
||||
$_SESSION['slicebar'] = $tokem_config;
|
||||
$_SESSION['slicebar_value'] = json_encode($graph_data);
|
||||
$graph = '<img src="data:image/png;base64,';
|
||||
$graph .= generator_chart_to_pdf('slicebar', $params);
|
||||
$graph .= '" />';
|
||||
|
@ -331,9 +331,13 @@
|
||||
id_group: id_group
|
||||
},
|
||||
function(data) {
|
||||
let routeImg =
|
||||
typeof data.folder === "undefined"
|
||||
? "images/"
|
||||
: "images/" + data.folder;
|
||||
$("img", config.spanPreview).attr(
|
||||
"src",
|
||||
"images/" + data["icon"]
|
||||
routeImg + data["icon"]
|
||||
);
|
||||
$("a", config.spanPreview).attr("href", hrefNew);
|
||||
},
|
||||
|
@ -1653,6 +1653,10 @@ function paint_graph_status(
|
||||
max_c = 0;
|
||||
}
|
||||
|
||||
// Remove Error class.
|
||||
$("#text-max_warning").removeClass("input_error");
|
||||
$("#text-max_critical").removeClass("input_error");
|
||||
|
||||
//if haven't errors
|
||||
if (error_w == 0 && error_c == 0) {
|
||||
//parse element
|
||||
@ -1958,6 +1962,9 @@ function paint_graph_status(
|
||||
.html(message_error_critical)
|
||||
.style("text-anchor", "first");
|
||||
}
|
||||
if (error_c == 2) {
|
||||
$("#text-max_critical").addClass("input_error");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -492,6 +492,37 @@ function event_comment(current_event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Save custom_field into an event.
|
||||
function update_event_custom_id(event_id, server_id) {
|
||||
var event_custom_id = $("#text-event_custom_id").val();
|
||||
|
||||
var params = {
|
||||
page: "include/ajax/events",
|
||||
update_event_custom_id: 1,
|
||||
event_custom_id: event_custom_id,
|
||||
event_id: event_id,
|
||||
server_id: server_id
|
||||
};
|
||||
|
||||
$("#button-update_custom_field").attr("disabled", "disabled");
|
||||
$("#response_loading").show();
|
||||
|
||||
jQuery.ajax({
|
||||
data: params,
|
||||
type: "POST",
|
||||
url: getUrlAjax(),
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
if (data === "update_error") {
|
||||
alert("Event Custom ID not valid");
|
||||
}
|
||||
$("#button-update_custom_field").removeAttr("disabled");
|
||||
$("#response_loading").hide();
|
||||
$("#button-events_form_search_bt").trigger("click");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var processed = 0;
|
||||
function update_event(table, id_evento, type, event_rep, row, server_id) {
|
||||
var inputs = $("#events_form :input");
|
||||
@ -1004,6 +1035,7 @@ function openSoundEventsDialog(settings, dialog_parameters, reload) {
|
||||
modal: false,
|
||||
width: 600,
|
||||
height: 600,
|
||||
dialogClass: "modal-sound",
|
||||
open: function() {
|
||||
$.ajax({
|
||||
method: "post",
|
||||
@ -1064,10 +1096,10 @@ function openSoundEventsDialog(settings, dialog_parameters, reload) {
|
||||
|
||||
if (reload == false && dialog_parameters != undefined) {
|
||||
if ($("#button-start-search").hasClass("play")) {
|
||||
$("#filter_id").val(dialog_parameters["filter_id"]);
|
||||
$("#interval").val(dialog_parameters["interval"]);
|
||||
$("#time_sound").val(dialog_parameters["time_sound"]);
|
||||
$("#sound_id").val(dialog_parameters["sound_id"]);
|
||||
$("#filter_id").val(dialog_parameters.filter_id);
|
||||
$("#interval").val(dialog_parameters.interval);
|
||||
$("#time_sound").val(dialog_parameters.time_sound);
|
||||
$("#sound_id").val(dialog_parameters.sound_id);
|
||||
|
||||
$("#filter_id").trigger("change");
|
||||
$("#interval").trigger("change");
|
||||
@ -1124,14 +1156,15 @@ function openSoundEventsDialog(settings, dialog_parameters, reload) {
|
||||
}
|
||||
|
||||
function openSoundEventModal(settings) {
|
||||
var win = "";
|
||||
if ($("#hidden-metaconsole_activated").val() === "1") {
|
||||
var win = open(
|
||||
win = open(
|
||||
"../../operation/events/sound_events.php",
|
||||
"day_123",
|
||||
"width=600,height=500"
|
||||
);
|
||||
} else {
|
||||
var win = open(
|
||||
win = open(
|
||||
"operation/events/sound_events.php",
|
||||
"day_123",
|
||||
"width=600,height=500"
|
||||
@ -1502,11 +1535,6 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
|
||||
typeof requestBody.includes === "function" &&
|
||||
requestBody.includes("drawConsoleSound=1")
|
||||
) {
|
||||
console.log(
|
||||
"AJAX request sent with drawConsoleSound=1:",
|
||||
ajaxOptions.url
|
||||
);
|
||||
|
||||
// Find the dialog element by the aria-describedby attribute
|
||||
var dialog = $('[aria-describedby="modal-sound"]');
|
||||
|
||||
@ -1516,62 +1544,32 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
|
||||
// Add the minimize button before the close button
|
||||
var minimizeButton = $("<button>", {
|
||||
class:
|
||||
"ui-corner-all ui-widget ui-button-icon-only ui-window-minimize ui-dialog-titlebar-minimize",
|
||||
"ui-corner-all ui-widget ui-button-icon-only ui-window-minimize ui-dialog-titlebar-minimize minimize-buttom-image",
|
||||
type: "button",
|
||||
title: "Minimize",
|
||||
style: "float: right;margin-right: 1.5em;"
|
||||
title: "Minimize"
|
||||
}).insertBefore(closeButton);
|
||||
|
||||
// Add the minimize icon to the minimize button
|
||||
$("<span>", {
|
||||
class: "ui-button-icon ui-icon ui-icon-minusthick",
|
||||
style: "background-color: #fff;"
|
||||
}).appendTo(minimizeButton);
|
||||
|
||||
$("<span>", {
|
||||
class: "ui-button-icon-space"
|
||||
})
|
||||
.html(" ")
|
||||
.appendTo(minimizeButton);
|
||||
|
||||
// Add the disengage button before the minimize button
|
||||
var disengageButton = $("<button>", {
|
||||
class:
|
||||
"ui-corner-all ui-widget ui-button-icon-only ui-dialog-titlebar-disengage",
|
||||
"ui-corner-all ui-widget ui-button-icon-only ui-dialog-titlebar-disengage disengage-buttom-image",
|
||||
type: "button",
|
||||
title: "Disengage",
|
||||
style: "float: right;margin-right: 0.5em; position:relative;"
|
||||
title: "Disengage"
|
||||
}).insertBefore(minimizeButton);
|
||||
|
||||
// Add the disengage icon to the disengage button
|
||||
$("<span>", {
|
||||
class: "ui-button-icon ui-icon ui-icon-circle-triangle-n",
|
||||
style: "background-color: #fff;"
|
||||
}).appendTo(disengageButton);
|
||||
|
||||
$("<span>", {
|
||||
class: "ui-button-icon-space"
|
||||
})
|
||||
.html(" ")
|
||||
.appendTo(disengageButton);
|
||||
|
||||
minimizeButton.click(function(e) {
|
||||
console.log("here");
|
||||
if ($("#minimize_arrow_event_sound").hasClass("arrow_menu_up")) {
|
||||
console.log("arrow_menu_up");
|
||||
$("#minimize_arrow_event_sound").removeClass("arrow_menu_up");
|
||||
$("#minimize_arrow_event_sound").addClass("arrow_menu_down");
|
||||
} else if (
|
||||
$("#minimize_arrow_event_sound").hasClass("arrow_menu_down")
|
||||
) {
|
||||
console.log("arrow_menu_down");
|
||||
$("#minimize_arrow_event_sound").removeClass("arrow_menu_down");
|
||||
$("#minimize_arrow_event_sound").addClass("arrow_menu_up");
|
||||
}
|
||||
|
||||
if (!dialog.data("isMinimized")) {
|
||||
$(".ui-widget-overlay").hide();
|
||||
console.log("Minimize Window");
|
||||
dialog.data("originalPos", dialog.position());
|
||||
dialog.data("originalSize", {
|
||||
width: dialog.width(),
|
||||
@ -1582,7 +1580,6 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
|
||||
dialog.animate(
|
||||
{
|
||||
height: "40px",
|
||||
top: 0,
|
||||
top: $(window).height() - 100
|
||||
},
|
||||
200,
|
||||
@ -1597,17 +1594,13 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
|
||||
},
|
||||
5
|
||||
);
|
||||
//dialog.find(".ui-dialog-content").hide();
|
||||
} else {
|
||||
console.log("Restore Window");
|
||||
$(".ui-widget-overlay").show();
|
||||
//dialog.find(".ui-dialog-content").show();
|
||||
dialog.data("isMinimized", false);
|
||||
|
||||
dialog.animate(
|
||||
{
|
||||
height: "40px",
|
||||
top: 0,
|
||||
top: $(window).height() - 100
|
||||
},
|
||||
5
|
||||
|
@ -458,6 +458,12 @@ class Manager implements PublicLogin
|
||||
$this->publicLink
|
||||
);
|
||||
|
||||
if ((bool) $this->dashboardFields['date_range'] === true) {
|
||||
$dateFrom = $this->dashboardFields['date_from'];
|
||||
$dateTo = $this->dashboardFields['date_to'];
|
||||
$instance->setDateRange($dateFrom, $dateTo);
|
||||
}
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
@ -1041,6 +1047,8 @@ class Manager implements PublicLogin
|
||||
$id_group = \get_parameter('id_group');
|
||||
$slideshow = \get_parameter_switch('slideshow');
|
||||
$favourite = \get_parameter_switch('favourite');
|
||||
$dateRange = \get_parameter_switch('date_range');
|
||||
$dateData = \get_parameter_date('range', '', 'U');
|
||||
|
||||
$id_user = (empty($private) === false) ? $config['id_user'] : '';
|
||||
|
||||
@ -1050,6 +1058,9 @@ class Manager implements PublicLogin
|
||||
'id_group' => $id_group,
|
||||
'cells_slideshow' => $slideshow,
|
||||
'active' => $favourite,
|
||||
'date_range' => $dateRange,
|
||||
'date_from' => $dateData['date_init'],
|
||||
'date_to' => $dateData['date_end'],
|
||||
];
|
||||
|
||||
if ($this->dashboardId === 0) {
|
||||
|
@ -51,6 +51,20 @@ class Widget
|
||||
*/
|
||||
private $showSelectNodeMeta;
|
||||
|
||||
/**
|
||||
* Date from init for filter widget.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $dateFrom;
|
||||
|
||||
/**
|
||||
* Date from end for filter widget.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $dateTo;
|
||||
|
||||
|
||||
/**
|
||||
* Contructor widget.
|
||||
@ -824,4 +838,41 @@ class Widget
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the date range of parent configuration.
|
||||
*
|
||||
* @param integer $dateFrom Date from init for filter widget.
|
||||
* @param integer $dateTo Date from end for filter widget.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setDateRange(int $dateFrom, int $dateTo)
|
||||
{
|
||||
$this->dateFrom = $dateFrom;
|
||||
$this->dateTo = $dateTo;
|
||||
}
|
||||
|
||||
|
||||
public function getDateFrom()
|
||||
{
|
||||
return $this->dateFrom;
|
||||
}
|
||||
|
||||
|
||||
public function getDateTo()
|
||||
{
|
||||
return $this->dateTo;
|
||||
}
|
||||
|
||||
|
||||
public function getPeriod():mixed
|
||||
{
|
||||
if (empty($this->dateFrom) === false && empty($this->dateTo) === false) {
|
||||
return ($this->dateTo - $this->dateFrom);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -637,6 +637,10 @@ class BasicChart extends Widget
|
||||
$color_status = $this->values['colorValue'];
|
||||
}
|
||||
|
||||
if (empty(parent::getPeriod()) === false) {
|
||||
$this->values['period'] = parent::getPeriod();
|
||||
}
|
||||
|
||||
$params = [
|
||||
'agent_module_id' => $this->values['moduleId'],
|
||||
'period' => $this->values['period'],
|
||||
|
@ -520,6 +520,9 @@ class BlockHistogram extends Widget
|
||||
global $config;
|
||||
|
||||
$size = parent::getSize();
|
||||
if (empty(parent::getPeriod()) === false) {
|
||||
$this->values['period'] = parent::getPeriod();
|
||||
}
|
||||
|
||||
// Desactive scroll bars only this item.
|
||||
$id_agent = $data['agent_id'];
|
||||
|
@ -473,6 +473,10 @@ class DataMatrix extends Widget
|
||||
return $output;
|
||||
}
|
||||
|
||||
if (empty(parent::getPeriod()) === false) {
|
||||
$this->values['period'] = parent::getPeriod();
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$modules_nodes = array_reduce(
|
||||
$this->values['moduleDataMatrix'],
|
||||
|
@ -472,6 +472,10 @@ class CustomGraphWidget extends Widget
|
||||
|
||||
$size = parent::getSize();
|
||||
|
||||
if (empty(parent::getPeriod()) === false) {
|
||||
$this->values['period'] = parent::getPeriod();
|
||||
}
|
||||
|
||||
switch ($this->values['type']) {
|
||||
case CUSTOM_GRAPH_STACKED_LINE:
|
||||
case CUSTOM_GRAPH_STACKED_AREA:
|
||||
|
@ -581,6 +581,12 @@ class EventsListWidget extends Widget
|
||||
$customFilter = \events_get_event_filter($this->values['customFilter']);
|
||||
if ($customFilter !== false) {
|
||||
$filter = $customFilter;
|
||||
if (in_array('0', $this->values['groupId'])) {
|
||||
$filter['id_group_filter'] = 0;
|
||||
} else {
|
||||
$filter['id_group_filter'] = (!empty($this->values['groupId'][0])) ? $this->values['groupId'] : 0;
|
||||
}
|
||||
|
||||
$filter['tag_with'] = base64_encode(
|
||||
io_safe_output($filter['tag_with'])
|
||||
);
|
||||
@ -838,6 +844,7 @@ class EventsListWidget extends Widget
|
||||
'mini_severity' => __('Severity mini'),
|
||||
'module_custom_id' => __('Module custom ID'),
|
||||
'custom_data' => __('Custom data'),
|
||||
'event_custom_id' => __('Event Custom ID'),
|
||||
];
|
||||
|
||||
}
|
||||
|
@ -302,6 +302,10 @@ class GraphModuleHistogramWidget extends Widget
|
||||
$values['period'] = SECONDS_1DAY;
|
||||
}
|
||||
|
||||
if (empty(parent::getPeriod()) === false) {
|
||||
$this->values['period'] = parent::getPeriod();
|
||||
}
|
||||
|
||||
if (isset($values['sizeLabel']) === false) {
|
||||
$values['sizeLabel'] = 30;
|
||||
}
|
||||
|
@ -309,6 +309,12 @@ class Netflow extends Widget
|
||||
|
||||
$start_date = (time() - $this->values['period']);
|
||||
$end_date = time();
|
||||
|
||||
if (empty(parent::getPeriod()) === false) {
|
||||
$start_date = parent::getDateFrom();
|
||||
$end_date = parent::getDateTo();
|
||||
}
|
||||
|
||||
if ($this->values['chart_type'] === 'usage_map') {
|
||||
$map_data = netflow_build_map_data(
|
||||
$start_date,
|
||||
|
@ -135,8 +135,6 @@ class SecurityHardening extends Widget
|
||||
// Includes.
|
||||
include_once ENTERPRISE_DIR.'/include/functions_security_hardening.php';
|
||||
include_once $config['homedir'].'/include/graphs/fgraph.php';
|
||||
include_once $config['homedir'].'/include/functions_graph.php';
|
||||
|
||||
// WARNING: Do not edit. This chunk must be in the constructor.
|
||||
parent::__construct(
|
||||
$cellId,
|
||||
@ -328,6 +326,11 @@ class SecurityHardening extends Widget
|
||||
$id_groups = $this->checkAcl($values['group']);
|
||||
$output .= '<b>'.$this->elements[$data_type].'</b>';
|
||||
|
||||
if (empty(parent::getPeriod()) === false) {
|
||||
$values['date_init'] = parent::getDateFrom();
|
||||
$values['date_end'] = parent::getDateTo();
|
||||
}
|
||||
|
||||
switch ($data_type) {
|
||||
case 'top_n_agents_sh':
|
||||
$output .= $this->loadTopNAgentsSh($id_groups, $values['limit']);
|
||||
|
@ -676,6 +676,10 @@ class SingleGraphWidget extends Widget
|
||||
$module_name = \modules_get_agentmodule_name($this->values['moduleId']);
|
||||
$units_name = \modules_get_unit($this->values['moduleId']);
|
||||
|
||||
if (empty(parent::getPeriod()) === false) {
|
||||
$this->values['period'] = parent::getPeriod();
|
||||
}
|
||||
|
||||
$trickHight = 0;
|
||||
if ($this->values['showLegend'] === 1) {
|
||||
// Needed for legend.
|
||||
|
@ -459,6 +459,9 @@ class SLAPercentWidget extends Widget
|
||||
global $config;
|
||||
|
||||
$size = parent::getSize();
|
||||
if (empty(parent::getPeriod()) === false) {
|
||||
$this->values['period'] = parent::getPeriod();
|
||||
}
|
||||
|
||||
$output .= '';
|
||||
$id_agent = $this->values['agentId'];
|
||||
|
@ -374,6 +374,10 @@ class TopNWidget extends Widget
|
||||
|
||||
$size = parent::getSize();
|
||||
|
||||
if (empty(parent::getPeriod()) === false) {
|
||||
$this->values['period'] = parent::getPeriod();
|
||||
}
|
||||
|
||||
$quantity = $this->values['quantity'];
|
||||
$period = $this->values['period'];
|
||||
|
||||
@ -420,6 +424,20 @@ class TopNWidget extends Widget
|
||||
// Prevent double safe input in agents_get_group_agents function.
|
||||
$agentRegex = io_safe_output($agentRegex);
|
||||
|
||||
// Validate regex.
|
||||
if (@preg_match('/'.$agentRegex.'/', '') === false
|
||||
|| @preg_match('/'.$this->values['module'].'/', '') === false
|
||||
) {
|
||||
$output .= '<div class="container-center">';
|
||||
$output .= \ui_print_info_message(
|
||||
__('Invalid regex'),
|
||||
'',
|
||||
true
|
||||
);
|
||||
$output .= '</div>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
// This function check ACL.
|
||||
$agents = @agents_get_group_agents(0, ['aliasRegex' => $agentRegex]);
|
||||
$agentsId = \array_keys($agents);
|
||||
|
@ -1120,7 +1120,10 @@ class Manager
|
||||
}
|
||||
|
||||
$onheader = [];
|
||||
$onheader['configure'] = $setup_tab;
|
||||
if (users_is_admin() === true) {
|
||||
$onheader['configure'] = $setup_tab;
|
||||
}
|
||||
|
||||
$onheader['dashboard'] = $dashboard_tab;
|
||||
$onheader['list'] = $list_tab;
|
||||
if ($idIncidence !== 0) {
|
||||
|
@ -6,6 +6,10 @@ div#bullets_modules span {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
div.bullets_modules span {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
div.agent_details_agent_caption {
|
||||
flex: 1;
|
||||
}
|
||||
|
@ -538,3 +538,7 @@ div.container-filter-buttons {
|
||||
.ui-state-active {
|
||||
border-radius: 0px !important;
|
||||
}
|
||||
|
||||
.ui-dialog.modal-sound .ui-widget-header {
|
||||
display: flex !important;
|
||||
}
|
||||
|
@ -46,15 +46,10 @@
|
||||
}
|
||||
|
||||
.ui-dialog .ui-dialog-titlebar-minimize {
|
||||
position: absolute;
|
||||
right: 1.5em;
|
||||
width: 21px;
|
||||
margin: 0px 0 0 0;
|
||||
padding: 1px;
|
||||
position: relative;
|
||||
height: 20px;
|
||||
bottom: 30%;
|
||||
top: 2em;
|
||||
background-color: #fff !important;
|
||||
width: 20px;
|
||||
margin-right: 1px;
|
||||
}
|
||||
|
||||
.ui-dialog .ui-dialog-titlebar-minimize:hover {
|
||||
@ -63,16 +58,9 @@
|
||||
|
||||
.ui-dialog .ui-dialog-titlebar-disengage {
|
||||
position: relative;
|
||||
right: 1.5em;
|
||||
width: 21px;
|
||||
margin: 0px 0 0 0;
|
||||
padding: 1px;
|
||||
height: 20px;
|
||||
bottom: 30%;
|
||||
background-color: #fff !important;
|
||||
-ms-transform: scale(1.2);
|
||||
-webkit-transform: scale(1.2);
|
||||
transform: scale(1.2);
|
||||
width: 20px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.ui-dialog .ui-dialog-titlebar-disengage:hover {
|
||||
|
@ -6043,18 +6043,18 @@ div.switch_radio_button label:last-of-type {
|
||||
margin-top: -2px;
|
||||
}
|
||||
|
||||
/*
|
||||
div#bullets_modules {
|
||||
display: flex;
|
||||
margin-left: 2em;
|
||||
}
|
||||
*/
|
||||
div#bullets_modules div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 0 5px;
|
||||
}
|
||||
|
||||
div.bullets_modules div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 0 10px;
|
||||
}
|
||||
|
||||
.orange_background {
|
||||
background: #ffa631;
|
||||
}
|
||||
@ -6225,7 +6225,7 @@ div#status_pie {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
padding: 20px;
|
||||
padding-bottom: 0;
|
||||
padding-bottom: 1%;
|
||||
}
|
||||
|
||||
.agent_details_content_cluster {
|
||||
@ -6315,6 +6315,7 @@ div#status_pie {
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.agent_details_agent_data {
|
||||
@ -6344,23 +6345,45 @@ div#status_pie {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.agent_details_bullets .bullets_modules {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.agent_details_bullets_cluster #bullets_modules {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.agent_details_bullets_cluster .bullets_modules {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.agent_details_bullets_cluster #bullets_modules > div {
|
||||
padding: 0px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.agent_details_bullets_cluster .bullets_modules > div {
|
||||
padding: 0px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.agent_details_bullets #bullets_modules > div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.agent_details_bullets .bullets_modules > div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
#agent_contact_main tr td img {
|
||||
max-width: 100%;
|
||||
}
|
||||
@ -6412,6 +6435,11 @@ div#status_pie {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.white_table_graph_header div.bullets_modules {
|
||||
display: flex;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.white_table_graph_header img,
|
||||
.white_table_graph_header span {
|
||||
vertical-align: middle;
|
||||
@ -10819,6 +10847,13 @@ button div.fail {
|
||||
-webkit-mask: url(../../images/fail@svg.svg) no-repeat center / contain;
|
||||
}
|
||||
|
||||
button div.refresh {
|
||||
mask: url(../../images/refresh@svg.svg) no-repeat center / contain;
|
||||
-webkit-mask: url(../../images/refresh@svg.svg) no-repeat center / contain;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
button div.force {
|
||||
mask: url(../../images/force@svg.svg) no-repeat center / contain;
|
||||
-webkit-mask: url(../../images/force@svg.svg) no-repeat center / contain;
|
||||
@ -12771,6 +12806,10 @@ div.agents_custom_fields #datatables_wrapper div.bottom {
|
||||
justify-content: flex-start !important;
|
||||
}
|
||||
|
||||
.alert_view_calendar > .fc-view-harness > .fc-view > .fc-scrollgrid {
|
||||
width: auto !important;
|
||||
}
|
||||
|
||||
.title_tactical {
|
||||
padding: 10px 0px 10px 0px;
|
||||
text-align: center;
|
||||
@ -12864,7 +12903,26 @@ tr.shown td.details-control {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.basic-options-disabled tr > td,
|
||||
.basic-options-disabled tr > td > div > label {
|
||||
color: gray;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#cluetip-inner > #example {
|
||||
position: absolute;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.disengage-buttom-image {
|
||||
background-color: rgb(51, 51, 51);
|
||||
mask: url(../../images/desacoplar-ventana.svg) no-repeat right / contain;
|
||||
-webkit-mask: url(../../images/desacoplar-ventana.svg) no-repeat right /
|
||||
contain;
|
||||
}
|
||||
|
||||
.minimize-buttom-image {
|
||||
background-color: rgb(51, 51, 51);
|
||||
mask: url(../../images/minimizar.svg) no-repeat right / contain;
|
||||
-webkit-mask: url(../../images/minimizar.svg) no-repeat right / contain;
|
||||
}
|
||||
|
@ -1471,6 +1471,10 @@ ul.datatable_filter:has(li > div.action-buttons) {
|
||||
background-color: #222 !important;
|
||||
}
|
||||
|
||||
ul.datatable_filter {
|
||||
background-color: #222 !important;
|
||||
}
|
||||
|
||||
span.ui-dialog-title {
|
||||
color: #fff !important;
|
||||
}
|
||||
|
@ -132,6 +132,11 @@
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#filter-agent-security div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
@media (max-width: 1500px) {
|
||||
.col-md-3 {
|
||||
width: 40%;
|
||||
|
@ -131,7 +131,7 @@
|
||||
<div style='padding-bottom: 50px'>
|
||||
<?php
|
||||
$version = '7.0NG.774';
|
||||
$build = '231128';
|
||||
$build = '231205';
|
||||
$banner = "v$version Build $build";
|
||||
error_reporting(0);
|
||||
|
||||
|
@ -66,7 +66,8 @@ function printFormFilterAlert(
|
||||
$action_filter=false,
|
||||
$return=false,
|
||||
$strict_user=false,
|
||||
$access='AR'
|
||||
$access='AR',
|
||||
$search_sg=0
|
||||
) {
|
||||
global $config;
|
||||
include_once $config['homedir'].'/include/functions_tags.php';
|
||||
@ -160,7 +161,12 @@ function printFormFilterAlert(
|
||||
$callbackTag
|
||||
);
|
||||
|
||||
$table->data[1][0] = html_print_label_input_block(
|
||||
$table->data[3][0] = html_print_label_input_block(
|
||||
__('Also search in secondary groups'),
|
||||
html_print_checkbox_switch_extended('search_sg', 0, 0, false, '', '', true)
|
||||
);
|
||||
|
||||
$table->data[2][0] = html_print_label_input_block(
|
||||
__('Free text for search').ui_print_help_tip(
|
||||
__('Filter by agent name, module name, template name or action name'),
|
||||
true
|
||||
@ -168,7 +174,7 @@ function printFormFilterAlert(
|
||||
html_print_input_text('free_search', $free_search, '', 20, 40, true)
|
||||
);
|
||||
|
||||
$table->data[1][1] = html_print_label_input_block(
|
||||
$table->data[2][1] = html_print_label_input_block(
|
||||
__('Standby'),
|
||||
html_print_select(
|
||||
$alert_standby,
|
||||
@ -187,7 +193,7 @@ function printFormFilterAlert(
|
||||
);
|
||||
|
||||
$alert_action = alerts_get_alert_actions_filter();
|
||||
$table->data[1][2] = html_print_label_input_block(
|
||||
$table->data[2][2] = html_print_label_input_block(
|
||||
__('Action'),
|
||||
html_print_select(
|
||||
$alert_action,
|
||||
|
@ -58,7 +58,7 @@ $filter_standby = get_parameter('standby', 'all');
|
||||
$id_group = (int) get_parameter('ag_group', 0);
|
||||
// 0 is the All group (selects all groups)
|
||||
$free_search = get_parameter('free_search', '');
|
||||
|
||||
$search_sg = get_parameter('search_sg', 0);
|
||||
$user_tag_array = tags_get_user_tags($config['id_user'], 'AR', true);
|
||||
|
||||
if ($user_tag_array) {
|
||||
@ -578,6 +578,14 @@ $(document).ready ( function () {
|
||||
});
|
||||
});
|
||||
|
||||
$('#checkbox-search_sg').click(function(){
|
||||
if ($('#checkbox-search_sg').val() == 0) {
|
||||
$('#checkbox-search_sg').val(1);
|
||||
}else {
|
||||
$('#checkbox-search_sg').val(0);
|
||||
}
|
||||
});
|
||||
|
||||
$('table.alert-status-filter #ag_group').change (function () {
|
||||
var strict_user = $("#text-strict_user_hidden").val();
|
||||
var is_meta = $("#text-is_meta_hidden").val();
|
||||
|
@ -102,17 +102,37 @@ $agentCountModules = html_print_div(
|
||||
|
||||
$table_status = new stdClass();
|
||||
$table_status->id = 'agent_status_main';
|
||||
$table_status->width = '100%';
|
||||
$table_status->width = '90%';
|
||||
$table_status->height = 'auto';
|
||||
$table_status->cellspacing = 0;
|
||||
$table_status->cellpadding = 0;
|
||||
$table_status->class = 'floating_form';
|
||||
$table_status->style[0] = 'height: 32px; width: 30%; padding-right: 5px; text-align: end; vertical-align: top';
|
||||
$table_status->style[1] = 'height: 32px; width: 70%; padding-left: 5px; font-weight: lighter; vertical-align: top';
|
||||
$table_status->data['agent_os'][0] = __('OS');
|
||||
$agentOS = [];
|
||||
$agentOS[] = html_print_div([ 'content' => (empty($agent['os_version']) === true) ? get_os_name((int) $agent['id_os']) : $agent['os_version']], true);
|
||||
$agentOS[] = html_print_div([ 'style' => 'width: 16px;padding-left: 5px', 'content' => ui_print_os_icon($agent['id_os'], false, true, true, false, false, false, ['width' => '16px'])], true);
|
||||
$table_status->data['agent_os'][1] = html_print_div(['class' => 'agent_details_agent_data', 'content' => implode('', $agentOS)], true);
|
||||
$table_status->style[0] = 'height: 28px; width: 30%; padding-right: 5px; text-align: end; vertical-align: top';
|
||||
$table_status->style[1] = 'height: 28px; width: 70%; padding-left: 5px; font-weight: lighter; vertical-align: top';
|
||||
|
||||
$os_agent_text = '';
|
||||
$os_name = get_os_name((int) $agent['id_os']);
|
||||
if (empty($agent['os_version']) !== true) {
|
||||
$agent['os_version'] = io_safe_output($agent['os_version']);
|
||||
if (strpos($agent['os_version'], '(') !== false) {
|
||||
$os_name = preg_split('/[0-9]|[\(]/', $agent['os_version'])[0];
|
||||
$os_version = explode($os_name, explode('(', $agent['os_version'])[0])[1];
|
||||
$os_version_name = preg_split('/[\(]|[\)]/', $agent['os_version']);
|
||||
$os_agent_text = $os_version.' ('.$os_version_name[1].')';
|
||||
} else {
|
||||
$os_name = preg_split('/[0-9]/', $agent['os_version'])[0];
|
||||
$os_version = explode($os_name, explode('(', $agent['os_version'])[0])[1];
|
||||
$os_agent_text = $os_version;
|
||||
}
|
||||
}
|
||||
|
||||
$table_status->data['agent_os'][0] = html_print_div([ 'style' => 'width: 16px; position: relative; left: 75%', 'content' => ui_print_os_icon($agent['id_os'], false, true, true, false, false, false, ['width' => '16px'])], true);
|
||||
$table_status->data['agent_os'][1] = $os_name;
|
||||
|
||||
if (empty($agent['os_version']) !== true) {
|
||||
$table_status->data['agent_os_version'][0] = __('OS Version');
|
||||
$table_status->data['agent_os_version'][1] = $os_agent_text;
|
||||
}
|
||||
|
||||
$addresses = agents_get_addresses($id_agente);
|
||||
$address = agents_get_address($id_agente);
|
||||
@ -124,43 +144,48 @@ foreach ($addresses as $k => $add) {
|
||||
}
|
||||
|
||||
if (empty($address) === false) {
|
||||
$address_text = '<span class="bolder" >'.$address.'</span>';
|
||||
if (!empty($addresses) === true) {
|
||||
foreach ($addresses as $sec_address) {
|
||||
$address_text .= '<br/><span class="italic">'.$sec_address.'</span>';
|
||||
}
|
||||
}
|
||||
|
||||
$table_status->data['ip_address'][0] = __('IP address');
|
||||
$table_status->data['ip_address'][1] = (empty($address) === true) ? '<em>'.__('N/A').'</em>' : $address;
|
||||
$table_status->data['ip_address'][1] = (empty($address) === true) ? '<em>'.__('N/A').'</em>' : $address_text;
|
||||
}
|
||||
|
||||
$table_status->data['agent_version'][0] = __('Agent Version');
|
||||
$table_status->data['agent_version'][1] = (empty($agent['agent_version']) === true) ? '<i>'.__('N/A').'</i>' : $agent['agent_version'];
|
||||
|
||||
$table_status->data['description'][0] = __('Description');
|
||||
$table_status->data['description'][1] = (empty($agent['comentarios']) === true) ? '<em>'.__('N/A').'</em>' : $agent['comentarios'];
|
||||
$table_status->data['description'][1] = (empty($agent['comentarios']) === true) ? '<em>'.__('N/A').'</em>' : ui_print_truncate_text($agent['comentarios'], 'description', true);
|
||||
|
||||
$has_remote_conf = enterprise_hook(
|
||||
'config_agents_has_remote_configuration',
|
||||
[$agent['id_agente']]
|
||||
$agentEventsHeader = html_print_div(
|
||||
[
|
||||
'class' => 'agent_details_header',
|
||||
'content' => '<span class="subsection_header_title">'.__('Events (Last 24h)').'</span>',
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
if ((bool) $has_remote_conf) {
|
||||
$table_status->data['remote_config'][0] = __('Remote configuration');
|
||||
$table_status->data['remote_config'][1] = __('Enabled');
|
||||
|
||||
$satellite_server = (int) db_get_value_filter(
|
||||
'satellite_server',
|
||||
'tagente',
|
||||
['id_agente' => $id_agente]
|
||||
);
|
||||
|
||||
if (empty($satellite_server) === false) {
|
||||
$satellite_name = db_get_value_filter(
|
||||
'name',
|
||||
'tserver',
|
||||
['id_server' => $satellite_server]
|
||||
);
|
||||
|
||||
$table_status->data['remote_config'][0] = __('Satellite server');
|
||||
$table_status->data['remote_config'][1] = $satellite_name;
|
||||
}
|
||||
}
|
||||
|
||||
$agentEventsGraph = html_print_div(
|
||||
[
|
||||
'class' => 'white-table-graph-content',
|
||||
'content' => graph_graphic_agentevents(
|
||||
$id_agente,
|
||||
95,
|
||||
50,
|
||||
SECONDS_1DAY,
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
500
|
||||
),
|
||||
'style' => 'margin-top: -25px',
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$table_agent = $agentStatusHeader.'
|
||||
<div class="agent_details_content">
|
||||
@ -170,6 +195,9 @@ $table_agent = $agentStatusHeader.'
|
||||
<div class="agent_details_info">
|
||||
'.$alive_animation.html_print_table($table_status, true).'
|
||||
</div>
|
||||
</div>
|
||||
<div class="agent_details_graph">
|
||||
'.$agentEventsHeader.$agentEventsGraph.'
|
||||
</div>';
|
||||
|
||||
|
||||
@ -189,11 +217,12 @@ $data_opcional->class = 'floating_form';
|
||||
// Gis and url address.
|
||||
$agentAdditionalContent = '';
|
||||
// Position Information.
|
||||
if ((bool) $config['activate_gis'] === true) {
|
||||
/*
|
||||
if ((bool) $config['activate_gis'] === true) {
|
||||
$dataPositionAgent = gis_get_data_last_position_agent(
|
||||
$agent['id_agente']
|
||||
);
|
||||
if (is_array($dataPositionAgent) === true && $dataPositionAgent['stored_longitude'] !== '' && $dataPositionAgent['stored_longitude'] !== '') {
|
||||
if (is_array($dataPositionAgent) === true && $dataPositionAgent['stored_longitude'] !== '' && $dataPositionAgent['stored_latitude'] !== '') {
|
||||
$data_opcional->data['agent_position'][0] = __('Position (Long, Lat)');
|
||||
|
||||
$dataOptionalOutput = html_print_anchor(
|
||||
@ -210,10 +239,11 @@ if ((bool) $config['activate_gis'] === true) {
|
||||
|
||||
$data_opcional->data['agent_position'][1] = $dataOptionalOutput;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// If the url description is set.
|
||||
if (empty($agent['url_address']) === false) {
|
||||
/*
|
||||
if (empty($agent['url_address']) === false) {
|
||||
$data_opcional->data['url_address'][0] = __('Url address');
|
||||
$data_opcional->data['url_address'][1] = html_print_anchor(
|
||||
[
|
||||
@ -222,11 +252,12 @@ if (empty($agent['url_address']) === false) {
|
||||
],
|
||||
true
|
||||
);
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
// Other IP address and timezone offset.
|
||||
if (empty($addresses) === false) {
|
||||
/*
|
||||
if (empty($addresses) === false) {
|
||||
$data_opcional->data['other_ip_address'][0] = __('Other IP addresses');
|
||||
$data_opcional->data['other_ip_address'][1] = html_print_div(
|
||||
[
|
||||
@ -235,13 +266,14 @@ if (empty($addresses) === false) {
|
||||
],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
// Timezone Offset.
|
||||
if ((int) $agent['timezone_offset'] !== 0) {
|
||||
/*
|
||||
if ((int) $agent['timezone_offset'] !== 0) {
|
||||
$data_opcional->data['timezone_offset'][0] = __('Timezone Offset');
|
||||
$data_opcional->data['timezone_offset'][1] = $agent['timezone_offset'];
|
||||
}
|
||||
}*/
|
||||
|
||||
// Custom fields.
|
||||
$fields = db_get_all_rows_filter(
|
||||
@ -485,39 +517,6 @@ $agentContact = html_print_div(
|
||||
true
|
||||
);
|
||||
|
||||
$agentEventsHeader = html_print_div(
|
||||
[
|
||||
'class' => 'agent_details_header',
|
||||
'content' => '<span class="subsection_header_title">'.__('Events (Last 24h)').'</span>',
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$agentEventsGraph = html_print_div(
|
||||
[
|
||||
'class' => 'white-table-graph-content',
|
||||
'content' => graph_graphic_agentevents(
|
||||
$id_agente,
|
||||
95,
|
||||
70,
|
||||
SECONDS_1DAY,
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
500
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$agentEvents = html_print_div(
|
||||
[
|
||||
'class' => 'box-flat agent_details_col w50p',
|
||||
'content' => $agentEventsHeader.$agentEventsGraph,
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
/*
|
||||
* EVENTS TABLE END.
|
||||
*/
|
||||
|
@ -130,6 +130,11 @@ $severity = get_parameter(
|
||||
'filter[severity]',
|
||||
($filter['severity'] ?? '')
|
||||
);
|
||||
$regex = get_parameter(
|
||||
'filter[regex]',
|
||||
(io_safe_output($filter['regex']) ?? '')
|
||||
);
|
||||
unset($filter['regex']);
|
||||
$status = get_parameter(
|
||||
'filter[status]',
|
||||
($filter['status'] ?? '')
|
||||
@ -378,6 +383,7 @@ if (is_ajax() === true) {
|
||||
'te.owner_user',
|
||||
'if(te.ack_utimestamp > 0, te.ack_utimestamp,"") as ack_utimestamp',
|
||||
'te.custom_data',
|
||||
'te.event_custom_id',
|
||||
'te.data',
|
||||
'te.module_status',
|
||||
'ta.alias as agent_name',
|
||||
@ -472,7 +478,7 @@ if (is_ajax() === true) {
|
||||
|
||||
$data = array_reduce(
|
||||
$events,
|
||||
function ($carry, $item) use ($table_id, &$redirection_form_id, $filter, $compact_date, $external_url, $compact_name_event) {
|
||||
function ($carry, $item) use ($table_id, &$redirection_form_id, $filter, $compact_date, $external_url, $compact_name_event, $regex) {
|
||||
global $config;
|
||||
|
||||
$tmp = (object) $item;
|
||||
@ -1207,12 +1213,34 @@ if (is_ajax() === true) {
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($tmp) === false && $regex !== '') {
|
||||
$regex_validation = false;
|
||||
foreach (json_decode(json_encode($tmp), true) as $key => $field) {
|
||||
if (preg_match('/'.$regex.'/', $field)) {
|
||||
$regex_validation = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($regex_validation === false) {
|
||||
unset($tmp);
|
||||
}
|
||||
}
|
||||
|
||||
$carry[] = $tmp;
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
$data = array_values(
|
||||
array_filter(
|
||||
$data,
|
||||
function ($item) {
|
||||
return (bool) (array) $item;
|
||||
}
|
||||
)
|
||||
);
|
||||
$count = count($data);
|
||||
// RecordsTotal && recordsfiltered resultados totales.
|
||||
echo json_encode(
|
||||
[
|
||||
@ -1293,6 +1321,7 @@ if ($loaded_filter !== false && $from_event_graph != 1 && isset($fb64) === false
|
||||
$severity = $filter['severity'];
|
||||
$status = $filter['status'];
|
||||
$search = $filter['search'];
|
||||
$regex = $filter['regex'];
|
||||
$not_search = $filter['not_search'];
|
||||
$text_agent = $filter['text_agent'];
|
||||
$id_agent = $filter['id_agent'];
|
||||
@ -1861,6 +1890,13 @@ if (enterprise_hook(
|
||||
'eventos',
|
||||
'execute_event_responses',
|
||||
]
|
||||
) === false && enterprise_hook(
|
||||
'enterprise_acl',
|
||||
[
|
||||
$config['id_user'],
|
||||
'eventos',
|
||||
'operation/events/events',
|
||||
]
|
||||
) === false
|
||||
) {
|
||||
$readonly = true;
|
||||
@ -2057,6 +2093,12 @@ $in = '<div class="filter_input"><label>'.__('Severity').'</label>';
|
||||
$in .= $data.'</div>';
|
||||
$inputs[] = $in;
|
||||
|
||||
// REGEX search datatable.
|
||||
$in = '<div class="filter_input"><label>'.__('Regex search').ui_print_help_tip(__('Regular expresion to filter.'), true).'</label>';
|
||||
$in .= html_print_input_text('regex', $regex, '', '', 255, true);
|
||||
$in .= '</div>';
|
||||
$inputs[] = $in;
|
||||
|
||||
// User private filter.
|
||||
$inputs[] = html_print_input_hidden('private_filter_event', $private_filter_event, true);
|
||||
// Trick view in table.
|
||||
@ -3488,6 +3530,10 @@ $(document).ready( function() {
|
||||
click_button_remove_tag("without");
|
||||
});
|
||||
|
||||
$('#myInputTextField').keyup(function(){
|
||||
$("#table_events").search($(this).val()).draw() ;
|
||||
});
|
||||
|
||||
$("#button-events_form_search_bt").click(function(){
|
||||
show_events_graph();
|
||||
});
|
||||
|
@ -774,7 +774,7 @@ if ($access_console_node === true) {
|
||||
|
||||
// Check if was displayed inside other menu.
|
||||
if ($extension['operation_menu']['fatherId'] == '') {
|
||||
if ($extension_menu['name'] == 'Update manager') {
|
||||
if ($extension_menu['name'] == 'Warp update') {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
%define debug_package %{nil}
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.774
|
||||
%define release 231128
|
||||
%define release 231205
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -6,7 +6,7 @@
|
||||
%define debug_package %{nil}
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.774
|
||||
%define release 231128
|
||||
%define release 231205
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.774
|
||||
%define release 231128
|
||||
%define release 231205
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
@ -726,6 +726,7 @@ CREATE TABLE IF NOT EXISTS `tevento` (
|
||||
`custom_data` TEXT,
|
||||
`data` TINYTEXT,
|
||||
`module_status` INT NOT NULL DEFAULT 0,
|
||||
`event_custom_id` TEXT,
|
||||
PRIMARY KEY (`id_evento`),
|
||||
KEY `idx_agente` (`id_agente`),
|
||||
KEY `idx_agentmodule` (`id_agentmodule`),
|
||||
@ -1271,6 +1272,7 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` (
|
||||
`custom_data_filter_type` TINYINT UNSIGNED DEFAULT 0,
|
||||
`owner_user` TEXT,
|
||||
`private_filter_user` TEXT,
|
||||
`regex` TEXT,
|
||||
PRIMARY KEY (`id_filter`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
@ -2640,6 +2642,9 @@ CREATE TABLE IF NOT EXISTS `tdashboard` (
|
||||
`active` TINYINT NOT NULL DEFAULT 0,
|
||||
`cells` INT UNSIGNED DEFAULT 0,
|
||||
`cells_slideshow` TINYINT NOT NULL DEFAULT 0,
|
||||
`date_range` TINYINT NOT NULL DEFAULT 0,
|
||||
`date_from` INT NOT NULL DEFAULT 0,
|
||||
`date_to` INT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
@ -3031,7 +3036,6 @@ CREATE TABLE IF NOT EXISTS `tevent_rule` (
|
||||
`module` TEXT,
|
||||
`alert` TEXT,
|
||||
`criticity` TEXT,
|
||||
`user_comment` TEXT,
|
||||
`id_tag` TEXT,
|
||||
`name` TEXT,
|
||||
`group_recursion` TEXT,
|
||||
@ -3046,7 +3050,6 @@ CREATE TABLE IF NOT EXISTS `tevent_rule` (
|
||||
`operator_module` TEXT COMMENT 'Operator for module',
|
||||
`operator_alert` TEXT COMMENT 'Operator for alert',
|
||||
`operator_criticity` TEXT COMMENT 'Operator for criticity',
|
||||
`operator_user_comment` TEXT COMMENT 'Operator for user_comment',
|
||||
`operator_id_tag` TEXT COMMENT 'Operator for id_tag',
|
||||
`operator_log_content` TEXT COMMENT 'Operator for log_content',
|
||||
`operator_log_source` TEXT COMMENT 'Operator for log_source',
|
||||
|
@ -156,7 +156,8 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
||||
('gotty', '/usr/bin/gotty'),
|
||||
('custom_module_units', '{"bytes":"bytes","entries":"entries","files":"files","hits":"hits","sessions":"sessions","users":"users","ºC":"ºC","ºF":"ºF"}'),
|
||||
('server_unique_identifier', replace(uuid(),'-','')),
|
||||
('lts_name', '');
|
||||
('lts_name', ''),
|
||||
('lts_updates', 1);
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
@ -1167,9 +1168,9 @@ INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field
|
||||
INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`) VALUES (6,'Create Pandora ITSM ticket',16);
|
||||
INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (7, 'Pandora Google chat', 17, "", "data=_data_", "[PANDORA] Alert FIRED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", "", 0, 0, "", "data=_data_", "[PANDORA] Alert RECOVERED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", "");
|
||||
INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (8, 'Pandora Slack', 18, "data=_data_", "", ":red_circle:", "[PANDORA] Alert FIRED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", 0, 0, "data=_data_", "", ":green_circle:", "[PANDORA] Alert RECOVERED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "");
|
||||
INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (9, 'Pandora Telegram', 19, "", "[PANDORA] Alert FIRED on _agent_ / _module_ / _tiemstamp_ / _data_", "", "", "", "", "", "", "", "", 0, 0, "", "[PANDORA] Alert RECOVERED on _agent_ / _module_ / _tiemstamp_ / _data_", "", "", "", "", "", "", "", "");
|
||||
INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (9, 'Pandora Telegram', 19, "", "[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_", "", "", "", "", "", "", "", "", 0, 0, "", "[PANDORA] Alert RECOVERED on _agent_ / _module_ / _timestamp_ / _data_", "", "", "", "", "", "", "", "");
|
||||
INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (10, 'Pandora ilert', 20, "alert", "", "[PANDORA] Alert FIRED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", "", 0, 0, "resolved", "", "[PANDORA] Alert RECOVERED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", "");
|
||||
INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (11, 'Pandora Vonage', 21, "", "[PANDORA] Alert FIRED on _agent_ / _module_ / _tiemstamp_ / _data_", "", "", "", "", "", "", "", "", 0, 0, "", "[PANDORA] Alert RECOVERED on _agent_ / _module_ / _tiemstamp_ / _data_", "", "", "", "", "", "", "", "");
|
||||
INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (11, 'Pandora Vonage', 21, "", "[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_", "", "", "", "", "", "", "", "", 0, 0, "", "[PANDORA] Alert RECOVERED on _agent_ / _module_ / _timestamp_ / _data_", "", "", "", "", "", "", "", "");
|
||||
|
||||
|
||||
-- alert templates (default)
|
||||
@ -1194,7 +1195,7 @@ INSERT INTO `trecon_script` (`type`,`name`,`description`,`script`,`macros`) VALU
|
||||
INSERT INTO `trecon_script` (`type`,`name`,`description`,`script`,`macros`) VALUES (2, 'Discovery.Cloud', 'Discovery Cloud script to monitor Cloud technologies (AWS.EC2, AWS.S3, AWS.RDS, RDS,ȊWS.EKS)', '/usr/share/pandora_server/util/recon_scripts/pcm_client.pl', '{"1":{"macro":"_field1_","desc":"Configuration file","help":"","value":"","hide":""}}');
|
||||
|
||||
-- IPAM is 3.
|
||||
INSERT INTO `trecon_script` (`type`,`name`,`description`,`script`,`macros`) VALUES (4, 'IPMI Recon','Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 <info@artica.es>

Usage: ./ipmi-recon.pl <task_id> <group_id> <custom_field1> <custom_field2> <custom_field3> <custom_field4>

* custom_field1 = Network i.e.: 192.168.100.0/24
* custom_field2 = Username
* custom_field3 = Password
* custom_field4 = Additional parameters i.e.: -D LAN_2_0','/usr/share/pandora_server/util/recon_scripts/ipmi-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"i.e.: 192.168.100.0/24\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Additional parameters\",\"help\":\"Optional additional parameters such as -D LAN_2_0 to use IPMI ver 2.0 instead of 1.5.  These options will also be passed to the IPMI plugin when the current values are read.\",\"value\":\"\",\"hide\":\"\"}}');
|
||||
INSERT INTO `trecon_script` (`type`,`name`,`description`,`script`,`macros`) VALUES (4, 'IPMI Recon','Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 <info@pandorafms.com>

Usage: ./ipmi-recon.pl <task_id> <group_id> <custom_field1> <custom_field2> <custom_field3> <custom_field4>

* custom_field1 = Network i.e.: 192.168.100.0/24
* custom_field2 = Username
* custom_field3 = Password
* custom_field4 = Additional parameters i.e.: -D LAN_2_0','/usr/share/pandora_server/util/recon_scripts/ipmi-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"i.e.: 192.168.100.0/24\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Additional parameters\",\"help\":\"Optional additional parameters such as -D LAN_2_0 to use IPMI ver 2.0 instead of 1.5.  These options will also be passed to the IPMI plugin when the current values are read.\",\"value\":\"\",\"hide\":\"\"}}');
|
||||
|
||||
INSERT INTO `trecon_script` (`type`,`name`,`description`,`script`,`macros`) VALUES (3, 'IPAM Recon', 'This script is used to automatically detect network hosts availability and name, used as Recon Custom Script in the recon task. Parameters used are:\n\n* custom_field1 = network. i.e.: 192.168.100.0/24\n* custom_field2 = associated IPAM network id. i.e.: 4. Please do not change this value, it is assigned automatically in IPAM management.\n\nSee documentation for more information.', '/usr/share/pandora_server/util/recon_scripts/IPAMrecon.pl', '{"1":{"macro":"_field1_","desc":"Network","help":"i.e.: 192.168.100.0/24","value":"","hide":""}}');
|
||||
|
||||
@ -1214,7 +1215,7 @@ INSERT INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `max_retries`
|
||||
|
||||
INSERT INTO `tagent_custom_fields` VALUES (1,'Serial Number',0,0,'',0),(2,'Department',0,0,'',0),(3,'Additional ID',0,0,'',0),(4,'eHorusID',0,0,'',0);
|
||||
|
||||
INSERT INTO `ttag` VALUES (1,'network','Network equipment','http://artica.es','','',''),(2,'critical','Critical modules','','','',''),(3,'dmz','DMZ Network Zone','','','',''),(4,'performance','Performance anda capacity modules','','','',''),(5,'configuration','','','','','');
|
||||
INSERT INTO `ttag` VALUES (1,'network','Network equipment','http://pandorafms.com','','',''),(2,'critical','Critical modules','','','',''),(3,'dmz','DMZ Network Zone','','','',''),(4,'performance','Performance anda capacity modules','','','',''),(5,'configuration','','','','','');
|
||||
|
||||
INSERT INTO `tevent_response` VALUES (1,'Ping to host','Ping to the agent host','ping -c 5 _agent_address_','command',0,620,500,0,'',0,90,0),(3,'Create incident from event','Create a incident from the event with the standard incidents system of Pandora FMS','index.php?sec=workspace&sec2=operation/incidents/incident_detail&insert_form&from_event=_event_id_','url',0,0,0,1,'',0,90,0),(5,'Restart agent','Restart the agent with using UDP protocol.

To use this response is necessary to have installed Pandora FMS server and console in the same machine.','/usr/share/pandora_server/util/udp_client.pl _agent_address_ 41122 "REFRESH AGENT"','command',0,620,500,0,'',0,90,0),(6,'Ping to module agent host','Ping to the module agent host','ping -c 5 _module_address_','command',0,620,500,0,'',0,90,0),(7,'Create ticket in Pandora ITSM from event','Create a ticket in Pandora ITSM from an event','index.php?sec=manageTickets&sec2=operation/ITSM/itsm&operation=edit&from_event=_event_id_','url',0,0,0,1,'',0,90,1);
|
||||
|
||||
@ -2775,7 +2776,7 @@ SET @short_name = 'pandorafms.oracle';
|
||||
SET @name = 'Oracle';
|
||||
SET @section = 'app';
|
||||
SET @description = 'Monitor Oracle databases';
|
||||
SET @version = '1.0';
|
||||
SET @version = '1.1';
|
||||
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
|
||||
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user