diff --git a/startScan/api/views.py b/startScan/api/views.py index 1222bdf2..ca06b9bd 100644 --- a/startScan/api/views.py +++ b/startScan/api/views.py @@ -71,12 +71,19 @@ class ListSubdomains(APIView): scan_id = req.query_params.get('scan_id') ip_address = req.query_params.get('ip_address') port = req.query_params.get('port') + tech = req.query_params.get('tech') if scan_id and ip_address: subdomain = Subdomain.objects.filter( ip_addresses__address=ip_address).filter( scan_history__id=scan_id) serializer = SubdomainSerializer(subdomain, many=True) return Response({"subdomains": serializer.data}) + elif scan_id and tech: + subdomain = Subdomain.objects.filter( + technologies__name=tech).filter( + scan_history__id=scan_id) + serializer = SubdomainSerializer(subdomain, many=True) + return Response({"subdomains": serializer.data}) elif scan_id and port: subdomain = Subdomain.objects.filter( ip_addresses__in=IpAddress.objects.filter( diff --git a/startScan/templates/startScan/detail_scan.html b/startScan/templates/startScan/detail_scan.html index 5e9c8cd8..fef4d07b 100644 --- a/startScan/templates/startScan/detail_scan.html +++ b/startScan/templates/startScan/detail_scan.html @@ -165,7 +165,7 @@ Detailed Scan Results for {{history.domain.name}}
-
+ -
+
IP Addresses
@@ -258,7 +258,7 @@ Detailed Scan Results for {{history.domain.name}}
-
+
Discovered Ports
@@ -272,7 +272,7 @@ Detailed Scan Results for {{history.domain.name}}
-
+
Discovered Technologies
diff --git a/static/custom/custom.js b/static/custom/custom.js index dc2a32e8..cdb9b064 100644 --- a/static/custom/custom.js +++ b/static/custom/custom.js @@ -782,7 +782,7 @@ function get_ip_details(ip_address, scan_id){ $('#tabsModal').modal('show'); $.getJSON(`../api/queryPorts/?scan_id=${scan_id}&ip_address=${ip_address}&format=json`, function(data) { $('#modal-open-port-text').empty(); - $('#modal-open-port-text').append(`

IP Addresses ${ip_address} has ${data['ports'].length} Open Port`); + $('#modal-open-port-text').append(`

IP Addresses ${ip_address} has ${data['ports'].length} Open Ports`); $('#modal-open-ports-count').html(`${data['ports'].length}  `); for (port in data['ports']){ port_obj = data['ports'][port]; @@ -794,7 +794,7 @@ function get_ip_details(ip_address, scan_id){ // query subdomains $.getJSON(`../api/querySubdomains/?scan_id=${scan_id}&ip_address=${ip_address}&format=json`, function(data) { $('#modal-subdomain-text').empty(); - $('#modal-subdomain-text').append(`

${data['subdomains'].length} subdomain are associated with IP Address: ${ip_address}

`); + $('#modal-subdomain-text').append(`

${data['subdomains'].length} subdomain associated with IP Address: ${ip_address}

`); $('#modal-subdomain-count').html(`${data['subdomains'].length}  `); for (subdomain in data['subdomains']){ subdomain_obj = data['subdomains'][subdomain]; @@ -828,7 +828,7 @@ function get_port_details(port, scan_id){ $('#tabsModal').modal('show'); $.getJSON(`../api/queryIps/?scan_id=${scan_id}&port=${port}&format=json`, function(data) { $('#modal-ip-text').empty(); - $('#modal-ip-text').append(`

${data['ips'].length} IP Addresses have Port ${port} Open`); + $('#modal-ip-text').append(`

${data['ips'].length} IP Addresses has Port ${port} Open`); $('#modal-ip-count').html(`${data['ips'].length}  `); for (ip in data['ips']){ ip_obj = data['ips'][ip]; @@ -839,7 +839,6 @@ function get_port_details(port, scan_id){ // query subdomains $.getJSON(`../api/querySubdomains/?scan_id=${scan_id}&port=${port}&format=json`, function(data) { - $('#subdomain-spinner').empty(); $('#modal-subdomain-text').empty(); $('#modal-subdomain-text').append(`

${data['subdomains'].length} Subdomain has Port ${port} Open`); $('#modal-subdomain-count').html(`${data['subdomains'].length}  `); @@ -856,12 +855,33 @@ function get_port_details(port, scan_id){ }); } +function get_tech_details(tech, scan_id){ + // render tab modal + $('.modal-title').html('Details for Technology: ' + tech); + $('#exampleModal').modal('show'); + $('.modal-text').empty(); + // query subdomains + $.getJSON(`../api/querySubdomains/?scan_id=${scan_id}&tech=${tech}&format=json`, function(data) { + $('.modal-text').append(`${data['subdomains'].length} Subdomains using ${tech}`); + $('.modal-text').append(`

    `); + for (subdomain in data['subdomains']){ + subdomain_obj = data['subdomains'][subdomain]; + if (subdomain_obj['http_url']) { + $("#subdomain-ul").append(`
  • ${subdomain_obj['name']}
  • `) + } + else { + $("#subdomain-ul").append(`
  • ${subdomain_obj['name']}
  • `) + } + } + }); +} + function get_technologies(scan_id){ $.getJSON(`../api/queryTechnologies/?scan_id=${scan_id}&format=json`, function(data) { $('#technologies-count').empty(); for (var val in data['technologies']){ tech = data['technologies'][val] - $("#technologies").append(`${tech['name']}`); + $("#technologies").append(`${tech['name']}`); } $('#technologies-count').html(`${data['technologies'].length}`); $("body").tooltip({ selector: '[data-toggle=tooltip]' }); diff --git a/templates/base/_items/modal.html b/templates/base/_items/modal.html index 5cabfeb2..fe0ca05a 100644 --- a/templates/base/_items/modal.html +++ b/templates/base/_items/modal.html @@ -8,7 +8,7 @@