Enabled wigle to use .geo.json and .paw-gps.json files #1027
-Incorporated changes from dbukovac/pwnagotchi on Github
This commit is contained in:
parent
fe0b23625b
commit
29aa46a468
@ -20,8 +20,14 @@ def _extract_gps_data(path):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(path, 'r') as json_file:
|
if path.endswith('.geo.json'):
|
||||||
return json.load(json_file)
|
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:
|
except OSError as os_err:
|
||||||
raise os_err
|
raise os_err
|
||||||
except json.JSONDecodeError as json_err:
|
except json.JSONDecodeError as json_err:
|
||||||
@ -117,6 +123,7 @@ class Wigle(plugins.Plugin):
|
|||||||
self.options['donate'] = True
|
self.options['donate'] = True
|
||||||
|
|
||||||
self.ready = True
|
self.ready = True
|
||||||
|
logging.info("WIGLE: ready")
|
||||||
|
|
||||||
def on_internet_available(self, agent):
|
def on_internet_available(self, agent):
|
||||||
"""
|
"""
|
||||||
@ -134,7 +141,7 @@ class Wigle(plugins.Plugin):
|
|||||||
all_files = os.listdir(handshake_dir)
|
all_files = os.listdir(handshake_dir)
|
||||||
all_gps_files = [os.path.join(handshake_dir, filename)
|
all_gps_files = [os.path.join(handshake_dir, filename)
|
||||||
for filename in all_files
|
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'])
|
all_gps_files = remove_whitelisted(all_gps_files, self.options['whitelist'])
|
||||||
new_gps_files = set(all_gps_files) - set(reported) - set(self.skip)
|
new_gps_files = set(all_gps_files) - set(reported) - set(self.skip)
|
||||||
@ -143,7 +150,12 @@ class Wigle(plugins.Plugin):
|
|||||||
csv_entries = list()
|
csv_entries = list()
|
||||||
no_err_entries = list()
|
no_err_entries = list()
|
||||||
for gps_file in new_gps_files:
|
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):
|
if not os.path.exists(pcap_filename):
|
||||||
logging.debug("WIGLE: Can't find pcap for %s", gps_file)
|
logging.debug("WIGLE: Can't find pcap for %s", gps_file)
|
||||||
self.skip.append(gps_file)
|
self.skip.append(gps_file)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user