diff --git a/web/api/views.py b/web/api/views.py index 01a7d91b..37fd267e 100644 --- a/web/api/views.py +++ b/web/api/views.py @@ -649,49 +649,71 @@ class GetFileContents(APIView): req = self.request name = req.query_params.get('name') + response = {} + response['status'] = False + response['message'] = 'Invalid Query Params' + if 'nuclei_config' in req.query_params: path = "/root/.config/nuclei/config.yaml" if not os.path.exists(path): os.system('touch {}'.format(path)) + response['message'] = 'File Created!' f = open(path, "r") - return Response({'content': f.read()}) + response['status'] = True + response['content'] = f.read() + return Response(response) if 'subfinder_config' in req.query_params: path = "/root/.config/subfinder/config.yaml" if not os.path.exists(path): os.system('touch {}'.format(path)) + response['message'] = 'File Created!' f = open(path, "r") - return Response({'content': f.read()}) + response['status'] = True + response['content'] = f.read() + return Response(response) if 'naabu_config' in req.query_params: path = "/root/.config/naabu/config.yaml" if not os.path.exists(path): os.system('touch {}'.format(path)) + response['message'] = 'File Created!' f = open(path, "r") - return Response({'content': f.read()}) + response['status'] = True + response['content'] = f.read() + return Response(response) if 'theharvester_config' in req.query_params: path = "/usr/src/github/theHarvester/api-keys.yaml" if not os.path.exists(path): os.system('touch {}'.format(path)) + response['message'] = 'File Created!' f = open(path, "r") - return Response({'content': f.read()}) + response['status'] = True + response['content'] = f.read() + return Response(response) if 'amass_config' in req.query_params: path = "/root/.config/amass.ini" if not os.path.exists(path): os.system('touch {}'.format(path)) + response['message'] = 'File Created!' f = open(path, "r") - return Response({'content': f.read()}) + response['status'] = True + response['content'] = f.read() + return Response(response) if 'gf_pattern' in req.query_params: basedir = '/root/.gf' path = '/root/.gf/{}.json'.format(name) if is_safe_path(basedir, path) and os.path.exists(path): content = open(path, "r").read() + response['status'] = True + response['content'] = content else: - content = "Invalid path!" - return Response({'content': content}) + response['message'] = "Invalid path!" + response['status'] = False + return Response(response) if 'nuclei_template' in req.query_params: @@ -699,11 +721,14 @@ class GetFileContents(APIView): path = '/root/nuclei-templates/{}'.format(name) if is_safe_path(safe_dir, path) and os.path.exists(path): content = open(path.format(name), "r").read() + response['status'] = True + response['content'] = content else: - content = 'Invalid Path!' - return Response({'content': content}) + response['message'] = 'Invalid Path!' + response['status'] = False + return Response(response) - return Response({'content': "ping-pong"}) + return Response(response) class ListTodoNotes(APIView): diff --git a/web/dashboard/templates/dashboard/index.html b/web/dashboard/templates/dashboard/index.html index cc2a633b..f4409d79 100644 --- a/web/dashboard/templates/dashboard/index.html +++ b/web/dashboard/templates/dashboard/index.html @@ -20,209 +20,209 @@ Dashboard {% block main_content %}
-
-
-
- -

Total Targets

-

{{domain_count|intcomma}}

-
-

 

-
-
-
-
-
-
-
-
-
- -

Total Subdomains

-

{{subdomain_count|intcomma}}

-
-
-

Alive Subdomains: {{alive_count|intcomma}}

-
-
-
-
-
-
-
-
- -

Total Endpoints

-

{{endpoint_count|intcomma}}

-
-
-

Alive Endpoints: {{endpoint_alive_count|intcomma}}

-
-
-
-
-
-
-
-
- -

Total Vulnerabilities

-

{{total_vul_count|intcomma}}

-
-

{{critical_count}} Critical, {{high_count}} High, {{medium_count}} Medium

-
-

{{low_count}} Low, {{info_count}} Info, {{unknown_count}} Unknown Vulnerabilities

-
-
-
-
+
+
+
+ +

Total Targets

+

{{domain_count|intcomma}}

+
+

 

+
+
+
+
+
+
+
+
+
+ +

Total Subdomains

+

{{subdomain_count|intcomma}}

+
+
+

Alive Subdomains: {{alive_count|intcomma}}

+
+
+
+
+
+
+
+
+ +

Total Endpoints

+

{{endpoint_count|intcomma}}

+
+
+

Alive Endpoints: {{endpoint_alive_count|intcomma}}

+
+
+
+
+
+
+
+
+ +

Total Vulnerabilities

+

{{total_vul_count|intcomma}}

+
+

{{critical_count}} Critical, {{high_count}} High, {{medium_count}} Medium

+
+

{{low_count}} Low, {{info_count}} Info, {{unknown_count}} Unknown Vulnerabilities

+
+
+
+
-
- {% include 'base/_items/widgets/vulnerability_breakdown_by_severity_chart.html' %} -
-
- {% include 'base/_items/most_vuln_target.html' with most_vuln_widget_title='Most Vulnerable Target'%} -
-
- {% include 'base/_items/most_common_vuln.html' %} -
+
+ {% include 'base/_items/widgets/vulnerability_breakdown_by_severity_chart.html' %} +
+
+ {% include 'base/_items/most_vuln_target.html' with most_vuln_widget_title='Most Vulnerable Target'%} +
+
+ {% include 'base/_items/most_common_vuln.html' %} +
- {% include 'base/_items/most_common_cve_cwe_tag_template.html' %} + {% include 'base/_items/most_common_cve_cwe_tag_template.html' %}
-
-
-
-

Most common IP Address

-
-
-
-
-
-
-
-
-
-

Most common Ports

-
-
-
-
-
-
-
-
-
-

Most common Technology

-
-
-
-
-
-
+
+
+
+

Most common IP Address

+
+
+
+
+
+
+
+
+
+

Most common Ports

+
+
+
+
+
+
+
+
+
+

Most common Technology

