Merge branch 'ent-12253-informe-de-vulnerabilidades' into 'develop'
Ent 12253 Informe de vulnerabilidades See merge request artica/pandorafms!6686
This commit is contained in:
commit
8b6a4733cf
|
@ -922,22 +922,25 @@ $tableAdvancedAgent->data['safe_operation'][] = html_print_label_input_block(
|
|||
)
|
||||
);
|
||||
|
||||
$tableAdvancedAgent->data['vul_scan_enabled'][] = html_print_label_input_block(
|
||||
__('Vulnerability scanning'),
|
||||
html_print_select(
|
||||
[
|
||||
0 => __('Disabled'),
|
||||
1 => __('Enabled'),
|
||||
2 => __('Use global settings'),
|
||||
],
|
||||
'vul_scan_enabled',
|
||||
$vul_scan_enabled,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true
|
||||
)
|
||||
);
|
||||
if (enterprise_installed() === true) {
|
||||
$tableAdvancedAgent->data['vul_scan_enabled'][] = html_print_label_input_block(
|
||||
__('Vulnerability scanning'),
|
||||
html_print_select(
|
||||
[
|
||||
0 => __('Disabled'),
|
||||
1 => __('Enabled'),
|
||||
2 => __('Use global settings'),
|
||||
],
|
||||
'vul_scan_enabled',
|
||||
$vul_scan_enabled,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
ui_toggle(
|
||||
html_print_table($tableAdvancedAgent, true),
|
||||
|
|
|
@ -1086,6 +1086,50 @@ 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);
|
||||
$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;
|
||||
|
||||
case 'vuls_info_agent':
|
||||
$idAgent = $item['id_agent'];
|
||||
$es = json_decode($item['external_source'], true);
|
||||
$vul_package = $es['vul_package'];
|
||||
$vul_severity = $es['vul_severity'];
|
||||
$vul_ac = $es['vul_ac'];
|
||||
$vul_pr = $es['vul_pr'];
|
||||
$vul_ui = $es['vul_ui'];
|
||||
$vul_av = (empty($es['vul_av']) === true) ? 'all' : $es['vul_av'];
|
||||
break;
|
||||
|
||||
case 'top_n_agents_vuls':
|
||||
$group = $item['id_group'];
|
||||
$recursion = $item['recursion'];
|
||||
$top_n_value = (empty($item['top_n_value']) === true) ? 10 : $item['top_n_value'];
|
||||
break;
|
||||
|
||||
case 'top_n_vuls_count':
|
||||
$group = $item['id_group'];
|
||||
$recursion = $item['recursion'];
|
||||
$top_n_value = (empty($item['top_n_value']) === true) ? 10 : $item['top_n_value'];
|
||||
break;
|
||||
|
||||
default:
|
||||
// It's not possible.
|
||||
break;
|
||||
|
@ -3965,6 +4009,217 @@ if (is_metaconsole() === true) {
|
|||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_secmon_status" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
echo __('Secmon status');
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_select(
|
||||
[
|
||||
'all' => __('All'),
|
||||
'critical' => __('Critical'),
|
||||
'warning' => __('Warning'),
|
||||
],
|
||||
'secmon_status',
|
||||
$secmon_status,
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_security_hardening_score" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
echo __('Security hardening score');
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_select(
|
||||
[
|
||||
'all' => __('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',
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_vulnerabilities_status" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
echo __('Vulnerabilities status');
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_select(
|
||||
[
|
||||
'all' => __('All'),
|
||||
'crit' => __('Critical'),
|
||||
'warn' => __('Warning'),
|
||||
],
|
||||
'vulnerabilities_status',
|
||||
$vulnerabilities_status,
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_vulnerabilities_packages" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
echo __('Package').ui_print_help_tip(__('Select a agent for load his packages.'), true);
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_select(
|
||||
[
|
||||
'all' => __('All'),
|
||||
],
|
||||
'vul_package',
|
||||
$vul_package,
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_vulnerabilities_severity" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
echo __('Severity');
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_select(
|
||||
[
|
||||
'all' => __('All'),
|
||||
'high' => __('High'),
|
||||
'low' => __('Low'),
|
||||
'none' => __('None'),
|
||||
],
|
||||
'vul_severity',
|
||||
$vul_severity,
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_vulnerabilities_ac" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
echo __('Attack Complexity');
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_select(
|
||||
[
|
||||
'all' => __('All'),
|
||||
'H' => __('High'),
|
||||
'L' => __('Low'),
|
||||
],
|
||||
'vul_ac',
|
||||
$vul_ac,
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_vulnerabilities_pr" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
echo __('Privileges Required');
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_select(
|
||||
[
|
||||
'all' => __('All'),
|
||||
'H' => __('High'),
|
||||
'L' => __('Low'),
|
||||
'N' => __('None'),
|
||||
],
|
||||
'vul_pr',
|
||||
$vul_pr,
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_vulnerabilities_ui" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
echo __('User Interaction');
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_select(
|
||||
[
|
||||
'all' => __('All'),
|
||||
'R' => __('Required'),
|
||||
'N' => __('None'),
|
||||
],
|
||||
'vul_ui',
|
||||
$vul_ui,
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_vulnerabilities_av" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
echo __('Attack vector');
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_select(
|
||||
[
|
||||
'all' => __('All'),
|
||||
'A' => __('Adjacent Network'),
|
||||
'L' => __('Local'),
|
||||
'N' => __('Network'),
|
||||
'P' => __('Physical'),
|
||||
],
|
||||
'vul_av',
|
||||
(empty($vul_av) === true) ? 'all' : $vul_av,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<tr id="row_status_check" class="datos">
|
||||
|
@ -5692,6 +5947,27 @@ $(document).ready (function () {
|
|||
return false;
|
||||
}
|
||||
break;
|
||||
case 'vuls_info_agent':
|
||||
if ($("#hidden-id_agent").val() == 0) {
|
||||
dialog_message('#message_no_agent');
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'top_n_agents_vuls':
|
||||
if ($("#text-max_items").val() == '') {
|
||||
dialog_message('#message_no_max_item');
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'top_n_vuls_count':
|
||||
if ($("#text-max_items").val() == '') {
|
||||
dialog_message('#message_no_max_item');
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -5846,7 +6122,24 @@ $(document).ready (function () {
|
|||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'vuls_info_agent':
|
||||
if ($("#hidden-id_agent").val() == 0) {
|
||||
dialog_message('#message_no_agent');
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 'top_n_agents_vuls':
|
||||
if ($("#text-max_items").val() == '') {
|
||||
dialog_message('#message_no_max_item');
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 'top_n_vuls_count':
|
||||
if ($("#text-max_items").val() == '') {
|
||||
dialog_message('#message_no_max_item');
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -6903,6 +7196,15 @@ 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();
|
||||
$("#row_vulnerabilities_packages").hide();
|
||||
$("#row_vulnerabilities_severity").hide();
|
||||
$("#row_vulnerabilities_ac").hide();
|
||||
$("#row_vulnerabilities_pr").hide();
|
||||
$("#row_vulnerabilities_ui").hide();
|
||||
$("#row_vulnerabilities_av").hide();
|
||||
|
||||
// SLA list default state.
|
||||
$("#sla_list").hide();
|
||||
|
@ -7803,6 +8105,50 @@ function chooseType() {
|
|||
$("#row_group").show();
|
||||
$('#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();
|
||||
$("#row_secmon_status").show();
|
||||
$("#row_security_hardening_score").show();
|
||||
$("#row_vulnerabilities_status").show();
|
||||
break;
|
||||
|
||||
case 'vuls_info_agent':
|
||||
$("#row_agent").show();
|
||||
$("#row_vulnerabilities_packages").show();
|
||||
$("#row_vulnerabilities_severity").show();
|
||||
$("#row_vulnerabilities_ac").show();
|
||||
$("#row_vulnerabilities_pr").show();
|
||||
$("#row_vulnerabilities_ui").show();
|
||||
$("#row_vulnerabilities_av").show();
|
||||
updatePackages();
|
||||
$('#row_agent input[type=text]').change(function(e) {
|
||||
updatePackages();
|
||||
});
|
||||
break;
|
||||
|
||||
case 'top_n_agents_vuls':
|
||||
$("#row_group").show();
|
||||
$("#row_max_items").show();
|
||||
break;
|
||||
|
||||
case 'top_n_vuls_count':
|
||||
$("#row_group").show();
|
||||
$("#row_max_items").show();
|
||||
break;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
|
@ -8045,6 +8391,46 @@ function control_period_range() {
|
|||
}, 800);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function updateSelect(element, fields, selected) {
|
||||
if (typeof fields === "object") {
|
||||
$(element).find("select").empty();
|
||||
$(element).find(".select2-container .select2-selection__rendered").empty();
|
||||
Object.keys(fields).forEach(function(key) {
|
||||
if (key === selected) {
|
||||
$(element).find(".select2-container .select2-selection__rendered").append(`${fields[key]}`);
|
||||
$(element).find("select").append(`<option value="${key}" selected>${fields[key]}</option>`);
|
||||
} else {
|
||||
$(element).find("select").append(`<option value="${key}">${fields[key]}</option>`);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function updatePackages() {
|
||||
let id_agent = $('#hidden-id_agent').val();
|
||||
let server_id = $('#hidden-server_id').val();
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "<?php echo ui_get_full_url('ajax.php'); ?>",
|
||||
data: {
|
||||
page: "<?php echo ENTERPRISE_DIR.'/include/ajax/vulnerabilities.ajax'; ?>",
|
||||
action: "updatePackages",
|
||||
id_agent: id_agent,
|
||||
server_id: server_id,
|
||||
},
|
||||
success: function(data) {
|
||||
const json = JSON.parse(data);
|
||||
if (json.success) {
|
||||
updateSelect("#row_vulnerabilities_packages", json.data, '<?php echo $vul_package; ?>');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$('[id^=period], #combo_graph_options, #combo_sla_sort_options').next().css('z-index', 0);
|
||||
|
||||
|
|
|
@ -2046,6 +2046,56 @@ 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');
|
||||
$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;
|
||||
|
||||
case 'vuls_info_agent':
|
||||
$values['id_agent'] = get_parameter('id_agent');
|
||||
$es['server_id'] = get_parameter('server_id');
|
||||
$es['vul_package'] = get_parameter('vul_package');
|
||||
$es['vul_severity'] = get_parameter('vul_severity');
|
||||
$es['vul_ac'] = get_parameter('vul_ac');
|
||||
$es['vul_pr'] = get_parameter('vul_pr');
|
||||
$es['vul_ui'] = get_parameter('vul_ui');
|
||||
$es['vul_av'] = get_parameter('vul_av');
|
||||
$values['external_source'] = json_encode($es);
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'top_n_agents_vuls':
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
$values['top_n_value'] = get_parameter('max_items');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'top_n_vuls_count':
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
$values['top_n_value'] = get_parameter('max_items');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
$values['period'] = get_parameter('period');
|
||||
$values['top_n'] = get_parameter(
|
||||
|
@ -2979,6 +3029,56 @@ 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');
|
||||
$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;
|
||||
|
||||
case 'vuls_info_agent':
|
||||
$values['id_agent'] = get_parameter('id_agent');
|
||||
$es['server_id'] = get_parameter('server_id');
|
||||
$es['vul_package'] = get_parameter('vul_package');
|
||||
$es['vul_severity'] = get_parameter('vul_severity');
|
||||
$es['vul_ac'] = get_parameter('vul_ac');
|
||||
$es['vul_pr'] = get_parameter('vul_pr');
|
||||
$es['vul_ui'] = get_parameter('vul_ui');
|
||||
$es['vul_av'] = get_parameter('vul_av');
|
||||
$values['external_source'] = json_encode($es);
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'top_n_agents_vuls':
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
$values['top_n_value'] = get_parameter('max_items');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'top_n_vuls_count':
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
$values['top_n_value'] = get_parameter('max_items');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
$values['period'] = get_parameter('period');
|
||||
$values['top_n'] = get_parameter(
|
||||
|
|
|
@ -1024,6 +1024,62 @@ 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,
|
||||
$content,
|
||||
$type
|
||||
);
|
||||
break;
|
||||
|
||||
case 'vuls_info_agent':
|
||||
$report['contents'][] = reporting_vuls_info_agent(
|
||||
$report,
|
||||
$content,
|
||||
$type
|
||||
);
|
||||
break;
|
||||
|
||||
case 'top_n_agents_vuls':
|
||||
$report['contents'][] = reporting_top_n_agents_vuls(
|
||||
$report,
|
||||
$content,
|
||||
$type
|
||||
);
|
||||
break;
|
||||
|
||||
case 'top_n_vuls_count':
|
||||
$report['contents'][] = reporting_top_n_vuls_count(
|
||||
$report,
|
||||
$content,
|
||||
$type
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
|
|
|
@ -507,6 +507,34 @@ function reporting_html_print_report($report, $mini=false, $report_info=1, $cust
|
|||
case 'evolution':
|
||||
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;
|
||||
|
||||
case 'vuls_info_agent':
|
||||
reporting_html_vuls_info_agent($table, $item);
|
||||
break;
|
||||
|
||||
case 'top_n_agents_vuls':
|
||||
reporting_html_top_n_agents_vuls($table, $item);
|
||||
break;
|
||||
|
||||
case 'top_n_vuls_count':
|
||||
reporting_html_top_n_vuls_count($table, $item);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($item['type'] == 'agent_module') {
|
||||
|
@ -522,6 +550,300 @@ function reporting_html_print_report($report, $mini=false, $report_info=1, $cust
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to print top vulnerabiries more common.
|
||||
*
|
||||
* @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_top_n_vuls_count($table, $item, $pdf=0)
|
||||
{
|
||||
global $config;
|
||||
$table->width = '99%';
|
||||
$table->styleTable = 'border: 0px;';
|
||||
$table->colspan[2][0] = 3;
|
||||
$table1 = new stdClass();
|
||||
$table1->headstyle = [];
|
||||
$table1->width = '99%';
|
||||
$table1->class = 'info_table';
|
||||
$table1->titleclass = 'title_table_pdf';
|
||||
$table1->rowclass[0] = '';
|
||||
$table1->head[0] = __('Vulnerability');
|
||||
$table1->head[2] = __('Total');
|
||||
|
||||
$row = 2;
|
||||
foreach ($item['data'] as $key => $vul) {
|
||||
$table1->data[$row][0] = $vul['cve_id'];
|
||||
$table1->data[$row][2] = $vul['count'];
|
||||
$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($table, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to print top agents with worst score.
|
||||
*
|
||||
* @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_top_n_agents_vuls($table, $item, $pdf=0)
|
||||
{
|
||||
global $config;
|
||||
$table->width = '99%';
|
||||
$table->styleTable = 'border: 0px;';
|
||||
$table->colspan[2][0] = 3;
|
||||
$table1 = new stdClass();
|
||||
$table1->headstyle = [];
|
||||
$table1->width = '99%';
|
||||
$table1->class = 'info_table';
|
||||
$table1->titleclass = 'title_table_pdf';
|
||||
$table1->rowclass[0] = '';
|
||||
$table1->head[0] = __('Agent');
|
||||
$table1->head[2] = __('Risk');
|
||||
|
||||
$row = 2;
|
||||
foreach ($item['data'] as $key => $agent) {
|
||||
$table1->data[$row][0] = $agent['alias'];
|
||||
$table1->data[$row][2] = $agent['score'];
|
||||
$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($table, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to print vulnerabilities of 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_info_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] = __('Name');
|
||||
$table1->head[1] = __('CVE');
|
||||
$table1->head[2] = __('Version');
|
||||
$table1->head[3] = __('Score');
|
||||
$table1->head[4] = __('Detection time');
|
||||
$table1->head[5] = __('Severity');
|
||||
$table1->head[6] = __('Version');
|
||||
$table1->head[7] = __('Attack Vector');
|
||||
$table1->head[8] = __('Attack Complexity');
|
||||
$table1->head[9] = __('Privileges Required');
|
||||
$table1->head[10] = __('User Interaction');
|
||||
$table1->head[11] = __('Scope');
|
||||
$table1->head[12] = __('Confidentiality');
|
||||
$table1->head[13] = __('Integrity');
|
||||
$table1->head[14] = __('Availability');
|
||||
|
||||
$row = 1;
|
||||
foreach ($item['data'] as $key => $vul) {
|
||||
$table1->data[$row][0] = (key_exists('name', $vul) === true) ? $vul['name'] : '';
|
||||
$table1->data[$row][1] = (key_exists('cve', $vul) === true) ? $vul['cve'] : '';
|
||||
$table1->data[$row][2] = (key_exists('version', $vul) === true) ? $vul['version'] : '';
|
||||
$table1->data[$row][3] = (key_exists('score', $vul) === true) ? $vul['score'] : '';
|
||||
$table1->data[$row][4] = (key_exists('detection_time', $vul) === true) ? $vul['detection_time'] : '';
|
||||
$table1->data[$row][5] = (key_exists('severity', $vul) === true) ? $vul['severity'] : '';
|
||||
$table1->data[$row][6] = (key_exists('CVSS', $vul) === true) ? $vul['CVSS'] : '';
|
||||
$table1->data[$row][7] = (key_exists('AV', $vul) === true) ? $vul['AV'] : '';
|
||||
$table1->data[$row][8] = (key_exists('AC', $vul) === true) ? $vul['AC'] : '';
|
||||
$table1->data[$row][9] = (key_exists('PR', $vul) === true) ? $vul['PR'] : '';
|
||||
$table1->data[$row][10] = (key_exists('UI', $vul) === true) ? $vul['UI'] : '';
|
||||
$table1->data[$row][11] = (key_exists('S', $vul) === true) ? $vul['S'] : '';
|
||||
$table1->data[$row][12] = (key_exists('C', $vul) === true) ? $vul['C'] : '';
|
||||
$table1->data[$row][13] = (key_exists('I', $vul) === true) ? $vul['I'] : '';
|
||||
$table1->data[$row][14] = (key_exists('A', $vul) === true) ? $vul['A'] : '';
|
||||
|
||||
$row++;
|
||||
}
|
||||
|
||||
$table->data[2][0] = html_print_table($table1, true);
|
||||
|
||||
if ($pdf === 1) {
|
||||
$table1->title = $item['title'];
|
||||
$table1->titleclass = 'title_table_pdf';
|
||||
$table1->titlestyle = 'text-align:left;';
|
||||
return html_print_table($table1, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
|
|
|
@ -1003,6 +1003,41 @@ function reports_get_report_types($template=false, $not_editor=false)
|
|||
'optgroup' => __('Security hardening'),
|
||||
'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'),
|
||||
];
|
||||
|
||||
$types['vuls_info_agent'] = [
|
||||
'optgroup' => __('Vulnerabilities'),
|
||||
'name' => __('Vulnerabilities of agent'),
|
||||
];
|
||||
|
||||
$types['top_n_agents_vuls'] = [
|
||||
'optgroup' => __('Vulnerabilities'),
|
||||
'name' => __('Top-N agents with more risk'),
|
||||
];
|
||||
|
||||
$types['top_n_vuls_count'] = [
|
||||
'optgroup' => __('Vulnerabilities'),
|
||||
'name' => __('Top-N common vulnerabilities'),
|
||||
];
|
||||
}
|
||||
|
||||
return $types;
|
||||
|
|
Loading…
Reference in New Issue