Get current e-paper display image as base64
()
| 12430 | 'type': 'deep_scan_progress', |
| 12431 | 'ip': ip, |
| 12432 | 'message': f"Parameters accepted: ip={ip} mode={'top3000' if use_top_ports else 'full-range'} range={portstart}-{portend}" |
| 12433 | }) |
| 12434 | |
| 12435 | # Perform the deep scan with progress callback |
| 12436 | result = scanner.deep_scan_host(ip, portstart, portend, progress_callback=progress_callback, use_top_ports=use_top_ports) |
| 12437 | |
| 12438 | # Emit final result |
| 12439 | if result['success']: |
| 12440 | socketio.emit('deep_scan_update', { |
| 12441 | 'type': 'deep_scan_completed', |
| 12442 | 'ip': ip, |
| 12443 | 'open_ports': result['open_ports'], |
| 12444 | 'hostname': result['hostname'], |
| 12445 | 'port_details': result['port_details'], |
| 12446 | 'scan_duration': result['scan_duration'], |
| 12447 | 'message': result['message'] |
| 12448 | }) |
| 12449 | |
| 12450 | # Also emit a network update to refresh the table |
| 12451 | socketio.emit('network_update', {'refresh': True}) |
| 12452 | else: |
| 12453 | socketio.emit('deep_scan_update', { |
| 12454 | 'type': 'deep_scan_error', |
| 12455 | 'ip': ip, |
| 12456 | 'message': result['message'] |
| 12457 | }) |
| 12458 | |
| 12459 | except Exception as e: |
| 12460 | logger.error(f"Error in deep scan background task for {ip}: {e}") |
| 12461 | socketio.emit('deep_scan_update', { |
| 12462 | 'type': 'deep_scan_error', |
| 12463 | 'ip': ip, |
| 12464 | 'message': f'Deep scan error: {str(e)}' |
| 12465 | }) |
| 12466 | |
| 12467 | # Start the deep scan in a background thread |
| 12468 | import threading |
| 12469 | scan_thread = threading.Thread(target=deep_scan_background) |
| 12470 | scan_thread.daemon = True |
| 12471 | scan_thread.start() |
| 12472 | |
| 12473 | return jsonify({ |
| 12474 | 'status': 'success', |
| 12475 | 'message': f"Started deep scan of {ip} (mode={'top3000' if use_top_ports else 'full-range'})", |
| 12476 | 'ip': ip, |
| 12477 | 'portstart': portstart, |
| 12478 | 'portend': portend, |
| 12479 | 'mode': 'top3000' if use_top_ports else 'full-range' |
| 12480 | }) |
| 12481 | |
| 12482 | except Exception as e: |
| 12483 | logger.error(f"Error initiating deep scan: {e}") |
| 12484 | return jsonify({'status': 'error', 'message': str(e)}), 500 |
| 12485 | |
| 12486 | # ============================================================================ |
| 12487 | # SYSTEM MANAGEMENT UTILITIES & ENDPOINTS |
| 12488 | # ============================================================================ |
| 12489 |