mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-08-08 22:36:48 +02:00
doc updates
This commit is contained in:
@@ -32,6 +32,7 @@ pydocmd simple jc.parsers.id+ > ../docs/parsers/id.md
|
|||||||
pydocmd simple jc.parsers.ifconfig+ > ../docs/parsers/ifconfig.md
|
pydocmd simple jc.parsers.ifconfig+ > ../docs/parsers/ifconfig.md
|
||||||
pydocmd simple jc.parsers.ini+ > ../docs/parsers/ini.md
|
pydocmd simple jc.parsers.ini+ > ../docs/parsers/ini.md
|
||||||
pydocmd simple jc.parsers.iptables+ > ../docs/parsers/iptables.md
|
pydocmd simple jc.parsers.iptables+ > ../docs/parsers/iptables.md
|
||||||
|
pydocmd simple jc.parsers.iw_scan+ > ../docs/parsers/iw_scan.md
|
||||||
pydocmd simple jc.parsers.jobs+ > ../docs/parsers/jobs.md
|
pydocmd simple jc.parsers.jobs+ > ../docs/parsers/jobs.md
|
||||||
pydocmd simple jc.parsers.kv+ > ../docs/parsers/kv.md
|
pydocmd simple jc.parsers.kv+ > ../docs/parsers/kv.md
|
||||||
pydocmd simple jc.parsers.last+ > ../docs/parsers/last.md
|
pydocmd simple jc.parsers.last+ > ../docs/parsers/last.md
|
||||||
|
160
docs/parsers/iw_scan.md
Normal file
160
docs/parsers/iw_scan.md
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
|
||||||
|
# jc.parsers.iw_scan
|
||||||
|
jc - JSON CLI output utility `iw DEV scan` command output parser
|
||||||
|
|
||||||
|
This parser is considered beta quality. Not all fields are parsed.
|
||||||
|
|
||||||
|
Usage (cli):
|
||||||
|
|
||||||
|
$ iw dev wlan0 scan | jc --iw-scan
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
$ jc iw dev wlan0 scan
|
||||||
|
|
||||||
|
Usage (module):
|
||||||
|
|
||||||
|
import jc.parsers.iw-scan
|
||||||
|
result = jc.parsers.iw-scan.parse(iw-scan_command_output)
|
||||||
|
|
||||||
|
Compatibility:
|
||||||
|
|
||||||
|
'linux'
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
$ iw-scan | jc --iw-scan -p
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"mac_address": "71:31:72:65:e1:a2",
|
||||||
|
"interface": "wlan0",
|
||||||
|
"freq": 2462,
|
||||||
|
"capability": "ESS Privacy ShortSlotTime (0x0411)",
|
||||||
|
"ssid": "WLAN-1234",
|
||||||
|
"supported_rates": [
|
||||||
|
1.0,
|
||||||
|
2.0,
|
||||||
|
5.5,
|
||||||
|
11.0,
|
||||||
|
18.0,
|
||||||
|
24.0,
|
||||||
|
36.0,
|
||||||
|
54.0
|
||||||
|
],
|
||||||
|
"erp": "<no flags>",
|
||||||
|
"erp_d4.0": "<no flags>",
|
||||||
|
"rsn": "Version: 1",
|
||||||
|
"group_cipher": "CCMP",
|
||||||
|
"pairwise_ciphers": "CCMP",
|
||||||
|
"authentication_suites": "PSK",
|
||||||
|
"capabilities": "0x186c",
|
||||||
|
"extended_supported_rates": [
|
||||||
|
6.0,
|
||||||
|
9.0,
|
||||||
|
12.0,
|
||||||
|
48.0
|
||||||
|
],
|
||||||
|
"ht_rx_mcs_rate_indexes_supported": "0-15",
|
||||||
|
"primary_channel": 11,
|
||||||
|
"secondary_channel_offset": "no secondary",
|
||||||
|
"rifs": 1,
|
||||||
|
"ht_protection": "no",
|
||||||
|
"non-gf_present": 1,
|
||||||
|
"obss_non-gf_present": 0,
|
||||||
|
"dual_beacon": 0,
|
||||||
|
"dual_cts_protection": 0,
|
||||||
|
"stbc_beacon": 0,
|
||||||
|
"l-sig_txop_prot": 0,
|
||||||
|
"pco_active": 0,
|
||||||
|
"pco_phase": 0,
|
||||||
|
"bss_width_channel_transition_delay_factor": 5,
|
||||||
|
"extended_capabilities": "HT Information Exchange Supported",
|
||||||
|
"wmm": "Parameter version 1",
|
||||||
|
"be": "CW 15-1023, AIFSN 3",
|
||||||
|
"bk": "CW 15-1023, AIFSN 7",
|
||||||
|
"vi": "CW 7-15, AIFSN 2, TXOP 3008 usec",
|
||||||
|
"vo": "CW 3-7, AIFSN 2, TXOP 1504 usec",
|
||||||
|
"wps": "Version: 1.0",
|
||||||
|
"wi-fi_protected_setup_state": "2 (Configured)",
|
||||||
|
"selected_registrar": "0x0",
|
||||||
|
"response_type": "3 (AP)",
|
||||||
|
"uuid": "00000000-0000-0003-0000-75317074f1a2",
|
||||||
|
"manufacturer": "Corporation",
|
||||||
|
"model": "VGV8539JW",
|
||||||
|
"model_number": "1.47.000",
|
||||||
|
"serial_number": "J144024542",
|
||||||
|
"primary_device_type": "6-0050f204-1",
|
||||||
|
"device_name": "Wireless Router(WFA)",
|
||||||
|
"config_methods": "Label, PBC",
|
||||||
|
"rf_bands": "0x3",
|
||||||
|
"tsf_usec": 212098649788,
|
||||||
|
"sta_channel_width_mhz": 20,
|
||||||
|
"passive_dwell_tus": 20,
|
||||||
|
"active_dwell_tus": 10,
|
||||||
|
"channel_width_trigger_scan_interval_s": 300,
|
||||||
|
"scan_passive_total_per_channel_tus": 200,
|
||||||
|
"scan_active_total_per_channel_tus": 20,
|
||||||
|
"beacon_interval_tus": 100,
|
||||||
|
"signal_dbm": -80.0,
|
||||||
|
"last_seen_ms": 11420,
|
||||||
|
"selected_rates": [
|
||||||
|
1.0,
|
||||||
|
2.0,
|
||||||
|
5.5,
|
||||||
|
11.0
|
||||||
|
],
|
||||||
|
"obss_scan_activity_threshold_percent": 0.25,
|
||||||
|
"ds_parameter_set_channel": 11,
|
||||||
|
"max_amsdu_length_bytes": 7935,
|
||||||
|
"minimum_rx_ampdu_time_spacing_usec": 16
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
## info
|
||||||
|
```python
|
||||||
|
info()
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## process
|
||||||
|
```python
|
||||||
|
process(proc_data)
|
||||||
|
```
|
||||||
|
|
||||||
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
proc_data: (List of Dictionaries) raw structured data to process
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
List of Dictionaries. Structured data with the following schema:
|
||||||
|
]
|
||||||
|
{
|
||||||
|
"foo": string/integer/float, # best guess based on value
|
||||||
|
"bar": string/integer/float,
|
||||||
|
"baz": string/integer/float
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
## parse
|
||||||
|
```python
|
||||||
|
parse(data, raw=False, quiet=False)
|
||||||
|
```
|
||||||
|
|
||||||
|
Main text parsing function
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
data: (string) text data to parse
|
||||||
|
raw: (boolean) output preprocessed JSON if True
|
||||||
|
quiet: (boolean) suppress warning messages if True
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
List of Dictionaries. Raw or processed structured data.
|
||||||
|
|
@@ -1,6 +1,6 @@
|
|||||||
"""jc - JSON CLI output utility `iw DEV scan` command output parser
|
"""jc - JSON CLI output utility `iw DEV scan` command output parser
|
||||||
|
|
||||||
<<Short iw-scan description and caveats>>
|
This parser is considered beta quality. Not all fields are parsed.
|
||||||
|
|
||||||
Usage (cli):
|
Usage (cli):
|
||||||
|
|
||||||
@@ -22,10 +22,92 @@ Compatibility:
|
|||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
$ iw-scan | jc --iw-scan -p
|
$ iw-scan | jc --iw-scan -p
|
||||||
[]
|
[
|
||||||
|
{
|
||||||
$ iw-scan | jc --iw-scan -p -r
|
"mac_address": "71:31:72:65:e1:a2",
|
||||||
[]
|
"interface": "wlan0",
|
||||||
|
"freq": 2462,
|
||||||
|
"capability": "ESS Privacy ShortSlotTime (0x0411)",
|
||||||
|
"ssid": "WLAN-1234",
|
||||||
|
"supported_rates": [
|
||||||
|
1.0,
|
||||||
|
2.0,
|
||||||
|
5.5,
|
||||||
|
11.0,
|
||||||
|
18.0,
|
||||||
|
24.0,
|
||||||
|
36.0,
|
||||||
|
54.0
|
||||||
|
],
|
||||||
|
"erp": "<no flags>",
|
||||||
|
"erp_d4.0": "<no flags>",
|
||||||
|
"rsn": "Version: 1",
|
||||||
|
"group_cipher": "CCMP",
|
||||||
|
"pairwise_ciphers": "CCMP",
|
||||||
|
"authentication_suites": "PSK",
|
||||||
|
"capabilities": "0x186c",
|
||||||
|
"extended_supported_rates": [
|
||||||
|
6.0,
|
||||||
|
9.0,
|
||||||
|
12.0,
|
||||||
|
48.0
|
||||||
|
],
|
||||||
|
"ht_rx_mcs_rate_indexes_supported": "0-15",
|
||||||
|
"primary_channel": 11,
|
||||||
|
"secondary_channel_offset": "no secondary",
|
||||||
|
"rifs": 1,
|
||||||
|
"ht_protection": "no",
|
||||||
|
"non-gf_present": 1,
|
||||||
|
"obss_non-gf_present": 0,
|
||||||
|
"dual_beacon": 0,
|
||||||
|
"dual_cts_protection": 0,
|
||||||
|
"stbc_beacon": 0,
|
||||||
|
"l-sig_txop_prot": 0,
|
||||||
|
"pco_active": 0,
|
||||||
|
"pco_phase": 0,
|
||||||
|
"bss_width_channel_transition_delay_factor": 5,
|
||||||
|
"extended_capabilities": "HT Information Exchange Supported",
|
||||||
|
"wmm": "Parameter version 1",
|
||||||
|
"be": "CW 15-1023, AIFSN 3",
|
||||||
|
"bk": "CW 15-1023, AIFSN 7",
|
||||||
|
"vi": "CW 7-15, AIFSN 2, TXOP 3008 usec",
|
||||||
|
"vo": "CW 3-7, AIFSN 2, TXOP 1504 usec",
|
||||||
|
"wps": "Version: 1.0",
|
||||||
|
"wi-fi_protected_setup_state": "2 (Configured)",
|
||||||
|
"selected_registrar": "0x0",
|
||||||
|
"response_type": "3 (AP)",
|
||||||
|
"uuid": "00000000-0000-0003-0000-75317074f1a2",
|
||||||
|
"manufacturer": "Corporation",
|
||||||
|
"model": "VGV8539JW",
|
||||||
|
"model_number": "1.47.000",
|
||||||
|
"serial_number": "J144024542",
|
||||||
|
"primary_device_type": "6-0050f204-1",
|
||||||
|
"device_name": "Wireless Router(WFA)",
|
||||||
|
"config_methods": "Label, PBC",
|
||||||
|
"rf_bands": "0x3",
|
||||||
|
"tsf_usec": 212098649788,
|
||||||
|
"sta_channel_width_mhz": 20,
|
||||||
|
"passive_dwell_tus": 20,
|
||||||
|
"active_dwell_tus": 10,
|
||||||
|
"channel_width_trigger_scan_interval_s": 300,
|
||||||
|
"scan_passive_total_per_channel_tus": 200,
|
||||||
|
"scan_active_total_per_channel_tus": 20,
|
||||||
|
"beacon_interval_tus": 100,
|
||||||
|
"signal_dbm": -80.0,
|
||||||
|
"last_seen_ms": 11420,
|
||||||
|
"selected_rates": [
|
||||||
|
1.0,
|
||||||
|
2.0,
|
||||||
|
5.5,
|
||||||
|
11.0
|
||||||
|
],
|
||||||
|
"obss_scan_activity_threshold_percent": 0.25,
|
||||||
|
"ds_parameter_set_channel": 11,
|
||||||
|
"max_amsdu_length_bytes": 7935,
|
||||||
|
"minimum_rx_ampdu_time_spacing_usec": 16
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
"""
|
"""
|
||||||
import jc.utils
|
import jc.utils
|
||||||
|
|
||||||
@@ -56,12 +138,11 @@ def process(proc_data):
|
|||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
List of Dictionaries. Structured data with the following schema:
|
||||||
|
]
|
||||||
[
|
|
||||||
{
|
{
|
||||||
"iw-scan": string,
|
"foo": string/integer/float, # best guess based on value
|
||||||
"bar": boolean,
|
"bar": string/integer/float,
|
||||||
"baz": integer
|
"baz": string/integer/float
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
"""
|
"""
|
||||||
@@ -241,8 +322,6 @@ def parse(data, raw=False, quiet=False):
|
|||||||
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if section:
|
if section:
|
||||||
raw_output.append(section)
|
raw_output.append(section)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user