I've been trying to figure how a html5 browser like chrome or firefox performs geolocation under the hood but I'm running into some difficulties.
navigator.geolocation.getCurrentPosition (success_func) but before
success_func actually gets called back. I want to know how the browser goes about obtaining the latitude and longitude coordinates. What's the protocol it uses? What servers does it query to obtain this information? etc.
Here's what I have determined and tried:
- Chrome and Firefox uses the MAC of nearby wifi access points to obtain geolocation by sending it to googlesapi.com. It is this MAC-wifi based implementation I am most interested in.
- By the time
success_funcgets called, the browser has already obtained the geolocation data.
- I made limited progress using proxy and packet captures like tcpcatcher and wireshark. I see a query is being made to
googleapis.com:443but of course it's over tls/ssl which means I can't read it. (using ssl monitor in tcpcatcher causes geoloc to fail in browser)
- I tried using builtin devtool and console in browser but it seems to omit the communication that grabs the geoloc data. For example, using chrome's devtool (ctrl+shift+I), it does not show any
CONNECTmethods or connections to
googleapis.comeven though tcpcatcher clearly captures that during geolocation.
- I've tried looking at the source to determine this but not having much luck. The problem is that browser codebases are just humongous and locating the pertinent class and source files would be difficult especially since I'm unfamiliar with their overall design. grepping for interesting keywords only goes so far.
If you guys were trying to determine and reverse the protocol a given browser uses to implement geolocation how would you guys proceed?
Here are some things I've already looked at that I found helpful:
The problem is some of the info mentioned there is out-of-date and no longer accurate. My aim now is to figure out exactly what changed and how an external custom application can use this protocol itself for geolocation.