diff --git a/web/api/urls.py b/web/api/urls.py index ab6ea0ce..5901c9ae 100644 --- a/web/api/urls.py +++ b/web/api/urls.py @@ -78,10 +78,6 @@ urlpatterns = [ 'queryVulnerabilities/', ListVulnerability.as_view(), name='queryVulnerabilities'), - path( - 'queryEndpoints/', - ListEndpoints.as_view(), - name='queryEndpoints'), path( 'queryTargetsWithoutOrganization/', ListTargetsWithoutOrganization.as_view(), diff --git a/web/api/views.py b/web/api/views.py index 1ad7bd90..ac837f43 100644 --- a/web/api/views.py +++ b/web/api/views.py @@ -820,33 +820,6 @@ class ListVulnerability(APIView): return Response({'vulnerabilities': vulnerability_serializer.data}) -class ListEndpoints(APIView): - def get(self, request, format=None): - req = self.request - scan_id = req.query_params.get('scan_id') - subdomain_name = req.query_params.get('subdomain_name') - pattern = req.query_params.get('pattern') - - if scan_id: - endpoints = EndPoint.objects.filter(scan_history__id=scan_id) - else: - endpoints = EndPoint.objects.all() - - if subdomain_name: - endpoints = endpoints.filter(subdomain__name=subdomain_name) - - if pattern: - endpoints = endpoints.filter(matched_gf_patterns__icontains=pattern) - - if 'only_urls' in req.query_params: - endpoints_serializer = EndpointOnlyURLsSerializer(endpoints, many=True) - - else: - endpoints_serializer = EndpointSerializer(endpoints, many=True) - - return Response({'endpoints': endpoints_serializer.data}) - - class VisualiseData(APIView): def get(self, request, format=None): req = self.request @@ -1540,81 +1513,90 @@ class EndPointViewSet(viewsets.ModelViewSet): def get_queryset(self): req = self.request + scan_id = req.query_params.get('scan_history') - target_id = req.query_params.get('target_id') - url_query = req.query_params.get('query_param') + subdomain_id = req.query_params.get('subdomain_id') gf_tag = req.query_params.get( 'gf_tag') if 'gf_tag' in req.query_params else None if scan_id: - self.queryset = EndPoint.objects.filter( + endpoints_queryset = EndPoint.objects.filter( scan_history__id=scan_id ).distinct() - elif target_id: - self.queryset = EndPoint.objects.filter( + endpoints_queryset = EndPoint.objects.filter( target_domain__id=target_id).distinct() else: - self.queryset = EndPoint.objects.distinct() + endpoints_queryset = EndPoint.objects.distinct() if url_query: - self.queryset = EndPoint.objects.filter( + endpoints_queryset = endpoints_queryset.filter( Q(target_domain__name=url_query)).distinct() if gf_tag: - self.queryset = self.queryset.filter(matched_gf_patterns__icontains=gf_tag) + endpoints_queryset = endpoints_queryset.filter(matched_gf_patterns__icontains=gf_tag) + + if subdomain_id: + endpoints_queryset = endpoints_queryset.filter(subdomain__id=subdomain_id) + + if 'only_urls' in req.query_params: + self.serializer_class = EndpointOnlyURLsSerializer + + self.queryset = endpoints_queryset return self.queryset def filter_queryset(self, qs): qs = self.queryset.filter() + print(qs) search_value = self.request.GET.get(u'search[value]', None) _order_col = self.request.GET.get(u'order[0][column]', None) _order_direction = self.request.GET.get(u'order[0][dir]', None) - order_col = 'content_length' - if _order_col == '1': - order_col = 'http_url' - elif _order_col == '2': - order_col = 'http_status' - elif _order_col == '3': - order_col = 'page_title' - elif _order_col == '4': - order_col = 'matched_gf_patterns' - elif _order_col == '5': - order_col = 'content_type' - elif _order_col == '6': + if search_value or _order_col or _order_direction: order_col = 'content_length' - elif _order_col == '7': - order_col = 'technologies' - elif _order_col == '8': - order_col = 'webserver' - elif _order_col == '9': - order_col = 'response_time' - if _order_direction == 'desc': - order_col = '-{}'.format(order_col) - # if the search query is separated by = means, it is a specific lookup - # divide the search query into two half and lookup - if '=' in search_value or '&' in search_value or '|' in search_value or '>' in search_value or '<' in search_value or '!' in search_value: - if '&' in search_value: - complex_query = search_value.split('&') - for query in complex_query: - if query.strip(): - qs = qs & self.special_lookup(query.strip()) - elif '|' in search_value: - qs = Subdomain.objects.none() - complex_query = search_value.split('|') - for query in complex_query: - if query.strip(): - qs = self.special_lookup(query.strip()) | qs + if _order_col == '1': + order_col = 'http_url' + elif _order_col == '2': + order_col = 'http_status' + elif _order_col == '3': + order_col = 'page_title' + elif _order_col == '4': + order_col = 'matched_gf_patterns' + elif _order_col == '5': + order_col = 'content_type' + elif _order_col == '6': + order_col = 'content_length' + elif _order_col == '7': + order_col = 'technologies' + elif _order_col == '8': + order_col = 'webserver' + elif _order_col == '9': + order_col = 'response_time' + if _order_direction == 'desc': + order_col = '-{}'.format(order_col) + # if the search query is separated by = means, it is a specific lookup + # divide the search query into two half and lookup + if '=' in search_value or '&' in search_value or '|' in search_value or '>' in search_value or '<' in search_value or '!' in search_value: + if '&' in search_value: + complex_query = search_value.split('&') + for query in complex_query: + if query.strip(): + qs = qs & self.special_lookup(query.strip()) + elif '|' in search_value: + qs = Subdomain.objects.none() + complex_query = search_value.split('|') + for query in complex_query: + if query.strip(): + qs = self.special_lookup(query.strip()) | qs + else: + qs = self.special_lookup(search_value) else: - qs = self.special_lookup(search_value) - else: - qs = self.general_lookup(search_value) - return qs.order_by(order_col) - + qs = self.general_lookup(search_value) + return qs.order_by(order_col) + return qs def general_lookup(self, search_value): qs = self.queryset.filter( Q(http_url__icontains=search_value) | diff --git a/web/startScan/static/startScan/js/detail_scan.js b/web/startScan/static/startScan/js/detail_scan.js index 4d6c2e0f..2027a513 100644 --- a/web/startScan/static/startScan/js/detail_scan.js +++ b/web/startScan/static/startScan/js/detail_scan.js @@ -1,1654 +1,1659 @@ function get_ips_from_port(port_number, history_id){ - document.getElementById("detailScanModalLabel").innerHTML='IPs with port ' + port_number + ' OPEN'; - var ip_badge = ''; - fetch('../port/ip/'+port_number+'/'+history_id+'/') - .then(response => response.json()) - .then(data => render_ips(data)); + document.getElementById("detailScanModalLabel").innerHTML='IPs with port ' + port_number + ' OPEN'; + var ip_badge = ''; + fetch('../port/ip/'+port_number+'/'+history_id+'/') + .then(response => response.json()) + .then(data => render_ips(data)); } function get_ports_for_ip(ip, history_id){ - console.log(ip, history_id); - document.getElementById("detailScanModalLabel").innerHTML='Open Ports identified for ' + ip; - var port_badge = ''; - fetch('../ip/ports/'+ip+'/'+history_id+'/') - .then(response => response.json()) - .then(data => render_ports(data)); + console.log(ip, history_id); + document.getElementById("detailScanModalLabel").innerHTML='Open Ports identified for ' + ip; + var port_badge = ''; + fetch('../ip/ports/'+ip+'/'+history_id+'/') + .then(response => response.json()) + .then(data => render_ports(data)); } function render_ports(data) { - var port_badge = '' - ip_address_content = document.getElementById("detailScanModalContent"); - Object.entries(JSON.parse(data)).forEach(([key, value]) => { - badge_color = value[3] ? 'danger' : 'info'; - title = value[3] ? 'Uncommon Port - ' + value[2] : value[2]; - port_badge += `${value[0]}/${value[1]}` - }); - ip_address_content.innerHTML = port_badge; - $('.bs-tooltip').tooltip(); + var port_badge = '' + ip_address_content = document.getElementById("detailScanModalContent"); + Object.entries(JSON.parse(data)).forEach(([key, value]) => { + badge_color = value[3] ? 'danger' : 'info'; + title = value[3] ? 'Uncommon Port - ' + value[2] : value[2]; + port_badge += `${value[0]}/${value[1]}` + }); + ip_address_content.innerHTML = port_badge; + $('.bs-tooltip').tooltip(); } function render_ips(data) { - var ip_badge = '' - content = document.getElementById("detailScanModalContent"); - Object.entries(JSON.parse(data)).forEach(([key, value]) => { - badge_color = value[1] ? 'warning' : 'info'; - title = value[1] ? 'CDN IP Address' : ''; - ip_badge += `${value[0]}` - }); - content.innerHTML = ip_badge; - $('.bs-tooltip').tooltip(); + var ip_badge = '' + content = document.getElementById("detailScanModalContent"); + Object.entries(JSON.parse(data)).forEach(([key, value]) => { + badge_color = value[1] ? 'warning' : 'info'; + title = value[1] ? 'CDN IP Address' : ''; + ip_badge += `${value[0]}` + }); + content.innerHTML = ip_badge; + $('.bs-tooltip').tooltip(); } function get_endpoints(scan_history_id, gf_tags){ - if (scan_history_id) { - var lookup_url = `/api/listEndpoints/?scan_history=${scan_history_id}&format=datatables`; - } - else{ - var lookup_url = `/api/listEndpoints/?&format=datatables`; - } - if (gf_tags){ - lookup_url += `&gf_tag=${gf_tags}` - } - var endpoint_table = $('#endpoint_results').DataTable({ - "destroy": true, - "processing": true, - "oLanguage": { - "oPaginate": { "sPrevious": '', "sNext": '' }, - "sInfo": "Showing page _PAGE_ of _PAGES_", - "sLengthMenu": "Results : _MENU_", - "sProcessing": "Processing... Please wait..." - }, - "dom": "<'row'<'col-lg-12 col-md-12 col-12 mb-2'l>>" + - "<'row'<'col'tr>>" + - "<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>", - "stripeClasses": [], - "lengthMenu": [100, 200, 300, 500, 1000], - "pageLength": 100, - 'serverSide': true, - "ajax": lookup_url, - "order": [[ 6, "desc" ]], - "columns": [ - {'data': 'id'}, - {'data': 'http_url'}, - {'data': 'http_status'}, - {'data': 'page_title'}, - {'data': 'matched_gf_patterns'}, - {'data': 'content_type'}, - {'data': 'content_length', 'searchable': false}, - {'data': 'technologies'}, - {'data': 'webserver'}, - {'data': 'response_time', 'searchable': false}, - ], - "columnDefs": [ - { - "targets": [ 0 ], - "visible": false, - "searchable": false, - }, - { - "targets": [ 7, 8 ], - "visible": false, - "searchable": true, - }, - { - "render": function ( data, type, row ) { - var tech_badge = ''; - var web_server = ''; - if (row['technologies']){ - tech_badge = `` + parse_technology(row['technologies'], "primary", outline=true); - } + if (scan_history_id) { + var lookup_url = `/api/listEndpoints/?scan_history=${scan_history_id}&format=datatables`; + } + else{ + var lookup_url = `/api/listEndpoints/?&format=datatables`; + } + if (gf_tags){ + lookup_url += `&gf_tag=${gf_tags}` + } + var endpoint_table = $('#endpoint_results').DataTable({ + "destroy": true, + "processing": true, + "oLanguage": { + "oPaginate": { "sPrevious": '', "sNext": '' }, + "sInfo": "Showing page _PAGE_ of _PAGES_", + "sLengthMenu": "Results : _MENU_", + "sProcessing": "Processing... Please wait..." + }, + "dom": "<'row'<'col-lg-12 col-md-12 col-12 mb-2'l>>" + + "<'row'<'col'tr>>" + + "<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>", + "stripeClasses": [], + "lengthMenu": [100, 200, 300, 500, 1000], + "pageLength": 100, + 'serverSide': true, + "ajax": lookup_url, + "order": [[ 6, "desc" ]], + "columns": [ + {'data': 'id'}, + {'data': 'http_url'}, + {'data': 'http_status'}, + {'data': 'page_title'}, + {'data': 'matched_gf_patterns'}, + {'data': 'content_type'}, + {'data': 'content_length', 'searchable': false}, + {'data': 'technologies'}, + {'data': 'webserver'}, + {'data': 'response_time', 'searchable': false}, + ], + "columnDefs": [ + { + "targets": [ 0 ], + "visible": false, + "searchable": false, + }, + { + "targets": [ 7, 8 ], + "visible": false, + "searchable": true, + }, + { + "render": function ( data, type, row ) { + var tech_badge = ''; + var web_server = ''; + if (row['technologies']){ + tech_badge = `` + parse_technology(row['technologies'], "primary", outline=true); + } - if (row['webserver']) { - web_server = `${row['webserver']}`; - } + if (row['webserver']) { + web_server = `${row['webserver']}`; + } - var url = split_into_lines(data, 70); - var action_icons = ` -
- `; - tech_badge += web_server; + var url = split_into_lines(data, 70); + var action_icons = ` + + `; + tech_badge += web_server; - return `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]; - badge_color = port_obj['is_uncommon'] ? 'danger' : 'info'; - $("#modal_content_port").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]; + badge_color = port_obj['is_uncommon'] ? 'danger' : 'info'; + $("#modal_content_port").append(`
${data['subdomains'].length} Subdomains are associated with IP ${ip_address}`); - $('#modal-subdomain-count').html(`${data['subdomains'].length} `); - for (subdomain in data['subdomains']){ - subdomain_obj = data['subdomains'][subdomain]; - badge_color = subdomain_obj['http_status'] >= 400 ? 'danger' : ''; - li_id = get_randid(); - if (subdomain_obj['http_url']) { - $("#modal_content_subdomain").append(`
${data['subdomains'].length} Subdomains are associated with IP ${ip_address}`); + $('#modal-subdomain-count').html(`${data['subdomains'].length} `); + for (subdomain in data['subdomains']){ + subdomain_obj = data['subdomains'][subdomain]; + badge_color = subdomain_obj['http_status'] >= 400 ? 'danger' : ''; + li_id = get_randid(); + if (subdomain_obj['http_url']) { + $("#modal_content_subdomain").append(`
${data['ips'].length} IP Addresses have Port ${port} Open`); - $('#modal-ip-count').html(`${data['ips'].length} `); - for (ip in data['ips']){ - ip_obj = data['ips'][ip]; - text_color = ip_obj['is_cdn'] ? 'warning' : ''; - $("#modal_ip_ul").append(`
${data['ips'].length} IP Addresses have Port ${port} Open`); + $('#modal-ip-count').html(`${data['ips'].length} `); + for (ip in data['ips']){ + ip_obj = data['ips'][ip]; + text_color = ip_obj['is_cdn'] ? 'warning' : ''; + $("#modal_ip_ul").append(`
${data['subdomains'].length} Subdomains have Port ${port} Open`); - $('#modal-subdomain-count').html(`${data['subdomains'].length} `); - for (subdomain in data['subdomains']){ - subdomain_obj = data['subdomains'][subdomain]; - badge_color = subdomain_obj['http_status'] >= 400 ? 'danger' : ''; - li_id = get_randid(); - if (subdomain_obj['http_url']) { - $("#modal_subdomain_ul").append(`
${data['subdomains'].length} Subdomains have Port ${port} Open`); + $('#modal-subdomain-count').html(`${data['subdomains'].length} `); + for (subdomain in data['subdomains']){ + subdomain_obj = data['subdomains'][subdomain]; + badge_color = subdomain_obj['http_status'] >= 400 ? 'danger' : ''; + li_id = get_randid(); + if (subdomain_obj['http_url']) { + $("#modal_subdomain_ul").append(`
No Users discovered.
`); - }); + $.getJSON(`/api/queryOsintUsers/?scan_id=${scan_id}&format=json`, function(data) { + $('#osint-users-count').empty(); + for (var val in data['users']){ + user = data['users'][val] + $("#osint-users").append(`${user['author']}`); + } + $('#osint-users-count').html(`${data['users'].length}`); + $("body").tooltip({ selector: '[data-toggle=tooltip]' }); + }).fail(function(){ + $('#osint-users-count').empty(); + $("#osint-users").append(`No Users discovered.
`); + }); } function get_ports(scan_id){ - url = `/api/queryPorts/?scan_id=${scan_id}&format=json`; - $.getJSON(url, function(data) { - $('#ports-count').empty(); - for (var val in data['ports']){ - port = data['ports'][val] - badge_color = port['is_uncommon'] ? 'danger' : 'primary'; - $("#ports").append(`${port['number']}/${port['service_name']}`); - } - $('#ports-count').html(`${data['ports'].length}`); - $("body").tooltip({ selector: '[data-toggle=tooltip]' }); - }); + url = `/api/queryPorts/?scan_id=${scan_id}&format=json`; + $.getJSON(url, function(data) { + $('#ports-count').empty(); + for (var val in data['ports']){ + port = data['ports'][val] + badge_color = port['is_uncommon'] ? 'danger' : 'primary'; + $("#ports").append(`${port['number']}/${port['service_name']}`); + } + $('#ports-count').html(`${data['ports'].length}`); + $("body").tooltip({ selector: '[data-toggle=tooltip]' }); + }); } function get_screenshot(scan_id){ - var port_array = []; - var service_array = []; - var tech_array = []; - var ip_array = []; - var gridzyElement = document.querySelector('.gridzy'); - gridzyElement.classList.add('gridzySkinBlank'); - gridzyElement.setAttribute('data-gridzy-layout', 'waterfall'); - gridzyElement.setAttribute('data-gridzy-spaceBetween', 10); - gridzyElement.setAttribute('data-gridzy-desiredwidth', 350); - gridzyElement.setAttribute('data-gridzySearchField', "#screenshot-search"); - var interesting_badge = `Interesting`; - $.getJSON(`/api/listSubdomains/?scan_id=${scan_id}&no_page&only_screenshot`, function(data) { - $("#screenshot-loader").remove(); - $("#filter-screenshot").show(); - for (var subdomain in data) { - var figure = document.createElement('figure'); - var link = document.createElement('a'); - // return `Error loading Vulnerabilities Summary
`); - }); + if (scan_id) { + url = `/api/queryVulnerabilities/?scan_id=${scan_id}&severity=${severity}&subdomain_name=${subdomain_name}&format=json`; + } + else{ + url = `/api/queryVulnerabilities/?severity=${severity}&subdomain_name=${subdomain_name}&format=json`; + } + switch (severity) { + case 0: + severity_title = 'Informational' + break; + case 1: + severity_title = 'Low' + break; + case 2: + severity_title = 'Medium' + break; + case 3: + severity_title = 'High' + break; + case 4: + severity_title = 'Critical' + break; + default: + severity_title = '' + } + $('.modal-title').html(`${severity_title} Severity Vulnerabilities`); + $('#modal_dialog').modal('show'); + $('.modal-text').empty(); $('#modal-footer').empty(); + $('.modal-text').append(`Error loading Vulnerabilities Summary
`); + }); } function get_endpoint_modal(scan_id, subdomain_id){ - if (scan_id) { - url = `/api/listEndpoints/?scan_id=${scan_id}&subdomain_id=${subdomain_id}&format=json` - } - else{ - url = `/api/listEndpoints/?subdomain_id=${subdomain_id}&format=json` - } - $('.modal-title').html(`Endpoints Summary`); - $('#modal_dialog').modal('show'); - $('.modal-text').empty(); $('#modal-footer').empty(); - $('.modal-text').append(`Error loading Vulnerabilities Summary
`); - }); + + $('#xl-modal-title').empty(); + $('#xl-modal-content').empty(); + $('#xl-modal-footer').empty(); + + if (scan_id) { + url = `/api/listEndpoints/?scan_id=${scan_id}&subdomain_id=${subdomain_id}&format=json` + } + else{ + url = `/api/listEndpoints/?subdomain_id=${subdomain_id}&format=json` + } + + Swal.fire({ + title: 'Fetching Endpoints...' + }); + swal.showLoading(); + + fetch(url, { + method: 'GET', + credentials: "same-origin", + headers: { + "X-CSRFToken": getCookie("csrftoken"), + 'Content-Type': 'application/json' + }, + }).then(response => response.json()).then(function(response) { + console.log(response); + swal.close(); + $('#xl-modal_title').html(`${response['count']} Endpoints`); + }); + $('#modal_xl_scroll_dialog').modal('show'); + $("body").tooltip({ + selector: '[data-toggle=tooltip]' + }); + } function get_http_badge(http_status){ - switch (true) { - case (http_status >= 400): - badge_color = 'danger' - break; - case (http_status >= 300): - badge_color = 'warning' - break; - case (http_status >= 200): - badge_color = 'success' - break; - default: - badge_color = 'danger' - } - if (http_status) { - badge = `${http_status}`; - return badge - } + switch (true) { + case (http_status >= 400): + badge_color = 'danger' + break; + case (http_status >= 300): + badge_color = 'warning' + break; + case (http_status >= 200): + badge_color = 'success' + break; + default: + badge_color = 'danger' + } + if (http_status) { + badge = `${http_status}`; + return badge + } } function add_todo_for_scanhistory_modal(scan_history_id){ - $("#todoTitle").val(''); - $("#todoDescription").val(''); + $("#todoTitle").val(''); + $("#todoDescription").val(''); - $('#addTaskModal').modal('show'); - subdomain_dropdown = document.getElementById('todoSubdomainDropdown'); - $.getJSON(`/api/querySubdomains?scan_id=${scan_history_id}&no_lookup_interesting&format=json`, function(data) { - document.querySelector("#selectedSubdomainCount").innerHTML = data['subdomains'].length + ' Subdomains'; - for (var subdomain in data['subdomains']){ - subdomain_obj = data['subdomains'][subdomain]; - var option = document.createElement('option'); - option.value = subdomain_obj['id']; - option.innerHTML = subdomain_obj['name']; - subdomain_dropdown.appendChild(option); - } - }); + $('#addTaskModal').modal('show'); + subdomain_dropdown = document.getElementById('todoSubdomainDropdown'); + $.getJSON(`/api/querySubdomains?scan_id=${scan_history_id}&no_lookup_interesting&format=json`, function(data) { + document.querySelector("#selectedSubdomainCount").innerHTML = data['subdomains'].length + ' Subdomains'; + for (var subdomain in data['subdomains']){ + subdomain_obj = data['subdomains'][subdomain]; + var option = document.createElement('option'); + option.value = subdomain_obj['id']; + option.innerHTML = subdomain_obj['name']; + subdomain_dropdown.appendChild(option); + } + }); } // listen to save todo event $(".add-scan-history-todo").click(function(){ - var title = document.getElementById('todoTitle').value; + var title = document.getElementById('todoTitle').value; - var description = document.getElementById('todoDescription').value; + var description = document.getElementById('todoDescription').value; - data = { - 'title': title, - 'description': description - } + data = { + 'title': title, + 'description': description + } - scan_id = parseInt(document.getElementById('summary_identifier_val').value); - data['scan_history'] = scan_id; + scan_id = parseInt(document.getElementById('summary_identifier_val').value); + data['scan_history'] = scan_id; - if ($("#todoSubdomainDropdown").val() != 'Choose Subdomain...') { - data['subdomain'] = parseInt($("#todoSubdomainDropdown").val()); - } + if ($("#todoSubdomainDropdown").val() != 'Choose Subdomain...') { + data['subdomain'] = parseInt($("#todoSubdomainDropdown").val()); + } - fetch('../../recon_note/add_note', { - method: 'post', - headers: { - "X-CSRFToken": getCookie("csrftoken") - }, - body: JSON.stringify(data) - }).then(res => res.json()) - .then(function (response) { - Snackbar.show({ - text: 'Todo Added.', - pos: 'top-right', - duration: 1500, - }); - $('#addTaskModal').modal('hide'); - get_recon_notes(null, scan_id); - }); + fetch('../../recon_note/add_note', { + method: 'post', + headers: { + "X-CSRFToken": getCookie("csrftoken") + }, + body: JSON.stringify(data) + }).then(res => res.json()) + .then(function (response) { + Snackbar.show({ + text: 'Todo Added.', + pos: 'top-right', + duration: 1500, + }); + $('#addTaskModal').modal('hide'); + get_recon_notes(null, scan_id); + }); }); function add_task_for_subdomain(subdomain_id, subdomain_name){ - $('#todo-modal-subdomain-name').html(subdomain_name); - $("#subdomainTodoTitle").val(''); - $("#subdomainTodoDescription").val(''); + $('#todo-modal-subdomain-name').html(subdomain_name); + $("#subdomainTodoTitle").val(''); + $("#subdomainTodoDescription").val(''); - $('#add-todo-subdomain-submit-button').attr('onClick', `add_task_for_subdomain_handler(${subdomain_id});`); + $('#add-todo-subdomain-submit-button').attr('onClick', `add_task_for_subdomain_handler(${subdomain_id});`); - $('#addSubdomainTaskModal').modal('show'); + $('#addSubdomainTaskModal').modal('show'); } function add_task_for_subdomain_handler(subdomain_id){ - var title = document.getElementById('subdomainTodoTitle').value; - var description = document.getElementById('subdomainTodoDescription').value; + var title = document.getElementById('subdomainTodoTitle').value; + var description = document.getElementById('subdomainTodoDescription').value; - data = { - 'title': title, - 'description': description - } + data = { + 'title': title, + 'description': description + } - scan_id = 0; - if (document.getElementById("summary_identifier_val")) { - scan_id = parseInt(document.getElementById('summary_identifier_val').value); - } + scan_id = 0; + if (document.getElementById("summary_identifier_val")) { + scan_id = parseInt(document.getElementById('summary_identifier_val').value); + } - data['scan_history'] = scan_id; - data['subdomain'] = subdomain_id; + data['scan_history'] = scan_id; + data['subdomain'] = subdomain_id; - fetch('../../recon_note/add_note', { - method: 'post', - headers: { - "X-CSRFToken": getCookie("csrftoken") - }, - body: JSON.stringify(data) - }).then(res => res.json()) - .then(function (response) { - Snackbar.show({ - text: 'Todo Added.', - pos: 'top-right', - duration: 1500, - }); - $('#subdomain_scan_results').DataTable().ajax.reload(); - $('#addSubdomainTaskModal').modal('hide'); - }); + fetch('../../recon_note/add_note', { + method: 'post', + headers: { + "X-CSRFToken": getCookie("csrftoken") + }, + body: JSON.stringify(data) + }).then(res => res.json()) + .then(function (response) { + Snackbar.show({ + text: 'Todo Added.', + pos: 'top-right', + duration: 1500, + }); + $('#subdomain_scan_results').DataTable().ajax.reload(); + $('#addSubdomainTaskModal').modal('hide'); + }); } function download_subdomains(scan_id, domain_name){ - Swal.fire({ - title: 'Querying Subdomains...' - }); - swal.showLoading(); - count = ``; - if (scan_id) { - url = `/api/querySubdomains?format=json&no_lookup_interesting&scan_id=${scan_id}`; - } - else{ - url = `/api/querySubdomains?format=json&no_lookup_interesting`; - } - if (domain_name) { - $('.modal-title').html(count + ' Subdomains for : ' + domain_name + ''); - } - else{ - $('.modal-title').html(count + ' Subdomains'); - } - $('.modal-text').empty(); $('#modal-footer').empty(); - $('.modal-text').append(``); - // query subdomains - $.getJSON(url, function(data) { - swal.close(); - if (data['subdomains'].length) { - $('#modal_dialog').modal('show'); - $('.modal_count').html(data['subdomains'].length); - $('#modal-content').empty(); - subdomains = ''; - $('#modal-content').append(``); - for (subdomain in data['subdomains']){ - subdomain_obj = data['subdomains'][subdomain]; - subdomains += subdomain_obj['name'] + '\n' - } - $('#all_subdomains_text_area').append(subdomains); - $("#modal-footer").empty(); - $("#modal-footer").append(` Download Subdomains as txt`); - $("#modal-footer").append(` Copy Subdomains`); - } - else{ - swal.fire("No Subdomains", "Could not find any subdomains.", "warning", { - button: "Okay", - }); - } - }).fail(function(){ - swal.fire("No Subdomains", "Could not find any subdomains.", "warning", { - button: "Okay", - }); - }); + Swal.fire({ + title: 'Querying Subdomains...' + }); + swal.showLoading(); + count = ``; + if (scan_id) { + url = `/api/querySubdomains?format=json&no_lookup_interesting&scan_id=${scan_id}`; + } + else{ + url = `/api/querySubdomains?format=json&no_lookup_interesting`; + } + if (domain_name) { + $('.modal-title').html(count + ' Subdomains for : ' + domain_name + ''); + } + else{ + $('.modal-title').html(count + ' Subdomains'); + } + $('.modal-text').empty(); $('#modal-footer').empty(); + $('.modal-text').append(``); + // query subdomains + $.getJSON(url, function(data) { + swal.close(); + if (data['subdomains'].length) { + $('#modal_dialog').modal('show'); + $('.modal_count').html(data['subdomains'].length); + $('#modal-content').empty(); + subdomains = ''; + $('#modal-content').append(``); + for (subdomain in data['subdomains']){ + subdomain_obj = data['subdomains'][subdomain]; + subdomains += subdomain_obj['name'] + '\n' + } + $('#all_subdomains_text_area').append(subdomains); + $("#modal-footer").empty(); + $("#modal-footer").append(` Download Subdomains as txt`); + $("#modal-footer").append(` Copy Subdomains`); + } + else{ + swal.fire("No Subdomains", "Could not find any subdomains.", "warning", { + button: "Okay", + }); + } + }).fail(function(){ + swal.fire("No Subdomains", "Could not find any subdomains.", "warning", { + button: "Okay", + }); + }); } function download_interesting_subdomains(scan_id, domain_name){ - Swal.fire({ - title: 'Querying Interesting Subdomains...' - }); - swal.showLoading(); - count = ``; - if (scan_id) { - url = `/api/listInterestingSubdomains/?scan_id=${scan_id}&format=json&only_subdomains&no_page`; - } - else{ - url = `/api/listInterestingSubdomains/?format=json&only_subdomains&no_page`; - } - if (domain_name) { - $('.modal-title').html( count + ' Interesting Subdomains for : ' + domain_name + ''); - } - else{ - $('.modal-title').html( count + ' Interesting Subdomains'); - } - $('.modal-text').empty(); $('#modal-footer').empty(); - // query subdomains - $.getJSON(url, function(data) { - swal.close() - if (data.length) { - $('#modal_dialog').modal('show'); - $('.modal_count').html(data.length); - $('#modal-content').empty(); - subdomains = ''; - $('#modal-content').append(``); - for (subdomain in data){ - subdomains += data[subdomain]['name'] + '\n' - } - $('#interesting_subdomains_text_area').append(subdomains); - $("#modal-footer").empty(); - $("#modal-footer").append(` Download Subdomains as txt`); - $("#modal-footer").append(` Copy Subdomains`); - } - else{ - swal.fire("No Interesting Subdomains", "Could not find any interesting subdomains.", "warning", { - button: "Okay", - }); - } + Swal.fire({ + title: 'Querying Interesting Subdomains...' + }); + swal.showLoading(); + count = ``; + if (scan_id) { + url = `/api/listInterestingSubdomains/?scan_id=${scan_id}&format=json&only_subdomains&no_page`; + } + else{ + url = `/api/listInterestingSubdomains/?format=json&only_subdomains&no_page`; + } + if (domain_name) { + $('.modal-title').html( count + ' Interesting Subdomains for : ' + domain_name + ''); + } + else{ + $('.modal-title').html( count + ' Interesting Subdomains'); + } + $('.modal-text').empty(); $('#modal-footer').empty(); + // query subdomains + $.getJSON(url, function(data) { + swal.close() + if (data.length) { + $('#modal_dialog').modal('show'); + $('.modal_count').html(data.length); + $('#modal-content').empty(); + subdomains = ''; + $('#modal-content').append(``); + for (subdomain in data){ + subdomains += data[subdomain]['name'] + '\n' + } + $('#interesting_subdomains_text_area').append(subdomains); + $("#modal-footer").empty(); + $("#modal-footer").append(` Download Subdomains as txt`); + $("#modal-footer").append(` Copy Subdomains`); + } + else{ + swal.fire("No Interesting Subdomains", "Could not find any interesting subdomains.", "warning", { + button: "Okay", + }); + } - }).fail(function(){ - swal.fire("No Interesting Subdomains", "Could not find any interesting subdomains.", "warning", { - button: "Okay", - }); - }); + }).fail(function(){ + swal.fire("No Interesting Subdomains", "Could not find any interesting subdomains.", "warning", { + button: "Okay", + }); + }); } function download_interesting_endpoints(scan_id, domain_name){ - Swal.fire({ - title: 'Querying Interesting Endpoints...' - }); - swal.showLoading(); - count = ``; - if (scan_id) { - url = `/api/listInterestingEndpoints/?scan_id=${scan_id}&format=json&no_page`; - } - else{ - url = `/api/listInterestingEndpoints/?format=json&no_page`; - } - if (domain_name) { - $('.modal-title').html( count + ' Interesting Endpoints for : ' + domain_name + ''); - } - else{ - $('.modal-title').html( count + ' Interesting Endpoints'); - } - $('.modal-text').empty(); $('#modal-footer').empty(); - // query subdomains - $.getJSON(url, function(data) { - swal.close(); - if (data.length) { - $('#modal_dialog').modal('show'); - $('.modal_count').html(data.length); - $('#modal-content').empty(); - endpoints = ''; - $('#modal-content').append(``); - for (endpoint in data){ - endpoints += data[endpoint]['http_url'] + '\n' - } - $('#interesting_endpoints_text_area').append(endpoints); - $("#modal-footer").empty(); - $("#modal-footer").append(` Download Endpoints as txt`); - $("#modal-footer").append(` Copy Endpoints`); - } - else{ - swal.fire("No Interesting Endpoints", "Could not find any interesting Endpoints.", "warning", { - button: "Okay", - }); - } + Swal.fire({ + title: 'Querying Interesting Endpoints...' + }); + swal.showLoading(); + count = ``; + if (scan_id) { + url = `/api/listInterestingEndpoints/?scan_id=${scan_id}&format=json&no_page`; + } + else{ + url = `/api/listInterestingEndpoints/?format=json&no_page`; + } + if (domain_name) { + $('.modal-title').html( count + ' Interesting Endpoints for : ' + domain_name + ''); + } + else{ + $('.modal-title').html( count + ' Interesting Endpoints'); + } + $('.modal-text').empty(); $('#modal-footer').empty(); + // query subdomains + $.getJSON(url, function(data) { + swal.close(); + if (data.length) { + $('#modal_dialog').modal('show'); + $('.modal_count').html(data.length); + $('#modal-content').empty(); + endpoints = ''; + $('#modal-content').append(``); + for (endpoint in data){ + endpoints += data[endpoint]['http_url'] + '\n' + } + $('#interesting_endpoints_text_area').append(endpoints); + $("#modal-footer").empty(); + $("#modal-footer").append(` Download Endpoints as txt`); + $("#modal-footer").append(` Copy Endpoints`); + } + else{ + swal.fire("No Interesting Endpoints", "Could not find any interesting Endpoints.", "warning", { + button: "Okay", + }); + } - }).fail(function(){ - swal.fire("No Interesting Endpoints", "Could not find any interesting Endpoints.", "warning", { - button: "Okay", - }); - }); + }).fail(function(){ + swal.fire("No Interesting Endpoints", "Could not find any interesting Endpoints.", "warning", { + button: "Okay", + }); + }); } function download_important_subdomains(scan_id, domain_name){ - Swal.fire({ - title: 'Querying Interesting Subdomains...' - }); - swal.showLoading(); - count = ``; - if (scan_id) { - url = `/api/querySubdomains?format=json&no_lookup_interesting&only_important&scan_id=${scan_id}`; - } - else{ - url = `/api/querySubdomains?format=json&no_lookup_interesting&only_important`; - } - if (domain_name) { - $('.modal-title').html(count + 'Subdomains marked as important : ' + domain_name + ''); - } - else{ - $('.modal-title').html(count + ' Subdomains marked as important'); - } - $('.modal-text').empty(); $('#modal-footer').empty(); - // query subdomains - $.getJSON(url, function(data) { - swal.close(); - if (data['subdomains'].length) { - $('#modal_dialog').modal('show'); - $('.modal_count').html(data['subdomains'].length); - $('#modal-content').empty(); - subdomains = ''; - $('#modal-content').append(``); - for (subdomain in data['subdomains']){ - subdomain_obj = data['subdomains'][subdomain]; - subdomains += subdomain_obj['name'] + '\n' - } - $('#all_subdomains_text_area').append(subdomains); - $("#modal-footer").empty(); - $("#modal-footer").append(` Download Subdomains as txt`); - $("#modal-footer").append(` Copy Subdomains`); - } - else{ - swal.fire("No Important Endpoints", "No subdomains has been marked as important.", "warning", { - button: "Okay", - }); - } - }).fail(function(){ - swal.fire("No Important Endpoints", "No subdomains has been marked as important.", "warning", { - button: "Okay", - }); - }); + Swal.fire({ + title: 'Querying Interesting Subdomains...' + }); + swal.showLoading(); + count = ``; + if (scan_id) { + url = `/api/querySubdomains?format=json&no_lookup_interesting&only_important&scan_id=${scan_id}`; + } + else{ + url = `/api/querySubdomains?format=json&no_lookup_interesting&only_important`; + } + if (domain_name) { + $('.modal-title').html(count + 'Subdomains marked as important : ' + domain_name + ''); + } + else{ + $('.modal-title').html(count + ' Subdomains marked as important'); + } + $('.modal-text').empty(); $('#modal-footer').empty(); + // query subdomains + $.getJSON(url, function(data) { + swal.close(); + if (data['subdomains'].length) { + $('#modal_dialog').modal('show'); + $('.modal_count').html(data['subdomains'].length); + $('#modal-content').empty(); + subdomains = ''; + $('#modal-content').append(``); + for (subdomain in data['subdomains']){ + subdomain_obj = data['subdomains'][subdomain]; + subdomains += subdomain_obj['name'] + '\n' + } + $('#all_subdomains_text_area').append(subdomains); + $("#modal-footer").empty(); + $("#modal-footer").append(` Download Subdomains as txt`); + $("#modal-footer").append(` Copy Subdomains`); + } + else{ + swal.fire("No Important Endpoints", "No subdomains has been marked as important.", "warning", { + button: "Okay", + }); + } + }).fail(function(){ + swal.fire("No Important Endpoints", "No subdomains has been marked as important.", "warning", { + button: "Okay", + }); + }); } function download_endpoints(scan_id, domain_name, pattern){ - Swal.fire({ - title: 'Querying Endpoints...' - }); - swal.showLoading(); - count = `Loading... `; - if (scan_id) { - url = `/api/queryEndpoints/?format=json&only_urls&scan_id=${scan_id}`; - } - else{ - url = `/api/queryEndpoints/?format=json&only_urls`; - } - if (pattern) { - url += `&pattern=${pattern}`; - } - if (domain_name) { - $('.modal-title').html( count + ' Endpoints for : ' + domain_name + ''); - } - else{ - $('.modal-title').html(count + ' Endpoints'); - } - $('.modal-text').empty(); $('#modal-footer').empty(); - // query subdomains - $.getJSON(url, function(data) { - swal.close(); - $('#modal_dialog').modal('show'); - $('.modal_count').html(data['endpoints'].length); - $('#modal-content').empty(); - endpoints = ''; - $('#modal-content').append(``); - for (endpoint in data['endpoints']){ - endpoint_obj = data['endpoints'][endpoint]; - endpoints += endpoint_obj['http_url'] + '\n' - } - $('#all_endpoints_text_area').append(endpoints); - $("#modal-footer").empty(); - if (domain_name) { - $("#modal-footer").append(` Download Endpoints as txt`); - } - else{ - $("#modal-footer").append(` Download Endpoints as txt`); - } - $("#modal-footer").append(` Copy Endpoints`); - }).fail(function(){ - }); + Swal.fire({ + title: 'Querying Endpoints...' + }); + swal.showLoading(); + count = `Loading... `; + if (scan_id) { + url = `/api/queryEndpoints/?format=json&only_urls&scan_id=${scan_id}`; + } + else{ + url = `/api/queryEndpoints/?format=json&only_urls`; + } + if (pattern) { + url += `&pattern=${pattern}`; + } + if (domain_name) { + $('.modal-title').html( count + ' Endpoints for : ' + domain_name + ''); + } + else{ + $('.modal-title').html(count + ' Endpoints'); + } + $('.modal-text').empty(); $('#modal-footer').empty(); + // query subdomains + $.getJSON(url, function(data) { + swal.close(); + $('#modal_dialog').modal('show'); + $('.modal_count').html(data['endpoints'].length); + $('#modal-content').empty(); + endpoints = ''; + $('#modal-content').append(``); + for (endpoint in data['endpoints']){ + endpoint_obj = data['endpoints'][endpoint]; + endpoints += endpoint_obj['http_url'] + '\n' + } + $('#all_endpoints_text_area').append(endpoints); + $("#modal-footer").empty(); + if (domain_name) { + $("#modal-footer").append(` Download Endpoints as txt`); + } + else{ + $("#modal-footer").append(` Download Endpoints as txt`); + } + $("#modal-footer").append(` Copy Endpoints`); + }).fail(function(){ + }); } function fetch_whois(domain_name){ - $('[data-toggle="tooltip"]').tooltip('hide'); - Snackbar.show({ - text: 'Fetching WHOIS...', - pos: 'top-right', - duration: 1500, - }); - $("#whois_not_fetched_alert").hide(); - $("#whois_fetching_alert").show(); - fetch(`/api/tools/whois/?format=json&ip_domain=${domain_name}&save_db`, {}).then(res => res.json()) - .then(function (response) { - $("#whois_fetching_alert").hide(); - document.getElementById('domain_age').innerHTML = response['domain']['domain_age'] + ' ' + response['domain']['date_created']; - document.getElementById('ip_address').innerHTML = response['domain']['ip_address']; - document.getElementById('ip_geolocation').innerHTML = response['domain']['geolocation']; + $('[data-toggle="tooltip"]').tooltip('hide'); + Snackbar.show({ + text: 'Fetching WHOIS...', + pos: 'top-right', + duration: 1500, + }); + $("#whois_not_fetched_alert").hide(); + $("#whois_fetching_alert").show(); + fetch(`/api/tools/whois/?format=json&ip_domain=${domain_name}&save_db`, {}).then(res => res.json()) + .then(function (response) { + $("#whois_fetching_alert").hide(); + document.getElementById('domain_age').innerHTML = response['domain']['domain_age'] + ' ' + response['domain']['date_created']; + document.getElementById('ip_address').innerHTML = response['domain']['ip_address']; + document.getElementById('ip_geolocation').innerHTML = response['domain']['geolocation']; - document.getElementById('registrant_name').innerHTML = response['registrant']['name']; - console.log(response['registrant']['organization']) - document.getElementById('registrant_organization').innerHTML = response['registrant']['organization'] ? response['registrant']['organization'] : ' '; - document.getElementById('registrant_address').innerHTML = response['registrant']['address'] + ' ' + response['registrant']['city'] + ' ' + response['registrant']['state'] + ' ' + response['registrant']['country']; - document.getElementById('registrant_phone_numbers').innerHTML = response['registrant']['tel']; - document.getElementById('registrant_fax').innerHTML = response['registrant']['fax']; + document.getElementById('registrant_name').innerHTML = response['registrant']['name']; + console.log(response['registrant']['organization']) + document.getElementById('registrant_organization').innerHTML = response['registrant']['organization'] ? response['registrant']['organization'] : ' '; + document.getElementById('registrant_address').innerHTML = response['registrant']['address'] + ' ' + response['registrant']['city'] + ' ' + response['registrant']['state'] + ' ' + response['registrant']['country']; + document.getElementById('registrant_phone_numbers').innerHTML = response['registrant']['tel']; + document.getElementById('registrant_fax').innerHTML = response['registrant']['fax']; - Snackbar.show({ - text: 'Whois Fetched...', - pos: 'top-right', - duration: 3000 - }); + Snackbar.show({ + text: 'Whois Fetched...', + pos: 'top-right', + duration: 3000 + }); - $("#whois_fetched_alert").show(); + $("#whois_fetched_alert").show(); - $("#whois_fetched_alert").fadeTo(2000, 500).slideUp(1500, function(){ - $("#whois_fetched_alert").slideUp(500); - }); + $("#whois_fetched_alert").fadeTo(2000, 500).slideUp(1500, function(){ + $("#whois_fetched_alert").slideUp(500); + }); - }); + }); } function initiate_subtask(subdomain_ids){ - var port_scan = $('#port_scan_subtask').is(':checked'); - var osint = $('#osint_subtask').is(':checked'); - var endpoint = $('#endpoint_subtask').is(':checked'); - var dir_fuzz = $('#dir_fuzz_subtask').is(':checked'); - var vuln_scan = $('#vuln_subtask').is(':checked'); - if (!port_scan && !osint && !endpoint && !dir_fuzz && !vuln_scan) { - Swal.fire({ - title: 'Oops!', - text: 'No Subtasks Selected. Please choose atleast one subtask!', - icon: 'error' - }); - return; - } - var data = { - 'subdomain_ids': subdomain_ids, - 'port_scan': port_scan, - 'osint': osint, - 'endpoint': endpoint, - 'dir_fuzz': dir_fuzz, - 'vuln_scan': vuln_scan, - }; - Swal.fire({ - title: 'Initiating Subtask...', - allowOutsideClick: false - }); - swal.showLoading(); - fetch('/api/action/initiate/subtask/', { - method: 'POST', - credentials: "same-origin", - headers: { - "X-CSRFToken": getCookie("csrftoken"), - 'Content-Type': 'application/json' - }, - body: JSON.stringify(data) - }) - .then(response => response.json()) - .then(function (response) { - swal.close(); - if (response['status']) { - Snackbar.show({ - text: 'Subtask initiated successfully!', - pos: 'top-right', - duration: 2500 - }); - } - else{ - Swal.fire({ - title: 'Could not initiate subtask!', - icon: 'fail', - }); - } - }); + var port_scan = $('#port_scan_subtask').is(':checked'); + var osint = $('#osint_subtask').is(':checked'); + var endpoint = $('#endpoint_subtask').is(':checked'); + var dir_fuzz = $('#dir_fuzz_subtask').is(':checked'); + var vuln_scan = $('#vuln_subtask').is(':checked'); + if (!port_scan && !osint && !endpoint && !dir_fuzz && !vuln_scan) { + Swal.fire({ + title: 'Oops!', + text: 'No Subtasks Selected. Please choose atleast one subtask!', + icon: 'error' + }); + return; + } + var data = { + 'subdomain_ids': subdomain_ids, + 'port_scan': port_scan, + 'osint': osint, + 'endpoint': endpoint, + 'dir_fuzz': dir_fuzz, + 'vuln_scan': vuln_scan, + }; + Swal.fire({ + title: 'Initiating Subtask...', + allowOutsideClick: false + }); + swal.showLoading(); + fetch('/api/action/initiate/subtask/', { + method: 'POST', + credentials: "same-origin", + headers: { + "X-CSRFToken": getCookie("csrftoken"), + 'Content-Type': 'application/json' + }, + body: JSON.stringify(data) + }) + .then(response => response.json()) + .then(function (response) { + swal.close(); + if (response['status']) { + Snackbar.show({ + text: 'Subtask initiated successfully!', + pos: 'top-right', + duration: 2500 + }); + } + else{ + Swal.fire({ + title: 'Could not initiate subtask!', + icon: 'fail', + }); + } + }); } // initiate sub scan $('#btn-initiate-subtask').on('click', function(){ - $('#subscan-modal').modal('hide'); - if ($('#btn-initiate-subtask').attr('multiple-subscan') === 'true') { - var subdomain_item = document.getElementsByClassName("subdomain_checkbox"); - var subdomain_ids = []; - for (var i = 0; i < subdomain_item.length; i++) { - if (subdomain_item[i].checked) { - subdomain_ids.push($(subdomain_item[i]).val()); - } - } - initiate_subtask(subdomain_ids); - } - else{ - var subdomain_id = $('#subtask_subdomain_id').val(); - initiate_subtask([subdomain_id]); - } + $('#subscan-modal').modal('hide'); + if ($('#btn-initiate-subtask').attr('multiple-subscan') === 'true') { + var subdomain_item = document.getElementsByClassName("subdomain_checkbox"); + var subdomain_ids = []; + for (var i = 0; i < subdomain_item.length; i++) { + if (subdomain_item[i].checked) { + subdomain_ids.push($(subdomain_item[i]).val()); + } + } + initiate_subtask(subdomain_ids); + } + else{ + var subdomain_id = $('#subtask_subdomain_id').val(); + initiate_subtask([subdomain_id]); + } }); function deleteMultipleSubdomains(){ - if (!checkedCount()) { - swal({ - title: 'Oops! No Subdomains has been selected!', - type: 'error', - padding: '2em' - }) - } else { - // atleast one target is selected - Swal.fire({ - showCancelButton: true, - title: 'Are you sure you want to delete ' + checkedCount() + ' Subdomains?', - text: 'Do you really want to delete these subdomains? This action cannot be undone.', - icon: 'error', - confirmButtonText: 'Delete', - }).then((result) => { - if (result.isConfirmed) { - Swal.fire({ - title: 'Deleting Subdomain...', - allowOutsideClick: false - }); - swal.showLoading(); + if (!checkedCount()) { + swal({ + title: 'Oops! No Subdomains has been selected!', + type: 'error', + padding: '2em' + }) + } else { + // atleast one target is selected + Swal.fire({ + showCancelButton: true, + title: 'Are you sure you want to delete ' + checkedCount() + ' Subdomains?', + text: 'Do you really want to delete these subdomains? This action cannot be undone.', + icon: 'error', + confirmButtonText: 'Delete', + }).then((result) => { + if (result.isConfirmed) { + Swal.fire({ + title: 'Deleting Subdomain...', + allowOutsideClick: false + }); + swal.showLoading(); - subdomain_item = document.getElementsByClassName("subdomain_checkbox"); - var subdomain_ids = []; - for (var i = 0; i < subdomain_item.length; i++) { - if (subdomain_item[i].checked) { - subdomain_ids.push($(subdomain_item[i]).val()); - } - } - var data = {'subdomain_ids': subdomain_ids}; - fetch('/api/action/subdomain/delete/', { - method: 'POST', - credentials: "same-origin", - headers: { - "X-CSRFToken": getCookie("csrftoken"), - 'Content-Type': 'application/json' - }, - body: JSON.stringify(data) - }) - .then(response => response.json()) - .then(function (response) { - swal.close(); - if (response['status']) { - // remove all rows - var table = $('#subdomain_scan_results').DataTable(); - for (var id in subdomain_ids) { - table.row('#subdomain_row_' + id).remove().draw(); - } - Snackbar.show({ - text: 'Subdomain successfully deleted!', - pos: 'top-right', - duration: 2500 - }); - } - else{ - Swal.fire({ - title: 'Could not delete Subdomain!', - icon: 'fail', - }); - } - }); - } - });; - } + subdomain_item = document.getElementsByClassName("subdomain_checkbox"); + var subdomain_ids = []; + for (var i = 0; i < subdomain_item.length; i++) { + if (subdomain_item[i].checked) { + subdomain_ids.push($(subdomain_item[i]).val()); + } + } + var data = {'subdomain_ids': subdomain_ids}; + fetch('/api/action/subdomain/delete/', { + method: 'POST', + credentials: "same-origin", + headers: { + "X-CSRFToken": getCookie("csrftoken"), + 'Content-Type': 'application/json' + }, + body: JSON.stringify(data) + }) + .then(response => response.json()) + .then(function (response) { + swal.close(); + if (response['status']) { + // remove all rows + var table = $('#subdomain_scan_results').DataTable(); + for (var id in subdomain_ids) { + table.row('#subdomain_row_' + id).remove().draw(); + } + Snackbar.show({ + text: 'Subdomain successfully deleted!', + pos: 'top-right', + duration: 2500 + }); + } + else{ + Swal.fire({ + title: 'Could not delete Subdomain!', + icon: 'fail', + }); + } + }); + } + });; + } } function initiateMultipleSubscan(){ - $('#subscan-modal').modal('show'); - $('a[data-toggle="tooltip"]').tooltip("hide") - // to distinguish multiple subscan or single, put a extra attribute on button - $('#btn-initiate-subtask').attr('multiple-subscan', true); + $('#subscan-modal').modal('show'); + $('a[data-toggle="tooltip"]').tooltip("hide") + // to distinguish multiple subscan or single, put a extra attribute on button + $('#btn-initiate-subtask').attr('multiple-subscan', true); } diff --git a/web/startScan/templates/startScan/detail_scan.html b/web/startScan/templates/startScan/detail_scan.html index 9b5101d2..46c5718e 100644 --- a/web/startScan/templates/startScan/detail_scan.html +++ b/web/startScan/templates/startScan/detail_scan.html @@ -1639,7 +1639,7 @@ $(document).ready(function(){ endpoint_count_badge = ''; if (row['endpoint_count']) { - endpoint_count_badge = `${row['endpoint_count']} Endpoints` + endpoint_count_badge = `${row['endpoint_count']} Endpoints` } vuln_count_badge = ''; diff --git a/web/static/custom/custom.js b/web/static/custom/custom.js index aa6895fb..96583759 100644 --- a/web/static/custom/custom.js +++ b/web/static/custom/custom.js @@ -1115,72 +1115,7 @@ function show_subscan_results(subscan_id) { } }); } else if(response['subscan']['task'] == 'fetch_url') { - $('#xl-modal-content').append(`| HTTP URL | -Status | -Page Title | -Tags | -Content Type | -Content Length | -Response Time | -
|---|
| HTTP URL | +Status | +Page Title | +Tags | +Content Type | +Content Length | +Response Time | +
|---|