2021-04-09 10:36:42 -07:00
|
|
|
[Home](https://kellyjonbrazil.github.io/jc/)
|
2022-01-25 17:07:47 -08:00
|
|
|
<a id="jc.parsers.airport_s"></a>
|
|
|
|
|
|
|
|
# jc.parsers.airport\_s
|
2020-07-30 16:20:24 -07:00
|
|
|
|
2020-08-05 16:51:58 -07:00
|
|
|
jc - JSON CLI output utility `airport -s` 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 21:51:02 -07:00
|
|
|
|
2020-08-05 13:32:59 -07:00
|
|
|
Usage (cli):
|
2020-03-10 21:51:02 -07:00
|
|
|
|
2022-01-25 17:07:47 -08:00
|
|
|
$ airport -s | jc --airport-s
|
2020-08-05 15:08:42 -07:00
|
|
|
|
2022-01-25 17:07:47 -08:00
|
|
|
or
|
2020-03-10 21:51:02 -07:00
|
|
|
|
2022-01-25 17:07:47 -08:00
|
|
|
$ jc airport -s
|
2020-03-10 21:51:02 -07:00
|
|
|
|
2020-08-05 13:32:59 -07:00
|
|
|
Usage (module):
|
|
|
|
|
2022-01-25 17:07:47 -08:00
|
|
|
import jc
|
|
|
|
result = jc.parse('airport_s', airport_s_command_output)
|
2022-01-18 14:18:12 -08:00
|
|
|
|
2022-01-25 17:07:47 -08:00
|
|
|
or
|
2022-01-18 14:18:12 -08:00
|
|
|
|
2022-01-25 17:07:47 -08:00
|
|
|
import jc.parsers.airport_s
|
|
|
|
result = jc.parsers.airport_s.parse(airport_s_command_output)
|
2020-08-05 13:32:59 -07:00
|
|
|
|
2021-04-09 19:55:03 -07:00
|
|
|
Schema:
|
|
|
|
|
2022-01-25 17:07:47 -08:00
|
|
|
[
|
|
|
|
{
|
|
|
|
"ssid": string,
|
|
|
|
"bssid": string,
|
|
|
|
"rssi": integer,
|
|
|
|
"channel": string,
|
|
|
|
"ht": boolean,
|
|
|
|
"cc": string,
|
|
|
|
"security": [
|
|
|
|
string,
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
**Examples**:
|
|
|
|
|
|
|
|
|
|
|
|
$ 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"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
...
|
|
|
|
]
|
|
|
|
|
|
|
|
$ airport -s | jc --airport -p -r
|
|
|
|
[
|
|
|
|
{
|
|
|
|
- `"ssid"` - "DIRECT-F3-HP ENVY 5660 series",
|
|
|
|
- `"bssid"` - "b0:5a:da:6f:0a:d4",
|
|
|
|
- `"rssi"` - "-93",
|
|
|
|
- `"channel"` - "1",
|
|
|
|
- `"ht"` - "Y",
|
|
|
|
- `"cc"` - "--",
|
|
|
|
- `"security"` - "WPA2(PSK/AES/AES)"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
- `"ssid"` - "YouAreInfected-5",
|
|
|
|
- `"bssid"` - "5c:e3:0e:c2:85:da",
|
|
|
|
- `"rssi"` - "-85",
|
|
|
|
- `"channel"` - "36",
|
|
|
|
- `"ht"` - "Y",
|
|
|
|
- `"cc"` - "US",
|
|
|
|
- `"security"` - "WPA(PSK/AES,TKIP/TKIP) WPA2(PSK/AES,TKIP/TKIP)"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
- `"ssid"` - "YuanFamily",
|
|
|
|
- `"bssid"` - "5c:e3:0e:b8:5f:9a",
|
|
|
|
- `"rssi"` - "-84",
|
|
|
|
- `"channel"` - "11",
|
|
|
|
- `"ht"` - "Y",
|
|
|
|
- `"cc"` - "US",
|
|
|
|
- `"security"` - "WPA(PSK/AES,TKIP/TKIP) WPA2(PSK/AES,TKIP/TKIP)"
|
|
|
|
},
|
|
|
|
...
|
|
|
|
]
|
|
|
|
|
|
|
|
<a id="jc.parsers.airport_s.info"></a>
|
|
|
|
|
|
|
|
## info Objects
|
|
|
|
|
2020-03-10 21:51:02 -07:00
|
|
|
```python
|
2022-01-25 17:07:47 -08:00
|
|
|
class info()
|
2020-03-10 21:51:02 -07:00
|
|
|
```
|
2022-01-25 17:07:47 -08:00
|
|
|
|
2021-04-09 19:55:03 -07:00
|
|
|
Provides parser metadata (version, author, etc.)
|
2020-07-30 16:20:24 -07:00
|
|
|
|
2022-01-25 17:07:47 -08:00
|
|
|
<a id="jc.parsers.airport_s.parse"></a>
|
|
|
|
|
|
|
|
#### parse
|
|
|
|
|
2020-03-10 21:51:02 -07:00
|
|
|
```python
|
2022-01-25 17:07:47 -08:00
|
|
|
def parse(data, raw=False, quiet=False)
|
2020-03-10 21:51:02 -07:00
|
|
|
```
|
|
|
|
|
|
|
|
Main text parsing function
|
|
|
|
|
2022-01-25 17:07:47 -08:00
|
|
|
**Arguments**:
|
2020-03-10 21:51:02 -07:00
|
|
|
|
2022-01-25 17:07:47 -08:00
|
|
|
|
|
|
|
- `data` - (string) text data to parse
|
|
|
|
- `raw` - (boolean) unprocessed output if True
|
|
|
|
- `quiet` - (boolean) suppress warning messages if True
|
|
|
|
|
2020-03-10 21:51:02 -07:00
|
|
|
|
2022-01-25 17:07:47 -08:00
|
|
|
**Returns**:
|
2020-03-10 21:51:02 -07:00
|
|
|
|
2022-01-25 17:07:47 -08:00
|
|
|
|
|
|
|
List of Dictionaries. Raw or processed structured data.
|
2020-03-10 21:51:02 -07:00
|
|
|
|
2021-04-09 10:36:42 -07:00
|
|
|
## Parser Information
|
|
|
|
Compatibility: darwin
|
|
|
|
|
2021-12-01 16:12:51 -08:00
|
|
|
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|