Parse nmap ping scan output to extract IP addresses and MAC addresses
(output)
| 8637 | resp.headers['Pragma'] = 'no-cache' |
| 8638 | resp.headers['Expires'] = '0' |
| 8639 | return resp |
| 8640 | |
| 8641 | |
| 8642 | @app.route('/') |
| 8643 | def index(): |
| 8644 | """Serve the main dashboard page or captive portal for AP clients""" |
| 8645 | if is_ap_client_request(): |
| 8646 | # KEY1 wardriving AP: land straight on the minimal wardriving page. |
| 8647 | if getattr(shared_data, 'wardrive_ap_active', False): |
| 8648 | return _no_store(make_response(send_from_directory('web', 'wardrive_mobile.html'))) |
| 8649 | # Serve captive portal for AP clients |
| 8650 | return _no_store(make_response(send_from_directory('web', 'captive_portal.html'))) |
| 8651 | else: |
| 8652 | # Serve main dashboard for regular users |
| 8653 | return _no_store(make_response(send_from_directory('web', 'index_modern.html'))) |
| 8654 | |
| 8655 | |
| 8656 | # Minimal wardriving-only page (served by the KEY1 phone-access AP) |
| 8657 | @app.route('/wardrive') |
| 8658 | def wardrive_mobile(): |
| 8659 | """Lightweight, offline-safe live wardriving page (stats + canvas map).""" |
| 8660 | return send_from_directory('web', 'wardrive_mobile.html') |
| 8661 | |
| 8662 | |
| 8663 | # Add explicit captive portal route |
| 8664 | @app.route('/portal') |
| 8665 | def captive_portal(): |
| 8666 | """Explicit captive portal route""" |
| 8667 | return send_from_directory('web', 'captive_portal.html') |
| 8668 | |
| 8669 | # WiFi configuration page route |
| 8670 | @app.route('/wifi-config') |
| 8671 | def wifi_config_page(): |
| 8672 | """Serve the Wi-Fi configuration page for AP clients and regular users""" |
| 8673 | return send_from_directory('web', 'wifi_config.html') |
| 8674 | |
| 8675 | # Alternative routes for WiFi config (for compatibility) |
| 8676 | @app.route('/wifi') |
| 8677 | @app.route('/setup') |
| 8678 | def wifi_config_alt(): |
| 8679 | """Alternative routes for Wi-Fi configuration""" |
| 8680 | return send_from_directory('web', 'wifi_config.html') |
| 8681 | |
| 8682 | |
| 8683 | def _any_sdr_present(): |
| 8684 | """True if a HackRF or RTL-SDR is currently detected. Uses each backend's |
| 8685 | status() (which reports from cache while a capture streams, so this never |
| 8686 | knocks a running sweep off the USB bus). Best-effort — any probe error |
| 8687 | reads as 'not present'.""" |
no test coverage detected