Today I found a really neat tool. It is a command-line utility,
buried in MacOS, that allows inspecting and changing operation of
the wireless device. It’s called airport.
First lets make access to it easier with a soft link.
cd /usr/local/bin sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport
Next lets figure out how to use it.
airport -h
airport AirPort v.528.1 (528.1.0)
Supported arguments:
-z --disassociate Disassociate from any network
-i[] --ibss=[] Create IBSS
-x --xml Print info as XML
-s[] --scan=[] Perform a wireless broadcast scan.
Will perform a directed scan if the optional is provided
-r --repeats= Repeat the command the specified number of times
-A[] --associate=[] Associate to network.
Will prompt for network name if arg is not specified
and if necessary, for a password if the network is using WEP or WPA.
The following additional arguments may be specified with this command:
--bssid= Specify BSSID to associate with
--password= Specify a WEP key or WPA password
-I --getinfo Print current wireless status, e.g. signal info, BSSID, port type etc.
-P --psk= Create PSK from specified pass phrase and SSID.
The following additional arguments must be specified with this command:
--ssid= Specify SSID when creating a PSK
-c[] --channel=[] Set arbitrary channel on the card
-h --help Show this help
You don’t need admin privileges to see your configuration
airport -I or to scan the current networks
airport -s, but you do to associate with a new network
airport -Anewnetwork.