mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2026-04-03 17:44:07 +02:00
Compare commits
85 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87b506dc9b | ||
|
|
15c9002d9e | ||
|
|
042aaa61b9 | ||
|
|
ef856c6ba5 | ||
|
|
9cf5be73e3 | ||
|
|
63fc149e2a | ||
|
|
3c25839350 | ||
|
|
58246e33b7 | ||
|
|
8b1407c706 | ||
|
|
2fde4a4e22 | ||
|
|
60b9e97982 | ||
|
|
0adac79c0f | ||
|
|
9f485b5981 | ||
|
|
db17d21b8f | ||
|
|
996d394e89 | ||
|
|
5885b960f9 | ||
|
|
79987b35f3 | ||
|
|
661b3ef311 | ||
|
|
fb422726a8 | ||
|
|
4fb6f3ea59 | ||
|
|
f78fe771e1 | ||
|
|
567b887253 | ||
|
|
e516e6b946 | ||
|
|
62748676aa | ||
|
|
7351c72e45 | ||
|
|
2b7405c5e2 | ||
|
|
e2c77cb935 | ||
|
|
7ac621e4c9 | ||
|
|
d8b5d6c66c | ||
|
|
22b461eb4b | ||
|
|
b37ee8555a | ||
|
|
1d0ad2f045 | ||
|
|
ceccfb2c81 | ||
|
|
03c02953cd | ||
|
|
f254a0eaa1 | ||
|
|
9e3b88727c | ||
|
|
b12217466e | ||
|
|
8b9c932f9b | ||
|
|
5986ce03db | ||
|
|
a7b0e936e4 | ||
|
|
cb02211424 | ||
|
|
bd443bf392 | ||
|
|
1f547edd36 | ||
|
|
e4bac3a493 | ||
|
|
5e6bfa681a | ||
|
|
276160125e | ||
|
|
d4ae5543f2 | ||
|
|
55f360e267 | ||
|
|
fdedab2a0c | ||
|
|
a9be42e303 | ||
|
|
6da9510e46 | ||
|
|
0431798178 | ||
|
|
62432f3c48 | ||
|
|
9fbbc30906 | ||
|
|
d1567d1f62 | ||
|
|
6ca1f5970b | ||
|
|
1c880b9e24 | ||
|
|
3b7d54c720 | ||
|
|
44a7406057 | ||
|
|
8157dcfdb1 | ||
|
|
28762aea15 | ||
|
|
439871ea9f | ||
|
|
c9180b005c | ||
|
|
b14e0725f8 | ||
|
|
70fe3dcb4d | ||
|
|
8c554604a4 | ||
|
|
a0a35454bd | ||
|
|
e8467e2af5 | ||
|
|
7515deb566 | ||
|
|
ed9e52af24 | ||
|
|
592a380410 | ||
|
|
1a458d2d5b | ||
|
|
0e4cf53b92 | ||
|
|
e2f06ccb33 | ||
|
|
8abff004cd | ||
|
|
c4a0e2e3fe | ||
|
|
4f10f79c73 | ||
|
|
69e7a560fd | ||
|
|
59b1055808 | ||
|
|
6ed48c6289 | ||
|
|
f2fb4d3f41 | ||
|
|
6aeea59ea8 | ||
|
|
d016f3bbb3 | ||
|
|
7131c29718 | ||
|
|
7432442983 |
2
.github/workflows/pythonapp.yml
vendored
2
.github/workflows/pythonapp.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||
python-version: [3.6, 3.7, 3.8]
|
||||
python-version: [3.6, 3.7, 3.8, 3.9]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
20
CHANGELOG
20
CHANGELOG
@@ -1,5 +1,25 @@
|
||||
jc changelog
|
||||
|
||||
20210205 v1.14.2
|
||||
- Update dig parser to fix cases where there are spaces in the answer data (e.g. TXT records)
|
||||
|
||||
20210106 v1.14.1
|
||||
- Add iw-scan parser tested on linux (beta)
|
||||
- Update date parser for Ubuntu 20.04 support
|
||||
- Update last parser for last -F support
|
||||
- Update last parser to add convenience fields and augment data for easier parsing
|
||||
- Update man page
|
||||
- Minor documentation updates
|
||||
|
||||
20201231 v1.14.0
|
||||
- Add hashsum parser tested on linux, macos
|
||||
- Add hash parser tested on linux, macos
|
||||
- Add cksum parser tested on linux, macos
|
||||
- Add wc parser tested on linux, macos
|
||||
- Add printenv support under env parser
|
||||
- Add vdir support under ls parser
|
||||
- Add python 3.9 to github automation tests
|
||||
|
||||
20200805 v1.13.4
|
||||
- Update crontab and crontab-u parsers to tighten up variable detection
|
||||
- Update ping parser to tighten linux/bsd detection
|
||||
|
||||
189
EXAMPLES.md
189
EXAMPLES.md
@@ -175,6 +175,29 @@ blkid -o udev -ip /dev/sda2 | jc --blkid -p # or: jc -p blkid -o udev
|
||||
}
|
||||
]
|
||||
```
|
||||
### cksum
|
||||
```bash
|
||||
cksum * | jc --cksum -p # or: jc -p cksum *
|
||||
```
|
||||
```json
|
||||
[
|
||||
{
|
||||
"filename": "__init__.py",
|
||||
"checksum": 4294967295,
|
||||
"blocks": 0
|
||||
},
|
||||
{
|
||||
"filename": "airport.py",
|
||||
"checksum": 2208551092,
|
||||
"blocks": 3745
|
||||
},
|
||||
{
|
||||
"filename": "airport_s.py",
|
||||
"checksum": 1113817598,
|
||||
"blocks": 4572
|
||||
}
|
||||
]
|
||||
```
|
||||
### crontab
|
||||
```bash
|
||||
cat /etc/crontab | jc --crontab -p # or: jc -p crontab -l
|
||||
@@ -389,6 +412,7 @@ date | jc --date -p # or: jc -p date
|
||||
"hour": 16,
|
||||
"minute": 48,
|
||||
"second": 11,
|
||||
"period": null,
|
||||
"month": "Jul",
|
||||
"weekday": "Fri",
|
||||
"weekday_num": 6,
|
||||
@@ -843,6 +867,54 @@ cat /etc/gshadow | jc --gshadow -p
|
||||
}
|
||||
]
|
||||
```
|
||||
### hash
|
||||
```bash
|
||||
hash | jc --hash -p
|
||||
```
|
||||
```json
|
||||
[
|
||||
{
|
||||
"hits": 2,
|
||||
"command": "/bin/cat"
|
||||
},
|
||||
{
|
||||
"hits": 1,
|
||||
"command": "/bin/ls"
|
||||
}
|
||||
]
|
||||
```
|
||||
### hashsum
|
||||
```bash
|
||||
md5sum * | jc --hashsum -p # or: jc -p md5sum *
|
||||
```
|
||||
```json
|
||||
[
|
||||
{
|
||||
"filename": "devtoolset-3-gcc-4.9.2-6.el7.x86_64.rpm",
|
||||
"hash": "65fc958c1add637ec23c4b137aecf3d3"
|
||||
},
|
||||
{
|
||||
"filename": "digout",
|
||||
"hash": "5b9312ee5aff080927753c63a347707d"
|
||||
},
|
||||
{
|
||||
"filename": "dmidecode.out",
|
||||
"hash": "716fd11c2ac00db109281f7110b8fb9d"
|
||||
},
|
||||
{
|
||||
"filename": "file with spaces in the name",
|
||||
"hash": "d41d8cd98f00b204e9800998ecf8427e"
|
||||
},
|
||||
{
|
||||
"filename": "id-centos.out",
|
||||
"hash": "4295be239a14ad77ef3253103de976d2"
|
||||
},
|
||||
{
|
||||
"filename": "ifcfg.json",
|
||||
"hash": "01fda0d9ba9a75618b072e64ff512b43"
|
||||
}
|
||||
]
|
||||
```
|
||||
### history
|
||||
```bash
|
||||
history | jc --history -p
|
||||
@@ -1124,6 +1196,97 @@ iptables --line-numbers -v -L -t nat | jc --iptables -p # or: jc -p ip
|
||||
}
|
||||
]
|
||||
```
|
||||
### iw dev `device` scan
|
||||
```bash
|
||||
iw dev wlan0 scan | jc --iw-scan -p # or: jc -p iw dev wlan0 scan
|
||||
```
|
||||
```json
|
||||
[
|
||||
{
|
||||
"bssid": "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
|
||||
}
|
||||
]
|
||||
```
|
||||
### jobs
|
||||
```bash
|
||||
jobs -l | jc --jobs -p # or: jc -p jobs
|
||||
@@ -2469,6 +2632,32 @@ w | jc --w -p # or: jc -p w
|
||||
}
|
||||
]
|
||||
```
|
||||
### wc
|
||||
```bash
|
||||
wc * | jc --wc -p # or: jc -p wc *
|
||||
```
|
||||
```json
|
||||
[
|
||||
{
|
||||
"filename": "airport-I.json",
|
||||
"lines": 1,
|
||||
"words": 30,
|
||||
"characters": 307
|
||||
},
|
||||
{
|
||||
"filename": "airport-I.out",
|
||||
"lines": 15,
|
||||
"words": 33,
|
||||
"characters": 348
|
||||
},
|
||||
{
|
||||
"filename": "airport-s.json",
|
||||
"lines": 1,
|
||||
"words": 202,
|
||||
"characters": 2152
|
||||
}
|
||||
]
|
||||
```
|
||||
### who
|
||||
```bash
|
||||
who | jc --who -p # or: jc -p who
|
||||
|
||||
25
README.md
25
README.md
@@ -1,6 +1,10 @@
|
||||

|
||||

