Merge branch 'develop' into ent-12095-correlacion-de-alertas-con-field-event-user-comment-no-funciona-adecuadamente

This commit is contained in:
Daniel Maya 2023-11-29 15:44:04 +01:00
commit 544997d30c
122 changed files with 2668 additions and 1047 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.774-231127
Version: 7.0NG.774-231129
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.774"
PI_BUILD="231127"
PI_BUILD="231129"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{231127}
{231129}
ViewReadme
{Yes}

View File

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

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.774(Build 231127))"
VALUE "ProductVersion", "(7.0NG.774(Build 231129))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.774-231127
Version: 7.0NG.774-231129
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.774-231127"
pandora_version="7.0NG.774-231129"
package_pear=0
package_pandora=1

View File

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

View File

@ -99,7 +99,7 @@ function api_execute(
if (empty($token) === true) {
$data['apipass'] = $apipass;
$data['user'] = $user;
$data['password'] = $password;
$data['pass'] = $password;
}
}

View File

@ -90,7 +90,7 @@ function dbmgr_extension_main()
// Header.
ui_print_standard_header(
__('Database interface'),
__('DB interface'),
'images/gm_db.png',
false,
'',

View File

@ -1,8 +1,30 @@
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 `tevent_rule` DROP COLUMN `user_comment`;
ALTER TABLE `tevent_rule` DROP COLUMN `operator_user_comment`;
ALTER TABLE treport_content ADD check_unknowns_graph tinyint DEFAULT 0 NULL;
-- 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;
COMMIT;

View File

@ -418,7 +418,7 @@ switch ($login_screen) {
}
if ($config['enterprise_installed']) {
if ($config['reset_pass_option']) {
if ($config['reset_pass_option'] && $config['auth'] === 'mysql') {
$reset_pass_link = 'reset_pass.php';
// Reset password link.
echo '<div class="reset_password">';

View File

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

View File

@ -217,6 +217,7 @@ foreach ($fields as $field) {
array_push($table->data, $data);
}
$tablePagination = '';
if ($fields) {
html_print_table($table);
$tablePagination = ui_pagination($count_fields, false, $offset, 0, true, 'offset', false);
@ -231,6 +232,9 @@ html_print_action_buttons(
[ 'icon' => 'next' ],
true
),
['type' => 'form_action']
[
'type' => 'form_action',
'right_content' => $tablePagination,
],
);
echo '</form>';

View File

@ -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 = '<?php echo __('Please introduce a positive percentage value'); ?>';
//if haven't error
if (max_w == 0 || max_w > min_w) {
if (max_c == 0 || max_c > min_c) {
paint_graph_status(
min_w, max_w, min_c, max_c, inverse_w,
inverse_c, error_w, error_c,
legend_normal, legend_warning, legend_critical,
message_error_warning, message_error_critical
);
if (max_w == 0 || max_w > min_w || $('#radius-percentage_warning').is(':checked') === true) {
if (max_c == 0 || max_c > min_c || $('#radius-percentage_critical').is(':checked') === true) {
error_c = 0;
error_w = 0;
} else {
error_c = 1;
paint_graph_status(
0, 0, 0, 0, 0, 0, error_w, error_c,
legend_normal, legend_warning, legend_critical,
message_error_warning, message_error_critical
);
min_w = 0;
max_w = 0;
min_c = 0;
max_c = 0;
inverse_w = 0;
inverse_c = 0;
}
} else {
if (max_c !== 0 && max_c < min_c && $('#radius-percentage_critical').is(':checked') === false) {
error_c = 2;
}
error_w = 1;
paint_graph_status(
0, 0, 0, 0, 0, 0, error_w, error_c,
legend_normal, legend_warning, legend_critical,
message_error_warning, message_error_critical
);
min_w = 0;
max_w = 0;
min_c = 0;
max_c = 0;
inverse_w = 0;
inverse_c = 0;
}
if ($('#radius-percentage_warning').is(':checked') === true){
min_w = 0;
max_w = 0;
}
if ($('#radius-percentage_critical').is(':checked') === true){
min_c = 0;
max_c = 0;
}
paint_graph_status(
min_w, max_w, min_c, max_c, inverse_w,
inverse_c, error_w, error_c,
legend_normal, legend_warning, legend_critical,
message_error_warning, message_error_critical
);
}
/* ]]> */

View File

@ -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 = '<select id="prediction_module" name="custom_integer_1" disabled="disabled"><option value="0">Select an Agent first</option></select>';
$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;

View File

@ -31,13 +31,14 @@ if (is_ajax()) {
return;
}
echo '<h3>'.$template['name'].'</h3>';
echo '<h3 style="background-color: #14524f">'.$template['name'].'</h3>';
echo html_print_image('images/info.svg', true, ['class' => 'invert_filter']);
echo ui_print_alert_template_example($template['id'], true, true, false);
echo '<br />';
echo '<br />';
echo '<strong>'.__('Type').': </strong>';
echo alerts_get_alert_templates_type_name($template['type']);
echo '<br />';
echo ui_print_alert_template_example($template['id'], true);
echo '<br />';
if ($template['description'] != '') {

View File

@ -1240,7 +1240,7 @@ if ($step == 2) {
'priority',
$priority,
'',
0,
'',
0,
true,
false,

View File

@ -27,7 +27,6 @@ if (! check_acl($config['id_user'], 0, 'DM')) {
// Get some general DB stats (not very heavy)
// NOTE: this is not realtime monitoring stats, are more focused on DB sanity
$stat_access = db_get_sql('SELECT COUNT(*) FROM tagent_access WHERE id_agent != 0');
$stat_data = db_get_sql('SELECT COUNT(*) FROM tagente_datos WHERE id_agente_modulo != 0');
$stat_data_log4x = db_get_sql('SELECT COUNT(*) FROM tagente_datos_log4x WHERE id_agente_modulo != 0');
$stat_data_string = db_get_sql('SELECT COUNT(*) FROM tagente_datos_string WHERE id_agente_modulo != 0');
@ -149,18 +148,6 @@ echo $stat_modules;
echo '</b></td></tr>';
echo '<tr class="rowOdd"><td>';
echo __('Total agent access records');
echo '<td><b>';
if ($stat_access > $max_access) {
echo "<font color='#ff0000'>$stat_access</font>";
} else {
echo $stat_access;
}
echo '</b></td></tr>';
// Sanity
echo '<tr><th colspan=2><i>';
echo __('Database sanity');

View File

@ -68,7 +68,7 @@ foreach ($layer_ids as $layer_id) {
$layer_list[] = [
'id' => (strpos($layer_id, 'new_') === false) ? (int) $layer_id : null,
'layer_name' => $trimmed_name,
'layer_visible' => ((int) $layers[$layer_id]['visible'] === 1),
'layer_visible' => ($layers[$layer_id]['visible'] === 'true'),
'layer_group' => (int) $layers[$layer_id]['agents_from_group'],
'layer_agent_list' => $layers[$layer_id]['agents'],
'layer_group_list' => $layers[$layer_id]['groups'],
@ -560,21 +560,23 @@ html_print_table($table);
$user_groups = users_get_groups($config['user'], 'AR', false);
echo '<h3>'.__('Layers').'</h3>';
echo '<fieldset class="margin-bottom-10"><legend>'.__('Layers').'</legend>';
$table->width = '100%';
$table->class = 'databox filters';
$table->valign = [];
$table->valign[0] = 'top';
$table->valign[1] = 'top';
$table->valign[0] = 'top; width: 50%';
$table->valign[1] = 'top; width: 50%';
$table->data = [];
$table->data[0][0] = '<h4>'.__('List of layers').'</h4>';
$table->data[0][1] = '<div class="right">'.html_print_button(__('New layer'), 'new_layer', false, 'newLayer();', 'class="sub add "', true).'</div>';
$table->data[1][0] = '<table class="databox" border="0" cellpadding="4" cellspacing="4" id="list_layers"></table>';
$table->data[1][1] = '<div id="form_layer" class="invisible">
$table->data[1][0] = '<div id="form_layer" class="invisible">
<table id="form_layer_table" class="" border="0" cellpadding="4" cellspacing="4">
<tr>
<td colspan="4"><hr/></td>
</tr>
<tr>
<td>'.__('Layer name').':</td>
<td>'.html_print_input_text('layer_name_form', '', '', 20, 40, true).'</td>
@ -592,10 +594,6 @@ $table->data[1][1] = '<div id="form_layer" class="invisible">
<td>'.__('Agent').':</td>
<td colspan="3">';
$table->data[1][1] .= html_print_button(__('Add agent'), 'add_agent', true, '', ['mode' => 'secondary', 'icon' => 'next'], true);
$params = [];
$params['return'] = true;
$params['show_helptip'] = true;
@ -608,12 +606,13 @@ $params['javascript_function_action_after_select'] = 'active_button_add_agent';
$params['javascript_is_function_select'] = true;
$params['disabled_javascript_on_blur_function'] = false;
$table->data[1][1] .= ui_print_agent_autocomplete_input($params);
$table->data[1][1] .= '</td>
$table->data[1][0] .= ui_print_agent_autocomplete_input($params);
$buttonAgent = html_print_button(__('Add agent'), 'add_agent', true, '', ['mode' => 'secondary', 'icon' => 'next'], true);
$table->data[1][0] .= '</td>
</tr>
<tr>
<td colspan="4" align="right">'.$buttonAgent.'</td>
</tr>
<tr>
<td colspan="4">
<h4>'.__('List of Agents to be shown in the layer').'</h4>
@ -641,7 +640,7 @@ $params['disabled_javascript_on_blur_function'] = false;
$agent_for_group_input = ui_print_agent_autocomplete_input($params);
$add_group_btn = html_print_button(__('Add'), 'add_group', true, '', ['mode' => 'secondary', 'icon' => 'next'], true);
$table->data[1][1] .= '<tr><td colspan="4"><hr /></td></tr>
$table->data[1][0] .= '<tr><td colspan="4"><hr /></td></tr>
<tr>
<td>'.__('Group').':</td>
<td colspan="3">'.$group_select.'</td>
@ -661,7 +660,7 @@ $table->data[1][1] .= '<tr><td colspan="4"><hr /></td></tr>
</td>
</tr>';
$table->data[1][1] .= '<tr>
$table->data[1][0] .= '<tr>
<td align="right" colspan="4">'.html_print_button(__('Save Layer'), 'save_layer', false, 'javascript:saveNewLayer();', 'class="sub wand"', true).'
'.html_print_input_hidden('current_edit_layer_id', '', true).'
</td>
@ -669,7 +668,12 @@ $table->data[1][1] .= '<tr>
</table>
</div>';
$table->data[1][1] = '<fieldset>
<legend>'.__('Layers list').'</legend>
<table class="databox invisible" border="0" id="list_layers"></table>
</fieldset>';
html_print_table($table);
echo '</fieldset>';
switch ($action) {
case 'save_new':
@ -1229,6 +1233,8 @@ function getLayerRow (layerId, layerData) {
.append($editCol)
.append($deleteCol);
$("#list_layers").removeClass('invisible');
return $row;
}

View File

@ -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;
@ -757,6 +760,125 @@ if ($tab == 'tree') {
/*
* Group tree view.
*/
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters filter-table-adv';
if (is_metaconsole() === true) {
$table->cellspacing = 0;
$table->cellpadding = 0;
}
$search_group_string = get_parameter('search_group_string', '');
$search_agent_string = get_parameter('search_agent_string', '');
$agent_status = get_parameter('agent_status', '');
$show_not_init_agents = get_parameter('show_not_init_agents', 1);
$show_not_init_modules = get_parameter('show_not_init_modules', 1);
$show_full_hirearchy = get_parameter('show_full_hirearchy', 1);
$table->data = [];
$table->head = [];
$table->style = [];
$table->style[0] = 'width: 50%;';
$table->style[1] = 'width: 50%;';
$table->data[0][0] = html_print_label_input_block(
__('Search group'),
html_print_input_text(
'search_group_string',
$search_group_string,
'',
25,
255,
true,
false,
false,
'',
)
);
$agents_status_list = agents_status_list();
$table->data[0][1] = html_print_label_input_block(
__('Search by agent status').ui_print_help_tip(__('Shows the groups that contain an agent with the status that has been searched'), true),
html_print_select(
$agents_status_list,
'agent_status',
$agent_status,
'',
__('All'),
'',
true,
false,
false,
'w200p',
false,
'width: 100%;'
)
);
$table->data[1][0] = html_print_label_input_block(
__('Search by agent').ui_print_help_tip(__('Shows groups that contain an agent matching the search'), true),
html_print_input_text(
'search_agent_string',
$search_agent_string,
'',
25,
255,
true,
false,
false,
'',
)
);
$table->data[1][1] = html_print_label_input_block(
__('Show full hierarchy'),
html_print_checkbox_switch_extended(
'show_full_hirearchy',
1,
$show_full_hirearchy,
false,
'',
'',
true
)
);
$table->data[3][0] = '&nbsp;';
$table->data[3][1] = html_print_submit_button(
__('Filter'),
'filter',
false,
[
'class' => 'float-right',
'icon' => 'search',
],
true
);
$form = "<form method='post' action=''>";
$form .= html_print_table($table, true);
$form .= '</form>';
ui_toggle(
$form,
'<span class="subsection_header_title">'.__('Filters').'</span>',
'filter_form',
'',
true,
false,
'',
'white-box-content',
'box-flat white_table_graph fixed_filter_bar'
);
echo "<div id='tree-controller-recipient'></div>";
} else {
/*
@ -826,6 +948,8 @@ if ($tab == 'tree') {
);
$form .= '</form>';
ui_toggle(
$form,
'<span class="subsection_header_title">'.__('Filters').'</span>',
@ -1058,87 +1182,119 @@ $tab = 'group_edition';
<?php } ?>
<script type="text/javascript">
var treeController = TreeController.getController();
treeController.meta = <?php echo (is_metaconsole() === true) ? 1 : 0; ?>;
if (typeof treeController.recipient != 'undefined' && treeController.recipient.length > 0)
treeController.recipient.empty();
let show_full_hirearchy = "<?php echo $show_full_hirearchy; ?>";
let show_not_init_agents = "<?php echo $show_not_init_agents; ?>";
let show_not_init_modules = "<?php echo $show_not_init_modules; ?>";
showSpinner();
$('#checkbox-show_full_hirearchy').on("change", function() {
if (show_full_hirearchy == 1) {
show_full_hirearchy = 0;
} else {
show_full_hirearchy = 1;
}
});
var parameters = {};
parameters['page'] = "include/ajax/tree.ajax";
parameters['getChildren'] = 1;
parameters['type'] = "<?php echo $tab; ?>";
parameters['filter'] = {};
parameters['filter']['searchGroup'] = '';
parameters['filter']['searchAgent'] = '';
parameters['filter']['statusAgent'] = '';
parameters['filter']['searchModule'] = '';
parameters['filter']['statusModule'] = '';
parameters['filter']['groupID'] = '';
parameters['filter']['tagID'] = '';
parameters['filter']['searchHirearchy'] = 1;
parameters['filter']['show_not_init_agents'] = 1;
parameters['filter']['show_not_init_modules'] = 1;
$('#button-filter').on('click', function(event) {
console.log('here');
event.preventDefault();
$.ajax({
type: "POST",
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
data: parameters,
success: function(data) {
if (data.success) {
hideSpinner();
load_tree(show_full_hirearchy, show_not_init_agents, show_not_init_modules);
});
treeController.init({
recipient: $("div#tree-controller-recipient"),
page: parameters['page'],
emptyMessage: "<?php echo __('No data found'); ?>",
foundMessage: "<?php echo __('Found groups'); ?>",
tree: data.tree,
baseURL: "<?php echo ui_get_full_url(false, false, false, is_metaconsole()); ?>",
ajaxURL: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
filter: parameters['filter'],
counterTitles: {
total: {
agents: "<?php echo __('Total agents'); ?>",
modules: "<?php echo __('Total modules'); ?>",
none: "<?php echo __('Total'); ?>"
},
alerts: {
agents: "<?php echo __('Fired alerts'); ?>",
modules: "<?php echo __('Fired alerts'); ?>",
none: "<?php echo __('Fired alerts'); ?>"
},
critical: {
agents: "<?php echo __('Critical agents'); ?>",
modules: "<?php echo __('Critical modules'); ?>",
none: "<?php echo __('Critical'); ?>"
},
warning: {
agents: "<?php echo __('Warning agents'); ?>",
modules: "<?php echo __('Warning modules'); ?>",
none: "<?php echo __('Warning'); ?>"
},
unknown: {
agents: "<?php echo __('Unknown agents'); ?>",
modules: "<?php echo __('Unknown modules'); ?>",
none: "<?php echo __('Unknown'); ?>"
},
not_init: {
agents: "<?php echo __('Not init agents'); ?>",
modules: "<?php echo __('Not init modules'); ?>",
none: "<?php echo __('Not init'); ?>"
},
ok: {
agents: "<?php echo __('Normal agents'); ?>",
modules: "<?php echo __('Normal modules'); ?>",
none: "<?php echo __('Normal'); ?>"
window.addEventListener('load', function() {
load_tree(show_full_hirearchy, show_not_init_agents, show_not_init_modules);
});
function load_tree(show_full_hirearchy, show_not_init_agents, show_not_init_modules) {
var treeController = TreeController.getController();
treeController.meta = <?php echo (is_metaconsole() === true) ? 1 : 0; ?>;
if (typeof treeController.recipient != 'undefined' && treeController.recipient.length > 0)
treeController.recipient.empty();
showSpinner();
var parameters = {};
parameters['page'] = "include/ajax/tree.ajax";
parameters['getChildren'] = 1;
parameters['type'] = "<?php echo $tab; ?>";
parameters['filter'] = {};
parameters['filter']['searchGroup'] = $('#text-search_group_string').val();
parameters['filter']['searchAgent'] = $('#text-search_agent_string').val();
parameters['filter']['statusAgent'] = $('#agent_status option:selected').val();
parameters['filter']['searchModule'] = '';
parameters['filter']['statusModule'] = '';
parameters['filter']['groupID'] = '';
parameters['filter']['tagID'] = '';
parameters['filter']['searchHirearchy'] = 1;
parameters['filter']['show_full_hirearchy'] = show_full_hirearchy;
parameters['filter']['show_not_init_agents'] = show_not_init_agents;
parameters['filter']['show_not_init_modules'] = show_not_init_modules;
$.ajax({
type: "POST",
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
data: parameters,
success: function(data) {
if (data.success) {
hideSpinner();
treeController.init({
recipient: $("div#tree-controller-recipient"),
page: parameters['page'],
emptyMessage: "<?php echo __('No data found'); ?>",
foundMessage: "<?php echo __('Found groups'); ?>",
tree: data.tree,
baseURL: "<?php echo ui_get_full_url(false, false, false, is_metaconsole()); ?>",
ajaxURL: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
filter: parameters['filter'],
counterTitles: {
total: {
agents: "<?php echo __('Total agents'); ?>",
modules: "<?php echo __('Total modules'); ?>",
none: "<?php echo __('Total'); ?>"
},
alerts: {
agents: "<?php echo __('Fired alerts'); ?>",
modules: "<?php echo __('Fired alerts'); ?>",
none: "<?php echo __('Fired alerts'); ?>"
},
critical: {
agents: "<?php echo __('Critical agents'); ?>",
modules: "<?php echo __('Critical modules'); ?>",
none: "<?php echo __('Critical'); ?>"
},
warning: {
agents: "<?php echo __('Warning agents'); ?>",
modules: "<?php echo __('Warning modules'); ?>",
none: "<?php echo __('Warning'); ?>"
},
unknown: {
agents: "<?php echo __('Unknown agents'); ?>",
modules: "<?php echo __('Unknown modules'); ?>",
none: "<?php echo __('Unknown'); ?>"
},
not_init: {
agents: "<?php echo __('Not init agents'); ?>",
modules: "<?php echo __('Not init modules'); ?>",
none: "<?php echo __('Not init'); ?>"
},
ok: {
agents: "<?php echo __('Normal agents'); ?>",
modules: "<?php echo __('Normal modules'); ?>",
none: "<?php echo __('Normal'); ?>"
}
}
}
});
}
},
dataType: "json"
});
});
}
},
dataType: "json"
});
}
</script>

View File

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

View File

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

View File

@ -95,7 +95,7 @@ $subsection = reporting_enterprise_add_graph_template_subsection('', $buttons);
$buttons['graph_container'] = [
'active' => true,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_container">'.html_print_image(
'images/graph-container.svg@svg',
'images/graph-container@svg.svg',
true,
[
'title' => __('Graph container'),

View File

@ -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) {
?>
</td>
</tr>
<tr id="row_secmon_status" class="datos">
<td class="bolder">
<?php
echo __('Secmon status');
?>
</td>
<td>
<?php
html_print_select(
[
'all' => __('All'),
'critical' => __('Critical'),
'warning' => __('Warning'),
],
'secmon_status',
$secmon_status,
);
?>
</td>
</tr>
<tr id="row_security_hardening_score" class="datos">
<td class="bolder">
<?php
echo __('Security hardening score');
?>
</td>
<td>
<?php
html_print_select(
[
'all' => __('All'),
'90' => __('< 90%'),
'80' => __('< 80%'),
'70' => __('< 70%'),
'60' => __('< 60%'),
'50' => __('< 50%'),
'40' => __('< 40%'),
'30' => __('< 30%'),
'20' => __('< 20%'),
'10' => __('< 10%'),
],
'security_hardening_score',
(empty($security_hardening_score) === false) ? $security_hardening_score : 'all',
'',
'',
0,
false,
false,
false
);
?>
</td>
</tr>
<tr id="row_vulnerabilities_status" class="datos">
<td class="bolder">
<?php
echo __('Vulnerabilities status');
?>
</td>
<td>
<?php
html_print_select(
[
'all' => __('All'),
'crit' => __('Critical'),
'warn' => __('Warning'),
],
'vulnerabilities_status',
$vulnerabilities_status,
);
?>
</td>
</tr>
<tr id="row_vulnerabilities_packages" class="datos">
<td class="bolder">
<?php
echo __('Package').ui_print_help_tip(__('Select a agent for load his packages.'), true);
?>
</td>
<td>
<?php
html_print_select(
[
'all' => __('All'),
],
'vul_package',
$vul_package,
);
?>
</td>
</tr>
<tr id="row_vulnerabilities_severity" class="datos">
<td class="bolder">
<?php
echo __('Severity');
?>
</td>
<td>
<?php
html_print_select(
[
'all' => __('All'),
'high' => __('High'),
'low' => __('Low'),
'none' => __('None'),
],
'vul_severity',
$vul_severity,
);
?>
</td>
</tr>
<tr id="row_vulnerabilities_ac" class="datos">
<td class="bolder">
<?php
echo __('Attack Complexity');
?>
</td>
<td>
<?php
html_print_select(
[
'all' => __('All'),
'H' => __('High'),
'L' => __('Low'),
],
'vul_ac',
$vul_ac,
);
?>
</td>
</tr>
<tr id="row_vulnerabilities_pr" class="datos">
<td class="bolder">
<?php
echo __('Privileges Required');
?>
</td>
<td>
<?php
html_print_select(
[
'all' => __('All'),
'H' => __('High'),
'L' => __('Low'),
'N' => __('None'),
],
'vul_pr',
$vul_pr,
);
?>
</td>
</tr>
<tr id="row_vulnerabilities_ui" class="datos">
<td class="bolder">
<?php
echo __('User Interaction');
?>
</td>
<td>
<?php
html_print_select(
[
'all' => __('All'),
'R' => __('Required'),
'N' => __('None'),
],
'vul_ui',
$vul_ui,
);
?>
</td>
</tr>
<tr id="row_vulnerabilities_av" class="datos">
<td class="bolder">
<?php
echo __('Attack vector');
?>
</td>
<td>
<?php
html_print_select(
[
'all' => __('All'),
'A' => __('Adjacent Network'),
'L' => __('Local'),
'N' => __('Network'),
'P' => __('Physical'),
],
'vul_av',
(empty($vul_av) === true) ? 'all' : $vul_av,
'',
'',
0,
false,
false,
false
);
?>
</td>
</tr>
<?php endif; ?>
<tr id="row_status_check" class="datos">
@ -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(`<option value="${key}" selected>${fields[key]}</option>`);
} else {
$(element).find("select").append(`<option value="${key}">${fields[key]}</option>`);
}
});
}
}
function updatePackages() {
let id_agent = $('#hidden-id_agent').val();
let server_id = $('#hidden-server_id').val();
$.ajax({
method: "POST",
url: "<?php echo ui_get_full_url('ajax.php'); ?>",
data: {
page: "<?php echo ENTERPRISE_DIR.'/include/ajax/vulnerabilities.ajax'; ?>",
action: "updatePackages",
id_agent: id_agent,
server_id: server_id,
},
success: function(data) {
const json = JSON.parse(data);
if (json.success) {
updateSelect("#row_vulnerabilities_packages", json.data, '<?php echo $vul_package; ?>');
}
}
});
}
$(document).ready(function () {
$('[id^=period], #combo_graph_options, #combo_sla_sort_options').next().css('z-index', 0);

View File

@ -777,7 +777,7 @@ $table->data[0][0] = html_print_label_input_block(
)
);
$table->data[0][1] = html_print_label_input_block(
__('Poisition'),
__('Position'),
html_print_input_text_extended(
'position_to_delete',
1,

View File

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

View File

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

View File

@ -860,8 +860,10 @@ if (empty($create) === false || empty($view) === false) {
if ($management_allowed === false) {
ui_print_warning_message(
__(
'This console is not manager of this environment,
please manage this feature from centralized manager console (Metaconsole).'
'This console is not manager of this environment, please manage this feature from feature from %s.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/servers/plugin_registration&tab=plugin_registration&pure=0'
).'">'.__('metaconsole').'</a>'
)
);
}

View File

@ -179,7 +179,7 @@ foreach ($servers as $server) {
}
$data[7] = '';
if ($server['queued_modules'] > 500) {
if ($server['queued_modules'] >= $config['number_modules_queue']) {
$data[7] .= '<div class="inline"><a onclick="show_dialog();" >'.html_print_image(
'images/info-warning.svg',
true,
@ -276,7 +276,7 @@ foreach ($servers as $server) {
$data[9] .= '</a>';
if (($names_servers[$safe_server_name] === true) && ($ext === '_server' || $server['type'] === 'enterprise satellite')) {
$data[9] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext.'&tab=agent_editor').'">';
$data[9] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext.'&tab=advanced_editor').'">';
$data[9] .= html_print_image(
'images/agents@svg.svg',
true,

View File

@ -54,8 +54,12 @@ if (isset($_POST['create'])) {
if (! $result) {
ui_print_error_message(__('There was a problem creating link'));
} else {
ui_print_success_message(__('Successfully created'));
$id_link = $result;
ui_print_result_message(
$id_link,
__('Successfully created'),
__('Could not be created')
);
}
}
@ -111,8 +115,8 @@ if ((isset($_GET['form_add'])) or (isset($_GET['form_edit']))) {
$link = '';
}
echo '<table class="databox filters filter-table-adv max_floating_element_size" cellpadding="4" cellspacing="4" width="100%">';
echo '<form name="ilink" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/links">';
echo '<table class="databox filters filter-table-adv max_floating_element_size" cellpadding="4" cellspacing="4" width="100%">';
if ($creation_mode == 1) {
echo "<input type='hidden' name='create' value='1'>";
} else {
@ -179,10 +183,10 @@ if ((isset($_GET['form_add'])) or (isset($_GET['form_edit']))) {
)
);
echo '</form></td></tr></table>';
echo '</td></tr></table></form>';
} else {
// Main list view for Links editor
$rows = db_get_all_rows_in_table('tlink', 'name');
// Main list view for Links editor.
$rows = db_get_all_fields_in_table('tlink', '', '', 'name');
if ($rows === false) {
$rows = [];
}

View File

@ -46,7 +46,7 @@ if ($idOS > 0) {
$description = $os['description'];
$icon = $os['icon_name'];
} else {
$name = io_safe_input(strip_tags(io_safe_output((string) get_parameter('name'))));
$name = io_safe_input(strip_tags(trim(io_safe_output((string) get_parameter('name')))));
$description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
$icon = get_parameter('icon', 0);
}
@ -87,9 +87,16 @@ if ($is_management_allowed === true) {
if (in_array($file_ext, $allowed_extensions) === false) {
$message = 9;
} else if (exif_imagetype($file_tmp) === false && $file_ext !== 'svg') {
$message = 10;
} else {
$message = 8;
move_uploaded_file($file_tmp, $config['homedir'].'/images/os_icons/'.$file_name);
$file_uploaded = move_uploaded_file($file_tmp, $config['homedir'].'/images/os_icons/'.$file_name);
if ($file_uploaded !== true) {
$message = 10;
}
}
}
} else {
@ -108,7 +115,7 @@ if ($is_management_allowed === true) {
if ($resultOrId === false) {
$message = 2;
$tab = 'builder';
$tab = 'manage_os';
$actionHidden = 'save';
$textButton = __('Create');
$classButton = ['icon' => 'wand'];
@ -144,13 +151,19 @@ if ($is_management_allowed === true) {
if (in_array($file_ext, $allowed_extensions) === false) {
$message = 9;
} else if (exif_imagetype($file_tmp) === false) {
$message = 10;
} else {
$message = 8;
move_uploaded_file($file_tmp, $config['homedir'].'/images/os_icons/'.$file_name);
$file_uploaded = move_uploaded_file($file_tmp, $config['homedir'].'/images/os_icons/'.$file_name);
if ($file_uploaded !== true) {
$message = 10;
}
}
}
} else {
$name = io_safe_input(strip_tags(io_safe_output((string) get_parameter('name'))));
$name = io_safe_input(strip_tags(trim(io_safe_output((string) get_parameter('name')))));
$description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
$icon = get_parameter('icon', 0);
@ -254,7 +267,7 @@ $table->class = 'databox filter-table-adv';
$table->data[0][] = html_print_label_input_block(
__('Name'),
html_print_input_text('name', $name, __('Name'), 20, 30, true, false, false, '', 'w250px')
html_print_input_text('name', $name, __('Name'), 20, 30, true, false, true, '', 'w250px')
);
$table->data[0][] = html_print_label_input_block(
@ -290,6 +303,28 @@ html_print_action_buttons(
echo '</form>';
$id_message = get_parameter('id_message', 0);
if ($id_message !== 0) {
switch ($id_message) {
case 8:
echo ui_print_success_message(__('Icon successfuly uploaded'), '', true);
break;
case 9:
echo ui_print_error_message(__('File must be of type JPG, JPEG, PNG or SVG'), '', true);
break;
case 10:
echo ui_print_error_message(__('An error ocurrered to upload icon'), '', true);
break;
default:
// Nothing to do.
break;
}
}
function get_list_os_icons_dir()
{

View File

@ -162,11 +162,15 @@ if (empty($id_message) === false) {
break;
case 8:
echo ui_print_success_message(__('Icon successfuly uploaded'), '', true);
header('Location: index.php?sec=gagente&sec2=godmode/setup/os&tab=manage_os&action=edit&id_message=8');
break;
case 9:
echo ui_print_error_message(__('File must be of type JPG, JPEG, PNG or SVG'), '', true);
header('Location: index.php?sec=gagente&sec2=godmode/setup/os&tab=manage_os&action=edit&id_message=9');
break;
case 10:
header('Location: index.php?sec=gagente&sec2=godmode/setup/os&tab=manage_os&action=edit&id_message=10');
break;
default:

View File

@ -154,8 +154,7 @@ if ($update_config == 1 && $config['history_db_enabled'] == 1) {
$performance_variables_control = (array) json_decode(io_safe_output($config['performance_variables_control']));
$total_agents = db_get_value('count(*)', 'tagente');
$disable_agentaccess = ($total_agents >= 200 && $config['agentaccess'] == 0) ? true : false;
// $disable_agentaccess = ($total_agents >= 200 && $config['agentaccess'] == 0) ? true : false;
$table_status = new StdClass();
$table_status->width = '100%';
$table_status->class = 'databox filters';
@ -666,8 +665,8 @@ $table_other->data[2][1] = html_print_label_input_block(
true
)
);
$table_other->data[3][0] = html_print_label_input_block(
/*
$table_other->data[3][0] = html_print_label_input_block(
__('Use agent access graph'),
html_print_checkbox_switch(
'agentaccess',
@ -676,9 +675,9 @@ $table_other->data[3][0] = html_print_label_input_block(
true,
$disable_agentaccess
)
);
$table_other->data[3][1] = html_print_label_input_block(
);
*/
$table_other->data[3][0] = html_print_label_input_block(
__('Max. recommended number of files in attachment directory'),
html_print_input_text(
'num_files_attachment',

View File

@ -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;
@ -370,14 +370,14 @@ switch ($section) {
break;
default:
$subpage = 'seccion: '.$section;
$subpage = 'seccion: ';
// Default.
break;
}
// Header.
ui_print_standard_header(
$subpage,
__('Setup').' &raquo; '.$subpage,
'',
false,
$help_header,
@ -388,6 +388,10 @@ ui_print_standard_header(
'link' => '',
'label' => __('Setup'),
],
[
'link' => '',
'label' => $subpage,
],
]
);

View File

@ -535,16 +535,47 @@ html_print_action_buttons(
__('Update'),
'update_button',
false,
[ 'icon' => 'update' ],
[
'icon' => 'update',
'onclick' => 'onFormSubmit()',
],
true
)
);
echo '</form>';
echo ui_print_warning_message(
[
'message' => __('Session timeout must be a number'),
'force_class' => 'invisible js_warning_msg',
],
'',
true
);
?>
<script type="text/javascript">
function onFormSubmit() {
const isNumber = n => $.isNumeric(n);
let session_timeout = $('#text-session_timeout').val()
if(isNumber(session_timeout)) {
if (session_timeout < 0) {
session_timeout = -1;
}
if (session_timeout > 604800) {
session_timeout = 604800;
}
$('#text-session_timeout').val(session_timeout);
} else {
$('.js_warning_msg').removeClass('invisible');
event.preventDefault();
return false;
}
}
function showAndHide() {
if ($('input[type=checkbox][name=double_auth_enabled]:checked').val() == 1) {
$('#table1-2FA_all_users').removeClass('invisible');

View File

@ -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 '<form class="max_floating_element_size" id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general&amp;pure='.$config['pure'].'">';

View File

@ -1952,6 +1952,7 @@ if ($create_alert || $update_alert) {
[
'border' => '0',
'alt' => __('Delete'),
'class' => 'invert_filter main_menu_icon',
]
).'</a> </td>';
$data[1] .= '</tr>';

View File

@ -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) {
).'</a>',
],
];
$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']];
@ -686,23 +769,55 @@ if ($update_user) {
$id_user = (string) get_parameter('id_user', '');
if ($password_new != '') {
$correct_password = false;
if ($config['auth'] !== 'mysql') {
ui_print_error_message(__('It is not possible to change the password because external authentication is being used'));
} else {
$correct_password = false;
$user_credentials_check = process_user_login($id_user, $own_password_confirm, true);
$user_credentials_check = process_user_login($id_user, $own_password_confirm, true);
if ($user_credentials_check !== false) {
$correct_password = true;
}
if ($user_credentials_check !== false) {
$correct_password = true;
}
if ((string) $password_confirm === (string) $password_new) {
if ($correct_password === true || is_user_admin($config['id_user'])) {
if ((is_user_admin($config['id_user']) === false || $config['enable_pass_policy_admin']) && $config['enable_pass_policy']) {
$pass_ok = login_validate_pass($password_new, $id, true);
if ($pass_ok != 1) {
ui_print_error_message($pass_ok);
if ((string) $password_confirm === (string) $password_new) {
if ($correct_password === true || is_user_admin($config['id_user'])) {
if ((is_user_admin($config['id_user']) === false || $config['enable_pass_policy_admin']) && $config['enable_pass_policy']) {
$pass_ok = login_validate_pass($password_new, $id, true);
if ($pass_ok != 1) {
ui_print_error_message($pass_ok);
} else {
$res2 = update_user_password($id, $password_new);
if ($res2) {
db_process_sql_insert(
'tsesion',
[
'id_sesion' => '',
'id_usuario' => $id,
'ip_origen' => $_SERVER['REMOTE_ADDR'],
'accion' => 'Password&#x20;change',
'descripcion' => 'Access password updated',
'fecha' => date('Y-m-d H:i:s'),
'utimestamp' => time(),
]
);
$res3 = save_pass_history($id, $password_new);
// Generate new API token.
$newToken = api_token_generate();
$res4 = update_user($id, ['api_token' => $newToken]);
}
ui_print_result_message(
$res1 || $res2,
__('User info successfully updated'),
__('Error updating user info (no change?)')
);
}
} else {
$res2 = update_user_password($id, $password_new);
if ($res2) {
$res3 = save_pass_history($id, $password_new);
db_process_sql_insert(
'tsesion',
[
@ -715,7 +830,6 @@ if ($update_user) {
'utimestamp' => time(),
]
);
$res3 = save_pass_history($id, $password_new);
// Generate new API token.
$newToken = api_token_generate();
@ -729,54 +843,27 @@ if ($update_user) {
);
}
} else {
$res2 = update_user_password($id, $password_new);
if ($res2) {
$res3 = save_pass_history($id, $password_new);
db_process_sql_insert(
'tsesion',
[
'id_sesion' => '',
'id_usuario' => $id,
'ip_origen' => $_SERVER['REMOTE_ADDR'],
'accion' => 'Password&#x20;change',
'descripcion' => 'Access password updated',
'fecha' => date('Y-m-d H:i:s'),
'utimestamp' => time(),
]
);
// Generate new API token.
$newToken = api_token_generate();
$res4 = update_user($id, ['api_token' => $newToken]);
if ($own_password_confirm === '') {
ui_print_error_message(__('Password of the active user is required to perform password change'));
} else {
ui_print_error_message(__('Password of active user is not correct'));
}
ui_print_result_message(
$res1 || $res2,
__('User info successfully updated'),
__('Error updating user info (no change?)')
);
}
} else {
if ($own_password_confirm === '') {
ui_print_error_message(__('Password of the active user is required to perform password change'));
} else {
ui_print_error_message(__('Password of active user is not correct'));
}
db_process_sql_insert(
'tsesion',
[
'id_sesion' => '',
'id_usuario' => $id,
'ip_origen' => $_SERVER['REMOTE_ADDR'],
'accion' => 'Password&#x20;change',
'descripcion' => 'Access password update failed',
'fecha' => date('Y-m-d H:i:s'),
'utimestamp' => time(),
]
);
ui_print_error_message(__('Passwords does not match'));
}
} else {
db_process_sql_insert(
'tsesion',
[
'id_sesion' => '',
'id_usuario' => $id,
'ip_origen' => $_SERVER['REMOTE_ADDR'],
'accion' => 'Password&#x20;change',
'descripcion' => 'Access password update failed',
'fecha' => date('Y-m-d H:i:s'),
'utimestamp' => time(),
]
);
ui_print_error_message(__('Passwords does not match'));
}
} else {
$has_skin = false;
@ -862,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,
@ -1155,6 +1159,13 @@ if (is_user_admin($id) === true) {
);
}
html_print_div(
[
'id' => 'delete_profile_modal',
'content' => '',
]
);
$full_name = ' <div class="label_select_simple">'.html_print_input_text_extended(
'fullname',
$user_info['fullname'],
@ -1927,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('<?php echo __('Deleting last profile will delete this user'); ?>' + '. ' + '<?php echo __('Are you sure?'); ?>')) {
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("<?php echo __('Deleting this profile will leave your user without a profile or group. You can continue by deleting the user or preserving it.'); ?>");
// Set the title.
$("#delete_profile_modal").prop("title", "<?php echo __('Are you sure?'); ?>");
// 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('<?php echo __('Deleting last profile will delete this user'); ?>' + '. ' + '<?php echo __('Are you sure?'); ?>')) {
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");
@ -1955,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("<?php echo ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/user_list&tab=user&pure=0', false, false, false); ?>");
} 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("<?php echo ui_get_full_url('index.php?sec=advanced&sec2=advanced/users_setup', false, false, true); ?>");
}
}
});
});
}
function checkProfiles(e) {
e.preventDefault();

View File

@ -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 = [];
@ -327,7 +332,7 @@ $passwordManageTable->data = [];
$passwordManageTable->data['captions_newpassword'][0] = __('New password');
$passwordManageTable->rowclass['fields_newpassword'] = 'w540px';
$passwordManageTable->data['fields_newpassword'][0] = html_print_input_text_extended(
$passwordManageTable->data['fields_newpassword'][0] = '<div class="relative container-div-input-password ">'.html_print_input_text_extended(
'password_new',
'',
'password_new',
@ -337,16 +342,17 @@ $passwordManageTable->data['fields_newpassword'][0] = html_print_input_text_exte
$view_mode,
'',
[
'class' => 'input w100p',
'class' => 'input',
'placeholder' => __('Password'),
'style' => 'width: 540px',
],
true,
true
);
).'</div>';
$passwordManageTable->data['captions_repeatpassword'][0] = __('Repeat new password');
$passwordManageTable->rowclass['fields_repeatpassword'] = 'w540px';
$passwordManageTable->data['fields_repeatpassword'][0] = html_print_input_text_extended(
$passwordManageTable->data['fields_repeatpassword'][0] = '<div class="relative container-div-input-password ">'.html_print_input_text_extended(
'password_confirm',
'',
'password_conf',
@ -358,10 +364,11 @@ $passwordManageTable->data['fields_repeatpassword'][0] = html_print_input_text_e
[
'class' => 'input w100p',
'placeholder' => __('Password confirmation'),
'style' => 'width: 540px',
],
true,
true
);
).'</div>';
if ($new_user === false && users_is_admin() === false) {
$passwordManageTable->data['captions_currentpassword'][0] = __('Current password');
@ -857,50 +864,56 @@ $userManagementTable->data['fields_addSettings'][0] = html_print_textarea(
''
);
$userManagementTable->data['captions_addSettings'][1] = __('Login allowed IP list');
$userManagementTable->data['fields_addSettings'][1] = html_print_div(
[
'class' => 'edit_user_allowed_ip',
'content' => html_print_textarea(
'allowed_ip_list',
5,
65,
($user_info['allowed_ip_list'] ?? ''),
(((bool) $view_mode === true) ? 'readonly="readonly"' : ''),
true
),
],
true
);
if (users_is_admin($config['id_user']) === true || (bool) check_acl($config['id_user'], 0, 'PM') === true) {
$allowAllIpsContent = [];
$allowAllIpsContent[] = '<span>'.__('Enable IP allowlist').'</span>';
$allowAllIpsContent[] = html_print_div(
[
'content' => html_print_checkbox_switch(
'allowed_ip_active',
0,
($user_info['allowed_ip_active'] ?? 0),
true,
false,
'handleIpAllowlist(this)'
),
],
true
);
$userManagementTable->data['fields_addSettings'][1] .= ui_print_input_placeholder(
__('Add the source IPs that will allow console access. Each IP must be separated only by comma. * allows all.'),
true
);
$userManagementTable->data['captions_addSettings'][1] = html_print_div(
[
'class' => 'margin-top-10',
'style' => 'display: flex; flex-direction: row-reverse; align-items: center;',
'content' => implode('', $allowAllIpsContent),
],
true
);
$allowAllIpsContent = [];
$allowAllIpsContent[] = '<span>'.__('Allow all IPs').'</span>';
$allowAllIpsContent[] = html_print_div(
[
'content' => html_print_checkbox_switch(
'allowed_ip_active',
0,
($user_info['allowed_ip_active'] ?? 0),
true
),
],
true
);
$userManagementTable->data['fields_addSettings'][1] .= html_print_div(
[
'class' => 'margin-top-10',
'style' => 'display: flex; flex-direction: row-reverse; align-items: center;',
'content' => implode('', $allowAllIpsContent),
],
true
);
$userManagementTable->data['fields_addSettings'][1] .= html_print_div(
[
'class' => 'edit_user_allowed_ip '.(((int) $user_info['allowed_ip_active'] === 1) ? '' : 'invisible'),
'content' => html_print_textarea(
'allowed_ip_list',
5,
65,
($user_info['allowed_ip_list'] ?? ''),
(((bool) $view_mode === true) ? 'readonly="readonly"' : ''),
true
),
],
true
);
$userManagementTable->data['fields_addSettings'][1] .= ui_print_input_placeholder(
__('Add the source IPs that will allow console access. Each IP must be separated only by comma. * allows all.'),
true,
[
'id' => 'info_allowed_ip',
'class' => ((int) $user_info['allowed_ip_active'] === 1) ? 'input_sub_placeholder' : 'input_sub_placeholder invisible',
]
);
}
if ($config['ITSM_enabled'] && $config['ITSM_user_level_conf']) {
// Pandora ITSM user remote login.
@ -1038,4 +1051,14 @@ $(document).ready(function () {
}
})
});
function handleIpAllowlist(e){
if(e.checked === true) {
$('.edit_user_allowed_ip').show();
$('#info_allowed_ip').show();
} else {
$('.edit_user_allowed_ip').hide();
$('#info_allowed_ip').hide();
}
}
</script>

View File

@ -1168,7 +1168,9 @@ if (check_login()) {
);
}
$data[2] .= '<a href ="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;id_agente='.$id_agente.'&amp;tab=module&amp;id_agent_module='.$module['id_agente_modulo'].'&amp;edit_module='.$module['id_modulo'].'">';
$data[2] .= ui_print_truncate_text($module['nombre'], 'module_medium', false, true, true, '&hellip;', 'font-size: 9pt;');
$data[2] .= '</a>';
if (empty($module['extended_info']) === false) {
$data[2] .= ui_print_help_tip($module['extended_info'], true, '/images/default_list.png');
}

View File

@ -38,6 +38,10 @@ if ($change_label === '1') {
$source = get_parameter('source', 0);
$user = get_parameter('user', '');
$value = get_parameter('value', 0) ? 1 : 0;
$user_info = get_user_info($config['id_user']);
if ((bool) $user_info['is_admin'] === false && $config['id_user'] !== $user) {
return false;
}
// Update the label value.
ob_clean();

View File

@ -59,6 +59,7 @@ if (is_ajax() === true) {
$metaID = (int) get_parameter('metaID', 0);
$childrenMethod = get_parameter('childrenMethod', 'on_demand');
$default_filters = [
'searchAgent' => '',
'statusAgent' => AGENT_STATUS_ALL,
@ -69,6 +70,7 @@ if (is_ajax() === true) {
];
$filter = get_parameter('filter', $default_filters);
$agent_a = check_acl($config['id_user'], 0, 'AR');
$agent_w = check_acl($config['id_user'], 0, 'AW');
$access = ($agent_a === true) ? 'AR' : (($agent_w === true) ? 'AW' : 'AR');

View File

@ -829,17 +829,47 @@ class AgentWizard extends HTML
];
}
html_print_action_buttons(
html_print_submit_button(
$this->actionLabel,
'sub-protocol',
$create_modules_button = '';
if ($this->actionType === 'snmp' && $this->version !== null && $this->message['type'][0] !== 'error') {
$create_modules_button = html_print_submit_button(
__('Create modules'),
'create-modules-action',
false,
[
'icon' => 'cog',
'onclick' => '$("#form-main-wizard").submit();',
'icon' => 'next',
'onclick' => 'processListModules()',
],
true
)
);
} else if ($this->actionType === 'wmi' && $this->protocol === 'wmi' && $this->message['type'][0] !== 'error') {
$create_modules_button = html_print_submit_button(
__('Create modules'),
'create-modules-action',
false,
[
'icon' => 'next',
'onclick' => 'processListModules()',
],
true
);
} else {
$create_modules_button = '';
}
html_print_action_buttons(
[
html_print_submit_button(
$this->actionLabel,
'sub-protocol',
false,
[
'icon' => 'cog',
'onclick' => '$("#form-main-wizard").submit();',
],
true
),
$create_modules_button,
]
);
// Prints main form.
@ -3765,7 +3795,10 @@ class AgentWizard extends HTML
'label' => __('Create modules'),
'name' => 'create-modules-action',
'type' => 'button',
'attributes' => [ 'icon' => 'next' ],
'attributes' => [
'icon' => 'next',
'style' => 'display: none;',
],
'script' => 'processListModules();',
'return' => true,
],

View File

@ -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 = [];

View File

@ -269,13 +269,6 @@ class ConsoleSupervisor
$this->checkSyncQueueStatus();
}
/*
* Check number of agents is equals and more than 200.
* NOTIF.ACCESSSTASTICS.PERFORMANCE
*/
$this->checkAccessStatisticsPerformance();
/*
* Checkc agent missing libraries.
* NOTIF.AGENT.LIBRARY
@ -573,13 +566,6 @@ class ConsoleSupervisor
$this->checkSyncQueueStatus();
}
/*
* Check number of agents is equals and more than 200.
* NOTIF.ACCESSSTASTICS.PERFORMANCE
*/
$this->checkAccessStatisticsPerformance();
/*
* Checkc agent missing libraries.
* NOTIF.AGENT.LIBRARY
@ -2392,17 +2378,19 @@ class ConsoleSupervisor
include_once $config['homedir'].'/include/functions_update_manager.php';
$login = get_parameter('login', false);
if (update_manager_verify_registration() === false) {
$this->notify(
[
'type' => 'NOTIF.UPDATEMANAGER.REGISTRATION',
'title' => __('This instance is not registered in the Update manager section'),
'message' => __('Click here to start the registration process'),
'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online',
]
);
} else {
$this->cleanNotifications('NOTIF.UPDATEMANAGER.REGISTRATION');
if ($config['autoupdate'] === '1' || $_GET['sec2'] === 'godmode/update_manager/update_manager') {
if (update_manager_verify_registration() === false) {
$this->notify(
[
'type' => 'NOTIF.UPDATEMANAGER.REGISTRATION',
'title' => __('This instance is not registered in the Update manager section'),
'message' => __('Click here to start the registration process'),
'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online',
]
);
} else {
$this->cleanNotifications('NOTIF.UPDATEMANAGER.REGISTRATION');
}
}
}

View File

@ -580,9 +580,6 @@ class Diagnostics extends Wizard
$countModuleData = db_get_value_sql(
'SELECT COUNT(*) FROM tagente_datos'
);
$countAgentAccess = db_get_value_sql(
'SELECT COUNT(*) FROM tagent_access'
);
$countEvents = db_get_value_sql('SELECT COUNT(*) FROM tevento');
if (enterprise_installed() === true) {
@ -595,39 +592,35 @@ class Diagnostics extends Wizard
$result = [
'error' => false,
'data' => [
'countAgents' => [
'countAgents' => [
'name' => __('Total agents'),
'value' => $countAgents,
],
'countModules' => [
'countModules' => [
'name' => __('Total modules'),
'value' => $countModules,
],
'countGroups' => [
'countGroups' => [
'name' => __('Total groups'),
'value' => $countGroups,
],
'countModuleData' => [
'countModuleData' => [
'name' => __('Total module data records'),
'value' => $countModuleData,
],
'countAgentAccess' => [
'name' => __('Total agent access record'),
'value' => $countAgentAccess,
],
'countEvents' => [
'countEvents' => [
'name' => __('Total events'),
'value' => $countEvents,
],
'countTraps' => [
'countTraps' => [
'name' => __('Total traps'),
'value' => $countTraps,
],
'countUsers' => [
'countUsers' => [
'name' => __('Total users'),
'value' => $countUsers,
],
'countSessions' => [
'countSessions' => [
'name' => __('Total sessions'),
'value' => $countSessions,
],
@ -744,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
@ -763,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'),

View File

@ -106,20 +106,24 @@ class TreeGroupEdition extends TreeGroup
}
// Build the group hierarchy.
foreach ($groups as $id => $group) {
if (isset($groups[$id]['parent']) === true
&& ($groups[$id]['parent'] != 0)
) {
$parent = $groups[$id]['parent'];
// Parent exists.
if (isset($groups[$parent]['children']) === false) {
$groups[$parent]['children'] = [];
}
if (isset($this->filter['show_full_hirearchy']) === false
|| (isset($this->filter['show_full_hirearchy']) === true && (bool) $this->filter['show_full_hirearchy'] === true)
) {
foreach ($groups as $id => $group) {
if (isset($groups[$id]['parent']) === true
&& ($groups[$id]['parent'] != 0)
) {
$parent = $groups[$id]['parent'];
// Parent exists.
if (isset($groups[$parent]['children']) === false) {
$groups[$parent]['children'] = [];
}
// Store a reference to the group into the parent.
$groups[$parent]['children'][] = &$groups[$id];
// This group was introduced into a parent.
$groups[$id]['have_parent'] = true;
// Store a reference to the group into the parent.
$groups[$parent]['children'][] = &$groups[$id];
// This group was introduced into a parent.
$groups[$id]['have_parent'] = true;
}
}
}
@ -167,24 +171,112 @@ class TreeGroupEdition extends TreeGroup
];
$group_acl = '';
if (users_can_manage_group_all('AR') === false) {
$user_groups_str = implode(',', $this->userGroupsArray);
$group_acl = sprintf(
'AND id_grupo IN (%s)',
$user_groups_str
$search_agent = '';
$status_agent = '';
$inner_agent = '';
if ((bool) is_metaconsole() === true) {
if (users_can_manage_group_all('AR') === false) {
$user_groups_str = implode(',', $this->userGroupsArray);
$group_acl = sprintf(
' AND tgrupo.id_grupo IN (%s) ',
$user_groups_str
);
}
if (isset($this->filter['searchAgent']) === true && empty($this->filter['searchAgent']) === false
|| isset($this->filter['statusAgent']) === true && strlen($this->filter['statusAgent']) > 0
) {
$inner_agent = 'INNER JOIN tmetaconsole_agent ON tgrupo.id_grupo = tmetaconsole_agent.id_grupo';
}
if (isset($this->filter['searchAgent']) === true && empty($this->filter['searchAgent']) === false) {
$search_agent = ' AND tmetaconsole_agent.alias LIKE "%'.$this->filter['searchAgent'].'%" ';
}
if (isset($this->filter['statusAgent']) === true && strlen($this->filter['statusAgent']) > 0) {
switch ($this->filter['statusAgent']) {
case AGENT_STATUS_NORMAL:
$status_agent = ' AND (
tmetaconsole_agent.critical_count = 0
AND tmetaconsole_agent.warning_count = 0
AND tmetaconsole_agent.unknown_count = 0
AND tmetaconsole_agent.normal_count > 0)';
break;
case AGENT_STATUS_WARNING:
$status_agent = ' AND (
tmetaconsole_agent.critical_count = 0
AND tmetaconsole_agent.warning_count > 0
AND tmetaconsole_agent.total_count > 0)';
break;
case AGENT_STATUS_CRITICAL:
$status_agent = ' AND tmetaconsole_agent.critical_count > 0';
break;
case AGENT_STATUS_UNKNOWN:
$status_agent = ' AND (
tmetaconsole_agent.critical_count = 0
AND tmetaconsole_agent.warning_count = 0
AND tmetaconsole_agent.unknown_count > 0)';
break;
case AGENT_STATUS_NOT_NORMAL:
$status_agent = ' AND (
tmetaconsole_agent.normal_count <> total_count
OR tmetaconsole_agent.total_count = notinit_count)';
break;
case AGENT_STATUS_NOT_INIT:
$status_agent = ' AND (
tmetaconsole_agent.total_count = 0
OR tmetaconsole_agent.total_count = notinit_count)';
break;
default:
// Nothing to do.
break;
}
}
$sql = sprintf(
'SELECT tgrupo.id_grupo AS gid,
tgrupo.nombre as name,
tgrupo.parent,
tgrupo.icon
FROM tgrupo
%s
WHERE 1=1
%s
%s
%s ',
$inner_agent,
$search_agent,
$status_agent,
$group_acl
);
} else {
if (users_can_manage_group_all('AR') === false) {
$user_groups_str = implode(',', $this->userGroupsArray);
$group_acl = sprintf(
'AND id_grupo IN (%s)',
$user_groups_str
);
}
$sql = sprintf(
'SELECT id_grupo AS gid,
nombre as name,
parent,
icon
FROM tgrupo
WHERE 1=1
%s ',
$group_acl
);
}
$sql = sprintf(
'SELECT id_grupo AS gid,
nombre as name,
parent,
icon
FROM tgrupo
WHERE 1=1 %s',
$group_acl
);
$stats = db_get_all_rows_sql($sql);
$group_stats = [];
foreach ($stats as $group) {

View File

@ -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 = '<?php echo ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=general#table3'); ?>';
window.location = '<?php echo ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=general#table4'); ?>';
}
function serversUp() {

View File

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

View File

@ -4752,7 +4752,7 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
$secondary_groups = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
$secondaryLinks = [];
if (empty($secondary_groups['for_select']) === true) {
$secondaryLinks[] = '<em>'.__('N/A').'</em>';
$secondaryLinks = [];
} else {
foreach ($secondary_groups['for_select'] as $id => $name) {
$secondaryLinks[] = html_print_anchor(
@ -4811,22 +4811,22 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
'content' => groups_get_name($agent['id_grupo']),
],
true
);
).' '.ui_print_group_icon($agent['id_grupo'], true, '', 'margin-left: 2%;', true, false, false, '', true);
$table_contact->data[] = $data;
// Secondary groups.
$data = [];
$data[0] = '<b>'.__('Secondary groups').'</b>';
$data[1] = implode(', ', $secondaryLinks);
$table_contact->data[] = $data;
if (!empty($secondaryLinks) === true) {
$data[0] = '<b>'.__('Secondary groups').'</b>';
$data[1] = implode(', ', $secondaryLinks);
$table_contact->data[] = $data;
}
// Parent agent line.
if (enterprise_installed() === true) {
$data = [];
$data[0] = '<b>'.__('Parent').'</b>';
if ((int) $agent['id_parent'] === 0) {
$data[1] = '<em>'.__('N/A').'</em>';
} else {
if ((int) $agent['id_parent'] !== 0) {
$data = [];
$data[0] = '<b>'.__('Parent').'</b>';
$data[1] = html_print_anchor(
[
'href' => 'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$agent['id_parent'],
@ -4834,9 +4834,9 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
],
true
);
}
$table_contact->data[] = $data;
$table_contact->data[] = $data;
}
}
// Last status change line.
@ -4845,6 +4845,44 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
$data[1] = $time_elapsed;
$table_contact->data[] = $data;
$has_remote_conf = enterprise_hook(
'config_agents_has_remote_configuration',
[$agent['id_agente']]
);
if ((bool) $has_remote_conf) {
$data = [];
$data[0] = __('Remote configuration');
$data[1] = '<spam style="position: relative;top: -10%; margin-right: 10px;">'.__('Enabled').'</spam>';
$data[1] .= html_print_menu_button(
[
'href' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=remote_configuration&id_agente='.$agent['id_agente'].'&disk_conf=1'),
'image' => 'images/remote-configuration@svg.svg',
'title' => __('Edit remote config'),
],
true
);
$satellite_server = (int) db_get_value_filter(
'satellite_server',
'tagente',
['id_agente' => $id_agente]
);
if (empty($satellite_server) === false) {
$satellite_name = db_get_value_filter(
'name',
'tserver',
['id_server' => $satellite_server]
);
$data[0] = __('Satellite server');
$data[1] = $satellite_name;
}
$table_contact->data[] = $data;
}
if (enterprise_installed() === true) {
// SecurityMon line.
$id_module_group = db_get_value('id_mg', 'tmodule_group', 'name', 'Security');
@ -4887,6 +4925,43 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
}
}
// Optional data
// Position Information.
if ((bool) $config['activate_gis'] === true) {
$data = [];
$dataPositionAgent = gis_get_data_last_position_agent(
$agent['id_agente']
);
if (is_array($dataPositionAgent) === true && $dataPositionAgent['stored_longitude'] !== '' && $dataPositionAgent['stored_latitude'] !== '') {
$data[0] = __('Position (Long, Lat)');
$dataOptionalOutput = html_print_anchor(
[
'href' => 'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;tab=gis&amp;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',
@ -4898,4 +4973,25 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
$agent_contact .= html_print_table($table_contact, true);
return $agent_contact;
}
/**
* Return an array with a list of status agents
*
* @return array.
*/
function agents_status_list()
{
$status_list = [];
$status_list[AGENT_STATUS_NORMAL] = __('Normal');
$status_list[AGENT_STATUS_WARNING] = __('Warning');
$status_list[AGENT_STATUS_CRITICAL] = __('Critical');
$status_list[AGENT_STATUS_UNKNOWN] = __('Unknown');
$status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal');
$status_list[AGENT_STATUS_NOT_INIT] = __('Not init');
return $status_list;
}

View File

@ -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');
}
@ -917,10 +921,6 @@ function config_update_config()
$error_update[] = __('Batch statistics period (secs)');
}
if (config_update_value('agentaccess', (int) get_parameter('agentaccess'), true) === false) {
$error_update[] = __('Use agent access graph');
}
if (config_update_value('num_files_attachment', (int) get_parameter('num_files_attachment'), true) === false) {
$error_update[] = __('Max. recommended number of files in attachment directory');
}
@ -2237,10 +2237,6 @@ function config_process_config()
config_update_value('show_qr_code_header', false);
}
if (!isset($config['agentaccess'])) {
config_update_value('agentaccess', true);
}
if (!isset($config['timezone'])) {
config_update_value('timezone', 'Europe/Berlin');
}
@ -2449,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);
}

View File

@ -2525,92 +2525,6 @@ function combined_graph_summatory_average(
}
/**
* Print a graph with access data of agents.
*
* @param integer $id_agent Agent Id.
* @param integer $period Timestamp period graph.
* @param boolean|null $return Type return.
*
* @return string
*/
function graphic_agentaccess(
int $id_agent,
int $period=0,
?bool $return=false,
?bool $agent_view=false
) {
global $config;
// Dates.
$date = get_system_time();
$datelimit = ($date - $period);
$interval = 3600;
// Query.
$sql = sprintf(
'SELECT utimestamp, count(*) as data
FROM tagent_access
WHERE id_agent = %d
AND utimestamp >= %d
AND utimestamp <= %d
GROUP BY TRUNCATE(utimestamp/%d,0)',
$id_agent,
$datelimit,
$date,
$interval
);
$data = db_get_all_rows_sql($sql);
// Array data.
$data_array = [];
$colors = [];
if (isset($data) === true && is_array($data) === true) {
foreach ($data as $value) {
$time = io_safe_output(date('H:m', $value['utimestamp']));
$labels[] = $time;
$data_array[] = [
'y' => (int) $value['data'],
'x' => $time,
];
$colors[] = '#82b92f';
}
}
$options = [];
$options['grid']['hoverable'] = true;
if ($agent_view === true) {
$options['agent_view'] = true;
}
$options = [
'height' => 125,
'colors' => $colors,
'legend' => ['display' => false],
'scales' => [
'x' => [
'grid' => ['display' => false],
'ticks' => [
'fonts' => ['size' => 8],
],
],
'y' => [
'grid' => ['display' => false],
'ticks' => [
'fonts' => ['size' => 8],
],
],
],
'labels' => $labels,
];
return vbar_graph($data_array, $options);
}
/**
* Print a pie graph with alerts defined/fired data
*

View File

@ -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) {
@ -4939,8 +4961,8 @@ function html_print_input_file($name, $return=false, $options=false, $inline_upl
$inline_upload_anchor_to_form
),
[
'mode' => 'link',
'style' => 'min-width: initial;',
'class' => 'secondary',
'style' => 'min-width: initial; position: relative; margin-left: 5%; ',
],
true,
);
@ -7305,8 +7327,10 @@ function html_print_select_date_range(
$time_end='',
$date_text=SECONDS_1DAY,
$class='w100p',
$date_format='Y/m/d',
$time_format='H:i:s'
$date_format_php='Y/m/d',
$time_format_php='H:i:s',
$date_format_js='yy/mm/dd',
$time_format_js='HH:mm:ss'
) {
global $config;
@ -7328,21 +7352,21 @@ function html_print_select_date_range(
}
if ($date_end === '') {
$date_end = date($date_format);
$date_end = date($date_format_php);
}
if ($date_init === '') {
$date_init = date($date_format, strtotime($date_end.' -1 days'));
$date_init = date($date_format_php, strtotime($date_end.' -1 days'));
}
$date_init = date($date_format, strtotime($date_init));
$date_init = date($date_format_php, strtotime($date_init));
if ($time_init === '') {
$time_init = date($time_format);
$time_init = date($time_format_php);
}
if ($time_end === '') {
$time_end = date($time_format);
$time_end = date($time_format_php);
}
$fields[SECONDS_1DAY] = __('Last 24hr');
@ -7508,7 +7532,7 @@ function html_print_select_date_range(
}
$('#text-date').datepicker({
dateFormat: '".DATE_FORMAT_JS."',
dateFormat: '".$date_format_js."',
changeMonth: true,
changeYear: true,
showAnim: 'slideDown'
@ -7516,7 +7540,7 @@ function html_print_select_date_range(
$('[id^=text-time_init]').timepicker({
showSecond: true,
timeFormat: '".TIME_FORMAT_JS."',
timeFormat: '".$time_format_js."',
timeOnlyTitle: '".__('Choose time')."',
timeText: '".__('Time')."',
hourText: '".__('Hour')."',
@ -7527,7 +7551,7 @@ function html_print_select_date_range(
});
$('[id^=text-date_init]').datepicker ({
dateFormat: '".DATE_FORMAT_JS."',
dateFormat: '".$date_format_js."',
changeMonth: true,
changeYear: true,
showAnim: 'slideDown',
@ -7549,7 +7573,7 @@ function html_print_select_date_range(
});
$('[id^=text-date_end]').datepicker ({
dateFormat: '".DATE_FORMAT_JS."',
dateFormat: '".$date_format_js."',
changeMonth: true,
changeYear: true,
showAnim: 'slideDown',
@ -7572,7 +7596,7 @@ function html_print_select_date_range(
$('[id^=text-time_end]').timepicker({
showSecond: true,
timeFormat: '".TIME_FORMAT_JS."',
timeFormat: '".$time_format_js."',
timeOnlyTitle: '".__('Choose time')."',
timeText: '".__('Time')."',
hourText: '".__('Hour')."',

View File

@ -1170,6 +1170,14 @@ if (is_ajax()) {
<p style="font-size: 10pt;">'.$sys_info->data->ramInfo->value.'</p>
</th>
</tr>
<tr>
<th style="width: 15%;">
<p><span>'.$sys_info->data->distroInfo->name.'</span></p>
</th>
<th style="width: 85%;">
<p style="font-size: 10pt;">'.$sys_info->data->distroInfo->value.'</p>
</th>
</tr>
<tr>
<th style="width: 15%;">
<p><span>'.$sys_info->data->osInfo->name.'</span></p>

View File

@ -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(),
]

View File

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

View File

@ -142,7 +142,6 @@ function notifications_get_subtypes(?string $source=null)
'NOTIF.PANDORADB.HISTORICAL',
'NOTIF.HISTORYDB.MR',
'NOTIF.EXT.ELASTICSEARCH',
'NOTIF.EXT.LOGSTASH',
'NOTIF.METACONSOLE.DB_CONNECTION',
'NOTIF.DOWNTIME',
'NOTIF.UPDATEMANAGER.REGISTRATION',
@ -659,7 +658,15 @@ function notifications_get_user_label_status($source, $user, $label)
*/
function notifications_set_user_label_status($source, $user, $label, $value)
{
global $config;
$user_info = get_user_info($config['id_user']);
if ((bool) $user_info['is_admin'] === false && $config['id_user'] !== $user) {
return false;
}
$source_info = notifications_get_all_sources(['id' => $source]);
if (!isset($source_info[0])
|| !$source_info[0]['enabled']
|| !$source_info[0]['user_editable']

View File

@ -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'] = '<form method="post" onsubmit="if (!confirm (\''.__('Are you sure?').'\')) return false">';
$data['actions'] .= html_print_input_image('del', 'images/delete.svg', 1, '', true, ['class' => 'main_menu_icon invert_filter']);
$data['actions'] = '<form method="post" onsubmit="">';
$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'] .= '</form>';

View File

@ -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 .= '<div id="bullets_modules">';
if (isset($fired_count) && $fired_count > 0) {
$out .= '<div class="bullets_modules">';
$out .= '<div><div id="fired_count_'.$uniq_id.'" class="forced_title bullet_modules orange_background"></div>';
$out .= '<span class="font_12pt">'.$fired_count.'</span></div>';
$out .= '</div>';
}
if (isset($critical_count) && $critical_count > 0) {
$out .= '<div class="bullets_modules">';
$out .= '<div><div id="critical_count_'.$uniq_id.'" class="forced_title bullet_modules red_background"></div>';
$out .= '<span class="font_12pt">'.$critical_count.'</span></div>';
$out .= '</div>';
}
if (isset($warning_count) && $warning_count > 0) {
$out .= '<div class="bullets_modules">';
$out .= '<div><div id="warning_count_'.$uniq_id.'" class="forced_title bullet_modules yellow_background"></div>';
$out .= '<span class="font_12pt">'.$warning_count.'</span></div>';
$out .= '</div>';
}
if (isset($unknown_count) && $unknown_count > 0) {
$out .= '<div class="bullets_modules">';
$out .= '<div><div id="unknown_count_'.$uniq_id.'" class="forced_title bullet_modules grey_background"></div>';
$out .= '<span class="font_12pt">'.$unknown_count.'</span></div>';
$out .= '</div>';
}
if (isset($not_init_count) && $not_init_count > 0) {
$out .= '<div class="bullets_modules">';
$out .= '<div><div id="not_init_count_'.$uniq_id.'" class="forced_title bullet_modules blue_background"></div>';
$out .= '<span class="font_12pt">'.$not_init_count.'</span></div>';
$out .= '</div>';
}
if (isset($normal_count) && $normal_count > 0) {
$out .= '<div class="bullets_modules">';
$out .= '<div><div id="normal_count_'.$uniq_id.'" class="forced_title bullet_modules green_background"></div>';
$out .= '<span class="font_12pt">'.$normal_count.'</span></div>';
$out .= '</div>';
}
$out .= '</div>';
} else {
// Classic ones.
$out .= '<b><span id="total_count_'.$uniq_id.'" class="forced_title" >'.$total_count.'</span>';

View File

@ -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.
*
@ -3249,7 +3571,7 @@ function reporting_html_group_report($table, $item, $pdf=0)
$out .= '</tr>';
$out .= '<tr>';
$out .= '</td>';
$out .= '<td><fieldset><legend>'.__('Events per agent').'</legend>';
$out .= '<td><fieldset><legend>'.__('Events by agent').'</legend>';
$data = [];
$options = [];
$labels = [];

View File

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

View File

@ -644,14 +644,16 @@ function snmp_browser_print_oid(
if (isset($_POST['print_create_agent_module'])) {
// Hidden by default.
$output .= html_print_button(
__('Create agent module'),
'create_module_agent_single',
false,
'show_add_module()',
'class="sub add invisible"',
true
);
if (is_metaconsole() === false) {
$output .= html_print_button(
__('Create agent module'),
'create_module_agent_single',
false,
'show_add_module()',
'class="sub add invisible"',
true
);
}
}
if (isset($_POST['print_copy_oid'])) {
@ -1238,13 +1240,15 @@ function snmp_browser_print_container(
if ($show_massive_buttons) {
$output .= '<div id="snmp_create_buttons" style="display:none">';
$output .= html_print_submit_button(
__('Create agent modules'),
'create_modules_agent',
false,
['class' => 'sub add'],
true
);
if (is_metaconsole() === false) {
$output .= html_print_submit_button(
__('Create agent modules'),
'create_modules_agent',
false,
['class' => 'sub add'],
true
);
}
if (is_management_allowed() === true && enterprise_installed()) {
$output .= html_print_submit_button(

View File

@ -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] = '<b>'.$text_title.'</b>';
$messageTable->data[0][1] = $closeButton;
$messageTable->data[0][0] = '<b>'.$text_title.'</b>'.$closeButton;
$messageTable->data[1][0] = '<span>'.$text_message.'</b>';
// JavaScript help vars.
@ -1802,11 +1801,14 @@ function ui_print_string_substr($string, $cutoff=16, $return=false, $fontsize=0)
*
* @return An HTML string if return was true.
*/
function ui_print_alert_template_example($id_alert_template, $return=false, $print_values=true)
function ui_print_alert_template_example($id_alert_template, $return=false, $print_values=true, $print_icon=true)
{
$output = '';
$output .= html_print_image('images/information.png', true, ['class' => 'invert_filter']);
if ($print_icon === true) {
$output .= html_print_image('images/information.png', true, ['class' => 'invert_filter']);
}
$output .= '<span id="example">';
$template = alerts_get_alert_template($id_alert_template);

View File

@ -45,6 +45,7 @@ if (file_exists('../languages/'.$user_language.'.mo') === true) {
$type = (string) get_parameter('type', 'csv');
$data = (string) get_parameter('data');
$data = strip_tags(io_safe_output($data));
$data = json_decode(io_safe_output($data), true);
$default_filename = 'data_exported - '.date($config['date_format']);

View File

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

View File

@ -305,7 +305,7 @@ function agent_changed_by_multiple_agents(event, id_agent, selected) {
$("<option></option>")
.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");
}
}
}

View File

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

View File

@ -1739,3 +1739,8 @@ function loadModal() {
}
}
window.onload = loadModal;
function openEvents(severity) {
$('input[name="filter[severity]"]').val(severity);
$("#event_redirect").submit();
}

View File

@ -609,10 +609,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;
@ -632,12 +647,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;
}

View File

@ -327,8 +327,13 @@ class EventCardboard extends Widget
$return_all_group = true;
}
$help_tip = ui_print_help_tip(
__('Only the first group selected will be used on the redirect to events view.'),
true
);
$inputs['inputs']['row1'][] = [
'label' => __('Groups'),
'label' => __('Groups').$help_tip,
'arguments' => [
'type' => 'select_groups',
'name' => 'groupId[]',
@ -526,6 +531,16 @@ class EventCardboard extends Widget
);
}
$output .= '<form style="display: none" action="'.ui_get_full_url('index.php?sec=eventos&sec2=operation/events/events').'" method="POST" id="event_redirect">';
$output .= html_print_input_hidden('filter[event_type]', $this->values['eventType'], true, false, false, 'filter[event_type]');
$output .= html_print_input_hidden('filter[event_view_hr]', $this->values['maxHours'], true, false, false, 'filter[event_view_hr]');
$output .= html_print_input_hidden('filter[status]', $this->values['eventStatus'], true, false, false, 'filter[status]');
$output .= html_print_input_hidden('filter[id_group_filter]', $this->values['groupId'][0], true, false, false, 'filter[id_group_filter]');
$output .= html_print_input_hidden('filter[severity]', '', true, false, false, 'filter[severity]');
$output .= html_print_input_hidden('get_events', '1', true, false, false, 'get_events');
$output .= html_print_input_hidden('filter[tag_with]', 'WyIwIl0=', true, false, false, 'filter[tag_with]');
$output .= html_print_input_hidden('filter[tag_without]', 'WyIwIl0=', true, false, false, 'filter[tag_without]');
$output .= '</form>';
$output .= '<table class="w100p h100p table-border-0 event-cardboard-widget"><tbody><tr>';
$width_td = (100 / count(explode(',', $severity)));
@ -539,7 +554,8 @@ class EventCardboard extends Widget
}
}
switch ((int) $key) {
$severity_row = (int) $key;
switch ($severity_row) {
case 0:
$text = __('Maintenance');
$color = get_priority_class((int) $key);
@ -600,7 +616,7 @@ class EventCardboard extends Widget
$border = ' border-right: 1px solid white; border-collapse: collapse;';
}
$output .= '<td class="'.$color.'" style="width: '.$width_td.'%;'.$border.'"><span class="med_data">';
$output .= '<td class="'.$color.'" style="width: '.$width_td.'%;'.$border.'" onclick="openEvents('.$severity_row.')"><span class="med_data">';
$output .= $count;
$output .= '</span><br>';
$output .= $text;

View File

@ -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,
'<span class="toggle-inventory-nodo">'.$node_name.'</span>',
'',
'',
$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,
'<span class="toggle-inventory-nodo">'.$node_name.'</span>',
'',
'',
$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,

View File

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

View File

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

View File

@ -420,6 +420,20 @@ class TopNWidget extends Widget
// Prevent double safe input in agents_get_group_agents function.
$agentRegex = io_safe_output($agentRegex);
// Validate regex.
if (@preg_match('/'.$agentRegex.'/', '') === false
|| @preg_match('/'.$this->values['module'].'/', '') === false
) {
$output .= '<div class="container-center">';
$output .= \ui_print_info_message(
__('Invalid regex'),
'',
true
);
$output .= '</div>';
return $output;
}
// This function check ACL.
$agents = @agents_get_group_agents(0, ['aliasRegex' => $agentRegex]);
$agentsId = \array_keys($agents);

View File

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

View File

@ -950,6 +950,23 @@ input.resize_button {
right: 6%;
}
.new-widget-message > div > table,
.container-center > div > table {
display: flex;
flex-direction: column;
align-items: center;
}
.new-widget-message > div > table tr td > div,
.container-center > div > table tr td > div {
position: absolute;
right: 20px;
}
.parent_graph > .graph {
margin-left: 10px;
}
.event-cardboard-widget td {
cursor: pointer;
}

View File

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

View File

@ -4933,6 +4933,7 @@ div#dialog_messages table th:last-child {
margin-top: 55px;
border-radius: 5px;
max-height: 530px;
position: fixed;
}
#notification-wrapper::before {
@ -6042,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;
}
@ -6224,7 +6225,7 @@ div#status_pie {
display: flex;
align-items: flex-start;
padding: 20px;
padding-bottom: 0;
padding-bottom: 1%;
}
.agent_details_content_cluster {
@ -6314,6 +6315,7 @@ div#status_pie {
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
}
.agent_details_agent_data {
@ -6343,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%;
}
@ -6411,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;
@ -11781,16 +11810,14 @@ p.trademark-copyright {
}
.show-hide-pass {
position: absolute;
right: 9px;
top: 4px;
position: fixed;
border: 0;
outline: none;
margin: 0;
margin-left: -50px;
height: 30px;
width: 40px;
cursor: pointer;
display: inline-block;
display: initial;
}
.show-hide-pass-background {
@ -12827,3 +12854,8 @@ tr.shown td.details-control {
position: relative;
top: -92px;
}
#cluetip-inner > #example {
position: absolute;
margin-left: 5px;
}

View File

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

View File

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

View File

@ -131,7 +131,7 @@
<div style='padding-bottom: 50px'>
<?php
$version = '7.0NG.774';
$build = '231127';
$build = '231129';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -523,6 +523,9 @@ if ($agent_view_page === true) {
echo $html_content;
}
// Filter control.
echo '<input type="hidden" id="filter_applied" value="0" />';
// Strict user hidden.
echo '<div id="strict_hidden" class="invisible">';
html_print_input_text('strict_user_hidden', $strict_user);
@ -565,6 +568,10 @@ function alerts_table_controls() {
}
$(document).ready ( function () {
if ($('#filter_applied').val() == 0){
$('#button-form_alerts_status_datatable_search_bt').trigger('click');
$('#filter_applied').val(1);
}
alerts_table_controls();
$('#button-alert_validate').on('click', function () {
validateAlerts();

View File

@ -102,17 +102,37 @@ $agentCountModules = html_print_div(
$table_status = new stdClass();
$table_status->id = 'agent_status_main';
$table_status->width = '100%';
$table_status->width = '90%';
$table_status->height = 'auto';
$table_status->cellspacing = 0;
$table_status->cellpadding = 0;
$table_status->class = 'floating_form';
$table_status->style[0] = 'height: 32px; width: 30%; padding-right: 5px; text-align: end; vertical-align: top';
$table_status->style[1] = 'height: 32px; width: 70%; padding-left: 5px; font-weight: lighter; vertical-align: top';
$table_status->data['agent_os'][0] = __('OS');
$agentOS = [];
$agentOS[] = html_print_div([ 'content' => (empty($agent['os_version']) === true) ? get_os_name((int) $agent['id_os']) : $agent['os_version']], true);
$agentOS[] = html_print_div([ 'style' => 'width: 16px;padding-left: 5px', 'content' => ui_print_os_icon($agent['id_os'], false, true, true, false, false, false, ['width' => '16px'])], true);
$table_status->data['agent_os'][1] = html_print_div(['class' => 'agent_details_agent_data', 'content' => implode('', $agentOS)], true);
$table_status->style[0] = 'height: 28px; width: 30%; padding-right: 5px; text-align: end; vertical-align: top';
$table_status->style[1] = 'height: 28px; width: 70%; padding-left: 5px; font-weight: lighter; vertical-align: top';
$os_agent_text = '';
$os_name = get_os_name((int) $agent['id_os']);
if (empty($agent['os_version']) !== true) {
$agent['os_version'] = io_safe_output($agent['os_version']);
if (strpos($agent['os_version'], '(') !== false) {
$os_name = preg_split('/[0-9]|[\(]/', $agent['os_version'])[0];
$os_version = explode($os_name, explode('(', $agent['os_version'])[0])[1];
$os_version_name = preg_split('/[\(]|[\)]/', $agent['os_version']);
$os_agent_text = $os_version.' ('.$os_version_name[1].')';
} else {
$os_name = preg_split('/[0-9]/', $agent['os_version'])[0];
$os_version = explode($os_name, explode('(', $agent['os_version'])[0])[1];
$os_agent_text = $os_version;
}
}
$table_status->data['agent_os'][0] = html_print_div([ 'style' => 'width: 16px; position: relative; left: 75%', 'content' => ui_print_os_icon($agent['id_os'], false, true, true, false, false, false, ['width' => '16px'])], true);
$table_status->data['agent_os'][1] = $os_name;
if (empty($agent['os_version']) !== true) {
$table_status->data['agent_os_version'][0] = __('OS Version');
$table_status->data['agent_os_version'][1] = $os_agent_text;
}
$addresses = agents_get_addresses($id_agente);
$address = agents_get_address($id_agente);
@ -124,43 +144,48 @@ foreach ($addresses as $k => $add) {
}
if (empty($address) === false) {
$address_text = '<span class="bolder" >'.$address.'</span>';
if (!empty($addresses) === true) {
foreach ($addresses as $sec_address) {
$address_text .= '<br/><span class="italic">'.$sec_address.'</span>';
}
}
$table_status->data['ip_address'][0] = __('IP address');
$table_status->data['ip_address'][1] = (empty($address) === true) ? '<em>'.__('N/A').'</em>' : $address;
$table_status->data['ip_address'][1] = (empty($address) === true) ? '<em>'.__('N/A').'</em>' : $address_text;
}
$table_status->data['agent_version'][0] = __('Agent Version');
$table_status->data['agent_version'][1] = (empty($agent['agent_version']) === true) ? '<i>'.__('N/A').'</i>' : $agent['agent_version'];
$table_status->data['description'][0] = __('Description');
$table_status->data['description'][1] = (empty($agent['comentarios']) === true) ? '<em>'.__('N/A').'</em>' : $agent['comentarios'];
$table_status->data['description'][1] = (empty($agent['comentarios']) === true) ? '<em>'.__('N/A').'</em>' : ui_print_truncate_text($agent['comentarios'], 'description', true);
$has_remote_conf = enterprise_hook(
'config_agents_has_remote_configuration',
[$agent['id_agente']]
$agentEventsHeader = html_print_div(
[
'class' => 'agent_details_header',
'content' => '<span class="subsection_header_title">'.__('Events (Last 24h)').'</span>',
],
true
);
if ((bool) $has_remote_conf) {
$table_status->data['remote_config'][0] = __('Remote configuration');
$table_status->data['remote_config'][1] = __('Enabled');
$satellite_server = (int) db_get_value_filter(
'satellite_server',
'tagente',
['id_agente' => $id_agente]
);
if (empty($satellite_server) === false) {
$satellite_name = db_get_value_filter(
'name',
'tserver',
['id_server' => $satellite_server]
);
$table_status->data['remote_config'][0] = __('Satellite server');
$table_status->data['remote_config'][1] = $satellite_name;
}
}
$agentEventsGraph = html_print_div(
[
'class' => 'white-table-graph-content',
'content' => graph_graphic_agentevents(
$id_agente,
95,
50,
SECONDS_1DAY,
'',
true,
true,
500
),
'style' => 'margin-top: -25px',
],
true
);
$table_agent = $agentStatusHeader.'
<div class="agent_details_content">
@ -170,6 +195,9 @@ $table_agent = $agentStatusHeader.'
<div class="agent_details_info">
'.$alive_animation.html_print_table($table_status, true).'
</div>
</div>
<div class="agent_details_graph">
'.$agentEventsHeader.$agentEventsGraph.'
</div>';
@ -189,11 +217,12 @@ $data_opcional->class = 'floating_form';
// Gis and url address.
$agentAdditionalContent = '';
// Position Information.
if ((bool) $config['activate_gis'] === true) {
/*
if ((bool) $config['activate_gis'] === true) {
$dataPositionAgent = gis_get_data_last_position_agent(
$agent['id_agente']
);
if (is_array($dataPositionAgent) === true && $dataPositionAgent['stored_longitude'] !== '' && $dataPositionAgent['stored_longitude'] !== '') {
if (is_array($dataPositionAgent) === true && $dataPositionAgent['stored_longitude'] !== '' && $dataPositionAgent['stored_latitude'] !== '') {
$data_opcional->data['agent_position'][0] = __('Position (Long, Lat)');
$dataOptionalOutput = html_print_anchor(
@ -210,10 +239,11 @@ if ((bool) $config['activate_gis'] === true) {
$data_opcional->data['agent_position'][1] = $dataOptionalOutput;
}
}
}*/
// If the url description is set.
if (empty($agent['url_address']) === false) {
/*
if (empty($agent['url_address']) === false) {
$data_opcional->data['url_address'][0] = __('Url address');
$data_opcional->data['url_address'][1] = html_print_anchor(
[
@ -222,11 +252,12 @@ if (empty($agent['url_address']) === false) {
],
true
);
}
}*/
// Other IP address and timezone offset.
if (empty($addresses) === false) {
/*
if (empty($addresses) === false) {
$data_opcional->data['other_ip_address'][0] = __('Other IP addresses');
$data_opcional->data['other_ip_address'][1] = html_print_div(
[
@ -235,13 +266,14 @@ if (empty($addresses) === false) {
],
true
);
}
}
*/
// Timezone Offset.
if ((int) $agent['timezone_offset'] !== 0) {
/*
if ((int) $agent['timezone_offset'] !== 0) {
$data_opcional->data['timezone_offset'][0] = __('Timezone Offset');
$data_opcional->data['timezone_offset'][1] = $agent['timezone_offset'];
}
}*/
// Custom fields.
$fields = db_get_all_rows_filter(
@ -313,55 +345,6 @@ for ($i = 0; $i < $custom_fields_count; $i++) {
* END: TABLE DATA BUILD
*/
/*
* START: ACCESS RATE GRAPH
*/
$access_agent = db_get_value_sql(
'SELECT COUNT(id_agent)
FROM tagent_access
WHERE id_agent = '.$id_agente
);
if ((bool) $config['agentaccess'] === true && $access_agent > 0) {
$agentAccessRateHeader = html_print_div(
[
'class' => 'agent_details_header',
'content' => '<span class="subsection_header_title">'.__('Agent access rate (Last 24h)').'</span>',
],
true
);
$agentAccessRateContent = html_print_div(
[
'class' => 'white-table-graph-content',
'content' => graphic_agentaccess(
$id_agente,
SECONDS_1DAY,
true,
true
),
],
true
);
$agentAccessRate = html_print_div(
[
'class' => 'box-flat agent_details_col mrgn_lft_20px w50p',
'id' => 'table_access_rate',
'content' => $agentAccessRateHeader.$agentAccessRateContent,
],
true
);
} else {
$agentAccessRate = '';
}
/*
* END: ACCESS RATE GRAPH
*/
/*
* START: TABLE INTERFACES
*/
@ -534,39 +517,6 @@ $agentContact = html_print_div(
true
);
$agentEventsHeader = html_print_div(
[
'class' => 'agent_details_header',
'content' => '<span class="subsection_header_title">'.__('Events (Last 24h)').'</span>',
],
true
);
$agentEventsGraph = html_print_div(
[
'class' => 'white-table-graph-content',
'content' => graph_graphic_agentevents(
$id_agente,
95,
70,
SECONDS_1DAY,
'',
true,
true,
500
),
],
true
);
$agentEvents = html_print_div(
[
'class' => 'box-flat agent_details_col w50p',
'content' => $agentEventsHeader.$agentEventsGraph,
],
true
);
/*
* EVENTS TABLE END.
*/
@ -598,7 +548,7 @@ html_print_div(
html_print_div(
[
'class' => 'agent_details_line',
'content' => $agentEvents.$agentAccessRate,
'content' => $agentEvents,
]
);

View File

@ -789,10 +789,6 @@ function print_table(
}
html_print_table($table);
if (count($selected_interfaces) > $config['block_size']) {
ui_pagination(count($selected_interfaces), false, $pagination_index, 0, false, 'offset', true, '');
}
} else {
ui_print_info_message(['no_close' => true, 'message' => __('No search parameters')]);
}

View File

@ -541,19 +541,6 @@ if (is_ajax() === true) {
);
}
if (empty($tmp->module_name) === false) {
$tmp->module_name = ui_print_truncate_text(
$tmp->module_name,
'module_medium',
false,
true,
false,
'&hellip;',
true,
true,
);
}
if (empty($tmp->comments) === false) {
$tmp->comments = ui_print_comments($tmp->comments, 20);
}

View File

@ -819,13 +819,6 @@ if ($access_console_node === true) {
}
}
}
if (!empty($sub)) {
$menu_operation['extensions']['text'] = __('Tools');
$menu_operation['extensions']['sec2'] = 'operation/extensions';
$menu_operation['extensions']['id'] = 'oper-extensions';
$menu_operation['extensions']['sub'] = $sub;
}
}
// ~ }

View File

@ -38,7 +38,7 @@ $send_mes = (bool) get_parameter('send_mes', false);
$new_msg = (string) get_parameter('new_msg');
$dst_user = get_parameter('dst_user');
$dst_group = get_parameter('dst_group');
$subject = io_safe_html_tags(get_parameter('subject'));
$subject = io_safe_input(get_parameter('subject'));
$message = (string) get_parameter('message');
$read_message = (bool) get_parameter('read_message', false);
$reply = (bool) get_parameter('reply', false);
@ -132,7 +132,7 @@ if ($read_message) {
echo '<h1>Conversation with '.$user_name.'</h1>';
}
echo '<h2>Subject: '.$message['subject'].'</h2>';
echo '<h2>Subject: '.io_safe_output($message['subject']).'</h2>';
$conversation = messages_get_conversation($message);

View File

@ -259,7 +259,7 @@ if (empty($messages) === true) {
$pathSubject = 'index.php?sec=message_list&amp;sec2=operation/messages/message_edit&amp;read_message=1&amp;id_message='.$message_id;
}
$contentSubject = (empty($message['subject']) === true) ? __('No Subject') : $message['subject'];
$contentSubject = (empty($message['subject']) === true) ? __('No Subject') : io_safe_output($message['subject']);
if ((int) $message['read'] !== 1) {
$contentSubject = '<strong>'.$contentSubject.'</strong>';

View File

@ -72,6 +72,7 @@ if ($searchAgents) {
$has_secondary = enterprise_hook('agents_is_using_secondary_groups');
$stringSearchSQL = str_replace('&amp;', '&', $stringSearchSQL);
$stringSearchSQL = str_replace('&#92;', '\\', $stringSearchSQL);
$sql = "SELECT DISTINCT taddress_agent.id_agent FROM taddress
INNER JOIN taddress_agent ON
taddress.id_a = taddress_agent.id_a

View File

@ -19,17 +19,25 @@ require_once $config['homedir'].'/include/functions_users.php';
$searchModules = check_acl($config['id_user'], 0, 'AR');
$selectModuleNameUp = '';
$selectModuleNameDown = '';
$selectAgentNameUp = '';
$selectAgentNameDown = '';
if ($config['style'] === 'pandora_black') {
$selectModuleNameUp = '';
$selectModuleNameDown = '';
$selectAgentNameUp = '';
$selectAgentNameDown = '';
} else {
$selectModuleNameUp = '_black';
$selectModuleNameDown = '_black';
$selectAgentNameUp = '_black';
$selectAgentNameDown = '_black';
}
$is_admin = (bool) db_get_value('is_admin', 'tusuario', 'id_user', $config['id_user']);
switch ($sortField) {
case 'module_name':
switch ($sort) {
case 'up':
$selectModuleNameUp = $selected;
$selectModuleNameUp = $selected_module;
$order = [
'field' => 'module_name',
'order' => 'ASC',
@ -37,7 +45,7 @@ switch ($sortField) {
break;
case 'down':
$selectModuleNameDown = $selected;
$selectModuleNameDown = $selected_module;
$order = [
'field' => 'module_name',
'order' => 'DESC',
@ -49,7 +57,7 @@ switch ($sortField) {
case 'agent_name':
switch ($sort) {
case 'up':
$selectAgentNameUp = $selected;
$selectAgentNameUp = $selected_module;
$order = [
'field' => 'agent_name',
'order' => 'ASC',
@ -57,7 +65,7 @@ switch ($sortField) {
break;
case 'down':
$selectAgentNameDown = $selected;
$selectAgentNameDown = $selected_module;
$order = [
'field' => 'agent_name',
'order' => 'DESC',
@ -67,7 +75,7 @@ switch ($sortField) {
break;
default:
$selectModuleNameUp = $selected;
$selectModuleNameUp = $selected_module;
$order = [
'field' => 'module_name',
'order' => 'ASC',

View File

@ -30,10 +30,9 @@ if (!$modules || !$searchModules) {
$table->cellspacing = 4;
$table->width = '98%';
$table->class = 'info_table';
$table->head = [];
$table->head[0] = __('Module').' <a href="index.php?search_category=modules&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=module_name&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectModuleNameUp]).'</a><a href="index.php?search_category=modules&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=module_name&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectModuleNameDown]).'</a>';
$table->head[1] = __('Agent').' <a href="index.php?search_category=modules&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=agent_name&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectAgentNameUp]).'</a><a href="index.php?search_category=modules&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=agent_name&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectAgentNameDown]).'</a>';
$table->head[0] = __('Module').' <a href="index.php?search_category=modules&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=module_name&sort=up">'.html_print_image('images/sort_up'.$selectModuleNameUp.'.png', true).'</a><a href="index.php?search_category=modules&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=module_name&sort=down">'.html_print_image('images/sort_down'.$selectModuleNameDown.'.png', true).'</a>';
$table->head[1] = __('Agent').' <a href="index.php?search_category=modules&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=agent_name&sort=up">'.html_print_image('images/sort_up'.$selectAgentNameUp.'.png', true).'</a><a href="index.php?search_category=modules&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=agent_name&sort=down">'.html_print_image('images/sort_down'.$selectAgentNameDown.'.png', true).'</a>';
$table->head[2] = __('Type');
$table->head[3] = __('Interval');
$table->head[4] = __('Status');
@ -80,6 +79,9 @@ if (!$modules || !$searchModules) {
$module['datos'] = modules_get_last_value($module['id_agente_modulo']);
$module['module_name'] = $module['nombre'];
$linked_module_name = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;id_agente='.$module['id_agente'].'&amp;tab=module&amp;id_agent_module='.$module['id_agente_modulo'].'&amp;edit_module='.$module['id_modulo'].'">';
$linked_module_name .= $module['module_name'];
$linked_module_name .= '</a>';
// To search the monitor status
$status_sql = sprintf('SELECT estado from tagente_estado where id_agente_modulo ='.$module['id_agente_modulo']);
$status_sql = db_process_sql($status_sql);
@ -217,7 +219,7 @@ if (!$modules || !$searchModules) {
$url_edit = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$module['id_agente'].'&tab=module&id_agent_module='.$module['id_agente_modulo'].'&edit_module=1';
$edit_module = '<a href="'.$url_edit.'">'.html_print_image('images/edit.svg', true).'</a>';
$edit_module = '<a href="'.$url_edit.'">'.html_print_image('images/edit.svg', true, ['class' => 'invert_filter main_menu_icon']).'</a>';
} else {
$edit_module = '';
}
@ -226,7 +228,7 @@ if (!$modules || !$searchModules) {
array_push(
$table->data,
[
$module['module_name'],
$linked_module_name,
$agentCell,
$typeCell,
$intervalCell,

View File

@ -60,7 +60,7 @@ $order = null;
$sortField = get_parameter('sort_field');
$sort = get_parameter('sort', 'none');
$selected = 'border: 1px solid black;';
$selected_module = '_green';
if ($searchMain) {
$main_tab = [
'text' => "<a href='index.php?search_category=main&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".html_print_image(

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