diff --git a/web/startScan/templates/startScan/detail_scan.html b/web/startScan/templates/startScan/detail_scan.html index d32a11a06..a1db5e196 100644 --- a/web/startScan/templates/startScan/detail_scan.html +++ b/web/startScan/templates/startScan/detail_scan.html @@ -1827,7 +1827,7 @@

\nc`; - } - else{ - return `
\nc
`; - } - }, - "targets": 0, + "targets":0, "width":"15px", "className":"", "orderable":!1, render:function(e, a, t, n) { + return `
\nc
`; }, }, { "render": function ( data, type, row ) { if (data) { - return `  ${data.toUpperCase()}  `; + return `${data.toUpperCase()}`; } }, "targets": 1, @@ -98,7 +91,7 @@ { "render": function ( data, type, row ) { if (data) { - return `  ${data.toUpperCase()}  `; + return `${data.toUpperCase()}`; } }, "targets": 2, @@ -205,10 +198,10 @@ { "render": function ( data, type, row ) { if (data){ - return '  OPEN  ' + return 'OPEN' } else{ - return '  RESOLVED  ' + return 'RESOLVED' } }, "targets": 15, @@ -297,8 +290,7 @@ }); $('#vulnerability_results').on('click', 'tr' , function (e) { - console.log(e.target); - if ($(e.target).is('input[type="checkbox"]') || $(e.target).is('svg') || $(e.target).is('a') || $(e.target).is('th')) { + if ($(e.target).is('input[type="checkbox"]') || $(e.target).is('svg') || $(e.target).is('a') || $(e.target).is('th') || $(e.target).is('span')) { return; } var data = vulnerability_table.row(this).data(); diff --git a/web/static/custom/custom.css b/web/static/custom/custom.css index c77410a09..8270f3df5 100644 --- a/web/static/custom/custom.css +++ b/web/static/custom/custom.css @@ -120,7 +120,7 @@ form-control:disabled, .form-control[readonly]{ .badge { font-weight: 600 !important; line-height: 1.4 !important; - padding: 3px 6px !important; + padding: 3px 12px !important; font-size: 13px !important; font-weight: 600 !important; transition: all 0.3s ease-out !important; diff --git a/web/static/custom/custom.js b/web/static/custom/custom.js index 884b29daf..fbf69f9fe 100644 --- a/web/static/custom/custom.js +++ b/web/static/custom/custom.js @@ -390,16 +390,58 @@ function download(filename, text) { document.body.removeChild(element); } -function vuln_status_change(checkbox, id) { - if (checkbox.checked) { - checkbox.parentNode.parentNode.parentNode.className = "table-success text-strike"; - } else { - checkbox.parentNode.parentNode.parentNode.classList.remove("table-success"); - checkbox.parentNode.parentNode.parentNode.classList.remove("text-strike"); - } - change_vuln_status(id); +function updateVulnStatus(element, id, status) { + const $element = $(element); + const $row = $element.closest("tr"); + + $row.toggleClass("table-success text-strike", status); + $element.text(status ? 'RESOLVED' : 'OPEN') + .toggleClass('badge-soft-primary', !status) + .toggleClass('badge-soft-success', status) + .attr('onclick', `vuln_status_change(this, ${id}, ${!status})`); +} + +function vuln_status_change(element, id, status) { + updateVulnStatus(element, id, status); + change_vuln_status(id); +} + +function bulk_vuln_status_change(status) { + $('.vulnerability_checkbox:checked') + .parents("tr") + .find('.vuln-status') + .filter((_, el) => (status && $(el).text() === "OPEN") || (!status && $(el).text() === "RESOLVED")) + .trigger('click'); } +function toggleMultipleVulnerabilitiesButton(){ + if($('.vulnerability_checkbox:checked').length >= 1){ + if($('.vulnerability_checkbox:checked').length >= 2){ + $('#select_all_checkbox').prop('checked','checked') + } + $(".vulnerability_btns").removeClass("disabled") + $('#vulnaribilities_selected_count').show().text($('.vulnerability_checkbox:checked').length + ' Vulnerabilities Selected x'); + }else{ + $('#select_all_checkbox').prop('checked','') + $(".vulnerability_btns").addClass("disabled") + $('#vulnaribilities_selected_count').hide() + + } +} + +function uncheckVulnerabilities(){ + $('.vulnerability_checkbox:checked').trigger('click') +} + +function countVulnerabilities (){ + +} + +$('#select_all_checkbox').on('click', function() { + $("tr").find("[type=checkbox]").prop('checked', $(this).is(':checked')); + toggleMultipleVulnerabilitiesButton(); +}); + $("#vulnerability_results").on('click', '.btn-delete-vulnerability', function () { var vulnerability_id = $(this).attr('id'); var data = {'vulnerability_ids': [vulnerability_id]}; @@ -450,6 +492,61 @@ $("#vulnerability_results").on('click', '.btn-delete-vulnerability', function () }); +$("#bulk_delete_vulnerabilities").on('click', function () { + //btn-delete-vulnerability contains vuln id to delete + var vulnerabilities = $('.vulnerability_checkbox:checked').parents("tr").find('.btn-delete-vulnerability') + var vulnerabilities_ids = Array(); + Array.from(vulnerabilities).forEach(vuln => { + vulnerabilities_ids.push($(vuln).attr('id')); + }); + var data = {'vulnerability_ids': vulnerabilities_ids}; + Swal.fire({ + showCancelButton: true, + title: 'Bulk Delete Vulnerabilities!', + text: 'Do you really want to delete all those Vulnerabilities? This action cannot be undone.', + icon: 'error', + confirmButtonText: 'Delete', + }).then((result) => { + if (result.isConfirmed) { + Swal.fire({ + title: 'Deleting Vulnerabilities...', + allowOutsideClick: false + }); + swal.showLoading(); + fetch('/api/action/vulnerability/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']) { + Array.from(vulnerabilities).forEach(vuln => { + $(vuln).parents('tr').remove(); + }); + Snackbar.show({ + text: 'Vulnerabilities successfully deleted!', + pos: 'top-right', + duration: 2500 + }); + } + else{ + Swal.fire({ + title: 'Could not delete Vulnerabilities!', + icon: 'fail', + }); + } + }); + } + });; + $('a[data-toggle="tooltip').tooltip("hide") +}); + function report_hackerone(vulnerability_id, severity) { message = "" if (severity == 'Info' || severity == 'Low' || severity == 'Medium') { diff --git a/web/targetApp/templates/target/summary.html b/web/targetApp/templates/target/summary.html index 51ce0ea43..67027e186 100644 --- a/web/targetApp/templates/target/summary.html +++ b/web/targetApp/templates/target/summary.html @@ -1649,7 +1649,7 @@

+
+ +
+
+ +
+
+ +
+
+ +
- +
Status + + Source Type