Resolve a virtual per-network path to a real filesystem path. network_rel_path is the subdirectory relative to the network root, e.g.: 'loot/data_stolen', 'loot/credentials', 'output/scan_results', 'output/vulnerabilities' Returns None when the caller should show the netwo
(virtual_root, network_rel_path, path)
| 15726 | logger.error(f"Error getting Wi-Fi status: {e}") |
| 15727 | return jsonify({ |
| 15728 | 'error': str(e), |
| 15729 | 'wifi_connected': False, |
| 15730 | 'ap_mode_active': False, |
| 15731 | 'current_ssid': None, |
| 15732 | 'interface': None, |
| 15733 | 'interfaces': [] |
| 15734 | }), 500 |
| 15735 | |
| 15736 | |
| 15737 | @app.route('/api/wifi/scan-control', methods=['GET']) |
| 15738 | def get_wifi_scan_control(): |
| 15739 | try: |
| 15740 | interfaces = _gather_wifi_interfaces() |
| 15741 | state = _get_multi_interface_state() |
| 15742 | payload = state.get_state_payload() |
| 15743 | payload['available_interfaces'] = interfaces |
| 15744 | return jsonify({'success': True, **payload}) |
| 15745 | except Exception as exc: |
| 15746 | logger.error(f"Failed to read scan control state: {exc}") |
| 15747 | return jsonify({'success': False, 'error': str(exc)}), 500 |
| 15748 | |
| 15749 | |
| 15750 | def _toggle_scan_interface(enable: bool): |
| 15751 | state = _get_multi_interface_state() |
| 15752 | data = request.get_json(silent=True) or {} |
| 15753 | try: |
| 15754 | interface = _parse_wifi_interface_arg(data.get('interface')) |
| 15755 | except ValueError as invalid_iface: |
| 15756 | return jsonify({'success': False, 'error': str(invalid_iface)}), 400 |
| 15757 | if not interface: |
| 15758 | return jsonify({'success': False, 'error': 'interface is required'}), 400 |
| 15759 | |
| 15760 | if enable and not state.is_multi_mode_enabled(): |
| 15761 | try: |
| 15762 | state.update_scan_mode(mode=state.MODE_MULTI) |
| 15763 | except Exception as exc: |
| 15764 | logger.warning(f"Unable to switch to multi-interface mode automatically: {exc}") |
no test coverage detected