1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2026-04-03 17:44:07 +02:00

Compare commits

...

115 Commits

Author SHA1 Message Date
Kelly Brazil
3c25839350 Merge pull request #98 from kellyjonbrazil/dev
Dev v1.14.1
2021-01-06 14:37:24 -08:00
Kelly Brazil
58246e33b7 update compatibility info and changelog date 2021-01-06 14:33:38 -08:00
Kelly Brazil
8b1407c706 pull env-specific tests from CI/CD and run locally only 2021-01-06 14:22:26 -08:00
Kelly Brazil
2fde4a4e22 doc updates 2021-01-06 12:07:58 -08:00
Kelly Brazil
60b9e97982 last parser enhancements: augment hostname with CONSOLE for GUI login, add convenience fields when -F is used: login_epoch, logout_epoch, duration_seconds, calculate duration to hours:minutes 2021-01-06 12:02:47 -08:00
Kelly Brazil
0adac79c0f Add last parser enhancements 2021-01-06 11:09:59 -08:00
Kelly Brazil
9f485b5981 change mac_address fieldname to bssid. Add credit to Phillip 2021-01-06 11:09:37 -08:00
Kelly Brazil
db17d21b8f Merge pull request #97 from pschmitt/iw_scan_fix_space_detection
iw_scan: Improve detection of lines starting with spaces
2021-01-06 10:42:30 -08:00
Philipp Schmitt
996d394e89 iw_scan: Improve detection of lines starting with spaces 2021-01-06 10:32:17 +01:00
Kelly Brazil
5885b960f9 doc updates 2021-01-05 22:12:13 -08:00
Kelly Brazil
79987b35f3 formatting 2021-01-05 22:07:22 -08:00
Kelly Brazil
661b3ef311 doc updates 2021-01-05 22:04:44 -08:00
Kelly Brazil
fb422726a8 update test to add 'down' condition 2021-01-05 21:55:06 -08:00
Kelly Brazil
4fb6f3ea59 add support for down in addition to crash 2021-01-05 21:51:30 -08:00
Kelly Brazil
f78fe771e1 add iw-scan tests 2021-01-05 21:38:51 -08:00
Kelly Brazil
567b887253 doc updates 2021-01-05 21:26:43 -08:00
Kelly Brazil
e516e6b946 fix country/environment fields and process int/float conversions 2021-01-05 21:17:40 -08:00
Kelly Brazil
62748676aa initial iw-scan parser 2021-01-05 20:44:22 -08:00
Kelly Brazil
7351c72e45 add fixes and tests for entries that contain 'crash' 2021-01-05 15:16:40 -08:00
Kelly Brazil
2b7405c5e2 doc updates 2021-01-05 13:58:38 -08:00
Kelly Brazil
e2c77cb935 add test for last -F output 2021-01-05 13:00:38 -08:00
Kelly Brazil
7ac621e4c9 add -F support 2021-01-05 12:29:29 -08:00
Kelly Brazil
d8b5d6c66c version bump to 1.14.1 2021-01-05 09:45:37 -08:00
Kelly Brazil
22b461eb4b Add period field for en_US.UTF-8 locale 2021-01-05 09:42:05 -08:00
Kelly Brazil
b37ee8555a changelog update 2021-01-04 18:02:07 -08:00
Kelly Brazil
1d0ad2f045 doc fixes 2021-01-04 18:01:16 -08:00
Kelly Brazil
ceccfb2c81 add test output for iw-scan and date on ubuntu 20.04 2021-01-04 17:05:26 -08:00
Kelly Brazil
03c02953cd add wc doc 2021-01-01 12:01:56 -08:00
Kelly Brazil
f254a0eaa1 version bump 2020-12-31 16:45:10 -08:00
Kelly Brazil
9e3b88727c Merge pull request #91 from kellyjonbrazil/dev
Dev v1.14.0
2020-12-31 16:40:36 -08:00
Kelly Brazil
b12217466e spelling 2020-12-31 16:37:47 -08:00
Kelly Brazil
8b9c932f9b update date 2020-12-31 16:37:14 -08:00
Kelly Brazil
5986ce03db add printenv info 2020-12-31 16:36:27 -08:00
Kelly Brazil
a7b0e936e4 add vdir and printenv info 2020-12-31 14:21:24 -08:00
Kelly Brazil
cb02211424 add wc tests 2020-12-31 14:19:45 -08:00
Kelly Brazil
bd443bf392 add printenv to env docs 2020-12-31 14:11:25 -08:00
Kelly Brazil
1f547edd36 add printenv to env docs 2020-12-31 14:10:56 -08:00
Kelly Brazil
e4bac3a493 add wc parser 2020-12-31 14:10:37 -08:00
Kelly Brazil
5e6bfa681a add vdir info 2020-12-31 13:18:53 -08:00
Kelly Brazil
276160125e add new commands to README 2020-12-30 14:04:49 -08:00
Kelly Brazil
d4ae5543f2 add hash tests 2020-12-30 13:11:13 -08:00
Kelly Brazil
55f360e267 add hash command parser 2020-12-30 12:58:52 -08:00
Kelly Brazil
fdedab2a0c description updates 2020-12-30 11:33:29 -08:00
Kelly Brazil
a9be42e303 specify parser warnings for quiet option 2020-12-30 11:28:42 -08:00
Kelly Brazil
6da9510e46 add cksum tests 2020-12-30 11:22:17 -08:00
Kelly Brazil
0431798178 add cksum parser 2020-12-30 11:02:02 -08:00
Kelly Brazil
62432f3c48 update hashsum description 2020-12-30 09:59:54 -08:00
Kelly Brazil
9fbbc30906 add supported commands to docs 2020-12-29 13:09:03 -08:00
Kelly Brazil
d1567d1f62 add hashsum documentation 2020-12-29 13:05:04 -08:00
Kelly Brazil
6ca1f5970b Merge branch 'dev' of https://github.com/kellyjonbrazil/jc into dev 2020-12-29 12:59:02 -08:00
Kelly Brazil
1c880b9e24 force git tests 2020-12-29 12:58:04 -08:00
Kelly Brazil
3b7d54c720 add python 3.9 2020-12-29 12:55:30 -08:00
Kelly Brazil
44a7406057 add hashsum tests 2020-12-29 12:51:43 -08:00
Kelly Brazil
8157dcfdb1 fix for files with spaces in the name 2020-12-29 12:25:20 -08:00
Kelly Brazil
28762aea15 add hashsum parser 2020-12-29 11:36:20 -08:00
Kelly Brazil
439871ea9f add ubuntu 2020-11-19 07:07:30 -08:00
Kelly Brazil
c9180b005c formatting 2020-08-30 11:58:42 -07:00
Kelly Brazil
b14e0725f8 add ansible plugin blog post link 2020-08-30 11:57:55 -07:00
Kelly Brazil
70fe3dcb4d formatting 2020-08-26 15:21:45 -07:00
Kelly Brazil
8c554604a4 formatting 2020-08-26 14:41:01 -07:00
Kelly Brazil
a0a35454bd add link to the web demo 2020-08-26 14:39:40 -07:00
Kelly Brazil
e8467e2af5 remove extra space 2020-08-20 10:57:13 -07:00
Kelly Brazil
7515deb566 add ansible install command 2020-08-20 10:39:34 -07:00
Kelly Brazil
ed9e52af24 spelling 2020-08-20 10:37:15 -07:00
Kelly Brazil
592a380410 add Ansible note 2020-08-20 10:35:49 -07:00
Kelly Brazil
1a458d2d5b update link 2020-08-11 07:00:07 -07:00
Kelly Brazil
0e4cf53b92 add parser docs link 2020-08-11 06:36:30 -07:00
Kelly Brazil
e2f06ccb33 formatting 2020-08-06 13:00:33 -07:00
Kelly Brazil
8abff004cd indentation fix 2020-08-06 12:59:30 -07:00
Kelly Brazil
c4a0e2e3fe fix indentation 2020-08-06 12:58:53 -07:00
Kelly Brazil
4f10f79c73 standardize doc 2020-08-06 12:55:24 -07:00
Kelly Brazil
69e7a560fd add output info to docs 2020-08-06 07:48:08 -07:00
Kelly Brazil
59b1055808 enhance docs 2020-08-05 16:51:58 -07:00
Kelly Brazil
6ed48c6289 enhance docs 2020-08-05 15:34:17 -07:00
Kelly Brazil
f2fb4d3f41 improve docs 2020-08-05 15:10:48 -07:00
Kelly Brazil
6aeea59ea8 doc updates 2020-08-05 15:08:42 -07:00
Kelly Brazil
d016f3bbb3 improve documentation 2020-08-05 15:07:33 -07:00
Kelly Brazil
7131c29718 add module usage info to docs 2020-08-05 13:32:59 -07:00
Kelly Brazil
7432442983 add usage 2020-08-05 13:31:52 -07:00
Kelly Brazil
5344883394 spelling/add ping parser update 2020-08-05 11:35:52 -07:00
Kelly Brazil
3fcd2f6c2e version bump 2020-08-05 11:34:29 -07:00
Kelly Brazil
f3d84bd5bf tighten crontab and crontab-u parser variable detection 2020-08-05 11:28:37 -07:00
Kelly Brazil
549780c232 add debian/apt-get info 2020-08-05 11:04:07 -07:00
Kelly Brazil
2a6da69b82 improve linux/bsd check 2020-08-05 09:58:01 -07:00
Kelly Brazil
5c538816cf ping parser fix for raspberry pi 2020-08-04 17:36:35 -07:00
Kelly Brazil
7b8b378a7d add pydoc-markdown version requirement 2020-08-03 12:39:18 -07:00
Kelly Brazil
e30a75e25c Merge pull request #76 from kellyjonbrazil/dev
Dev v1.13.2
2020-08-03 10:18:39 -07:00
Kelly Brazil
85ad5cfd0b date change 2020-08-03 10:14:13 -07:00
Kelly Brazil
88b9d5068c finish date parser 2020-08-03 09:26:37 -07:00
Kelly Brazil
f8c4948a09 remove comment 2020-07-31 16:52:48 -07:00
Kelly Brazil
412322447f add month_num and weekday_num fields 2020-07-31 16:51:05 -07:00
Kelly Brazil
d4f289e40f documentation fixup 2020-07-31 14:47:06 -07:00
Kelly Brazil
e1f3feb8f5 cover empty data case in process 2020-07-31 14:45:30 -07:00
Kelly Brazil
37d3bc699c add date parser 2020-07-31 14:39:02 -07:00
Kelly Brazil
672fd18016 date bump 2020-07-31 12:59:44 -07:00
Kelly Brazil
bc2c23a2a0 version bump 2020-07-31 12:58:58 -07:00
Kelly Brazil
865f7e7812 add kv parser to man page 2020-07-31 12:58:11 -07:00
Kelly Brazil
720212b552 fixup traceroute example with new behavior 2020-07-31 11:02:24 -07:00
Kelly Brazil
d3be61f608 version bump 2020-07-31 10:59:46 -07:00
Kelly Brazil
13418b16b8 doc update 2020-07-31 10:56:51 -07:00
Kelly Brazil
42d2017cd6 traceroute updates: handle missing header row, add annotations, don't print timeouts as probes 2020-07-31 10:53:47 -07:00
Kelly Brazil
4345e76ead change to use --kv for key/value files 2020-07-30 16:49:38 -07:00
Kelly Brazil
741431322b update tests for kv parser 2020-07-30 16:45:36 -07:00
Kelly Brazil
980beaaf41 fix docgen issue 2020-07-30 16:21:03 -07:00
Kelly Brazil
2205034e09 add kv parser 2020-07-30 16:20:51 -07:00
Kelly Brazil
82b9c87a66 update docs 2020-07-30 16:20:24 -07:00
Kelly Brazil
dda517a937 shorten more examples 2020-07-29 14:36:20 -07:00
Kelly Brazil
4e6d283b9e shorten netstat example 2020-07-29 14:27:13 -07:00
Kelly Brazil
55acab05aa change name to CHANGELOG 2020-07-29 11:55:16 -07:00
Kelly Brazil
ed38a18d23 remove more examples 2020-07-29 11:49:00 -07:00
Kelly Brazil
95b3c11203 remove more examples 2020-07-29 11:43:22 -07:00
Kelly Brazil
dce318f4fd remove examples to reduce file size 2020-07-29 11:40:47 -07:00
Kelly Brazil
85127f0fb8 move examples to root 2020-07-29 11:34:43 -07:00
Kelly Brazil
fb45058244 add examples file 2020-07-29 11:32:18 -07:00
Kelly Brazil
45bb5ae389 spelling 2020-07-28 11:03:41 -07:00
219 changed files with 10820 additions and 2852 deletions

