diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 2cbd073e72..961430ed2d 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.774-231127 +Version: 7.0NG.774-231129 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index d22fd0695f..afccdacf6e 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.774-231127" +pandora_version="7.0NG.774-231129" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index f942f995b4..717ea04435 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1039,7 +1039,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.774'; -use constant AGENT_BUILD => '231127'; +use constant AGENT_BUILD => '231129'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index d1eb93e83f..89a42e7053 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.774 -%define release 231127 +%define release 231129 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec index d711fb699c..22f398cc58 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.774 -%define release 231127 +%define release 231129 %define debug_package %{nil} Summary: Pandora FMS Linux agent, binary version diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec index ea420e44ed..9b3432f0e8 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.774 -%define release 231127 +%define release 231129 %define debug_package %{nil} Summary: Pandora FMS Linux agent, binary version diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.spec b/pandora_agents/unix/pandora_agent.redhat_bin.spec index 3796b6ecd8..f36d3ee5ef 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.774 -%define release 231127 +%define release 231129 Summary: Pandora FMS Linux agent, binary version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 3480ae034d..7509428246 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.774 -%define release 231127 +%define release 231129 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index cdd83702fb..cf837d8d18 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.774" -PI_BUILD="231127" +PI_BUILD="231129" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 9cdd7c6d29..2da734487d 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{231127} +{231129} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 963a3116dc..11dd5631d0 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.774 Build 231127") +#define PANDORA_VERSION ("7.0NG.774 Build 231129") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index ff3ee2a969..07e506116e 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Pandora FMS" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.774(Build 231127))" + VALUE "ProductVersion", "(7.0NG.774(Build 231129))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 8bfb3754d1..c6182f77f3 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.774-231127 +Version: 7.0NG.774-231129 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index ad9d0a7a05..9a519e7218 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.774-231127" +pandora_version="7.0NG.774-231129" package_pear=0 package_pandora=1 diff --git a/pandora_console/extensions/agents_modules_csv.php b/pandora_console/extensions/agents_modules_csv.php index 6ed1061c11..e4a331338f 100644 --- a/pandora_console/extensions/agents_modules_csv.php +++ b/pandora_console/extensions/agents_modules_csv.php @@ -27,17 +27,18 @@ */ global $config; -if (true) { - include_once '../include/config.php'; - include_once '../include/functions_agents.php'; - include_once '../include/functions_reporting.php'; - include_once '../include/functions_modules.php'; - include_once '../include/functions_users.php'; +if ((bool) $config['metaconsole']) { include_once $config['homedir'].'/include/config.php'; include_once $config['homedir'].'/include/functions_agents.php'; include_once $config['homedir'].'/include/functions_reporting.php'; include_once $config['homedir'].'/include/functions_modules.php'; include_once $config['homedir'].'/include/functions_users.php'; +} else { + include_once '../include/config.php'; + include_once '../include/functions_agents.php'; + include_once '../include/functions_reporting.php'; + include_once '../include/functions_modules.php'; + include_once '../include/functions_users.php'; } @@ -106,7 +107,25 @@ if ($get_agents_module_csv === '1') { foreach ($results as $result) { foreach ($result as $key => $value) { - $out_csv .= io_safe_output($value).$divider; + if (preg_match('/Linux/i', $_SERVER['HTTP_USER_AGENT'])) { + $value = preg_replace( + '/\s+/', + ' ', + io_safe_output($value) + ); + } else { + $value = mb_convert_encoding( + preg_replace( + '/\s+/', + '', + io_safe_output($value) + ), + 'UTF-16LE', + 'UTF-8' + ); + } + + $out_csv .= $value.$divider; } $out_csv .= "\n"; diff --git a/pandora_console/extensions/api_checker.php b/pandora_console/extensions/api_checker.php index fce3e1a00f..38488fc9e4 100755 --- a/pandora_console/extensions/api_checker.php +++ b/pandora_console/extensions/api_checker.php @@ -99,7 +99,7 @@ function api_execute( if (empty($token) === true) { $data['apipass'] = $apipass; $data['user'] = $user; - $data['password'] = $password; + $data['pass'] = $password; } } diff --git a/pandora_console/extensions/dbmanager.php b/pandora_console/extensions/dbmanager.php index 983e208bef..acaaadd12c 100644 --- a/pandora_console/extensions/dbmanager.php +++ b/pandora_console/extensions/dbmanager.php @@ -90,7 +90,7 @@ function dbmgr_extension_main() // Header. ui_print_standard_header( - __('Database interface'), + __('DB interface'), 'images/gm_db.png', false, '', diff --git a/pandora_console/extras/mr/67.sql b/pandora_console/extras/mr/67.sql index 88082d4a6e..3e011368c4 100644 --- a/pandora_console/extras/mr/67.sql +++ b/pandora_console/extras/mr/67.sql @@ -1,10 +1,28 @@ START TRANSACTION; - +-- 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 treport_content ADD check_unknowns_graph tinyint DEFAULT 0 NULL; +-- 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; + 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`, diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 9fd0d8c7ef..557b855e09 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -922,22 +922,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), diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 9c318b4e9f..c396634f67 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -1391,7 +1391,6 @@ $table_advanced->data['made_enabled'][0] = html_print_checkbox_switch( false, '', false, - false, 'wp100 static' ); @@ -2004,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(); @@ -2028,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(); @@ -2355,30 +2334,48 @@ ui_require_jquery_file('json'); var message_error_percentage = ''; //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 + ); } /* ]]> */ diff --git a/pandora_console/godmode/agentes/module_manager_editor_prediction.php b/pandora_console/godmode/agentes/module_manager_editor_prediction.php index eb85a05618..095708d2b1 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_prediction.php +++ b/pandora_console/godmode/agentes/module_manager_editor_prediction.php @@ -131,9 +131,10 @@ if ($module_service_synthetic_selector !== ENTERPRISE_NOT_HOOK) { } $data = []; -$data[0] = __('Agent'); -$data[1] = __('Module'); -$data[2] = __('Period'); + +$data[0] = __('Module'); +$data[1] = __('Period'); + $table_simple->cellclass['caption_prediction_module'][0] = 'w33p'; $table_simple->cellclass['caption_prediction_module'][1] = 'w33p'; $table_simple->cellclass['caption_prediction_module'][2] = 'w33p'; @@ -163,34 +164,68 @@ $params['none_module_text'] = __('Select Module'); $params['use_hidden_input_idagent'] = true; $params['input_style'] = 'width: 100%;'; $params['hidden_input_idagent_id'] = 'hidden-id_agente_module_prediction'; -$data[0] = ui_print_agent_autocomplete_input($params); -if ($id_agente > 0) { - $predictionModuleInput = html_print_select_from_sql( - 'SELECT id_agente_modulo, nombre - FROM tagente_modulo - WHERE delete_pending = 0 - AND history_data = 1 - AND id_agente = '.$id_agente_clean.' - AND id_agente_modulo <> '.$id_agente_modulo, +if (strstr($page, 'policy_modules') === false) { + $modules = agents_get_modules($id_agente); + + $predictionModuleInput = html_print_select( + $modules, 'prediction_module', $prediction_module, '', - __('Select Module'), + '', 0, true, false, true, + '', false, - 'width: 100%;' + false, + false, + false, + false, + '', + false, + false, + false, + false, + true, + false, + false, + '', + false, + 'pm' ); } else { - $predictionModuleInput = ''; + $modules = index_array(policies_get_modules($policy_id, false, ['id', 'name'])); + + $predictionModuleInput = html_print_select( + $modules, + 'id_module_policy', + $module['custom_integer_1'], + '', + '', + 0, + true, + false, + true, + '', + false, + false, + false, + false, + false, + '', + false, + false, + true + ); } -$data[1] = $predictionModuleInput; -$data[2] = html_print_select([__('Weekly'), __('Monthly'), __('Daily')], 'custom_integer_2', $custom_integer_2, '', '', 0, true, false, true, '', false, 'width: 100%;'); -$data[2] .= html_print_input_hidden('id_agente_module_prediction', $id_agente, true); +$data[0] = $predictionModuleInput; +$data[1] = html_print_select([__('Weekly'), __('Monthly'), __('Daily')], 'custom_integer_2', $custom_integer_2, '', '', 0, true, false, true, '', false, 'width: 100%;'); +$data[1] .= html_print_input_hidden('id_agente_module_prediction', $id_agente, true); + $table_simple->cellclass['prediction_module'][0] = 'w33p'; $table_simple->cellclass['prediction_module'][1] = 'w33p'; $table_simple->cellclass['prediction_module'][2] = 'w33p'; @@ -264,7 +299,7 @@ if ($selector_form !== ENTERPRISE_NOT_HOOK) { } // Synthetic modules are an Enterprise feature. -$synthetic_module_form = enterprise_hook('get_synthetic_module_form'); +$synthetic_module_form = enterprise_hook('get_synthetic_module_form', [$policy_id]); if ($synthetic_module_form !== ENTERPRISE_NOT_HOOK) { $data = []; $data[0] = $synthetic_module_form; diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index 201d3cea4e..66717bc35b 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -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; diff --git a/pandora_console/godmode/massive/massive_add_alerts.php b/pandora_console/godmode/massive/massive_add_alerts.php index 57261a357b..ad5cc00e27 100755 --- a/pandora_console/godmode/massive/massive_add_alerts.php +++ b/pandora_console/godmode/massive/massive_add_alerts.php @@ -255,7 +255,18 @@ $table->data[1][1] = html_print_select( true, '', false, - 'width:180px;' + 'width:180px;', + false, + false, + false, + '', + false, + false, + false, + false, + true, + true, + true ); $table->data[1][2] = __('When select agents'); $table->data[1][2] .= '
'; @@ -271,7 +282,31 @@ $table->data[1][2] .= html_print_select( '', true ); -$table->data[1][3] = html_print_select([], 'module[]', '', false, '', '', true, true, false, '', false, 'width:180px;'); +$table->data[1][3] = html_print_select( + [], + 'module[]', + '', + false, + '', + '', + true, + true, + false, + '', + false, + 'width:180px;', + false, + false, + false, + '', + true, + false, + false, + false, + true, + true, + false +); $usr_groups = users_get_groups($config['id_user'], 'LW', true); $filter_groups = ''; diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index 94509ab820..171e16870b 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -367,6 +367,8 @@ if ($access_console_node === true) { $sub['godmode/alerts/alert_list']['text'] = __('List of Alerts'); $sub['godmode/alerts/alert_list']['id'] = 'List_of_Alerts'; $sub['godmode/alerts/alert_list']['pages'] = ['godmode/alerts/alert_view']; + $sub['godmode/agentes/planned_downtime.list']['text'] = __('Scheduled downtime'); + $sub['godmode/agentes/planned_downtime.list']['id'] = 'scheduled_downtime'; if ((bool) check_acl($config['id_user'], 0, 'LM') === true) { $sub['godmode/alerts/alert_templates']['text'] = __('Templates'); @@ -708,6 +710,17 @@ if ($access_console_node === true) { } if ($access_console_node === true) { + // Tools + $menu_godmode['tools']['text'] = __('Tools'); + $menu_godmode['tools']['sec2'] = 'operation/extensions'; + $menu_godmode['tools']['id'] = 'oper-extensions'; + $sub = []; + $sub['operation/agentes/exportdata']['text'] = __('Export data'); + $sub['operation/agentes/exportdata']['id'] = 'export_data'; + $sub['extensions/files_repo']['text'] = __('File repository'); + $sub['extensions/files_repo']['id'] = 'file_repository'; + $menu_godmode['tools']['sub'] = $sub; + // About. $menu_godmode['about']['text'] = __('About'); $menu_godmode['about']['id'] = 'about'; diff --git a/pandora_console/godmode/reporting/graph_container.php b/pandora_console/godmode/reporting/graph_container.php index b4fdcf521d..d7e0aefb78 100644 --- a/pandora_console/godmode/reporting/graph_container.php +++ b/pandora_console/godmode/reporting/graph_container.php @@ -95,7 +95,7 @@ $subsection = reporting_enterprise_add_graph_template_subsection('', $buttons); $buttons['graph_container'] = [ 'active' => true, 'text' => ''.html_print_image( - 'images/graph-container.svg@svg', + 'images/graph-container@svg.svg', true, [ 'title' => __('Graph container'), diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index bf2f9fae24..e2fec0a075 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -1086,6 +1086,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; @@ -3965,6 +4009,217 @@ if (is_metaconsole() === true) { ?> + + + + + + + __('All'), + 'critical' => __('Critical'), + 'warning' => __('Warning'), + ], + 'secmon_status', + $secmon_status, + ); + ?> + + + + + + + + + __('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 + ); + ?> + + + + + + + + + __('All'), + 'crit' => __('Critical'), + 'warn' => __('Warning'), + ], + 'vulnerabilities_status', + $vulnerabilities_status, + ); + ?> + + + + + + + + + __('All'), + ], + 'vul_package', + $vul_package, + ); + ?> + + + + + + + + + __('All'), + 'high' => __('High'), + 'low' => __('Low'), + 'none' => __('None'), + ], + 'vul_severity', + $vul_severity, + ); + ?> + + + + + + + + + __('All'), + 'H' => __('High'), + 'L' => __('Low'), + ], + 'vul_ac', + $vul_ac, + ); + ?> + + + + + + + + + __('All'), + 'H' => __('High'), + 'L' => __('Low'), + 'N' => __('None'), + ], + 'vul_pr', + $vul_pr, + ); + ?> + + + + + + + + + __('All'), + 'R' => __('Required'), + 'N' => __('None'), + ], + 'vul_ui', + $vul_ui, + ); + ?> + + + + + + + + + __('All'), + 'A' => __('Adjacent Network'), + 'L' => __('Local'), + 'N' => __('Network'), + 'P' => __('Physical'), + ], + 'vul_av', + (empty($vul_av) === true) ? 'all' : $vul_av, + '', + '', + 0, + false, + false, + false + ); + ?> + + + @@ -5692,6 +5947,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; } @@ -5846,7 +6122,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; } @@ -6903,6 +7196,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(); @@ -7803,6 +8105,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) { @@ -8045,6 +8391,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(``); + } else { + $(element).find("select").append(``); + } + }); + } +} + +function updatePackages() { + let id_agent = $('#hidden-id_agent').val(); + let server_id = $('#hidden-server_id').val(); + $.ajax({ + method: "POST", + url: "", + data: { + page: "", + 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, ''); + } + } + }); +} + $(document).ready(function () { $('[id^=period], #combo_graph_options, #combo_sla_sort_options').next().css('z-index', 0); diff --git a/pandora_console/godmode/reporting/reporting_builder.main.php b/pandora_console/godmode/reporting/reporting_builder.main.php index c0381acca2..d4914d2b58 100755 --- a/pandora_console/godmode/reporting/reporting_builder.main.php +++ b/pandora_console/godmode/reporting/reporting_builder.main.php @@ -180,8 +180,8 @@ if ($report_id_user == $config['id_user'] $options['div_class'] = ''; } - $table->data[2][1] = html_print_label_input_block( - __('Group'), + $table->data[3][0] = html_print_label_input_block( + __('Write Access Group'), html_print_select_groups( false, 'RW', @@ -216,7 +216,7 @@ if ($enterpriseEnable) { if (enterprise_installed() === true) { - $table->data[3][0] = html_print_label_input_block( + $table->data[4][0] = html_print_label_input_block( __('Generate cover page in PDF render'), html_print_checkbox_switch( 'cover_page_render', @@ -226,7 +226,7 @@ if (enterprise_installed() === true) { ) ); - $table->data[3][1] = html_print_label_input_block( + $table->data[4][1] = html_print_label_input_block( __('Generate index in PDF render'), html_print_checkbox_switch( 'index_render', diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index e0e06f0f42..cca61ed3e6 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -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( @@ -2979,6 +3029,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( diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php index 315702528e..39acc45c21 100644 --- a/pandora_console/godmode/servers/plugin.php +++ b/pandora_console/godmode/servers/plugin.php @@ -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.', + ''.__('metaconsole').'' ) ); } diff --git a/pandora_console/godmode/servers/servers.build_table.php b/pandora_console/godmode/servers/servers.build_table.php index 95b831b86c..516a62ea82 100644 --- a/pandora_console/godmode/servers/servers.build_table.php +++ b/pandora_console/godmode/servers/servers.build_table.php @@ -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] .= '
'.html_print_image( 'images/info-warning.svg', true, @@ -276,7 +276,7 @@ foreach ($servers as $server) { $data[9] .= ''; if (($names_servers[$safe_server_name] === true) && ($ext === '_server' || $server['type'] === 'enterprise satellite')) { - $data[9] .= ''; + $data[9] .= ''; $data[9] .= html_print_image( 'images/agents@svg.svg', true, diff --git a/pandora_console/godmode/setup/links.php b/pandora_console/godmode/setup/links.php index fc27454b48..20e61e95b0 100644 --- a/pandora_console/godmode/setup/links.php +++ b/pandora_console/godmode/setup/links.php @@ -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 ''; echo ''; + echo '
'; if ($creation_mode == 1) { echo ""; } else { @@ -179,10 +183,10 @@ if ((isset($_GET['form_add'])) or (isset($_GET['form_edit']))) { ) ); - echo '
'; + echo ''; } 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 = []; } diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index 6732612c9d..0f3b494fc5 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -93,7 +93,7 @@ $buttons['general'] = [ 'images/setup.png', true, [ - 'title' => __('General'), + 'title' => __('General setup'), 'class' => 'invert_filter', ] @@ -265,7 +265,7 @@ if (enterprise_installed()) { switch ($section) { case 'general': $buttons['general']['active'] = true; - $subpage = __('General'); + $subpage = __('General setup'); $help_header = 'setup_general_tab'; break; @@ -377,7 +377,7 @@ switch ($section) { // Header. ui_print_standard_header( - $subpage, + __('Setup').' » '.$subpage, '', false, $help_header, @@ -388,6 +388,10 @@ ui_print_standard_header( 'link' => '', 'label' => __('Setup'), ], + [ + 'link' => '', + 'label' => $subpage, + ], ] ); diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index 2732568208..47c78d8a18 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -766,6 +766,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 '
'; diff --git a/pandora_console/godmode/snmpconsole/snmp_alert.php b/pandora_console/godmode/snmpconsole/snmp_alert.php index 99895b3464..5f76fd1f9c 100755 --- a/pandora_console/godmode/snmpconsole/snmp_alert.php +++ b/pandora_console/godmode/snmpconsole/snmp_alert.php @@ -1952,6 +1952,7 @@ if ($create_alert || $update_alert) { [ 'border' => '0', 'alt' => __('Delete'), + 'class' => 'invert_filter main_menu_icon', ] ).' '; $data[1] .= ''; diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index fd62dde741..83e54f24c5 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -155,14 +155,92 @@ if (is_ajax() === true) { return; } + + if ($delete_profile === true) { + // Get parameters. + $result = false; + $id_user = (string) get_parameter('id_user'); + $id_up = (int) get_parameter('id_user_profile'); + $delete_user = (bool) get_parameter('delete_user', false); + $user_is_global_admin = users_is_admin($id_user); + + $perfilUser = db_get_row('tusuario_perfil', 'id_up', $id_up); + $id_perfil = $perfilUser['id_perfil']; + + db_pandora_audit( + AUDIT_LOG_USER_MANAGEMENT, + 'Deleted profile for user '.io_safe_output($id_user), + false, + false, + 'The profile with id '.$id_perfil.' in the group '.$perfilUser['id_grupo'] + ); + // Delete profile. + $profile_deleted = profile_delete_user_profile($id_user, $id_up); + // Check if exists more profiles. + $has_profile = db_get_row('tusuario_perfil', 'id_usuario', $id_user); + if ($profile_deleted === true) { + if ($has_profile === false && $user_is_global_admin === false && $delete_user === true) { + if (is_metaconsole() === true) { + $servers = metaconsole_get_servers(); + foreach ($servers as $server) { + // Connect to the remote console. + metaconsole_connect($server); + + // Delete the user. + $result = delete_user($id_user); + if ($result === true) { + db_pandora_audit( + AUDIT_LOG_USER_MANAGEMENT, + __('Deleted user %s from metaconsole', io_safe_output($id_user)) + ); + } + + // Restore the db connection. + metaconsole_restore_db(); + + // Log to the metaconsole too. + if ($result === true) { + db_pandora_audit( + AUDIT_LOG_USER_MANAGEMENT, + __( + 'Deleted user %s from %s', + io_safe_input($id_user), + io_safe_input($server['server_name']) + ) + ); + } + } + + $result = delete_user((string) $id_user); + + if ($result === true) { + db_pandora_audit( + AUDIT_LOG_USER_MANAGEMENT, + __('Deleted user %s', io_safe_output($id_user)) + ); + } + } else { + $result = delete_user((string) $id_user); + if ($result === true) { + db_pandora_audit( + AUDIT_LOG_USER_MANAGEMENT, + __('Deleted user %s', io_safe_output($id_user)) + ); + } + } + } else { + $result = $profile_deleted; + } + } + + return $result; + } } $tab = get_parameter('tab', 'user'); - // Save autorefresh list. $autorefresh_list = (array) get_parameter_post('autorefresh_list'); $autorefresh_white_list = (($autorefresh_list[0] === '') || ($autorefresh_list[0] === '0')) ? '' : json_encode($autorefresh_list); - // Header. if (is_metaconsole() === true) { user_meta_print_header(); @@ -195,11 +273,11 @@ if (is_metaconsole() === true) { ).'', ], ]; - $buttons[$tab]['active'] = true; } $edit_user = get_parameter('edit_user'); + ui_print_standard_header( ($edit_user) ? sprintf('%s [ %s ]', __('Update User'), $id) : __('Create User'), 'images/gm_users.png', @@ -222,11 +300,9 @@ if (is_metaconsole() === true) { ], ] ); - $sec = 'gusuarios'; } - if ((bool) $config['user_can_update_info'] === true) { $view_mode = false; } else { @@ -348,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']]; @@ -596,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'); @@ -643,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']]; @@ -866,89 +949,6 @@ if ($update_user) { $user_info = $values; } -if ($delete_profile) { - $id2 = (string) get_parameter('id_user'); - $id_up = (int) get_parameter('id_user_profile'); - $perfilUser = db_get_row('tusuario_perfil', 'id_up', $id_up); - $id_perfil = $perfilUser['id_perfil']; - $perfil = db_get_row('tperfil', 'id_perfil', $id_perfil); - - db_pandora_audit( - AUDIT_LOG_USER_MANAGEMENT, - 'Deleted profile for user '.io_safe_output($id2), - false, - false, - 'The profile with id '.$id_perfil.' in the group '.$perfilUser['id_grupo'] - ); - - $return = profile_delete_user_profile($id2, $id_up); - ui_print_result_message( - $return, - __('Successfully deleted'), - __('Could not be deleted') - ); - - - $has_profile = db_get_row('tusuario_perfil', 'id_usuario', $id2); - $user_is_global_admin = users_is_admin($id2); - - if ($has_profile === false && $user_is_global_admin === false) { - $result = delete_user($id2); - - if ($result === true) { - db_pandora_audit( - AUDIT_LOG_USER_MANAGEMENT, - __('Deleted user %s', io_safe_output($id_user)) - ); - } - - ui_print_result_message( - $result, - __('Successfully deleted'), - __('There was a problem deleting the user') - ); - - // Delete the user in all the consoles. - if (is_metaconsole() === true) { - $servers = metaconsole_get_servers(); - foreach ($servers as $server) { - // Connect to the remote console. - metaconsole_connect($server); - - // Delete the user. - $result = delete_user($id_user); - if ($result === true) { - db_pandora_audit( - AUDIT_LOG_USER_MANAGEMENT, - __('Deleted user %s from metaconsole', io_safe_output($id_user)) - ); - } - - // Restore the db connection. - metaconsole_restore_db(); - - // Log to the metaconsole too. - if ($result === true) { - db_pandora_audit( - AUDIT_LOG_USER_MANAGEMENT, - __( - 'Deleted user %s from %s', - io_safe_input($id_user), - io_safe_input($server['server_name']) - ) - ); - } - - ui_print_result_message( - $result, - __('Successfully deleted from %s', io_safe_input($server['server_name'])), - __('There was a problem deleting the user from %s', io_safe_input($server['server_name'])) - ); - } - } - } -} - if ((int) $status !== -1) { ui_print_result_message( $status, @@ -1159,6 +1159,13 @@ if (is_user_admin($id) === true) { ); } +html_print_div( + [ + 'id' => 'delete_profile_modal', + 'content' => '', + ] +); + $full_name = '
'.html_print_input_text_extended( 'fullname', $user_info['fullname'], @@ -1931,24 +1938,87 @@ if (is_metaconsole() === false) { } }); }); - + $('input:image[name="del"]').click(function(e) { - if ($(json_profile).length > 0) return; - if (!confirm('Are you sure?')) return; - e.preventDefault(); - var rows = $("#table_profiles tr").length; - if (((is_metaconsole === '1' && rows <= 4) || (is_metaconsole === '' && rows <= 3)) && user_is_global_admin !== '1') { - if (!confirm('' + '. ' + '')) { - return; - } - } + + var rows = $("#table_profiles tr").length; + let deleteuser = 0; + e.preventDefault(); var id_user_profile = $(this).siblings(); id_user_profile = id_user_profile[1].value; var row = $(this).closest('tr'); + if (((is_metaconsole === '1' && rows <= 3) || (is_metaconsole !== '1' && rows <= 3)) && user_is_global_admin !== '1') { + $("#delete_profile_modal") + .empty() + .html(""); + // Set the title. + $("#delete_profile_modal").prop("title", ""); + // Build the dialog for show the mesage. + $("#delete_profile_modal").dialog({ + resizable: true, + draggable: true, + modal: true, + width: 500, + buttons: [ + { + text: "Cancel", + click: function() { + $(this).dialog("close"); + return false; + } + }, + { + text: "Delete", + click: function() { + $(this).dialog("close"); + deleteuser = 1; + delete_user_profile(id_user_profile, row, id_user, deleteuser); + } + }, + { + text: "Preserve", + click: function() { + $(this).dialog("close"); + deleteuser = 0; + delete_user_profile(id_user_profile, row, id_user, deleteuser) + } + } + ], + overlay: { + opacity: 0.5, + background: "black" + }, + closeOnEscape: false, + open: function(event, ui) { + $(".ui-dialog-titlebar-close").hide(); + } + }); + } else { + if (((is_metaconsole === '1' && rows <= 3) || (is_metaconsole === '' && rows <= 3)) && user_is_global_admin !== '1') { + if (!confirm('' + '. ' + '')) { + return false; + } else { + delete_user_profile(id_user_profile, row, id_user, deleteuser); + } + } else { + if (!confirm('Are you sure?')) { + return false; + } else { + delete_user_profile(id_user_profile, row, id_user, deleteuser); + } + } + } + + if ($(json_profile).length > 0) return; + }); + + function delete_user_profile(id_user_profile, row, id_user, deleteuser){ var params = []; params.push("delete_profile=1"); + params.push("edit_user=1"); + params.push("delete_user=" + deleteuser); params.push("id_user=" + id_user); params.push("id_user_profile=" + id_user_profile); params.push("page=godmode/users/configure_user"); @@ -1959,15 +2029,14 @@ if (is_metaconsole() === false) { success: function(data) { row.remove(); var rows = $("#table_profiles tr").length; - - if (is_metaconsole === '' && rows <= 2 && user_is_global_admin !== '1') { + if (is_metaconsole === '' && rows <= 2 && user_is_global_admin !== '1' && deleteuser == '1') { window.location.replace(""); - } else if (is_metaconsole === '1' && rows <= 3 && user_is_global_admin !== '1') { + } else if (is_metaconsole === '1' && rows <= 2 && user_is_global_admin !== '1' && deleteuser == '1') { window.location.replace(""); } } }); - }); + } function checkProfiles(e) { e.preventDefault(); diff --git a/pandora_console/godmode/users/user_management.php b/pandora_console/godmode/users/user_management.php index ab6269d0b8..b1212c11ec 100644 --- a/pandora_console/godmode/users/user_management.php +++ b/pandora_console/godmode/users/user_management.php @@ -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[] = ''.__('Enable IP allowlist').''; + $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[] = ''.__('Allow all IPs').''; -$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(); + } +} \ No newline at end of file diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index b93d51b522..f3e6627388 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -1168,7 +1168,9 @@ if (check_login()) { ); } + $data[2] .= ''; $data[2] .= ui_print_truncate_text($module['nombre'], 'module_medium', false, true, true, '…', 'font-size: 9pt;'); + $data[2] .= ''; if (empty($module['extended_info']) === false) { $data[2] .= ui_print_help_tip($module['extended_info'], true, '/images/default_list.png'); } diff --git a/pandora_console/include/class/AgentsAlerts.class.php b/pandora_console/include/class/AgentsAlerts.class.php index e55566f469..70c1ff9e3c 100644 --- a/pandora_console/include/class/AgentsAlerts.class.php +++ b/pandora_console/include/class/AgentsAlerts.class.php @@ -457,9 +457,7 @@ class AgentsAlerts extends HTML $template2 = get_parameter('template'); $module_action_threshold = get_parameter('module_action_threshold'); $action_select = get_parameter('action_select', 0); - - $id_alert = alerts_create_alert_agent_module($this->create_alert, $template2); - + $id_alert = alerts_create_alert_agent_module($this->createAlert, $template2); if ($id_alert !== false) { if ($action_select != 0) { $values = []; diff --git a/pandora_console/include/class/Diagnostics.class.php b/pandora_console/include/class/Diagnostics.class.php index aa5d5995af..ea3caaf276 100644 --- a/pandora_console/include/class/Diagnostics.class.php +++ b/pandora_console/include/class/Diagnostics.class.php @@ -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'), diff --git a/pandora_console/include/class/WelcomeWindow.class.php b/pandora_console/include/class/WelcomeWindow.class.php index 3b49e1a56f..dec741c3f0 100644 --- a/pandora_console/include/class/WelcomeWindow.class.php +++ b/pandora_console/include/class/WelcomeWindow.class.php @@ -372,7 +372,7 @@ class WelcomeWindow extends Wizard $flag_um = true; } - if (empty($config['welcome_mail_configured']) === false) { + if (empty($config['email_username']) === false && empty($config['email_password']) === false) { $btn_configure_mail_class = ''; $li_configure_mail_class = 'row_green'; $flag_cm = true; @@ -1135,7 +1135,7 @@ class WelcomeWindow extends Wizard } function configureEmail() { - window.location = ''; + window.location = ''; } function serversUp() { diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index efb2c99128..317a84b39f 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC231127'; +$build_version = 'PC231129'; $pandora_version = 'v7.0NG.774'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 195b509106..2d6803ccd4 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -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[] = ''.__('N/A').''; + $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] = ''.__('Secondary groups').''; - $data[1] = implode(', ', $secondaryLinks); - $table_contact->data[] = $data; + if (!empty($secondaryLinks) === true) { + $data[0] = ''.__('Secondary groups').''; + $data[1] = implode(', ', $secondaryLinks); + $table_contact->data[] = $data; + } // Parent agent line. if (enterprise_installed() === true) { - $data = []; - $data[0] = ''.__('Parent').''; - if ((int) $agent['id_parent'] === 0) { - $data[1] = ''.__('N/A').''; - } else { + if ((int) $agent['id_parent'] !== 0) { + $data = []; + $data[0] = ''.__('Parent').''; $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] = ''.__('Enabled').''; + $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', diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index bfdd131748..0e8c347e83 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -371,6 +371,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'); } @@ -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); } diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 69f16182e6..5b37dc51d2 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -774,6 +774,7 @@ function html_print_select( $select2_multiple_enable_all=false, $form='', $order=false, + $custom_id=null ) { $output = "\n"; @@ -789,6 +790,10 @@ function html_print_select( $id = preg_replace('/[^a-z0-9\:\;\-\_]/i', '', $name.($idcounter[$name] ? $idcounter[$name] : '')); + if ($custom_id !== null) { + $id = $custom_id; + } + $attributes = ''; if (!empty($script)) { $attributes .= ' onchange="'.$script.'"'; @@ -1740,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) { diff --git a/pandora_console/include/functions_menu.php b/pandora_console/include/functions_menu.php index 346dee04b5..1df84f6025 100644 --- a/pandora_console/include/functions_menu.php +++ b/pandora_console/include/functions_menu.php @@ -1170,6 +1170,14 @@ if (is_ajax()) {

'.$sys_info->data->ramInfo->value.'

+ + +

'.$sys_info->data->distroInfo->name.'

+ + +

'.$sys_info->data->distroInfo->value.'

+ +

'.$sys_info->data->osInfo->name.'

diff --git a/pandora_console/include/functions_messages.php b/pandora_console/include/functions_messages.php index 189844c174..fe35d5b5a6 100644 --- a/pandora_console/include/functions_messages.php +++ b/pandora_console/include/functions_messages.php @@ -122,6 +122,7 @@ function messages_create_message( 'id_usuario_origen' => $usuario_origen, 'subject' => $subject, 'mensaje' => $mensaje, + 'subtype' => 'NOTIF.MESSAGE', 'id_source' => get_notification_source_id('message'), 'timestamp' => get_system_time(), ] diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index de618605c8..090bb8bdb9 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -4735,7 +4735,7 @@ function export_agents_module_csv($filters) $query_filter .= ' AND tam.nombre IN '.$module_filter.' '; } else { $module_filter = '('.implode(', ', $filter).')'; - $query_filter .= ' AND tam.id_tipo_modulo IN '.$module_filter.' '; + $query_filter .= ' AND tam.id_agente_modulo IN '.$module_filter.' '; } } break; diff --git a/pandora_console/include/functions_profile.php b/pandora_console/include/functions_profile.php index 7cdbd1c461..d97edf17aa 100644 --- a/pandora_console/include/functions_profile.php +++ b/pandora_console/include/functions_profile.php @@ -308,7 +308,7 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c 'del', 'images/delete.svg', 1, - '', + 'background-color: transparent !important;', true, [ 'onclick' => 'delete_profile(event, this)', @@ -316,8 +316,15 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c ] ); } else { - $data['actions'] = ''; - $data['actions'] .= html_print_input_image('del', 'images/delete.svg', 1, '', true, ['class' => 'main_menu_icon invert_filter']); + $data['actions'] = ''; + $data['actions'] .= html_print_input_image( + 'del', + 'images/delete.svg', + 1, + 'background-color: transparent !important;', + true, + ['class' => 'main_menu_icon invert_filter'] + ); $data['actions'] .= html_print_input_hidden('delete_profile', 1, true); $data['actions'] .= html_print_input_hidden('id_user_profile', $profile['id_up'], true); $data['actions'] .= html_print_input_hidden('id_user', $id, true); @@ -391,7 +398,14 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c $data['last_hierarchy'] = html_print_checkbox('no_hierarchy', 1, false, true); - $data['last_actions'] = html_print_input_image('add', 'images/validate.svg', 1, '', true, ['class' => 'main_menu_icon invert_filter']); + $data['last_actions'] = html_print_input_image( + 'add', + 'images/validate.svg', + 1, + 'background-color: transparent !important;', + true, + ['class' => 'main_menu_icon invert_filter'] + ); $data['last_actions'] .= html_print_input_hidden('id', $id, true); $data['last_actions'] .= html_print_input_hidden('add_profile', 1, true); $data['last_actions'] .= ''; diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 64e6c5670b..dce7dd9efc 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -42,6 +42,7 @@ require_once $config['homedir'].'/include/functions_users.php'; enterprise_include_once('include/functions_reporting.php'); enterprise_include_once('include/functions_metaconsole.php'); enterprise_include_once('include/functions_inventory.php'); +require_once $config['homedir'].'/include/functions_inventory.php'; enterprise_include_once('include/functions_cron.php'); require_once $config['homedir'].'/include/functions_forecast.php'; require_once $config['homedir'].'/include/functions_ui.php'; @@ -1023,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; @@ -13641,38 +13698,47 @@ function reporting_tiny_stats( } if ($modern === true) { - $out .= '
'; if (isset($fired_count) && $fired_count > 0) { + $out .= '
'; $out .= '
'; $out .= ''.$fired_count.'
'; + $out .= '
'; } if (isset($critical_count) && $critical_count > 0) { + $out .= '
'; $out .= '
'; $out .= ''.$critical_count.'
'; + $out .= '
'; } if (isset($warning_count) && $warning_count > 0) { + $out .= '
'; $out .= '
'; $out .= ''.$warning_count.'
'; + $out .= '
'; } if (isset($unknown_count) && $unknown_count > 0) { + $out .= '
'; $out .= '
'; $out .= ''.$unknown_count.'
'; + $out .= '
'; } if (isset($not_init_count) && $not_init_count > 0) { + $out .= '
'; $out .= '
'; $out .= ''.$not_init_count.'
'; + $out .= '
'; } if (isset($normal_count) && $normal_count > 0) { + $out .= '
'; $out .= '
'; $out .= ''.$normal_count.'
'; + $out .= '
'; } - - $out .= '
'; } else { // Classic ones. $out .= ''.$total_count.''; diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index fddfc16528..6699d2c74d 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -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. * diff --git a/pandora_console/include/functions_reports.php b/pandora_console/include/functions_reports.php index 3da9993933..e5b8f52b7b 100755 --- a/pandora_console/include/functions_reports.php +++ b/pandora_console/include/functions_reports.php @@ -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 graph donut'), + ]; + + $types['vuls_by_packages'] = [ + 'optgroup' => __('Vulnerabilities'), + 'name' => __('By packages in graph pie'), + ]; + + $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; diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 516c2ddb51..b6a7486455 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -409,8 +409,7 @@ function ui_print_message($message, $class='', $attributes='', $return=false, $t $messageTable->colspan[1][0] = 2; $messageTable->data = []; - $messageTable->data[0][0] = ''.$text_title.''; - $messageTable->data[0][1] = $closeButton; + $messageTable->data[0][0] = ''.$text_title.''.$closeButton; $messageTable->data[1][0] = ''.$text_message.''; // JavaScript help vars. diff --git a/pandora_console/include/javascript/jquery.pandora.controls.js b/pandora_console/include/javascript/jquery.pandora.controls.js index c42f205b60..640e83c26d 100644 --- a/pandora_console/include/javascript/jquery.pandora.controls.js +++ b/pandora_console/include/javascript/jquery.pandora.controls.js @@ -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); }, diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index 2b906e61f6..1a59ab50e8 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -305,7 +305,7 @@ function agent_changed_by_multiple_agents(event, id_agent, selected) { $("") .html(anyText) .attr("value", 0) - .prop("selected", true) + .prop("selected", false) ); } } @@ -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"); + } } } diff --git a/pandora_console/include/javascript/pandora_dashboards.js b/pandora_console/include/javascript/pandora_dashboards.js index 80d0625e4a..283acf8005 100644 --- a/pandora_console/include/javascript/pandora_dashboards.js +++ b/pandora_console/include/javascript/pandora_dashboards.js @@ -310,8 +310,6 @@ function initialiceLayout(data) { } function duplicateWidget(original_cellId, original_widgetId) { - let duplicate_cellId = insertCellLayoutForDuplicate(); - $.ajax({ method: "post", url: data.url, @@ -320,16 +318,14 @@ function initialiceLayout(data) { method: "duplicateWidget", dashboardId: data.dashboardId, widgetId: original_widgetId, - cellId: original_cellId, - duplicateCellId: duplicate_cellId + cellId: original_cellId }, dataType: "json", - success: function(success) { - console.log(success); + success: function(data) { + addCell(data.cellId, 0, 0, 4, 4, true, 0, 2000, 0, 2000, 0, true); }, - error: function(error) { - console.log(error); - return []; + error: function(xhr, textStatus, errorMessage) { + console.log("ERROR" + errorMessage + textStatus + xhr); } }); } @@ -428,8 +424,8 @@ function initialiceLayout(data) { } }); } - - function insertCellLayoutForDuplicate() { + /* + function insertCellLayoutForDuplicate(original_cell_id) { let duplicateCellId = 0; $.ajax({ async: false, @@ -441,7 +437,8 @@ function initialiceLayout(data) { dashboardId: data.dashboardId, auth_class: data.auth.class, auth_hash: data.auth.hash, - id_user: data.auth.user + id_user: data.auth.user, + copy: original_cell_id }, dataType: "json", success: function(data) { @@ -449,7 +446,7 @@ function initialiceLayout(data) { // width and height = 4 // position auto = true. if (data.cellId !== 0) { - addCell(data.cellId, 0, 0, 4, 4, true, 0, 2000, 0, 2000, 0, true); + addCell(data.cellId, 0, 0, 4, 4, true, 0, 2000, 0, 2000, 0, true, original_cell_id); duplicateCellId = data.cellId; } }, @@ -458,7 +455,7 @@ function initialiceLayout(data) { } }); return duplicateCellId; - } + }*/ function configurationWidget(cellId, widgetId, size) { load_modal({ diff --git a/pandora_console/include/lib/Dashboard/Manager.php b/pandora_console/include/lib/Dashboard/Manager.php index 10ab96986c..4430bfa253 100644 --- a/pandora_console/include/lib/Dashboard/Manager.php +++ b/pandora_console/include/lib/Dashboard/Manager.php @@ -615,10 +615,25 @@ class Manager implements PublicLogin /** * Duplicate widget. * - * @return integer + * @return void */ - public function duplicateWidget():int + public function duplicateWidget():void { + global $config; + + $return = false; + + $position = [ + 'x' => 0, + 'y' => 0, + 'width' => 4, + 'height' => 4, + ]; + + $cellClass = new Cell($position, $this->dashboardId); + $dataCell = $cellClass->get(); + + // $result = ['cellId' => $dataCell['id']]; $original_widget = []; $original_cellId = $this->cellId; @@ -638,12 +653,23 @@ class Manager implements PublicLogin 'options' => $options_json, 'id_widget' => $original_widget['id_widget'], ]; + $res = \db_process_sql_update( 'twidget_dashboard', $values, - ['id' => $this->duplicateCellId] + ['id' => $dataCell['id']] ); - return $res; + + if ($res === 1) { + $return = [ + 'cellId' => $dataCell['id'], + 'widgetId' => $original_widget['id_widget'], + ]; + + $json_return = json_encode($return); + } + + echo $json_return; } diff --git a/pandora_console/include/lib/Dashboard/Widgets/inventory.php b/pandora_console/include/lib/Dashboard/Widgets/inventory.php index 1bcacf4da8..a8fc01ee1c 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/inventory.php +++ b/pandora_console/include/lib/Dashboard/Widgets/inventory.php @@ -393,9 +393,10 @@ class InventoryWidget extends Widget public function load() { global $config; - + include_once $config['homedir'].'/include/functions_inventory.php'; $inventory_id_agent = $this->values['agentId']; $inventory_agent = $this->values['agentAlias']; + $cellId = $this->cellId; if (strlen($inventory_agent) === 0) { $inventory_id_agent = -1; @@ -610,7 +611,7 @@ class InventoryWidget extends Widget } } - $id_table = 'id_'.$row['id_module_inventory'].'_'.uniqid().'_'.$nodo['server_uid']; + $id_table = 'id_'.$row['id_module_inventory'].'_'.$nodo['server_uid'].'_'.$cellId; $table = ui_print_datatable( [ 'id' => $id_table, @@ -682,7 +683,7 @@ class InventoryWidget extends Widget $agents, ''.$node_name.'', '', - '', + $cellId, false, false, '', @@ -729,7 +730,7 @@ class InventoryWidget extends Widget } } - $id_table = 'id_'.$row['id_module_inventory'].'_'.uniqid().'_'.$nodo['server_uid']; + $id_table = 'id_'.$row['id_module_inventory'].'_'.$nodo['server_uid'].'_'.$cellId; $table = ui_print_datatable( [ @@ -801,7 +802,7 @@ class InventoryWidget extends Widget $agents, ''.$node_name.'', '', - '', + $cellId, false, false ); @@ -826,7 +827,7 @@ class InventoryWidget extends Widget ); } - if (count($agents_ids) === 0 || (int) $rows === ERR_NODATA) { + if (count($agents_ids) === 0 || (int) $rows === ERR_NODATA || empty($rows) === true) { ui_print_info_message( [ 'no_close' => true, @@ -895,7 +896,7 @@ class InventoryWidget extends Widget } } - $id_table = 'id_'.$key_row.'_'.$row['id_module_inventory'].'_'.uniqid().'_'.$row['id_agente']; + $id_table = 'id_'.$key_row.'_'.$row['id_module_inventory'].'_'.$row['id_agente'].'_'.$cellId; $table = ui_print_datatable( [ @@ -950,7 +951,7 @@ class InventoryWidget extends Widget $modules, $agent_rows['agent'], '', - '', + $cellId, false, false, '', @@ -987,7 +988,7 @@ class InventoryWidget extends Widget array_push($data, $data_tmp); } - $id_table = 'id_'.$row['id_module_inventory'].'_'.uniqid(); + $id_table = 'id_'.$row['id_module_inventory'].'_'.$cellId; } if ($count_rows > 1) { @@ -1000,8 +1001,8 @@ class InventoryWidget extends Widget 'column_names' => $columns, 'no_sortable_columns' => [], 'data_element' => $data, - 'searching' => true, - 'dom_elements' => 'rtilp', + 'searching' => false, + 'dom_elements' => 'frtilp', 'order' => [ 'field' => $columns[0], 'direction' => 'asc', @@ -1010,11 +1011,9 @@ class InventoryWidget extends Widget 'emptyTable' => __('No inventory found'), 'return' => true, 'no_sortable_columns' => [], - 'mini_search' => true, + 'mini_search' => false, 'mini_pagination' => true, 'csv' => 0, - 'mini_pagination' => true, - 'mini_search' => true, ] ); @@ -1022,7 +1021,7 @@ class InventoryWidget extends Widget $table, array_shift($module_rows)['name'], '', - '', + $cellId, false, false ); @@ -1092,9 +1091,11 @@ class InventoryWidget extends Widget __('Values Custom Fields'), ]; + $basic_info_id = 'id_'.$row['id_module_inventory'].'_'.$cellId; + ui_print_datatable( [ - 'id' => 'basic_info', + 'id' => $basic_info_id, 'class' => $class, 'style' => $style, 'columns' => $columns, diff --git a/pandora_console/include/lib/Dashboard/Widgets/post.php b/pandora_console/include/lib/Dashboard/Widgets/post.php index d6274e279d..df20869780 100755 --- a/pandora_console/include/lib/Dashboard/Widgets/post.php +++ b/pandora_console/include/lib/Dashboard/Widgets/post.php @@ -221,9 +221,10 @@ class PostWidget extends Widget 'type' => 'textarea', 'value' => $values['text'], 'return' => true, - 'rows' => 1, - 'columns' => 1, + 'rows' => 25, + 'columns' => 100, 'size' => 25, + 'style' => 'display: none;', ], ]; @@ -296,7 +297,7 @@ class PostWidget extends Widget public function getSizeModalConfiguration(): array { $size = [ - 'width' => 500, + 'width' => 1000, 'height' => 500, ]; diff --git a/pandora_console/include/lib/Dashboard/Widgets/single_graph.php b/pandora_console/include/lib/Dashboard/Widgets/single_graph.php index beb5852d38..a718217a57 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/single_graph.php +++ b/pandora_console/include/lib/Dashboard/Widgets/single_graph.php @@ -328,7 +328,7 @@ class SingleGraphWidget extends Widget // Autocomplete module. $inputs[] = [ - 'label' => __('Module'), + 'label' => __('Module').ui_print_help_tip(__('Warning, this requires to have data for a mid-term (days/weeks) of the source data, if not, projection will not be reliable.'), true), 'arguments' => [ 'type' => 'autocomplete_module', 'name' => 'moduleId', diff --git a/pandora_console/include/lib/Dashboard/Widgets/top_n.php b/pandora_console/include/lib/Dashboard/Widgets/top_n.php index f732f8b264..5e885927db 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/top_n.php +++ b/pandora_console/include/lib/Dashboard/Widgets/top_n.php @@ -424,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 .= '
'; + $output .= \ui_print_info_message( + __('Invalid regex'), + '', + true + ); + $output .= '
'; + return $output; + } + // This function check ACL. $agents = @agents_get_group_agents(0, ['aliasRegex' => $agentRegex]); $agentsId = \array_keys($agents); diff --git a/pandora_console/include/styles/agent_view.css b/pandora_console/include/styles/agent_view.css index d4a1d89a4e..1df8efdb84 100644 --- a/pandora_console/include/styles/agent_view.css +++ b/pandora_console/include/styles/agent_view.css @@ -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; } diff --git a/pandora_console/include/styles/form.css b/pandora_console/include/styles/form.css index a0e5957358..c212d459f6 100644 --- a/pandora_console/include/styles/form.css +++ b/pandora_console/include/styles/form.css @@ -279,8 +279,8 @@ form.modal ul.wizard li { flex-wrap: nowrap; } -form.modal-dashboard ul.wizard li *, -form.modal ul.wizard li *:not(.tox.tox-tinymce *) { +form.modal-dashboard ul.wizard li > *, +form.modal ul.wizard li > *:not(.tox.tox-tinymce *) { flex: 1 1 50%; } diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 50d3ec4778..0879c38f88 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -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; diff --git a/pandora_console/include/styles/pandora_black.css b/pandora_console/include/styles/pandora_black.css index e2f5eb1639..1e2cc377fc 100644 --- a/pandora_console/include/styles/pandora_black.css +++ b/pandora_console/include/styles/pandora_black.css @@ -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; } diff --git a/pandora_console/include/styles/tables.css b/pandora_console/include/styles/tables.css index 4f340b32d9..c0be0717ff 100644 --- a/pandora_console/include/styles/tables.css +++ b/pandora_console/include/styles/tables.css @@ -653,6 +653,7 @@ div.advanced-options-events > div.filter_input { .vert-align-bottom { vertical-align: bottom; + font-size: 8pt; } label.vert-align-bottom > a.tip { diff --git a/pandora_console/install.php b/pandora_console/install.php index 4522b758cf..36fe3a8ea4 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -131,7 +131,7 @@
'; + // Strict user hidden. echo '