mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-09-18 15:57:44 +02:00
Currently scanning added
This commit is contained in:
@@ -197,11 +197,10 @@ Dashboard
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="row layout-top-spacing">
|
||||
|
||||
<div class="col-xl-6 col-lg-6 col-md-12 col-sm-12 col-12 layout-spacing">
|
||||
<div class="col-xl-4 col-lg-4 col-md-6 col-sm-12 col-12 layout-spacing">
|
||||
<div class="widget widget-table-one">
|
||||
<div class="widget-heading">
|
||||
<h6 class="">Recent Scans</h6>
|
||||
<h6 class="">Recently completed Scans</h6>
|
||||
</div>
|
||||
|
||||
<div class="widget-content">
|
||||
@@ -215,7 +214,7 @@ Dashboard
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% for item in recent_scans %}
|
||||
{% for item in recent_completed_scans %}
|
||||
<div class="transactions-list">
|
||||
<a href="{% url 'detail_scan' item.id %}">
|
||||
<div class="t-item">
|
||||
@@ -260,20 +259,58 @@ Dashboard
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-6 col-lg-6 col-md-12 col-sm-12 col-12 layout-spacing">
|
||||
<div class="col-xl-4 col-lg-4 col-md-6 col-sm-12 col-12 layout-spacing">
|
||||
<div class="widget widget-table-one">
|
||||
<div class="widget-heading">
|
||||
<h6 class="">Currently Scanning</h6>
|
||||
</div>
|
||||
|
||||
<div class="widget-content">
|
||||
{% for item in currently_scanning %}
|
||||
<div class="transactions-list">
|
||||
<a href="{% url 'detail_scan' item.id %}">
|
||||
<div class="t-item">
|
||||
<div class="t-company-name">
|
||||
<div class="t-icon">
|
||||
<div class="icon">
|
||||
{% if item.scan_status == 1 %}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-zap"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"></polygon></svg>
|
||||
{% elif item.scan_status == 2 %}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check-circle"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path><polyline points="22 4 12 14.01 9 11.01"></polyline></svg>
|
||||
{% else %}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-alert-circle"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="t-name">
|
||||
<h4>{{item.domain_name}}</h4>
|
||||
<p class="meta-date">{{item.last_scan_date|naturaltime}}</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="t-rate">
|
||||
<span class="shadow-none badge badge-info">{% include 'base/_items/progress_spin.html' %}Scanning</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{% empty %}
|
||||
<div class="alert alert-light-info mb-4" role="alert">
|
||||
No targets are currently being scanned.
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-4 col-lg-4 col-md-6 col-sm-12 col-12 layout-spacing">
|
||||
<div class="widget widget-table-one">
|
||||
<div class="widget-heading">
|
||||
<h6 class="">Upcoming Scans</h6>
|
||||
</div>
|
||||
|
||||
<div class="widget-content">
|
||||
{% if upcoming_scans.count == 0 %}
|
||||
<div class="alert alert-light-info mb-4" role="alert">
|
||||
No scans are currently scheduled.
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% for item in upcoming_scans %}
|
||||
{% for item in pending_scans %}
|
||||
<div class="transactions-list">
|
||||
<a href="{% url 'detail_scan' item.id %}">
|
||||
<div class="t-item">
|
||||
@@ -307,8 +344,11 @@ Dashboard
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{% empty %}
|
||||
<div class="alert alert-light-info mb-4" role="alert">
|
||||
No scans are currently scheduled.
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+12
-11
@@ -9,7 +9,7 @@ from django.contrib.auth.signals import user_logged_out, user_logged_in
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth import update_session_auth_hash
|
||||
from django.contrib.auth.forms import PasswordChangeForm
|
||||
from django.db.models import Count, Value, CharField
|
||||
from django.db.models import Count, Value, CharField, Q
|
||||
|
||||
|
||||
def index(request):
|
||||
@@ -23,25 +23,25 @@ def index(request):
|
||||
WayBackEndPoint.objects.filter(http_status__exact=200).count()
|
||||
on_going_scan_count = \
|
||||
ScanHistory.objects.filter(scan_status=1).count()
|
||||
recent_scans = ScanHistory.objects.all().order_by(
|
||||
'-last_scan_date').exclude(scan_status=-1)[:4]
|
||||
upcoming_scans = ScanHistory.objects.filter(scan_status=-1)[:4]
|
||||
recent_completed_scans = ScanHistory.objects.all().order_by(
|
||||
'-last_scan_date').filter(Q(scan_status=0) | Q(scan_status=2) | Q(scan_status=3))[:4]
|
||||
currently_scanning = ScanHistory.objects.filter(scan_status=1)[:4]
|
||||
pending_scans = ScanHistory.objects.filter(scan_status=-1)[:4]
|
||||
info_count = VulnerabilityScan.objects.filter(severity=0).count()
|
||||
low_count = VulnerabilityScan.objects.filter(severity=1).count()
|
||||
medium_count = VulnerabilityScan.objects.filter(severity=2).count()
|
||||
high_count = VulnerabilityScan.objects.filter(severity=3).count()
|
||||
critical_count = VulnerabilityScan.objects.filter(severity=4).count()
|
||||
total_vul_count = info_count + low_count + medium_count + high_count + critical_count
|
||||
total_vul_count = info_count + low_count + \
|
||||
medium_count + high_count + critical_count
|
||||
# most_vulnerable_target = Domain.objects.exclude(
|
||||
# scanhistory__scannedhost__vulnerabilityscan__severity=0).annotate(
|
||||
# num_vul=Count(
|
||||
# 'scanhistory__scannedhost__vulnerabilityscan__name',
|
||||
# distinct=True)).order_by('-num_vul')[
|
||||
# :5]
|
||||
most_vulnerable_target = Domain.objects.annotate(
|
||||
num_vul=Count(
|
||||
'scanhistory__scannedhost__vulnerabilityscan__name')).order_by('-num_vul')[
|
||||
:7]
|
||||
most_vulnerable_target = Domain.objects.annotate(num_vul=Count(
|
||||
'scanhistory__scannedhost__vulnerabilityscan__name')).order_by('-num_vul')[:7]
|
||||
most_common_vulnerability = VulnerabilityScan.objects.values("name", "severity").exclude(
|
||||
severity=0).annotate(count=Count('name')).order_by("-count")[:7]
|
||||
context = {
|
||||
@@ -53,8 +53,9 @@ def index(request):
|
||||
'alive_count': alive_count,
|
||||
'endpoint_alive_count': endpoint_alive_count,
|
||||
'on_going_scan_count': on_going_scan_count,
|
||||
'recent_scans': recent_scans,
|
||||
'upcoming_scans': upcoming_scans,
|
||||
'recent_completed_scans': recent_completed_scans,
|
||||
'pending_scans': pending_scans,
|
||||
'currently_scanning': currently_scanning,
|
||||
'info_count': info_count,
|
||||
'low_count': low_count,
|
||||
'medium_count': medium_count,
|
||||
|
||||
@@ -23,77 +23,77 @@ Scan History
|
||||
|
||||
{% block main_content %}
|
||||
<div class="col-lg-12 layout-spacing">
|
||||
<div class="col-lg-12">
|
||||
<div class="statbox widget box box-shadow">
|
||||
<div class="widget-header">
|
||||
<div class="row">
|
||||
<div class="col-xl-12 col-md-12 col-sm-12 col-12">
|
||||
<h4>Scan History</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget-content widget-content-area">
|
||||
<div class="table-responsive mb-4">
|
||||
<table id="style-2" class="table style-2 table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Serial</th>
|
||||
<th>Domain Name</th>
|
||||
<th>Scan Type</th>
|
||||
<th>Last Scanned On</th>
|
||||
<th class="text-center">Status</th>
|
||||
<th class="text-center">Result</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for scan_history in scan_history.all %}
|
||||
<tr>
|
||||
<td class="checkbox-column"> {{ scan_history.id }} </td>
|
||||
<td>{{ scan_history.domain_name }}</td>
|
||||
<td>{{ scan_history.scan_type }}</td>
|
||||
<td>{{ scan_history.last_scan_date }}</td>
|
||||
<td class="text-center">
|
||||
{% if scan_history.scan_status == -1 %}
|
||||
<span class="shadow-none badge badge-warning bs-tooltip" data-placement="top" title="Waiting for other scans to complete">{% include 'base/_items/progress_spin.html' %}Pending</span>
|
||||
{% elif scan_history.scan_status == 0 %}
|
||||
<span class="shadow-none badge badge-danger">Failed</span>
|
||||
{% elif scan_history.scan_status == 1 %}
|
||||
<span class="shadow-none badge badge-primary">{% include 'base/_items/progress_spin.html' %}Scanning</span>
|
||||
{% elif scan_history.scan_status == 2 %}
|
||||
<span class="shadow-none badge badge-success p-2">Succesful</span>
|
||||
{% elif scan_history.scan_status == 3 %}
|
||||
<span class="shadow-none badge badge-danger">Aborted</span>
|
||||
{% else %}
|
||||
<span class="shadow-none badge badge-danger">Unknown</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<a href="{% url 'detail_scan' scan_history.id %}" class="btn btn-outline-primary">View</a>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{% if scan_history.scan_status == 1 or scan_history.scan_status == -1%}
|
||||
<a onclick="stop_scan('{{ scan_history.celery_id }}')" href="#" class="bs-tooltip" data-toggle="tooltip" data-placement="top" title="" data-original-title="Stop Scan">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather table-delete feather-alert-octagon"><polygon points="7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2"></polygon><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>
|
||||
</a>
|
||||
{% endif %}
|
||||
<a onclick="delete_scan({{ scan_history.id }})" href="#" class="bs-tooltip" data-toggle="tooltip" data-placement="top" title="" data-original-title="Delete Scan {{ scan_history.domain_name }}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather table-delete feather-x-circle">
|
||||
<circle cx="12" cy="12" r="10"></circle>
|
||||
<line x1="15" y1="9" x2="9" y2="15"></line>
|
||||
<line x1="9" y1="9" x2="15" y2="15"></line>
|
||||
</svg>
|
||||
</a>
|
||||
<div class="col-lg-12">
|
||||
<div class="statbox widget box box-shadow">
|
||||
<div class="widget-header">
|
||||
<div class="row">
|
||||
<div class="col-xl-12 col-md-12 col-sm-12 col-12">
|
||||
<h4>Scan History</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget-content widget-content-area">
|
||||
<div class="table-responsive mb-4">
|
||||
<table id="style-2" class="table style-2 table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Serial</th>
|
||||
<th>Domain Name</th>
|
||||
<th>Scan Type</th>
|
||||
<th>Last Scanned On</th>
|
||||
<th class="text-center">Status</th>
|
||||
<th class="text-center">Result</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for scan_history in scan_history.all %}
|
||||
<tr>
|
||||
<td class="checkbox-column"> {{ scan_history.id }} </td>
|
||||
<td>{{ scan_history.domain_name }}</td>
|
||||
<td>{{ scan_history.scan_type }}</td>
|
||||
<td>{{ scan_history.last_scan_date }}</td>
|
||||
<td class="text-center">
|
||||
{% if scan_history.scan_status == -1 %}
|
||||
<span class="shadow-none badge badge-warning bs-tooltip" data-placement="top" title="Waiting for other scans to complete">{% include 'base/_items/progress_spin.html' %}Pending</span>
|
||||
{% elif scan_history.scan_status == 0 %}
|
||||
<span class="shadow-none badge badge-danger">Failed</span>
|
||||
{% elif scan_history.scan_status == 1 %}
|
||||
<span class="shadow-none badge badge-primary">{% include 'base/_items/progress_spin.html' %}Scanning</span>
|
||||
{% elif scan_history.scan_status == 2 %}
|
||||
<span class="shadow-none badge badge-success p-2">Succesful</span>
|
||||
{% elif scan_history.scan_status == 3 %}
|
||||
<span class="shadow-none badge badge-danger">Aborted</span>
|
||||
{% else %}
|
||||
<span class="shadow-none badge badge-danger">Unknown</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<a href="{% url 'detail_scan' scan_history.id %}" class="btn btn-outline-primary">View</a>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{% if scan_history.scan_status == 1 or scan_history.scan_status == -1%}
|
||||
<a onclick="stop_scan('{{ scan_history.celery_id }}')" href="#" class="bs-tooltip" data-toggle="tooltip" data-placement="top" title="" data-original-title="Stop Scan">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather table-delete feather-alert-octagon"><polygon points="7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2"></polygon><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>
|
||||
</a>
|
||||
{% endif %}
|
||||
<a onclick="delete_scan({{ scan_history.id }})" href="#" class="bs-tooltip" data-toggle="tooltip" data-placement="top" title="" data-original-title="Delete Scan {{ scan_history.domain_name }}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather table-delete feather-x-circle">
|
||||
<circle cx="12" cy="12" r="10"></circle>
|
||||
<line x1="15" y1="9" x2="9" y2="15"></line>
|
||||
<line x1="9" y1="9" x2="15" y2="15"></line>
|
||||
</svg>
|
||||
</a>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock main_content %}
|
||||
|
||||
@@ -107,23 +107,23 @@ Scan History
|
||||
<script>
|
||||
// var e;
|
||||
c1 = $('#style-2').DataTable({
|
||||
headerCallback:function(e, a, t, n, s) {
|
||||
e.getElementsByTagName("th")[0].innerHTML='<label class="new-control new-checkbox checkbox-outline-info m-auto">\n<input type="checkbox" class="new-control-input chk-parent select-customers-info" id="customer-all-info">\n<span class="new-control-indicator"></span><span style="visibility:hidden">c</span>\n</label>'
|
||||
},
|
||||
columnDefs:[ {
|
||||
targets:0, width:"30px", className:"", orderable:!1, render:function(e, a, t, n) {
|
||||
return'<label class="new-control new-checkbox checkbox-outline-info m-auto">\n<input type="checkbox" class="new-control-input child-chk select-customers-info" id="customer-all-info">\n<span class="new-control-indicator"></span><span style="visibility:hidden">c</span>\n</label>'
|
||||
}
|
||||
}],
|
||||
"oLanguage": {
|
||||
"oPaginate": { "sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>', "sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>' },
|
||||
"sInfo": "Showing page _PAGE_ of _PAGES_",
|
||||
"sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
|
||||
"sSearchPlaceholder": "Search...",
|
||||
"sLengthMenu": "Results : _MENU_",
|
||||
},
|
||||
"lengthMenu": [10, 20, 50, 100, 500, 1000],
|
||||
"pageLength": 10
|
||||
headerCallback:function(e, a, t, n, s) {
|
||||
e.getElementsByTagName("th")[0].innerHTML='<label class="new-control new-checkbox checkbox-outline-info m-auto">\n<input type="checkbox" class="new-control-input chk-parent select-customers-info" id="customer-all-info">\n<span class="new-control-indicator"></span><span style="visibility:hidden">c</span>\n</label>'
|
||||
},
|
||||
columnDefs:[ {
|
||||
targets:0, width:"30px", className:"", orderable:!1, render:function(e, a, t, n) {
|
||||
return'<label class="new-control new-checkbox checkbox-outline-info m-auto">\n<input type="checkbox" class="new-control-input child-chk select-customers-info" id="customer-all-info">\n<span class="new-control-indicator"></span><span style="visibility:hidden">c</span>\n</label>'
|
||||
}
|
||||
}],
|
||||
"oLanguage": {
|
||||
"oPaginate": { "sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>', "sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>' },
|
||||
"sInfo": "Showing page _PAGE_ of _PAGES_",
|
||||
"sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
|
||||
"sSearchPlaceholder": "Search...",
|
||||
"sLengthMenu": "Results : _MENU_",
|
||||
},
|
||||
"lengthMenu": [10, 20, 50, 100, 500, 1000],
|
||||
"pageLength": 10
|
||||
});
|
||||
multiCheck(c1);
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user