Login with username and password.
()
| 4650 | m = re.search( |
| 4651 | r'_([0-9a-fA-F]{2})_([0-9a-fA-F]{2})_([0-9a-fA-F]{2})' |
| 4652 | r'_([0-9a-fA-F]{2})_([0-9a-fA-F]{2})_([0-9a-fA-F]{2})$', name) |
| 4653 | if m: |
| 4654 | bssid = ':'.join(m.group(i).lower() for i in range(1, 7)) |
| 4655 | return name[:m.start()] or None, bssid, ext |
| 4656 | |
| 4657 | return name, None, ext |
| 4658 | |
| 4659 | |
| 4660 | def _read_gps_json_safe(filepath: str) -> Optional[dict]: |
| 4661 | """Read a Pwnagotchi .gps.json file. Returns dict with lat/lng or None.""" |
| 4662 | try: |
| 4663 | with open(filepath, 'r', encoding='utf-8') as fh: |
| 4664 | data = json.load(fh) |
| 4665 | lat = data.get('Latitude') or data.get('latitude') |
| 4666 | lng = data.get('Longitude') or data.get('longitude') |
| 4667 | if lat is None or lng is None: |
| 4668 | return None |
| 4669 | lat, lng = float(lat), float(lng) |
| 4670 | if lat == 0.0 and lng == 0.0: |
| 4671 | return None |
| 4672 | return { |
| 4673 | 'latitude': lat, |
| 4674 | 'longitude': lng, |
| 4675 | 'altitude': data.get('Altitude') or data.get('altitude'), |
| 4676 | 'accuracy': data.get('Accuracy') or data.get('accuracy'), |
| 4677 | 'updated': data.get('Updated') or data.get('updated'), |
| 4678 | } |
| 4679 | except (OSError, json.JSONDecodeError, ValueError, TypeError): |
| 4680 | return None |
| 4681 | |
| 4682 |
nothing calls this directly
no test coverage detected