Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Location verification on server failed #19

Open
dancesWithCycles opened this issue Sep 1, 2023 · 5 comments
Open

Location verification on server failed #19

dancesWithCycles opened this issue Sep 1, 2023 · 5 comments

Comments

@dancesWithCycles
Copy link

Hi folks,
Thank you so much for providing and maintaining this repository!

I stumbled of this repo and jumped straight into a PoC setup. This is where I am stuck right now.

The app is running on Android. I called gpsd on the public accessible server like this.

sudo gpsd -N upd://*:65535

I can verify that the server receives location data like this.

nc -vlup 65535 2>&1;

Here is an example output.

$GPGSV,4,1,14,01,00,000,30,02,44,137,29,03,77,275,24,04,30,191,22,1*61

$GPGSV,4,2,14,17,43,281,22,19,30,307,21,21,36,136,20,28,23,071,29,1*67

$GPGSV,4,3,14,31,18,102,20,32,15,043,23,06,04,303,,09,07,206,,1*67

$GPGSV,4,4,14,12,02,357,,22,02,268,,1*6F

$GLGSV,2,1,08,69,57,223,19,85,11,323,19,67,14,043,22,68,64,042,20,1*79

$GLGSV,2,2,08,77,10,043,,76,11,358,,84,70,306,,83,38,151,,1*72

$GAGSV,3,1,10,02,02,008,,07,26,047,,10,26,303,,11,01,305,,7*7A

$GAGSV,3,2,10,12,52,299,,19,41,189,,24,00,000,,25,07,323,,7*7C

$GAGSV,3,3,10,26,18,129,,33,66,139,,7*7E

$GBGSV,3,1,10,06,32,056,22,16,29,049,26,20,36,232,23,02,02,101,,1*71

$GBGSV,3,2,10,09,36,073,,24,04,009,,25,07,060,,27,14,158,,1*7F

$GBGSV,3,3,10,29,44,296,,30,54,198,,1*73

$GNGSA,A,3,02,03,04,17,19,21,28,31,32,,,,1.1,0.7,0.8,1*3F

$GNGSA,A,3,67,68,69,85,,,,,,,,,1.1,0.7,0.8,2*30

$GNGSA,A,3,06,16,20,,,,,,,,,,1.1,0.7,0.8,4*38

$GNVTG,,T,,M,0.0,N,0.0,K,A*3D

$GNDTM,P90,,0000.000025,S,00000.000000,E,0.972,W84*55

$GNRMC,101854.00,A,5215.953038,N,01026.370460,E,0.0,,010923,0.0,E,A,V*7B

$GNGNS,101854.00,5215.953038,N,01026.370460,E,AANANN,16,0.7,90.5,46.0,,,V*1E

$GNGGA,101854.00,5215.953038,N,01026.370460,E,1,12,0.7,90.5,M,46.0,M,,*45

Anyhow, the data the server receives from the phone (I tested Android 9 and 11) seems not enough to get location information.

This is what gps clients on the server response on the data provided by the phone.

$ gpspipe -w
{"class":"VERSION","release":"3.22","rev":"3.22","proto_major":3,"proto_minor":14}
{"class":"DEVICES","devices":[]}
{"class":"WATCH","enable":true,"json":true,"nmea":false,"raw":0,"scaled":false,"timing":false,"split24":false,"pps":false}
$ gpsmon
tcp://localhost:2947          JSON slave driver>
(82) {"class":"VERSION","release":"3.22","rev":"3.22","proto_major":3,"proto_minor":14}
(32) {"class":"DEVICES","devices":[]}
(122) {"class":"WATCH","enable":true,"json":false,"nmea":false,"raw":2,"scaled":false,"timing":false,"split24":false,"pps":true}
$ cgps
{"class":"VERSION","release":"3.22","rev":"3.22","proto_major":3,"proto_minor":14}
{"class":"DEVICES","devices":[]}
{"class":"WATCH","enable":true,"json":true,"nmea":false,"raw":0,"scaled":false,"timing":false,"split24":false,"pps":false}

I appreciate any hint that helps me fix my setup! Cheers!

@julianoborba
Copy link

julianoborba commented Oct 15, 2023

@dancesWithCycles , please try the following at the server (here, I'm running it daemonized):

sudo gpsd -F /var/run/gpsd.sock udp://0.0.0.0:65535

Where

-F FILE, --sockfile FILE

    Create a control socket for device addition and removal commands. Default is None. You must specify a valid pathname on your local filesystem; this will be created as a Unix-domain socket to which you can write commands that edit the daemon’s internal device list.

0.0.0.0 in this context should means it will accept connections on all interfaces and on any IP address assigned to the server.

@dancesWithCycles
Copy link
Author

sudo gpsd -F /var/run/gpsd.sock udp://0.0.0.0:65535

gpsd

$ sudo gpsd -F /var/run/gpsd.sock udp://0.0.0.0:65535

netcut

$ nc -vlup 65535 2>&1;
listening on [any] 65535 ...
connect to [83.223.91.130] from p5de9b702.dip0.t-ipconnect.de [93.233.183.2] 38905
$GPGSV,3,1,12,05,18,205,23,08,00,000,18,10,02,337,22,13,73,143,31,1*68

$GPGSV,3,2,12,14,51,068,20,15,62,278,25,17,19,113,18,19,07,136,22,1*6E

$GPGSV,3,3,12,22,63,097,33,23,26,310,23,24,30,267,26,30,24,081,25,1*63

$GLGSV,3,1,10,73,65,237,31,80,52,043,19,88,09,348,16,81,14,039,26,1*7B

$GLGSV,3,2,10,71,71,282,24,72,25,323,22,74,18,230,,70,43,168,,1*72

$GLGSV,3,3,10,82,01,082,,79,01,047,,1*74

$GAGSV,3,1,09,02,20,205,27,05,37,137,25,08,30,302,18,24,43,057,30,7*7A

$GAGSV,3,2,09,25,65,165,33,03,78,240,,13,02,295,,26,07,343,,7*7E

$GAGSV,3,3,09,33,00,000,,7*4A

$GBGSV,2,1,05,23,37,237,29,24,30,063,21,25,85,147,22,10,35,066,,1*74

$GBGSV,2,2,05,12,05,091,,1*4D

$GNGSA,A,3,05,13,14,15,17,19,22,23,24,30,,,1.0,0.7,0.7,1*3C

$GNGSA,A,3,71,72,73,80,81,88,,,,,,,1.0,0.7,0.7,2*35

$GNGSA,A,3,24,25,,,,,,,,,,,1.0,0.7,0.7,3*33

$GNGSA,A,3,23,,,,,,,,,,,,1.0,0.7,0.7,4*34

$GNVTG,,T,,M,0.0,N,0.0,K,A*3D

$GNDTM,P90,,0000.000025,S,00000.000000,E,0.972,W84*55

$GNRMC,153350.00,A,5215.952351,N,01026.370068,E,0.0,,171023,0.0,E,A,V*7D

$GNGNS,153350.00,5215.952351,N,01026.370068,E,AAAANN,19,0.7,84.6,46.0,,,V*11

$GNGGA,153350.00,5215.952351,N,01026.370068,E,1,12,0.7,84.6,M,46.0,M,,*4A

cgps

┌───────────────────────────────────────────┐┌──────────────────Seen  0/Used  0┐
│ Time:          n/a (0)                    ││GNSS   PRN  Elev   Azim   SNR Use│
│ Latitude:        n/a                      ││                                 │
│ Longitude:       n/a                      ││                                 │
│ Alt (HAE, MSL):        n/a,       n/a     ││                                 │
│ Speed:           n/a                      ││                                 │
│ Track (true, var):                n/a deg ││                                 │
│ Climb:           n/a                      ││                                 │
│ Status:         NO FIX (0 secs)           ││                                 │
│ Long Err  (XDOP, EPX):  n/a ,  n/a        ││                                 │
│ Lat Err   (YDOP, EPY):  n/a ,  n/a        ││                                 │
│ Alt Err   (VDOP, EPV):  n/a ,  n/a        ││                                 │
│ 2D Err    (HDOP, CEP):  n/a ,  n/a        ││                                 │
│ 3D Err    (PDOP, SEP):  n/a ,  n/a        ││                                 │
│ Time Err  (TDOP):       n/a               ││                                 │
│ Geo Err   (GDOP):       n/a               ││                                 │
│ ECEF X, VX:              n/a    n/a       ││                                 │
│ ECEF Y, VY:              n/a    n/a       ││                                 │
│ ECEF Z, VZ:              n/a    n/a       ││                                 │
│ Speed Err (EPS):        n/a               ││                                 │
│ Track Err (EPD):        n/a               ││                                 │
│ Time offset:            n/a               ││                                 │
│ Grid Square:            n/a               ││                                 │
└───────────────────────────────────────────┘└─────────────────────────────────┘

{"class":"VERSION","release":"3.22","rev":"3.22","proto_major":3,"proto_minor":14}
{"class":"DEVICES","devices":[{"class":"DEVICE","path":"udp://0.0.0.0:65535","driver":"NMEA0183","activated":"2023-10-17T15:34:26.036Z","flags":1}]}
{"class":"WATCH","enable":true,"json":true,"nmea":false,"raw":0,"scaled":false,"timing":false,"split24":false,"pps":false}

gpspipe -w

$ gpspipe -w
{"class":"VERSION","release":"3.22","rev":"3.22","proto_major":3,"proto_minor":14}
{"class":"DEVICES","devices":[{"class":"DEVICE","path":"udp://0.0.0.0:65535","driver":"NMEA0183","activated":"2023-10-17T15:34:26.036Z","flags":1}]}
{"class":"WATCH","enable":true,"json":true,"nmea":false,"raw":0,"scaled":false,"timing":false,"split24":false,"pps":false}

gpsmon

tcp://localhost:2947          JSON slave driver>
(82) {"class":"VERSION","release":"3.22","rev":"3.22","proto_major":3,"proto_minor":14}
(148) {"class":"DEVICES","devices":[{"class":"DEVICE","path":"udp://0.0.0.0:65535","driver":"NMEA0183","activated":"2023-10-17T15:34:26.036Z","flags":1}]}
(122) {"class":"WATCH","enable":true,"json":false,"nmea":false,"raw":2,"scaled":false,"timing":false,"split24":false,"pps":true}

@julianoborba Thank you very much for your suggestion. Anyhow, as you can see from the logs, this setup is still not working. Any idea? Appreciate!

@julianoborba
Copy link

julianoborba commented Oct 18, 2023

Hmmm... @dancesWithCycles ,

Looks like your server is ok, the app too, but maybe some issue with your Android device. Silly question, did you tried this setup while outdoors with a clear view of the sky?

I can reproduce this just if I run GPSd on server, run Android GPSd Forwarder and then inactivate my Android's GPS. Just for test, try another application just to pinpoint your location on a map with GPS only, maybe your Android aren't receiving satellite data in between the time of your waiting:

┌───────────────────────────────────────────┐┌─────────────────────────────────┐
│    Time:       n/a                        ││PRN:   Elev:  Azim:  SNR:  Used: │
│    Latitude:   n/a                        ││                                 │
│    Longitude:  n/a                        ││                                 │
│    Altitude:   n/a                        ││                                 │
│    Speed:      n/a                        ││                                 │
│    Heading:    n/a                        ││                                 │
│    Climb:      n/a                        ││                                 │
│    Status:     NO FIX (1 secs)            ││                                 │
│    Longitude Err:   n/a                   ││                                 │
│    Latitude Err:    n/a                   ││                                 │
│    Altitude Err:    n/a                   ││                                 │
│    Course Err:      n/a                   ││                                 │
│    Speed Err:       n/a                   ││                                 │
│    Time offset:     n/a                   ││                                 │
│    Grid Square:     n/a                   ││                                 │
└───────────────────────────────────────────┘└─────────────────────────────────┘


ue,"nmea":false,"raw":0,"scaled":false,"timing":false,"split24":false,"pps":false}

9:02.837Z","flags":1}]}
{"class":"WATCH","enable":true,"json":true,"nmea":false,"raw":0,"scaled":false,"timing":false,"split24":false,"pps":false}


Also double check the granted permissions for the app, and be aware of battery management feature willing to block the app. But I don't think this is the cause.

@dancesWithCycles
Copy link
Author

Dear @julianoborba ,

Looks like your server is ok, the app too, but maybe some issue with your Android device. Silly question, did you tried this setup while outdoors with a clear view of the sky?

Yes!

I can reproduce this just if I run GPSd on server, run Android GPSd Forwarder and then inactivate my Android's GPS. Just for test, try another application just to pinpoint your location on a map with GPS only, maybe your Android aren't receiving satellite data in between the time of your waiting:

I tried the apps gpstest and also a map app to verify working gps on Android version 8, 9 and 11.

Still, while the gpstest app on Android looks fine, nc on the server receives some data, the data is not enough for cgps, gpspipe or gpsmon on the server to make some sense out of the received data.

What Android version and verification apps have you (@julianoborba ) used? What is your exact test setup?

Cheers!

@julianoborba
Copy link

@dancesWithCycles

the data is not enough for cgps, gpspipe or gpsmon on the server to make some sense out of the received data.

I'm out of ideas. Sorry.

What Android version and verification apps have you used? What is your exact test setup?

I'm running Android 9 with 1.0.4 release of GPSd Forwarder apk as client and good old WiFi Pineapple Nano as a GPS server, built with OpenWrt 19.07 and GPSd gpsd 3.17 (revision 3.17). In my case, the Pineapple fires a management AP, so my Android connect in that AP to share the same network, this way the apk and server stay in touch. It's an offline setup.

I run gpsd the same way I suggested to you, I use only cpgs for some tests. Everything works fine.

I just found a parameter in gpsd doc by the time of that reply. Give it a try, but be aware of the privacy implications (it is probably a good idea to harden your site with some firewall):

~ https://gpsd.gitlab.io/gpsd/gpsd.html

-G, --listenany

    This flag causes gpsd to listen on all addresses (INADDR_ANY) rather than just the loop back (INADDR_LOOPBACK) address. For the sake of privacy and security, gpsd information is private by default to the local machine until the user makes an effort to expose this to the world.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants