Mac Wireless airport Command

In macOS and prior most functionality found in the GUI can also be performed from the command line. One of those is the “airport” command which allows users to scan, sniff, connect, and disconnect from Wireless routers.

If you are not comfortable with the command line, I have a previous post here on Mac Built-in Wireless Tools accessible in the GUI.


Getting Started

The airport command is found in the following directory:

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

The easiest way to use the airport command is by creating a Symbolic link.

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

Scan

Perform a wireless scan of available Wireless networks by using the -s or –scan option. Example:

$ airport -s
                            SSID BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)
              TheCenturionLounge 6c:f3:7f:58:3X:XX -77  1       Y  US NONE
                    WiFi Printer 28:cf:e9:82:eX:XX -91  149,+1  Y  US WPA2(PSK/AES/AES) 
  HP-Print-A5-Officejet Pro 8610 58:20:b1:5f:eX:XX -67  1       N  -- NONE
                   McCarran WiFi 40:e3:d6:f8:0X:XX -58  11      Y  -- NONE
                            Ji6S 3a:71:de:d3:6X:XX -78  11      Y  US WPA2(PSK/AES/AES) 
                            TCLO 6c:f3:7f:58:3X:XX -80  52,+1   Y  US WPA2(PSK/AES/AES) 
                        icandy 2 30:46:9a:3e:dX:XX -64  6       Y  -- WEP
 DIRECT-41-HP OfficeJet Pro 8730 72:5a:0f:f1:1X:XX -49  6       Y  -- WPA2(PSK/AES/AES) 

Sniff

When sniffing, you will need to define your WLAN interface. A channel number can be specified as well.

$sudo airport en0 sniff
Password:
Capturing 802.11 frames on en0.
^CSession saved to /tmp/airportSniffDiGthp.cap.

Status

Using the -I option will view the current wireless status information such as signal, BSSID, Authentication, etc. Example:

$ airport -I
     agrCtlRSSI: -66
     agrExtRSSI: 0
    agrCtlNoise: -95
    agrExtNoise: 0
          state: running
        op mode: station 
     lastTxRate: 174
        maxRate: 289
lastAssocStatus: 0
    802.11 auth: open
      link auth: none
          BSSID: 70:3a:e:21:eX:XX
           SSID: McCarran WiFi
            MCS: 8
        channel: 165 

Disconnect

WLAN Disconnect

If you want to disconnect from your existing WLAN you can use the -z option.

$ sudo airport -z

Disconnect After Logout

sudo airport en0 prefs DisconnectOnLogout=Yes

Output Information

Capture

When performing a Sniff it saves a .cap file to the /tmp directory.
Wireshark (tshark) and tcpdump are great options for analyzing the 802.11 frames quickly.

Read the captured packets in tcpdump.

tcpdump -r /tmp/airportSniffDiGthp.cap

Read the captured packets in tshark.

tshark -r /tmp/airportSniffDiGthp.cap

XML

Print info as XML by using the -x option. Example:

$ airport -I -x 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>AUTH_LOWER</key>
	<integer>1</integer>
	<key>AUTH_UPPER</key>
	<integer>8</integer>
	<key>CHANNEL</key>
	<integer>36</integer>
	<key>CHANNEL_FLAGS</key>
	<integer>18</integer>
	<key>NOISE_CTL_AGR</key>
	<integer>-98</integer>
	<key>NOISE_UNIT</key>
	<integer>0</integer>
	<key>RSSI_CTL_AGR</key>
	<integer>-54</integer>
	<key>RSSI_CTL_LIST</key>
	<array>
		<integer>-51</integer>
		<integer>-53</integer>
		<integer>-60</integer>
	</array>
	<key>RSSI_EXT_AGR</key>
	<integer>0</integer>
	<key>RSSI_EXT_LIST</key>
	<array>
		<integer>0</integer>
		<integer>0</integer>
		<integer>0</integer>
	</array>
	<key>RSSI_UNIT</key>
	<integer>0</integer>
</dict>
</plist>

Save the XML info to a file.

$ airport -I -x >> /Users/UserName/Desktop/wifi.xml

Using the plutil we can convert a plist or xml file from one format to another.
Convert it to JSON format.

plutil -convert json wifi.xml -o wifi.json

File example:

{
	"RSSI_UNIT": 0,
	"AUTH_LOWER": 1,
	"NOISE_UNIT": 0,
	"CHANNEL_FLAGS": 532,
	"RSSI_CTL_AGR": -58,
	"CHANNEL": 149,
	"NOISE_CTL_AGR": -95,
	"RSSI_CTL_LIST": [-56, -62, -56],
	"AUTH_UPPER": 8,
	"RSSI_EXT_AGR": 0,
	"RSSI_EXT_LIST": [0, 0, 0]
}

You can use PlistBuddy command to read and write values to the file.

$/usr/libexec/PlistBuddy

TinkerTry SuperServer Upgrades

I haven’t posted much on the TinkerTry Server bundle I purchased last year, I am still jubilant, and the server hasn’t let me down once.

I decided to make some changes for the better on the hardware front by adding another 64GB of memory and a 250GB Samsung 960 EVO M.2 harddrive.

The M.2 Samsung 960 EVO is now my primary drive for ESXi 6.5, and the other two drives (850 Evo/Pro) are datastores with VMFS 6.

The 500GB 850 Evo reserved for all virtual machines, and the 128GB 850 Pro separated for using operating systems like Project Atomic and PhotonOS for containerization (OS level virtualization).


Samsung 960 EVO M.2

Paul at TinkerTry has put in an extensive amount of time collecting information and testing the Samsung 960 M.2 after the online community had been reporting the disappearance of the drive. The remediation of this issue was a firmware fix from Samsung. I recently purchased my drive off of Amazon, and it had already come with the updated firmware.

Specs:

  • PCIe 3.0 x4 NVM Express
  • M.2 (2280)
  • Samsung V-NAND 3bit MLC
  • Samsung Polaris controller
  • Intelligent TurboWrite
  • Sequential Read Speed: Max 3,200 MB/sec
  • Sequential Write Speed: Max 1,900 MB/sec
  • Capacity: 250 GB
    • Part#: MZ-V6E250BW

Samsung 32GB DDR4 (x2)

After a few months of heavy usage, I found myself needing more memory for my Linux servers. I ordered the memory from Wired Zone who sells the server bundles and had the best pricing after shopping around.

Specs:

  • Form Factor: RDIMM 288-pin
  • Data Integrity Check: ECC
  • Memory Speed: PC4-19200 (2400MHz)
  • Registered/Unbuffered: Registered
  • Supply Voltage: 1.2V
  • Supermicro Certified Server Memory
    • Supermicro Part#: MEM-DR432L-SL01-ER24
    • Samsung Part#: M393A4K40BB1-CRC