Vulnerability Added

This commit is contained in:
Yogesh Ojha
2022-04-24 22:57:30 +05:30
parent 374067cc48
commit 82daa9575e
3 changed files with 87 additions and 3 deletions
+6 -1
View File
@@ -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')
+33 -2
View File
@@ -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;
}
+48
View File
@@ -86,6 +86,54 @@
</div>
<span id="info_title">* {{scan_object.get_info_vulnerability_count}} Informational Vulnerabilities Identified</span>
</article>
<article class="">
<h3>Listed below are the vulnerabilities identified on <span id="primary-title">{{scan_object.domain.name}}</span></h3>
<div class="table">
<div class="row header">
<div class="cell" style="width: 15%">
Severity
</div>
<div class="cell" style="width: 55%">
Vulnerability Name
</div>
<div class="cell" style="width: 19%;">
Times Identified
</div>
</div>
{% for vulnerability in vulnerabilities %}
<div class="row">
{% if vulnerability.severity == 0 %}
<div class="cell info-cell" style="width: 15%">
<span class="severity-title-box">Informational</span>
{% elif vulnerability.severity == 1 %}
<div class="cell low" style="width: 15%">
<span class="severity-title-box">Low</span>
{% elif vulnerability.severity == 2 %}
<div class="cell medium" style="width: 15%">
<span class="severity-title-box">Medium</span>
{% elif vulnerability.severity == 3 %}
<div class="cell high" style="width: 15%">
<span class="severity-title-box">High</span>
{% elif vulnerability.severity == 4 %}
<div class="cell critical" style="width: 15%">
<span class="severity-title-box">Critical</span>
{% endif %}
</div>
<div class="cell" style="width: 55%">
{{vulnerability.name}}
</div>
<div class="cell" style="float: right; width: 19%;">
{{vulnerability.count}}
</div>
</div>
{% endfor %}
</div>
</article>
<article class="">
</article>
</body>
</html>