diff --git a/web/startScan/templates/startScan/vulnerabilities.html b/web/startScan/templates/startScan/vulnerabilities.html index b774f834..b8acc24a 100644 --- a/web/startScan/templates/startScan/vulnerabilities.html +++ b/web/startScan/templates/startScan/vulnerabilities.html @@ -203,7 +203,7 @@ $(document).ready(function() { if (row['cve_ids']) { row['cve_ids'].forEach(cve => { - cve_cwe_badge += `${cve.name.toUpperCase()}`; + cve_cwe_badge += `${cve.name.toUpperCase()}`; }); } if (row['cwe_ids']) { diff --git a/web/static/custom/custom.js b/web/static/custom/custom.js index f3fdad19..b2789d13 100644 --- a/web/static/custom/custom.js +++ b/web/static/custom/custom.js @@ -2224,3 +2224,118 @@ function get_http_badge(http_status){ return badge } } + + +function get_and_render_cve_details(cve_id){ + var api_url = `/api/tools/cve_details/?cve_id=${cve_id}&format=json`; + Swal.fire({ + title: 'Fetching CVE Details...' + }); + swal.showLoading(); + fetch(api_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(); + if (response.status) { + $('#xl-modal-title').empty(); + $('#xl-modal-content').empty(); + $('#xl-modal-footer').empty(); + $('#xl-modal_title').html(`CVE Details of ${cve_id}`); + + var cvss_score_badge = 'danger'; + + if (response.result.cvss > 0.1 && response.result.cvss <= 3.9) { + cvss_score_badge = 'info'; + } + else if (response.result.cvss > 3.9 && response.result.cvss <= 6.9) { + cvss_score_badge = 'warning'; + } + + content = `
| CVSS Score | +${response.result.cvss ? response.result.cvss: "-"} | +
| Confidentiality Impact | +${response.result.impact.confidentiality ? response.result.impact.confidentiality: "N/A"} | +
| Integrity Impact | +${response.result.impact.integrity ? response.result.impact.integrity: "N/A"} | +
| Availability Impact | +${response.result.impact.availability ? response.result.impact.availability: "N/A"} | +
| Access Complexity | +${response.result.access.complexity ? response.result.access.complexity: "N/A"} | +
| Authentication | +${response.result.access.authentication ? response.result.access.authentication: "N/A"} | +
| CWE ID | +${response.result.cwe ? response.result.cwe: "N/A"} | +