(vulnText)
| 14710 | // Real-time scanning control functions |
| 14711 | async function startRealtimeScan() { |
| 14712 | const startBtn = document.getElementById('start-network-scan'); |
| 14713 | const stopBtn = document.getElementById('stop-network-scan'); |
| 14714 | |
| 14715 | try { |
| 14716 | startBtn.disabled = true; |
| 14717 | startBtn.innerHTML = '⏳ Starting...'; |
| 14718 | |
| 14719 | const response = await networkAwareFetch('/api/scan/start-realtime', { |
| 14720 | method: 'POST', |
| 14721 | headers: { |
| 14722 | 'Content-Type': 'application/json', |
| 14723 | } |
| 14724 | }); |
| 14725 | |
| 14726 | if (response.ok) { |
| 14727 | currentScanState.isScanning = true; |
| 14728 | currentScanState.startTime = new Date(); |
| 14729 | stopBtn.disabled = false; |
| 14730 | startBtn.innerHTML = '⏳ Scanning...'; |
| 14731 | |
| 14732 | // Show progress section |
| 14733 | document.getElementById('scan-progress').classList.remove('hidden'); |
| 14734 | |
| 14735 | addConsoleMessage('Real-time network scan started', 'info'); |
| 14736 | } else { |
| 14737 | throw new Error('Failed to start scan'); |
| 14738 | } |
| 14739 | } catch (error) { |
| 14740 | console.error('Error starting scan:', error); |
| 14741 | addConsoleMessage('Failed to start network scan: ' + error.message, 'error'); |
| 14742 | resetScanButtons(); |
| 14743 | } |
| 14744 | } |
| 14745 | |
| 14746 | async function stopRealtimeScan() { |
| 14747 | const stopBtn = document.getElementById('stop-network-scan'); |
| 14748 | |
| 14749 | try { |
| 14750 | stopBtn.disabled = true; |
| 14751 | stopBtn.innerHTML = '⏳ Stopping...'; |
| 14752 | |
| 14753 | // Emit stop scan event via WebSocket |
| 14754 | socket.emit('stop_scan'); |
| 14755 | |
| 14756 | addConsoleMessage('Stopping network scan...', 'info'); |
| 14757 | } catch (error) { |
| 14758 | console.error('Error stopping scan:', error); |
| 14759 | addConsoleMessage('Failed to stop network scan: ' + error.message, 'error'); |
| 14760 | stopBtn.disabled = false; |
no outgoing calls
no test coverage detected