From 1e426f74117417d04f0f3ba2e7b86daf916bd60f Mon Sep 17 00:00:00 2001 From: xenDE Date: Mon, 4 Nov 2019 00:16:50 +0100 Subject: [PATCH] add timestamp to net-pos plugin, https://github.com/evilsocket/pwnagotchi/issues/308 added timestam as "ts" var in both .json files. tested with old plugin format. --- pwnagotchi/plugins/default/net-pos.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pwnagotchi/plugins/default/net-pos.py b/pwnagotchi/plugins/default/net-pos.py index 3f1f4e5..ab14e26 100644 --- a/pwnagotchi/plugins/default/net-pos.py +++ b/pwnagotchi/plugins/default/net-pos.py @@ -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