()
| 18826 | // Hide status after 4 seconds |
| 18827 | setTimeout(() => { |
| 18828 | if (statusEl) { |
| 18829 | statusEl.classList.add('hidden'); |
| 18830 | } |
| 18831 | }, 4000); |
| 18832 | } |
| 18833 | } else { |
| 18834 | addConsoleMessage(`Failed to trigger network scan: ${data.message || 'Unknown error'}`, 'error'); |
| 18835 | if (statusEl) { |
| 18836 | statusEl.textContent = `Error: ${data.message || 'Failed to trigger network scan'}`; |
| 18837 | statusEl.className = 'text-sm text-red-600 mt-4'; |
| 18838 | } |
| 18839 | } |
| 18840 | |
| 18841 | } catch (error) { |
| 18842 | console.error('Error triggering network scan:', error); |
| 18843 | addConsoleMessage('Failed to trigger network scan', 'error'); |
| 18844 | if (statusEl) { |
| 18845 | statusEl.textContent = `Error: ${error.message}`; |
| 18846 | statusEl.className = 'text-sm text-red-600 mt-4'; |
| 18847 | } |
| 18848 | } |
| 18849 | } |
| 18850 | |
| 18851 | async function triggerVulnScan() { |
| 18852 | const statusEl = document.getElementById('system-control-status'); |
| 18853 | |
| 18854 | try { |
| 18855 | const vulnIpDropdown = document.getElementById('vuln-ip-dropdown'); |
| 18856 | const selectedIp = vulnIpDropdown ? vulnIpDropdown.value : 'all'; |
| 18857 | const isAllTargets = !selectedIp || selectedIp === 'all'; |
| 18858 | const scanLabel = isAllTargets ? 'all targets' : selectedIp; |
| 18859 | |
| 18860 | // Show status and start progress |
| 18861 | if (statusEl) { |
| 18862 | statusEl.classList.remove('hidden'); |
| 18863 | statusEl.textContent = `Starting vulnerability scan for ${scanLabel}...`; |
| 18864 | statusEl.className = 'text-sm text-purple-600 mt-4'; |
| 18865 | } |
| 18866 | |
| 18867 | addConsoleMessage(`Triggering vulnerability scan for ${scanLabel}...`, 'info'); |
| 18868 | |
| 18869 | const data = await postAPI('/api/manual/scan/vulnerability', { ip: isAllTargets ? 'all' : selectedIp }); |
| 18870 | |
| 18871 | if (data.success) { |
| 18872 | addConsoleMessage('Vulnerability scan triggered successfully', 'success'); |
| 18873 | if (statusEl) { |
| 18874 | statusEl.textContent = `Vulnerability scan initiated for ${scanLabel} - Check Threat Intel tab in a few minutes`; |
no test coverage detected