Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Parser: airport -I #46

Closed
chrisbergeron opened this issue Mar 10, 2020 · 7 comments · Fixed by #48
Closed

New Parser: airport -I #46

chrisbergeron opened this issue Mar 10, 2020 · 7 comments · Fixed by #48

Comments

@chrisbergeron
Copy link

It would be nice to have a parser for the Mac OSX 'airport' command. Output of 'airport -I' is:
agrCtlRSSI: -73
agrExtRSSI: 0
agrCtlNoise: -92
agrExtNoise: 0
state: running
op mode: station
lastTxRate: 176
maxRate: 867
lastAssocStatus: 0
802.11 auth: open
link auth: wpa2-psk
BSSID: 58:d9:d5:3:40:35
SSID: Tenda_034030_5G
MCS: 2
channel: 36,80

@kellyjonbrazil
Copy link
Owner

Hey there - thanks for the request! What program should I install on my Mac to get airport? Is it a brew install?

@kellyjonbrazil kellyjonbrazil added the enhancement New feature or request label Mar 10, 2020
@chrisbergeron
Copy link
Author

I think it's built in to OS X:
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport
I symlinked it into /usr/local/bin

If you don't have it there, I'll see what package I used to install it.

@kellyjonbrazil
Copy link
Owner

Ah yes, I see it there. Cool - looks pretty simple to parse so I'll add it to the next release.

@kellyjonbrazil
Copy link
Owner

Now supporting airport -I and airport -s:

airport -I

$ airport -I | jc --airport -p
{
  "agrctlrssi": -66,
  "agrextrssi": 0,
  "agrctlnoise": -90,
  "agrextnoise": 0,
  "state": "running",
  "op_mode": "station",
  "lasttxrate": 195,
  "maxrate": 867,
  "lastassocstatus": 0,
  "802_11_auth": "open",
  "link_auth": "wpa2-psk",
  "bssid": "3c:37:86:15:ad:f9",
  "ssid": "SnazzleDazzle",
  "mcs": 0,
  "channel": "48,80"
}

airport -s

$ airport -s | jc --airport-s -p
[
  {
    "ssid": "DIRECT-4A-HP OfficeJet 3830",
    "bssid": "00:67:eb:2a:a7:3b",
    "rssi": -90,
    "channel": "6",
    "ht": true,
    "cc": "--",
    "security": [
      "WPA2(PSK/AES/AES)"
    ]
  },
  {
    "ssid": "Latitude38",
    "bssid": "c0:ff:d5:d2:7a:f3",
    "rssi": -85,
    "channel": "11",
    "ht": true,
    "cc": "US",
    "security": [
      "WPA2(PSK/AES/AES)"
    ]
  },
  {
    "ssid": "xfinitywifi",
    "bssid": "6e:e3:0e:b8:45:99",
    "rssi": -83,
    "channel": "11",
    "ht": true,
    "cc": "US",
    "security": [
      "NONE"
    ]
  },
  ...
]

@chrisbergeron
Copy link
Author

chrisbergeron commented Mar 11, 2020 via email

@kellyjonbrazil
Copy link
Owner

You got it! Still working on some other things but this should go out in the 1.9.0 release soon.

@kellyjonbrazil kellyjonbrazil linked a pull request Mar 11, 2020 that will close this issue
@kellyjonbrazil
Copy link
Owner

You should be able to do a pip3 install --upgrade jc to get the new airport parsers.

Happy parsing!
kb

@kellyjonbrazil kellyjonbrazil added new-parser and removed enhancement New feature or request labels Jun 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants