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

update docs

This commit is contained in:
Kelly Brazil
2021-04-08 15:52:49 -07:00
parent 4290a3cbd1
commit b8b8dfead4
61 changed files with 1500 additions and 1847 deletions

View File

@ -15,6 +15,19 @@ Usage (module):
import jc.parsers.ini
result = jc.parsers.ini.parse(ini_file_output)
Schema:
ini or key/value document converted to a dictionary - see configparser standard
library documentation for more details.
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 or raw=True argument.
{
"key1": string,
"key2": string
}
Compatibility:
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
@ -58,31 +71,7 @@ Examples:
```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 representing an ini or simple key/value pair document:
{
ini or key/value document converted to a dictionary - see configparser standard
library documentation for more details.
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 or raw=True argument.
}
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -17,6 +17,29 @@ Usage (module):
import jc.parsers.iptables
result = jc.parsers.iptables.parse(iptables_command_output)
Schema:
[
{
"chain": string,
"rules": [
{
"num" integer,
"pkts": integer,
"bytes": integer, # converted based on suffix
"target": string,
"prot": string,
"opt": string, # "--" = Null
"in": string,
"out": string,
"source": string,
"destination": string,
"options": string
}
]
}
]
Compatibility:
'linux'
@ -146,44 +169,7 @@ Examples:
```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:
[
{
"chain": string,
"rules": [
{
"num" integer,
"pkts": integer,
"bytes": integer, # converted based on suffix
"target": string,
"prot": string,
"opt": string, # "--" = Null
"in": string,
"out": string,
"source": string,
"destination": string,
"options": string
}
]
}
]
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -17,6 +17,16 @@ Usage (module):
import jc.parsers.iw-scan
result = jc.parsers.iw-scan.parse(iw-scan_command_output)
Schema:
[
{
"foo": string/integer/float, # best guess based on value
"bar": string/integer/float,
"baz": string/integer/float
}
]
Compatibility:
'linux'
@ -116,30 +126,7 @@ Examples:
```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
}
]
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -17,6 +17,18 @@ Usage (module):
import jc.parsers.jobs
result = jc.parsers.jobs.parse(jobs_command_output)
Schema:
[
{
"job_number": integer,
"pid": integer,
"history": string,
"status": string,
"command": string
}
]
Compatibility:
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
@ -88,33 +100,7 @@ Example:
```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:
[
{
"job_number": integer,
"pid": integer,
"history": string,
"status": string,
"command": string
}
]
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -6,7 +6,6 @@ Supports files containing simple key/value pairs. Delimiter can be `=` or `:`. M
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
@ -16,6 +15,15 @@ Usage (module):
import jc.parsers.kv
result = jc.parsers.kv.parse(kv_file_output)
Schema:
key/value document converted to a dictionary - see configparser standard library documentation for more details.
{
"key1": string,
"key2": string
}
Compatibility:
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
@ -46,7 +54,7 @@ Examples:
```python
info()
```
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -19,6 +19,22 @@ Usage (module):
import jc.parsers.last
result = jc.parsers.last.parse(last_command_output)
Schema:
[
{
"user": string,
"tty": string,
"hostname": string,
"login": string,
"logout": string,
"duration": string,
"login_epoch": integer, # (naive) available with last -F option
"logout_epoch": integer, # (naive) available with last -F option
"duration_seconds": integer # available with last -F option
}
]
Compatibility:
'linux', 'darwin', 'aix', 'freebsd'
@ -93,37 +109,7 @@ Examples:
```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:
[
{
"user": string,
"tty": string,
"hostname": string,
"login": string,
"logout": string,
"duration": string,
"login_epoch": integer, # (naive) available with last -F option
"logout_epoch": integer, # (naive) available with last -F option
"duration_seconds": integer # available with last -F option
}
]
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -26,6 +26,23 @@ Usage (module):
import jc.parsers.ls
result = jc.parsers.ls.parse(ls_command_output)
Schema:
[
{
"filename": string,
"flags": string,
"links": integer,
"parent": string,
"owner": string,
"group": string,
"size": integer,
"date": string,
"epoch": integer, # naive timestamp if date field exists and can be converted
"epoch_utc": integer # timezone aware timestamp if date field is in UTC and can be converted
}
]
Compatibility:
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
@ -159,38 +176,7 @@ Examples:
```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,
"flags": string,
"links": integer,
"parent": string,
"owner": string,
"group": string,
"size": integer,
"date": string,
"epoch": integer, # naive timestamp if date field exists and can be converted
"epoch_utc": integer # timezone aware timestamp if date field is in UTC and can be converted
}
]
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -15,6 +15,53 @@ Usage (module):
import jc.parsers.lsblk
result = jc.parsers.lsblk.parse(lsblk_command_output)
Schema:
[
{
"name": string,
"maj_min": string,
"rm": boolean,
"size": string,
"ro": boolean,
"type": string,
"mountpoint": string,
"kname": string,
"fstype": string,
"label": string,
"uuid": string,
"partlabel": string,
"partuuid": string,
"ra": integer,
"model": string,
"serial": string,
"state": string,
"owner": string,
"group": string,
"mode": string,
"alignment": integer,
"min_io": integer,
"opt_io": integer,
"phy_sec": integer,
"log_sec": integer,
"rota": boolean,
"sched": string,
"rq_size": integer,
"disc_aln": integer,
"disc_gran": string,
"disc_max": string,
"disc_zero": boolean,
"wsame": string,
"wwn": string,
"rand": boolean,
"pkname": string,
"hctl": string,
"tran": string,
"rev": string,
"vendor": string
}
]
Compatibility:
'linux'
@ -227,68 +274,7 @@ Examples:
```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:
[
{
"name": string,
"maj_min": string,
"rm": boolean,
"size": string,
"ro": boolean,
"type": string,
"mountpoint": string,
"kname": string,
"fstype": string,
"label": string,
"uuid": string,
"partlabel": string,
"partuuid": string,
"ra": integer,
"model": string,
"serial": string,
"state": string,
"owner": string,
"group": string,
"mode": string,
"alignment": integer,
"min_io": integer,
"opt_io": integer,
"phy_sec": integer,
"log_sec": integer,
"rota": boolean,
"sched": string,
"rq_size": integer,
"disc_aln": integer,
"disc_gran": string,
"disc_max": string,
"disc_zero": boolean,
"wsame": string,
"wwn": string,
"rand": boolean,
"pkname": string,
"hctl": string,
"tran": string,
"rev": string,
"vendor": string
}
]
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -15,6 +15,19 @@ Usage (module):
import jc.parsers.lsmod
result = jc.parsers.lsmod.parse(lsmod_command_output)
Schema:
[
{
"module": string,
"size": integer,
"used": integer,
"by": [
string
]
}
]
Compatibility:
'linux'
@ -118,34 +131,7 @@ Examples:
```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:
[
{
"module": string,
"size": integer,
"used": integer,
"by": [
string
]
}
]
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -15,6 +15,23 @@ Usage (module):
import jc.parsers.lsof
result = jc.parsers.lsof.parse(lsof_command_output)
Schema:
[
{
"command": string,
"pid": integer,
"tid": integer,
"user": string,
"fd": string,
"type": string,
"device": string,
"size_off": integer,
"node": integer,
"name": string
}
]
Compatibility:
'linux'
@ -108,38 +125,7 @@ Examples:
```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,
"pid": integer,
"tid": integer,
"user": string,
"fd": string,
"type": string,
"device": string,
"size_off": integer,
"node": integer,
"name": string
}
]
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -15,6 +15,19 @@ Usage (module):
import jc.parsers.mount
result = jc.parsers.mount.parse(mount_command_output)
Schema:
[
{
"filesystem": string,
"mount_point": string,
"type": string,
"access": [
string
]
}
]
Compatibility:
'linux', 'darwin', 'freebsd'
@ -68,34 +81,7 @@ Example:
```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:
[
{
"filesystem": string,
"mount_point": string,
"type": string,
"access": [
string
]
}
]
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -19,6 +19,107 @@ Usage (module):
import jc.parsers.netstat
result = jc.parsers.netstat.parse(netstat_command_output)
Schema:
[
{
"proto": string,
"recv_q": integer,
"send_q": integer,
"transport_protocol" string,
"network_protocol": string,
"local_address": string,
"local_port": string,
"local_port_num": integer,
"foreign_address": string,
"foreign_port": string,
"foreign_port_num": integer,
"state": string,
"program_name": string,
"pid": integer,
"user": string,
"security_context": string,
"refcnt": integer,
"flags": string,
"type": string,
"inode": integer,
"path": string,
"kind": string,
"address": string,
"unix_inode": string,
"conn": string,
"refs": string,
"nextref": string,
"name": string,
"unit": integer,
"vendor": integer,
"class": integer,
"subcla": integer,
"unix_flags": integer,
"pcbcount": integer,
"rcvbuf": integer,
"sndbuf": integer,
"rxbytes": integer,
"txbytes": integer,
"destination": string,
"gateway": string,
"route_flags": string,
"route_flags_pretty": [
string,
]
"route_refs": integer,
"use": integer,
"mtu": integer,
"expire": string,
"genmask": string,
"mss": integer,
"window": integer,
"irtt": integer,
"iface": string,
"metric": integer,
"network": string,
"address": string,
"ipkts": integer, # - = null
"ierrs": integer, # - = null
"idrop": integer, # - = null
"opkts": integer, # - = null
"oerrs": integer, # - = null
"coll": integer, # - = null
"rx_ok": integer,
"rx_err": integer,
"rx_drp": integer,
"rx_ovr": integer,
"tx_ok": integer,
"tx_err": integer,
"tx_drp": integer,
"tx_ovr": integer,
"flg": string,
"ibytes": integer,
"obytes": integer,
"r_mbuf": integer,
"s_mbuf": integer,
"r_clus": integer,
"s_clus": integer,
"r_hiwa": integer,
"s_hiwa": integer,
"r_lowa": integer,
"s_lowa": integer,
"r_bcnt": integer,
"s_bcnt": integer,
"r_bmax": integer,
"s_bmax": integer,
"rexmit": integer,
"ooorcv": integer,
"0_win": integer,
"rexmt": float,
"persist": float,
"keep": float,
"2msl": float,
"delack": float,
"rcvtime": float,
}
]
Compatibility:
'linux', 'darwin', 'freebsd'
@ -259,122 +360,7 @@ Examples:
```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:
[
{
"proto": string,
"recv_q": integer,
"send_q": integer,
"transport_protocol" string,
"network_protocol": string,
"local_address": string,
"local_port": string,
"local_port_num": integer,
"foreign_address": string,
"foreign_port": string,
"foreign_port_num": integer,
"state": string,
"program_name": string,
"pid": integer,
"user": string,
"security_context": string,
"refcnt": integer,
"flags": string,
"type": string,
"inode": integer,
"path": string,
"kind": string,
"address": string,
"unix_inode": string,
"conn": string,
"refs": string,
"nextref": string,
"name": string,
"unit": integer,
"vendor": integer,
"class": integer,
"subcla": integer,
"unix_flags": integer,
"pcbcount": integer,
"rcvbuf": integer,
"sndbuf": integer,
"rxbytes": integer,
"txbytes": integer,
"destination": string,
"gateway": string,
"route_flags": string,
"route_flags_pretty": [
string,
]
"route_refs": integer,
"use": integer,
"mtu": integer,
"expire": string,
"genmask": string,
"mss": integer,
"window": integer,
"irtt": integer,
"iface": string,
"metric": integer,
"network": string,
"address": string,
"ipkts": integer, - = null
"ierrs": integer, - = null
"idrop": integer, - = null
"opkts": integer, - = null
"oerrs": integer, - = null
"coll": integer, - = null
"rx_ok": integer,
"rx_err": integer,
"rx_drp": integer,
"rx_ovr": integer,
"tx_ok": integer,
"tx_err": integer,
"tx_drp": integer,
"tx_ovr": integer,
"flg": string,
"ibytes": integer,
"obytes": integer,
"r_mbuf": integer,
"s_mbuf": integer,
"r_clus": integer,
"s_clus": integer,
"r_hiwa": integer,
"s_hiwa": integer,
"r_lowa": integer,
"s_lowa": integer,
"r_bcnt": integer,
"s_bcnt": integer,
"r_bmax": integer,
"s_bmax": integer,
"rexmit": integer,
"ooorcv": integer,
"0_win": integer,
"rexmt": float,
"persist": float,
"keep": float,
"2msl": float,
"delack": float,
"rcvtime": float,
}
]
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -15,6 +15,24 @@ Usage (module):
import jc.parsers.ntpq
result = jc.parsers.ntpq.parse(ntpq_command_output)
Schema:
[
{
"state": string, # space/~ converted to null
"remote": string,
"refid": string,
"st": integer,
"t": string,
"when": integer, # - converted to null
"poll": integer,
"reach": integer,
"delay": float,
"offset": float,
"jitter": float
},
]
Compatibility:
'linux', 'freebsd'
@ -194,40 +212,7 @@ Examples:
```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:
[
{
"state": string, # space/~ converted to null
"remote": string,
"refid": string,
"st": integer,
"t": string,
"when": integer, # - converted to null
"poll": integer,
"reach": integer,
"delay": float,
"offset": float,
"jitter": float
},
]
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -11,6 +11,20 @@ Usage (module):
import jc.parsers.passwd
result = jc.parsers.passwd.parse(passwd_file_output)
Schema:
[
{
"username": string,
"password": string,
"uid": integer,
"gid": integer,
"comment": string,
"home": string,
"shell": string
}
]
Compatibility:
'linux', 'darwin', 'aix', 'freebsd'
@ -86,35 +100,7 @@ Examples:
```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:
[
{
"username": string,
"password": string,
"uid": integer,
"gid": integer,
"comment": string,
"home": string,
"shell": string
}
]
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -19,6 +19,36 @@ Usage (module):
import jc.parsers.ping
result = jc.parsers.ping.parse(ping_command_output)
Schema:
{
"source_ip": string,
"destination_ip": string,
"data_bytes": integer,
"pattern": string, # (null if not set)
"destination": string,
"packets_transmitted": integer,
"packets_received": integer,
"packet_loss_percent": float,
"duplicates": integer,
"round_trip_ms_min": float,
"round_trip_ms_avg": float,
"round_trip_ms_max": float,
"round_trip_ms_stddev": float,
"responses": [
{
"type": string, # ('reply' or 'timeout')
"timestamp": float,
"bytes": integer,
"response_ip": string,
"icmp_seq": integer,
"ttl": integer,
"time_ms": float,
"duplicate": boolean
}
]
}
Compatibility:
'linux', 'darwin', 'freebsd'
@ -121,51 +151,7 @@ Examples:
```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:
{
"source_ip": string,
"destination_ip": string,
"data_bytes": integer,
"pattern": string, (null if not set)
"destination": string,
"packets_transmitted": integer,
"packets_received": integer,
"packet_loss_percent": float,
"duplicates": integer,
"round_trip_ms_min": float,
"round_trip_ms_avg": float,
"round_trip_ms_max": float,
"round_trip_ms_stddev": float,
"responses": [
{
"type": string, ('reply' or 'timeout')
"timestamp": float,
"bytes": integer,
"response_ip": string,
"icmp_seq": integer,
"ttl": integer,
"time_ms": float,
"duplicate": boolean
}
]
}
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -15,6 +15,16 @@ Usage (module):
import jc.parsers.pip_list
result = jc.parsers.pip_list.parse(pip_list_command_output)
Schema:
[
{
"package": string,
"version": string,
"location": string
}
]
Compatibility:
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
@ -43,31 +53,7 @@ Examples:
```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:
[
{
"package": string,
"version": string,
"location": string
}
]
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -15,6 +15,23 @@ Usage (module):
import jc.parsers.pip_show
result = jc.parsers.pip_show.parse(pip_show_command_output)
Schema:
[
{
"name": string,
"version": string,
"summary": string,
"home_page": string,
"author": string,
"author_email": string,
"license": string,
"location": string,
"requires": string,
"required_by": string
}
]
Compatibility:
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
@ -54,39 +71,7 @@ Examples:
```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:
[
{
"name": string,
"version": string,
"summary": string,
"home_page": string,
"author": string,
"author_email": string,
"license": string,
"location": string,
"requires": string,
"required_by": string
}
]
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -19,6 +19,30 @@ Usage (module):
import jc.parsers.ps
result = jc.parsers.ps.parse(ps_command_output)
Schema:
[
{
"uid": string,
"pid": integer,
"ppid": integer,
"c": integer,
"stime": string,
"tty": string, # ? or ?? = Null
"tt": string, # ?? = Null
"time": string,
"cmd": string,
"user": string,
"cpu_percent": float,
"mem_percent": float,
"vsz": integer,
"rss": integer,
"stat": string,
"start": string,
"command": string
}
]
Compatibility:
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
@ -188,45 +212,7 @@ Examples:
```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:
[
{
"uid": string,
"pid": integer,
"ppid": integer,
"c": integer,
"stime": string,
"tty": string, # ? or ?? = Null
"tt": string, # ?? = Null
"time": string,
"cmd": string,
"user": string,
"cpu_percent": float,
"mem_percent": float,
"vsz": integer,
"rss": integer,
"stat": string,
"start": string,
"command": string
}
]
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -15,6 +15,27 @@ Usage (module):
import jc.parsers.route
result = jc.parsers.route.parse(route_command_output)
Schema:
[
{
"destination": string,
"gateway": string,
"genmask": string,
"flags": string,
"flags_pretty": [
string,
]
"metric": integer,
"ref": integer,
"use": integer,
"mss": integer,
"window": integer,
"irtt": integer,
"iface": string
}
]
Compatibility:
'linux'
@ -95,42 +116,7 @@ Examples:
```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:
[
{
"destination": string,
"gateway": string,
"genmask": string,
"flags": string,
"flags_pretty": [
string,
]
"metric": integer,
"ref": integer,
"use": integer,
"mss": integer,
"window": integer,
"irtt": integer,
"iface": string
}
]
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -21,6 +21,34 @@ Usage (module):
import jc.parsers.rpm_qi
result = jc.parsers.rpm_qi.parse(rpm_qi_command_output)
Schema:
[
{
"name": string,
"epoch": integer,
"version": string,
"release": string,
"architecture": string,
"install_date": string,
"group": string,
"size": integer,
"license": string,
"signature": string,
"source_rpm": string,
"build_date": string,
"build_epoch": integer, # naive timestamp
"build_epoch_utc": integer, # Aware timestamp if timezone is UTC
"build_host": string,
"relocations": string,
"packager": string,
"vendor": string,
"url": string,
"summary": string,
"description": string
}
]
Compatibility:
'linux'
@ -128,49 +156,7 @@ Examples:
```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:
[
{
"name": string,
"epoch": integer,
"version": string,
"release": string,
"architecture": string,
"install_date": string,
"group": string,
"size": integer,
"license": string,
"signature": string,
"source_rpm": string,
"build_date": string,
"build_epoch": integer, # naive timestamp
"build_epoch_utc": integer, # Aware timestamp if timezone is UTC
"build_host": string,
"relocations": string,
"packager": string,
"vendor": string,
"url": string,
"summary": string,
"description": string
}
]
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -11,6 +11,21 @@ Usage (module):
import jc.parsers.shadow
result = jc.parsers.shadow.parse(shadow_file_output)
Schema:
[
{
"username": string,
"password": string,
"last_changed": integer,
"minimum": integer,
"maximum": integer,
"warn": integer,
"inactive": integer,
"expire": integer
}
]
Compatibility:
'linux', 'darwin', 'aix', 'freebsd'
@ -92,36 +107,7 @@ Examples:
```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:
[
{
"username": string,
"password": string,
"last_changed": integer,
"minimum": integer,
"maximum": integer,
"warn": integer,
"inactive": integer,
"expire": integer
}
]
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -2,6 +2,8 @@
# jc.parsers.ss
jc - JSON CLI output utility `ss` command output parser
Extended information options like -e and -p are not supported and may cause parsing irregularities.
Usage (cli):
$ ss | jc --ss
@ -15,9 +17,29 @@ Usage (module):
import jc.parsers.ss
result = jc.parsers.ss.parse(ss_command_output)
Limitations:
Schema:
Extended information options like -e and -p are not supported and may cause parsing irregularities
Information from https://www.cyberciti.biz/files/ss.html used to define field names
[
{
"netid": string,
"state": string,
"recv_q": integer,
"send_q": integer,
"local_address": string,
"local_port": string,
"local_port_num": integer,
"peer_address": string,
"peer_port": string,
"peer_port_num": integer,
"interface": string,
"link_layer" string,
"channel": string,
"path": string,
"pid": integer
}
]
Compatibility:
@ -262,45 +284,7 @@ Examples:
```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:
[
{
"netid": string,
"state": string,
"recv_q": integer,
"send_q": integer,
"local_address": string,
"local_port": string,
"local_port_num": integer,
"peer_address": string,
"peer_port": string,
"peer_port_num": integer,
"interface": string,
"link_layer" string,
"channel": string,
"path": string,
"pid": integer
}
]
Information from https://www.cyberciti.biz/files/ss.html used to define field names
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -19,6 +19,44 @@ Usage (module):
import jc.parsers.stat
result = jc.parsers.stat.parse(stat_command_output)
Schema:
[
{
"file": string,
"link_to" string,
"size": integer,
"blocks": integer,
"io_blocks": integer,
"type": string,
"device": string,
"inode": integer,
"links": integer,
"access": string,
"flags": string,
"uid": integer,
"user": string,
"gid": integer,
"group": string,
"access_time": string, # - = null
"access_time_epoch": integer, # naive timestamp
"access_time_epoch_utc": integer, # timezone-aware timestamp
"modify_time": string, # - = null
"modify_time_epoch": integer, # naive timestamp
"modify_time_epoch_utc": integer, # timezone-aware timestamp
"change_time": string, # - = null
"change_time_epoch": integer, # naive timestamp
"change_time_epoch_utc": integer, # timezone-aware timestamp
"birth_time": string, # - = null
"birth_time_epoch": integer, # naive timestamp
"birth_time_epoch_utc": integer, # timezone-aware timestamp
"unix_device": integer,
"rdev": integer,
"block_size": integer,
"unix_flags": string
}
]
Compatibility:
'linux', 'darwin', 'freebsd'
@ -136,59 +174,7 @@ Examples:
```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:
[
{
"file": string,
"link_to" string,
"size": integer,
"blocks": integer,
"io_blocks": integer,
"type": string,
"device": string,
"inode": integer,
"links": integer,
"access": string,
"flags": string,
"uid": integer,
"user": string,
"gid": integer,
"group": string,
"access_time": string, # - = null
"access_time_epoch": integer, # naive timestamp
"access_time_epoch_utc": integer, # timezone-aware timestamp
"modify_time": string, # - = null
"modify_time_epoch": integer, # naive timestamp
"modify_time_epoch_utc": integer, # timezone-aware timestamp
"change_time": string, # - = null
"change_time_epoch": integer, # naive timestamp
"change_time_epoch_utc": integer, # timezone-aware timestamp
"birth_time": string, # - = null
"birth_time_epoch": integer, # naive timestamp
"birth_time_epoch_utc": integer, # timezone-aware timestamp
"unix_device": integer,
"rdev": integer,
"block_size": integer,
"unix_flags": string
}
]
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -17,6 +17,14 @@ Usage (module):
import jc.parsers.sysctl
result = jc.parsers.sysctl.parse(sysctl_command_output)
Schema:
{
"key1": string/integer/float, # best guess based on value
"key2": string/integer/float,
"key3": string/integer/float
}
Compatibility:
'linux', 'darwin', 'freebsd'
@ -52,29 +60,7 @@ Examples:
```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:
{
"foo": string/integer/float, # best guess based on value
"bar": string/integer/float,
"baz": string/integer/float
}
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -15,6 +15,18 @@ Usage (module):
import jc.parsers.systemctl
result = jc.parsers.systemctl.parse(systemctl_command_output)
Schema:
[
{
"unit": string,
"load": string,
"active": string,
"sub": string,
"description": string
}
]
Compatibility:
'linux'
@ -52,33 +64,7 @@ Examples:
```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:
[
{
"unit": string,
"load": string,
"active": string,
"sub": string,
"description": string
}
]
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -15,6 +15,17 @@ Usage (module):
import jc.parsers.systemctl_lj
result = jc.parsers.systemctl_lj.parse(systemctl_lj_command_output)
Schema:
[
{
"job": integer,
"unit": string,
"type": string,
"state": string
}
]
Compatibility:
'linux'
@ -66,37 +77,11 @@ Examples:
]
## 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:
[
{
"job": integer,
"unit": string,
"type": string,
"state": string
}
]
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -15,6 +15,16 @@ Usage (module):
import jc.parsers.systemctl_ls
result = jc.parsers.systemctl_ls.parse(systemctl_ls_command_output)
Schema:
[
{
"listen": string,
"unit": string,
"activates": string
}
]
Compatibility:
'linux'
@ -46,31 +56,7 @@ Examples:
```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:
[
{
"listen": string,
"unit": string,
"activates": string
}
]
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -15,6 +15,15 @@ Usage (module):
import jc.parsers.systemctl_luf
result = jc.parsers.systemctl_luf.parse(systemctl_luf_command_output)
Schema:
[
{
"unit_file": string,
"state": string
}
]
Compatibility:
'linux'
@ -43,30 +52,7 @@ Examples:
```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:
[
{
"unit_file": string,
"state": string
}
]
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -17,6 +17,48 @@ Usage (module):
import jc.parsers.time
result = jc.parsers.time.parse(time_command_output)
Schema:
Source: https://www.freebsd.org/cgi/man.cgi?query=getrusage
https://man7.org/linux/man-pages/man1/time.1.html
{
"real_time": float,
"user_time": float,
"system_time": float,
"elapsed_time": string,
"elapsed_time_hours": integer,
"elapsed_time_minutes": integer,
"elapsed_time_seconds": integer,
"elapsed_time_centiseconds": integer,
"elapsed_time_total_seconds": float,
"cpu_percent": integer, # null if ?
"average_shared_text_size": integer,
"average_unshared_data_size": integer,
"average_unshared_stack_size": integer,
"average_shared_memory_size": integer,
"maximum_resident_set_size": integer,
"block_input_operations": integer, # aka File system inputs
"block_output_operations": integer, # aka File system outputs
"major_pagefaults": integer,
"minor_pagefaults": integer,
"swaps": integer,
"page_reclaims": integer,
"page_faults": integer,
"messages_sent": integer,
"messages_received": integer,
"signals_received": integer,
"voluntary_context_switches": integer,
"involuntary_context_switches": integer
"command_being_timed": string,
"average_stack_size": integer,
"average_total_size": integer,
"average_resident_set_size": integer,
"signals_delivered": integer,
"page_size": integer,
"exit_status": integer
}
Compatibility:
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
@ -87,63 +129,7 @@ Examples:
```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:
Dictionary. Structured data with the following schema:
Source: https://www.freebsd.org/cgi/man.cgi?query=getrusage
https://man7.org/linux/man-pages/man1/time.1.html
{
"real_time": float,
"user_time": float,
"system_time": float,
"elapsed_time": string,
"elapsed_time_hours": integer,
"elapsed_time_minutes": integer,
"elapsed_time_seconds": integer,
"elapsed_time_centiseconds": integer,
"elapsed_time_total_seconds": float,
"cpu_percent": integer, # null if ?
"average_shared_text_size": integer,
"average_unshared_data_size": integer,
"average_unshared_stack_size": integer,
"average_shared_memory_size": integer,
"maximum_resident_set_size": integer,
"block_input_operations": integer, # aka File system inputs
"block_output_operations": integer, # aka File system outputs
"major_pagefaults": integer,
"minor_pagefaults": integer,
"swaps": integer,
"page_reclaims": integer,
"page_faults": integer,
"messages_sent": integer,
"messages_received": integer,
"signals_received": integer,
"voluntary_context_switches": integer,
"involuntary_context_switches": integer
"command_being_timed": string,
"average_stack_size": integer,
"average_total_size": integer,
"average_resident_set_size": integer,
"signals_delivered": integer,
"page_size": integer,
"exit_status": integer
}
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -17,6 +17,22 @@ Usage (module):
import jc.parsers.timedatectl
result = jc.parsers.timedatectl.parse(timedatectl_command_output)
Schema:
{
"local_time": string,
"universal_time": string,
"epoch_utc": integer, # timezone-aware timestamp
"rtc_time": string,
"time_zone": string,
"ntp_enabled": boolean,
"ntp_synchronized": boolean,
"system_clock_synchronized": boolean,
"systemd-timesyncd.service_active": boolean,
"rtc_in_local_tz": boolean,
"dst_active": boolean
}
Compatibility:
'linux'
@ -53,37 +69,7 @@ Examples:
```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:
{
"local_time": string,
"universal_time": string,
"epoch_utc": integer, # timezone-aware timestamp
"rtc_time": string,
"time_zone": string,
"ntp_enabled": boolean,
"ntp_synchronized": boolean,
"system_clock_synchronized": boolean,
"systemd-timesyncd.service_active": boolean,
"rtc_in_local_tz": boolean,
"dst_active": boolean
}
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -17,6 +17,25 @@ Usage (module):
import jc.parsers.tracepath
result = jc.parsers.tracepath.parse(tracepath_command_output)
Schema:
{
"pmtu": integer,
"forward_hops": integer,
"return_hops": integer,
"hops": [
{
"ttl": integer,
"guess": boolean,
"host": string,
"reply_ms": float,
"pmtu": integer,
"asymmetric_difference": integer,
"reached": boolean
}
]
}
Compatibility:
'linux'
@ -114,45 +133,11 @@ Examples:
}
## 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:
{
"pmtu": integer,
"forward_hops": integer,
"return_hops": integer,
"hops": [
{
"ttl": integer,
"guess": boolean,
"host": string,
"reply_ms": float,
"pmtu": integer,
"asymmetric_difference": integer,
"reached": boolean
}
]
}
Provides parser metadata (version, author, etc.)
## parse
```python

View File

@ -21,6 +21,27 @@ Usage (module):
import jc.parsers.traceroute
result = jc.parsers.traceroute.parse(traceroute_command_output)
Schema:
{
"destination_ip": string,
"destination_name": string,
"hops": [
{
"hop": integer,
"probes": [
{
"annotation": string,
"asn": integer,
"ip": string,
"name": string,
"rtt": float
}
]
}
]
}
Compatibility:
'linux', 'darwin', 'freebsd'
@ -102,48 +123,7 @@ Examples:
```python
info()
```
## Hop
```python
Hop(idx)
```
## 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:
{
"destination_ip": string,
"destination_name": string,
"hops": [
{
"hop": integer,
"probes": [
{
"annotation": string,
"asn": integer,
"ip": string,
"name": string,
"rtt": float
}
]
}
]
}
Provides parser metadata (version, author, etc.)
## parse
```python