View File

@@ -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

View File

@@ -1,5 +1,36 @@
jc changelog
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
20200804 v1.13.3
- Update ping parser for Raspberry Pi compatibility
20200803 v1.13.2
- Add key/value file parser (wrapper for ini parser)
- Add date command parser
- Update traceroute parser to more gracefully handle missing header row
- Update traceroute parser to handle annotations
- Update traceroute parser to only return successful probes
20200727 v1.13.1
- Add route -6 tests

2840
EXAMPLES.md Normal file

File diff suppressed because it is too large Load Diff

2004
README.md

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,6 @@
#!/bin/bash
# Generate docs.md
# requires pydoc-markdown 2.1.0.post1
cd jc
pydocmd simple jc+ > ../docs/readme.md
@@ -8,9 +9,11 @@ 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
pydocmd simple jc.parsers.date+ > ../docs/parsers/date.md
pydocmd simple jc.parsers.df+ > ../docs/parsers/df.md
pydocmd simple jc.parsers.dig+ > ../docs/parsers/dig.md
pydocmd simple jc.parsers.dmidecode+ > ../docs/parsers/dmidecode.md
@@ -21,13 +24,17 @@ 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
pydocmd simple jc.parsers.ls+ > ../docs/parsers/ls.md
pydocmd simple jc.parsers.lsblk+ > ../docs/parsers/lsblk.md
@@ -56,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

