Reputation: 99
This is a general programming question although I would prefer a Node.js-geared solution. Are there any JavaScript or .NET APIs for retrieving a list of wireless access points and their associated data (SSID, MAC address, etc.)? I used TamperData to see what happens when you share your location with Firefox and got this request URL:
https://maps.googleapis.com/maps/api/browserlocation/json?browser=firefox&sensor=true&wifi=mac:b8-c7-5d-07-6e-cf|ssid:TV2 Network|ss:-58&wifi=mac:00-13-10-8d-a7-32|ssid:LUBIN|ss:-61&wifi=mac:62-4c-fe-9c-08-18|ssid:airportthru|ss:-73&wifi=mac:00-24-93-0c-49-e0|ssid:Custom Gifts Memphis|ss:-87&wifi=mac:98-fc-11-69-35-46|ssid:linksys|ss:-87&wifi=mac:00-0f-cc-6d-ba-ac|ssid:3333|ss:-88&wifi=mac:40-b7-f3-5b-2c-60|ssid:ATT456|ss:-88&wifi=mac:00-c0-02-7d-5f-4e|ssid:iHub_0060350392e0|ss:-89&wifi=mac:00-24-b2-d5-df-9a|ssid:Memphis CPA|ss:-89&wifi=mac:06-02-6f-c3-06-27|ssid:3333|ss:-89&wifi=mac:00-27-0d-55-c3-20|ssid:custard|ss:-90&wifi=mac:a2-a1-15-0d-a8-68|ssid:SETUP|ss:-90&wifi=mac:00-0f-cc-76-5b-2c|ssid:3545 2340|ss:-92&wifi=mac:c0-3f-0e-6e-ac-34|ssid:patricia|ss:-92
... which, when executed, returns a JSON object with exactly what I'm seeking: latitude and longitude coordinates. The object for this example is:
{
"accuracy" : 49.0,
"location" : {
"lat" : 35.06993630,
"lng" : -89.88568730
},
"status" : "OK"
}
CURIOUS: how is the accuracy here represented? I am fairly certain it's not a percentage because other requests with less access points listed return a higher integer. For example, when removing every WAP except the first listed, I get an accuracy of 43000.0
.
I have been investigating the way the Node version of prey interacts with a similar Google service and it follows the same suit of passing a list of WAPs and their info. I am trying to extract the bits of their code that accomplish this task but I am having trouble even getting the project to run properly. If anyone has any information, I would greatly appreciate it, as I have a wonderful project in mind that makes use of such technology. Thanks!
Upvotes: 4
Views: 8849
Reputation:
This is truly only capable through Java applet or an application on the host computer. Chrome and other browsers achieve this by having an application on the users computer. This application forwards the data securely through an Https request and passes your mac id ans ssid to lets say Google. Here Google replies with its best guess on your location.
Upvotes: 5
Reputation: 18796
The node_wifi_location npm package retrieves a list of available wireless access points from the local machine’s wireless card, and optionally passes them to the Google location API to retrieve the location of the machine. It relies on the wifi command-line utilities for the operating system, since each platform has its own APIs for accessing wifi hardware. There is no JavaScript API within any browser for retrieving the list of access points, only an API for retrieving location (the HTML5 geolocation API).
var wifiLocation = require('wifi_location');
wifiLocation.wifiTowers(function (err, accessPoints) {
// accessPoints contains an array of access point objects
// with ssid, mac_address, signal_strength keys
});
wifiLocation.location(function (err, location) {
// location contains the location object from the Google Maps API
});
Upvotes: 1