1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00
Files
jc/docs/parsers/airport.md

109 lines
2.4 KiB
Markdown
Raw Normal View History

[Home](https://kellyjonbrazil.github.io/jc/)
2022-01-25 17:07:47 -08:00
<a id="jc.parsers.airport"></a>
2020-07-30 16:20:24 -07:00
2020-03-10 20:35:52 -07:00
# jc.parsers.airport
2022-01-25 17:07:47 -08:00
2022-03-04 13:27:39 -08:00
jc - JSON Convert `airport -I` command output parser
2020-08-05 15:08:42 -07:00
The `airport` program can be found at `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport`.
2020-03-10 20:35:52 -07:00
2020-08-05 13:32:59 -07:00
Usage (cli):
2020-03-10 20:35:52 -07:00
2022-01-25 18:03:34 -08:00
$ airport -I | jc --airport
2020-08-05 15:08:42 -07:00
2022-08-15 13:51:48 -07:00
or
2022-01-25 18:03:34 -08:00
$ jc airport -I
2020-03-10 20:35:52 -07:00
2020-08-05 13:32:59 -07:00
Usage (module):
2022-01-25 18:03:34 -08:00
import jc
result = jc.parse('airport', airport_command_output)
2022-01-18 14:18:12 -08:00
Schema:
2022-01-25 18:03:34 -08:00
{
"agrctlrssi": integer,
"agrextrssi": integer,
"agrctlnoise": integer,
"agrextnoise": integer,
"state": string,
"op_mode": string,
"lasttxrate": integer,
"maxrate": integer,
"lastassocstatus": integer,
"802_11_auth": string,
"link_auth": string,
"bssid": string,
"ssid": string,
"mcs": integer,
"channel": string
}
Examples:
$ 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 -I | jc --airport -p -r
{
"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"
}
2022-01-25 17:07:47 -08:00
<a id="jc.parsers.airport.parse"></a>
2022-03-05 12:15:14 -08:00
### parse
2022-01-25 17:07:47 -08:00
2020-03-10 20:35:52 -07:00
```python
2022-01-25 17:07:47 -08:00
def parse(data, raw=False, quiet=False)
2020-03-10 20:35:52 -07:00
```
Main text parsing function
2022-01-25 18:03:34 -08:00
Parameters:
2020-03-10 20:35:52 -07:00
2022-01-25 18:03:34 -08:00
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
2020-03-10 20:35:52 -07:00
2022-01-25 18:03:34 -08:00
Returns:
2020-03-10 20:35:52 -07:00
2022-01-25 18:03:34 -08:00
Dictionary. Raw or processed structured data.
2020-03-10 20:35:52 -07:00
2022-01-25 19:18:54 -08:00
### Parser Information
Compatibility: darwin
2023-12-21 14:55:21 -08:00
Source: [`jc/parsers/airport.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/airport.py)
2022-07-16 20:52:19 -07:00
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)