Skip to content

Instantly share code, notes, and snippets.

@parvez
Created March 29, 2012 11:15
Show Gist options
  • Save parvez/2236007 to your computer and use it in GitHub Desktop.
Save parvez/2236007 to your computer and use it in GitHub Desktop.
wifi info to location
`airport -s -x | egrep 'BSSID|>CHANNEL<|NOISE|SSID_STR|RSSI' --after-context=1 \
| egrep -v "AGE|array|WPA|80211" | tr '\n' ' ' | tr -d '\t' \
| sed -e 's/<[^>]*>//g' \
-e 's/ -- /, /g' \
-e 'y/:/-/' \
-e 's/ \([0-9]\)-/ 0\1-/g' -e 's/-\([0-9]\)\([-|,]\)/-0\1\2/g' \
-e 's/BSSID \([a-f0-9-]*\)/{"mac_address": "\1"/g' \
-e 's/CHANNEL \([0-9]*\)/"channel": \1/g' \
-e 's/NOISE \([0-9]*\)/"signal_to_noise": \1/g' \
-e 's/RSSI \([0-9]*\)/"signal_strength": \1/g' \
-e 's/SSID_STR \([^,]*\)/"ssid": "\1"}/g' \
-e 's/ "\([,|}]\)/"\1/g' \
-e 's/"/\\"/g'`
getter -X POST -H "Content-Type: application/json" -d "{JSON_OUTPUT_FROM_ABOVER}" http://www.google.com/loc/json
@parvez
Copy link
Author

parvez commented Mar 29, 2012

{
"requestUrl": "https://www.google.com/loc/json",
"requestMethod": "POST",
"requestBody": "{\n "version": "1.1.0", \n "wifi_towers": [{\n "mac_address": "00:00:00:00:00:00", \n "ssid": "0", \n "signal_strength":-72\n }]\n}",
"headers": [
"Content-type",
"application/x-www-form-urlencoded"
]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment