使用Google地理定位API通过MAC地址对802.11接入点进行地理定位 [英] Geolocating 802.11 access points by MAC address using Google Geolocation API

查看:205
本文介绍了使用Google地理定位API通过MAC地址对802.11接入点进行地理定位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对大多数浏览器现在都支持Google Geolocation API。他们这样做的部分原因是,向Google发送附近802.11接入点的MAC地址(那些信标由您的计算机捕获的)。

Support for the Google Geolocation API is now built in to most browsers. They do this, in part, by sending to Google the MAC address of nearby 802.11 access points (those whose beacons are captured by your computer.)

我有一个很大的数字从不同位置捕获的802.11数据包。我正在寻找802.11接入点的地理定位。假设我们只有他们的mac地址。这应该可以通过使用谷歌地理定位API。

I have a large number of 802.11 packets captured from various locations. I'm looking to geolocate the 802.11 access points. Assume that we only have their mac addresses. This should be possible by using the Google Geolocation API.

我发现迄今为止可能对此有用的信息包括:

Sources that I've found to date that might be helpful on this include:

  • Geolocation source code from Mozilla 1.9.1 code base
  • MDN article on Monitoring WiFi access points
  • MDN article on using geolocation
  • Mozilla WebDev article on using Geolocation in the Browser

第一个可能是最好的选择。问题是,我不知道如何使用那里的例子,并且实际上创建了一个让我管理MAC地址并输出纬度/长度对的程序。我也不确定如何从Unix / MacOS命令行运行JavaScript。

The first is probably the best bet. Problem is, I'm not sure how to use the example there and actually create a program that lets me pipe in the MAC addresses and output lat/long pairs. I'm also not sure how to run JavaScript from a Unix/MacOS command line.

我知道这有很多要问,但有没有人有任何线索我应该从哪里开始?

I know that this is a lot to ask, but does anybody have any clue where I should start?

推荐答案

<?php

$mac = $_SERVER['argv'][1];


$postData = '{
    "version": "1.1.0", 
    "wifi_towers": [{
        "mac_address": "' . $mac . '", 
        "ssid": "0", 
        "signal_strength":-72
    }]
}';

$opts = array(
  'http'=>array(
    'method' => "POST",
    'header'  => 'Content-type: application/x-www-form-urlencoded',
    'content' => $postData
  )
);


$response = file_get_contents(
    'http://www.google.com/loc/json', 
    false, 
    stream_context_create($opts)
);

$loc = json_decode($response, true);

echo $loc['location']['latitude'];
echo ',';
echo $loc['location']['longitude'];

命令行用法:

Command line usage:

php geo.php "mac addy here"

这篇关于使用Google地理定位API通过MAC地址对802.11接入点进行地理定位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