"; - echo ' | '.__('Group filter: ').' | '; - echo ''; - html_print_select_groups(false, 'AW', true, 'group'); - echo ' | '; - echo ""; - echo ' |
'.$php_sys->data->memoryLimit->value.'
+'.$php_sys->data->postMaxSize->name.'
+'.$php_sys->data->postMaxSize->value.'
+'.$php_sys->data->uploadMaxFilesize->name.'
+'.$php_sys->data->uploadMaxFilesize->value.'
+'.$php_sys->data->sessionLifetime->name.'
diff --git a/pandora_console/include/functions_netflow.php b/pandora_console/include/functions_netflow.php index 5fc9e6b32f..9ed730af38 100644 --- a/pandora_console/include/functions_netflow.php +++ b/pandora_console/include/functions_netflow.php @@ -2404,3 +2404,50 @@ function netflow_build_map_data($start_date, $end_date, $top, $aggregate, $advan array_merge($relations, $orphan_hosts) ); } + + +/** + * Run whois command and return all results as array. + * + * @param integer $ip Ip for search info with command whois. + * + * @return array + */ +function command_whois($ip) +{ + $command = 'whois '.$ip; + $result = ''; + exec($command, $result); + if (empty($result) === false && is_array($result) === true) { + $resultArray = parse_whois_output($result); + } else { + $resultArray = []; + } + + return $resultArray; +} + + +/** + * Parse the result of command whois to array. + * + * @param array $lines Lines result of command whois. + * + * @return array + */ +function parse_whois_output($lines) +{ + $resultArray = []; + if (is_array($lines) === true) { + foreach ($lines as $line) { + $parts = explode(':', $line, 2); + if (count($parts) === 2 && strpos($line, '#') !== 0) { + $key = trim($parts[0]); + $value = trim($parts[1]); + $resultArray[$key] = $value; + } + } + } + + return $resultArray; +} diff --git a/pandora_console/include/functions_notifications.php b/pandora_console/include/functions_notifications.php index 61330b66f7..f16e8fd25b 100644 --- a/pandora_console/include/functions_notifications.php +++ b/pandora_console/include/functions_notifications.php @@ -133,6 +133,7 @@ function notifications_get_subtypes(?string $source=null) 'NOTIF.PHP.INPUT_TIME', 'NOTIF.PHP.EXECUTION_TIME', 'NOTIF.PHP.UPLOAD_MAX_FILESIZE', + 'NOTIF.PHP.POST_MAX_SIZE', 'NOTIF.PHP.MEMORY_LIMIT', 'NOTIF.PHP.DISABLE_FUNCTIONS', 'NOTIF.PHP.CHROMIUM', @@ -818,7 +819,7 @@ function notifications_print_global_source_configuration($source) $html_checkboxes = ''; - $blacklist = json_decode($source['subtype_blacklist'], 1); + $blacklist = json_decode(($source['subtype_blacklist'] ?? ''), 1); if (json_last_error() !== JSON_ERROR_NONE) { $blacklist = []; } diff --git a/pandora_console/include/functions_profile.php b/pandora_console/include/functions_profile.php index d97edf17aa..278d39f9a6 100644 --- a/pandora_console/include/functions_profile.php +++ b/pandora_console/include/functions_profile.php @@ -243,6 +243,7 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c $profile = json_decode($profile); } + $result = []; $result[] = [ 'id_grupo' => $profile->group, 'id_perfil' => $profile->profile, diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 7534cb5e23..c5c7090623 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -12546,7 +12546,7 @@ function reporting_get_stats_indicators($data, $width=280, $height=20, $html=tru $table_ind = html_get_predefined_table(); $servers = []; - $servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver'); + $servers['all'] = (int) count((servers_get_info() ?? [])); $servers['up'] = (int) servers_check_status(); $servers['down'] = ($servers['all'] - $servers['up']); if ($servers['all'] == 0) { @@ -12607,7 +12607,7 @@ function reporting_get_stats_indicators_mobile($data, $width=280, $height=20, $h $table_ind = html_get_predefined_table(); $servers = []; - $servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver'); + $servers['all'] = (int) count((servers_get_info() ?? [])); $servers['up'] = (int) servers_check_status(); $servers['down'] = ($servers['all'] - $servers['up']); if ($servers['all'] == 0) { @@ -16206,7 +16206,8 @@ function reporting_module_histogram_graph($report, $content, $pdf=0) // Si viene de no iniciado busco el primer dato del modulo y si es de histórico. $first_utimestamp = false; $search_historydb = false; - $extract_first_data = modules_get_first_date($content['id_agent_module'], 0); + // Limitamos el primer dato al rango de tiempo seleccionado por el usuario. + $extract_first_data = modules_get_first_date($content['id_agent_module'], $date_start); if (empty($extract_first_data) === false) { $first_utimestamp = $extract_first_data['first_utimestamp']; $search_historydb = (isset($extract_first_data['search_historydb']) === true) ? $extract_first_data['search_historydb'] : false; @@ -16311,7 +16312,8 @@ function reporting_module_histogram_graph($report, $content, $pdf=0) $return['data_ok'] = $check_ok; $return['data_total'] = $check_total; if ($check_total > 0) { - $return['percent_ok'] = (($time_ok * 100) / $content['period']); + $percent_ok = (($time_ok * 100) / $content['period']); + $return['percent_ok'] = ($percent_ok > 100) ? 100 : $percent_ok; } else { $return['percent_ok'] = 0; } diff --git a/pandora_console/include/functions_servers.php b/pandora_console/include/functions_servers.php index bdc8a56fc9..8805998232 100644 --- a/pandora_console/include/functions_servers.php +++ b/pandora_console/include/functions_servers.php @@ -615,7 +615,7 @@ function servers_get_rate($avg_interval, $num_modules) * This function will get all the server information in an array * or a specific server. * - * @param integer $id_server An optional integer or array of integers + * @param integer|array $id_server An optional integer or array of integers * to select specific servers. * * @return mixed False in case the server doesn't exist or an array with info. @@ -624,28 +624,63 @@ function servers_get_info($id_server=-1, $sql_limit=-1) { global $config; - if (is_array($id_server)) { - $select_id = ' WHERE id_server IN ('.implode(',', $id_server).')'; + $select_id = ''; + if (is_array($id_server) === true) { + $select_id = ' AND id_server IN ('.implode(',', $id_server).')'; } else if ($id_server > 0) { - $select_id = ' WHERE id_server IN ('.(int) $id_server.')'; - } else { - $select_id = ''; + $select_id = ' AND id_server IN ('.(int) $id_server.')'; } - $sql = ' - SELECT * - FROM tserver '.$select_id.' - ORDER BY server_type'; + $types_sql = sprintf( + ' AND ( + `server_type` != %d AND + `server_type` != %d + )', + SERVER_TYPE_AUTOPROVISION, + SERVER_TYPE_MIGRATION + ); + if (is_metaconsole() === true && isset($config['ndbh']) === false) { + $types_sql = sprintf( + ' AND ( + `server_type` = %d OR + `server_type` = %d OR + `server_type` = %d OR + `server_type` = %d + )', + SERVER_TYPE_AUTOPROVISION, + SERVER_TYPE_EVENT, + SERVER_TYPE_MIGRATION, + SERVER_TYPE_PREDICTION + ); + } + + $sql = sprintf( + 'SELECT * + FROM tserver + WHERE 1=1 + %s + %s + ORDER BY server_type', + $select_id, + $types_sql + ); if ($sql_limit !== -1) { - $sql = ' - SELECT * - FROM tserver '.$select_id.' - ORDER BY server_type'.$sql_limit; + $sql = sprintf( + 'SELECT * + FROM tserver + WHERE 1=1 + %s + %s + ORDER BY server_type + %s', + $select_id, + $types_sql, + $sql_limit + ); } $result = db_get_all_rows_sql($sql); - $time = get_system_time(); if (empty($result)) { return false; @@ -1445,6 +1480,12 @@ function servers_get_server_string_name(int $server) case SERVER_TYPE_NCM: return __('NCM server'); + case SERVER_TYPE_AUTOPROVISION: + return __('Autoprovision server'); + + case SERVER_TYPE_MIGRATION: + return __('Migration server'); + default: return __('N/A'); } diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index 66dad24db6..ada7841ab7 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -1039,7 +1039,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false) echo " + + + values['gis_map']); + + $output .= ''; + gis_print_map( + 'map_'.$this->cellId, + $map['zoom_level'], + $map['initial_latitude'], + $map['initial_longitude'], + $baselayers, + $controls + ); + $output .= ''; + + if (empty($layers) === false) { + foreach ($layers as $layer) { + gis_make_layer( + $layer['layer_name'], + $layer['view_layer'], + null, + $layer['id_tmap_layer'] + ); + + // Calling agents_get_group_agents with none to obtain the names in the same case as they are in the DB. + $agentNamesByGroup = []; + if ($layer['tgrupo_id_grupo'] >= 0) { + $agentNamesByGroup = agents_get_group_agents( + $layer['tgrupo_id_grupo'], + false, + 'none', + true, + true, + false + ); + } + + $agentNamesByLayer = gis_get_agents_layer($layer['id_tmap_layer']); + + $groupsByAgentId = gis_get_groups_layer_by_agent_id($layer['id_tmap_layer']); + $agentNamesOfGroupItems = []; + foreach ($groupsByAgentId as $agentId => $groupInfo) { + $agentNamesOfGroupItems[$agentId] = $groupInfo['agent_name']; + } + + $agentNames = array_unique($agentNamesByGroup + $agentNamesByLayer + $agentNamesOfGroupItems); + + foreach ($agentNames as $key => $agentName) { + $idAgent = $key; + $coords = gis_get_data_last_position_agent($idAgent); + + if ($coords === false) { + $coords['stored_latitude'] = $map['default_latitude']; + $coords['stored_longitude'] = $map['default_longitude']; + } else { + if ($show_history == 'y') { + $lastPosition = [ + 'longitude' => $coords['stored_longitude'], + 'latitude' => $coords['stored_latitude'], + ]; + gis_add_path($layer['layer_name'], $idAgent, $lastPosition); + } + } + + $status = agents_get_status($idAgent, true); + $icon = gis_get_agent_icon_map($idAgent, true, $status); + $icon_size = getimagesize($icon); + $icon_width = $icon_size[0]; + $icon_height = $icon_size[1]; + + // Is a group item. + if (empty($groupsByAgentId[$idAgent]) === false) { + $groupId = (int) $groupsByAgentId[$idAgent]['id']; + $groupName = $groupsByAgentId[$idAgent]['name']; + + gis_add_agent_point( + $layer['layer_name'], + io_safe_output($groupName), + $coords['stored_latitude'], + $coords['stored_longitude'], + $icon, + $icon_width, + $icon_height, + $idAgent, + $status, + 'point_group_info', + $groupId + ); + } else { + $parent = db_get_value('id_parent', 'tagente', 'id_agente', $idAgent); + + gis_add_agent_point( + $layer['layer_name'], + io_safe_output($agentName), + $coords['stored_latitude'], + $coords['stored_longitude'], + $icon, + $icon_width, + $icon_height, + $idAgent, + $status, + 'point_agent_info', + $parent + ); + } + } + } + + gis_add_parent_lines(); + + $timestampLastOperation = db_get_value_sql('SELECT UNIX_TIMESTAMP()'); + + gis_activate_select_control(); + gis_activate_ajax_refresh($layers, $timestampLastOperation); + } + + return $output; + } + + + /** + * Get description. + * + * @return string. + */ + public static function getDescription() + { + return __('GIS map'); + } + + + /** + * Get Name. + * + * @return string. + */ + public static function getName() + { + return 'GisMap'; + } + + + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 500, + 'height' => 300, + ]; + + return $size; + } + + +} diff --git a/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php b/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php index 69c0a36f44..1bbcc3be33 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php +++ b/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php @@ -115,6 +115,13 @@ class ModulesByStatus extends Widget */ protected $cellId; + /** + * Size + * + * @var array + */ + public $size; + /** * Construct. diff --git a/pandora_console/include/lib/Dashboard/Widgets/agent_module.php b/pandora_console/include/lib/Dashboard/Widgets/agent_module.php index 56ab854375..f5c4ff5a96 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/agent_module.php +++ b/pandora_console/include/lib/Dashboard/Widgets/agent_module.php @@ -355,7 +355,7 @@ class AgentModuleWidget extends Widget */ public function getIdCacheAgent($id_agents) { - $target_agents = explode(',', $id_agents); + $target_agents = explode(',', ($id_agents ?? '')); $cache_id_agents = []; foreach ($target_agents as $agent_id) { if (str_contains($agent_id, '|') === false) { diff --git a/pandora_console/include/lib/Dashboard/Widgets/events_list.php b/pandora_console/include/lib/Dashboard/Widgets/events_list.php index a50cab93e4..beb7a92b5f 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/events_list.php +++ b/pandora_console/include/lib/Dashboard/Widgets/events_list.php @@ -111,6 +111,20 @@ class EventsListWidget extends Widget */ protected $publicLink; + /** + * Overflow scrollbar. + * + * @var boolean + */ + public $overflow_scrollbars; + + /** + * Position + * + * @var array + */ + public $position; + /** * Construct. diff --git a/pandora_console/include/lib/Dashboard/Widgets/heatmap.php b/pandora_console/include/lib/Dashboard/Widgets/heatmap.php index e199a80ad8..ada804bedb 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/heatmap.php +++ b/pandora_console/include/lib/Dashboard/Widgets/heatmap.php @@ -271,7 +271,7 @@ class HeatmapWidget extends Widget 'name' => 'groups[]', 'returnAllGroup' => true, 'privilege' => 'AR', - 'selected' => explode(',', $values['groups'][0]), + 'selected' => (isset($values['groups'][0]) === true) ? explode(',', $values['groups'][0]) : [], 'return' => true, 'multiple' => true, ], @@ -305,7 +305,7 @@ class HeatmapWidget extends Widget 'type' => 'select', 'fields' => $tags, 'name' => 'tags[]', - 'selected' => explode(',', $values['tags'][0]), + 'selected' => (isset($values['tags'][0]) === true) ? explode(',', $values['tags'][0]) : [], 'return' => true, 'multiple' => true, ], @@ -332,7 +332,7 @@ class HeatmapWidget extends Widget 'type' => 'select', 'fields' => $module_groups, 'name' => 'module_groups[]', - 'selected' => explode(',', $values['module_groups'][0]), + 'selected' => (isset($values['module_groups'][0]) === true) ? explode(',', $values['module_groups'][0]) : [], 'return' => true, 'multiple' => true, 'nothing' => __('Not assigned'), diff --git a/pandora_console/include/lib/Dashboard/Widgets/maps_status.php b/pandora_console/include/lib/Dashboard/Widgets/maps_status.php index 2e59af771c..12d0ef9461 100755 --- a/pandora_console/include/lib/Dashboard/Widgets/maps_status.php +++ b/pandora_console/include/lib/Dashboard/Widgets/maps_status.php @@ -253,7 +253,7 @@ class MapsStatusWidget extends Widget $fields = array_reduce( $dataVc, function ($carry, $item) { - $carry[$item['id']] = $item['name']; + $carry[$item['id']] = io_safe_output($item['name']); return $carry; }, [] @@ -350,7 +350,7 @@ class MapsStatusWidget extends Widget // This will give us the group name. $data[0] = ''; - $data[0] .= $user_layouts[$id_layout]['name']; + $data[0] .= io_safe_output($user_layouts[$id_layout]['name']); $data[0] .= ''; // Status 0 is OK. diff --git a/pandora_console/include/lib/Dashboard/Widgets/security_hardening.php b/pandora_console/include/lib/Dashboard/Widgets/security_hardening.php index 9f7d726677..88e37c58b5 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/security_hardening.php +++ b/pandora_console/include/lib/Dashboard/Widgets/security_hardening.php @@ -446,7 +446,7 @@ class SecurityHardening extends Widget { global $config; - $id_groups = explode(',', $group); + $id_groups = explode(',', ($group ?? '')); if (in_array(0, $id_groups) === true) { $id_groups = array_keys(users_get_groups($config['id_user'], 'AR', false)); } diff --git a/pandora_console/include/lib/TacticalView/elements/SnmpTraps.php b/pandora_console/include/lib/TacticalView/elements/SnmpTraps.php index f606893429..9e1de4d891 100644 --- a/pandora_console/include/lib/TacticalView/elements/SnmpTraps.php +++ b/pandora_console/include/lib/TacticalView/elements/SnmpTraps.php @@ -83,7 +83,11 @@ class SnmpTraps extends Element { if ($this->isEnabled() === true) { $value = $this->valueMonitoring('snmp_trap_queue'); - $total = round($value[0]['data']); + if (isset($value[0]['data']) === true) { + $total = round($value[0]['data']); + } else { + $total = __('N/A'); + } } else { $total = __('N/A'); } @@ -109,7 +113,11 @@ class SnmpTraps extends Element { if ($this->isEnabled() === true) { $value = $this->valueMonitoring('total_trap'); - $total = round($value[0]['data']); + if (isset($value[0]['data']) === true) { + $total = round($value[0]['data']); + } else { + $total = __('N/A'); + } } else { $total = __('N/A'); } diff --git a/pandora_console/include/styles/events.css b/pandora_console/include/styles/events.css index ea31dfeecc..c3c6f73f5d 100644 --- a/pandora_console/include/styles/events.css +++ b/pandora_console/include/styles/events.css @@ -585,3 +585,7 @@ div.container-filter-buttons { margin-right: 10px !important; } } + +#button-start-search { + width: 115px; +} diff --git a/pandora_console/include/styles/jquery.tag-editor.css b/pandora_console/include/styles/jquery.tag-editor.css index 5d535dba1e..31040fca45 100644 --- a/pandora_console/include/styles/jquery.tag-editor.css +++ b/pandora_console/include/styles/jquery.tag-editor.css @@ -108,9 +108,7 @@ cursor: default; font-size: 14px; } -.ui-front { - z-index: 9999; -} + .ui-menu { list-style: none; padding: 1px; diff --git a/pandora_console/include/styles/js/jquery-ui_custom.css b/pandora_console/include/styles/js/jquery-ui_custom.css index 440540ab05..5bf343ee60 100644 --- a/pandora_console/include/styles/js/jquery-ui_custom.css +++ b/pandora_console/include/styles/js/jquery-ui_custom.css @@ -61,15 +61,11 @@ } .ui-dialog .ui-dialog-titlebar-disengage { - position: absolute !important; - right: 50px; - top: -3px; - width: 40px; margin: 0px 0 0 0; padding: 1px; - height: 40px; + height: 20px; bottom: 30%; - background-color: #fff !important; + background-color: white; } .ui-dialog .ui-dialog-titlebar-disengage:hover { diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 1453289d08..2b347fd81a 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -1945,7 +1945,7 @@ div.title_line { #menu_tab_frame_view_bc { position: sticky; top: 61px; - z-index: 2; + z-index: 3; display: flex; align-items: flex-end; justify-content: space-between; @@ -10954,6 +10954,18 @@ div.status_dot { -webkit-mask: url(../../images/status_dot.svg) no-repeat center / contain; } +button div.import { + mask: url(../../images/import.svg) no-repeat center / contain; + -webkit-mask: url(../../images/import.svg) no-repeat center / contain; + height: 1.5rem; +} + +button div.export { + mask: url(../../images/export.svg) no-repeat center / contain; + -webkit-mask: url(../../images/export.svg) no-repeat center / contain; + height: 1.5rem; +} + .status_dot.ok { background-color: #82b92e; } @@ -12819,9 +12831,9 @@ div.agents_custom_fields #datatables_wrapper div.bottom { .actions-sound-modal .buttons-sound-modal button.play, .actions-sound-modal .buttons-sound-modal input[type="button"].play { - background: url(../../images/play-white.png), transparent !important; + /*background: url(../../images/play-white.png), transparent !important; background-repeat: no-repeat !important; - background-position: 82px 14px !important; + background-position: 82px 14px !important;*/ color: #ffffff; padding-left: 20px; border: 0; @@ -13504,3 +13516,79 @@ tr.shown td.details-control { mask: url(../../images/minimizar.svg) no-repeat right / contain; -webkit-mask: url(../../images/minimizar.svg) no-repeat right / contain; } + +#modules-toggle > .modules > .white-box-content div { + z-index: 1 !important; +} + +/* Import/export */ +.div-import-export { + display: flex; + flex-direction: row; +} + +.form-import { + width: 48%; + height: auto; + margin-right: 40px; +} + +.div-import { + background-color: #ffffff; + border: 1px solid #e5e9ed; + border-radius: 8px; + width: 100%; + height: 180px; + display: flex; + flex-direction: row; + align-items: normal; + padding-top: 20px; + padding-left: 20px; + margin-bottom: 20px; +} + +.div-export { + background-color: #ffffff; + border: 1px solid #e5e9ed; + border-radius: 8px; + width: 48%; + height: 180px; + display: flex; + flex-direction: row; + align-items: normal; + padding-top: 20px; + padding-left: 20px; + margin-bottom: 20px; +} + +@media (max-width: 1300px) { + .div-import-export { + display: flex; + flex-direction: column; + } + + .div-export { + width: calc(100% - 20px); + } + + .form-import { + width: calc(100% - 20px); + } +} + +.input-file-style::file-selector-button { + background-color: #ffffff; + border: 1px solid #979797; + border-radius: 4px; + width: 120px; + height: 32px; +} + +button.disabled { + background: #c0ccdc !important; + border: 0px; +} + +.ui-draggable-handle { + z-index: 2 !important; +} diff --git a/pandora_console/include/styles/sound_events.css b/pandora_console/include/styles/sound_events.css index a572c219f3..a8068a8308 100644 --- a/pandora_console/include/styles/sound_events.css +++ b/pandora_console/include/styles/sound_events.css @@ -1,9 +1,6 @@ /* * Css Modal Sound events. */ -div.container-button-play > button#button-start-search { - transition: none !important; -} .wizard { text-align: left; } @@ -217,9 +214,9 @@ div.container-button-play > button#button-start-search { .actions-sound-modal .buttons-sound-modal button.play, .actions-sound-modal .buttons-sound-modal input[type="button"].play { - background: url(../../images/play-white.png), transparent !important; + /*background: url(../../images/play-white.png), transparent !important; background-repeat: no-repeat !important; - background-position: 82px 14px !important; + background-position: 82px 14px !important;*/ color: #ffffff !important; padding-left: 20px; border: 0; @@ -263,11 +260,6 @@ button#button-no-alerts.silence-alerts:hover { background-position: 138px 4px !important; } -.actions-sound-modal .container-button-play { - background-color: var(--primary-color); - border-radius: 8px; -} - .actions-sound-modal .container-button-alert.fired { background: #ee2132; border-radius: 8px; diff --git a/pandora_console/install.php b/pandora_console/install.php index c6329db34e..6f9c6c9029 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -131,7 +131,7 @@