#12138 Resolve conflict
This commit is contained in:
commit
a4cd6d7fe1
|
@ -3,4 +3,6 @@ START TRANSACTION;
|
|||
-- Delete table tagent_access
|
||||
DROP TABLE tagent_access;
|
||||
|
||||
ALTER TABLE treport_content ADD check_unknowns_graph tinyint DEFAULT 0 NULL;
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -2000,7 +2000,11 @@ ui_require_jquery_file('json');
|
|||
$('#' + thisLabel).prop('checked', true);
|
||||
$('#' + thisLabel).siblings().prop('checked', false);
|
||||
|
||||
if ($('#radius-percentage_warning').prop('checked') === true || $('#radius-percentage_critical').prop('checked') === true) {
|
||||
var type_selected = $("#id_module_type").val();
|
||||
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') {
|
||||
$("#svg_dinamic").hide();
|
||||
} else {
|
||||
paint_graph_values();
|
||||
|
|
|
@ -552,6 +552,9 @@ $(document).ready (function () {
|
|||
|
||||
// If the row is empty, hide it
|
||||
if (field_row == '') {
|
||||
// Clear hidden fields.
|
||||
$("[name=field" + i + "_value]").val('');
|
||||
$("[name=field" + i + "_recovery_value]").val('')
|
||||
$table_macros_field.hide();
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -519,9 +519,9 @@ if (!$maps && is_metaconsole() === false) {
|
|||
$data = [];
|
||||
|
||||
if (is_metaconsole() === false) {
|
||||
$data[0] = '<a href="index.php?sec=network&sec2=operation/visual_console/render_view&id='.$map['id'].'&refr='.$refr.'">'.$map['name'].'</a>';
|
||||
$data[0] = '<a href="index.php?sec=network&sec2=operation/visual_console/render_view&id='.$map['id'].'&refr='.$refr.'">'.io_safe_output($map['name']).'</a>';
|
||||
} else {
|
||||
$data[0] = '<a href="index.php?sec=screen&sec2=screens/screens&action=visualmap&pure='.$pure.'&id='.$map['id'].'&refr='.$refr.'">'.$map['name'].'</a>';
|
||||
$data[0] = '<a href="index.php?sec=screen&sec2=screens/screens&action=visualmap&pure='.$pure.'&id='.$map['id'].'&refr='.$refr.'">'.io_safe_output($map['name']).'</a>';
|
||||
}
|
||||
|
||||
$data[1] = ui_print_group_icon($map['id_group'], true);
|
||||
|
@ -541,7 +541,7 @@ if (!$maps && is_metaconsole() === false) {
|
|||
true,
|
||||
['class' => 'main_menu_icon invert_filter']
|
||||
).'</a>';
|
||||
$data[4] = '<a class="delete_visualmap" href="index.php?sec=network&sec2=godmode/reporting/map_builder&id_layout='.$map['id'].'&delete_layout=1" onclick="javascript: if (!confirm(\''.__('Are you sure?').'\n'.__('Delete').': '.$map['name'].'\')) return false;">'.html_print_image(
|
||||
$data[4] = '<a class="delete_visualmap" href="index.php?sec=network&sec2=godmode/reporting/map_builder&id_layout='.$map['id'].'&delete_layout=1" onclick="javascript: if (!confirm(\''.__('Are you sure?').'\n'.__('Delete').': '.io_safe_output($map['name']).'\')) return false;">'.html_print_image(
|
||||
'images/delete.svg',
|
||||
true,
|
||||
['class' => 'main_menu_icon invert_filter']
|
||||
|
@ -552,7 +552,7 @@ if (!$maps && is_metaconsole() === false) {
|
|||
true,
|
||||
['class' => 'main_menu_icon invert_filter']
|
||||
).'</a>';
|
||||
$data[4] = '<a class="delete_visualmap" href="index.php?sec=screen&sec2=screens/screens&action=visualmap&pure='.$pure.'&id_layout='.$map['id'].'&delete_layout=1" onclick="javascript: if (!confirm(\''.__('Are you sure?').'\n'.__('Delete').': '.$map['name'].'\')) return false;">'.html_print_image(
|
||||
$data[4] = '<a class="delete_visualmap" href="index.php?sec=screen&sec2=screens/screens&action=visualmap&pure='.$pure.'&id_layout='.$map['id'].'&delete_layout=1" onclick="javascript: if (!confirm(\''.__('Are you sure?').'\n'.__('Delete').': '.io_safe_output($map['name']).'\')) return false;">'.html_print_image(
|
||||
'images/delete.svg',
|
||||
true,
|
||||
['class' => 'main_menu_icon invert_filter']
|
||||
|
|
|
@ -150,6 +150,7 @@ $fullscale = false;
|
|||
$percentil = false;
|
||||
$image_threshold = false;
|
||||
$time_compare_overlapped = false;
|
||||
$unknowns_graph = false;
|
||||
|
||||
// Added for events items.
|
||||
$server_multiple = [0];
|
||||
|
@ -354,6 +355,7 @@ switch ($action) {
|
|||
$percentil = isset($style['percentil']) ? (bool) $style['percentil'] : 0;
|
||||
$image_threshold = (isset($style['image_threshold']) === true) ? (bool) $style['image_threshold'] : false;
|
||||
$graph_render = $item['graph_render'];
|
||||
$unknowns_graph = $item['check_unknowns_graph'];
|
||||
// The break hasn't be forgotten.
|
||||
case 'simple_baseline_graph':
|
||||
case 'projection_graph':
|
||||
|
@ -2954,6 +2956,23 @@ if (is_metaconsole() === true) {
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_unknowns_graph" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
echo __('Show unknowns in graph');
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_checkbox_switch(
|
||||
'unknowns_graph',
|
||||
1,
|
||||
$unknowns_graph
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_time_compare_overlapped" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
|
@ -6877,6 +6896,7 @@ function chooseType() {
|
|||
$("#row_group_by").hide();
|
||||
$("#row_type_show").hide();
|
||||
$("#row_use_prefix_notation").hide();
|
||||
$("#row_unknowns_graph").hide();
|
||||
$("#row_os_selector").hide();
|
||||
$("#row_os_version_regexp").hide();
|
||||
$("#row_os_end_of_life").hide();
|
||||
|
@ -6969,6 +6989,7 @@ function chooseType() {
|
|||
$("#row_image_threshold").show();
|
||||
$("#row_graph_render").show();
|
||||
$("#row_percentil").show();
|
||||
$("#row_unknowns_graph").show();
|
||||
|
||||
// Force type.
|
||||
if('<?php echo $action; ?>' === 'new'){
|
||||
|
|
|
@ -1928,6 +1928,7 @@ switch ($action) {
|
|||
$values['graph_render'] = (int) get_parameter(
|
||||
'graph_render'
|
||||
);
|
||||
$values['check_unknowns_graph'] = get_parameter_switch('unknowns_graph', 0);
|
||||
case 'simple_baseline_graph':
|
||||
// HACK it is saved in show_graph field.
|
||||
$values['show_graph'] = (int) get_parameter(
|
||||
|
@ -2867,6 +2868,7 @@ switch ($action) {
|
|||
$values['graph_render'] = (int) get_parameter(
|
||||
'graph_render'
|
||||
);
|
||||
$values['check_unknowns_graph'] = get_parameter_switch('unknowns_graph', 0);
|
||||
case 'simple_baseline_graph':
|
||||
// HACK it is saved in show_graph field.
|
||||
$values['show_graph'] = (int) get_parameter(
|
||||
|
|
|
@ -151,7 +151,7 @@ $table->data[0][] = html_print_label_input_block(
|
|||
__('Name'),
|
||||
html_print_input_text(
|
||||
'name',
|
||||
$visualConsoleName,
|
||||
io_safe_output($visualConsoleName),
|
||||
'',
|
||||
80,
|
||||
100,
|
||||
|
|
|
@ -163,7 +163,7 @@ switch ($activeTab) {
|
|||
$background_color = (string) get_parameter('background_color');
|
||||
$width = (int) get_parameter('width');
|
||||
$height = (int) get_parameter('height');
|
||||
$visualConsoleName = (string) get_parameter('name');
|
||||
$visualConsoleName = (string) io_safe_input(get_parameter('name'));
|
||||
$is_favourite = (int) get_parameter('is_favourite_sent');
|
||||
$auto_adjust = (int) get_parameter('auto_adjust_sent');
|
||||
|
||||
|
@ -239,7 +239,7 @@ switch ($activeTab) {
|
|||
if ($uploadOK == 1) {
|
||||
if (move_uploaded_file($_FILES['background_image']['tmp_name'], $target_file)) {
|
||||
$background = $nameImage;
|
||||
$values['background'] = $background;
|
||||
$values['background'] = io_safe_input($background);
|
||||
$error2 = chmod($target_file, 0644);
|
||||
$uploadOK = $error2;
|
||||
} else {
|
||||
|
@ -872,7 +872,7 @@ $buttons[$activeTab]['active'] = true;
|
|||
|
||||
$tab_builder = ($activeTab === 'editor') ? 'visual_console_editor_editor_tab' : '';
|
||||
ui_print_standard_header(
|
||||
($visualConsoleName ?? ''),
|
||||
(io_safe_output($visualConsoleName) ?? ''),
|
||||
'images/visual_console.png',
|
||||
false,
|
||||
$tab_builder,
|
||||
|
|
|
@ -71,6 +71,8 @@ if (isset($config['filemanager']['message']) === true) {
|
|||
$fallback_directory = 'images';
|
||||
// Get directory.
|
||||
$directory = (string) get_parameter('directory');
|
||||
$directory = str_replace('<', '', $text);
|
||||
$directory = str_replace('>', '', $text);
|
||||
if (empty($directory) === true) {
|
||||
$directory = $fallback_directory;
|
||||
} else {
|
||||
|
|
|
@ -99,10 +99,26 @@ if ($method === 'draw') {
|
|||
|
||||
$table->data = [];
|
||||
|
||||
$where_name = '';
|
||||
if (strlen($filter['free_search']) > 0) {
|
||||
$where = 'WHERE name LIKE "%'.$filter['free_search'].'%"';
|
||||
} else {
|
||||
$where = '';
|
||||
$where_name = 'name LIKE "%'.$filter['free_search'].'%"';
|
||||
}
|
||||
|
||||
$where_group = '';
|
||||
if (empty($filter['group']) === false && $filter['group'] !== '0') {
|
||||
$where_group = sprintf('id_group = %s', $filter['group']);
|
||||
if (empty($where_name) === false) {
|
||||
$where_group = 'AND '.$where_group;
|
||||
}
|
||||
}
|
||||
|
||||
$where = '';
|
||||
if (empty($where_name) === false || empty($where_group) === false) {
|
||||
$where = sprintf(
|
||||
'WHERE %s %s',
|
||||
$where_name,
|
||||
$where_group
|
||||
);
|
||||
}
|
||||
|
||||
$sql = 'SELECT * FROM tdashboard '.$where.' ORDER BY id '.$pagination;
|
||||
|
|
|
@ -92,6 +92,8 @@ $get_id_source_event = get_parameter('get_id_source_event');
|
|||
$node_id = (int) get_parameter('node_id', 0);
|
||||
$settings_modal = get_parameter('settings', 0);
|
||||
$parameters_modal = get_parameter('parameters', 0);
|
||||
$draw_events_graph = get_parameter('drawEventsGraph', false);
|
||||
|
||||
// User private filter.
|
||||
$current_filter = get_parameter('current_filter', 0);
|
||||
$private_filter_event = get_parameter('private_filter_event', 0);
|
||||
|
@ -2751,3 +2753,10 @@ if ($draw_row_response_info === true) {
|
|||
echo $output;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((bool) $draw_events_graph === true) {
|
||||
$filter = get_parameter('filter');
|
||||
$output = event_print_graph($filter);
|
||||
echo $output;
|
||||
return;
|
||||
}
|
|
@ -1361,10 +1361,12 @@ if (check_login()) {
|
|||
$additionalLinkAction = '&flag=1';
|
||||
$linkCaption = __('Force checks');
|
||||
$imgaction = 'images/force@svg.svg';
|
||||
$visibility = '';
|
||||
} else {
|
||||
$additionalLinkAction = '';
|
||||
$linkCaption = __('Refresh');
|
||||
$imgaction = 'images/go-back@svg.svg';
|
||||
$visibility = 'visibility: initial;';
|
||||
}
|
||||
|
||||
$moduleActionButtons[] = html_print_anchor(
|
||||
|
@ -1376,6 +1378,7 @@ if (check_login()) {
|
|||
[
|
||||
'title' => __('Force remote check'),
|
||||
'class' => 'main_menu_icon forced_title',
|
||||
'style' => $visibility,
|
||||
]
|
||||
),
|
||||
],
|
||||
|
|
|
@ -70,8 +70,7 @@ $otherSerialize = get_parameter('other');
|
|||
$otherMode = get_parameter('other_mode', 'url_encode');
|
||||
$returnType = get_parameter('return_type', 'string');
|
||||
$info = get_parameter('info', '');
|
||||
$raw_decode = (bool) get_parameter('raw_decode', false);
|
||||
|
||||
$raw_decode = (bool) get_parameter('raw_decode', true);
|
||||
$other = parseOtherParameter($otherSerialize, $otherMode, $raw_decode);
|
||||
$apiPassword = io_output_password(
|
||||
db_get_value_filter(
|
||||
|
|
|
@ -702,7 +702,7 @@ class WelcomeWindow extends Wizard
|
|||
<?php
|
||||
echo html_print_input_hidden('check_connectivity', 1);
|
||||
echo html_print_label_input_block(
|
||||
__('Ip target'),
|
||||
__('IP address target'),
|
||||
html_print_input_text(
|
||||
'ip_target',
|
||||
'',
|
||||
|
@ -717,7 +717,7 @@ class WelcomeWindow extends Wizard
|
|||
)
|
||||
);
|
||||
echo html_print_label_input_block(
|
||||
__('Agent name'),
|
||||
__('Agent alias'),
|
||||
html_print_input_text(
|
||||
'agent_name',
|
||||
'',
|
||||
|
@ -732,7 +732,7 @@ class WelcomeWindow extends Wizard
|
|||
)
|
||||
);
|
||||
echo html_print_label_input_block(
|
||||
__('Module group'),
|
||||
__('Agent group'),
|
||||
html_print_select_from_sql(
|
||||
'SELECT * FROM tgrupo ORDER BY nombre',
|
||||
'id_group',
|
||||
|
@ -747,7 +747,6 @@ class WelcomeWindow extends Wizard
|
|||
'width: 100%;'
|
||||
)
|
||||
);
|
||||
|
||||
echo html_print_submit_button(__('Create'), 'create_conectivity', false, ['icon' => 'next', 'style' => 'margin-top:15px; float:right;']);
|
||||
?>
|
||||
</div>
|
||||
|
@ -1263,14 +1262,18 @@ class WelcomeWindow extends Wizard
|
|||
});
|
||||
});
|
||||
|
||||
$('#button-create_conectivity').click(function(){
|
||||
$('#button-create_conectivity').click(function(e){
|
||||
if($("#text-ip_target")[0].checkValidity() == false) {
|
||||
$("#text-ip_target")[0].reportValidity();
|
||||
return false;
|
||||
}
|
||||
$.ajax({
|
||||
async: false,
|
||||
type: "POST",
|
||||
url: "include/ajax/task_to_perform.php",
|
||||
data: {
|
||||
check_connectivity: 1,
|
||||
id_group: $('#id_group :selected').val(),
|
||||
id_group: $('#id_group1 option:selected').val(),
|
||||
ip_target: $('#text-ip_target').val(),
|
||||
agent_name: $('#text-agent_name').val(),
|
||||
},
|
||||
|
|
|
@ -4845,6 +4845,48 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
|
|||
$data[1] = $time_elapsed;
|
||||
$table_contact->data[] = $data;
|
||||
|
||||
if (enterprise_installed() === true) {
|
||||
// SecurityMon line.
|
||||
$id_module_group = db_get_value('id_mg', 'tmodule_group', 'name', 'Security');
|
||||
$modules = db_get_all_rows_filter(
|
||||
'tagente_modulo',
|
||||
[
|
||||
'id_agente' => $agent['id_agente'],
|
||||
'id_module_group' => $id_module_group,
|
||||
]
|
||||
);
|
||||
|
||||
if (is_array($modules) === true && count($modules) > 0) {
|
||||
$secmon_status = secmon_status($agent['id_agente']);
|
||||
$data = [];
|
||||
$data[0] = '<b>'.__('SecurityMon').'</b>';
|
||||
$data[1] = ui_print_status_secmon_div($secmon_status, __('Total security modules: %s', count($modules)));
|
||||
$table_contact->data[] = $data;
|
||||
}
|
||||
|
||||
// Hardening line.
|
||||
$module_score = modules_get_agentmodule_id(io_safe_input('Hardening - Score'), $agent['id_agente']);
|
||||
$hardening = '';
|
||||
if (is_array($module_score) === true && key_exists('id_agente_modulo', $module_score) == true) {
|
||||
$raw_data_score = modules_get_raw_data($module_score['id_agente_modulo'], 0, time());
|
||||
$hardening = format_numeric($raw_data_score[0]['datos'], 2);
|
||||
$data = [];
|
||||
$data[0] = '<b>'.__('Hardening').'</b>';
|
||||
$data[1] = $hardening.' %';
|
||||
$table_contact->data[] = $data;
|
||||
}
|
||||
|
||||
// Vulnerabilities line.
|
||||
$vuls = get_vulnerabilities($agent['id_agente']);
|
||||
if (is_array($vuls) === true && count($vuls) > 0) {
|
||||
$score = get_score($vuls);
|
||||
$data = [];
|
||||
$data[0] = '<b>'.__('Vulnerability').'</b>';
|
||||
$data[1] = ui_print_status_vulnerability_div($score);
|
||||
$table_contact->data[] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
$agent_contact = html_print_div(
|
||||
[
|
||||
'class' => 'agent_details_header',
|
||||
|
|
|
@ -12952,7 +12952,7 @@ function api_set_create_event($id, $trash1, $other, $returnType)
|
|||
$values = [];
|
||||
|
||||
if ($other['data'][0] != '') {
|
||||
$values['event'] = $other['data'][0];
|
||||
$values['event'] = io_safe_input(io_safe_output($other['data'][0]));
|
||||
} else {
|
||||
returnError('Event text required.');
|
||||
return;
|
||||
|
|
|
@ -4039,7 +4039,13 @@ function events_get_response_target(
|
|||
if (empty($event['custom_data']) === false) {
|
||||
$custom_data = json_decode($event['custom_data']);
|
||||
foreach ($custom_data as $key => $value) {
|
||||
$target = str_replace('_customdata_'.$key.'_', $value, $target);
|
||||
if (is_array($value) === true) {
|
||||
foreach ($value as $k => $v) {
|
||||
$target = str_replace('_customdata_'.$k.'_', $v, $target);
|
||||
}
|
||||
} else {
|
||||
$target = str_replace('_customdata_'.$key.'_', $value, $target);
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($target, '_customdata_json_') !== false) {
|
||||
|
@ -6199,3 +6205,144 @@ function event_get_counter_extraId(array $event, ?array $filters)
|
|||
|
||||
return $counters;
|
||||
}
|
||||
|
||||
|
||||
function event_print_graph(
|
||||
$filter,
|
||||
$graph_height=100,
|
||||
) {
|
||||
global $config;
|
||||
$show_all_data = false;
|
||||
$events = events_get_all(['te.id_evento', 'te.timestamp', 'te.utimestamp'], $filter, null, null, 'te.utimestamp', true);
|
||||
|
||||
if (empty($filter['date_from']) === false
|
||||
&& empty($filter['time_from']) === false
|
||||
&& empty($filter['date_to']) === false
|
||||
&& empty($filter['time_to']) === false
|
||||
) {
|
||||
$start_utimestamp = strtotime($filter['date_from'].' '.$filter['time_from']);
|
||||
$end_utimestamp = strtotime($filter['date_to'].' '.$filter['time_to']);
|
||||
} else if ($filter['event_view_hr'] !== '') {
|
||||
$start_utimestamp = strtotime('-'.$filter['event_view_hr'].' hours');
|
||||
$end_utimestamp = strtotime('now');
|
||||
} else {
|
||||
$show_all_data = true;
|
||||
$start_utimestamp = $events[0]['utimestamp'];
|
||||
$end_utimestamp = $events[array_key_last($events)]['utimestamp'];
|
||||
}
|
||||
|
||||
$data_events = [];
|
||||
$control_timestamp = $start_utimestamp;
|
||||
$count = 0;
|
||||
foreach ($events as $event) {
|
||||
if ($event['utimestamp'] === $control_timestamp) {
|
||||
$count++;
|
||||
} else {
|
||||
$control_timestamp = $event['utimestamp'];
|
||||
$count = 1;
|
||||
}
|
||||
|
||||
$data_events[$control_timestamp] = $count;
|
||||
}
|
||||
|
||||
$num_data = count($data_events);
|
||||
|
||||
$num_intervals = $num_data;
|
||||
|
||||
$period = ($end_utimestamp - $start_utimestamp);
|
||||
|
||||
if ($period <= SECONDS_6HOURS) {
|
||||
$chart_time_format = 'H:i:s';
|
||||
} else if ($period < SECONDS_1DAY) {
|
||||
$chart_time_format = 'H:i';
|
||||
} else if ($period < SECONDS_15DAYS) {
|
||||
$chart_time_format = 'M d H:i';
|
||||
} else if ($period < SECONDS_1MONTH) {
|
||||
$chart_time_format = 'M d H\h';
|
||||
} else {
|
||||
$chart_time_format = 'M d H\h';
|
||||
}
|
||||
|
||||
$chart = [];
|
||||
$labels = [];
|
||||
$color = [];
|
||||
$count = 0;
|
||||
|
||||
if ($show_all_data === true) {
|
||||
foreach ($events as $event) {
|
||||
if ($event['utimestamp'] === $control_timestamp) {
|
||||
$count++;
|
||||
} else {
|
||||
$control_timestamp = $event['utimestamp'];
|
||||
$count = 1;
|
||||
}
|
||||
|
||||
$data_events[$control_timestamp] = $count;
|
||||
}
|
||||
|
||||
$data_events = array_reverse($data_events, true);
|
||||
|
||||
foreach ($data_events as $utimestamp => $count) {
|
||||
$labels[] = date($chart_time_format, $utimestamp);
|
||||
$chart[] = [
|
||||
'y' => $count,
|
||||
'x' => date($chart_time_format, $utimestamp),
|
||||
];
|
||||
$color[] = '#82b92f';
|
||||
}
|
||||
} else {
|
||||
$interval_length = (int) ($period / $num_intervals);
|
||||
$intervals = [];
|
||||
$intervals[0] = $start_utimestamp;
|
||||
for ($i = 0; $i < $num_intervals; $i++) {
|
||||
$intervals[($i + 1)] = ($intervals[$i] + $interval_length);
|
||||
}
|
||||
|
||||
$control_data = [];
|
||||
|
||||
foreach ($data_events as $utimestamp => $count_event) {
|
||||
for ($i = 0; $i < $num_intervals; $i++) {
|
||||
if ((int) $utimestamp > (int) $intervals[$i] && (int) $utimestamp < (int) $intervals[($i + 1)]) {
|
||||
$control_data[(string) $intervals[$i]] += $count_event;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $num_intervals; $i++) {
|
||||
$labels[] = date($chart_time_format, $intervals[$i]);
|
||||
$chart[] = [
|
||||
'y' => $control_data[$intervals[$i]],
|
||||
'x' => date($chart_time_format, $intervals[$i]),
|
||||
];
|
||||
$color[] = '#82b92f';
|
||||
}
|
||||
}
|
||||
|
||||
$water_mark = [
|
||||
'file' => $config['homedir'].'/images/logo_vertical_water.png',
|
||||
'url' => ui_get_full_url('/images/logo_vertical_water.png'),
|
||||
];
|
||||
|
||||
$options = [
|
||||
'height' => $graph_height,
|
||||
'waterMark' => $water_mark,
|
||||
'legend' => ['display' => false],
|
||||
'colors' => $color,
|
||||
'border' => false,
|
||||
'scales' => [
|
||||
'x' => [
|
||||
'grid' => ['display' => false],
|
||||
],
|
||||
'y' => [
|
||||
'grid' => ['display' => false],
|
||||
],
|
||||
],
|
||||
'labels' => $labels,
|
||||
];
|
||||
|
||||
$graph = '<div style="width:100%; height: '.$graph_height.'px;">';
|
||||
$graph .= vbar_graph($chart, $options);
|
||||
$graph .= '</div>';
|
||||
|
||||
return $graph;
|
||||
}
|
||||
|
|
|
@ -1745,7 +1745,7 @@ function html_print_select_multiple_modules_filtered(array $data):string
|
|||
'label' => __('Agents'),
|
||||
'label_class' => 'font-title-font',
|
||||
'type' => 'select_from_sql',
|
||||
'sql' => 'SELECT `id_agente`,`nombre` FROM tagente',
|
||||
'sql' => 'SELECT `id_agente`,`alias` FROM tagente',
|
||||
'name' => 'filtered-module-agents-'.$uniqId,
|
||||
'selected' => explode(',', $data['mAgents']),
|
||||
'return' => true,
|
||||
|
|
|
@ -11294,7 +11294,7 @@ function reporting_simple_graph(
|
|||
),
|
||||
'ttl' => $ttl,
|
||||
'compare' => $time_compare_overlapped,
|
||||
'show_unknown' => true,
|
||||
'show_unknown' => $content['check_unknowns_graph'],
|
||||
'percentil' => ($content['style']['percentil'] == 1) ? $config['percentil'] : null,
|
||||
'fullscale' => $fullscale,
|
||||
'server_id' => $id_meta,
|
||||
|
|
|
@ -792,10 +792,31 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
|
|||
false,
|
||||
false,
|
||||
'',
|
||||
'white-box-content mrgn_top_0 mrgn_btn_0px',
|
||||
'white-box-content-no-height mrgn_top_0 mrgn_btn_0px',
|
||||
'white_table_flex'
|
||||
);
|
||||
|
||||
if ($config['agentaccess']) {
|
||||
$access_graph = '<div style="height: 150px;" class="w100p center">';
|
||||
$access_graph .= graphic_agentaccess(
|
||||
$id_agente,
|
||||
SECONDS_1DAY,
|
||||
false
|
||||
);
|
||||
$access_graph .= '</div>';
|
||||
ui_toggle(
|
||||
$access_graph,
|
||||
'<span class="subsection_header_title secondary">'.__('Agent access rate (24h)').'</span>',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
'white-box-content-no-height mrgn_top_0 mrgn_btn_0px border-bottom-gray',
|
||||
'white_table_flex'
|
||||
);
|
||||
}
|
||||
|
||||
// Table network interfaces.
|
||||
$network_interfaces_by_agents = agents_get_network_interfaces([$agent]);
|
||||
|
||||
|
@ -966,7 +987,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
|
|||
true,
|
||||
empty($table_advanced->data),
|
||||
'',
|
||||
'white-box-content mrgn_top_0 mrgn_btn_0px border-bottom-gray',
|
||||
'white-box-content-no-height mrgn_top_0 mrgn_btn_0px border-bottom-gray',
|
||||
'white_table_flex'
|
||||
);
|
||||
|
||||
|
|
|
@ -8230,3 +8230,43 @@ function ui_update_name_fav_element($id_element, $section, $label)
|
|||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
function ui_print_status_vulnerability_div(float $score)
|
||||
{
|
||||
$return = '';
|
||||
$class = 'status_rounded_rectangles forced_title';
|
||||
if (((float) $score) <= 5) {
|
||||
return ui_print_div('group_view_ok '.$class, $score);
|
||||
}
|
||||
|
||||
if (((float) $score) > 5 && ((float) $score) <= 7.5) {
|
||||
return ui_print_div('group_view_warn '.$class, $score);
|
||||
}
|
||||
|
||||
if (((float) $score) > 7.5) {
|
||||
return ui_print_div('group_view_crit '.$class, $score);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
function ui_print_status_secmon_div($status, $title=false)
|
||||
{
|
||||
$class = 'status_rounded_rectangles forced_title';
|
||||
if (($status) === 'normal') {
|
||||
$title = ($title === false) ? __('normal') : $title;
|
||||
return ui_print_div('group_view_ok '.$class, $title);
|
||||
}
|
||||
|
||||
if (($status) === 'warning') {
|
||||
$title = ($title === false) ? __('warning') : $title;
|
||||
return ui_print_div('group_view_warn '.$class, $title);
|
||||
}
|
||||
|
||||
if (($status) === 'critical') {
|
||||
$title = ($title === false) ? __('critical') : $title;
|
||||
return ui_print_div('group_view_crit '.$class, $title);
|
||||
}
|
||||
}
|
|
@ -1228,6 +1228,12 @@ function get_build_setup_charts($type, $options, $data)
|
|||
) {
|
||||
$colors = $options['colors'];
|
||||
$borders = $options['colors'];
|
||||
if (isset($options['border']) === true && (bool) $options['border'] === false) {
|
||||
$borders = [];
|
||||
foreach ($colors as $color) {
|
||||
$borders[] = 'rgba(0, 0, 0, 0)';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Colors.
|
||||
$defaultColor = [];
|
||||
|
|
|
@ -2223,6 +2223,9 @@ function pandoraFlotArea(
|
|||
}
|
||||
|
||||
var dataInSelection = ranges.xaxis.to - ranges.xaxis.from;
|
||||
if (dataInSelection < 35000) {
|
||||
return;
|
||||
}
|
||||
|
||||
var maxticks_zoom = dataInSelection / 3600000 / number_ticks;
|
||||
if (maxticks_zoom < 0.001) {
|
||||
|
|
|
@ -500,16 +500,25 @@ function configure_modules_form() {
|
|||
"checked",
|
||||
data["critical_inverse"]
|
||||
);
|
||||
$("#checkbox-warning_inverse").prop("checked", data["warning_inverse"]);
|
||||
$("#checkbox-percentage_warning").prop(
|
||||
"uncheck",
|
||||
data["percentage_warning"]
|
||||
);
|
||||
$("#checkbox-percentage_critical").prop(
|
||||
"uncheck",
|
||||
data["percentage_critical"]
|
||||
);
|
||||
|
||||
$("#label-radius-normal_warning").trigger("click");
|
||||
$("#label-radius-normal_critical").trigger("click");
|
||||
|
||||
if (data["warning_inverse"] == true) {
|
||||
$("#label-radius-warning_inverse").trigger("click");
|
||||
}
|
||||
|
||||
if (data["critical_inverse"] == true) {
|
||||
$("#label-radius-critical_inverse").trigger("click");
|
||||
}
|
||||
|
||||
if (data["percentage_warning"] == true) {
|
||||
$("#label-radius-percentage_warning").trigger("click");
|
||||
}
|
||||
|
||||
if (data["percentage_critical"] == true) {
|
||||
$("#label-radius-percentage_critical").trigger("click");
|
||||
}
|
||||
$("#component_loading").hide();
|
||||
$("#id_module_type").change();
|
||||
if ($("#id_category").is("select")) {
|
||||
|
|
|
@ -731,8 +731,7 @@ class Manager implements PublicLogin
|
|||
int $limit=-1,
|
||||
bool $favourite=false,
|
||||
bool $slideshow=false,
|
||||
string $id_user='',
|
||||
array $rowFilter=[]
|
||||
string $id_user=''
|
||||
):array {
|
||||
global $config;
|
||||
|
||||
|
@ -750,14 +749,6 @@ class Manager implements PublicLogin
|
|||
$sql_where .= 'AND td.cells_slideshow = 1';
|
||||
}
|
||||
|
||||
if (empty((int) $rowFilter['id_group']) === false) {
|
||||
$sql_where .= ' AND td.id_group = '.$rowFilter['id_group'];
|
||||
}
|
||||
|
||||
if (empty($rowFilter['name_filter']) === false) {
|
||||
$sql_where .= ' AND td.name like "%'.$rowFilter['name_filter'].'%"';
|
||||
}
|
||||
|
||||
if (empty($id_user) === true) {
|
||||
$id_user = $config['id_user'];
|
||||
}
|
||||
|
@ -953,13 +944,6 @@ class Manager implements PublicLogin
|
|||
private function showList()
|
||||
{
|
||||
global $config;
|
||||
$id_group_filter = \get_parameter_post('id_group', '');
|
||||
$name_filter = \get_parameter_post('name', '');
|
||||
|
||||
$rowFilter = [
|
||||
'id_group' => $id_group_filter,
|
||||
'name_filter' => $name_filter,
|
||||
];
|
||||
|
||||
$limit_sql = $config['block_size'];
|
||||
|
||||
|
@ -973,7 +957,7 @@ class Manager implements PublicLogin
|
|||
$resultCopy = $this->copy();
|
||||
}
|
||||
|
||||
$dashboards = $this->getDashboards($this->offset, $limit_sql, false, false, '', $rowFilter);
|
||||
$dashboards = $this->getDashboards($this->offset, $limit_sql);
|
||||
$count = $this->getDashboardsCount();
|
||||
|
||||
View::render(
|
||||
|
|
|
@ -6443,6 +6443,18 @@ div#status_pie {
|
|||
min-width: 100%;
|
||||
}
|
||||
|
||||
.white-box-content-no-height {
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
box-sizing: border-box;
|
||||
/*border: 1px solid #e2e2e2;*/
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
padding: 10px;
|
||||
min-width: 100%;
|
||||
}
|
||||
|
||||
.white-box-content-clean {
|
||||
padding-left: 2em;
|
||||
padding-top: 1em;
|
||||
|
@ -6720,6 +6732,7 @@ table.table_modal_alternate tr td:first-child {
|
|||
white-space: normal;
|
||||
word-break: break-all;
|
||||
line-height: 1.3;
|
||||
max-width: 40px !important;
|
||||
}
|
||||
|
||||
table#agent_interface_info .flot-text .flot-x-axis div {
|
||||
|
|
|
@ -1871,3 +1871,8 @@ a.pandora_pagination,
|
|||
#general-tactical-view #horizontalBar .labels .label span {
|
||||
color: black;
|
||||
}
|
||||
|
||||
#score-bar .labels-bar span,
|
||||
#score-bar .labels-bar div {
|
||||
color: white;
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@
|
|||
.dt-buttons {
|
||||
display: flex;
|
||||
margin: 10px;
|
||||
margin-left: 0px;
|
||||
margin-left: 10px;
|
||||
position: relative;
|
||||
}
|
||||
.dt-buttons button {
|
||||
|
@ -148,6 +148,15 @@
|
|||
.col-md-7 {
|
||||
width: 80%;
|
||||
}
|
||||
.col-sl-12 {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.col-sl-4 {
|
||||
width: 33%;
|
||||
margin: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes load {
|
||||
|
|
|
@ -2604,6 +2604,27 @@ try {
|
|||
// Open current filter quick reference.
|
||||
$active_filters_div = '<div class="filter_summary">';
|
||||
|
||||
$active_filters_div .= '<div>';
|
||||
$active_filters_div .= '<div class="label box-shadow">'.__('Show graph').'</div>';
|
||||
|
||||
$active_filters_div .= html_print_div(
|
||||
[
|
||||
'class' => 'content',
|
||||
'style' => 'padding-top: 5px !important;',
|
||||
'content' => html_print_checkbox_switch_extended(
|
||||
'show_event_graph',
|
||||
1,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
$active_filters_div .= '</div>';
|
||||
|
||||
// Current filter.
|
||||
$active_filters_div .= '<div>';
|
||||
$active_filters_div .= '<div class="label box-shadow">'.__('Current filter').'</div>';
|
||||
|
@ -2690,6 +2711,42 @@ try {
|
|||
$show_hide_filters = 'invisible';
|
||||
}
|
||||
|
||||
|
||||
// Print graphs
|
||||
$graph_background = '';
|
||||
if ($config['style'] === 'pandora') {
|
||||
$graph_background = ' background-color: #fff;';
|
||||
} else if ($config['style'] === 'pandora_black') {
|
||||
$graph_background = ' background-color: #222;';
|
||||
}
|
||||
|
||||
$graph_div = html_print_div(
|
||||
[
|
||||
'id' => 'events-graph',
|
||||
'class' => 'invisible',
|
||||
'style' => 'margin-bottom: 10px; text-align: left;'.$graph_background,
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$graph_div .= html_print_div(
|
||||
[
|
||||
'id' => 'events-graph-loading',
|
||||
'class' => 'center invisible',
|
||||
'content' => html_print_image(
|
||||
'images/spinner.gif',
|
||||
true,
|
||||
[
|
||||
'title' => __('Loading'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
|
||||
|
||||
// Print datatable.
|
||||
html_print_div(
|
||||
[
|
||||
|
@ -2713,7 +2770,7 @@ try {
|
|||
'inputs' => [],
|
||||
'extra_buttons' => $buttons,
|
||||
],
|
||||
'extra_html' => $active_filters_div,
|
||||
'extra_html' => $active_filters_div.$graph_div,
|
||||
'pagination_options' => [
|
||||
[
|
||||
$config['block_size'],
|
||||
|
@ -3262,6 +3319,19 @@ function reorder_tags_inputs() {
|
|||
/* Tag management ends */
|
||||
$(document).ready( function() {
|
||||
|
||||
let hidden_graph = true;
|
||||
$('#checkbox-show_event_graph').on('change', function(){
|
||||
if (hidden_graph == true) {
|
||||
hidden_graph = false;
|
||||
$('#events-graph').removeClass('invisible');
|
||||
show_events_graph();
|
||||
} else {
|
||||
hidden_graph = true;
|
||||
$('#events-graph').html();
|
||||
$('#events-graph').addClass('invisible');
|
||||
}
|
||||
});
|
||||
|
||||
let refresco = <?php echo get_parameter('refr', 0); ?>;
|
||||
$('#refresh option[value='+refresco+']').attr('selected', 'selected');
|
||||
|
||||
|
@ -3427,6 +3497,10 @@ $(document).ready( function() {
|
|||
click_button_remove_tag("without");
|
||||
});
|
||||
|
||||
$("#button-events_form_search_bt").click(function(){
|
||||
show_events_graph();
|
||||
});
|
||||
|
||||
|
||||
//Autorefresh in fullscreen
|
||||
var pure = '<?php echo $pure; ?>';
|
||||
|
@ -3641,4 +3715,27 @@ function show_event_dialo(event, dialog_page) {
|
|||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
function show_events_graph(){
|
||||
var inputs = $("#events_form :input");
|
||||
var values = {};
|
||||
inputs.each(function() {
|
||||
values[this.name] = $(this).val();
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
|
||||
data: {
|
||||
page: 'include/ajax/events',
|
||||
drawEventsGraph: true,
|
||||
filter: values
|
||||
},
|
||||
success: function (data){
|
||||
$('#events-graph')
|
||||
.empty()
|
||||
.html(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1646,6 +1646,7 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
|
|||
`cat_security_hardening` INT NOT NULL DEFAULT 0,
|
||||
`ignore_skipped` INT NOT NULL DEFAULT 0,
|
||||
`status_of_check` TINYTEXT,
|
||||
`check_unknowns_graph` tinyint DEFAULT '0',
|
||||
PRIMARY KEY(`id_rc`),
|
||||
FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
|
|
|
@ -67,74 +67,6 @@ if (isset($resultCopy) === true) {
|
|||
);
|
||||
}
|
||||
|
||||
// Filter table.
|
||||
$filter_id_group = \get_parameter_post('id_group', '');
|
||||
$filter_name = \get_parameter_post('name', '');
|
||||
|
||||
$filterTable = new stdClass();
|
||||
$filterTable->class = 'filter-table-adv w100p';
|
||||
$filterTable->size[0] = '20%';
|
||||
$filterTable->size[1] = '20%';
|
||||
$filterTable->data = [];
|
||||
|
||||
$filterTable->data[0][0] = html_print_label_input_block(
|
||||
__('Group'),
|
||||
html_print_select_groups(
|
||||
false,
|
||||
'AR',
|
||||
true,
|
||||
'id_group',
|
||||
$filter_id_group,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'w100p',
|
||||
false,
|
||||
''
|
||||
)
|
||||
);
|
||||
|
||||
$filterTable->data[0][1] = html_print_label_input_block(
|
||||
__('Name'),
|
||||
html_print_input_text('name', $filter_name, '', 25, 80, true)
|
||||
);
|
||||
|
||||
$form_html = '<form id="form_dashboard_search" method="post" action="'.$urlDashboard.'">';
|
||||
$form_html .= html_print_table($filterTable, true);
|
||||
$form_html .= html_print_div(
|
||||
[
|
||||
'class' => 'action-buttons',
|
||||
'content' => html_print_submit_button(
|
||||
__('Filter'),
|
||||
'uptbutton',
|
||||
false,
|
||||
[
|
||||
'icon' => 'search',
|
||||
'mode' => 'mini',
|
||||
],
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
$form_html .= '</form>';
|
||||
|
||||
ui_toggle(
|
||||
$form_html,
|
||||
'<span class="subsection_header_title">'.__('Filter').'</span>',
|
||||
'dashboard_search',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
'white-box-content',
|
||||
'box-flat white_table_graph fixed_filter_bar'
|
||||
);
|
||||
|
||||
|
||||
if (empty($dashboards) === true) {
|
||||
ui_print_info_message(
|
||||
[
|
||||
|
@ -189,15 +121,21 @@ if (empty($dashboards) === true) {
|
|||
'form' => [
|
||||
'inputs' => [
|
||||
[
|
||||
'label' => __('Free search'),
|
||||
'label' => __('Name'),
|
||||
'type' => 'text',
|
||||
'class' => 'w400px',
|
||||
'class' => 'w80p',
|
||||
'id' => 'free_search',
|
||||
'name' => 'free_search',
|
||||
],
|
||||
[
|
||||
'label' => __('Group'),
|
||||
'type' => 'select_groups',
|
||||
'id' => 'group',
|
||||
'name' => 'group',
|
||||
],
|
||||
],
|
||||
],
|
||||
'filter_main_class' => 'box-flat white_table_graph fixed_filter_bar ',
|
||||
'filter_main_class' => 'box-flat white_table_graph fixed_filter_bar',
|
||||
'csv' => false,
|
||||
]
|
||||
);
|
||||
|
|
|
@ -2395,10 +2395,8 @@ sub pandora_process_module ($$$$$$$$$;$) {
|
|||
|
||||
} else {
|
||||
if($new_status == 0 && $ff_normal > $min_ff_event) {
|
||||
# Reached normal FF but status have not changed, reset counters.
|
||||
# Reached normal FF but status have not changed, reset counter.
|
||||
$ff_normal = 0;
|
||||
$ff_critical = 0;
|
||||
$ff_warning = 0;
|
||||
}
|
||||
|
||||
# Active ff interval
|
||||
|
|
Loading…
Reference in New Issue