From 82daa9575e04dce80490168e95bbfd64d7c29c2f Mon Sep 17 00:00:00 2001 From: Yogesh Ojha Date: Thu, 30 Sep 2021 00:17:27 +0530 Subject: [PATCH] Vulnerability Added --- web/startScan/views.py | 7 ++++- web/static/reports/report.css | 35 +++++++++++++++++++++++-- web/templates/report/full.html | 48 ++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 3 deletions(-) diff --git a/web/startScan/views.py b/web/startScan/views.py index 4ab95bd1..e9f7c948 100644 --- a/web/startScan/views.py +++ b/web/startScan/views.py @@ -16,6 +16,7 @@ from django_celery_beat.models import PeriodicTask, IntervalSchedule, ClockedSch from django.utils import timezone from django.conf import settings from django.core import serializers +from django.db.models import Count from startScan.models import * from targetApp.models import * @@ -628,8 +629,12 @@ def delete_scans(request): def create_report(request, id): scan_object = ScanHistory.objects.get(id=id) + vulnerabilities = Vulnerability.objects.values("name", "severity").annotate(count=Count('name')).order_by('-severity', '-count') template = get_template('report/full.html') - data = {'scan_object': scan_object} + data = { + 'scan_object': scan_object, + 'vulnerabilities': vulnerabilities + } html = template.render(data) pdf = HTML(string=html).write_pdf() response = HttpResponse(pdf, content_type='application/pdf') diff --git a/web/static/reports/report.css b/web/static/reports/report.css index 1fd91232..6f4bb239 100644 --- a/web/static/reports/report.css +++ b/web/static/reports/report.css @@ -105,7 +105,6 @@ h2, h3, h4 { } h2 { - break-before: always; font-size: 28pt; string-set: heading content(); } @@ -196,7 +195,7 @@ h4 { margin-bottom: 0; padding: .25cm 0; text-align: center; - height: 100px; + height: 85px; color: #37474F; } @@ -243,3 +242,35 @@ h4 { #mini-text{ font-size: 11px; } + +.table{ + margin: 0 0 40px 0; + width: 100%; + box-shadow: 0 1px 3px rgba(0,0,0,0.2); + display: table; + border-spacing: 0 0.4em; +} + +.row{ + display: table-row; + background: #f6f6f6; +} + +.cell{ + padding: 6px 6px 6px 6px; + display: table-cell; +} + +.header{ + font-weight: 900; + color: #ffffff; + background: #ea6153; +} + +.info-cell{ + background: #42A5F5; +} + +.severity-title-box{ + color: #37474F; +} diff --git a/web/templates/report/full.html b/web/templates/report/full.html index 2352d497..ea3d9c01 100644 --- a/web/templates/report/full.html +++ b/web/templates/report/full.html @@ -86,6 +86,54 @@ * {{scan_object.get_info_vulnerability_count}} Informational Vulnerabilities Identified +
+

Listed below are the vulnerabilities identified on {{scan_object.domain.name}}

+
+ +
+
+ Severity +
+
+ Vulnerability Name +
+
+ Times Identified +
+
+ + {% for vulnerability in vulnerabilities %} +
+ {% if vulnerability.severity == 0 %} +
+ Informational + {% elif vulnerability.severity == 1 %} +
+ Low + {% elif vulnerability.severity == 2 %} +
+ Medium + {% elif vulnerability.severity == 3 %} +
+ High + {% elif vulnerability.severity == 4 %} +
+ Critical + {% endif %} +
+
+ {{vulnerability.name}} +
+
+ {{vulnerability.count}} +
+
+ {% endfor %} +
+
+
+ +