9.30.2008

Speaking of wi-fi...

If you happen to be using OS X, eventually you'll wonder why in the hell you can't observe the SNR, RSSI, or channel of any access points, connected or otherwise. What's more, if you're familiar with iwconfig under GNU/Linux, you'll probably want something that works from a terminal session. Well, it turns out that just such a tool has already been provided; it just takes a fair amount of searching and a small amount of setup to start using it.

The utility of which I speak is none other than the airport command. However, if you type this in a terminal, you'll find that it's not actually in your PATH environment variable. And where might it be? Heh... It is seriously buried:

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport

Yeah, I'm not kidding: they really hid the hell out of it. And how might we use this in a more sane manner? Just create a symbolic link. I tossed mine into /usr/sbin/, like this:

sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin

Once you do that, just type 'airport -s' in any old terminal to scan for wireless signals and return a list of nearby, broadcasting AP's. Here's the output I get:

absinthe:~ jstorm$ airport -s
SSID BSSID RSSI CHANNEL SECURITY (auth/unicast/group)
beware 00:1d:7e:62:42:c9 -62 6 WPA(PSK/TKIP/TKIP)
bloodgulch 00:1c:f0:58:8c:0d -60 4 WEP
kanseikan 00:14:bf:46:79:1c -47 1 WPA2(PSK/AES/AES)
2WIRE211 00:22:a4:64:f6:b1 -39 11 WPA2(PSK/AES/AES)


If you'd like to take a closer look at the setup of the currently connected AP, just use the 'I' parameter, like so:

absinthe:~ jstorm$ airport -I
agrCtlRSSI: -40
agrExtRSSI: 0
agrCtlNoise: -94
agrExtNoise: 0
state: running
op mode: station
lastTxRate: 54
maxRate: 54
lastAssocStatus: 0
802.11 auth: open
link auth: wpa2-psk
BSSID: 0:22:a4:64:f6:b1
SSID: 2WIRE211
MCS: -1
channel: 11


There are other things you can do with the airport command, but--by far--these are the two commands that I use most often. Most everything else is better done from the GUI.

Cheers.

No comments:

Post a Comment