mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-09-26 19:54:53 +02:00
493 lines
23 KiB
HTML
493 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 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' with all_subdomains=True%}
|
||
</div>
|
||
{% include "base/_items/recon_note_modal.html" %}
|
||
{% include "base/_items/subscan_modal.html" %}
|
||
{# for passing subdomain id to initiate subtask scan #}
|
||
<input type="hidden" name="subtask_subdomain_id" id="subtask_subdomain_id" value="0">
|
||
{% 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/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 src="{% static 'custom/subdomain_datatable.js' %}"></script>
|
||
<script type="text/javascript">
|
||
$(document).ready(function() {
|
||
const ps = new PerfectScrollbar(document.querySelector('.mt-container'));
|
||
var clipboard = new Clipboard('.copyable');
|
||
var is_subd_grouping = false;
|
||
var subd_grouping_col = 8;
|
||
{% if request.GET.ip_address %}
|
||
var url = '/api/listDatatableSubdomain/?&project={{current_project.slug}}&format=datatables&ip_address={{request.GET.ip_address}}';
|
||
{% elif request.GET.name %}
|
||
var url = '/api/listDatatableSubdomain/?&project={{current_project.slug}}&format=datatables&name={{request.GET.name}}';
|
||
{% else %}
|
||
var url = '/api/listDatatableSubdomain/?&project={{current_project.slug}}&format=datatables';
|
||
{% endif %}
|
||
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": subdomain_oLanguage,
|
||
"fnCreatedRow": function (nRow, aData, iDataIndex) {
|
||
$(nRow).attr('id', 'subdomain_row_' + aData['id']);
|
||
},
|
||
"stripeClasses": [],
|
||
"lengthMenu": subdomain_datatable_length_menu,
|
||
"pageLength": subdomain_datatable_page_length,
|
||
"serverSide": true,
|
||
"ajax": {
|
||
'url': url
|
||
},
|
||
"rowGroup": {
|
||
"startRender": function(rows, group) {
|
||
return group + ' (' + rows.count() + ' Subdomains)';
|
||
}
|
||
},
|
||
"order": [[ 8, "desc" ]],
|
||
"columns": subdomain_datatable_columns,
|
||
"columnDefs": [
|
||
{ "orderable": false, "targets": [2, 3, 6, 7, 9]},
|
||
{
|
||
"targets": [ 2, 3, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 25, 26, 27, 28],
|
||
"visible": false,
|
||
"searchable": false,
|
||
},
|
||
{
|
||
"targets": [ 11, 13, 21, 22, 23 ],
|
||
"visible": false,
|
||
"searchable": true,
|
||
},
|
||
{"className": "text-start text-lg-center", "targets": [2, 3, 4, 8, 10]},
|
||
// checkbox
|
||
{
|
||
"targets":0, "width":"15px", "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 ) {
|
||
var badges = '';
|
||
var tech_badge = '';
|
||
var interesting_badge = '';
|
||
var content_type = '';
|
||
var web_server = '';
|
||
var waf_badge = '';
|
||
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(project='{{current_project.slug}}', scan_id=null, subdomain_id=${row['id']}, '${row['name']}')">${row['endpoint_count']} <i class=" fas fa-link"></i></span>`;
|
||
}
|
||
|
||
if(row['waf'].length){
|
||
waf_badge = `<div><span class="pl-2 pr-2 my-1 badge badge-soft-danger" bs-tooltip" title="WAF Detected by wafw00f!""><i class="fe-cloud-lightning mx-1"></i>WAF Detected</span>`;
|
||
for (var waf in row['waf']) {
|
||
var waf_object = row['waf'][waf];
|
||
waf_badge += `<span class="mx-1 my-1 badge badge-soft-danger" bs-tooltip" title="WAF Manufacturer: ${waf_object.manufacturer}">${waf_object.name}</span>`;
|
||
}
|
||
waf_badge += `</div>`;
|
||
}
|
||
|
||
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 + waf_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>` + waf_badge + 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>` + waf_badge + 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="Show Attack Surface" class="btn btn-primary me-1 bs-tooltip" onclick="show_attack_surface_modal(${row['id']})"><i class="fe-eye"></i></button>
|
||
<button type="button" data-toggle="tooltip" data-placement="top" title="Further Scan Subdomain" class="btn btn-primary btn-scan-subdomain me-1 bs-tooltip" 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 bs-tooltip" 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": "<'dt--top-section'<'row'<'col-12 mb-3 mb-sm-0 col-sm-4 col-md-3 col-lg-4 d-flex justify-content-sm-start justify-content-center'l><'dt--pages-count col-12 col-sm-6 col-md-4 col-lg-4 d-flex justify-content-sm-middle justify-content-center'i><'dt--pagination col-12 col-sm-2 col-md-5 col-lg-4 d-flex justify-content-sm-end justify-content-center'p>>>" +
|
||
"<'table-responsive'tr>" +
|
||
"<'dt--bottom-section'<'row'<'col-12 mb-3 mb-sm-0 col-sm-4 col-md-3 col-lg-4 d-flex justify-content-sm-start justify-content-center'l><'dt--pages-count col-12 col-sm-6 col-md-4 col-lg-4 d-flex justify-content-sm-middle justify-content-center'i><'dt--pagination col-12 col-sm-2 col-md-5 col-lg-4 d-flex justify-content-sm-end justify-content-center'p>>>",
|
||
"initComplete": function(settings, json) {
|
||
api = this.api();
|
||
subdomain_datatable_col_visibility(subdomain_datatables);
|
||
$(".dtrg-group th:contains('No group')").remove();
|
||
},
|
||
"drawCallback": function () {
|
||
$('.badge').tooltip({ template: '<div class="tooltip status" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>' })
|
||
$('.bs-tooltip').tooltip();
|
||
$('.dtrg-group').remove();
|
||
drawCallback_api = this.api();
|
||
setTimeout(function() {
|
||
$(".dtrg-group th:contains('No group')").remove();
|
||
}, 1);
|
||
},
|
||
"rowCallback": function( row, data, dataIndex ) {
|
||
if (data['is_important']){
|
||
$(row).addClass('table-danger');
|
||
}
|
||
},
|
||
});
|
||
|
||
var radioGroup = document.getElementsByName('grouping_subd_row');
|
||
radioGroup.forEach(function(radioButton) {
|
||
radioButton.addEventListener('change', function() {
|
||
if (this.checked) {
|
||
var groupRows = document.querySelectorAll('tr.group');
|
||
var col_index = get_datatable_col_index(this.value, subdomain_datatable_columns);
|
||
api.page.len(-1).draw();
|
||
api.order([col_index, 'asc']).draw();
|
||
subdomain_datatables.rowGroup().dataSrc(this.value);
|
||
Snackbar.show({
|
||
text: 'Subdomains grouped by ' + this.value,
|
||
pos: 'top-right',
|
||
duration: 2500
|
||
});
|
||
}
|
||
});
|
||
});
|
||
|
||
$('#reload_subdomain_table_btn').click(function () {
|
||
subdomain_datatables.ajax.reload();
|
||
});
|
||
|
||
$('#subdomain-search-button').click(function () {
|
||
subdomain_datatables.search($("#subdomains-search").val()).draw() ;
|
||
});
|
||
|
||
$('#load_important_subdomain_table_btn').click(function() {
|
||
subdomain_datatables.search('is_important=true').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 %}
|