Added ignore info vulnerability in report preview/download

This commit is contained in:
Yogesh Ojha
2023-05-09 09:23:51 +05:30
parent ebba9154d8
commit f40abb71cf
2 changed files with 38 additions and 0 deletions
@@ -213,6 +213,12 @@ Quick Scan History
<select class="form-control" id="report_type_select" name="report_type">
</select>
</div>
<div class="form-group mb-4">
<div class="form-check" id="report_info_vuln_div">
<input type="checkbox" class="form-check-input" id="report_ignore_info_vuln" checked="">
<label class="form-check-label" for="report_ignore_info_vuln">Ignore Informational Vulnerabilities</label>
</div>
</div>
<a id='generateReportButton' href="#" class="btn btn-primary float-end m-2">Download Report</a>
<a id='previewReportButton' href="#" class="btn btn-secondary float-end m-2">Preview Report</a>
</div>
@@ -464,6 +470,18 @@ Quick Scan History
}
}
// select option listener for report_type_select
var report_type = document.getElementById("report_type_select");
report_type.addEventListener("change", function() {
if(report_type.value == "recon")
{
$("#report_info_vuln_div").hide();
}
else{
$("#report_info_vuln_div").show();
}
});
function initiate_report(id, is_subdomain_scan, is_vulnerability_scan, domain_name) {
$('#generateReportModal').modal('show');
$('#report_alert_message').empty();
@@ -507,6 +525,9 @@ Quick Scan History
function preview_report(id, domain_name){
var report_type = $("#report_type_select option:selected").val();
var url = `/scan/create_report/${id}?report_type=${report_type}`;
if ($('#report_ignore_info_vuln').is(":checked")) {
url += `&ignore_info_vuln`
}
$('#generateReportModal').modal('hide');
window.open(url, '_blank').focus();
}
@@ -514,6 +535,9 @@ Quick Scan History
function generate_report(id, domain_name) {
var report_type = $("#report_type_select option:selected").val();
var url = `/scan/create_report/${id}?report_type=${report_type}&download`;
if ($('#report_ignore_info_vuln').is(":checked")) {
url += `&ignore_info_vuln`
}
$('#generateReportModal').modal('hide');
swal.queue([{
title: 'Generating Report!',
+14
View File
@@ -817,6 +817,7 @@ def create_report(request, id):
secondary_color = '#212121'
# get report type
report_type = request.GET['report_type'] if 'report_type' in request.GET else 'full'
is_ignore_info_vuln = True if 'ignore_info_vuln' in request.GET else False
if report_type == 'recon':
show_recon = True
show_vuln = False
@@ -836,6 +837,11 @@ def create_report(request, id):
Vulnerability.objects
.filter(scan_history=scan)
.order_by('-severity')
) if not is_ignore_info_vuln else (
Vulnerability.objects
.filter(scan_history=scan)
.exclude(severity=0)
.order_by('-severity')
)
unique_vulns = (
Vulnerability.objects
@@ -843,7 +849,15 @@ def create_report(request, id):
.values("name", "severity")
.annotate(count=Count('name'))
.order_by('-severity', '-count')
) if not is_ignore_info_vuln else (
Vulnerability.objects
.filter(scan_history=scan)
.exclude(severity=0)
.values("name", "severity")
.annotate(count=Count('name'))
.order_by('-severity', '-count')
)
subdomains = (
Subdomain.objects
.filter(scan_history=scan)