Periodically parse airodump-ng CSV and GPS output.
(self, csv_path: str)
| 1813 | return {'status': 'error', 'message': str(e)} |
| 1814 | |
| 1815 | def _wifi_csv_reader(self, csv_path: str): |
| 1816 | """Periodically parse airodump-ng CSV and GPS output.""" |
| 1817 | mode = 'wifi' |
| 1818 | stop_event = self.stop_events.get(mode) |
| 1819 | csv_file = csv_path + '-01.csv' |
| 1820 | gps_file = csv_path + '-01.gps' |
| 1821 | |
| 1822 | while not (stop_event and stop_event.is_set()): |
| 1823 | if os.path.exists(csv_file): |
| 1824 | try: |
| 1825 | # Parse GPS file for accurate coordinates (if available) |
| 1826 | gps_data = self._parse_airodump_gps(gps_file) if os.path.exists(gps_file) else None |
| 1827 | |
| 1828 | networks, clients = self._parse_airodump_csv(csv_file, gps_data) |
| 1829 | self.wifi_networks = networks |
| 1830 | self.wifi_clients = clients |
| 1831 | except Exception as e: |
| 1832 | logger.error(f"CSV parse error: {e}") |
| 1833 | |
| 1834 | time.sleep(2) |
| 1835 | |
| 1836 | logger.info("WiFi CSV reader stopped") |
| 1837 | |
| 1838 | def _parse_airodump_gps(self, gps_path: str) -> dict | None: |
| 1839 | """ |
nothing calls this directly
no test coverage detected