View File

@@ -1,12 +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:
@@ -52,11 +61,13 @@ Examples:
"channel": "48,80"
}
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -66,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:
@@ -90,6 +101,7 @@ Returns:
"channel": string
}
## parse
```python
parse(data, raw=False, quiet=False)

View File

@@ -1,12 +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:
@@ -84,11 +93,13 @@ Examples:
...
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -98,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,
@@ -117,6 +128,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -132,5 +144,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,13 +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:
@@ -95,11 +103,13 @@ Examples:
}
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -109,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:
[
{
@@ -128,6 +138,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -143,5 +154,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -75,11 +85,13 @@ Examples:
}
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -89,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:
[
{
@@ -129,6 +141,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -144,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
View 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.

View File

@@ -1,9 +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:
@@ -128,11 +140,13 @@ Examples:
]
}
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -142,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:
@@ -178,6 +192,7 @@ Returns:
}
## parse
```python
parse(data, raw=False, quiet=False)

View File

@@ -1,9 +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:
@@ -129,11 +137,13 @@ Examples:
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -143,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:
@@ -180,6 +190,7 @@ Returns:
}
## parse
```python
parse(data, raw=False, quiet=False)

View File

@@ -1,12 +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:
@@ -59,11 +64,13 @@ Examples:
...
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -73,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:
[
{
@@ -86,6 +93,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -101,5 +109,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

104
docs/parsers/date.md Normal file
View File

@@ -0,0 +1,104 @@
# jc.parsers.date
jc - JSON CLI output utility `date` command output parser
Usage (cli):
$ date | jc --date
or
$ jc date
Usage (module):
import jc.parsers.date
result = jc.parsers.date.parse(date_command_output)
Compatibility:
'linux', 'darwin', 'freebsd'
Examples:
$ date | jc --date -p
{
"year": 2020,
"month_num": 7,
"day": 31,
"hour": 16,
"minute": 48,
"second": 11,
"period": null,
"month": "Jul",
"weekday": "Fri",
"weekday_num": 6,
"timezone": "PDT"
}
$ date | jc --date -p -r
{
"year": "2020",
"month": "Jul",
"day": "31",
"weekday": "Fri",
"hour": "16",
"minute": "50",
"second": "01",
"timezone": "PDT"
}
## info
```python
info()
```
## process
```python
process(proc_data)
```
Final processing to conform to the schema.
Parameters:
proc_data: (Dictionary) raw structured data to process
Returns:
Dictionary. Structured data with the following schema:
{
"year": integer,
"month_num": integer,
"day": integer,
"hour": integer,
"minute": integer,
"second": integer,
"period": string,
"month": string,
"weekday": string,
"weekday_num": integer,
"timezone": 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:
Dictionary. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -69,11 +79,13 @@ Examples:
...
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -83,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:
[
{
@@ -106,6 +118,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -121,5 +134,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -321,11 +331,13 @@ Examples:
}
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -335,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:
[
{
@@ -393,6 +405,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -408,5 +421,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -99,11 +109,13 @@ Examples:
...
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -113,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:
[
{
@@ -134,6 +146,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -149,5 +162,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -69,11 +79,13 @@ Examples:
...
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -83,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:
[
{
@@ -96,6 +108,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -111,5 +124,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -49,11 +61,13 @@ Examples:
"_": "/usr/bin/env"
}
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -63,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:
[
{
@@ -76,6 +90,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -92,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

View File

@@ -1,9 +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:
@@ -44,11 +54,13 @@ Examples:
...
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -58,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:
[
{
@@ -71,6 +83,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -86,5 +99,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -49,11 +59,13 @@ Examples:
}
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -63,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:
[
{
@@ -81,6 +93,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -96,5 +109,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -67,11 +73,13 @@ Examples:
}
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -81,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:
[
{
@@ -98,6 +106,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -113,5 +122,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -91,11 +97,13 @@ Examples:
...
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -105,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:
[
{
@@ -122,6 +130,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -137,5 +146,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -57,11 +63,13 @@ Examples:
...
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -71,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:
[
{
@@ -90,6 +98,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -105,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
View 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
View 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.

View File

@@ -1,9 +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:
@@ -41,11 +49,13 @@ Examples:
...
}
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -55,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:
[
{
@@ -68,6 +78,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -84,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

View File

@@ -1,9 +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:
@@ -58,11 +64,13 @@ Examples:
}
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -72,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:
[
{
@@ -87,6 +95,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -102,5 +111,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -67,11 +77,13 @@ Examples:
}
}
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -81,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:
@@ -114,6 +126,7 @@ Returns:
}
}
## parse
```python
parse(data, raw=False, quiet=False)
@@ -129,5 +142,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
Dictionary. Raw or processed structured data.