|
||||
|
||||
> Try the new `jc` [web demo](https://jc-web-demo.herokuapp.com/)!
|
||||
|
||||
> JC is [now available](https://galaxy.ansible.com/community/general) as an Ansible filter plugin in the `community.general` collection! See this [blog post](https://blog.kellybrazil.com/2020/08/30/parsing-command-output-in-ansible-with-jc/) for an example.
|
||||
|
||||
# JC
|
||||
JSON CLI output utility
|
||||
|
||||
@@ -90,7 +94,7 @@ pip3 install jc
|
||||
|
||||
| OS | Command |
|
||||
|-----------------------|-------------------------------------------------------------------------------|
|
||||
| Debian linux | `apt-get install jc` |
|
||||
| Debian/Ubuntu linux | `apt-get install jc` |
|
||||
| Fedora linux | `dnf install jc` |
|
||||
| openSUSE linux | `zypper install jc` |
|
||||
| Arch linux | `pacman -S jc` |
|
||||
@@ -98,6 +102,7 @@ pip3 install jc
|
||||
| Guix System linux | `guix install jc` |
|
||||
| MacOS | `brew install jc` |
|
||||
| FreeBSD | `portsnap fetch update && cd /usr/ports/textproc/py-jc && make install clean` |
|
||||
| Ansible filter plugin | `ansible-galaxy collection install community.general` |
|
||||
|
||||
> For more packages and binaries, see https://kellyjonbrazil.github.io/jc-packaging/.
|
||||
|
||||
@@ -106,7 +111,7 @@ pip3 install jc
|
||||
```bash
|
||||
COMMAND | jc PARSER [OPTIONS]
|
||||
```
|
||||
Alternatively, the "magic" syntax can be used by prepending `jc` to the command to be converted. Options can be passed to `jc` immediately before the command is given. (Note: command aliases are not supported)
|
||||
Alternatively, the "magic" syntax can be used by prepending `jc` to the command to be converted. Options can be passed to `jc` immediately before the command is given. (Note: command aliases and shell builtins are not supported)
|
||||
```bash
|
||||
jc [OPTIONS] COMMAND
|
||||
```
|
||||
@@ -117,6 +122,7 @@ The JSON output can be compact (default) or pretty formatted with the `-p` optio
|
||||
- `--airport-s` enables the `airport -s` command parser (OSX)
|
||||
- `--arp` enables the `arp` command parser
|
||||
- `--blkid` enables the `blkid` command parser
|
||||
- `--cksum` enables the `cksum` and `sum` command parser
|
||||
- `--crontab` enables the `crontab` command and file parser
|
||||
- `--crontab-u` enables the `crontab` file parser with user support
|
||||
- `--csv` enables the `CSV` file parser
|
||||
@@ -125,22 +131,25 @@ The JSON output can be compact (default) or pretty formatted with the `-p` optio
|
||||
- `--dig` enables the `dig` command parser
|
||||
- `--dmidecode` enables the `dmidecode` command parser
|
||||
- `--du` enables the `du` command parser
|
||||
- `--env` enables the `env` command parser
|
||||
- `--env` enables the `env` and `printenv` command parser
|
||||
- `--file` enables the `file` command parser
|
||||
- `--free` enables the `free` command parser
|
||||
- `--fstab` enables the `/etc/fstab` file parser
|
||||
- `--group` enables the `/etc/group` file parser
|
||||
- `--gshadow` enables the `/etc/gshadow` file parser
|
||||
- `--hash` enables the `hash` command parser
|
||||
- `--hashsum` enables the `hashsum` command parser (`md5`, `md5sum`, `shasum`, `sha1sum`, `sha224sum`, `sha256sum`, `sha384sum`, `sha512sum`)
|
||||
- `--history` enables the `history` command parser
|
||||
- `--hosts` enables the `/etc/hosts` file parser
|
||||
- `--id` enables the `id` command parser
|
||||
- `--ifconfig` enables the `ifconfig` command parser
|
||||
- `--ini` enables the `INI` file parser
|
||||
- `--iptables` enables the `iptables` command parser
|
||||
- `--iw-scan` enables the `iw dev <device> scan` command parser (beta)
|
||||
- `--jobs` enables the `jobs` command parser
|
||||
- `--kv` enables the `Key/Value` file parser
|
||||
- `--last` enables the `last` and `lastb` command parser
|
||||
- `--ls` enables the `ls` command parser
|
||||
- `--ls` enables the `ls` and `vdir` command parser
|
||||
- `--lsblk` enables the `lsblk` command parser
|
||||
- `--lsmod` enables the `lsmod` command parser
|
||||
- `--lsof` enables the `lsof` command parser
|
||||
@@ -167,16 +176,17 @@ The JSON output can be compact (default) or pretty formatted with the `-p` optio
|
||||
- `--uname` enables the `uname -a` command parser
|
||||
- `--uptime` enables the `uptime` command parser
|
||||
- `--w` enables the `w` command parser
|
||||
- `--wc` enables the `wc` command parser
|
||||
- `--who` enables the `who` command parser
|
||||
- `--xml` enables the `XML` file parser
|
||||
- `--yaml` enables the `YAML` file parser
|
||||
|
||||
### Options
|
||||
- `-a` about `jc`. Prints information about `jc` and the parsers (in JSON, of course!)
|
||||
- `-d` debug mode. Prints trace messages if parsing issues encountered (use `-dd` for verbose debugging)
|
||||
- `-d` debug mode. Prints trace messages if parsing issues are encountered (use `-dd` for verbose debugging)
|
||||
- `-m` monochrome JSON output
|
||||
- `-p` pretty format the JSON output
|
||||
- `-q` quiet mode. Suppresses warning messages
|
||||
- `-q` quiet mode. Suppresses parser warning messages
|
||||
- `-r` raw output. Provides a more literal JSON output with all values as strings and no additional semantic processing
|
||||
|
||||
### Setting Custom Colors via Environment Variable
|
||||
@@ -219,7 +229,8 @@ cat lsof.out | jc --lsof -q
|
||||
|
||||
Tested on:
|
||||
- Centos 7.7
|
||||
- Ubuntu 18.4
|
||||
- Ubuntu 18.04
|
||||
- Ubuntu 20.04
|
||||
- Fedora32
|
||||
- OSX 10.11.6
|
||||
- OSX 10.14.6
|
||||
|
||||
@@ -9,6 +9,7 @@ pydocmd simple jc.parsers.airport+ > ../docs/parsers/airport.md
|
||||
pydocmd simple jc.parsers.airport_s+ > ../docs/parsers/airport_s.md
|
||||
pydocmd simple jc.parsers.arp+ > ../docs/parsers/arp.md
|
||||
pydocmd simple jc.parsers.blkid+ > ../docs/parsers/blkid.md
|
||||
pydocmd simple jc.parsers.cksum+ > ../docs/parsers/cksum.md
|
||||
pydocmd simple jc.parsers.crontab+ > ../docs/parsers/crontab.md
|
||||
pydocmd simple jc.parsers.crontab_u+ > ../docs/parsers/crontab_u.md
|
||||
pydocmd simple jc.parsers.csv+ > ../docs/parsers/csv.md
|
||||
@@ -23,12 +24,15 @@ pydocmd simple jc.parsers.free+ > ../docs/parsers/free.md
|
||||
pydocmd simple jc.parsers.fstab+ > ../docs/parsers/fstab.md
|
||||
pydocmd simple jc.parsers.group+ > ../docs/parsers/group.md
|
||||
pydocmd simple jc.parsers.gshadow+ > ../docs/parsers/gshadow.md
|
||||
pydocmd simple jc.parsers.hash+ > ../docs/parsers/hash.md
|
||||
pydocmd simple jc.parsers.hashsum+ > ../docs/parsers/hashsum.md
|
||||
pydocmd simple jc.parsers.history+ > ../docs/parsers/history.md
|
||||
pydocmd simple jc.parsers.hosts+ > ../docs/parsers/hosts.md
|
||||
pydocmd simple jc.parsers.id+ > ../docs/parsers/id.md
|
||||
pydocmd simple jc.parsers.ifconfig+ > ../docs/parsers/ifconfig.md
|
||||
pydocmd simple jc.parsers.ini+ > ../docs/parsers/ini.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.kv+ > ../docs/parsers/kv.md
|
||||
pydocmd simple jc.parsers.last+ > ../docs/parsers/last.md
|
||||
@@ -59,6 +63,7 @@ pydocmd simple jc.parsers.traceroute+ > ../docs/parsers/traceroute.md
|
||||
pydocmd simple jc.parsers.uname+ > ../docs/parsers/uname.md
|
||||
pydocmd simple jc.parsers.uptime+ > ../docs/parsers/uptime.md
|
||||
pydocmd simple jc.parsers.w+ > ../docs/parsers/w.md
|
||||
pydocmd simple jc.parsers.wc+ > ../docs/parsers/wc.md
|
||||
pydocmd simple jc.parsers.who+ > ../docs/parsers/who.md
|
||||
pydocmd simple jc.parsers.xml+ > ../docs/parsers/xml.md
|
||||
pydocmd simple jc.parsers.yaml+ > ../docs/parsers/yaml.md
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
|
||||
# jc.parsers.airport
|
||||
jc - JSON CLI output utility airport -I Parser
|
||||
jc - JSON CLI output utility `airport -I` command output parser
|
||||
|
||||
Usage:
|
||||
The `airport` program can be found at `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport`.
|
||||
|
||||
specify --airport as the first argument if the piped input is coming from airport -I (OSX)
|
||||
Usage (cli):
|
||||
|
||||
This program can be found at:
|
||||
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport
|
||||
$ airport -I | jc --airport
|
||||
|
||||
or
|
||||
|
||||
$ jc airport -I
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.airport
|
||||
result = jc.parsers.airport.parse(airport_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -69,7 +77,7 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
|
||||
# jc.parsers.airport_s
|
||||
jc - JSON CLI output utility airport -s Parser
|
||||
jc - JSON CLI output utility `airport -s` command output parser
|
||||
|
||||
Usage:
|
||||
The `airport` program can be found at `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport`.
|
||||
|
||||
specify --airport as the first argument if the piped input is coming from airport -s (OSX)
|
||||
Usage (cli):
|
||||
|
||||
This program can be found at:
|
||||
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport
|
||||
$ airport -s | jc --airport-s
|
||||
|
||||
or
|
||||
|
||||
$ jc airport -s
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.airport_s
|
||||
result = jc.parsers.airport_s.parse(airport_s_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -101,11 +109,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
[
|
||||
{
|
||||
"ssid": string,
|
||||
@@ -136,5 +144,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
|
||||
# jc.parsers.arp
|
||||
jc - JSON CLI output utility arp Parser
|
||||
jc - JSON CLI output utility `arp` command output parser
|
||||
|
||||
Usage:
|
||||
Supports `arp` and `arp -a` output.
|
||||
|
||||
specify --arp as the first argument if the piped input is coming from:
|
||||
Usage (cli):
|
||||
|
||||
arp
|
||||
or
|
||||
arp -a
|
||||
$ arp | jc --arp
|
||||
|
||||
or
|
||||
|
||||
$ jc arp
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.arp
|
||||
result = jc.parsers.arp.parse(arp_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -112,11 +119,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -147,5 +154,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.blkid
|
||||
jc - JSON CLI output utility blkid Parser
|
||||
jc - JSON CLI output utility `blkid` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --blkid as the first argument if the piped input is coming from blkid
|
||||
$ blkid | jc --blkid
|
||||
|
||||
or
|
||||
|
||||
$ jc blkid
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.blkid
|
||||
result = jc.parsers.blkid.parse(blkid_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -92,11 +101,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -148,5 +157,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
95
docs/parsers/cksum.md
Normal file
95
docs/parsers/cksum.md
Normal file
@@ -0,0 +1,95 @@
|
||||
|
||||
# jc.parsers.cksum
|
||||
jc - JSON CLI output utility `cksum` command output parser
|
||||
|
||||
This parser works with the following checksum calculation utilities:
|
||||
- `sum`
|
||||
- `cksum`
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cksum file.txt | jc --cksum
|
||||
|
||||
or
|
||||
|
||||
$ jc cksum file.txt
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.cksum
|
||||
result = jc.parsers.cksum.parse(cksum_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
||||
|
||||
Examples:
|
||||
|
||||
$ cksum * | jc --cksum -p
|
||||
[
|
||||
{
|
||||
"filename": "__init__.py",
|
||||
"checksum": 4294967295,
|
||||
"blocks": 0
|
||||
},
|
||||
{
|
||||
"filename": "airport.py",
|
||||
"checksum": 2208551092,
|
||||
"blocks": 3745
|
||||
},
|
||||
{
|
||||
"filename": "airport_s.py",
|
||||
"checksum": 1113817598,
|
||||
"blocks": 4572
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
|
||||
## 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:
|
||||
|
||||
[
|
||||
{
|
||||
"filename": string,
|
||||
"checksum": integer,
|
||||
"blocks": integer
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
## 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,10 +1,21 @@
|
||||
|
||||
# jc.parsers.crontab
|
||||
jc - JSON CLI output utility crontab command and file Parser
|
||||
jc - JSON CLI output utility `crontab -l` command output and crontab file parser
|
||||
|
||||
Usage:
|
||||
Supports `crontab -l` command output and crontab files.
|
||||
|
||||
specify --crontab as the first argument if the piped input is coming from crontab -l or a crontab file
|
||||
Usage (cli):
|
||||
|
||||
$ crontab -l | jc --crontab
|
||||
|
||||
or
|
||||
|
||||
$ jc crontab -l
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.crontab
|
||||
result = jc.parsers.crontab.parse(crontab_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -145,7 +156,7 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
|
||||
# jc.parsers.crontab_u
|
||||
jc - JSON CLI output utility crontab file Parser
|
||||
jc - JSON CLI output utility `crontab -l` command output and crontab file parser
|
||||
|
||||
Usage:
|
||||
This version of the `crontab -l` parser supports output that contains user information for processes.
|
||||
|
||||
specify --crontab-u as the first argument if the piped input is coming from a crontab file with User specified
|
||||
Usage (cli):
|
||||
|
||||
$ crontab -l | jc --crontab-u
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.crontab_u
|
||||
result = jc.parsers.crontab_u.parse(crontab_u_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -146,7 +153,7 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
|
||||
# jc.parsers.csv
|
||||
jc - JSON CLI output utility csv Parser
|
||||
jc - JSON CLI output utility `csv` file parser
|
||||
|
||||
Usage:
|
||||
The `csv` parser will attempt to automatically detect the delimiter character. If the delimiter cannot be detected it will default to comma. The first row of the file must be a header row.
|
||||
|
||||
specify --csv as the first argument if the piped input is coming from a csv file.
|
||||
the csv parser will attempt to automatically detect the delimiter character.
|
||||
if the delimiter cannot be detected it will default to comma.
|
||||
the first row of the file must be a header row.
|
||||
Usage (cli):
|
||||
|
||||
$ cat file.csv | jc --csv
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.csv
|
||||
result = jc.parsers.csv.parse(csv_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -76,11 +80,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Each dictionary represents a row in the csv file:
|
||||
List of Dictionaries. Each Dictionary represents a row in the csv file:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -105,5 +109,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.date
|
||||
jc - JSON CLI output utility date Parser
|
||||
jc - JSON CLI output utility `date` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --date as the first argument if the piped input is coming from date
|
||||
$ date | jc --date
|
||||
|
||||
or
|
||||
|
||||
$ jc date
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.date
|
||||
result = jc.parsers.date.parse(date_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -20,6 +29,7 @@ Examples:
|
||||
"hour": 16,
|
||||
"minute": 48,
|
||||
"second": 11,
|
||||
"period": null,
|
||||
"month": "Jul",
|
||||
"weekday": "Fri",
|
||||
"weekday_num": 6,
|
||||
@@ -54,7 +64,7 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -67,6 +77,7 @@ Returns:
|
||||
"hour": integer,
|
||||
"minute": integer,
|
||||
"second": integer,
|
||||
"period": string,
|
||||
"month": string,
|
||||
"weekday": string,
|
||||
"weekday_num": integer,
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.df
|
||||
jc - JSON CLI output utility df Parser
|
||||
jc - JSON CLI output utility `df` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --df as the first argument if the piped input is coming from df
|
||||
$ df | jc --df
|
||||
|
||||
or
|
||||
|
||||
$ jc df
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.df
|
||||
result = jc.parsers.df.parse(df_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -86,11 +95,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -125,5 +134,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.dig
|
||||
jc - JSON CLI output utility dig Parser
|
||||
jc - JSON CLI output utility `dig` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
Specify --dig as the first argument if the piped input is coming from dig
|
||||
$ dig example.com | jc --dig
|
||||
|
||||
or
|
||||
|
||||
$ jc dig example.com
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.dig
|
||||
result = jc.parsers.dig.parse(dig_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -338,11 +347,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -412,5 +421,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.dmidecode
|
||||
jc - JSON CLI output utility dmidecode Parser
|
||||
jc - JSON CLI output utility `dmidecode` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --dmidecode as the first argument if the piped input is coming from dmidecode
|
||||
$ dmidecode | jc --dmidecode
|
||||
|
||||
or
|
||||
|
||||
$ jc dmidecode
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.dmidecode
|
||||
result = jc.parsers.dmidecode.parse(dmidecode_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -116,11 +125,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -153,5 +162,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.du
|
||||
jc - JSON CLI output utility du Parser
|
||||
jc - JSON CLI output utility `du` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --du as the first argument if the piped input is coming from du
|
||||
$ du | jc --du
|
||||
|
||||
or
|
||||
|
||||
$ jc du
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.du
|
||||
result = jc.parsers.du.parse(du_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -86,11 +95,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -115,5 +124,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
|
||||
# jc.parsers.env
|
||||
jc - JSON CLI output utility env Parser
|
||||
jc - JSON CLI output utility `env` and `printenv` command output parser
|
||||
|
||||
Usage:
|
||||
This parser will output a list of dictionaries each containing `name` and `value` keys. If you would like a simple dictionary output, then use the `-r` command-line option or the `raw=True` argument in the `parse()` function.
|
||||
|
||||
specify --env as the first argument if the piped input is coming from env
|
||||
Usage (cli):
|
||||
|
||||
$ env | jc --env
|
||||
|
||||
or
|
||||
|
||||
$ jc env
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.env
|
||||
result = jc.parsers.env.parse(env_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -66,11 +77,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -96,5 +107,5 @@ Parameters:
|
||||
Returns:
|
||||
|
||||
Dictionary of raw structured data or
|
||||
list of dictionaries of processed structured data
|
||||
List of Dictionaries of processed structured data
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.file
|
||||
jc - JSON CLI output utility file command Parser
|
||||
jc - JSON CLI output utility `file` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --file as the first argument if the piped input is coming from file.
|
||||
$ file * | jc --file
|
||||
|
||||
or
|
||||
|
||||
$ jc file *
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.file
|
||||
result = jc.parsers.file.parse(file_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -61,11 +70,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -90,5 +99,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.free
|
||||
jc - JSON CLI output utility free Parser
|
||||
jc - JSON CLI output utility `free` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --free as the first argument if the piped input is coming from free
|
||||
$ free | jc --free
|
||||
|
||||
or
|
||||
|
||||
$ jc free
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.free
|
||||
result = jc.parsers.free.parse(free_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -66,11 +75,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -100,5 +109,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
|
||||
# jc.parsers.fstab
|
||||
jc - JSON CLI output utility fstab Parser
|
||||
jc - JSON CLI output utility `fstab` file parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --fstab as the first argument if the piped input is coming from a fstab file
|
||||
$ cat /etc/fstab | jc --fstab
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.fstab
|
||||
result = jc.parsers.fstab.parse(fstab_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -84,11 +89,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -117,5 +122,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
|
||||
# jc.parsers.group
|
||||
jc - JSON CLI output utility /etc/group file Parser
|
||||
jc - JSON CLI output utility `/etc/group` file parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --group as the first argument if the piped input is coming from /etc/group
|
||||
$ cat /etc/group | jc --group
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.group
|
||||
result = jc.parsers.group.parse(group_file_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -108,11 +113,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -141,5 +146,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
|
||||
# jc.parsers.gshadow
|
||||
jc - JSON CLI output utility /etc/gshadow file Parser
|
||||
jc - JSON CLI output utility `/etc/gshadow` file parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --gshadow as the first argument if the piped input is coming from /etc/gshadow
|
||||
$ cat /etc/gshadow | jc --gshadow
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.gshadow
|
||||
result = jc.parsers.gshadow.parse(gshadow_file_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -74,11 +79,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -109,5 +114,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
78
docs/parsers/hash.md
Normal file
78
docs/parsers/hash.md
Normal file
@@ -0,0 +1,78 @@
|
||||
|
||||
# jc.parsers.hash
|
||||
jc - JSON CLI output utility `hash` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ hash | jc --hash
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.hash
|
||||
result = jc.parsers.hash.parse(hash_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
||||
|
||||
Examples:
|
||||
|
||||
$ hash | jc --hash -p
|
||||
[
|
||||
{
|
||||
"hits": 2,
|
||||
"command": "/bin/cat"
|
||||
},
|
||||
{
|
||||
"hits": 1,
|
||||
"command": "/bin/ls"
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
## 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:
|
||||
|
||||
[
|
||||
{
|
||||
"command": string,
|
||||
"hits": integer
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
## 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.
|
||||
|
||||
109
docs/parsers/hashsum.md
Normal file
109
docs/parsers/hashsum.md
Normal file
@@ -0,0 +1,109 @@
|
||||
|
||||
# jc.parsers.hashsum
|
||||
jc - JSON CLI output utility `hash sum` command output parser
|
||||
|
||||
This parser works with the following hash calculation utilities:
|
||||
- `md5`
|
||||
- `md5sum`
|
||||
- `shasum`
|
||||
- `sha1sum`
|
||||
- `sha224sum`
|
||||
- `sha256sum`
|
||||
- `sha384sum`
|
||||
- `sha512sum`
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ md5sum file.txt | jc --hashsum
|
||||
|
||||
or
|
||||
|
||||
$ jc md5sum file.txt
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.hashsum
|
||||
result = jc.parsers.hashsum.parse(md5sum_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
||||
|
||||
Examples:
|
||||
|
||||
$ md5sum * | jc --hashsum -p
|
||||
[
|
||||
{
|
||||
"filename": "devtoolset-3-gcc-4.9.2-6.el7.x86_64.rpm",
|
||||
"hash": "65fc958c1add637ec23c4b137aecf3d3"
|
||||
},
|
||||
{
|
||||
"filename": "digout",
|
||||
"hash": "5b9312ee5aff080927753c63a347707d"
|
||||
},
|
||||
{
|
||||
"filename": "dmidecode.out",
|
||||
"hash": "716fd11c2ac00db109281f7110b8fb9d"
|
||||
},
|
||||
{
|
||||
"filename": "file with spaces in the name",
|
||||
"hash": "d41d8cd98f00b204e9800998ecf8427e"
|
||||
},
|
||||
{
|
||||
"filename": "id-centos.out",
|
||||
"hash": "4295be239a14ad77ef3253103de976d2"
|
||||
},
|
||||
{
|
||||
"filename": "ifcfg.json",
|
||||
"hash": "01fda0d9ba9a75618b072e64ff512b43"
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
|
||||
## 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:
|
||||
|
||||
[
|
||||
{
|
||||
"filename": string,
|
||||
"hash": string,
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
## 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,10 +1,17 @@
|
||||
|
||||
# jc.parsers.history
|
||||
jc - JSON CLI output utility history Parser
|
||||
jc - JSON CLI output utility `history` command output parser
|
||||
|
||||
Usage:
|
||||
This parser will output a list of dictionaries each containing `line` and `command` keys. If you would like a simple dictionary output, then use the `-r` command-line option or the `raw=True` argument in the `parse()` function.
|
||||
|
||||
specify --history as the first argument if the piped input is coming from history
|
||||
Usage (cli):
|
||||
|
||||
$ history | jc --history
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.history
|
||||
result = jc.parsers.history.parse(history_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -58,11 +65,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -88,5 +95,5 @@ Parameters:
|
||||
Returns:
|
||||
|
||||
Dictionary of raw structured data or
|
||||
list of dictionaries of processed structured data
|
||||
List of Dictionaries of processed structured data
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
|
||||
# jc.parsers.hosts
|
||||
jc - JSON CLI output utility hosts Parser
|
||||
jc - JSON CLI output utility `/etc/hosts` file parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --hosts as the first argument if the piped input is coming from a hosts file
|
||||
$ cat /etc/hosts | jc --hosts
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.hosts
|
||||
result = jc.parsers.hosts.parse(hosts_file_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -75,11 +80,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -106,5 +111,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.id
|
||||
jc - JSON CLI output utility id Parser
|
||||
jc - JSON CLI output utility `id` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --id as the first argument if the piped input is coming from id
|
||||
$ id | jc --id
|
||||
|
||||
or
|
||||
|
||||
$ jc id
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.id
|
||||
result = jc.parsers.id.parse(id_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -84,7 +93,7 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -133,5 +142,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,12 +1,21 @@
|
||||
|
||||
# jc.parsers.ifconfig
|
||||
jc - JSON CLI output utility ifconfig Parser
|
||||
jc - JSON CLI output utility `ifconfig` command output parser
|
||||
|
||||
Usage:
|
||||
Note: No `ifconfig` options are supported.
|
||||
|
||||
specify --ifconfig as the first argument if the piped input is coming from ifconfig
|
||||
Usage (cli):
|
||||
|
||||
no ifconfig options are supported.
|
||||
$ ifconfig | jc --ifconfig
|
||||
|
||||
or
|
||||
|
||||
$ jc ifconfig
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.ifconfig
|
||||
result = jc.parsers.ifconfig.parse(ifconfig_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -165,11 +174,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -220,5 +229,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
|
||||
# jc.parsers.ini
|
||||
jc - JSON CLI output utility INI Parser
|
||||
jc - JSON CLI output utility `INI` file parser
|
||||
|
||||
Usage:
|
||||
Parses standard `INI` files and files containing simple key/value pairs. Delimiter can be `=` or `:`. Missing values are supported. Comment prefix can be `#` or `;`. Comments must be on their own line.
|
||||
|
||||
Specify --ini as the first argument if the piped input is coming from an INI file or any
|
||||
simple key/value pair file. Delimiter can be '=' or ':'. Missing values are supported.
|
||||
Comment prefix can be '#' or ';'. Comments must be on their own line.
|
||||
Note: Values starting and ending with quotation marks will have the marks removed. If you would like to keep the quotation marks, use the `-r` command-line argument or the `raw=True` argument in `parse()`.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cat foo.ini | jc --ini
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.ini
|
||||
result = jc.parsers.ini.parse(ini_file_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -62,7 +69,7 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
@@ -1,12 +1,21 @@
|
||||
|
||||
# jc.parsers.iptables
|
||||
jc - JSON CLI output utility ipables Parser
|
||||
jc - JSON CLI output utility `ipables` command output parser
|
||||
|
||||
Usage:
|
||||
Supports `-vLn` and `--line-numbers` for all tables.
|
||||
|
||||
Specify --iptables as the first argument if the piped input is coming from iptables
|
||||
Usage (cli):
|
||||
|
||||
Supports -vLn and --line-numbers for all tables
|
||||
$ sudo iptables -L -t nat | jc --iptables
|
||||
|
||||
or
|
||||
|
||||
$ jc iptables -L -t nat
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.iptables
|
||||
result = jc.parsers.iptables.parse(iptables_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -148,11 +157,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -191,5 +200,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
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 <device> 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 dev wlan0 scan | jc --iw-scan -p
|
||||
[
|
||||
{
|
||||
"bssid": "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,12 +1,21 @@
|
||||
|
||||
# jc.parsers.jobs
|
||||
jc - JSON CLI output utility jobs Parser
|
||||
jc - JSON CLI output utility `jobs` command output parser
|
||||
|
||||
Usage:
|
||||
Also supports the `-l` option.
|
||||
|
||||
specify --jobs as the first argument if the piped input is coming from jobs
|
||||
Usage (cli):
|
||||
|
||||
Also supports the -l option
|
||||
$ jobs | jc --jobs
|
||||
|
||||
or
|
||||
|
||||
$ jc jobs
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.jobs
|
||||
result = jc.parsers.jobs.parse(jobs_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -90,11 +99,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -122,5 +131,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
|
||||
# jc.parsers.kv
|
||||
jc - JSON CLI output utility Key/Value File Parser
|
||||
jc - JSON CLI output utility `Key/Value` file parser
|
||||
|
||||
Usage:
|
||||
Supports files containing simple key/value pairs. Delimiter can be `=` or `:`. Missing values are supported. Comment prefix can be `#` or `;`. Comments must be on their own line.
|
||||
|
||||
Specify --kv as the first argument if the piped input is coming from a simple
|
||||
key/value pair file. Delimiter can be '=' or ':'. Missing values are supported.
|
||||
Comment prefix can be '#' or ';'. Comments must be on their own line.
|
||||
Note: Values starting and ending with quotation marks will have the marks removed. If you would like to keep the quotation marks, use the `-r` command-line argument or the `raw=True` argument in `parse()`.
|
||||
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cat foo.txt | jc --kv
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.kv
|
||||
result = jc.parsers.kv.parse(kv_file_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
|
||||
# jc.parsers.last
|
||||
jc - JSON CLI output utility last Parser
|
||||
jc - JSON CLI output utility `last` and `lastb` command output parser
|
||||
|
||||
Usage:
|
||||
Supports -w and -F options.
|
||||
|
||||
specify --last as the first argument if the piped input is coming from last or lastb
|
||||
Usage (cli):
|
||||
|
||||
$ last | jc --last
|
||||
|
||||
or
|
||||
|
||||
$ jc last
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.last
|
||||
result = jc.parsers.last.parse(last_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -12,30 +23,36 @@ Compatibility:
|
||||
|
||||
Examples:
|
||||
|
||||
$ last | jc --last -p
|
||||
$ last -F | jc --last -p
|
||||
[
|
||||
{
|
||||
"user": "kbrazil",
|
||||
"tty": "ttys002",
|
||||
"hostname": null,
|
||||
"login": "Thu Feb 27 14:31",
|
||||
"login": "Mon Dec 28 17:24:10 2020",
|
||||
"logout": "still logged in"
|
||||
},
|
||||
{
|
||||
"user": "kbrazil",
|
||||
"tty": "ttys003",
|
||||
"hostname": null,
|
||||
"login": "Thu Feb 27 10:38",
|
||||
"logout": "10:38",
|
||||
"duration": "00:00"
|
||||
"login": "Mon Dec 28 17:24:10 2020",
|
||||
"logout": "Mon Dec 28 17:25:01 2020",
|
||||
"duration": "00:00",
|
||||
"login_epoch": 1565891826,
|
||||
"logout_epoch": 1565895404,
|
||||
"duration_seconds": 3578
|
||||
},
|
||||
{
|
||||
"user": "kbrazil",
|
||||
"tty": "ttys003",
|
||||
"hostname": null,
|
||||
"login": "Thu Feb 27 10:18",
|
||||
"logout": "10:18",
|
||||
"duration": "00:00"
|
||||
"login": "Mon Dec 28 17:24:10 2020",
|
||||
"logout": "Mon Dec 28 17:25:01 2020",
|
||||
"duration": "00:00",
|
||||
"login_epoch": 1565891826,
|
||||
"logout_epoch": 1565895404,
|
||||
"duration_seconds": 3578
|
||||
},
|
||||
...
|
||||
]
|
||||
@@ -85,20 +102,23 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
"user": string,
|
||||
"tty": string,
|
||||
"hostname": string,
|
||||
"login": string,
|
||||
"logout": string,
|
||||
"duration": string
|
||||
"user": string,
|
||||
"tty": string,
|
||||
"hostname": string,
|
||||
"login": string,
|
||||
"logout": string,
|
||||
"duration": string,
|
||||
"login_epoch": integer, # available with last -F option
|
||||
"logout_epoch": integer, # available with last -F option
|
||||
"duration_seconds": integer # available with last -F option
|
||||
}
|
||||
]
|
||||
|
||||
@@ -118,5 +138,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,22 +1,26 @@
|
||||
|
||||
# jc.parsers.ls
|
||||
jc - JSON CLI output utility ls Parser
|
||||
jc - JSON CLI output utility `ls` and `vdir` command output parser
|
||||
|
||||
Note: The -l or -b option of ls should be used to correctly parse filenames that include newline characters.
|
||||
Since ls does not encode newlines in filenames when outputting to a pipe it will cause jc to see
|
||||
multiple files instead of a single file if -l or -b is not used.
|
||||
Options supported:
|
||||
- `lbaR`
|
||||
- `--time-style=full-iso`
|
||||
- `-h`: File sizes will be available in text form with `-r` but larger file sizes with human readable suffixes will be converted to `Null` in the default view since the parser attempts to convert this field to an integer.
|
||||
|
||||
Usage:
|
||||
Note: The `-l` or `-b` option of `ls` should be used to correctly parse filenames that include newline characters. Since `ls` does not encode newlines in filenames when outputting to a pipe it will cause `jc` to see multiple files instead of a single file if `-l` or `-b` is not used. Alternatively, `vdir` can be used, which is the same as running `ls -lb`.
|
||||
|
||||
specify --ls as the first argument if the piped input is coming from ls
|
||||
Usage (cli):
|
||||
|
||||
ls options supported:
|
||||
$ ls | jc --ls
|
||||
|
||||
-lbaR
|
||||
--time-style=full-iso
|
||||
-h file sizes will be available in text form with -r but larger file sizes
|
||||
with human readable suffixes will be converted to Null in default view
|
||||
since the parser attempts to convert this field to an integer.
|
||||
or
|
||||
|
||||
$ jc ls
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.ls
|
||||
result = jc.parsers.ls.parse(ls_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -162,11 +166,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -197,5 +201,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.lsblk
|
||||
jc - JSON CLI output utility lsblk Parser
|
||||
jc - JSON CLI output utility `lsblk` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --lsblk as the first argument if the piped input is coming from lsblk
|
||||
$ lsblk | jc --lsblk
|
||||
|
||||
or
|
||||
|
||||
$ jc lsblk
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.lsblk
|
||||
result = jc.parsers.lsblk.parse(lsblk_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -229,11 +238,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -296,5 +305,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.lsmod
|
||||
jc - JSON CLI output utility lsmod Parser
|
||||
jc - JSON CLI output utility `lsmod` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --lsmod as the first argument if the piped input is coming from lsmod
|
||||
$ lsmod | jc --lsmod
|
||||
|
||||
or
|
||||
|
||||
$ jc lsmod
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.lsmod
|
||||
result = jc.parsers.lsmod.parse(lsmod_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -120,11 +129,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -153,5 +162,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.lsof
|
||||
jc - JSON CLI output utility lsof Parser
|
||||
jc - JSON CLI output utility `lsof` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --lsof as the first argument if the piped input is coming from lsof
|
||||
$ lsof | jc --lsof
|
||||
|
||||
or
|
||||
|
||||
$ jc lsof
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.lsof
|
||||
result = jc.parsers.lsof.parse(lsof_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -110,11 +119,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -147,5 +156,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.mount
|
||||
jc - JSON CLI output utility mount Parser
|
||||
jc - JSON CLI output utility `mount` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --mount as the first argument if the piped input is coming from mount
|
||||
$ mount | jc --mount
|
||||
|
||||
or
|
||||
|
||||
$ jc mount
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.mount
|
||||
result = jc.parsers.mount.parse(mount_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -70,11 +79,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -103,5 +112,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,15 +1,23 @@
|
||||
|
||||
# jc.parsers.netstat
|
||||
jc - JSON CLI output utility netstat Parser
|
||||
|
||||
Usage:
|
||||
|
||||
Specify --netstat as the first argument if the piped input is coming from netstat
|
||||
jc - JSON CLI output utility `netstat` command output parser
|
||||
|
||||
Caveats:
|
||||
- Use of multiple `l` options is not supported on OSX (e.g. `netstat -rlll`)
|
||||
- Use of the `A` option is not supported on OSX when using the `r` option (e.g. `netstat -rA`)
|
||||
|
||||
- Use of multiple 'l' options is not supported on OSX (e.g. 'netstat -rlll')
|
||||
- Use of the 'A' option is not supported on OSX when using the 'r' option (e.g. netstat -rA)
|
||||
Usage (cli):
|
||||
|
||||
$ netstat | jc --netstat
|
||||
|
||||
or
|
||||
|
||||
$ jc netstat
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.netstat
|
||||
result = jc.parsers.netstat.parse(netstat_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -262,11 +270,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -383,5 +391,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.ntpq
|
||||
jc - JSON CLI output utility ntpq Parser
|
||||
jc - JSON CLI output utility `ntpq -p` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --ntpq as the first argument if the piped input is coming from ntpq -p
|
||||
$ ntpq -p | jc --ntpq
|
||||
|
||||
or
|
||||
|
||||
$ jc ntpq -p
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.ntpq
|
||||
result = jc.parsers.ntpq.parse(ntpq_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -196,11 +205,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -235,5 +244,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
|
||||
# jc.parsers.passwd
|
||||
jc - JSON CLI output utility /etc/passwd file Parser
|
||||
jc - JSON CLI output utility `/etc/passwd` file Parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --passwd as the first argument if the piped input is coming from /etc/passwd
|
||||
$ cat /etc/passwd | jc --passwd
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.passwd
|
||||
result = jc.parsers.passwd.parse(passwd_file_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -92,11 +97,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -126,5 +131,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,12 +1,23 @@
|
||||
|
||||
# jc.parsers.ping
|
||||
jc - JSON CLI output utility ping Parser
|
||||
jc - JSON CLI output utility `ping` command output parser
|
||||
|
||||
Usage:
|
||||
Supports `ping` and `ping6` output.
|
||||
|
||||
specify --ping as the first argument if the piped input is coming from ping
|
||||
Usage (cli):
|
||||
|
||||
Note: Use the ping -c (count) option, otherwise data will not be piped to jc.
|
||||
Note: Use the ping `-c` (count) option, otherwise data will not be piped to `jc`.
|
||||
|
||||
$ ping -c 3 1.2.3.4 | jc --ping
|
||||
|
||||
or
|
||||
|
||||
$ jc ping -c 3 1.2.3.4
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.ping
|
||||
result = jc.parsers.ping.parse(ping_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -121,7 +132,7 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.pip_list
|
||||
jc - JSON CLI output utility pip-list Parser
|
||||
jc - JSON CLI output utility `pip-list` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --pip-list as the first argument if the piped input is coming from pip list
|
||||
$ pip list | jc --pip-list
|
||||
|
||||
or
|
||||
|
||||
$ jc pip list
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.pip_list
|
||||
result = jc.parsers.pip_list.parse(pip_list_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -45,11 +54,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -75,5 +84,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.pip_show
|
||||
jc - JSON CLI output utility pip-show Parser
|
||||
jc - JSON CLI output utility `pip-show` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --pip-show as the first argument if the piped input is coming from pip show
|
||||
$ pip show | jc --pip-show
|
||||
|
||||
or
|
||||
|
||||
$ jc pip show
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.pip_show
|
||||
result = jc.parsers.pip_show.parse(pip_show_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -56,11 +65,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -94,5 +103,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,14 +1,23 @@
|
||||
|
||||
# jc.parsers.ps
|
||||
jc - JSON CLI output utility ps Parser
|
||||
jc - JSON CLI output utility `ps` command output parser
|
||||
|
||||
Usage:
|
||||
`ps` options supported:
|
||||
- `ef`
|
||||
- `axu`
|
||||
|
||||
specify --ps as the first argument if the piped input is coming from ps
|
||||
Usage (cli):
|
||||
|
||||
ps options supported:
|
||||
- ef
|
||||
- axu
|
||||
$ ps | jc --ps
|
||||
|
||||
or
|
||||
|
||||
$ jc ps
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.ps
|
||||
result = jc.parsers.ps.parse(ps_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -190,11 +199,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -234,5 +243,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.route
|
||||
jc - JSON CLI output utility route Parser
|
||||
jc - JSON CLI output utility `route` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --route as the first argument if the piped input is coming from route
|
||||
$ route | jc --route
|
||||
|
||||
or
|
||||
|
||||
$ jc route
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.route
|
||||
result = jc.parsers.route.parse(route_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -97,11 +106,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -138,5 +147,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
|
||||
# jc.parsers.shadow
|
||||
jc - JSON CLI output utility /etc/shadow file Parser
|
||||
jc - JSON CLI output utility `/etc/shadow` file parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --shadow as the first argument if the piped input is coming from /etc/shadow
|
||||
$ sudo cat /etc/shadow | jc --shadow
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.shadow
|
||||
result = jc.parsers.shadow.parse(shadow_file_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -98,11 +103,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -133,5 +138,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.ss
|
||||
jc - JSON CLI output utility ss Parser
|
||||
jc - JSON CLI output utility `ss` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --ss as the first argument if the piped input is coming from ss
|
||||
$ ss | jc --ss
|
||||
|
||||
or
|
||||
|
||||
$ jc ss
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.ss
|
||||
result = jc.parsers.ss.parse(ss_command_output)
|
||||
|
||||
Limitations:
|
||||
|
||||
@@ -264,11 +273,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -308,5 +317,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.stat
|
||||
jc - JSON CLI output utility stat Parser
|
||||
jc - JSON CLI output utility `stat` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --stat as the first argument if the piped input is coming from stat
|
||||
$ stat * | jc --stat
|
||||
|
||||
or
|
||||
|
||||
$ jc stat *
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.stat
|
||||
result = jc.parsers.stat.parse(stat_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -118,11 +127,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -168,5 +177,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
|
||||
# jc.parsers.sysctl
|
||||
jc - JSON CLI output utility sysctl -a Parser
|
||||
jc - JSON CLI output utility `sysctl -a` command output parser
|
||||
|
||||
Usage:
|
||||
Note: Since `sysctl` output is not easily parsable only a very simple key/value object will be output. An attempt is made to convert obvious integers and floats. If no conversion is desired, use the `-r` command-line argument or the `raw=True` argument in `parse()`.
|
||||
|
||||
specify --sysctl as the first argument if the piped input is coming from sysctl -a
|
||||
Usage (cli):
|
||||
|
||||
Note: since sysctl output is not easily parsable only a very simple key/value object
|
||||
will be output. An attempt is made to convert obvious integers and floats. If no
|
||||
conversion is desired, use the -r (raw) option.
|
||||
$ sysctl -a | jc --sysctl
|
||||
|
||||
or
|
||||
|
||||
$ jc sysctl -a
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.sysctl
|
||||
result = jc.parsers.sysctl.parse(sysctl_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -16,7 +23,7 @@ Compatibility:
|
||||
|
||||
Examples:
|
||||
|
||||
$ sysctl | jc --sysctl -p
|
||||
$ sysctl -a | jc --sysctl -p
|
||||
{
|
||||
"user.cs_path": "/usr/bin:/bin:/usr/sbin:/sbin",
|
||||
"user.bc_base_max": 99,
|
||||
@@ -28,7 +35,7 @@ Examples:
|
||||
...
|
||||
}
|
||||
|
||||
$ sysctl | jc --sysctl -p -r
|
||||
$ sysctl -a | jc --sysctl -p -r
|
||||
{
|
||||
"user.cs_path": "/usr/bin:/bin:/usr/sbin:/sbin",
|
||||
"user.bc_base_max": "99",
|
||||
@@ -56,7 +63,7 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.systemctl
|
||||
jc - JSON CLI output utility systemctl Parser
|
||||
jc - JSON CLI output utility `systemctl` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --systemctl as the first argument if the piped input is coming from systemctl
|
||||
$ systemctl | jc --systemctl
|
||||
|
||||
or
|
||||
|
||||
$ jc systemctl
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.systemctl
|
||||
result = jc.parsers.systemctl.parse(systemctl_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -54,11 +63,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -86,5 +95,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.systemctl_lj
|
||||
jc - JSON CLI output utility systemctl-lj Parser
|
||||
jc - JSON CLI output utility `systemctl list-jobs` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --systemctl-lj as the first argument if the piped input is coming from systemctl list-jobs
|
||||
$ systemctl list-jobs | jc --systemctl-lj
|
||||
|
||||
or
|
||||
|
||||
$ jc systemctl list-jobs
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.systemctl_lj
|
||||
result = jc.parsers.systemctl_lj.parse(systemctl_lj_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -73,11 +82,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -104,5 +113,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.systemctl_ls
|
||||
jc - JSON CLI output utility systemctl-ls Parser
|
||||
jc - JSON CLI output utility `systemctl list-sockets` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --systemctl-ls as the first argument if the piped input is coming from systemctl list-sockets
|
||||
$ systemctl list-sockets | jc --systemctl-ls
|
||||
|
||||
or
|
||||
|
||||
$ jc systemctl list-sockets
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.systemctl_ls
|
||||
result = jc.parsers.systemctl_ls.parse(systemctl_ls_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -48,11 +57,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -78,5 +87,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.systemctl_luf
|
||||
jc - JSON CLI output utility systemctl-luf Parser
|
||||
jc - JSON CLI output utility `systemctl list-unit-files` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --systemctl-luf as the first argument if the piped input is coming from systemctl list-unit-files
|
||||
$ systemctl list-unit-files | jc --systemctl-luf
|
||||
|
||||
or
|
||||
|
||||
$ jc systemctl list-unit-files
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.systemctl_luf
|
||||
result = jc.parsers.systemctl_luf.parse(systemctl_luf_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -45,11 +54,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -74,5 +83,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.timedatectl
|
||||
jc - JSON CLI output utility timedatectl Parser
|
||||
jc - JSON CLI output utility `timedatectl` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --timedatectl as the first argument if the piped input is coming from timedatectl or timedatectl status
|
||||
$ timedatectl | jc --timedatectl
|
||||
|
||||
or
|
||||
|
||||
$ jc timedatectl
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.timedatectl
|
||||
result = jc.parsers.timedatectl.parse(timedatectl_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -52,7 +61,7 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
|
||||
# jc.parsers.tracepath
|
||||
jc - JSON CLI output utility tracepath Parser
|
||||
jc - JSON CLI output utility `tracepath` command output parser
|
||||
|
||||
Usage:
|
||||
Supports `tracepath` and `tracepath6` output.
|
||||
|
||||
specify --tracepath as the first argument if the piped input is coming from tracepath
|
||||
Usage (cli):
|
||||
|
||||
$ tracepath 1.2.3.4 | jc --tracepath
|
||||
|
||||
or
|
||||
|
||||
$ jc tracepath 1.2.3.4
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.tracepath
|
||||
result = jc.parsers.tracepath.parse(tracepath_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -119,7 +130,7 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
@@ -1,16 +1,25 @@
|
||||
|
||||
# jc.parsers.traceroute
|
||||
jc - JSON CLI output utility traceroute Parser
|
||||
jc - JSON CLI output utility `traceroute` command output parser
|
||||
|
||||
Usage:
|
||||
Supports `traceroute` and `traceroute6` output.
|
||||
|
||||
specify --traceroute as the first argument if the piped input is coming from traceroute
|
||||
Note: On some operating systems you will need to redirect `STDERR` to `STDOUT` for destination info since the header line is sent to `STDERR`. A warning message will be printed to `STDERR` if the header row is not found.
|
||||
|
||||
Note: On some operating systems you will need to redirect STDERR to STDOUT for destination
|
||||
info since the header line is sent to STDERR. A warning message will be printed to
|
||||
STDERR if the header row is not found.
|
||||
e.g. `$ traceroute 8.8.8.8 2>&1 | jc --traceroute`
|
||||
|
||||
e.g. $ traceroute 8.8.8.8 2>&1 | jc --traceroute
|
||||
Usage (cli):
|
||||
|
||||
$ traceroute 1.2.3.4 | jc --traceroute
|
||||
|
||||
or
|
||||
|
||||
$ jc traceroute 1.2.3.4
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.traceroute
|
||||
result = jc.parsers.traceroute.parse(traceroute_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -110,7 +119,7 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
|
||||
# jc.parsers.uname
|
||||
jc - JSON CLI output utility uname Parser
|
||||
jc - JSON CLI output utility `uname -a` command output parser
|
||||
|
||||
Usage:
|
||||
Note: Must use `uname -a`
|
||||
|
||||
specify --uname as the first argument if the piped input is coming from uname
|
||||
Usage (cli):
|
||||
|
||||
Limitations:
|
||||
$ uname -a | jc --uname
|
||||
|
||||
must use 'uname -a'
|
||||
or
|
||||
|
||||
$ jc uname -a
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.uname
|
||||
result = jc.parsers.uname.parse(uname_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -44,7 +51,7 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.uptime
|
||||
jc - JSON CLI output utility uptime Parser
|
||||
jc - JSON CLI output utility `uptime` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --uptime as the first argument if the piped input is coming from uptime
|
||||
$ uptime | jc --uptime
|
||||
|
||||
or
|
||||
|
||||
$ jc uptime
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.uptime
|
||||
result = jc.parsers.uptime.parse(uptime_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -48,7 +57,7 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
|
||||
# jc.parsers.w
|
||||
jc - JSON CLI output utility w Parser
|
||||
jc - JSON CLI output utility `w` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --w as the first argument if the piped input is coming from w
|
||||
$ w | jc --w
|
||||
|
||||
or
|
||||
|
||||
$ jc w
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.w
|
||||
result = jc.parsers.w.parse(w_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -96,11 +105,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -131,5 +140,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
95
docs/parsers/wc.md
Normal file
95
docs/parsers/wc.md
Normal file
@@ -0,0 +1,95 @@
|
||||
|
||||
# jc.parsers.wc
|
||||
jc - JSON CLI output utility `wc` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ wc file.txt | jc --wc
|
||||
|
||||
or
|
||||
|
||||
$ jc wc file.txt
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.wc
|
||||
result = jc.parsers.wc.parse(wc_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
||||
|
||||
Examples:
|
||||
|
||||
$ wc * | jc --wc -p
|
||||
[
|
||||
{
|
||||
"filename": "airport-I.json",
|
||||
"lines": 1,
|
||||
"words": 30,
|
||||
"characters": 307
|
||||
},
|
||||
{
|
||||
"filename": "airport-I.out",
|
||||
"lines": 15,
|
||||
"words": 33,
|
||||
"characters": 348
|
||||
},
|
||||
{
|
||||
"filename": "airport-s.json",
|
||||
"lines": 1,
|
||||
"words": 202,
|
||||
"characters": 2152
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
|
||||
## 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:
|
||||
|
||||
[
|
||||
{
|
||||
"filename": string,
|
||||
"lines": integer,
|
||||
"words": integer,
|
||||
"characters": integer
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
## 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,12 +1,21 @@
|
||||
|
||||
# jc.parsers.who
|
||||
jc - JSON CLI output utility who Parser
|
||||
jc - JSON CLI output utility `who` command output parser
|
||||
|
||||
Usage:
|
||||
Accepts any of the following who options (or no options): `-aTH`
|
||||
|
||||
specify --who as the first argument if the piped input is coming from who
|
||||
Usage (cli):
|
||||
|
||||
accepts any of the following who options (or no options): -aTH
|
||||
$ who | jc --who
|
||||
|
||||
or
|
||||
|
||||
$ jc who
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.who
|
||||
result = jc.parsers.who.parse(who_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -116,11 +125,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -152,5 +161,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
|
||||
# jc.parsers.xml
|
||||
jc - JSON CLI output utility XML Parser
|
||||
jc - JSON CLI output utility `XML` file parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --xml as the first argument if the piped input is coming from an XML file
|
||||
$ cat foo.xml | jc --xml
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.xml
|
||||
result = jc.parsers.xml.parse(xml_file_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -72,7 +77,7 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
|
||||
# jc.parsers.yaml
|
||||
jc - JSON CLI output utility YAML Parser
|
||||
jc - JSON CLI output utility `YAML` file parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --yaml as the first argument if the piped input is coming from a YAML file
|
||||
$ cat foo.yaml | jc --yaml
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.yaml
|
||||
result = jc.parsers.yaml.parse(yaml_file_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -84,11 +89,11 @@ Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Each dictionary represents a YAML document:
|
||||
List of Dictionaries. Each dictionary represents a YAML document:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -113,5 +118,5 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries representing the YAML documents.
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ JC - JSON CLI output utility
|
||||
|
||||
This package serializes the output of many standard unix command line tools to JSON format.
|
||||
|
||||
For documentation on each parser, see [docs/parsers](https://github.com/kellyjonbrazil/jc/tree/master/docs/parsers).
|
||||
|
||||
CLI Example:
|
||||
|
||||
$ ls -l /usr/bin | jc --ls -p
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
This package serializes the output of many standard unix command line tools to JSON format.
|
||||
|
||||
For documentation on each parser, see [docs/parsers](https://github.com/kellyjonbrazil/jc/tree/master/docs/parsers).
|
||||
|
||||
CLI Example:
|
||||
|
||||
$ ls -l /usr/bin | jc --ls -p
|
||||
|
||||
17
jc/cli.py
17
jc/cli.py
@@ -21,7 +21,7 @@ import jc.appdirs as appdirs
|
||||
|
||||
|
||||
class info():
|
||||
version = '1.13.4'
|
||||
version = '1.14.2'
|
||||
description = 'JSON CLI output utility'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
@@ -34,6 +34,7 @@ parsers = [
|
||||
'airport-s',
|
||||
'arp',
|
||||
'blkid',
|
||||
'cksum',
|
||||
'crontab',
|
||||
'crontab-u',
|
||||
'csv',
|
||||
@@ -48,12 +49,15 @@ parsers = [
|
||||
'fstab',
|
||||
'group',
|
||||
'gshadow',
|
||||
'hash',
|
||||
'hashsum',
|
||||
'history',
|
||||
'hosts',
|
||||
'id',
|
||||
'ifconfig',
|
||||
'ini',
|
||||
'iptables',
|
||||
'iw-scan',
|
||||
'jobs',
|
||||
'kv',
|
||||
'last',
|
||||
@@ -84,6 +88,7 @@ parsers = [
|
||||
'uname',
|
||||
'uptime',
|
||||
'w',
|
||||
'wc',
|
||||
'who',
|
||||
'xml',
|
||||
'yaml'
|
||||
@@ -186,10 +191,10 @@ def set_env_colors(env_colors=None):
|
||||
|
||||
# Try the color set in the JC_COLORS env variable first. If it is set to default, then fall back to default colors
|
||||
return {
|
||||
Name.Tag: f'bold {PYGMENT_COLOR[color_list[0]]}' if not color_list[0] == 'default' else f"bold {PYGMENT_COLOR['blue']}", # key names
|
||||
Keyword: PYGMENT_COLOR[color_list[1]] if not color_list[1] == 'default' else PYGMENT_COLOR['brightblack'], # true, false, null
|
||||
Number: PYGMENT_COLOR[color_list[2]] if not color_list[2] == 'default' else PYGMENT_COLOR['magenta'], # numbers
|
||||
String: PYGMENT_COLOR[color_list[3]] if not color_list[3] == 'default' else PYGMENT_COLOR['green'] # strings
|
||||
Name.Tag: f'bold {PYGMENT_COLOR[color_list[0]]}' if color_list[0] != 'default' else f"bold {PYGMENT_COLOR['blue']}", # key names
|
||||
Keyword: PYGMENT_COLOR[color_list[1]] if color_list[1] != 'default' else PYGMENT_COLOR['brightblack'], # true, false, null
|
||||
Number: PYGMENT_COLOR[color_list[2]] if color_list[2] != 'default' else PYGMENT_COLOR['magenta'], # numbers
|
||||
String: PYGMENT_COLOR[color_list[3]] if color_list[3] != 'default' else PYGMENT_COLOR['green'] # strings
|
||||
}
|
||||
|
||||
|
||||
@@ -296,7 +301,7 @@ def helptext(message):
|
||||
-d debug - show traceback (-dd for verbose traceback)
|
||||
-m monochrome output
|
||||
-p pretty print output
|
||||
-q quiet - suppress warnings
|
||||
-q quiet - suppress parser warnings
|
||||
-r raw JSON output
|
||||
|
||||
Example:
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
"""jc - JSON CLI output utility airport -I Parser
|
||||
"""jc - JSON CLI output utility `airport -I` command output parser
|
||||
|
||||
Usage:
|
||||
The `airport` program can be found at `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport`.
|
||||
|
||||
specify --airport as the first argument if the piped input is coming from airport -I (OSX)
|
||||
Usage (cli):
|
||||
|
||||
This program can be found at:
|
||||
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport
|
||||
$ airport -I | jc --airport
|
||||
|
||||
or
|
||||
|
||||
$ jc airport -I
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.airport
|
||||
result = jc.parsers.airport.parse(airport_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -75,7 +83,7 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
"""jc - JSON CLI output utility airport -s Parser
|
||||
"""jc - JSON CLI output utility `airport -s` command output parser
|
||||
|
||||
Usage:
|
||||
The `airport` program can be found at `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport`.
|
||||
|
||||
specify --airport as the first argument if the piped input is coming from airport -s (OSX)
|
||||
Usage (cli):
|
||||
|
||||
This program can be found at:
|
||||
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport
|
||||
$ airport -s | jc --airport-s
|
||||
|
||||
or
|
||||
|
||||
$ jc airport -s
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.airport_s
|
||||
result = jc.parsers.airport_s.parse(airport_s_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -108,11 +116,11 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
[
|
||||
{
|
||||
"ssid": string,
|
||||
@@ -165,7 +173,7 @@ def parse(data, raw=False, quiet=False):
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
"""
|
||||
if not quiet:
|
||||
jc.utils.compatibility(__name__, info.compatible)
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
"""jc - JSON CLI output utility arp Parser
|
||||
"""jc - JSON CLI output utility `arp` command output parser
|
||||
|
||||
Usage:
|
||||
Supports `arp` and `arp -a` output.
|
||||
|
||||
specify --arp as the first argument if the piped input is coming from:
|
||||
Usage (cli):
|
||||
|
||||
arp
|
||||
or
|
||||
arp -a
|
||||
$ arp | jc --arp
|
||||
|
||||
or
|
||||
|
||||
$ jc arp
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.arp
|
||||
result = jc.parsers.arp.parse(arp_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -118,11 +125,11 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -166,7 +173,7 @@ def parse(data, raw=False, quiet=False):
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
"""
|
||||
if not quiet:
|
||||
jc.utils.compatibility(__name__, info.compatible)
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
"""jc - JSON CLI output utility blkid Parser
|
||||
"""jc - JSON CLI output utility `blkid` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --blkid as the first argument if the piped input is coming from blkid
|
||||
$ blkid | jc --blkid
|
||||
|
||||
or
|
||||
|
||||
$ jc blkid
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.blkid
|
||||
result = jc.parsers.blkid.parse(blkid_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -99,11 +108,11 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -169,7 +178,7 @@ def parse(data, raw=False, quiet=False):
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
"""
|
||||
if not quiet:
|
||||
jc.utils.compatibility(__name__, info.compatible)
|
||||
|
||||
128
jc/parsers/cksum.py
Normal file
128
jc/parsers/cksum.py
Normal file
@@ -0,0 +1,128 @@
|
||||
"""jc - JSON CLI output utility `cksum` command output parser
|
||||
|
||||
This parser works with the following checksum calculation utilities:
|
||||
- `sum`
|
||||
- `cksum`
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cksum file.txt | jc --cksum
|
||||
|
||||
or
|
||||
|
||||
$ jc cksum file.txt
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.cksum
|
||||
result = jc.parsers.cksum.parse(cksum_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
||||
|
||||
Examples:
|
||||
|
||||
$ cksum * | jc --cksum -p
|
||||
[
|
||||
{
|
||||
"filename": "__init__.py",
|
||||
"checksum": 4294967295,
|
||||
"blocks": 0
|
||||
},
|
||||
{
|
||||
"filename": "airport.py",
|
||||
"checksum": 2208551092,
|
||||
"blocks": 3745
|
||||
},
|
||||
{
|
||||
"filename": "airport_s.py",
|
||||
"checksum": 1113817598,
|
||||
"blocks": 4572
|
||||
},
|
||||
...
|
||||
]
|
||||
"""
|
||||
import jc.utils
|
||||
|
||||
|
||||
class info():
|
||||
version = '1.0'
|
||||
description = 'cksum command parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
details = 'Parses cksum and sum program output'
|
||||
|
||||
# compatible options: linux, darwin, cygwin, win32, aix, freebsd
|
||||
compatible = ['linux', 'darwin', 'cygwin', 'aix', 'freebsd']
|
||||
magic_commands = ['cksum', 'sum']
|
||||
|
||||
|
||||
__version__ = info.version
|
||||
|
||||
|
||||
def 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:
|
||||
|
||||
[
|
||||
{
|
||||
"filename": string,
|
||||
"checksum": integer,
|
||||
"blocks": integer
|
||||
}
|
||||
]
|
||||
"""
|
||||
|
||||
for entry in proc_data:
|
||||
int_list = ['checksum', 'blocks']
|
||||
for key in int_list:
|
||||
if key in entry:
|
||||
try:
|
||||
entry[key] = int(entry[key])
|
||||
except (ValueError):
|
||||
entry[key] = None
|
||||
return proc_data
|
||||
|
||||
|
||||
def 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.
|
||||
"""
|
||||
if not quiet:
|
||||
jc.utils.compatibility(__name__, info.compatible)
|
||||
|
||||
raw_output = []
|
||||
|
||||
if jc.utils.has_data(data):
|
||||
|
||||
for line in filter(None, data.splitlines()):
|
||||
item = {
|
||||
'filename': line.split(maxsplit=2)[2],
|
||||
'checksum': line.split(maxsplit=2)[0],
|
||||
'blocks': line.split(maxsplit=2)[1]
|
||||
}
|
||||
raw_output.append(item)
|
||||
|
||||
if raw:
|
||||
return raw_output
|
||||
else:
|
||||
return process(raw_output)
|
||||
@@ -1,8 +1,19 @@
|
||||
"""jc - JSON CLI output utility crontab command and file Parser
|
||||
"""jc - JSON CLI output utility `crontab -l` command output and crontab file parser
|
||||
|
||||
Usage:
|
||||
Supports `crontab -l` command output and crontab files.
|
||||
|
||||
specify --crontab as the first argument if the piped input is coming from crontab -l or a crontab file
|
||||
Usage (cli):
|
||||
|
||||
$ crontab -l | jc --crontab
|
||||
|
||||
or
|
||||
|
||||
$ jc crontab -l
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.crontab
|
||||
result = jc.parsers.crontab.parse(crontab_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -152,7 +163,7 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
"""jc - JSON CLI output utility crontab file Parser
|
||||
"""jc - JSON CLI output utility `crontab -l` command output and crontab file parser
|
||||
|
||||
Usage:
|
||||
This version of the `crontab -l` parser supports output that contains user information for processes.
|
||||
|
||||
specify --crontab-u as the first argument if the piped input is coming from a crontab file with User specified
|
||||
Usage (cli):
|
||||
|
||||
$ crontab -l | jc --crontab-u
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.crontab_u
|
||||
result = jc.parsers.crontab_u.parse(crontab_u_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -152,7 +159,7 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
"""jc - JSON CLI output utility csv Parser
|
||||
"""jc - JSON CLI output utility `csv` file parser
|
||||
|
||||
Usage:
|
||||
The `csv` parser will attempt to automatically detect the delimiter character. If the delimiter cannot be detected it will default to comma. The first row of the file must be a header row.
|
||||
|
||||
specify --csv as the first argument if the piped input is coming from a csv file.
|
||||
the csv parser will attempt to automatically detect the delimiter character.
|
||||
if the delimiter cannot be detected it will default to comma.
|
||||
the first row of the file must be a header row.
|
||||
Usage (cli):
|
||||
|
||||
$ cat file.csv | jc --csv
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.csv
|
||||
result = jc.parsers.csv.parse(csv_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -82,11 +86,11 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Each dictionary represents a row in the csv file:
|
||||
List of Dictionaries. Each Dictionary represents a row in the csv file:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -112,7 +116,7 @@ def parse(data, raw=False, quiet=False):
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
"""
|
||||
if not quiet:
|
||||
jc.utils.compatibility(__name__, info.compatible)
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
"""jc - JSON CLI output utility date Parser
|
||||
"""jc - JSON CLI output utility `date` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --date as the first argument if the piped input is coming from date
|
||||
$ date | jc --date
|
||||
|
||||
or
|
||||
|
||||
$ jc date
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.date
|
||||
result = jc.parsers.date.parse(date_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -18,6 +27,7 @@ Examples:
|
||||
"hour": 16,
|
||||
"minute": 48,
|
||||
"second": 11,
|
||||
"period": null,
|
||||
"month": "Jul",
|
||||
"weekday": "Fri",
|
||||
"weekday_num": 6,
|
||||
@@ -40,7 +50,7 @@ import jc.utils
|
||||
|
||||
|
||||
class info():
|
||||
version = '1.0'
|
||||
version = '1.1'
|
||||
description = 'date command parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
@@ -59,7 +69,7 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -72,6 +82,7 @@ def process(proc_data):
|
||||
"hour": integer,
|
||||
"minute": integer,
|
||||
"second": integer,
|
||||
"period": string,
|
||||
"month": string,
|
||||
"weekday": string,
|
||||
"weekday_num": integer,
|
||||
@@ -111,6 +122,7 @@ def process(proc_data):
|
||||
"hour": int(proc_data['hour']),
|
||||
"minute": int(proc_data['minute']),
|
||||
"second": int(proc_data['second']),
|
||||
"period": proc_data['period'] if 'period' in proc_data else None,
|
||||
"month": proc_data['month'],
|
||||
"weekday": proc_data['weekday'],
|
||||
"weekday_num": weekday_map[proc_data['weekday']],
|
||||
@@ -143,16 +155,31 @@ def parse(data, raw=False, quiet=False):
|
||||
data = data.replace(':', ' ')
|
||||
split_data = data.split()
|
||||
|
||||
raw_output = {
|
||||
"year": split_data[7],
|
||||
"month": split_data[1],
|
||||
"day": split_data[2],
|
||||
"weekday": split_data[0],
|
||||
"hour": split_data[3],
|
||||
"minute": split_data[4],
|
||||
"second": split_data[5],
|
||||
"timezone": split_data[6]
|
||||
}
|
||||
# date v8.32 uses a different format depending on locale, so need to support LANG=en_US.UTF-8
|
||||
if len(split_data) == 9 and ('AM' in split_data or 'am' in split_data or 'PM' in split_data or 'pm' in split_data):
|
||||
raw_output = {
|
||||
"year": split_data[8],
|
||||
"month": split_data[1],
|
||||
"day": split_data[2],
|
||||
"weekday": split_data[0],
|
||||
"hour": split_data[3],
|
||||
"minute": split_data[4],
|
||||
"second": split_data[5],
|
||||
"period": split_data[6],
|
||||
"timezone": split_data[7]
|
||||
}
|
||||
else:
|
||||
# standard LANG=C date output
|
||||
raw_output = {
|
||||
"year": split_data[7],
|
||||
"month": split_data[1],
|
||||
"day": split_data[2],
|
||||
"weekday": split_data[0],
|
||||
"hour": split_data[3],
|
||||
"minute": split_data[4],
|
||||
"second": split_data[5],
|
||||
"timezone": split_data[6]
|
||||
}
|
||||
|
||||
if raw:
|
||||
return raw_output
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
"""jc - JSON CLI output utility df Parser
|
||||
"""jc - JSON CLI output utility `df` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --df as the first argument if the piped input is coming from df
|
||||
$ df | jc --df
|
||||
|
||||
or
|
||||
|
||||
$ jc df
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.df
|
||||
result = jc.parsers.df.parse(df_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -92,11 +101,11 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -177,7 +186,7 @@ def parse(data, raw=False, quiet=False):
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
"""
|
||||
|
||||
if not quiet:
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
"""jc - JSON CLI output utility dig Parser
|
||||
"""jc - JSON CLI output utility `dig` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
Specify --dig as the first argument if the piped input is coming from dig
|
||||
$ dig example.com | jc --dig
|
||||
|
||||
or
|
||||
|
||||
$ jc dig example.com
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.dig
|
||||
result = jc.parsers.dig.parse(dig_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -324,7 +333,7 @@ import jc.utils
|
||||
|
||||
|
||||
class info():
|
||||
version = '1.3'
|
||||
version = '1.4'
|
||||
description = 'dig command parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
@@ -343,11 +352,11 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -517,7 +526,11 @@ def parse_answer(answer):
|
||||
answer_class = answer[2]
|
||||
answer_type = answer[3]
|
||||
answer_ttl = answer[1]
|
||||
answer_data = answer[4]
|
||||
answer_data = ' '.join(answer[4:])
|
||||
|
||||
# remove surrounding quotation marks from answer_data if they exist
|
||||
if answer_data.startswith('"') and answer_data.endswith('"'):
|
||||
answer_data = answer_data[1:-1]
|
||||
|
||||
return {'name': answer_name,
|
||||
'class': answer_class,
|
||||
@@ -557,7 +570,7 @@ def parse(data, raw=False, quiet=False):
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
"""
|
||||
|
||||
if not quiet:
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
"""jc - JSON CLI output utility dmidecode Parser
|
||||
"""jc - JSON CLI output utility `dmidecode` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --dmidecode as the first argument if the piped input is coming from dmidecode
|
||||
$ dmidecode | jc --dmidecode
|
||||
|
||||
or
|
||||
|
||||
$ jc dmidecode
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.dmidecode
|
||||
result = jc.parsers.dmidecode.parse(dmidecode_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -122,11 +131,11 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -171,7 +180,7 @@ def parse(data, raw=False, quiet=False):
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
"""
|
||||
if not quiet:
|
||||
jc.utils.compatibility(__name__, info.compatible)
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
"""jc - JSON CLI output utility du Parser
|
||||
"""jc - JSON CLI output utility `du` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --du as the first argument if the piped input is coming from du
|
||||
$ du | jc --du
|
||||
|
||||
or
|
||||
|
||||
$ jc du
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.du
|
||||
result = jc.parsers.du.parse(du_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -93,11 +102,11 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -131,7 +140,7 @@ def parse(data, raw=False, quiet=False):
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
"""
|
||||
if not quiet:
|
||||
jc.utils.compatibility(__name__, info.compatible)
|
||||
|
||||
@@ -1,8 +1,19 @@
|
||||
"""jc - JSON CLI output utility env Parser
|
||||
"""jc - JSON CLI output utility `env` and `printenv` command output parser
|
||||
|
||||
Usage:
|
||||
This parser will output a list of dictionaries each containing `name` and `value` keys. If you would like a simple dictionary output, then use the `-r` command-line option or the `raw=True` argument in the `parse()` function.
|
||||
|
||||
specify --env as the first argument if the piped input is coming from env
|
||||
Usage (cli):
|
||||
|
||||
$ env | jc --env
|
||||
|
||||
or
|
||||
|
||||
$ jc env
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.env
|
||||
result = jc.parsers.env.parse(env_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -59,7 +70,7 @@ class info():
|
||||
|
||||
# compatible options: linux, darwin, cygwin, win32, aix, freebsd
|
||||
compatible = ['linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd']
|
||||
magic_commands = ['env']
|
||||
magic_commands = ['env', 'printenv']
|
||||
|
||||
|
||||
__version__ = info.version
|
||||
@@ -71,11 +82,11 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -109,7 +120,7 @@ def parse(data, raw=False, quiet=False):
|
||||
Returns:
|
||||
|
||||
Dictionary of raw structured data or
|
||||
list of dictionaries of processed structured data
|
||||
List of Dictionaries of processed structured data
|
||||
"""
|
||||
if not quiet:
|
||||
jc.utils.compatibility(__name__, info.compatible)
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
"""jc - JSON CLI output utility file command Parser
|
||||
"""jc - JSON CLI output utility `file` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --file as the first argument if the piped input is coming from file.
|
||||
$ file * | jc --file
|
||||
|
||||
or
|
||||
|
||||
$ jc file *
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.file
|
||||
result = jc.parsers.file.parse(file_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -67,11 +76,11 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -96,7 +105,7 @@ def parse(data, raw=False, quiet=False):
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
"""
|
||||
if not quiet:
|
||||
jc.utils.compatibility(__name__, info.compatible)
|
||||
|
||||
@@ -1,8 +1,19 @@
|
||||
"""jc - JSON CLI output utility foo Parser
|
||||
"""jc - JSON CLI output utility `foo` command output parser
|
||||
|
||||
Usage:
|
||||
<<Short foo description and caveats>>
|
||||
|
||||
specify --foo as the first argument if the piped input is coming from foo
|
||||
Usage (cli):
|
||||
|
||||
$ foo | jc --foo
|
||||
|
||||
or
|
||||
|
||||
$ jc foo
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.foo
|
||||
result = jc.parsers.foo.parse(foo_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -40,11 +51,11 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -71,7 +82,7 @@ def parse(data, raw=False, quiet=False):
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
"""
|
||||
if not quiet:
|
||||
jc.utils.compatibility(__name__, info.compatible)
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
"""jc - JSON CLI output utility free Parser
|
||||
"""jc - JSON CLI output utility `free` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --free as the first argument if the piped input is coming from free
|
||||
$ free | jc --free
|
||||
|
||||
or
|
||||
|
||||
$ jc free
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.free
|
||||
result = jc.parsers.free.parse(free_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -72,11 +81,11 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -116,7 +125,7 @@ def parse(data, raw=False, quiet=False):
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
"""
|
||||
if not quiet:
|
||||
jc.utils.compatibility(__name__, info.compatible)
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
"""jc - JSON CLI output utility fstab Parser
|
||||
"""jc - JSON CLI output utility `fstab` file parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --fstab as the first argument if the piped input is coming from a fstab file
|
||||
$ cat /etc/fstab | jc --fstab
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.fstab
|
||||
result = jc.parsers.fstab.parse(fstab_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -88,11 +93,11 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -130,7 +135,7 @@ def parse(data, raw=False, quiet=False):
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
"""
|
||||
if not quiet:
|
||||
jc.utils.compatibility(__name__, info.compatible)
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
"""jc - JSON CLI output utility /etc/group file Parser
|
||||
"""jc - JSON CLI output utility `/etc/group` file parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --group as the first argument if the piped input is coming from /etc/group
|
||||
$ cat /etc/group | jc --group
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.group
|
||||
result = jc.parsers.group.parse(group_file_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -113,11 +118,11 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -158,7 +163,7 @@ def parse(data, raw=False, quiet=False):
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
"""
|
||||
if not quiet:
|
||||
jc.utils.compatibility(__name__, info.compatible)
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
"""jc - JSON CLI output utility /etc/gshadow file Parser
|
||||
"""jc - JSON CLI output utility `/etc/gshadow` file parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --gshadow as the first argument if the piped input is coming from /etc/gshadow
|
||||
$ cat /etc/gshadow | jc --gshadow
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.gshadow
|
||||
result = jc.parsers.gshadow.parse(gshadow_file_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -79,11 +84,11 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -120,7 +125,7 @@ def parse(data, raw=False, quiet=False):
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
"""
|
||||
if not quiet:
|
||||
jc.utils.compatibility(__name__, info.compatible)
|
||||
|
||||
108
jc/parsers/hash.py
Normal file
108
jc/parsers/hash.py
Normal file
@@ -0,0 +1,108 @@
|
||||
"""jc - JSON CLI output utility `hash` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ hash | jc --hash
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.hash
|
||||
result = jc.parsers.hash.parse(hash_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
||||
|
||||
Examples:
|
||||
|
||||
$ hash | jc --hash -p
|
||||
[
|
||||
{
|
||||
"hits": 2,
|
||||
"command": "/bin/cat"
|
||||
},
|
||||
{
|
||||
"hits": 1,
|
||||
"command": "/bin/ls"
|
||||
}
|
||||
]
|
||||
"""
|
||||
import jc.utils
|
||||
import jc.parsers.universal
|
||||
|
||||
|
||||
class info():
|
||||
version = '1.0'
|
||||
description = 'hash command parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
|
||||
# compatible options: linux, darwin, cygwin, win32, aix, freebsd
|
||||
compatible = ['linux', 'darwin', 'cygwin', 'aix', 'freebsd']
|
||||
|
||||
|
||||
__version__ = info.version
|
||||
|
||||
|
||||
def 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:
|
||||
|
||||
[
|
||||
{
|
||||
"command": string,
|
||||
"hits": integer
|
||||
}
|
||||
]
|
||||
"""
|
||||
for entry in proc_data:
|
||||
# change to int
|
||||
int_list = ['hits']
|
||||
for key in int_list:
|
||||
if key in entry:
|
||||
try:
|
||||
key_int = int(entry[key])
|
||||
entry[key] = key_int
|
||||
except (ValueError):
|
||||
entry[key] = None
|
||||
|
||||
return proc_data
|
||||
|
||||
|
||||
def 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.
|
||||
"""
|
||||
if not quiet:
|
||||
jc.utils.compatibility(__name__, info.compatible)
|
||||
|
||||
cleandata = data.splitlines()
|
||||
raw_output = []
|
||||
|
||||
if jc.utils.has_data(data):
|
||||
|
||||
cleandata[0] = cleandata[0].lower()
|
||||
raw_output = jc.parsers.universal.simple_table_parse(cleandata)
|
||||
|
||||
if raw:
|
||||
return raw_output
|
||||
else:
|
||||
return process(raw_output)
|
||||
145
jc/parsers/hashsum.py
Normal file
145
jc/parsers/hashsum.py
Normal file
@@ -0,0 +1,145 @@
|
||||
"""jc - JSON CLI output utility `hash sum` command output parser
|
||||
|
||||
This parser works with the following hash calculation utilities:
|
||||
- `md5`
|
||||
- `md5sum`
|
||||
- `shasum`
|
||||
- `sha1sum`
|
||||
- `sha224sum`
|
||||
- `sha256sum`
|
||||
- `sha384sum`
|
||||
- `sha512sum`
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ md5sum file.txt | jc --hashsum
|
||||
|
||||
or
|
||||
|
||||
$ jc md5sum file.txt
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.hashsum
|
||||
result = jc.parsers.hashsum.parse(md5sum_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
||||
|
||||
Examples:
|
||||
|
||||
$ md5sum * | jc --hashsum -p
|
||||
[
|
||||
{
|
||||
"filename": "devtoolset-3-gcc-4.9.2-6.el7.x86_64.rpm",
|
||||
"hash": "65fc958c1add637ec23c4b137aecf3d3"
|
||||
},
|
||||
{
|
||||
"filename": "digout",
|
||||
"hash": "5b9312ee5aff080927753c63a347707d"
|
||||
},
|
||||
{
|
||||
"filename": "dmidecode.out",
|
||||
"hash": "716fd11c2ac00db109281f7110b8fb9d"
|
||||
},
|
||||
{
|
||||
"filename": "file with spaces in the name",
|
||||
"hash": "d41d8cd98f00b204e9800998ecf8427e"
|
||||
},
|
||||
{
|
||||
"filename": "id-centos.out",
|
||||
"hash": "4295be239a14ad77ef3253103de976d2"
|
||||
},
|
||||
{
|
||||
"filename": "ifcfg.json",
|
||||
"hash": "01fda0d9ba9a75618b072e64ff512b43"
|
||||
},
|
||||
...
|
||||
]
|
||||
"""
|
||||
import jc.utils
|
||||
|
||||
|
||||
class info():
|
||||
version = '1.0'
|
||||
description = 'hashsum command parser (md5sum, shasum, etc.)'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
details = 'Parses MD5 and SHA hash program output'
|
||||
|
||||
# compatible options: linux, darwin, cygwin, win32, aix, freebsd
|
||||
compatible = ['linux', 'darwin', 'cygwin', 'aix', 'freebsd']
|
||||
magic_commands = ['md5sum', 'md5', 'shasum', 'sha1sum', 'sha224sum', 'sha256sum', 'sha384sum', 'sha512sum']
|
||||
|
||||
|
||||
__version__ = info.version
|
||||
|
||||
|
||||
def 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:
|
||||
|
||||
[
|
||||
{
|
||||
"filename": string,
|
||||
"hash": string,
|
||||
}
|
||||
]
|
||||
"""
|
||||
|
||||
# no further processing for this parser
|
||||
return proc_data
|
||||
|
||||
|
||||
def 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.
|
||||
"""
|
||||
if not quiet:
|
||||
jc.utils.compatibility(__name__, info.compatible)
|
||||
|
||||
raw_output = []
|
||||
|
||||
if jc.utils.has_data(data):
|
||||
|
||||
for line in filter(None, data.splitlines()):
|
||||
# check for legacy md5 command output
|
||||
if line.startswith('MD5 ('):
|
||||
file_hash = line.split('=', maxsplit=1)[1].strip()
|
||||
file_name = line.split('=', maxsplit=1)[0].strip()
|
||||
file_name = file_name[5:]
|
||||
file_name = file_name[:-1]
|
||||
# standard md5sum and shasum command output
|
||||
else:
|
||||
file_hash = line.split(maxsplit=1)[0]
|
||||
file_name = line.split(maxsplit=1)[1]
|
||||
|
||||
item = {
|
||||
'filename': file_name,
|
||||
'hash': file_hash
|
||||
}
|
||||
raw_output.append(item)
|
||||
|
||||
if raw:
|
||||
return raw_output
|
||||
else:
|
||||
return process(raw_output)
|
||||
@@ -1,8 +1,15 @@
|
||||
"""jc - JSON CLI output utility history Parser
|
||||
"""jc - JSON CLI output utility `history` command output parser
|
||||
|
||||
Usage:
|
||||
This parser will output a list of dictionaries each containing `line` and `command` keys. If you would like a simple dictionary output, then use the `-r` command-line option or the `raw=True` argument in the `parse()` function.
|
||||
|
||||
specify --history as the first argument if the piped input is coming from history
|
||||
Usage (cli):
|
||||
|
||||
$ history | jc --history
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.history
|
||||
result = jc.parsers.history.parse(history_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -63,11 +70,11 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -101,7 +108,7 @@ def parse(data, raw=False, quiet=False):
|
||||
Returns:
|
||||
|
||||
Dictionary of raw structured data or
|
||||
list of dictionaries of processed structured data
|
||||
List of Dictionaries of processed structured data
|
||||
"""
|
||||
if not quiet:
|
||||
jc.utils.compatibility(__name__, info.compatible)
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
"""jc - JSON CLI output utility hosts Parser
|
||||
"""jc - JSON CLI output utility `/etc/hosts` file parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --hosts as the first argument if the piped input is coming from a hosts file
|
||||
$ cat /etc/hosts | jc --hosts
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.hosts
|
||||
result = jc.parsers.hosts.parse(hosts_file_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -79,11 +84,11 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -111,7 +116,7 @@ def parse(data, raw=False, quiet=False):
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
"""
|
||||
if not quiet:
|
||||
jc.utils.compatibility(__name__, info.compatible)
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
"""jc - JSON CLI output utility id Parser
|
||||
"""jc - JSON CLI output utility `id` command output parser
|
||||
|
||||
Usage:
|
||||
Usage (cli):
|
||||
|
||||
specify --id as the first argument if the piped input is coming from id
|
||||
$ id | jc --id
|
||||
|
||||
or
|
||||
|
||||
$ jc id
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.id
|
||||
result = jc.parsers.id.parse(id_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -90,7 +99,7 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -160,7 +169,7 @@ def parse(data, raw=False, quiet=False):
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
Dictionary. Raw or processed structured data.
|
||||
"""
|
||||
if not quiet:
|
||||
jc.utils.compatibility(__name__, info.compatible)
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
"""jc - JSON CLI output utility ifconfig Parser
|
||||
"""jc - JSON CLI output utility `ifconfig` command output parser
|
||||
|
||||
Usage:
|
||||
Note: No `ifconfig` options are supported.
|
||||
|
||||
specify --ifconfig as the first argument if the piped input is coming from ifconfig
|
||||
Usage (cli):
|
||||
|
||||
no ifconfig options are supported.
|
||||
$ ifconfig | jc --ifconfig
|
||||
|
||||
or
|
||||
|
||||
$ jc ifconfig
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.ifconfig
|
||||
result = jc.parsers.ifconfig.parse(ifconfig_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -381,11 +390,11 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -466,7 +475,7 @@ def parse(data, raw=False, quiet=False):
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
"""
|
||||
if not quiet:
|
||||
jc.utils.compatibility(__name__, info.compatible)
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
"""jc - JSON CLI output utility INI Parser
|
||||
"""jc - JSON CLI output utility `INI` file parser
|
||||
|
||||
Usage:
|
||||
Parses standard `INI` files and files containing simple key/value pairs. Delimiter can be `=` or `:`. Missing values are supported. Comment prefix can be `#` or `;`. Comments must be on their own line.
|
||||
|
||||
Specify --ini as the first argument if the piped input is coming from an INI file or any
|
||||
simple key/value pair file. Delimiter can be '=' or ':'. Missing values are supported.
|
||||
Comment prefix can be '#' or ';'. Comments must be on their own line.
|
||||
Note: Values starting and ending with quotation marks will have the marks removed. If you would like to keep the quotation marks, use the `-r` command-line argument or the `raw=True` argument in `parse()`.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cat foo.ini | jc --ini
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.ini
|
||||
result = jc.parsers.ini.parse(ini_file_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -68,7 +75,7 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
"""jc - JSON CLI output utility ipables Parser
|
||||
"""jc - JSON CLI output utility `ipables` command output parser
|
||||
|
||||
Usage:
|
||||
Supports `-vLn` and `--line-numbers` for all tables.
|
||||
|
||||
Specify --iptables as the first argument if the piped input is coming from iptables
|
||||
Usage (cli):
|
||||
|
||||
Supports -vLn and --line-numbers for all tables
|
||||
$ sudo iptables -L -t nat | jc --iptables
|
||||
|
||||
or
|
||||
|
||||
$ jc iptables -L -t nat
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.iptables
|
||||
result = jc.parsers.iptables.parse(iptables_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -153,11 +162,11 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -234,7 +243,7 @@ def parse(data, raw=False, quiet=False):
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
"""
|
||||
if not quiet:
|
||||
jc.utils.compatibility(__name__, info.compatible)
|
||||
|
||||
332
jc/parsers/iw_scan.py
Normal file
332
jc/parsers/iw_scan.py
Normal file
@@ -0,0 +1,332 @@
|
||||
"""jc - JSON CLI output utility `iw dev <device> 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 dev wlan0 scan | jc --iw-scan -p
|
||||
[
|
||||
{
|
||||
"bssid": "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 re
|
||||
import jc.utils
|
||||
|
||||
|
||||
class info():
|
||||
version = '0.5'
|
||||
description = 'iw dev <device> scan command parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
details = 'Enhancements by Philipp Schmitt (https://pschmitt.dev/)'
|
||||
|
||||
# compatible options: linux, darwin, cygwin, win32, aix, freebsd
|
||||
compatible = ['linux']
|
||||
magic_commands = ['iw dev']
|
||||
|
||||
|
||||
__version__ = info.version
|
||||
|
||||
|
||||
def 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
|
||||
}
|
||||
]
|
||||
"""
|
||||
|
||||
# convert ints and floats for top-level keys
|
||||
for item in proc_data:
|
||||
for key in item:
|
||||
try:
|
||||
item[key] = int(item[key])
|
||||
except (Exception):
|
||||
try:
|
||||
item[key] = float(item[key])
|
||||
except (Exception):
|
||||
pass
|
||||
# convert ints and floats for lists
|
||||
if isinstance(item[key], list):
|
||||
new_list = []
|
||||
for list_item in item[key]:
|
||||
try:
|
||||
new_list.append(int(list_item))
|
||||
except (Exception):
|
||||
try:
|
||||
new_list.append(float(list_item))
|
||||
except (Exception):
|
||||
pass
|
||||
item[key] = new_list
|
||||
|
||||
return proc_data
|
||||
|
||||
def post_parse(data):
|
||||
# remove empty items
|
||||
cleandata = []
|
||||
for ssid in data:
|
||||
ssid = { k : v for k, v in ssid.items() if v}
|
||||
cleandata.append(ssid)
|
||||
|
||||
# remove asterisks from begining of values
|
||||
for ssid in cleandata:
|
||||
for key in ssid:
|
||||
if ssid[key].startswith('*'):
|
||||
ssid[key] = ssid[key][1:].strip()
|
||||
|
||||
for item in cleandata:
|
||||
if 'country' in item:
|
||||
country_split = item['country'].split()
|
||||
item['country'] = country_split[0]
|
||||
if len(country_split) > 1:
|
||||
item['environment'] = country_split[2]
|
||||
|
||||
if 'tsf' in item:
|
||||
item['tsf_usec'] = item['tsf'].split()[0]
|
||||
del item['tsf']
|
||||
|
||||
if 'sta_channel_width' in item:
|
||||
item['sta_channel_width_mhz'] = item['sta_channel_width'].replace(' MHz', '')
|
||||
del item['sta_channel_width']
|
||||
|
||||
if 'passive_dwell' in item:
|
||||
item['passive_dwell_tus'] = item['passive_dwell'].replace(' TUs', '')
|
||||
del item['passive_dwell']
|
||||
|
||||
if 'active_dwell' in item:
|
||||
item['active_dwell_tus'] = item['active_dwell'].replace(' TUs', '')
|
||||
del item['active_dwell']
|
||||
|
||||
if 'channel_width_trigger_scan_interval' in item:
|
||||
item['channel_width_trigger_scan_interval_s'] = item['channel_width_trigger_scan_interval'].replace(' s', '')
|
||||
del item['channel_width_trigger_scan_interval']
|
||||
|
||||
if 'scan_passive_total_per_channel' in item:
|
||||
item['scan_passive_total_per_channel_tus'] = item['scan_passive_total_per_channel'].replace(' TUs', '')
|
||||
del item['scan_passive_total_per_channel']
|
||||
|
||||
if 'scan_active_total_per_channel' in item:
|
||||
item['scan_active_total_per_channel_tus'] = item['scan_active_total_per_channel'].replace(' TUs', '')
|
||||
del item['scan_active_total_per_channel']
|
||||
|
||||
if 'beacon_interval' in item:
|
||||
item['beacon_interval_tus'] = item['beacon_interval'].replace(' TUs', '')
|
||||
del item['beacon_interval']
|
||||
|
||||
if 'signal' in item:
|
||||
item['signal_dbm'] = item['signal'].replace(' dBm', '')
|
||||
del item['signal']
|
||||
|
||||
if 'last_seen' in item:
|
||||
item['last_seen_ms'] = item['last_seen'].replace(' ms ago', '')
|
||||
del item['last_seen']
|
||||
|
||||
if 'supported_rates' in item:
|
||||
selected_rates = []
|
||||
for rate in item['supported_rates'].split():
|
||||
if rate.endswith('*'):
|
||||
selected_rates.append(rate.replace('*', ''))
|
||||
item['selected_rates'] = selected_rates
|
||||
item['supported_rates'] = item['supported_rates'].replace('*', '').split()
|
||||
|
||||
if 'extended_supported_rates' in item:
|
||||
item['extended_supported_rates'] = item['extended_supported_rates'].split()
|
||||
|
||||
if 'obss_scan_activity_threshold' in item:
|
||||
item['obss_scan_activity_threshold_percent'] = item['obss_scan_activity_threshold'].replace(' %', '')
|
||||
del item['obss_scan_activity_threshold']
|
||||
|
||||
if 'ds_parameter_set' in item:
|
||||
item['ds_parameter_set_channel'] = item['ds_parameter_set'].replace('channel ', '')
|
||||
del item['ds_parameter_set']
|
||||
|
||||
if 'max_amsdu_length' in item:
|
||||
item['max_amsdu_length_bytes'] = item['max_amsdu_length'].replace(' bytes', '')
|
||||
del item['max_amsdu_length']
|
||||
|
||||
if 'available_admission_capacity' in item:
|
||||
item['available_admission_capacity'] = item['available_admission_capacity'].replace(' [*32us]', '')
|
||||
|
||||
if 'power_constraint' in item:
|
||||
item['power_constraint_db'] = item['power_constraint'].replace(' dB', '')
|
||||
del item['power_constraint']
|
||||
|
||||
if 'minimum_rx_ampdu_time_spacing' in item:
|
||||
item['minimum_rx_ampdu_time_spacing_usec'] = item['minimum_rx_ampdu_time_spacing'].split()[0]
|
||||
del item['minimum_rx_ampdu_time_spacing']
|
||||
|
||||
if 'vht_rx_highest_supported' in item:
|
||||
item['vht_rx_highest_supported_mbps'] = item['vht_rx_highest_supported'].replace(' Mbps', '')
|
||||
del item['vht_rx_highest_supported']
|
||||
|
||||
if 'vht_tx_highest_supported' in item:
|
||||
item['vht_tx_highest_supported_mbps'] = item['vht_tx_highest_supported'].replace(' Mbps', '')
|
||||
del item['vht_tx_highest_supported']
|
||||
|
||||
return process(cleandata)
|
||||
|
||||
def 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.
|
||||
"""
|
||||
if not quiet:
|
||||
jc.utils.compatibility(__name__, info.compatible)
|
||||
|
||||
raw_output = []
|
||||
section = {}
|
||||
|
||||
if jc.utils.has_data(data):
|
||||
|
||||
for line in filter(None, data.splitlines()):
|
||||
if line.startswith('BSS'):
|
||||
if section:
|
||||
raw_output.append(section)
|
||||
section = {}
|
||||
|
||||
split_line = line.replace('(', ' ').replace(')', ' ').split()
|
||||
section['bssid'] = split_line[1]
|
||||
section['interface'] = split_line[3]
|
||||
|
||||
continue
|
||||
|
||||
if re.match(r"^\s+.+", line):
|
||||
# ignore problematic lines
|
||||
if 'Maximum RX AMPDU length' in line:
|
||||
continue
|
||||
|
||||
split_line = line.split(':', maxsplit=1)
|
||||
if len(split_line) == 2:
|
||||
split_line[0] = split_line[0].lower().replace('*', '').replace('(', '').replace(')', '').replace(',', '').replace('-', '_').strip().replace(' ', '_')
|
||||
section[split_line[0]] = split_line[1].strip()
|
||||
|
||||
continue
|
||||
|
||||
if section:
|
||||
raw_output.append(section)
|
||||
|
||||
if raw:
|
||||
return raw_output
|
||||
else:
|
||||
return post_parse(raw_output)
|
||||
@@ -1,10 +1,19 @@
|
||||
"""jc - JSON CLI output utility jobs Parser
|
||||
"""jc - JSON CLI output utility `jobs` command output parser
|
||||
|
||||
Usage:
|
||||
Also supports the `-l` option.
|
||||
|
||||
specify --jobs as the first argument if the piped input is coming from jobs
|
||||
Usage (cli):
|
||||
|
||||
Also supports the -l option
|
||||
$ jobs | jc --jobs
|
||||
|
||||
or
|
||||
|
||||
$ jc jobs
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.jobs
|
||||
result = jc.parsers.jobs.parse(jobs_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
@@ -96,11 +105,11 @@ def process(proc_data):
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (dictionary) raw structured data to process
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Structured data with the following schema:
|
||||
List of Dictionaries. Structured data with the following schema:
|
||||
|
||||
[
|
||||
{
|
||||
@@ -137,7 +146,7 @@ def parse(data, raw=False, quiet=False):
|
||||
|
||||
Returns:
|
||||
|
||||
List of dictionaries. Raw or processed structured data.
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
"""
|
||||
if not quiet:
|
||||
jc.utils.compatibility(__name__, info.compatible)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user