Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / scripts / networklocation / wps_harvest / reference / README.md
| 1 | # gs-loc protocol reference |
| 2 | |
| 3 | These two files are recovered from commit `cb9f1c384^`, which is the last commit before |
| 4 | `:networklocation` dropped its online Apple WPS client. They are **reference only** โ nothing |
| 5 | builds them. They are the specification the Rust client in `../src/gsloc.rs` implements. |
| 6 | |
| 7 | | File | What it pins | |
| 8 | | --- | --- | |
| 9 | | `apple_wps.proto` | The `gs-loc` wire schema: `WifiPositioning`, `CellPositioning`, and the `BeaconLocation` payload, including the per-beacon `horizontal_accuracy` field. | |
| 10 | | `ApplePositioningService.kt.txt` | The endpoint, the ASCII request envelope, the 10-byte response header, and the `1e8` coordinate scale. | |
| 11 | |
| 12 | Recover them again with: |
| 13 | |
| 14 | ```sh |
| 15 | git show cb9f1c384^:networklocation/src/main/proto/apple_wps.proto |
| 16 | git show cb9f1c384^:networklocation/src/main/java/com/vayunmathur/networklocation/apple/ApplePositioningService.kt |
| 17 | ``` |
| 18 | |
| 19 | ## The bits that matter |
| 20 | |
| 21 | **Endpoint** `POST https://gs-loc.apple.com/clls/wloc`, `Content-Type: |
| 22 | application/x-www-form-urlencoded`, with a spoofed `locationd` User-Agent. |
| 23 | |
| 24 | **Request envelope**, big-endian, wrapping the serialized protobuf: |
| 25 | |
| 26 | ``` |
| 27 | u16 1 version |
| 28 | u16 len, ascii locale "en_US" |
| 29 | u16 len, ascii identifier "com.apple.locationd" |
| 30 | u16 len, ascii version "8.4.1.12H321" |
| 31 | u32 1 |
| 32 | u32 0 |
| 33 | u16 payload_len |
| 34 | payload |
| 35 | ``` |
| 36 | |
| 37 | **Response**: a fixed 10-byte header, then the serialized protobuf. |
| 38 | |
| 39 | **Coordinates** are `int64` degrees x 1e8. `horizontal_accuracy` is `int32` metres; a negative |
| 40 | value (and the `(-1, -1)` coordinate pair) means "location unknown for this beacon". |
| 41 | |
| 42 | ## Why this is the whole harvester |
| 43 | |
| 44 | A request carries only beacon identifiers; the response echoes each identifier back with its |
| 45 | own location filled in. Apple does not return a device position. Critically, it returns *more* |
| 46 | beacons than were asked for โ querying one BSSID yields a few hundred nearby ones โ which is |
| 47 | what makes a snowball crawl possible: every response both answers the query and extends the |
| 48 | frontier. |