+
+
+
+
+
+
-
- -
-
- -
+
+ +
+
+ +
{% endblock main_content %} @@ -239,298 +239,298 @@ Dashboard var label_dates = ['{{last_7_dates.6}}', '{{last_7_dates.5}}', '{{last_7_dates.4}}', '{{last_7_dates.3}}', '{{last_7_dates.2}}', '{{last_7_dates.1}}', '{{last_7_dates.0}}']; var fill_options = { - type:"gradient", - gradient: { - type: "vertical", - shadeIntensity: 1, - inverseColors: !1, - opacityFrom: .30, - opacityTo: .05, - stops: [35, 100] - }, + type:"gradient", + gradient: { + type: "vertical", + shadeIntensity: 1, + inverseColors: !1, + opacityFrom: .30, + opacityTo: .05, + stops: [35, 100] + }, } var target_chart_option = { - chart: { - type: "area", - height: 50, - sparkline: { - enabled: !0 - } - }, - stroke: { - width: 2, - curve: "smooth" - }, - fill: { - opacity: .2 - }, - series: [{ - name: "Targets Added", - data: [{{targets_in_last_week.0}},{{targets_in_last_week.1}},{{targets_in_last_week.2}},{{targets_in_last_week.3}},{{targets_in_last_week.4}},{{targets_in_last_week.5}},{{targets_in_last_week.6}}] - }], - yaxis: { - min: 0 - }, - labels: label_dates, - colors: ['#2196f3'], - subtitle: { - text: "", - offsetX: 10, - offsetY: 35, - style: { - fontSize: "13px" - } - }, - fill: fill_options, + chart: { + type: "area", + height: 50, + sparkline: { + enabled: !0 + } + }, + stroke: { + width: 2, + curve: "smooth" + }, + fill: { + opacity: .2 + }, + series: [{ + name: "Targets Added", + data: [{{targets_in_last_week.0}},{{targets_in_last_week.1}},{{targets_in_last_week.2}},{{targets_in_last_week.3}},{{targets_in_last_week.4}},{{targets_in_last_week.5}},{{targets_in_last_week.6}}] + }], + yaxis: { + min: 0 + }, + labels: label_dates, + colors: ['#2196f3'], + subtitle: { + text: "", + offsetX: 10, + offsetY: 35, + style: { + fontSize: "13px" + } + }, + fill: fill_options, }; new ApexCharts(document.querySelector("#targets_chart"), target_chart_option).render(); var subdomains_chart_options = { - chart: { - type: "area", - height: 50, - sparkline: { - enabled: !0 - } - }, - stroke: { - width: 2, - curve: "smooth" - }, - fill: { - opacity: .2 - }, - series: [{ - name: "Subdomains Discovered", - data: [{{subdomains_in_last_week.0}},{{subdomains_in_last_week.1}},{{subdomains_in_last_week.2}},{{subdomains_in_last_week.3}},{{subdomains_in_last_week.4}},{{subdomains_in_last_week.5}},{{subdomains_in_last_week.6}}] - }], - yaxis: { - min: 0 - }, - labels: label_dates, - colors: ['#2196f3'], - subtitle: { - text: "", - offsetX: 10, - offsetY: 35, - style: { - fontSize: "13px" - } - }, - fill: fill_options, + chart: { + type: "area", + height: 50, + sparkline: { + enabled: !0 + } + }, + stroke: { + width: 2, + curve: "smooth" + }, + fill: { + opacity: .2 + }, + series: [{ + name: "Subdomains Discovered", + data: [{{subdomains_in_last_week.0}},{{subdomains_in_last_week.1}},{{subdomains_in_last_week.2}},{{subdomains_in_last_week.3}},{{subdomains_in_last_week.4}},{{subdomains_in_last_week.5}},{{subdomains_in_last_week.6}}] + }], + yaxis: { + min: 0 + }, + labels: label_dates, + colors: ['#2196f3'], + subtitle: { + text: "", + offsetX: 10, + offsetY: 35, + style: { + fontSize: "13px" + } + }, + fill: fill_options, }; new ApexCharts(document.querySelector("#subdomains_chart"), subdomains_chart_options).render(); var endpoint_chart_options = { - chart: { - type: "area", - height: 50, - sparkline: { - enabled: !0 - } - }, - stroke: { - width: 2, - curve: "smooth" - }, - fill: { - opacity: .2 - }, - series: [{ - name: "Endpoints Discovered", - data: [{{endpoints_in_last_week.0}},{{endpoints_in_last_week.1}},{{endpoints_in_last_week.2}},{{endpoints_in_last_week.3}},{{endpoints_in_last_week.4}},{{endpoints_in_last_week.5}},{{endpoints_in_last_week.6}}] - }], - yaxis: { - min: 0 - }, - labels: label_dates, - colors: ['#2196f3'], - subtitle: { - text: "", - offsetX: 10, - offsetY: 35, - style: { - fontSize: "13px" - } - }, - fill: fill_options, + chart: { + type: "area", + height: 50, + sparkline: { + enabled: !0 + } + }, + stroke: { + width: 2, + curve: "smooth" + }, + fill: { + opacity: .2 + }, + series: [{ + name: "Endpoints Discovered", + data: [{{endpoints_in_last_week.0}},{{endpoints_in_last_week.1}},{{endpoints_in_last_week.2}},{{endpoints_in_last_week.3}},{{endpoints_in_last_week.4}},{{endpoints_in_last_week.5}},{{endpoints_in_last_week.6}}] + }], + yaxis: { + min: 0 + }, + labels: label_dates, + colors: ['#2196f3'], + subtitle: { + text: "", + offsetX: 10, + offsetY: 35, + style: { + fontSize: "13px" + } + }, + fill: fill_options, }; new ApexCharts(document.querySelector("#endpoint_chart"), endpoint_chart_options).render(); var vuln_chart_options = { - chart: { - type: "area", - height: 50, - sparkline: { - enabled: !0 - } - }, - stroke: { - width: 2, - curve: "smooth" - }, - fill: { - opacity: .2 - }, - series: [{ - name: "Vulnerabilities Discovered", - data: [{{vulns_in_last_week.0}},{{vulns_in_last_week.1}},{{vulns_in_last_week.2}},{{vulns_in_last_week.3}},{{vulns_in_last_week.4}},{{vulns_in_last_week.5}},{{vulns_in_last_week.6}}] - }], - yaxis: { - min: 0 - }, - labels: label_dates, - colors: ['#e7515a'], - subtitle: { - text: "", - offsetX: 10, - offsetY: 35, - style: { - fontSize: "13px" - } - }, - fill: fill_options, + chart: { + type: "area", + height: 50, + sparkline: { + enabled: !0 + } + }, + stroke: { + width: 2, + curve: "smooth" + }, + fill: { + opacity: .2 + }, + series: [{ + name: "Vulnerabilities Discovered", + data: [{{vulns_in_last_week.0}},{{vulns_in_last_week.1}},{{vulns_in_last_week.2}},{{vulns_in_last_week.3}},{{vulns_in_last_week.4}},{{vulns_in_last_week.5}},{{vulns_in_last_week.6}}] + }], + yaxis: { + min: 0 + }, + labels: label_dates, + colors: ['#e7515a'], + subtitle: { + text: "", + offsetX: 10, + offsetY: 35, + style: { + fontSize: "13px" + } + }, + fill: fill_options, }; new ApexCharts(document.querySelector("#vuln_chart"), vuln_chart_options).render(); // vulnerability summary pie chart var options = { - chart: { - type: 'donut', - height: 320, - }, - colors: ['#D50000', '#F44336', '#FF6D00', '#FFD600', '#2962FF', '#03A9F4'], - dataLabels: { - enabled: false - }, - legend: { - show: !0, - position: "bottom", - horizontalAlign: "center", - verticalAlign: "middle", - floating: !1, - fontSize: "15px", - offsetX: 0, - offsetY: 7 - }, - plotOptions: { - pie: { - donut: { - size: '70%', - background: 'transparent', - labels: { - show: true, - name: { - show: true, - fontSize: '29px', - fontFamily: 'Nunito, sans-serif', - color: undefined, - offsetY: -10 - }, - value: { - show: true, - fontSize: '26px', - fontFamily: 'Nunito, sans-serif', - color: '20', - offsetY: 16, - formatter: function (val) { - return val - } - }, - total: { - show: true, - showAlways: true, - label: 'Total', - color: '#888ea8', - formatter: function (w) { - return w.globals.seriesTotals.reduce( function(a, b) { - return a + b - }, 0) - } - } - } - } - } - }, - series: [{{critical_count}}, {{high_count}}, {{medium_count}}, {{low_count}}, {{info_count}}, {{unknown_count}}], - labels: ['Critical', 'High', 'Medium', 'Low', 'Info', 'Unknown'], - responsive: [{ - breakpoint: 1599, - options: { - chart: { - height: 240 - }, - legend: { - position: 'bottom' - } - }, - breakpoint: 1439, - options: { - chart: { - width: '250px', - height: '390px' - }, - }, - }], + chart: { + type: 'donut', + height: 320, + }, + colors: ['#D50000', '#F44336', '#FF6D00', '#FFD600', '#2962FF', '#03A9F4'], + dataLabels: { + enabled: false + }, + legend: { + show: !0, + position: "bottom", + horizontalAlign: "center", + verticalAlign: "middle", + floating: !1, + fontSize: "15px", + offsetX: 0, + offsetY: 7 + }, + plotOptions: { + pie: { + donut: { + size: '70%', + background: 'transparent', + labels: { + show: true, + name: { + show: true, + fontSize: '29px', + fontFamily: 'Nunito, sans-serif', + color: undefined, + offsetY: -10 + }, + value: { + show: true, + fontSize: '26px', + fontFamily: 'Nunito, sans-serif', + color: '20', + offsetY: 16, + formatter: function (val) { + return val + } + }, + total: { + show: true, + showAlways: true, + label: 'Total', + color: '#888ea8', + formatter: function (w) { + return w.globals.seriesTotals.reduce( function(a, b) { + return a + b + }, 0) + } + } + } + } + } + }, + series: [{{critical_count}}, {{high_count}}, {{medium_count}}, {{low_count}}, {{info_count}}, {{unknown_count}}], + labels: ['Critical', 'High', 'Medium', 'Low', 'Info', 'Unknown'], + responsive: [{ + breakpoint: 1599, + options: { + chart: { + height: 240 + }, + legend: { + position: 'bottom' + } + }, + breakpoint: 1439, + options: { + chart: { + width: '250px', + height: '390px' + }, + }, + }], } var chart = new ApexCharts( - document.querySelector("#vulnerability-pie-chart"), - options + document.querySelector("#vulnerability-pie-chart"), + options ); chart.render() var options = { - series: [{ - name: "Ip is Used By Subdomains", - data: [{{most_used_ip.6.count}}, {{most_used_ip.5.count}}, {{most_used_ip.4.count}}, {{most_used_ip.3.count}}, {{most_used_ip.2.count}}, {{most_used_ip.1.count}}, {{most_used_ip.0.count}}] - }], - chart: { - type: 'bar', - height: 350 - }, - plotOptions: { - bar: { - borderRadius: 4, - horizontal: true, - } - }, - dataLabels: { - enabled: false - }, - xaxis: { - categories: ['{{most_used_ip.6.address}}', '{{most_used_ip.5.address}}', '{{most_used_ip.4.address}}', '{{most_used_ip.3.address}}', '{{most_used_ip.2.address}}', '{{most_used_ip.1.address}}', '{{most_used_ip.0.address}}'], - } + series: [{ + name: "Ip is Used By Subdomains", + data: [{{most_used_ip.6.count}}, {{most_used_ip.5.count}}, {{most_used_ip.4.count}}, {{most_used_ip.3.count}}, {{most_used_ip.2.count}}, {{most_used_ip.1.count}}, {{most_used_ip.0.count}}] + }], + chart: { + type: 'bar', + height: 350 + }, + plotOptions: { + bar: { + borderRadius: 4, + horizontal: true, + } + }, + dataLabels: { + enabled: false + }, + xaxis: { + categories: ['{{most_used_ip.6.address}}', '{{most_used_ip.5.address}}', '{{most_used_ip.4.address}}', '{{most_used_ip.3.address}}', '{{most_used_ip.2.address}}', '{{most_used_ip.1.address}}', '{{most_used_ip.0.address}}'], + } }; var chart = new ApexCharts(document.querySelector("#most_common_ip_chart"), options); chart.render(); var options = { - series: [{ - name: "Ports used by IPs", - data: [{{most_used_port.6.count}}, {{most_used_port.5.count}}, {{most_used_port.4.count}}, {{most_used_port.3.count}}, {{most_used_port.2.count}}, {{most_used_port.1.count}}, {{most_used_port.0.count}}] - }], - chart: { - type: 'bar', - height: 350 - }, - plotOptions: { - bar: { - borderRadius: 4, - horizontal: true, - } - }, - dataLabels: { - enabled: false - }, - xaxis: { - categories: ['{{most_used_port.6.number}}/{{most_used_port.6.service_name}}', '{{most_used_port.5.number}}/{{most_used_port.5.service_name}}', '{{most_used_port.4.number}}/{{most_used_port.4.service_name}}', '{{most_used_port.3.number}}/{{most_used_port.3.service_name}}', '{{most_used_port.2.number}}/{{most_used_port.2.service_name}}', '{{most_used_port.1.number}}/{{most_used_port.1.service_name}}', '{{most_used_port.0.number}}/{{most_used_port.0.service_name}}'], - } + series: [{ + name: "Ports used by IPs", + data: [{{most_used_port.6.count}}, {{most_used_port.5.count}}, {{most_used_port.4.count}}, {{most_used_port.3.count}}, {{most_used_port.2.count}}, {{most_used_port.1.count}}, {{most_used_port.0.count}}] + }], + chart: { + type: 'bar', + height: 350 + }, + plotOptions: { + bar: { + borderRadius: 4, + horizontal: true, + } + }, + dataLabels: { + enabled: false + }, + xaxis: { + categories: ['{{most_used_port.6.number}}/{{most_used_port.6.service_name}}', '{{most_used_port.5.number}}/{{most_used_port.5.service_name}}', '{{most_used_port.4.number}}/{{most_used_port.4.service_name}}', '{{most_used_port.3.number}}/{{most_used_port.3.service_name}}', '{{most_used_port.2.number}}/{{most_used_port.2.service_name}}', '{{most_used_port.1.number}}/{{most_used_port.1.service_name}}', '{{most_used_port.0.number}}/{{most_used_port.0.service_name}}'], + } }; var chart = new ApexCharts(document.querySelector("#most_common_port_chart"), options); @@ -538,26 +538,26 @@ chart.render(); var options = { - series: [{ - name: "Tech used by Subdomains", - data: [{{most_used_tech.6.count}}, {{most_used_tech.5.count}}, {{most_used_tech.4.count}}, {{most_used_tech.3.count}}, {{most_used_tech.2.count}}, {{most_used_tech.1.count}}, {{most_used_tech.0.count}}] - }], - chart: { - type: 'bar', - height: 350 - }, - plotOptions: { - bar: { - borderRadius: 4, - horizontal: true, - } - }, - dataLabels: { - enabled: false - }, - xaxis: { - categories: ['{{most_used_tech.6.name}}', '{{most_used_tech.5.name}}', '{{most_used_tech.4.name}}', '{{most_used_tech.3.name}}', '{{most_used_tech.2.name}}', '{{most_used_tech.1.name}}', '{{most_used_tech.0.name}}'], - } + series: [{ + name: "Tech used by Subdomains", + data: [{{most_used_tech.6.count}}, {{most_used_tech.5.count}}, {{most_used_tech.4.count}}, {{most_used_tech.3.count}}, {{most_used_tech.2.count}}, {{most_used_tech.1.count}}, {{most_used_tech.0.count}}] + }], + chart: { + type: 'bar', + height: 350 + }, + plotOptions: { + bar: { + borderRadius: 4, + horizontal: true, + } + }, + dataLabels: { + enabled: false + }, + xaxis: { + categories: ['{{most_used_tech.6.name}}', '{{most_used_tech.5.name}}', '{{most_used_tech.4.name}}', '{{most_used_tech.3.name}}', '{{most_used_tech.2.name}}', '{{most_used_tech.1.name}}', '{{most_used_tech.0.name}}'], + } }; var chart = new ApexCharts(document.querySelector("#most_common_tech_chart"), options); diff --git a/web/scanEngine/static/scanEngine/js/custom_tools.js b/web/scanEngine/static/scanEngine/js/custom_tools.js index 15f3b4e4..14e00d7c 100644 --- a/web/scanEngine/static/scanEngine/js/custom_tools.js +++ b/web/scanEngine/static/scanEngine/js/custom_tools.js @@ -1,16 +1,25 @@ function load_gf_template(pattern_name){ - $('#modal-size').removeClass('modal-xl'); - $('#modal-size').addClass('modal-lg'); - $('.modal-title').html(`GF Pattern ` + htmlEncode(pattern_name)); - $('#exampleModal').modal('show'); - $('.modal-text').empty(); - $('.modal-text').append(``); + Swal.fire({ + title: `Fetching GF template ${pattern_name}...`, + }); + swal.showLoading(); + $.getJSON(`/api/getFileContents?gf_pattern&name=${pattern_name}&format=json`, function(data) { - $('#modal-loader').empty(); + console.log(data); + swal.close(); + $('#modal_title').empty(); + $('#modal-content').empty(); + $("#modal-footer").empty(); + + $('#modal_title').html(`GF Pattern ` + htmlEncode(pattern_name)); + $('#modal-content').append(`
${htmlEncode(data['content'])}
`); + $('#modal_dialog').modal('show'); + }).fail(function(){ - $('#modal-loader').empty(); - $("#modal-content").append(`

Error loading GF Pattern

`); + swal.fire("Error!", 'Error loading gf pattern!', "error", { + button: "Okay", + }); }); }