diff --git a/pwnagotchi/plugins/default/wigle.py b/pwnagotchi/plugins/default/wigle.py index 3a7bce7..c8c4b38 100644 --- a/pwnagotchi/plugins/default/wigle.py +++ b/pwnagotchi/plugins/default/wigle.py @@ -20,8 +20,14 @@ def _extract_gps_data(path): """ try: - with open(path, 'r') as json_file: - return json.load(json_file) + if path.endswith('.geo.json'): + with open(path, 'r') as json_file: + tempJson = json.load(json_file) + d = datetime.utcfromtimestamp(int(tempJson["ts"])) + return {"Latitude": tempJson["location"]["lat"], "Longitude": tempJson["location"]["lng"], "Altitude": 10, "Updated": d.strftime('%Y-%m-%dT%H:%M:%S.%f')} + else: + with open(path, 'r') as json_file: + return json.load(json_file) except OSError as os_err: raise os_err except json.JSONDecodeError as json_err: @@ -117,6 +123,7 @@ class Wigle(plugins.Plugin): self.options['donate'] = True self.ready = True + logging.info("WIGLE: ready") def on_internet_available(self, agent): """ @@ -134,7 +141,7 @@ class Wigle(plugins.Plugin): all_files = os.listdir(handshake_dir) all_gps_files = [os.path.join(handshake_dir, filename) for filename in all_files - if filename.endswith('.gps.json')] + if filename.endswith('.gps.json' or filename.endswith('.paw-gps.json') or filename.endswith('.geo.json')] all_gps_files = remove_whitelisted(all_gps_files, self.options['whitelist']) new_gps_files = set(all_gps_files) - set(reported) - set(self.skip) @@ -143,7 +150,12 @@ class Wigle(plugins.Plugin): csv_entries = list() no_err_entries = list() for gps_file in new_gps_files: - pcap_filename = gps_file.replace('.gps.json', '.pcap') + if gps_file.endswith('.gps.json'): + pcap_filename = gps_file.replace('.gps.json', '.pcap') + if gps_file.endswith('.paw-gps.json'): + pcap_filename = gps_file.replace('.paw-gps.json', '.pcap') + if gps_file.endswith('.geo.json'): + pcap_filename = gps_file.replace('.geo.json', '.pcap') if not os.path.exists(pcap_filename): logging.debug("WIGLE: Can't find pcap for %s", gps_file) self.skip.append(gps_file)