A Hidden Gem – airport command-line tool

Following on from Darren’s series of blogs on bash I thought I would add a hidden gem.

The command line airport tool allows you to scan for Wi-Fi networks and sniff a Wi-Fi interface amongst others. The tool is buried deep in the System.

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

Although there is a man page it doesn’t contain any information, but if you type airport and hit return it will display a help screen.

To scan for networks…

bash-3.2# ./airport -s
SSID BSSID RSSI CHANNEL HT CC SECURITY (auth/unicast/group)
NetgearJohnG e0:46:9a:13:9a:e2 -62 1 N -- WPA(PSK/TKIP/TKIP)
BTHomeHub2-WPQ7 00:24:2c:70:c0:23 -69 7 Y -- WPA(PSK/AES,TKIP/TKIP) WPA2(PSK/AES,TKIP/TKIP)
BTWiFi-with-FON 02:24:2c:70:c0:25 -58 7 Y -- NONE
BTWiFi 02:24:2c:70:c0:24 -59 7 Y -- NONE
BTHub3-6GN3 00:fe:f4:6a:7b:e0 -84 6 Y -- WPA(PSK/AES,TKIP/TKIP) WPA2(PSK/AES,TKIP/TKIP)
Jagernet3 00:1d:68:ec:bc:13 -49 4 N -- WEP

To sniff the current network…

bash-3.2# ./airport sniff
Capturing 802.11 frames on en0.
^C

ctrl c to end the capture, the file will then be saved to /tmp

Session saved to /tmp/airportSniffk5Q1it.cap

To read the captured file you can use tcpdump…

tcpdump -r airportSniffk5Q1it.cap

Leave a Reply

Your email address will not be published. Required fields are marked *