diff --git a/dashboard/templates/dashboard/index.html b/dashboard/templates/dashboard/index.html index 46d87375..aa72134a 100644 --- a/dashboard/templates/dashboard/index.html +++ b/dashboard/templates/dashboard/index.html @@ -23,12 +23,13 @@ Dashboard
-
+

{{domain_count|intcomma}} Targets

+
View all targets
@@ -42,9 +43,10 @@ Dashboard
- +

{{subdomain_count|intcomma}} Subdomains Discovered

+ Total Alive Subdomains: {{alive_count|intcomma}}
View all Subdomains
@@ -61,7 +63,8 @@ Dashboard

{{total_vul_count|intcomma}} Vulnerabilities Discovered

- View all vulnerabilities + {{critical_count}} Critical, {{high_count}} High, {{medium_count}} Medium Severity
+ View all vulnerabilities
@@ -70,89 +73,21 @@ Dashboard
-
-
-
- {% if not domain_count %} - - {% endif %} - -
-
-
-
-
- -
-
-

{{domain_count|intcomma}}

-
Total Targets
-
- +
+
+
+
+ +
+

{{scan_count|intcomma}} Scans Performed

+ Currently Scanning {{currently_scanning.count}}
+ View all scan history +
+
+
+
- -
-
-
-
- -
-
-

{{subdomain_count|intcomma}}

-
Subdomains Discovered
-
-
- Total Alive Subdomains: {{alive_count|intcomma}} -
- View all Subdomains -
-
-
- -
-
-
-
- -
-
-

{{endpoint_count|intcomma}}

-
Endpoints Discovered
-
-
- Total Alive endpoints: {{endpoint_alive_count|intcomma}} -
- View all endpoints -
-
-
- -
-
-
-
- -
-
-

{{scan_count}}

-
Total Scans
-
-
- Currently Scanning {{currently_scanning.count}} -
- View all scan history -
-
-
-
@@ -247,7 +182,7 @@ Dashboard
{% endif %}
-
+
@@ -742,5 +677,48 @@ var vuln_chart_options = { var chart = new ApexCharts(document.querySelector("#vuln_chart"), vuln_chart_options); chart.render(); +var scan_chart_options = { + chart: { + id: 'sparkline1', + type: 'area', + height: 80, + sparkline: { + enabled: true + }, + }, + stroke: { + curve: 'smooth', + width: 2, + }, + series: [{ + name: 'Scans Initiated', + data: [{{scans_in_last_week.0}},{{scans_in_last_week.1}},{{scans_in_last_week.2}},{{scans_in_last_week.3}},{{scans_in_last_week.4}},{{scans_in_last_week.5}},{{scans_in_last_week.6}}] + }], + labels: ['1', '2', '3', '4', '5', '6', '7'], + yaxis: { + min: 0 + }, + colors: ['#8dbf42'], + tooltip: { + x: { + show: false, + } + }, + fill: { + type:"gradient", + gradient: { + type: "vertical", + shadeIntensity: 1, + inverseColors: !1, + opacityFrom: .40, + opacityTo: .05, + stops: [45, 100] + } + }, +} + +var chart = new ApexCharts(document.querySelector("#scan_chart"), scan_chart_options); +chart.render(); + {% endblock page_level_script %} diff --git a/dashboard/views.py b/dashboard/views.py index 275033ef..c2c98b82 100644 --- a/dashboard/views.py +++ b/dashboard/views.py @@ -64,6 +64,10 @@ def index(request): discovered_date__gte=last_week).annotate( date=TruncDay('discovered_date')).values("date").annotate( count=Count('id')).order_by("-date") + count_scans_by_date = ScanHistory.objects.filter( + last_scan_date__gte=last_week).annotate( + date=TruncDay('last_scan_date')).values("date").annotate( + count=Count('id')).order_by("-date") last_7_dates = [(timezone.now() - timedelta(days=i)).date() for i in range(0, 7)] @@ -94,6 +98,15 @@ def index(request): vulns_in_last_week.append(0) vulns_in_last_week.reverse() + scans_in_last_week = [] + for date in last_7_dates: + _scan = count_scans_by_date.filter(date=date) + if _scan: + scans_in_last_week.append(_scan[0]['count']) + else: + scans_in_last_week.append(0) + scans_in_last_week.reverse() + context = { 'dashboard_data_active': 'true', 'domain_count': domain_count, @@ -118,6 +131,7 @@ def index(request): 'targets_in_last_week': targets_in_last_week, 'subdomains_in_last_week': subdomains_in_last_week, 'vulns_in_last_week': vulns_in_last_week, + 'scans_in_last_week': scans_in_last_week, } return render(request, 'dashboard/index.html', context)