Created
March 31, 2011 20:00
-
-
Save le0pard/897131 to your computer and use it in GitHub Desktop.
Определите свое местоположение по WiFi сети
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iwlist wlan0 scan | sed -n 's/.* Address: //p;T;s/ //g;q' | | |
sed 's/.*/{version:1.1.0,host:maps.google.com,request_address:true,address_language:'${LANG/.*/}',wifi_towers:[{mac_address:"&",signal_strength:8,age:0}]}/' | | |
curl -sX POST -d @- www.google.com/loc/json | | |
sed -e 'h;s/.*latitude":\([^,]*\).*/\1/;G;s/\n[^\n]*longitude":\([^,]*\).*/,\1\n/;s|^|http://maps.google.com/maps?q=|;x;s/[,{]/\n/g;s/["}]//g;s/:/\t/g;s/\n//;G' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment