So, my current project is making paw-gps output the same format as the gps plugin does

The only problem with this is that i am sadly not good enough at java or anything else to do with this for that matter,
This is what a gps plugin file looks like {"Updated": "2019-11-14T12:26:35.09589078+01:00", "Latitude": 0.0000, "Longitude": 0.0000, "FixQuality": "0", "NumSatellites": 0, "HDOP": 99.99, "Altitude": 0, "Separation": 0}
And this is what currently a paw-gps file looks like {"long":25.00020152,"lat":62.00083852}
(Both files are edited to hide actual location)
Preferrably we would need to figure out a way to output the “updated” part, which is the time. The gps specific info shouldnt matter, but with my skills i just cannot do it. I only managed to output an unix timestamp once lol.
This page has the current beanshell/java/whatever code https://raw.githubusercontent.com/systemik/pwnagotchi-bt-tether/master/GPS-via-PAW and any help would be really appreciated. All of this is to make Paw-gps work with webgpsmap.

This is the data webgpsmap seems to need
gps_data: ssid (done), mac (done), longitude (done), latitude (done), timestamp of latest gps signal, timestamp of when the packet was captured (done), accuracy seems to be set at 50 always for gps https://github.com/evilsocket/pwnagotchi/blob/de62424dbcae2d95e17b88c688f10a786470fd8d/pwnagotchi/plugins/default/webgpsmap.py#L363

Found this, might be useful https://gist.github.com/gkhays/2f259acb7ded87df1fbc

I haven’t messed with paw-gps much past configuring and enabling yet, but if I recall it’s simply a webpage. Couldn’t the script inside gps.xhtml simply be slightly modified to include the current timestamp (possibly some string manipulation to format the same as gps outputs) in the page output?

Edit: Oh, sorry, looks like that’s what you were asking for help with?

1 Like

Yeah that is what im trying to figure out, its all editing that gps.xhtml file
Basically all we need is formatting and that timestamp

I have things I should be doing, but playing with this is more fun…lol. Let me see if I can figure out how the GPS xhtml works more than just a copy/paste, and see if I can figure something out.

1 Like

Thank you, and just a warning, it uses beanshell instead of normal java, dont know if that can be changed in any way https://en.wikipedia.org/wiki/BeanShell

Well, i’ve yet to try and test something. But I’m trying to find out how the timestamp is formed in the GPS plugin. Are you talking about the plugin in the pwnagotchi repo?

Yeah, thats the one, im pretty sure the gps plugin gets time from ntpd http://www.ntp.org/index.html
Maybe the paw server can be set up to run an ntp server?
Then have the plugin grab both gps and ntp data

It gets converted here in webgpsmap.py https://github.com/evilsocket/pwnagotchi/blob/de62424dbcae2d95e17b88c688f10a786470fd8d/pwnagotchi/plugins/default/webgpsmap.py#L286

Doesn’t the pwnagotchi already fetch NTP automatically on internet connection? If it’s connected to your phone via bt-tether, then it has internet. I haven’t set up any form of NTP nor do I have an RTC yet and it picks up proper time when i’ve checked.

In other news, i have to verify but i believe i found out how to do the proper time conversion, now to test it.

If you need me to do testing let me know
I have both webgpsmap and paw-gps set up and running

Unless i’m missing something, the GPS plugin would output the date formatted in a specific format. WebGPSMap then takes that specific format, and modifies it to the UNIX timestamp that it wants to work with. What I need to do is modify the output of gps.xhtml to include the timestamp in the same format that gps.py exports.

{“Updated”: “2019-11-14T12:26:35.09589078+01:00”, “Latitude”: 0.0000, “Longitude”: 0.0000, “FixQuality”: “0”, “NumSatellites”: 0, “HDOP”: 99.99, “Altitude”: 0, “Separation”: 0}

Will the output of gps.xhtml need to be exactly that?

Sounds good, I haven’t really sunk a ton of time into it but i haven’t gotten webgpsmap running yet and i don’t have a gps module for my pi. I will let you know when i get something working.

{"Updated": "2019-11-14T12:21:22.205494745+01:00", "Latitude": 0, "Longitude": 0, "FixQuality": "0", "NumSatellites": 0, "HDOP": 99.99, "Altitude": 0, "Separation": 0}
That is another obscured sample i got, so im guessing yes.

:+1:

Sanity check: Is this the correct output format for the date?

{“Updated”:“2019-11-15T15:06:33.45100000-0800”}

I actually dont know the output format, i just know the input has to match lol, ask @daPwnie, he is the one that made the plugin, or maybe @dadav can help aswell since they are both credited in the making of the plugin

I think i’ve matched it up so far, just adding in the extra bits to make it output exactly as the gps.py does…per your example…and as far as i understand it works.

1 Like

I can give it a test if you have a proof of concept