()
| 20983 | if (exploitBtn) { |
| 20984 | if (entry.type === 'vulnerability') { |
| 20985 | exploitBtn.classList.remove('hidden'); |
| 20986 | exploitBtn.onclick = () => exploitVulnerability(entry); |
| 20987 | } else { |
| 20988 | exploitBtn.classList.add('hidden'); |
| 20989 | } |
| 20990 | } |
| 20991 | |
| 20992 | // Update research button |
| 20993 | const researchBtn = document.getElementById('netkb-research-btn'); |
| 20994 | if (researchBtn) { |
| 20995 | researchBtn.onclick = () => researchEntry(entry); |
| 20996 | } |
| 20997 | |
| 20998 | modal.classList.remove('hidden'); |
| 20999 | modal.classList.add('flex'); |
| 21000 | } |
| 21001 | |
| 21002 | function closeNetkbModal() { |
| 21003 | const modal = document.getElementById('netkb-detail-modal'); |
| 21004 | if (modal) { |
| 21005 | modal.classList.add('hidden'); |
| 21006 | modal.classList.remove('flex'); |
| 21007 | } |
| 21008 | } |
| 21009 | |
| 21010 | function refreshNetkbData() { |
| 21011 | fetchNetkbData(); |
| 21012 | showNetkbSuccess('NetKB data refreshed'); |
| 21013 | } |
| 21014 | |
| 21015 | function exportNetkbData() { |
| 21016 | const format = prompt('Export format (json/csv):', 'json'); |
| 21017 | if (format && (format === 'json' || format === 'csv')) { |
| 21018 | window.open(`/api/netkb/export?format=${format}`, '_blank'); |
| 21019 | showNetkbSuccess(`NetKB data exported as ${format.toUpperCase()}`); |
| 21020 | } |
| 21021 | } |
| 21022 | |
| 21023 | function exportNetkbEntry() { |
| 21024 | // Export the currently viewed entry |
| 21025 | showNetkbInfo('Individual entry export feature coming soon'); |
| 21026 | } |
| 21027 | |
| 21028 | function researchEntry(entry) { |
| 21029 | let searchUrl = 'https://www.google.com/search?q='; |
| 21030 | let searchTerm = ''; |
| 21031 | |
| 21032 | if (entry.cve) { |
| 21033 | searchTerm = entry.cve; |
| 21034 | } else if (entry.service) { |
| 21035 | searchTerm = `${entry.service} vulnerability exploit`; |
| 21036 | } else { |
| 21037 | searchTerm = `${entry.host} ${entry.description}`; |
| 21038 | } |
| 21039 | |
| 21040 | window.open(searchUrl + encodeURIComponent(searchTerm), '_blank'); |
| 21041 | showNetkbInfo(`Researching: ${searchTerm}`); |
| 21042 | } |
no test coverage detected