Merge branch 'ent-12251-integracion-de-los-datos-de-seguridad-en-la-vista-ppal-de-agente' into 'develop'

Ent 12251 Integracion de los datos de seguridad en la vista ppal de agente

See merge request artica/pandorafms!6657
This commit is contained in:
Rafael Ameijeiras 2023-11-27 10:30:43 +00:00
commit 48c459e768
4 changed files with 97 additions and 1 deletions

View File

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

View File

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

View File

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

View File

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