From b100d34985404ad9402f1f4762df9463b92b970e Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Mon, 13 Nov 2023 09:38:24 +0100 Subject: [PATCH 1/4] #12249 new view vulnerabilities agent --- pandora_console/include/functions_ui.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 3b193b8975..cbe3314289 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -8230,3 +8230,23 @@ 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; +} \ No newline at end of file From dc714a5b9f9e1a82d9647305c7398fa25bbe3e24 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Mon, 13 Nov 2023 15:27:07 +0100 Subject: [PATCH 2/4] #12249 column secmon --- pandora_console/include/functions_ui.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index cbe3314289..05eeeb483d 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -8249,4 +8249,21 @@ function ui_print_status_vulnerability_div(float $score) } return $return; +} + + +function ui_print_status_secmon_div($status) +{ + $class = 'status_rounded_rectangles forced_title'; + if (($status) === 'normal') { + return ui_print_div('group_view_ok '.$class, __('normal')); + } + + if (($status) === 'warning') { + return ui_print_div('group_view_warn '.$class, __('warning')); + } + + if (($status) === 'critical') { + return ui_print_div('group_view_crit '.$class, __('critical')); + } } \ No newline at end of file From 636f76258e4fe017a4d38dcab6aa7ce85eca2c5b Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Tue, 14 Nov 2023 10:12:48 +0100 Subject: [PATCH 3/4] #12249 fixed black theme view --- pandora_console/include/styles/pandora_black.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pandora_console/include/styles/pandora_black.css b/pandora_console/include/styles/pandora_black.css index c2afb2c737..e2f5eb1639 100644 --- a/pandora_console/include/styles/pandora_black.css +++ b/pandora_console/include/styles/pandora_black.css @@ -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; +} From 2db0d05a3703bbce023ea08c93e2d1eb8d7ee408 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Wed, 15 Nov 2023 09:46:40 +0100 Subject: [PATCH 4/4] #12250 new report detail security --- .../reporting_builder.item_editor.php | 90 +++++++++++++++++++ .../godmode/reporting/reporting_builder.php | 20 +++++ .../include/functions_reporting.php | 8 ++ .../include/functions_reporting_html.php | 68 ++++++++++++++ pandora_console/include/functions_reports.php | 5 ++ 5 files changed, 191 insertions(+) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index bb06d3a800..013b623c8b 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -1084,6 +1084,15 @@ switch ($action) { $period = $item['period']; 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; + default: // It's not possible. break; @@ -3913,6 +3922,76 @@ if (is_metaconsole() === true) { ?> + + + + + + + __('ALL'), + 'critical' => __('CRITICAL'), + 'warning' => __('WARNING'), + ], + 'secmon_status', + $secmon_status, + ); + ?> + + + + + + + + + __('ALL'), + '90' => __('< 90%'), + '80' => __('< 80%'), + '70' => __('< 70%'), + '60' => __('< 60%'), + '50' => __('< 50%'), + '40' => __('< 40%'), + '30' => __('< 30%'), + '20' => __('< 20%'), + '10' => __('< 10%'), + ], + 'security_hardening_score', + (empty($security_hardening_score) === false) ? $security_hardening_score : 'all', + ); + ?> + + + + + + + + + __('ALL'), + 'crit' => __('CRITICAL'), + 'warn' => __('WARNING'), + ], + 'vulnerabilities_status', + $vulnerabilities_status, + ); + ?> + + @@ -6850,6 +6929,9 @@ 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(); // SLA list default state. $("#sla_list").hide(); @@ -7749,6 +7831,14 @@ function chooseType() { $("#row_group").show(); $('#row_period').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; } switch (type) { diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 095f79b14a..a85792f3e6 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -2045,6 +2045,16 @@ switch ($action) { $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; + default: $values['period'] = get_parameter('period'); $values['top_n'] = get_parameter( @@ -2977,6 +2987,16 @@ switch ($action) { $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; + default: $values['period'] = get_parameter('period'); $values['top_n'] = get_parameter( diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 39f1642fa0..167a0db389 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -1023,6 +1023,14 @@ function reporting_make_reporting_data( ); break; + case 'vuls_by_agent': + $report['contents'][] = reporting_vuls_by_agent( + $report, + $content, + $type + ); + break; + default: // Default. break; diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 99f3af63ad..92508ac00b 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -507,6 +507,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1, $cust case 'evolution': reporting_evolution_graph($table, $item); break; + + case 'vuls_by_agent': + reporting_html_vuls_by_agent($table, $item); + break; } if ($item['type'] == 'agent_module') { @@ -522,6 +526,70 @@ function reporting_html_print_report($report, $mini=false, $report_info=1, $cust } +/** + * Function to print the all vulnerabilities by agent. + * + * @param object $table Head table or false if it comes from pdf. + * @param array $item Items data. + * @param integer $pdf Flag for return table. + * + * @return mixed + */ +function reporting_html_vuls_by_agent($table, $item, $pdf=0) +{ + $table->width = '99%'; + $table->styleTable = 'border: 0px;'; + $table->colspan[2][0] = 3; + $table1 = new stdClass(); + $table1->headstyle[0] = 'text-align: left'; + $table1->headstyle[1] = 'text-align: left'; + $table1->headstyle[2] = 'text-align: left'; + $table1->width = '99%'; + $table1->class = 'info_table'; + $table1->titleclass = 'title_table_pdf'; + $table1->rowclass[0] = ''; + $table1->head[0] = __('Agent'); + $table1->head[1] = __('OS'); + $table1->head[2] = __('OS Version'); + $table1->head[3] = __('Group'); + $table1->head[4] = __('Ip'); + $table1->head[5] = __('Status'); + $table1->head[6] = __('SecMon'); + $table1->head[7] = __('Hardening'); + $table1->head[8] = __('Vulnerability'); + $table1->head[9] = __('Last contact'); + $table1->head[10] = __('L.S. Change'); + + $row = 1; + foreach ($item['data'] as $key => $vul) { + $table1->data[$row][0] = $vul['alias']; + $table1->data[$row][2] = $vul['name']; + $table1->data[$row][3] = $vul['os_version']; + $table1->data[$row][4] = $vul['nombre_gr']; + $table1->data[$row][5] = $vul['direccion']; + $table1->data[$row][6] = $vul['status']; + $table1->data[$row][7] = $vul['secmon']; + $table1->data[$row][8] = $vul['hardening']; + $table1->data[$row][9] = $vul['vulnerabilities']; + $table1->data[$row][10] = $vul['ultimo_contacto']; + $table1->data[$row][11] = $vul['last_status_c']; + $row++; + } + + if ($pdf === 1) { + $table1->title = $item['title']; + $table1->titleclass = 'title_table_pdf'; + $table1->titlestyle = 'text-align:left;'; + } + + $table->data[2][0] = html_print_table($table1, true); + + if ($pdf === 1) { + return html_print_table($table1, true); + } +} + + /** * Function to print the security hardening evolution. * diff --git a/pandora_console/include/functions_reports.php b/pandora_console/include/functions_reports.php index 3da9993933..27533fa5a3 100755 --- a/pandora_console/include/functions_reports.php +++ b/pandora_console/include/functions_reports.php @@ -1003,6 +1003,11 @@ function reports_get_report_types($template=false, $not_editor=false) 'optgroup' => __('Security hardening'), 'name' => __('Evolution'), ]; + + $types['vuls_by_agent'] = [ + 'optgroup' => __('Vulnerabilities'), + 'name' => __('Detailed security report'), + ]; } return $types;