View File

@@ -1,11 +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:
@@ -142,19 +152,16 @@ Examples:
}
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## IfconfigParser
```python
IfconfigParser(self, console_output)
```
## InterfaceNotFound
```python
InterfaceNotFound(self, /, *args, **kwargs)
IfconfigParser(console_output)
```
@@ -167,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:
[
{
@@ -206,6 +213,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -221,5 +229,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,11 +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:
@@ -45,11 +53,13 @@ Examples:
}
}
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -59,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:
@@ -73,6 +83,7 @@ Returns:
If you would like to keep the quotation marks, use the -r or raw=True argument.
}
## parse
```python
parse(data, raw=False, quiet=False)

View File

@@ -1,11 +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:
@@ -131,11 +141,13 @@ Examples:
...
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -145,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:
[
{
@@ -172,6 +184,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -187,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
View File

@@ -0,0 +1,160 @@
# jc.parsers.iw_scan
jc - JSON CLI output utility `iw DEV scan` command output parser
This parser is considered beta quality. Not all fields are parsed.
Usage (cli):
$ iw dev wlan0 scan | jc --iw-scan
or
$ jc iw dev wlan0 scan
Usage (module):
import jc.parsers.iw-scan
result = jc.parsers.iw-scan.parse(iw-scan_command_output)
Compatibility:
'linux'
Examples:
$ iw 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.

View File

@@ -1,11 +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:
@@ -73,11 +83,13 @@ Example:
}
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -87,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:
[
{
@@ -103,6 +115,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -118,5 +131,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

69
docs/parsers/kv.md Normal file
View File

@@ -0,0 +1,69 @@
# jc.parsers.kv
jc - JSON CLI output utility `Key/Value` file parser
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.
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:
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
Examples:
$ cat keyvalue.txt
# this file contains key/value pairs
name = John Doe
address=555 California Drive
age: 34
; comments can include # or ;
# delimiter can be = or :
# quoted values have quotation marks stripped by default
# but can be preserved with the -r argument
occupation:"Engineer"
$ cat keyvalue.txt | jc --ini -p
{
"name": "John Doe",
"address": "555 California Drive",
"age": "34",
"occupation": "Engineer"
}
## info
```python
info()
```
## parse
```python
parse(data, raw=False, quiet=False)
```
Main text parsing function
Note: this is just a wrapper for jc.parsers.ini
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary representing the key/value file

View File

@@ -1,9 +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:
@@ -11,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
},
...
]
@@ -68,11 +86,13 @@ Examples:
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -82,23 +102,27 @@ 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
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -114,5 +138,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,21 +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:
@@ -145,11 +150,13 @@ Examples:
"date": "May 3 2019"
}
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -159,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:
[
{
@@ -178,6 +185,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -193,5 +201,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -212,11 +222,13 @@ Examples:
...
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -226,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:
[
{
@@ -277,6 +289,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -292,5 +305,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -103,11 +113,13 @@ Examples:
...
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -117,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:
[
{
@@ -134,6 +146,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -149,5 +162,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -93,11 +103,13 @@ Examples:
...
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -107,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:
[
{
@@ -128,6 +140,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -143,5 +156,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -53,11 +63,13 @@ Example:
...
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -67,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:
[
{
@@ -84,6 +96,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -99,5 +112,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,14 +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:
@@ -245,11 +254,13 @@ Examples:
}
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -259,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:
[
{
@@ -364,6 +375,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -379,5 +391,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -179,11 +189,13 @@ Examples:
}
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -193,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:
[
{
@@ -216,6 +228,7 @@ Returns:
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -231,5 +244,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -75,11 +81,13 @@ Examples:
...
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -89,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:
[
{
@@ -107,6 +115,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -122,5 +131,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,11 +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:
@@ -104,11 +116,13 @@ Examples:
]
}
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -118,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:
@@ -152,6 +166,7 @@ Returns:
]
}
## parse
```python
parse(data, raw=False, quiet=False)

