8

I want to be able to write the current list of Wifi networks in airport, and their respective strengths, to a file. I would like to use some sort of bash script to do this, but I am unsure how to access the data in Airport.

11

Open Terminal.app and enter:

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

You have to be connected to a wireless signal. The output will look similar to the following:

     agrCtlRSSI: -64
     agrExtRSSI: 0
    agrCtlNoise: -91
    agrExtNoise: 0
          state: running
        op mode: station 
     lastTxRate: 130
        maxRate: 144
lastAssocStatus: 0
    802.11 auth: open
      link auth: wpa2-psk
          BSSID: 28:cf:da:b1:6:77
           SSID: 🍀
            MCS: 15
        channel: 6

Most of the data is self explanatory. agrCtlRSSI is the signal strength; the closer it is to 0, the stronger the signal. agrCtlNoise is the noise on your Wi-Fi signal; you want this as low as possible. Finally, maxRate is the maximum rate at which your Wi-Fi signal can run at, and lastTxRate is the last transmitted rate.

You can also use this Terminal command to scan the airwaves for other Wi-Fi signals to connect to (I believe this is what you were looking for):

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

This returns something like:

            SSID BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)
            🍀 28:cf:da:b1:06:78 -73  100,+1  Y  GB WPA2(PSK/AES/AES) 
           dlink 00:19:5b:de:4e:36 -90  6       N  -- WEP
    FON_BELGACOM 06:19:70:1e:c3:6e -77  1       N  BE NONE
      bbox2-f279 00:19:70:1e:c3:6e -77  1       N  BE WEP
   telenet-6F8E6 5c:35:3b:1e:88:20 -91  11      Y  -- WPA(PSK/TKIP,AES/TKIP) WPA2(PSK/TKIP,AES/TKIP) 
            🍀 28:cf:da:b1:06:77 -65  6       Y  GB WPA2(PSK/AES/AES) 

If you’ll be using these commands a lot, you might want to add /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources to your $PATH, like this:

# Place this in your `~/.bash_profile`
export PATH="/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources:$PATH"

That way, you can simply use the airport command without typing the full path to the binary every time:

airport -I
airport -s

Source

  • Wow very in depth, detailed answer. I'll get back to you once I try it out, thanks a ton man! – Andrew Mar 30 '12 at 2:58
  • Hi Mathias, I did click accepted, not sure why it didn't register as that before! – Andrew Mar 31 '12 at 20:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .