mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-09-22 09:44:55 +02:00
501 lines
23 KiB
HTML
501 lines
23 KiB
HTML
{% extends 'base/base.html' %}
|
||
{% load static %}
|
||
{% load humanize %}
|
||
{% load custom_tags %}
|
||
{% block title %}
|
||
All Subdomains
|
||
{% endblock title %}
|
||
|
||
{% block custom_js_css_link %}
|
||
<link rel="stylesheet" type="text/css" href="{% static 'plugins/datatable/datatables.css' %}">
|
||
<link rel="stylesheet" type="text/css" href="{% static 'plugins/datatable/global.css' %}">
|
||
<link rel="stylesheet" type="text/css" href="{% static 'plugins/datatable/custom.css' %}">
|
||
<link href="{% static 'plugins/perfect-scrollbar/perfect-scrollbar.css' %}" rel="stylesheet" type="text/css" />
|
||
<link href="{% static 'plugins/lightbox/css/lightbox.css' %}" rel="stylesheet" />
|
||
{% endblock custom_js_css_link %}
|
||
|
||
{% block main_content %}
|
||
<div class="row justify-content-center">
|
||
{% include 'base/_items/subdomain_tab_content.html' %}
|
||
</div>
|
||
{% include "base/_items/recon_note_modal.html" %}
|
||
{% include "base/_items/subscan_modal.html" %}
|
||
{% endblock main_content %}
|
||
|
||
|
||
{% block page_level_script %}
|
||
<script src="{% static 'custom/todo.js' %}"></script>
|
||
<script src="{% static 'note/js/todo.js' %}"></script>
|
||
<script src="{% static 'startScan/js/detail_scan.js' %}"></script>
|
||
<script src="{% static 'plugins/datatable/datatables.js' %}"></script>
|
||
<script src="{% static 'plugins/lightbox/js/lightbox.js' %}"></script>
|
||
<script src="{% static 'plugins/perfect-scrollbar/perfect-scrollbar.min.js' %}"></script>
|
||
<script src="{% static 'assets/js/clipboard.min.js' %}"></script>
|
||
<script src="{% static 'startScan/js/subdomains-suggestions.js' %}"></script>
|
||
<script src="{% static 'custom/subdomain.js' %}"></script>
|
||
<script type="text/javascript">
|
||
$(document).ready(function() {
|
||
const ps = new PerfectScrollbar(document.querySelector('.mt-container'));
|
||
var clipboard = new Clipboard('.copyable');
|
||
|
||
var subdomain_datatables = $('#subdomain_scan_results').DataTable({
|
||
"headerCallback": function(e, a, t, n, s) {
|
||
e.getElementsByTagName("th")[0].innerHTML='<div class="form-check ms-1 form-check-primary"><input type="checkbox" class="float-start form-check-input chk-parent" id="head_checkbox" onclick=mainCheckBoxSelected(this)>\n<span class="new-control-indicator"></span><span style="visibility:hidden">c</span></div>\n'
|
||
},
|
||
"destroy": true,
|
||
"processing": true,
|
||
"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="1.5" 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="1.5" 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="1.5" 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_",
|
||
"sProcessing": "Fetching Subdomains... Please wait..."
|
||
},
|
||
"fnCreatedRow": function (nRow, aData, iDataIndex) {
|
||
$(nRow).attr('id', 'subdomain_row_' + aData['id']);
|
||
},
|
||
"stripeClasses": [],
|
||
"lengthMenu": [50, 100, 500, 1000],
|
||
"pageLength": 50,
|
||
'serverSide': true,
|
||
{% if request.GET.ip_address %}
|
||
"ajax": '/api/listDatatableSubdomain/?&format=datatables&ip_address={{request.GET.ip_address}}',
|
||
{% else %}
|
||
"ajax": '/api/listDatatableSubdomain/?&format=datatables',
|
||
{% endif %}
|
||
"order": [[ 8, "desc" ]],
|
||
"columns": [
|
||
{'data': 'id'},
|
||
{'data': 'name'},
|
||
{'data': 'endpoint_count'},
|
||
{'data': 'endpoint_count'},
|
||
{'data': 'http_status'},
|
||
{'data': 'page_title'},
|
||
{'data': 'ip_addresses'},
|
||
{'data': 'ip_addresses'},
|
||
{'data': 'content_length', 'searchable': false},
|
||
{'data': 'screenshot_path', 'searchable': false},
|
||
{'data': 'response_time'},
|
||
{'data': 'technologies'},
|
||
{'data': 'http_url'},
|
||
{'data': 'cname'},
|
||
{'data': 'is_interesting'},
|
||
{'data': 'info_count'},
|
||
{'data': 'low_count'},
|
||
{'data': 'medium_count'},
|
||
{'data': 'high_count'},
|
||
{'data': 'critical_count'},
|
||
{'data': 'todos_count'},
|
||
{'data': 'is_important'},
|
||
{'data': 'webserver'},
|
||
{'data': 'content_type'},
|
||
{'data': 'id'},
|
||
{'data': 'directories_count'},
|
||
{'data': 'subscan_count'},
|
||
],
|
||
"columnDefs": [
|
||
{ "orderable": false, "targets": [2, 3, 6, 7, 9]},
|
||
{
|
||
"targets": [ 2, 3, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 25, 26],
|
||
"visible": false,
|
||
"searchable": false,
|
||
},
|
||
{
|
||
"targets": [ 11, 13, 21, 22, 23 ],
|
||
"visible": false,
|
||
"searchable": true,
|
||
},
|
||
{"className": "text-center", "targets": [2, 3, 4, 8, 10]},
|
||
// checkbox
|
||
{
|
||
"targets":0, "width":"20px", "className":"", "orderable":!1, render:function(e, a, t, n) {
|
||
return'<div class="form-check ms-1 form-check-primary"><input type="checkbox" name="subdomain_checkbox['+ e + ']" class="float-start form-check-input subdomain_checkbox" value="' + e + '" onchange=toggleMultipleSubdomainButton()>\n<span class="new-control-indicator"></span><span style="visibility:hidden">c</span></div>';
|
||
}},
|
||
// subdomain Name
|
||
{
|
||
"render": function ( data, type, row ) {
|
||
badges = '';
|
||
tech_badge = '';
|
||
interesting_badge = '';
|
||
content_type = '';
|
||
web_server = '';
|
||
if (row['technologies']){
|
||
tech_badge = '<div>' + parse_technology(row['technologies'], "primary", scan_id=null, domain_id=null) + '</div>';
|
||
}
|
||
if(row['is_interesting'])
|
||
{
|
||
interesting_badge = `<div><span class='me-1 badge badge-soft-danger' data-toggle="tooltip" data-placement="top" title="Interesting Subdomain">Interesting</span></div>`;
|
||
}
|
||
|
||
if (row['content_type']) {
|
||
content_type = `<div><span class='mt-1 badge badge-soft-blue bs-tooltip' title="Content Type">${row['content_type']}</span></div>`;
|
||
}
|
||
|
||
if (row['webserver']) {
|
||
web_server = `<div><span class='mt-1 badge badge-soft-info bs-tooltip' title="Web Server">${row['webserver']}</span></div>`;
|
||
}
|
||
|
||
if (interesting_badge) {
|
||
badges = interesting_badge;
|
||
}
|
||
|
||
todo_icon = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#e7515a" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>`;
|
||
todo_badge = '';
|
||
|
||
if (row['todos_count']) {
|
||
todo_badge = `<span class="text-danger badge badge-link badge-soft-danger float-end mt-1" onclick="list_subdomain_todos(${row['id']}, '${row['name']}')">${todo_icon} ${row['todos_count']} Todos </span>`
|
||
}
|
||
|
||
endpoint_count_badge = '';
|
||
if (row['endpoint_count']) {
|
||
endpoint_count_badge = `<span class="pl-2 pr-2 me-1 badge badge-soft-primary badge-link bs-tooltip" title="Endpoints" onclick="get_endpoint_modal(scan_id=null, subdomain_id=${row['id']}, '${row['name']}')">${row['endpoint_count']} <i class=" fas fa-link"></i></span>`;
|
||
}
|
||
|
||
vuln_count_badge = '';
|
||
total_vuln_badge = `<span class='pl-2 pr-2 me-1 mt-1 badge badge-critical bs-tooltip badge-link' title="All Vulnerabilities" onclick="get_vulnerability_modal(scan_id=null, severity=null, subdomain_id=${row['id']}, subdomain_name='${row['name']}')">${row['info_count'] + row['low_count'] + row['high_count'] + row['medium_count'] + row['critical_count']} <i class="fas fa-bug"></i></span>`;
|
||
info_badge = `<span class='pl-2 pr-2 me-1 mt-1 badge badge-soft-info bs-tooltip badge-link' title="Informational Vulnerabilities" onclick="get_vulnerability_modal(scan_id=null, severity=0, subdomain_id=${row['id']}, subdomain_name='${row['name']}')">${row['info_count']} Info</span>`;
|
||
low_badge = `<span class='pl-2 pr-2 me-1 mt-1 badge badge-low bs-tooltip badge-link' title=" Low Severity Vulnerabilities" onclick="get_vulnerability_modal(scan_id=null, severity=1, subdomain_id=${row['id']}, subdomain_name='${row['name']}')">${row['low_count']} Low</span>`;
|
||
medium_badge = `<span class='pl-2 pr-2 me-1 mt-1 badge badge-soft-warning bs-tooltip badge-link' title="Medium Severity Vulnerabilities" onclick="get_vulnerability_modal(scan_id=null, severity=2, subdomain_id=${row['id']}, subdomain_name='${row['name']}')">${row['medium_count']} Med</span>`;
|
||
high_badge = `<span class='pl-2 pr-2 me-1 mt-1 badge badge-soft-danger bs-tooltip badge-link' title="High Severity Vulnerabilities" onclick="get_vulnerability_modal(scan_id=null, severity=3, subdomain_id=${row['id']}, subdomain_name='${row['name']}')">${row['high_count']} High</span>`;
|
||
critical_badge = `<span class='pl-2 pr-2 me-1 mt-1 badge badge-critical bs-tooltip badge-link' title="Critical Vulnerabilities" onclick="get_vulnerability_modal(scan_id=null, severity=4, subdomain_id=${row['id']}, subdomain_name='${row['name']}')">${row['critical_count']} Critical</span>`;
|
||
vuln_count_badge = `<div class="">` + (row['info_count'] > 0? info_badge : '') + (row['low_count'] > 0? low_badge : '') + (row['medium_count'] > 0? medium_badge : '') + (row['high_count'] > 0? high_badge : '') + (row['critical_count'] > 0? critical_badge : '') + `</div>`;
|
||
|
||
vuln_count_badge = (row['info_count'] + row['low_count'] + row['high_count'] + row['medium_count'] + row['critical_count'] > 0? total_vuln_badge : '') + vuln_count_badge;
|
||
|
||
copy_icon = `
|
||
<a href="javascript:;" data-clipboard-action="copy" class="action-icon copyable" data-toggle="tooltip" data-placement="top" title="Copy Subdomain!" data-clipboard-target="#subdomain-${row['id']}" id="#subdomain-${row['id']}" onclick="setTooltip(this.id, 'Copied!')"> <i class="text-primary mdi mdi-content-copy"></i></a>
|
||
`;
|
||
|
||
var directory_count_badge = '';
|
||
if (row['directories_count']){
|
||
directory_count_badge = `<span class="me-1 badge badge-soft-primary badge-link bs-tooltip" title="Directories" onclick="get_directory_modal(scan_id=null, subdomain_id=${row['id']}, subdomain_name='${row['name']}')">${row['directories_count']} <i class="far fa-folder"></i></span>`;
|
||
}
|
||
|
||
var subscan_count_badge = '';
|
||
if (row['subscan_count']){
|
||
subscan_count_badge = `<span class="badge me-1 badge-soft-blue badge-link bs-tooltip" title="SubScans" onclick="get_and_render_subscan_history(${row['id']}, '${row['name']}')">${row['subscan_count']} <i class="fas fa-history"></i></span>`;
|
||
}
|
||
|
||
tech_badge += content_type;
|
||
tech_badge += web_server;
|
||
|
||
end_vuln_badge = '<div class="">' + subscan_count_badge + endpoint_count_badge + directory_count_badge + vuln_count_badge + '</div>';
|
||
|
||
if (row['http_url']) {
|
||
if (row['cname']) {
|
||
cname_badge = `<div><span class="text-dark">CNAME<br><span class="text-warning"> ❯ </span>` + row['cname'].replace(',', '<br><span class="text-warning"> ❯ </span>') + `</div>`;
|
||
return badges + `<div class="clipboard copy-txt"><a href="`+row['http_url']+`" class="text-primary" target="_blank"><span id='subdomain-${row['id']}'>` + data +`${copy_icon} </span></a>`+ `</div>` + cname_badge + end_vuln_badge + tech_badge + todo_badge;
|
||
}
|
||
return badges + `<div class="clipboard copy-txt"><a href="`+row['http_url']+`" class="text-primary" target="_blank"><span id='subdomain-${row['id']}'>` + data + `${copy_icon} </span></a>` + `</div>` + end_vuln_badge + tech_badge + todo_badge;
|
||
}
|
||
return badges + `<div class="clipboard copy-txt"><a href="https://`+data+`" class="text-primary" target="_blank"><span id='subdomain-${row['id']}'>` + data + `${copy_icon} </span></a>` + `</div>` + end_vuln_badge + tech_badge + todo_badge;
|
||
},
|
||
"targets": 1
|
||
},
|
||
// http_status
|
||
{
|
||
"render": function ( data, type, row ) {
|
||
// display badge based on http status
|
||
// green for http status 2XX, orange for 3XX and warning for everything else
|
||
if (data >= 200 && data < 300) {
|
||
return "<span class='badge bg-success'>"+data+"</span>";
|
||
}
|
||
else if (data >= 300 && data < 400) {
|
||
return "<span class='badge bg-warning'>"+data+"</span>";
|
||
}
|
||
else if (data == 0){
|
||
// datatable throws error when no data is returned
|
||
return "";
|
||
}
|
||
return `<span class='badge bg-danger'>`+data+`</span>`;
|
||
},
|
||
"targets": 4,
|
||
},
|
||
// page title
|
||
{
|
||
"render": function ( data, type, row ) {
|
||
if (data){
|
||
return htmlEncode(data);
|
||
}
|
||
return "";
|
||
},
|
||
"targets": 5,
|
||
},
|
||
// ip address
|
||
{
|
||
"render": function ( data, type, row ) {
|
||
ip_badge = ''
|
||
if (data)
|
||
{
|
||
Object.entries(data).forEach(([key, value]) => {
|
||
if (value['is_cdn']) {
|
||
ip_badge += `<span class='m-1 badge badge-soft-warning badge-link' title="CDN IP Address" onclick="get_ip_details('${value.address}', scan_id=null, domain_id=null)">${value.address}</span>`
|
||
}
|
||
else{
|
||
ip_badge += `<span class='m-1 badge badge-soft-primary badge-link' onclick="get_ip_details('${value.address}', scan_id=null, domain_id=null)">${value.address}</span>`
|
||
}
|
||
});
|
||
return ip_badge;
|
||
}
|
||
return "";
|
||
},
|
||
"targets": 6,
|
||
},
|
||
// open ports
|
||
{
|
||
"render": function ( data, type, row ) {
|
||
port_badge = ''
|
||
if (data){
|
||
for (ip in data){
|
||
ports = data[ip]['ports']
|
||
for (port in ports){
|
||
port_obj = data[ip]['ports'][port]
|
||
badge_color = port_obj['is_uncommon'] ? 'danger' : 'primary';
|
||
title = port_obj['is_uncommon'] ? 'Uncommon Port - ' + port_obj['description'] : port_obj['description'];
|
||
port_badge += `<span class='m-1 badge badge-soft-${badge_color} bs-tooltip badge-link' title='${title}' onclick="get_port_details(${port_obj['number']}, scan_id=null, domain_id=null)">${port_obj['number']}/${port_obj['service_name']}</span>`
|
||
}
|
||
}
|
||
return port_badge;
|
||
}
|
||
return "";
|
||
},
|
||
"targets": 7,
|
||
},
|
||
{
|
||
"render": function ( data, type, row ) {
|
||
if (data){
|
||
//return lightbox with caption as http link
|
||
return data;
|
||
}
|
||
return 0;
|
||
},
|
||
"targets": 8,
|
||
},
|
||
// screenshot
|
||
{
|
||
"render": function ( data, type, row ) {
|
||
if (data){
|
||
//return lightbox with caption as http link
|
||
return `<a href="/media/`+data+`" data-lightbox="screenshots" data-title="<a target='_blank' href='`+row['http_url']+`'><h3 style="color:white">`+row['name']+`</h3></a>"><img src="/media/`+data+`" class="img-fluid rounded mb-4 mt-4 screenshot" onerror="removeImageElement(this)"></a>`;
|
||
}
|
||
return "";
|
||
},
|
||
"targets": 9,
|
||
},
|
||
// response_time
|
||
{
|
||
"render": function ( data, type, row ) {
|
||
if (data){
|
||
return get_response_time_text(data);
|
||
}
|
||
return "";
|
||
},
|
||
"targets": 10,
|
||
},
|
||
// Action
|
||
{
|
||
"render": function ( data, type, row ) {
|
||
const cms_detector_http_url = row['http_url'] ? row['http_url'] : 'https://' + row['name'];
|
||
return `
|
||
<div class="btn-group mt-2">
|
||
<button type="button" data-toggle="tooltip" data-placement="top" title="Further Scan Subdomain" class="btn btn-primary btn-scan-subdomain me-1" id="${row['id']}"><i class="fe-zap"></i></button>
|
||
<button type="button" data-toggle="tooltip" data-placement="top" title="Add Recon Todo/Note" class="btn btn-primary me-1" id="${row['id']}" onclick="add_note_for_subdomain(${row['id']}, '${row['name']}')"><i class="fe-file-plus"></i></button>
|
||
<button class="btn btn-primary me-1 dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></button>
|
||
<div class="dropdown-menu dropdown-menu-end">
|
||
<a class="dropdown-item" href="#" onclick="mark_important_subdomain(this, ${row['id']})" id="${row['id']}"><i class="mdi mdi-alert-rhombus-outline me-2 text-muted font-18 vertical-middle"></i>Mark Important Subdomain</a>
|
||
<a class="dropdown-item" href="#" onclick="detect_subdomain_cms('${cms_detector_http_url}', ${row['http_status']})"><i class="fe-grid me-2 text-muted font-18 vertical-middle"></i>Detect CMS</a>
|
||
<a class="text-danger dropdown-item btn-delete-subdomain" href="#" id="${row['id']}"><i class="text-danger mdi mdi-delete-forever-outline me-2 font-18 vertical-middle"></i>Delete Subdomain</a>
|
||
</div>
|
||
</div>
|
||
`;
|
||
},
|
||
"targets": 24,
|
||
},
|
||
],
|
||
"dom": "<'row'<'col-lg-12 col-md-12 col-12 mb-2'l>>" +
|
||
"<'table-responsive'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>>",
|
||
drawCallback: function () {
|
||
$('.badge').tooltip({ template: '<div class="tooltip status" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>' })
|
||
$('.bs-tooltip').tooltip();
|
||
|
||
if(!$('#sub_http_status_filter_checkbox').is(":checked")){
|
||
subdomain_datatables.column(4).visible(false);
|
||
}
|
||
if(!$('#sub_page_title_filter_checkbox').is(":checked")){
|
||
subdomain_datatables.column(5).visible(false);
|
||
}
|
||
if(!$('#sub_ip_filter_checkbox').is(":checked")){
|
||
subdomain_datatables.column(6).visible(false);
|
||
}
|
||
if(!$('#sub_ports_filter_checkbox').is(":checked")){
|
||
subdomain_datatables.column(7).visible(false);
|
||
}
|
||
if(!$('#sub_content_length_filter_checkbox').is(":checked")){
|
||
subdomain_datatables.column(8).visible(false);
|
||
}
|
||
if(!$('#sub_http_status_filter_checkbox').is(":checked")){
|
||
subdomain_datatables.column(8).visible(false);
|
||
}
|
||
if(!$('#sub_response_time_filter_checkbox').is(":checked")){
|
||
subdomain_datatables.column(10).visible(false);
|
||
}
|
||
if(!$('#sub_screenshot_filter_checkbox').is(":checked")){
|
||
subdomain_datatables.column(9).visible(false);
|
||
}
|
||
|
||
},
|
||
"rowCallback": function( row, data, dataIndex ) {
|
||
if (data['is_important']){
|
||
$(row).addClass('table-danger');
|
||
}
|
||
},
|
||
});
|
||
|
||
$('#reload_subdomain_table_btn').click(function () {
|
||
subdomain_datatables.ajax.reload();
|
||
});
|
||
|
||
$('#subdomain-search-button').click(function () {
|
||
subdomain_datatables.search($("#subdomains-search").val()).draw() ;
|
||
});
|
||
|
||
$('input[name=sub_http_status_filter_checkbox]').change(function() {
|
||
if ($(this).is(':checked')) {
|
||
subdomain_datatables.column(4).visible(true);
|
||
} else {
|
||
subdomain_datatables.column(4).visible(false);
|
||
}
|
||
window.localStorage.setItem('sub_http_status_filter_checkbox', $(this).is(':checked'));
|
||
});
|
||
|
||
$('input[name=sub_page_title_filter_checkbox]').change(function() {
|
||
if ($(this).is(':checked')) {
|
||
subdomain_datatables.column(5).visible(true);
|
||
} else {
|
||
subdomain_datatables.column(5).visible(false);
|
||
}
|
||
window.localStorage.setItem('sub_page_title_filter_checkbox', $(this).is(':checked'));
|
||
});
|
||
$('input[name=sub_ip_filter_checkbox]').change(function() {
|
||
if ($(this).is(':checked')) {
|
||
subdomain_datatables.column(6).visible(true);
|
||
} else {
|
||
subdomain_datatables.column(6).visible(false);
|
||
}
|
||
window.localStorage.setItem('sub_ip_filter_checkbox', $(this).is(':checked'));
|
||
});
|
||
$('input[name=sub_ports_filter_checkbox]').change(function() {
|
||
if ($(this).is(':checked')) {
|
||
subdomain_datatables.column(7).visible(true);
|
||
} else {
|
||
subdomain_datatables.column(7).visible(false);
|
||
}
|
||
window.localStorage.setItem('sub_ports_filter_checkbox', $(this).is(':checked'));
|
||
});
|
||
$('input[name=sub_content_length_filter_checkbox]').change(function() {
|
||
if ($(this).is(':checked')) {
|
||
subdomain_datatables.column(8).visible(true);
|
||
} else {
|
||
subdomain_datatables.column(8).visible(false);
|
||
}
|
||
window.localStorage.setItem('sub_content_length_filter_checkbox', $(this).is(':checked'));
|
||
});
|
||
$('input[name=sub_response_time_filter_checkbox]').change(function() {
|
||
if ($(this).is(':checked')) {
|
||
subdomain_datatables.column(10).visible(true);
|
||
} else {
|
||
subdomain_datatables.column(10).visible(false);
|
||
}
|
||
window.localStorage.setItem('sub_response_time_filter_checkbox', $(this).is(':checked'));
|
||
});
|
||
$('input[name=sub_screenshot_filter_checkbox]').change(function() {
|
||
if ($(this).is(':checked')) {
|
||
subdomain_datatables.column(9).visible(true);
|
||
} else {
|
||
subdomain_datatables.column(9).visible(false);
|
||
}
|
||
window.localStorage.setItem('sub_screenshot_filter_checkbox', $(this).is(':checked'));
|
||
});
|
||
|
||
|
||
$("#subdomain_scan_results").on('click', '.btn-delete-subdomain', function () {
|
||
var subdomain_id = $(this).attr('id');
|
||
var data = {'subdomain_ids': [subdomain_id]};
|
||
var row = this;
|
||
Swal.fire({
|
||
showCancelButton: true,
|
||
title: 'Delete Subdomain!',
|
||
text: 'Do you really want to delete this subdomain? This action cannot be undone.',
|
||
icon: 'error',
|
||
confirmButtonText: 'Delete',
|
||
}).then((result) => {
|
||
if (result.isConfirmed) {
|
||
Swal.fire({
|
||
title: 'Deleting Subdomain...',
|
||
allowOutsideClick: false
|
||
});
|
||
swal.showLoading();
|
||
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']) {
|
||
$(row).parent().parent().parent().remove();
|
||
Snackbar.show({
|
||
text: 'Subdomain successfully deleted!',
|
||
pos: 'top-right',
|
||
duration: 2500
|
||
});
|
||
}
|
||
else{
|
||
Swal.fire({
|
||
title: 'Could not delete Subdomain!',
|
||
icon: 'fail',
|
||
});
|
||
}
|
||
});
|
||
}
|
||
});;
|
||
$('a[data-toggle="tooltip"]').tooltip("hide")
|
||
});
|
||
|
||
$("#subdomain_scan_results").on('click', '.btn-scan-subdomain', function () {
|
||
$('input[type=checkbox]').prop('checked',false);
|
||
$('#subscan-modal').modal('show');
|
||
var subdomain_id = $(this).attr('id');
|
||
$('a[data-toggle="tooltip"]').tooltip("hide")
|
||
$('#subtask_subdomain_id').val(subdomain_id);
|
||
// to distinguish multiple subscan or single, put a extra attribute on button
|
||
$('#btn-initiate-subtask').attr('multiple-subscan', false);
|
||
});
|
||
|
||
var subdomain_cols = [
|
||
'sub_http_status_filter_checkbox',
|
||
'sub_page_title_filter_checkbox',
|
||
'sub_ip_filter_checkbox',
|
||
'sub_ports_filter_checkbox',
|
||
'sub_content_length_filter_checkbox',
|
||
'sub_response_time_filter_checkbox',
|
||
'sub_screenshot_filter_checkbox'
|
||
];
|
||
|
||
for (var col in subdomain_cols) {
|
||
if(window.localStorage.getItem(subdomain_cols[col]) != null && window.localStorage.getItem(subdomain_cols[col]) === 'false'){
|
||
$('#' + subdomain_cols[col]).prop('checked', false);
|
||
}
|
||
}
|
||
|
||
});
|
||
</script>
|
||
{% endblock page_level_script %}
|