View File

@@ -1,9 +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:
@@ -28,11 +38,13 @@ Examples:
...
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -42,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:
[
{
@@ -56,6 +68,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -71,5 +84,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -39,11 +49,13 @@ Examples:
}
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -53,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:
[
{
@@ -75,6 +87,7 @@ Returns:
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -90,5 +103,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,13 +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:
@@ -173,11 +183,13 @@ Examples:
...
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -187,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:
[
{
@@ -215,6 +227,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -230,5 +243,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -80,11 +90,13 @@ Examples:
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -94,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:
[
{
@@ -119,6 +131,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -134,5 +147,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -81,11 +87,13 @@ Examples:
...
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -95,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:
[
{
@@ -114,6 +122,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -129,5 +138,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -247,11 +257,13 @@ Examples:
}
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -261,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:
[
{
@@ -289,6 +301,7 @@ Returns:
Information from https://www.cyberciti.biz/files/ss.html used to define field names
## parse
```python
parse(data, raw=False, quiet=False)
@@ -304,5 +317,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -101,11 +111,13 @@ Examples:
..
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -115,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:
[
{
@@ -149,6 +161,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -164,5 +177,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,13 +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:
@@ -15,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,
@@ -27,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",
@@ -39,11 +47,13 @@ Examples:
...
}
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -53,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:
@@ -65,6 +75,7 @@ Returns:
"baz": string/integer/float
}
## parse
```python
parse(data, raw=False, quiet=False)

View File

@@ -1,9 +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:
@@ -37,11 +47,13 @@ Examples:
...
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -51,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:
[
{
@@ -67,6 +79,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -82,5 +95,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -56,11 +66,13 @@ Examples:
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -70,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:
[
{
@@ -85,6 +97,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -100,5 +113,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -31,11 +41,13 @@ Examples:
...
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -45,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:
[
{
@@ -59,6 +71,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -74,5 +87,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -28,11 +38,13 @@ Examples:
...
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -42,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:
[
{
@@ -55,6 +67,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -70,5 +83,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -35,11 +45,13 @@ Examples:
"dst_active": "yes"
}
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -49,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:
@@ -68,6 +80,7 @@ Returns:
"dst_active": boolean
}
## parse
```python
parse(data, raw=False, quiet=False)

View File

@@ -1,9 +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:
@@ -102,11 +114,13 @@ Examples:
}
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -116,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:
@@ -139,6 +153,7 @@ Returns:
]
}
## parse
```python
parse(data, raw=False, quiet=False)

View File

@@ -1,12 +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 OSX and FreeBSD be sure to redirect STDERR to STDOUT since the header line is sent to STDERR
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:
@@ -84,16 +97,19 @@ Examples:
]
}
## info
```python
info(self, /, *args, **kwargs)
info()
```
## Hop
```python
Hop(self, idx)
Hop(idx)
```
## process
```python
process(proc_data)
@@ -103,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:
@@ -128,6 +144,7 @@ Returns:
]
}
## parse
```python
parse(data, raw=False, quiet=False)

View File

@@ -1,13 +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:
@@ -27,11 +35,13 @@ Example:
"kernel_version": "#74-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019"
}
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -41,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:
@@ -58,6 +68,7 @@ Returns:
"kernel_version": string
}
## parse
```python
parse(data, raw=False, quiet=False)

View File

@@ -1,9 +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:
@@ -31,11 +41,13 @@ Example:
"load_15m": "0.05"
}
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -45,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:
@@ -60,6 +72,7 @@ Returns:
"load_15m": float
}
## parse
```python
parse(data, raw=False, quiet=False)

View File

@@ -1,9 +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:
@@ -79,11 +89,13 @@ Examples:
}
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -93,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:
[
{
@@ -112,6 +124,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -127,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
View 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.

View File

@@ -1,11 +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:
@@ -99,11 +109,13 @@ Examples:
}
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -113,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:
[
{
@@ -133,6 +145,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -148,5 +161,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries. Raw or processed structured data.

View File

@@ -1,9 +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:
@@ -55,11 +61,13 @@ Examples:
...
}
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -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:
@@ -80,6 +88,7 @@ Returns:
See https://github.com/martinblech/xmltodict for details
}
## parse
```python
parse(data, raw=False, quiet=False)

View File

@@ -1,9 +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:
@@ -67,11 +73,13 @@ Examples:
}
]
## info
```python
info(self, /, *args, **kwargs)
info()
```
## process
```python
process(proc_data)
@@ -81,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:
[
{
@@ -94,6 +102,7 @@ Returns:
}
]
## parse
```python
parse(data, raw=False, quiet=False)
@@ -109,5 +118,5 @@ Parameters:
Returns:
List of dictionaries. Raw or processed structured data.
List of Dictionaries representing the YAML documents.

View File

@@ -1,3 +1,4 @@
# jc
JC - JSON CLI output utility
@@ -5,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

View File

@@ -1,5 +1,7 @@
# utils
jc - JSON CLI output utility utils
## warning_message
```python
warning_message(message)
@@ -15,6 +17,7 @@ Returns:
no return, just prints output to STDERR
## error_message
```python
error_message(message)
@@ -30,6 +33,7 @@ Returns:
no return, just prints output to STDERR
## compatibility
```python
compatibility(mod_name, compatible)
@@ -48,6 +52,7 @@ Returns:
no return, just prints output to STDERR
## has_data
```python
has_data(data)

View File

@@ -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

View File

@@ -21,7 +21,7 @@ import jc.appdirs as appdirs
class info():
version = '1.13.1'
version = '1.14.1'
description = 'JSON CLI output utility'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
@@ -34,9 +34,11 @@ parsers = [
'airport-s',
'arp',
'blkid',
'cksum',
'crontab',
'crontab-u',
'csv',
'date',
'df',
'dig',
'dmidecode',
@@ -47,13 +49,17 @@ parsers = [
'fstab',
'group',
'gshadow',
'hash',
'hashsum',
'history',
'hosts',
'id',
'ifconfig',
'ini',
'iptables',
'iw-scan',
'jobs',
'kv',
'last',
'ls',
'lsblk',
@@ -82,6 +88,7 @@ parsers = [
'uname',
'uptime',
'w',
'wc',
'who',
'xml',
'yaml'
@@ -294,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:

View File

@@ -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:

View File

@@ -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)

View File

@@ -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)

View File

@@ -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
View 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)

View File

@@ -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:
@@ -235,7 +246,7 @@ def parse(data, raw=False, quiet=False):
# Pop any variable assignment lines
cron_var = []
for i, line in reversed(list(enumerate(cleandata))):
if '=' in line:
if '=' in line and not line.strip()[0].isdigit() and not line.strip()[0] == '@':
var_line = cleandata.pop(i)
var_name = var_line.split('=', maxsplit=1)[0].strip()
var_value = var_line.split('=', maxsplit=1)[1].strip()

View File

@@ -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:
@@ -133,7 +140,7 @@ import jc.parsers.universal
class info():
version = '1.3'
version = '1.5'
description = 'crontab file parser with user support'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
@@ -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:
@@ -236,7 +243,7 @@ def parse(data, raw=False, quiet=False):
# Pop any variable assignment lines
cron_var = []
for i, line in reversed(list(enumerate(cleandata))):
if '=' in line:
if '=' in line and not line.strip()[0].isdigit() and not line.strip()[0] == '@':
var_line = cleandata.pop(i)
var_name = var_line.split('=', maxsplit=1)[0].strip()
var_value = var_line.split('=', maxsplit=1)[1].strip()

View File

@@ -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)

187
jc/parsers/date.py Normal file
View File

@@ -0,0 +1,187 @@
"""jc - JSON CLI output utility `date` command output parser
Usage (cli):
$ date | jc --date
or
$ jc date
Usage (module):
import jc.parsers.date
result = jc.parsers.date.parse(date_command_output)
Compatibility:
'linux', 'darwin', 'freebsd'
Examples:
$ date | jc --date -p
{
"year": 2020,
"month_num": 7,
"day": 31,
"hour": 16,
"minute": 48,
"second": 11,
"period": null,
"month": "Jul",
"weekday": "Fri",
"weekday_num": 6,
"timezone": "PDT"
}
$ date | jc --date -p -r
{
"year": "2020",
"month": "Jul",
"day": "31",
"weekday": "Fri",
"hour": "16",
"minute": "50",
"second": "01",
"timezone": "PDT"
}
"""
import jc.utils
class info():
version = '1.1'
description = 'date command parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
# compatible options: linux, darwin, cygwin, win32, aix, freebsd
compatible = ['linux', 'darwin', 'freebsd']
magic_commands = ['date']
__version__ = info.version
def process(proc_data):
"""
Final processing to conform to the schema.
Parameters:
proc_data: (Dictionary) raw structured data to process
Returns:
Dictionary. Structured data with the following schema:
{
"year": integer,
"month_num": integer,
"day": integer,
"hour": integer,
"minute": integer,
"second": integer,
"period": string,
"month": string,
"weekday": string,
"weekday_num": integer,
"timezone": string
}
"""
month_map = {
"Jan": 1,
"Feb": 2,
"Mar": 3,
"Apr": 4,
"May": 5,
"Jun": 6,
"Jul": 7,
"Aug": 8,
"Sep": 9,
"Oct": 10,
"Nov": 11,
"Dec": 12
}
weekday_map = {
"Sun": 1,
"Mon": 2,
"Tue": 3,
"Wed": 4,
"Thu": 5,
"Fri": 6,
"Sat": 7
}
if proc_data:
return {
"year": int(proc_data['year']),
'month_num': month_map[proc_data['month']],
"day": int(proc_data['day']),
"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']],
"timezone": proc_data['timezone']
}
else:
return {}
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:
Dictionary. Raw or processed structured data.
"""
if not quiet:
jc.utils.compatibility(__name__, info.compatible)
raw_output = {}
if jc.utils.has_data(data):
data = data.replace(':', ' ')
split_data = data.split()
# 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
else:
return process(raw_output)

View File

@@ -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:

View File

@@ -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:
@@ -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:
[
{
@@ -557,7 +566,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:

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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
View 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
View 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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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:
@@ -372,8 +381,6 @@ class IfconfigParser(object):
class InterfaceNotFound(Exception):
"""
"""
pass
@@ -383,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:
[
{
@@ -468,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)

View File

@@ -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:
@@ -49,8 +56,8 @@ import configparser
class info():
version = '1.2'
description = 'INI file parser. Also parses files/output containing simple key/value pairs'
version = '1.3'
description = 'INI file parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
details = 'Using configparser from the standard library'
@@ -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:

View File

@@ -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
View File

@@ -0,0 +1,332 @@
"""jc - JSON CLI output utility `iw DEV scan` command output parser
This parser is considered beta quality. Not all fields are parsed.
Usage (cli):
$ iw dev wlan0 scan | jc --iw-scan
or
$ jc iw dev wlan0 scan
Usage (module):
import jc.parsers.iw-scan
result = jc.parsers.iw-scan.parse(iw-scan_command_output)
Compatibility:
'linux'
Examples:
$ iw 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)

Some files were not shown because too many files have changed in this diff Show More