(action, ip)
| 15107 | return jsonify({'success': False, 'error': str(exc)}), 500 |
| 15108 | |
| 15109 | |
| 15110 | @app.route('/api/network/threat-sweep', methods=['POST']) |
| 15111 | def network_threat_sweep(): |
| 15112 | """Quick 10-second WiFi airspace scan to detect rogue APs, evil twins, and suspicious SSIDs.""" |
| 15113 | try: |
| 15114 | import re as _re |
| 15115 | |
| 15116 | # Allow the caller to choose which WiFi interface to sweep with; fall |
| 15117 | # back to the configured/auto-detected one. Validate against real wireless |
| 15118 | # interfaces so we never shell out with an arbitrary string. |
| 15119 | req = request.get_json(silent=True) or {} |
| 15120 | _req_iface = (req.get('interface') or '').strip() |
| 15121 | iface = _get_wifi_iface() |
| 15122 | if _req_iface: |
| 15123 | try: |
| 15124 | import wifi_analyzer as _wa |
| 15125 | _valid = {i.get('iface') for i in _wa.list_wifi_interfaces()} |
no test coverage detected