(files, path, highlightFile = null)
| 13230 | |
| 13231 | function handleDeepScanUpdate(data) { |
| 13232 | const { type, ip, message } = data; |
| 13233 | |
| 13234 | // Get the button for this IP |
| 13235 | const buttonId = `deep-scan-btn-${ip.replace(/\./g, '-')}`; |
| 13236 | const button = document.getElementById(buttonId); |
| 13237 | const customStatusEl = document.getElementById('custom-deep-scan-status'); |
| 13238 | const updateCustomStatus = customStatusEl && customStatusEl.dataset.currentIp === ip; |
| 13239 | |
| 13240 | switch (type) { |
| 13241 | case 'deep_scan_started': |
| 13242 | addConsoleMessage(`🔍 ${message}`, 'info'); |
| 13243 | if (button) { |
| 13244 | button.classList.remove('bg-purple-600', 'hover:bg-purple-700'); |
| 13245 | button.classList.add('bg-blue-600', 'cursor-wait'); |
| 13246 | button.disabled = true; |
| 13247 | button.textContent = 'Scan started'; |
| 13248 | button.dataset.scanStatus = 'scanning'; |
| 13249 | // Save the updated state |
| 13250 | saveDeepScanButtonState(ip); |
| 13251 | } |
| 13252 | if (updateCustomStatus && message) { |
| 13253 | customStatusEl.textContent = message; |
| 13254 | } |
| 13255 | break; |
| 13256 | |
| 13257 | case 'deep_scan_progress': |
| 13258 | // Update button with short progress messages |
| 13259 | if (button) { |
| 13260 | const event = data.event; |
| 13261 | if (event === 'scanning') { |
| 13262 | button.textContent = 'Scanning...'; |
| 13263 | } else if (event === 'hostname') { |
| 13264 | // Extract short hostname (max 20 chars already in message) |
| 13265 | button.textContent = message; |
| 13266 | } else if (event === 'port_found') { |
| 13267 | const port = data.port; |
| 13268 | const service = data.service; |
| 13269 | button.textContent = `Port ${port} found`; |
| 13270 | } |
| 13271 | button.dataset.scanStatus = 'scanning'; |
| 13272 | // Save the updated state |
| 13273 | saveDeepScanButtonState(ip); |
| 13274 | } |
| 13275 | if (updateCustomStatus && message) { |
| 13276 | customStatusEl.textContent = message; |
| 13277 | } |
| 13278 | break; |
| 13279 | |
| 13280 | case 'deep_scan_completed': |
| 13281 | const portCount = data.open_ports ? data.open_ports.length : 0; |
| 13282 | const duration = data.scan_duration ? data.scan_duration.toFixed(2) : 'unknown'; |
| 13283 | addConsoleMessage(`✅ Deep scan of ${ip} complete: ${portCount} ports found in ${duration}s`, 'success'); |
| 13284 | |
| 13285 | // Show detailed port information |
| 13286 | if (data.open_ports && data.open_ports.length > 0) { |
| 13287 | const portList = data.open_ports.slice(0, 10).join(', '); |
| 13288 | const moreText = data.open_ports.length > 10 ? ` (+${data.open_ports.length - 10} more)` : ''; |
| 13289 | addConsoleMessage(` Open ports: ${portList}${moreText}`, 'info'); |
no test coverage detected