diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 1c85daed6e..28122bb054 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -1084,6 +1084,18 @@ 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); @@ -7865,6 +7877,18 @@ function chooseType() { $('#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(); diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index a85792f3e6..b4ffafee6f 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -2045,6 +2045,21 @@ 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'); @@ -2987,6 +3002,21 @@ 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'); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 167a0db389..a77b212957 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -1023,6 +1023,30 @@ 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, diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 92508ac00b..937fa1f39d 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -508,6 +508,18 @@ function reporting_html_print_report($report, $mini=false, $report_info=1, $cust 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; @@ -526,6 +538,78 @@ function reporting_html_print_report($report, $mini=false, $report_info=1, $cust } +/** + * 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. * diff --git a/pandora_console/include/functions_reports.php b/pandora_console/include/functions_reports.php index 27533fa5a3..2ca7181938 100755 --- a/pandora_console/include/functions_reports.php +++ b/pandora_console/include/functions_reports.php @@ -1004,6 +1004,21 @@ function reports_get_report_types($template=false, $not_editor=false) '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'),