#12253 added reports vulnerabilities

This commit is contained in:
Daniel Cebrian 2023-11-21 10:31:06 +01:00
parent 5104d706f6
commit bb9cd81244
5 changed files with 177 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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

View File

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