mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
Merge pull request #1054 from justin-p/paw-gps
Ensure paw-gps works when default values are used.
This commit is contained in:
@ -83,7 +83,7 @@ main.plugins.memtemp.scale = "celsius"
|
|||||||
main.plugins.memtemp.orientation = "horizontal"
|
main.plugins.memtemp.orientation = "horizontal"
|
||||||
|
|
||||||
main.plugins.paw-gps.enabled = false
|
main.plugins.paw-gps.enabled = false
|
||||||
main.plugins.paw-gps.ip = ""
|
main.plugins.paw-gps.ip = "192.168.44.1:8080"
|
||||||
|
|
||||||
main.plugins.ups_lite.enabled = false
|
main.plugins.ups_lite.enabled = false
|
||||||
main.plugins.ups_lite.shutdown = 2
|
main.plugins.ups_lite.shutdown = 2
|
||||||
|
@ -10,25 +10,30 @@ GUIDE HERE: https://community.pwnagotchi.ai/t/setting-up-paw-gps-on-android
|
|||||||
|
|
||||||
class PawGPS(plugins.Plugin):
|
class PawGPS(plugins.Plugin):
|
||||||
__author__ = 'leont'
|
__author__ = 'leont'
|
||||||
__version__ = '1.0.0'
|
__version__ = '1.0.1'
|
||||||
__name__ = 'pawgps'
|
__name__ = 'pawgps'
|
||||||
__license__ = 'GPL3'
|
__license__ = 'GPL3'
|
||||||
__description__ = 'Saves GPS coordinates whenever an handshake is captured. The GPS data is get from PAW on android '
|
__description__ = 'Saves GPS coordinates whenever an handshake is captured. The GPS data is get from PAW on android.'
|
||||||
|
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
logging.info("PAW-GPS loaded")
|
logging.info("[paw-gps] plugin loaded")
|
||||||
if 'ip' not in self.options or ('ip' in self.options and self.options['ip'] is None):
|
if 'ip' not in self.options or ('ip' in self.options and self.options['ip'] is None) or (len('ip' in self.options and self.options['ip']) is 0):
|
||||||
logging.info("PAW-GPS: No IP Address in the config file is defined, it uses the default (192.168.44.1:8080)")
|
logging.info("[paw-gps] no IP Address defined in the config file, will uses paw server default (192.168.44.1:8080)")
|
||||||
|
|
||||||
def on_handshake(self, agent, filename, access_point, client_station):
|
def on_handshake(self, agent, filename, access_point, client_station):
|
||||||
if 'ip' not in self.options or ('ip' in self.options and self.options['ip'] is None):
|
if 'ip' not in self.options or ('ip' in self.options and self.options['ip'] is None or (len('ip' in self.options and self.options['ip']) is 0)):
|
||||||
ip = "192.168.44.1:8080"
|
ip = "192.168.44.1:8080"
|
||||||
else:
|
else:
|
||||||
ip = self.options['ip']
|
ip = self.options['ip']
|
||||||
|
|
||||||
gps = requests.get('http://' + ip + '/gps.xhtml')
|
try:
|
||||||
gps_filename = filename.replace('.pcap', '.paw-gps.json')
|
gps = requests.get('http://' + ip + '/gps.xhtml')
|
||||||
|
try:
|
||||||
logging.info("saving GPS to %s (%s)" % (gps_filename, gps))
|
gps_filename = filename.replace('.pcap', '.paw-gps.json')
|
||||||
with open(gps_filename, 'w+t') as f:
|
logging.info("[paw-gps] saving GPS data to %s" % (gps_filename))
|
||||||
f.write(gps.text)
|
with open(gps_filename, 'w+t') as f:
|
||||||
|
f.write(gps.text)
|
||||||
|
except Exception as error:
|
||||||
|
logging.error(f"[paw-gps] encountered error while saving gps data: {error}")
|
||||||
|
except Exception as error:
|
||||||
|
logging.error(f"[paw-gps] encountered error while getting gps data: {error}")
|
||||||
|
Reference in New Issue
Block a user