added timestam as "ts" var in both .json files.
tested with old plugin format.
This commit is contained in:
xenDE 2019-11-04 00:16:50 +01:00 committed by GitHub
parent 04e551600d
commit 1e426f7411
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@ import logging
import json
import os
import requests
import time
import pwnagotchi.plugins as plugins
from pwnagotchi.utils import StatusFile
@ -10,7 +11,7 @@ MOZILLA_API_URL = 'https://location.services.mozilla.com/v1/geolocate?key={api}'
class NetPos(plugins.Plugin):
__author__ = 'zenzen san'
__version__ = '2.0.0'
__version__ = '2.0.1'
__license__ = 'GPL3'
__description__ = """Saves a json file with the access points with more signal
whenever a handshake is captured.
@ -95,6 +96,7 @@ class NetPos(plugins.Plugin):
def on_handshake(self, agent, filename, access_point, client_station):
netpos = self._get_netpos(agent)
netpos["ts"] = int("%.0f" % time.time())
netpos_filename = filename.replace('.pcap', '.net-pos.json')
logging.info("NET-POS: Saving net-location to %s", netpos_filename)
@ -129,6 +131,9 @@ class NetPos(plugins.Plugin):
result = requests.post(geourl,
json=data,
timeout=timeout)
return result.json()
return_geo = result.json()
if data["ts"]:
return_geo["ts"] = data["ts"]
return return_geo
except requests.exceptions.RequestException as req_e:
raise req_e