mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-17 00:07:37 +02:00
update documentation
This commit is contained in:
@ -13,6 +13,17 @@ Usage (module):
|
|||||||
import jc.parsers.csv
|
import jc.parsers.csv
|
||||||
result = jc.parsers.csv.parse(csv_output)
|
result = jc.parsers.csv.parse(csv_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
csv file converted to a Dictionary: https://docs.python.org/3/library/csv.html
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"column_name1": string,
|
||||||
|
"column_name2": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
||||||
@ -69,30 +80,7 @@ Examples:
|
|||||||
```python
|
```python
|
||||||
info()
|
info()
|
||||||
```
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
## 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. Each Dictionary represents a row in the csv file:
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
csv file converted to a Dictionary
|
|
||||||
https://docs.python.org/3/library/csv.html
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
## parse
|
## parse
|
||||||
```python
|
```python
|
||||||
|
@ -19,6 +19,30 @@ Usage (module):
|
|||||||
import jc.parsers.date
|
import jc.parsers.date
|
||||||
result = jc.parsers.date.parse(date_command_output)
|
result = jc.parsers.date.parse(date_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
{
|
||||||
|
"year": integer,
|
||||||
|
"month": string,
|
||||||
|
"month_num": integer,
|
||||||
|
"day": integer,
|
||||||
|
"weekday": string,
|
||||||
|
"weekday_num": integer,
|
||||||
|
"hour": integer,
|
||||||
|
"hour_24": integer,
|
||||||
|
"minute": integer,
|
||||||
|
"second": integer,
|
||||||
|
"period": string,
|
||||||
|
"timezone": string,
|
||||||
|
"utc_offset": string, # null if timezone field is not UTC
|
||||||
|
"day_of_year": integer,
|
||||||
|
"week_of_year": integer,
|
||||||
|
"iso": string,
|
||||||
|
"epoch": integer, # naive timestamp
|
||||||
|
"epoch_utc": integer, # timezone-aware timestamp. Only available if timezone field is UTC
|
||||||
|
"timezone_aware": boolean # if true, all fields are correctly based on UTC
|
||||||
|
}
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'freebsd'
|
'linux', 'darwin', 'freebsd'
|
||||||
@ -53,44 +77,7 @@ Examples:
|
|||||||
```python
|
```python
|
||||||
info()
|
info()
|
||||||
```
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
## 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": string,
|
|
||||||
"month_num": integer,
|
|
||||||
"day": integer,
|
|
||||||
"weekday": string,
|
|
||||||
"weekday_num": integer,
|
|
||||||
"hour": integer,
|
|
||||||
"hour_24": integer,
|
|
||||||
"minute": integer,
|
|
||||||
"second": integer,
|
|
||||||
"period": string,
|
|
||||||
"timezone": string,
|
|
||||||
"utc_offset": string, # null if timezone field is not UTC
|
|
||||||
"day_of_year": integer,
|
|
||||||
"week_of_year": integer,
|
|
||||||
"iso": string,
|
|
||||||
"epoch": integer, # naive timestamp
|
|
||||||
"epoch_utc": integer, # timezone-aware timestamp. Only available if timezone field is UTC
|
|
||||||
"timezone_aware": boolean # if true, all fields are correctly based on UTC
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
## parse
|
## parse
|
||||||
```python
|
```python
|
||||||
|
@ -15,6 +15,25 @@ Usage (module):
|
|||||||
import jc.parsers.df
|
import jc.parsers.df
|
||||||
result = jc.parsers.df.parse(df_command_output)
|
result = jc.parsers.df.parse(df_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"filesystem": string,
|
||||||
|
"size": string,
|
||||||
|
"1k_blocks": integer,
|
||||||
|
"512_blocks": integer,
|
||||||
|
"used": integer,
|
||||||
|
"available": integer,
|
||||||
|
"capacity_percent": integer,
|
||||||
|
"ifree": integer,
|
||||||
|
"iused": integer,
|
||||||
|
"use_percent": integer,
|
||||||
|
"iused_percent": integer,
|
||||||
|
"mounted_on": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'freebsd'
|
'linux', 'darwin', 'freebsd'
|
||||||
@ -84,40 +103,7 @@ Examples:
|
|||||||
```python
|
```python
|
||||||
info()
|
info()
|
||||||
```
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
## 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,
|
|
||||||
"size": string,
|
|
||||||
"1k_blocks": integer,
|
|
||||||
"512_blocks": integer,
|
|
||||||
"used": integer,
|
|
||||||
"available": integer,
|
|
||||||
"capacity_percent": integer,
|
|
||||||
"ifree": integer,
|
|
||||||
"iused": integer,
|
|
||||||
"use_percent": integer,
|
|
||||||
"iused_percent": integer,
|
|
||||||
"mounted_on": string
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
## parse
|
## parse
|
||||||
```python
|
```python
|
||||||
|
@ -19,6 +19,62 @@ Usage (module):
|
|||||||
import jc.parsers.dig
|
import jc.parsers.dig
|
||||||
result = jc.parsers.dig.parse(dig_command_output)
|
result = jc.parsers.dig.parse(dig_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"id": integer,
|
||||||
|
"opcode": string,
|
||||||
|
"status": string,
|
||||||
|
"flags": [
|
||||||
|
string
|
||||||
|
],
|
||||||
|
"query_num": integer,
|
||||||
|
"answer_num": integer,
|
||||||
|
"authority_num": integer,
|
||||||
|
"additional_num": integer,
|
||||||
|
"axfr": [
|
||||||
|
{
|
||||||
|
"name": string,
|
||||||
|
"class": string,
|
||||||
|
"type": string,
|
||||||
|
"ttl": integer,
|
||||||
|
"data": string
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"question": {
|
||||||
|
"name": string,
|
||||||
|
"class": string,
|
||||||
|
"type": string
|
||||||
|
},
|
||||||
|
"answer": [
|
||||||
|
{
|
||||||
|
"name": string,
|
||||||
|
"class": string,
|
||||||
|
"type": string,
|
||||||
|
"ttl": integer,
|
||||||
|
"data": string
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"authority": [
|
||||||
|
{
|
||||||
|
"name": string,
|
||||||
|
"class": string,
|
||||||
|
"type": string,
|
||||||
|
"ttl": integer,
|
||||||
|
"data": string
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"query_time": integer, # in msec
|
||||||
|
"server": string,
|
||||||
|
"when": string,
|
||||||
|
"when_epoch": integer, # naive timestamp if when field is parsable, else null
|
||||||
|
"when_epoch_utc": integer, # timezone aware timestamp availabe for UTC, else null
|
||||||
|
"rcvd": integer
|
||||||
|
"size": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
||||||
@ -346,77 +402,7 @@ Examples:
|
|||||||
```python
|
```python
|
||||||
info()
|
info()
|
||||||
```
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
## 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:
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"id": integer,
|
|
||||||
"opcode": string,
|
|
||||||
"status": string,
|
|
||||||
"flags": [
|
|
||||||
string
|
|
||||||
],
|
|
||||||
"query_num": integer,
|
|
||||||
"answer_num": integer,
|
|
||||||
"authority_num": integer,
|
|
||||||
"additional_num": integer,
|
|
||||||
"axfr": [
|
|
||||||
{
|
|
||||||
"name": string,
|
|
||||||
"class": string,
|
|
||||||
"type": string,
|
|
||||||
"ttl": integer,
|
|
||||||
"data": string
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"question": {
|
|
||||||
"name": string,
|
|
||||||
"class": string,
|
|
||||||
"type": string
|
|
||||||
},
|
|
||||||
"answer": [
|
|
||||||
{
|
|
||||||
"name": string,
|
|
||||||
"class": string,
|
|
||||||
"type": string,
|
|
||||||
"ttl": integer,
|
|
||||||
"data": string
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"authority": [
|
|
||||||
{
|
|
||||||
"name": string,
|
|
||||||
"class": string,
|
|
||||||
"type": string,
|
|
||||||
"ttl": integer,
|
|
||||||
"data": string
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"query_time": integer, # in msec
|
|
||||||
"server": string,
|
|
||||||
"when": string,
|
|
||||||
"when_epoch": integer, # naive timestamp if when field is parsable, else null
|
|
||||||
"when_epoch_utc": integer, # timezone aware timestamp availabe for UTC, else null
|
|
||||||
"rcvd": integer
|
|
||||||
"size": string
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
## parse
|
## parse
|
||||||
```python
|
```python
|
||||||
|
@ -23,6 +23,20 @@ Usage (module):
|
|||||||
import jc.parsers.dir
|
import jc.parsers.dir
|
||||||
result = jc.parsers.dir.parse(dir_command_output)
|
result = jc.parsers.dir.parse(dir_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"date": string,
|
||||||
|
"time": string,
|
||||||
|
"epoch": integer, # naive timestamp
|
||||||
|
"dir": boolean,
|
||||||
|
"size": integer,
|
||||||
|
"filename: string,
|
||||||
|
"parent": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'win32'
|
'win32'
|
||||||
@ -112,35 +126,7 @@ Examples:
|
|||||||
```python
|
```python
|
||||||
info()
|
info()
|
||||||
```
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
## process
|
|
||||||
```python
|
|
||||||
process(proc_data)
|
|
||||||
```
|
|
||||||
|
|
||||||
Final processing to conform to the schema.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
|
|
||||||
proc_data: (Dictionary of Lists) raw structured data to process
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"date": string,
|
|
||||||
"time": string,
|
|
||||||
"epoch": integer, # naive timestamp
|
|
||||||
"dir": boolean,
|
|
||||||
"size": integer,
|
|
||||||
"filename: string,
|
|
||||||
"parent": string
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
## parse
|
## parse
|
||||||
```python
|
```python
|
||||||
|
@ -15,6 +15,23 @@ Usage (module):
|
|||||||
import jc.parsers.dmidecode
|
import jc.parsers.dmidecode
|
||||||
result = jc.parsers.dmidecode.parse(dmidecode_command_output)
|
result = jc.parsers.dmidecode.parse(dmidecode_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"handle": string,
|
||||||
|
"type": integer,
|
||||||
|
"bytes": integer,
|
||||||
|
"description": string,
|
||||||
|
"values": { (null if empty)
|
||||||
|
"lowercase_no_spaces_keys": string,
|
||||||
|
"multiline_key_values": [
|
||||||
|
string,
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux'
|
'linux'
|
||||||
@ -114,38 +131,7 @@ Examples:
|
|||||||
```python
|
```python
|
||||||
info()
|
info()
|
||||||
```
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
## 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:
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"handle": string,
|
|
||||||
"type": integer,
|
|
||||||
"bytes": integer,
|
|
||||||
"description": string,
|
|
||||||
"values": { (null if empty)
|
|
||||||
"lowercase_no_spaces_keys": string,
|
|
||||||
"multiline_key_values": [
|
|
||||||
string,
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
## parse
|
## parse
|
||||||
```python
|
```python
|
||||||
|
@ -19,6 +19,21 @@ Usage (module):
|
|||||||
import jc.parsers.dpkg
|
import jc.parsers.dpkg
|
||||||
result = jc.parsers.dpkg.parse(dpkg_command_output)
|
result = jc.parsers.dpkg.parse(dpkg_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"codes": string,
|
||||||
|
"name": string,
|
||||||
|
"version": string,
|
||||||
|
"architecture": string,
|
||||||
|
"description": string,
|
||||||
|
"desired": string,
|
||||||
|
"status": string,
|
||||||
|
"error": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux'
|
'linux'
|
||||||
@ -121,36 +136,7 @@ Examples:
|
|||||||
```python
|
```python
|
||||||
info()
|
info()
|
||||||
```
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
## 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:
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"codes": string,
|
|
||||||
"name": string,
|
|
||||||
"version": string,
|
|
||||||
"architecture": string,
|
|
||||||
"description": string,
|
|
||||||
"desired": string,
|
|
||||||
"status": string,
|
|
||||||
"error": string
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
## parse
|
## parse
|
||||||
```python
|
```python
|
||||||
|
@ -15,6 +15,15 @@ Usage (module):
|
|||||||
import jc.parsers.du
|
import jc.parsers.du
|
||||||
result = jc.parsers.du.parse(du_command_output)
|
result = jc.parsers.du.parse(du_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"size": integer,
|
||||||
|
"name": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'aix', 'freebsd'
|
'linux', 'darwin', 'aix', 'freebsd'
|
||||||
@ -84,30 +93,7 @@ Examples:
|
|||||||
```python
|
```python
|
||||||
info()
|
info()
|
||||||
```
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
## 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:
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"size": integer,
|
|
||||||
"name": string
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
## parse
|
## parse
|
||||||
```python
|
```python
|
||||||
|
@ -17,6 +17,15 @@ Usage (module):
|
|||||||
import jc.parsers.env
|
import jc.parsers.env
|
||||||
result = jc.parsers.env.parse(env_command_output)
|
result = jc.parsers.env.parse(env_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": string,
|
||||||
|
"value": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
||||||
@ -66,30 +75,7 @@ Examples:
|
|||||||
```python
|
```python
|
||||||
info()
|
info()
|
||||||
```
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
## process
|
|
||||||
```python
|
|
||||||
process(proc_data)
|
|
||||||
```
|
|
||||||
|
|
||||||
Final processing to conform to the schema.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
|
|
||||||
proc_data: (Dictionary) raw structured data to process
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"name": string,
|
|
||||||
"value": string
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
## parse
|
## parse
|
||||||
```python
|
```python
|
||||||
|
@ -15,6 +15,15 @@ Usage (module):
|
|||||||
import jc.parsers.file
|
import jc.parsers.file
|
||||||
result = jc.parsers.file.parse(file_command_output)
|
result = jc.parsers.file.parse(file_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"filename": string,
|
||||||
|
"type ": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'aix', 'freebsd', 'darwin'
|
'linux', 'aix', 'freebsd', 'darwin'
|
||||||
@ -59,30 +68,7 @@ Examples:
|
|||||||
```python
|
```python
|
||||||
info()
|
info()
|
||||||
```
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
## 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,
|
|
||||||
"type ": string
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
## parse
|
## parse
|
||||||
```python
|
```python
|
||||||
|
@ -17,6 +17,24 @@ Usage (module):
|
|||||||
import jc.parsers.finger
|
import jc.parsers.finger
|
||||||
result = jc.parsers.finger.parse(finger_command_output)
|
result = jc.parsers.finger.parse(finger_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"login": string,
|
||||||
|
"name": string,
|
||||||
|
"tty": string,
|
||||||
|
"idle": string, # null if empty
|
||||||
|
"login_time": string,
|
||||||
|
"details": string,
|
||||||
|
"tty_writeable": boolean,
|
||||||
|
"idle_minutes": integer,
|
||||||
|
"idle_hours": integer,
|
||||||
|
"idle_days": integer,
|
||||||
|
"total_idle_minutes": integer
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'cygwin', freebsd'
|
'linux', 'darwin', 'cygwin', freebsd'
|
||||||
@ -78,39 +96,7 @@ Examples:
|
|||||||
```python
|
```python
|
||||||
info()
|
info()
|
||||||
```
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
## 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:
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"login": string,
|
|
||||||
"name": string,
|
|
||||||
"tty": string,
|
|
||||||
"idle": string, # null if empty
|
|
||||||
"login_time": string,
|
|
||||||
"details": string,
|
|
||||||
"tty_writeable": boolean,
|
|
||||||
"idle_minutes": integer,
|
|
||||||
"idle_hours": integer,
|
|
||||||
"idle_days": integer,
|
|
||||||
"total_idle_minutes": integer
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
## parse
|
## parse
|
||||||
```python
|
```python
|
||||||
|
@ -15,6 +15,20 @@ Usage (module):
|
|||||||
import jc.parsers.free
|
import jc.parsers.free
|
||||||
result = jc.parsers.free.parse(free_command_output)
|
result = jc.parsers.free.parse(free_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": string,
|
||||||
|
"total": integer,
|
||||||
|
"used": integer,
|
||||||
|
"free": integer,
|
||||||
|
"shared": integer,
|
||||||
|
"buff_cache": integer,
|
||||||
|
"available": integer
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux'
|
'linux'
|
||||||
@ -64,35 +78,7 @@ Examples:
|
|||||||
```python
|
```python
|
||||||
info()
|
info()
|
||||||
```
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
## 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:
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"type": string,
|
|
||||||
"total": integer,
|
|
||||||
"used": integer,
|
|
||||||
"free": integer,
|
|
||||||
"shared": integer,
|
|
||||||
"buff_cache": integer,
|
|
||||||
"available": integer
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
## parse
|
## parse
|
||||||
```python
|
```python
|
||||||
|
@ -11,6 +11,19 @@ Usage (module):
|
|||||||
import jc.parsers.fstab
|
import jc.parsers.fstab
|
||||||
result = jc.parsers.fstab.parse(fstab_command_output)
|
result = jc.parsers.fstab.parse(fstab_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"fs_spec": string,
|
||||||
|
"fs_file": string,
|
||||||
|
"fs_vfstype": string,
|
||||||
|
"fs_mntops": string,
|
||||||
|
"fs_freq": integer,
|
||||||
|
"fs_passno": integer
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'freebsd'
|
'linux', 'freebsd'
|
||||||
@ -78,34 +91,7 @@ Examples:
|
|||||||
```python
|
```python
|
||||||
info()
|
info()
|
||||||
```
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
## 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:
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"fs_spec": string,
|
|
||||||
"fs_file": string,
|
|
||||||
"fs_vfstype": string,
|
|
||||||
"fs_mntops": string,
|
|
||||||
"fs_freq": integer,
|
|
||||||
"fs_passno": integer
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
## parse
|
## parse
|
||||||
```python
|
```python
|
||||||
|
@ -11,6 +11,19 @@ Usage (module):
|
|||||||
import jc.parsers.group
|
import jc.parsers.group
|
||||||
result = jc.parsers.group.parse(group_file_output)
|
result = jc.parsers.group.parse(group_file_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"group_name": string,
|
||||||
|
"password": string,
|
||||||
|
"gid": integer,
|
||||||
|
"members": [
|
||||||
|
string
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'aix', 'freebsd'
|
'linux', 'darwin', 'aix', 'freebsd'
|
||||||
@ -102,34 +115,7 @@ Examples:
|
|||||||
```python
|
```python
|
||||||
info()
|
info()
|
||||||
```
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
## 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:
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"group_name": string,
|
|
||||||
"password": string,
|
|
||||||
"gid": integer,
|
|
||||||
"members": [
|
|
||||||
string
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
## parse
|
## parse
|
||||||
```python
|
```python
|
||||||
|
@ -11,6 +11,21 @@ Usage (module):
|
|||||||
import jc.parsers.gshadow
|
import jc.parsers.gshadow
|
||||||
result = jc.parsers.gshadow.parse(gshadow_file_output)
|
result = jc.parsers.gshadow.parse(gshadow_file_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"group_name": string,
|
||||||
|
"password": string,
|
||||||
|
"administrators": [
|
||||||
|
string
|
||||||
|
],
|
||||||
|
"members": [
|
||||||
|
string
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'aix', 'freebsd'
|
'linux', 'aix', 'freebsd'
|
||||||
@ -68,36 +83,7 @@ Examples:
|
|||||||
```python
|
```python
|
||||||
info()
|
info()
|
||||||
```
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
## 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:
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"group_name": string,
|
|
||||||
"password": string,
|
|
||||||
"administrators": [
|
|
||||||
string
|
|
||||||
],
|
|
||||||
"members": [
|
|
||||||
string
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
## parse
|
## parse
|
||||||
```python
|
```python
|
||||||
|
@ -11,6 +11,15 @@ Usage (module):
|
|||||||
import jc.parsers.hash
|
import jc.parsers.hash
|
||||||
result = jc.parsers.hash.parse(hash_command_output)
|
result = jc.parsers.hash.parse(hash_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"command": string,
|
||||||
|
"hits": integer
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
||||||
@ -34,30 +43,7 @@ Examples:
|
|||||||
```python
|
```python
|
||||||
info()
|
info()
|
||||||
```
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
## 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
|
## parse
|
||||||
```python
|
```python
|
||||||
|
@ -25,6 +25,15 @@ Usage (module):
|
|||||||
import jc.parsers.hashsum
|
import jc.parsers.hashsum
|
||||||
result = jc.parsers.hashsum.parse(md5sum_command_output)
|
result = jc.parsers.hashsum.parse(md5sum_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"filename": string,
|
||||||
|
"hash": string,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
||||||
@ -65,30 +74,7 @@ Examples:
|
|||||||
```python
|
```python
|
||||||
info()
|
info()
|
||||||
```
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
## 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
|
## parse
|
||||||
```python
|
```python
|
||||||
|
@ -15,6 +15,57 @@ Usage (module):
|
|||||||
import jc.parsers.hciconfig
|
import jc.parsers.hciconfig
|
||||||
result = jc.parsers.hciconfig.parse(hciconfig_command_output)
|
result = jc.parsers.hciconfig.parse(hciconfig_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"device": string,
|
||||||
|
"type": string,
|
||||||
|
"bus": string,
|
||||||
|
"bd_address": string,
|
||||||
|
"acl_mtu": integer,
|
||||||
|
"acl_mtu_packets": integer,
|
||||||
|
"sco_mtu": integer,
|
||||||
|
"sco_mtu_packets": integer,
|
||||||
|
"state": [
|
||||||
|
string
|
||||||
|
],
|
||||||
|
"rx_bytes": integer,
|
||||||
|
"rx_acl": integer,
|
||||||
|
"rx_sco": integer,
|
||||||
|
"rx_events": integer,
|
||||||
|
"rx_errors": integer,
|
||||||
|
"tx_bytes": integer,
|
||||||
|
"tx_acl": integer,
|
||||||
|
"tx_sco": integer,
|
||||||
|
"tx_commands": integer,
|
||||||
|
"tx_errors": integer,
|
||||||
|
"features": [
|
||||||
|
string
|
||||||
|
],
|
||||||
|
"packet_type": [
|
||||||
|
string
|
||||||
|
],
|
||||||
|
"link_policy": [
|
||||||
|
string
|
||||||
|
],
|
||||||
|
"link_mode": [
|
||||||
|
string
|
||||||
|
],
|
||||||
|
"name": string,
|
||||||
|
"class": string,
|
||||||
|
"service_classes": [
|
||||||
|
string # 'Unspecified' is null
|
||||||
|
],
|
||||||
|
"device_class": string,
|
||||||
|
"hci_version": string,
|
||||||
|
"hci_revision": string,
|
||||||
|
"lmp_version": string,
|
||||||
|
"lmp_subversion": string,
|
||||||
|
"manufacturer": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux'
|
'linux'
|
||||||
@ -272,72 +323,7 @@ Examples:
|
|||||||
```python
|
```python
|
||||||
info()
|
info()
|
||||||
```
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
## 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:
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"device": string,
|
|
||||||
"type": string,
|
|
||||||
"bus": string,
|
|
||||||
"bd_address": string,
|
|
||||||
"acl_mtu": integer,
|
|
||||||
"acl_mtu_packets": integer,
|
|
||||||
"sco_mtu": integer,
|
|
||||||
"sco_mtu_packets": integer,
|
|
||||||
"state": [
|
|
||||||
string
|
|
||||||
],
|
|
||||||
"rx_bytes": integer,
|
|
||||||
"rx_acl": integer,
|
|
||||||
"rx_sco": integer,
|
|
||||||
"rx_events": integer,
|
|
||||||
"rx_errors": integer,
|
|
||||||
"tx_bytes": integer,
|
|
||||||
"tx_acl": integer,
|
|
||||||
"tx_sco": integer,
|
|
||||||
"tx_commands": integer,
|
|
||||||
"tx_errors": integer,
|
|
||||||
"features": [
|
|
||||||
string
|
|
||||||
],
|
|
||||||
"packet_type": [
|
|
||||||
string
|
|
||||||
],
|
|
||||||
"link_policy": [
|
|
||||||
string
|
|
||||||
],
|
|
||||||
"link_mode": [
|
|
||||||
string
|
|
||||||
],
|
|
||||||
"name": string,
|
|
||||||
"class": string,
|
|
||||||
"service_classes": [
|
|
||||||
string # 'Unspecified' is null
|
|
||||||
],
|
|
||||||
"device_class": string,
|
|
||||||
"hci_version": string,
|
|
||||||
"hci_revision": string,
|
|
||||||
"lmp_version": string,
|
|
||||||
"lmp_subversion": string,
|
|
||||||
"manufacturer": string
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
## parse
|
## parse
|
||||||
```python
|
```python
|
||||||
|
@ -13,6 +13,15 @@ Usage (module):
|
|||||||
import jc.parsers.history
|
import jc.parsers.history
|
||||||
result = jc.parsers.history.parse(history_command_output)
|
result = jc.parsers.history.parse(history_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"line": integer,
|
||||||
|
"command": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
||||||
@ -54,30 +63,7 @@ Examples:
|
|||||||
```python
|
```python
|
||||||
info()
|
info()
|
||||||
```
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
## process
|
|
||||||
```python
|
|
||||||
process(proc_data)
|
|
||||||
```
|
|
||||||
|
|
||||||
Final processing to conform to the schema.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
|
|
||||||
proc_data: (Dictionary) raw structured data to process
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"line": integer,
|
|
||||||
"command": string
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
## parse
|
## parse
|
||||||
```python
|
```python
|
||||||
|
@ -11,6 +11,17 @@ Usage (module):
|
|||||||
import jc.parsers.hosts
|
import jc.parsers.hosts
|
||||||
result = jc.parsers.hosts.parse(hosts_file_output)
|
result = jc.parsers.hosts.parse(hosts_file_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"ip": string,
|
||||||
|
"hostname": [
|
||||||
|
string
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
||||||
@ -69,32 +80,7 @@ Examples:
|
|||||||
```python
|
```python
|
||||||
info()
|
info()
|
||||||
```
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
## 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:
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"ip": string,
|
|
||||||
"hostname": [
|
|
||||||
string
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
## parse
|
## parse
|
||||||
```python
|
```python
|
||||||
|
@ -15,6 +15,35 @@ Usage (module):
|
|||||||
import jc.parsers.id
|
import jc.parsers.id
|
||||||
result = jc.parsers.id.parse(id_command_output)
|
result = jc.parsers.id.parse(id_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
{
|
||||||
|
"uid": {
|
||||||
|
"id": integer,
|
||||||
|
"name": string
|
||||||
|
},
|
||||||
|
"gid": {
|
||||||
|
"id": integer,
|
||||||
|
"name": string
|
||||||
|
},
|
||||||
|
"groups": [
|
||||||
|
{
|
||||||
|
"id": integer,
|
||||||
|
"name": string
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": integer,
|
||||||
|
"name": string
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"context": {
|
||||||
|
"user": string,
|
||||||
|
"role": string,
|
||||||
|
"type": string,
|
||||||
|
"level": string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'aix', 'freebsd'
|
'linux', 'darwin', 'aix', 'freebsd'
|
||||||
@ -82,50 +111,7 @@ Examples:
|
|||||||
```python
|
```python
|
||||||
info()
|
info()
|
||||||
```
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
## 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:
|
|
||||||
|
|
||||||
{
|
|
||||||
"uid": {
|
|
||||||
"id": integer,
|
|
||||||
"name": string
|
|
||||||
},
|
|
||||||
"gid": {
|
|
||||||
"id": integer,
|
|
||||||
"name": string
|
|
||||||
},
|
|
||||||
"groups": [
|
|
||||||
{
|
|
||||||
"id": integer,
|
|
||||||
"name": string
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": integer,
|
|
||||||
"name": string
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"context": {
|
|
||||||
"user": string,
|
|
||||||
"role": string,
|
|
||||||
"type": string,
|
|
||||||
"level": string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
## parse
|
## parse
|
||||||
```python
|
```python
|
||||||
|
@ -17,6 +17,41 @@ Usage (module):
|
|||||||
import jc.parsers.ifconfig
|
import jc.parsers.ifconfig
|
||||||
result = jc.parsers.ifconfig.parse(ifconfig_command_output)
|
result = jc.parsers.ifconfig.parse(ifconfig_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": string,
|
||||||
|
"flags": integer,
|
||||||
|
"state": [
|
||||||
|
string
|
||||||
|
],
|
||||||
|
"mtu": integer,
|
||||||
|
"ipv4_addr": string,
|
||||||
|
"ipv4_mask": string,
|
||||||
|
"ipv4_bcast": string,
|
||||||
|
"ipv6_addr": string,
|
||||||
|
"ipv6_mask": integer,
|
||||||
|
"ipv6_scope": string,
|
||||||
|
"mac_addr": string,
|
||||||
|
"type": string,
|
||||||
|
"rx_packets": integer,
|
||||||
|
"rx_bytes": integer,
|
||||||
|
"rx_errors": integer,
|
||||||
|
"rx_dropped": integer,
|
||||||
|
"rx_overruns": integer,
|
||||||
|
"rx_frame": integer,
|
||||||
|
"tx_packets": integer,
|
||||||
|
"tx_bytes": integer,
|
||||||
|
"tx_errors": integer,
|
||||||
|
"tx_dropped": integer,
|
||||||
|
"tx_overruns": integer,
|
||||||
|
"tx_carrier": integer,
|
||||||
|
"tx_collisions": integer,
|
||||||
|
"metric": integer
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'aix', 'freebsd', 'darwin'
|
'linux', 'aix', 'freebsd', 'darwin'
|
||||||
@ -157,7 +192,7 @@ Examples:
|
|||||||
```python
|
```python
|
||||||
info()
|
info()
|
||||||
```
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
## IfconfigParser
|
## IfconfigParser
|
||||||
```python
|
```python
|
||||||
@ -165,55 +200,6 @@ IfconfigParser(console_output)
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## 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,
|
|
||||||
"flags": integer,
|
|
||||||
"state": [
|
|
||||||
string
|
|
||||||
],
|
|
||||||
"mtu": integer,
|
|
||||||
"ipv4_addr": string,
|
|
||||||
"ipv4_mask": string,
|
|
||||||
"ipv4_bcast": string,
|
|
||||||
"ipv6_addr": string,
|
|
||||||
"ipv6_mask": integer,
|
|
||||||
"ipv6_scope": string,
|
|
||||||
"mac_addr": string,
|
|
||||||
"type": string,
|
|
||||||
"rx_packets": integer,
|
|
||||||
"rx_bytes": integer,
|
|
||||||
"rx_errors": integer,
|
|
||||||
"rx_dropped": integer,
|
|
||||||
"rx_overruns": integer,
|
|
||||||
"rx_frame": integer,
|
|
||||||
"tx_packets": integer,
|
|
||||||
"tx_bytes": integer,
|
|
||||||
"tx_errors": integer,
|
|
||||||
"tx_dropped": integer,
|
|
||||||
"tx_overruns": integer,
|
|
||||||
"tx_carrier": integer,
|
|
||||||
"tx_collisions": integer,
|
|
||||||
"metric": integer
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
## parse
|
## parse
|
||||||
```python
|
```python
|
||||||
parse(data, raw=False, quiet=False)
|
parse(data, raw=False, quiet=False)
|
||||||
|
@ -11,6 +11,17 @@ Usage (module):
|
|||||||
import jc.parsers.csv
|
import jc.parsers.csv
|
||||||
result = jc.parsers.csv.parse(csv_output)
|
result = jc.parsers.csv.parse(csv_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
csv file converted to a Dictionary: https://docs.python.org/3/library/csv.html
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"column_name1": string,
|
||||||
|
"column_name2": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
||||||
@ -67,7 +78,8 @@ import csv
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.1'
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
|
version = '1.2'
|
||||||
description = 'CSV file parser'
|
description = 'CSV file parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -80,7 +92,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def _process(proc_data):
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -90,14 +102,7 @@ def process(proc_data):
|
|||||||
|
|
||||||
Returns:
|
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.
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
csv file converted to a Dictionary
|
|
||||||
https://docs.python.org/3/library/csv.html
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# No further processing
|
# No further processing
|
||||||
@ -143,4 +148,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if raw:
|
if raw:
|
||||||
return raw_output
|
return raw_output
|
||||||
else:
|
else:
|
||||||
return process(raw_output)
|
return _process(raw_output)
|
||||||
|
@ -17,6 +17,30 @@ Usage (module):
|
|||||||
import jc.parsers.date
|
import jc.parsers.date
|
||||||
result = jc.parsers.date.parse(date_command_output)
|
result = jc.parsers.date.parse(date_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
{
|
||||||
|
"year": integer,
|
||||||
|
"month": string,
|
||||||
|
"month_num": integer,
|
||||||
|
"day": integer,
|
||||||
|
"weekday": string,
|
||||||
|
"weekday_num": integer,
|
||||||
|
"hour": integer,
|
||||||
|
"hour_24": integer,
|
||||||
|
"minute": integer,
|
||||||
|
"second": integer,
|
||||||
|
"period": string,
|
||||||
|
"timezone": string,
|
||||||
|
"utc_offset": string, # null if timezone field is not UTC
|
||||||
|
"day_of_year": integer,
|
||||||
|
"week_of_year": integer,
|
||||||
|
"iso": string,
|
||||||
|
"epoch": integer, # naive timestamp
|
||||||
|
"epoch_utc": integer, # timezone-aware timestamp. Only available if timezone field is UTC
|
||||||
|
"timezone_aware": boolean # if true, all fields are correctly based on UTC
|
||||||
|
}
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'freebsd'
|
'linux', 'darwin', 'freebsd'
|
||||||
@ -51,7 +75,8 @@ import jc.utils
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '2.0'
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
|
version = '2.1'
|
||||||
description = '`date` command parser'
|
description = '`date` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -64,7 +89,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def _process(proc_data):
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -74,28 +99,7 @@ def process(proc_data):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
Dictionary. Structured data with the following schema:
|
Dictionary. Structured data to conform to the schema.
|
||||||
{
|
|
||||||
"year": integer,
|
|
||||||
"month": string,
|
|
||||||
"month_num": integer,
|
|
||||||
"day": integer,
|
|
||||||
"weekday": string,
|
|
||||||
"weekday_num": integer,
|
|
||||||
"hour": integer,
|
|
||||||
"hour_24": integer,
|
|
||||||
"minute": integer,
|
|
||||||
"second": integer,
|
|
||||||
"period": string,
|
|
||||||
"timezone": string,
|
|
||||||
"utc_offset": string, # null if timezone field is not UTC
|
|
||||||
"day_of_year": integer,
|
|
||||||
"week_of_year": integer,
|
|
||||||
"iso": string,
|
|
||||||
"epoch": integer, # naive timestamp
|
|
||||||
"epoch_utc": integer, # timezone-aware timestamp. Only available if timezone field is UTC
|
|
||||||
"timezone_aware": boolean # if true, all fields are correctly based on UTC
|
|
||||||
}
|
|
||||||
"""
|
"""
|
||||||
# no further processing
|
# no further processing
|
||||||
return proc_data
|
return proc_data
|
||||||
@ -188,4 +192,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if raw:
|
if raw:
|
||||||
return raw_output
|
return raw_output
|
||||||
else:
|
else:
|
||||||
return process(raw_output)
|
return _process(raw_output)
|
||||||
|
@ -13,6 +13,25 @@ Usage (module):
|
|||||||
import jc.parsers.df
|
import jc.parsers.df
|
||||||
result = jc.parsers.df.parse(df_command_output)
|
result = jc.parsers.df.parse(df_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"filesystem": string,
|
||||||
|
"size": string,
|
||||||
|
"1k_blocks": integer,
|
||||||
|
"512_blocks": integer,
|
||||||
|
"used": integer,
|
||||||
|
"available": integer,
|
||||||
|
"capacity_percent": integer,
|
||||||
|
"ifree": integer,
|
||||||
|
"iused": integer,
|
||||||
|
"use_percent": integer,
|
||||||
|
"iused_percent": integer,
|
||||||
|
"mounted_on": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'freebsd'
|
'linux', 'darwin', 'freebsd'
|
||||||
@ -82,7 +101,8 @@ import jc.parsers.universal
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.5'
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
|
version = '1.6'
|
||||||
description = '`df` command parser'
|
description = '`df` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -95,7 +115,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def _process(proc_data):
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -105,24 +125,7 @@ def process(proc_data):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
List of Dictionaries. Structured data to conform to the schema:
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"filesystem": string,
|
|
||||||
"size": string,
|
|
||||||
"1k_blocks": integer,
|
|
||||||
"512_blocks": integer,
|
|
||||||
"used": integer,
|
|
||||||
"available": integer,
|
|
||||||
"capacity_percent": integer,
|
|
||||||
"ifree": integer,
|
|
||||||
"iused": integer,
|
|
||||||
"use_percent": integer,
|
|
||||||
"iused_percent": integer,
|
|
||||||
"mounted_on": string
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
for entry in proc_data:
|
for entry in proc_data:
|
||||||
@ -208,4 +211,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if raw:
|
if raw:
|
||||||
return raw_output
|
return raw_output
|
||||||
else:
|
else:
|
||||||
return process(raw_output)
|
return _process(raw_output)
|
||||||
|
@ -17,6 +17,62 @@ Usage (module):
|
|||||||
import jc.parsers.dig
|
import jc.parsers.dig
|
||||||
result = jc.parsers.dig.parse(dig_command_output)
|
result = jc.parsers.dig.parse(dig_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"id": integer,
|
||||||
|
"opcode": string,
|
||||||
|
"status": string,
|
||||||
|
"flags": [
|
||||||
|
string
|
||||||
|
],
|
||||||
|
"query_num": integer,
|
||||||
|
"answer_num": integer,
|
||||||
|
"authority_num": integer,
|
||||||
|
"additional_num": integer,
|
||||||
|
"axfr": [
|
||||||
|
{
|
||||||
|
"name": string,
|
||||||
|
"class": string,
|
||||||
|
"type": string,
|
||||||
|
"ttl": integer,
|
||||||
|
"data": string
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"question": {
|
||||||
|
"name": string,
|
||||||
|
"class": string,
|
||||||
|
"type": string
|
||||||
|
},
|
||||||
|
"answer": [
|
||||||
|
{
|
||||||
|
"name": string,
|
||||||
|
"class": string,
|
||||||
|
"type": string,
|
||||||
|
"ttl": integer,
|
||||||
|
"data": string
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"authority": [
|
||||||
|
{
|
||||||
|
"name": string,
|
||||||
|
"class": string,
|
||||||
|
"type": string,
|
||||||
|
"ttl": integer,
|
||||||
|
"data": string
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"query_time": integer, # in msec
|
||||||
|
"server": string,
|
||||||
|
"when": string,
|
||||||
|
"when_epoch": integer, # naive timestamp if when field is parsable, else null
|
||||||
|
"when_epoch_utc": integer, # timezone aware timestamp availabe for UTC, else null
|
||||||
|
"rcvd": integer
|
||||||
|
"size": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
||||||
@ -343,7 +399,8 @@ import jc.utils
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.6'
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
|
version = '1.7'
|
||||||
description = '`dig` command parser'
|
description = '`dig` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -356,7 +413,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def _process(proc_data):
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -366,61 +423,7 @@ def process(proc_data):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
List of Dictionaries. Structured data to conform to the schema.
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"id": integer,
|
|
||||||
"opcode": string,
|
|
||||||
"status": string,
|
|
||||||
"flags": [
|
|
||||||
string
|
|
||||||
],
|
|
||||||
"query_num": integer,
|
|
||||||
"answer_num": integer,
|
|
||||||
"authority_num": integer,
|
|
||||||
"additional_num": integer,
|
|
||||||
"axfr": [
|
|
||||||
{
|
|
||||||
"name": string,
|
|
||||||
"class": string,
|
|
||||||
"type": string,
|
|
||||||
"ttl": integer,
|
|
||||||
"data": string
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"question": {
|
|
||||||
"name": string,
|
|
||||||
"class": string,
|
|
||||||
"type": string
|
|
||||||
},
|
|
||||||
"answer": [
|
|
||||||
{
|
|
||||||
"name": string,
|
|
||||||
"class": string,
|
|
||||||
"type": string,
|
|
||||||
"ttl": integer,
|
|
||||||
"data": string
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"authority": [
|
|
||||||
{
|
|
||||||
"name": string,
|
|
||||||
"class": string,
|
|
||||||
"type": string,
|
|
||||||
"ttl": integer,
|
|
||||||
"data": string
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"query_time": integer, # in msec
|
|
||||||
"server": string,
|
|
||||||
"when": string,
|
|
||||||
"when_epoch": integer, # naive timestamp if when field is parsable, else null
|
|
||||||
"when_epoch_utc": integer, # timezone aware timestamp availabe for UTC, else null
|
|
||||||
"rcvd": integer
|
|
||||||
"size": string
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
for entry in proc_data:
|
for entry in proc_data:
|
||||||
@ -472,7 +475,7 @@ def process(proc_data):
|
|||||||
return proc_data
|
return proc_data
|
||||||
|
|
||||||
|
|
||||||
def parse_header(header):
|
def _parse_header(header):
|
||||||
# ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 6140
|
# ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 6140
|
||||||
header = header.split()
|
header = header.split()
|
||||||
opcode = header[3].rstrip(',')
|
opcode = header[3].rstrip(',')
|
||||||
@ -484,7 +487,7 @@ def parse_header(header):
|
|||||||
'status': status}
|
'status': status}
|
||||||
|
|
||||||
|
|
||||||
def parse_flags_line(flagsline):
|
def _parse_flags_line(flagsline):
|
||||||
# ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
|
# ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
|
||||||
flagsline = flagsline.split(';')
|
flagsline = flagsline.split(';')
|
||||||
flags = flagsline.pop(0)
|
flags = flagsline.pop(0)
|
||||||
@ -508,7 +511,7 @@ def parse_flags_line(flagsline):
|
|||||||
'additional_num': additional_num}
|
'additional_num': additional_num}
|
||||||
|
|
||||||
|
|
||||||
def parse_question(question):
|
def _parse_question(question):
|
||||||
# ;www.cnn.com. IN A
|
# ;www.cnn.com. IN A
|
||||||
question = question.split()
|
question = question.split()
|
||||||
dns_name = question[0].lstrip(';')
|
dns_name = question[0].lstrip(';')
|
||||||
@ -520,7 +523,7 @@ def parse_question(question):
|
|||||||
'type': dns_type}
|
'type': dns_type}
|
||||||
|
|
||||||
|
|
||||||
def parse_authority(authority):
|
def _parse_authority(authority):
|
||||||
# cnn.com. 3600 IN NS ns-1086.awsdns-07.org.
|
# cnn.com. 3600 IN NS ns-1086.awsdns-07.org.
|
||||||
authority = authority.split()
|
authority = authority.split()
|
||||||
authority_name = authority[0]
|
authority_name = authority[0]
|
||||||
@ -536,7 +539,7 @@ def parse_authority(authority):
|
|||||||
'data': authority_data}
|
'data': authority_data}
|
||||||
|
|
||||||
|
|
||||||
def parse_answer(answer):
|
def _parse_answer(answer):
|
||||||
# www.cnn.com. 5 IN CNAME turner-tls.map.fastly.net.
|
# www.cnn.com. 5 IN CNAME turner-tls.map.fastly.net.
|
||||||
answer = answer.split(maxsplit=4)
|
answer = answer.split(maxsplit=4)
|
||||||
answer_name = answer[0]
|
answer_name = answer[0]
|
||||||
@ -556,7 +559,7 @@ def parse_answer(answer):
|
|||||||
'data': answer_data}
|
'data': answer_data}
|
||||||
|
|
||||||
|
|
||||||
def parse_axfr(axfr):
|
def _parse_axfr(axfr):
|
||||||
# ; <<>> DiG 9.11.14-3-Debian <<>> @81.4.108.41 axfr zonetransfer.me +nocookie
|
# ; <<>> DiG 9.11.14-3-Debian <<>> @81.4.108.41 axfr zonetransfer.me +nocookie
|
||||||
# ; (1 server found)
|
# ; (1 server found)
|
||||||
# ;; global options: +cmd
|
# ;; global options: +cmd
|
||||||
@ -617,17 +620,17 @@ def parse(data, raw=False, quiet=False):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if ';' not in line and axfr:
|
if ';' not in line and axfr:
|
||||||
axfr_list.append(parse_axfr(line))
|
axfr_list.append(_parse_axfr(line))
|
||||||
output_entry.update({'axfr': axfr_list})
|
output_entry.update({'axfr': axfr_list})
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if line.startswith(';; ->>HEADER<<-'):
|
if line.startswith(';; ->>HEADER<<-'):
|
||||||
output_entry = {}
|
output_entry = {}
|
||||||
output_entry.update(parse_header(line))
|
output_entry.update(_parse_header(line))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if line.startswith(';; flags:'):
|
if line.startswith(';; flags:'):
|
||||||
output_entry.update(parse_flags_line(line))
|
output_entry.update(_parse_flags_line(line))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if line.startswith(';; QUESTION SECTION:'):
|
if line.startswith(';; QUESTION SECTION:'):
|
||||||
@ -638,7 +641,7 @@ def parse(data, raw=False, quiet=False):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if question:
|
if question:
|
||||||
output_entry['question'] = parse_question(line)
|
output_entry['question'] = _parse_question(line)
|
||||||
question = False
|
question = False
|
||||||
authority = False
|
authority = False
|
||||||
answer = False
|
answer = False
|
||||||
@ -654,7 +657,7 @@ def parse(data, raw=False, quiet=False):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if ';' not in line and authority:
|
if ';' not in line and authority:
|
||||||
authority_list.append(parse_authority(line))
|
authority_list.append(_parse_authority(line))
|
||||||
output_entry.update({'authority': authority_list})
|
output_entry.update({'authority': authority_list})
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -667,7 +670,7 @@ def parse(data, raw=False, quiet=False):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if ';' not in line and answer:
|
if ';' not in line and answer:
|
||||||
answer_list.append(parse_answer(line))
|
answer_list.append(_parse_answer(line))
|
||||||
output_entry.update({'answer': answer_list})
|
output_entry.update({'answer': answer_list})
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -704,4 +707,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if raw:
|
if raw:
|
||||||
return raw_output
|
return raw_output
|
||||||
else:
|
else:
|
||||||
return process(raw_output)
|
return _process(raw_output)
|
||||||
|
@ -21,6 +21,20 @@ Usage (module):
|
|||||||
import jc.parsers.dir
|
import jc.parsers.dir
|
||||||
result = jc.parsers.dir.parse(dir_command_output)
|
result = jc.parsers.dir.parse(dir_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"date": string,
|
||||||
|
"time": string,
|
||||||
|
"epoch": integer, # naive timestamp
|
||||||
|
"dir": boolean,
|
||||||
|
"size": integer,
|
||||||
|
"filename: string,
|
||||||
|
"parent": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'win32'
|
'win32'
|
||||||
@ -110,7 +124,8 @@ import jc.utils
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.0'
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
|
version = '1.1'
|
||||||
description = '`dir` command parser'
|
description = '`dir` command parser'
|
||||||
author = 'Rasheed Elsaleh'
|
author = 'Rasheed Elsaleh'
|
||||||
author_email = 'rasheed@rebelliondefense.com'
|
author_email = 'rasheed@rebelliondefense.com'
|
||||||
@ -123,7 +138,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def _process(proc_data):
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -133,19 +148,7 @@ def process(proc_data):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
List of Dictionaries. Structured data to conform to the schema.
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"date": string,
|
|
||||||
"time": string,
|
|
||||||
"epoch": integer, # naive timestamp
|
|
||||||
"dir": boolean,
|
|
||||||
"size": integer,
|
|
||||||
"filename: string,
|
|
||||||
"parent": string
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"""
|
"""
|
||||||
for entry in proc_data:
|
for entry in proc_data:
|
||||||
# add timestamps
|
# add timestamps
|
||||||
@ -216,4 +219,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if raw:
|
if raw:
|
||||||
return raw_output
|
return raw_output
|
||||||
else:
|
else:
|
||||||
return process(raw_output)
|
return _process(raw_output)
|
||||||
|
@ -13,6 +13,23 @@ Usage (module):
|
|||||||
import jc.parsers.dmidecode
|
import jc.parsers.dmidecode
|
||||||
result = jc.parsers.dmidecode.parse(dmidecode_command_output)
|
result = jc.parsers.dmidecode.parse(dmidecode_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"handle": string,
|
||||||
|
"type": integer,
|
||||||
|
"bytes": integer,
|
||||||
|
"description": string,
|
||||||
|
"values": { (null if empty)
|
||||||
|
"lowercase_no_spaces_keys": string,
|
||||||
|
"multiline_key_values": [
|
||||||
|
string,
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux'
|
'linux'
|
||||||
@ -111,7 +128,8 @@ import jc.utils
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.1'
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
|
version = '1.2'
|
||||||
description = '`dmidecode` command parser'
|
description = '`dmidecode` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -125,7 +143,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def _process(proc_data):
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -135,22 +153,7 @@ def process(proc_data):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
List of Dictionaries. Structured data to conform to the schema.
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"handle": string,
|
|
||||||
"type": integer,
|
|
||||||
"bytes": integer,
|
|
||||||
"description": string,
|
|
||||||
"values": { (null if empty)
|
|
||||||
"lowercase_no_spaces_keys": string,
|
|
||||||
"multiline_key_values": [
|
|
||||||
string,
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"""
|
"""
|
||||||
for entry in proc_data:
|
for entry in proc_data:
|
||||||
int_list = ['type', 'bytes']
|
int_list = ['type', 'bytes']
|
||||||
@ -347,4 +350,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if raw:
|
if raw:
|
||||||
return raw_output
|
return raw_output
|
||||||
else:
|
else:
|
||||||
return process(raw_output)
|
return _process(raw_output)
|
||||||
|
@ -17,6 +17,21 @@ Usage (module):
|
|||||||
import jc.parsers.dpkg
|
import jc.parsers.dpkg
|
||||||
result = jc.parsers.dpkg.parse(dpkg_command_output)
|
result = jc.parsers.dpkg.parse(dpkg_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"codes": string,
|
||||||
|
"name": string,
|
||||||
|
"version": string,
|
||||||
|
"architecture": string,
|
||||||
|
"description": string,
|
||||||
|
"desired": string,
|
||||||
|
"status": string,
|
||||||
|
"error": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux'
|
'linux'
|
||||||
@ -119,7 +134,8 @@ import jc.parsers.universal
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.0'
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
|
version = '1.1'
|
||||||
description = '`dpkg -l` command parser'
|
description = '`dpkg -l` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -133,7 +149,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def _process(proc_data):
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -143,20 +159,7 @@ def process(proc_data):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
List of Dictionaries. Structured data to conform to the schema:
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"codes": string,
|
|
||||||
"name": string,
|
|
||||||
"version": string,
|
|
||||||
"architecture": string,
|
|
||||||
"description": string,
|
|
||||||
"desired": string,
|
|
||||||
"status": string,
|
|
||||||
"error": string
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"""
|
"""
|
||||||
for entry in proc_data:
|
for entry in proc_data:
|
||||||
if 'codes' in entry:
|
if 'codes' in entry:
|
||||||
@ -245,4 +248,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if raw:
|
if raw:
|
||||||
return raw_output
|
return raw_output
|
||||||
else:
|
else:
|
||||||
return process(raw_output)
|
return _process(raw_output)
|
||||||
|
@ -13,6 +13,15 @@ Usage (module):
|
|||||||
import jc.parsers.du
|
import jc.parsers.du
|
||||||
result = jc.parsers.du.parse(du_command_output)
|
result = jc.parsers.du.parse(du_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"size": integer,
|
||||||
|
"name": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'aix', 'freebsd'
|
'linux', 'darwin', 'aix', 'freebsd'
|
||||||
@ -82,7 +91,8 @@ import jc.parsers.universal
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.2'
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
|
version = '1.3'
|
||||||
description = '`du` command parser'
|
description = '`du` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -96,7 +106,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def _process(proc_data):
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -106,14 +116,7 @@ def process(proc_data):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
List of Dictionaries. Structured data to conform to the schema.
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"size": integer,
|
|
||||||
"name": string
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"""
|
"""
|
||||||
int_list = ['size']
|
int_list = ['size']
|
||||||
for entry in proc_data:
|
for entry in proc_data:
|
||||||
@ -158,4 +161,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if raw:
|
if raw:
|
||||||
return raw_output
|
return raw_output
|
||||||
else:
|
else:
|
||||||
return process(raw_output)
|
return _process(raw_output)
|
||||||
|
@ -15,6 +15,15 @@ Usage (module):
|
|||||||
import jc.parsers.env
|
import jc.parsers.env
|
||||||
result = jc.parsers.env.parse(env_command_output)
|
result = jc.parsers.env.parse(env_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": string,
|
||||||
|
"value": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
||||||
@ -63,7 +72,8 @@ import jc.utils
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.2'
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
|
version = '1.3'
|
||||||
description = '`env` command parser'
|
description = '`env` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -76,7 +86,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def _process(proc_data):
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -86,14 +96,7 @@ def process(proc_data):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
List of Dictionaries. Structured data to conform to the schema.
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"name": string,
|
|
||||||
"value": string
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# rebuild output for added semantic information
|
# rebuild output for added semantic information
|
||||||
@ -139,4 +142,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if raw:
|
if raw:
|
||||||
return raw_output
|
return raw_output
|
||||||
else:
|
else:
|
||||||
return process(raw_output)
|
return _process(raw_output)
|
||||||
|
@ -13,6 +13,15 @@ Usage (module):
|
|||||||
import jc.parsers.file
|
import jc.parsers.file
|
||||||
result = jc.parsers.file.parse(file_command_output)
|
result = jc.parsers.file.parse(file_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"filename": string,
|
||||||
|
"type ": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'aix', 'freebsd', 'darwin'
|
'linux', 'aix', 'freebsd', 'darwin'
|
||||||
@ -57,7 +66,8 @@ import jc.parsers.universal
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.2'
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
|
version = '1.3'
|
||||||
description = '`file` command parser'
|
description = '`file` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -70,7 +80,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def _process(proc_data):
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -80,14 +90,7 @@ def process(proc_data):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
List of Dictionaries. Structured data to conform to the schema.
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"filename": string,
|
|
||||||
"type ": string
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"""
|
"""
|
||||||
# No further processing
|
# No further processing
|
||||||
return proc_data
|
return proc_data
|
||||||
@ -137,4 +140,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if raw:
|
if raw:
|
||||||
return raw_output
|
return raw_output
|
||||||
else:
|
else:
|
||||||
return process(raw_output)
|
return _process(raw_output)
|
||||||
|
@ -15,6 +15,24 @@ Usage (module):
|
|||||||
import jc.parsers.finger
|
import jc.parsers.finger
|
||||||
result = jc.parsers.finger.parse(finger_command_output)
|
result = jc.parsers.finger.parse(finger_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"login": string,
|
||||||
|
"name": string,
|
||||||
|
"tty": string,
|
||||||
|
"idle": string, # null if empty
|
||||||
|
"login_time": string,
|
||||||
|
"details": string,
|
||||||
|
"tty_writeable": boolean,
|
||||||
|
"idle_minutes": integer,
|
||||||
|
"idle_hours": integer,
|
||||||
|
"idle_days": integer,
|
||||||
|
"total_idle_minutes": integer
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'cygwin', freebsd'
|
'linux', 'darwin', 'cygwin', freebsd'
|
||||||
@ -77,7 +95,8 @@ import jc.parsers.universal
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.0'
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
|
version = '1.1'
|
||||||
description = '`finger` command parser'
|
description = '`finger` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -91,7 +110,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def _process(proc_data):
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -101,23 +120,7 @@ def process(proc_data):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
List of Dictionaries. Structured data to conform to the schema.
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"login": string,
|
|
||||||
"name": string,
|
|
||||||
"tty": string,
|
|
||||||
"idle": string, # null if empty
|
|
||||||
"login_time": string,
|
|
||||||
"details": string,
|
|
||||||
"tty_writeable": boolean,
|
|
||||||
"idle_minutes": integer,
|
|
||||||
"idle_hours": integer,
|
|
||||||
"idle_days": integer,
|
|
||||||
"total_idle_minutes": integer
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"""
|
"""
|
||||||
for entry in proc_data:
|
for entry in proc_data:
|
||||||
if 'tty' in entry:
|
if 'tty' in entry:
|
||||||
@ -212,4 +215,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if raw:
|
if raw:
|
||||||
return raw_output
|
return raw_output
|
||||||
else:
|
else:
|
||||||
return process(raw_output)
|
return _process(raw_output)
|
||||||
|
@ -15,6 +15,16 @@ Usage (module):
|
|||||||
import jc.parsers.foo
|
import jc.parsers.foo
|
||||||
result = jc.parsers.foo.parse(foo_command_output)
|
result = jc.parsers.foo.parse(foo_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"foo": string,
|
||||||
|
"bar": boolean,
|
||||||
|
"baz": integer
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
||||||
@ -31,6 +41,7 @@ import jc.utils
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
version = '1.0'
|
version = '1.0'
|
||||||
description = '`foo` command parser'
|
description = '`foo` command parser'
|
||||||
author = 'John Doe'
|
author = 'John Doe'
|
||||||
@ -45,7 +56,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def _process(proc_data):
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -55,15 +66,7 @@ def process(proc_data):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
List of Dictionaries. Structured to conform to the schema.
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"foo": string,
|
|
||||||
"bar": boolean,
|
|
||||||
"baz": integer
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# rebuild output for added semantic information
|
# rebuild output for added semantic information
|
||||||
@ -98,4 +101,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if raw:
|
if raw:
|
||||||
return raw_output
|
return raw_output
|
||||||
else:
|
else:
|
||||||
return process(raw_output)
|
return _process(raw_output)
|
||||||
|
@ -13,6 +13,20 @@ Usage (module):
|
|||||||
import jc.parsers.free
|
import jc.parsers.free
|
||||||
result = jc.parsers.free.parse(free_command_output)
|
result = jc.parsers.free.parse(free_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": string,
|
||||||
|
"total": integer,
|
||||||
|
"used": integer,
|
||||||
|
"free": integer,
|
||||||
|
"shared": integer,
|
||||||
|
"buff_cache": integer,
|
||||||
|
"available": integer
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux'
|
'linux'
|
||||||
@ -62,7 +76,8 @@ import jc.parsers.universal
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.2'
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
|
version = '1.3'
|
||||||
description = '`free` command parser'
|
description = '`free` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -75,7 +90,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def _process(proc_data):
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -85,19 +100,7 @@ def process(proc_data):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
List of Dictionaries. Structured data to conform to the schema.
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"type": string,
|
|
||||||
"total": integer,
|
|
||||||
"used": integer,
|
|
||||||
"free": integer,
|
|
||||||
"shared": integer,
|
|
||||||
"buff_cache": integer,
|
|
||||||
"available": integer
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
for entry in proc_data:
|
for entry in proc_data:
|
||||||
@ -147,4 +150,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if raw:
|
if raw:
|
||||||
return raw_output
|
return raw_output
|
||||||
else:
|
else:
|
||||||
return process(raw_output)
|
return _process(raw_output)
|
||||||
|
@ -9,6 +9,19 @@ Usage (module):
|
|||||||
import jc.parsers.fstab
|
import jc.parsers.fstab
|
||||||
result = jc.parsers.fstab.parse(fstab_command_output)
|
result = jc.parsers.fstab.parse(fstab_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"fs_spec": string,
|
||||||
|
"fs_file": string,
|
||||||
|
"fs_vfstype": string,
|
||||||
|
"fs_mntops": string,
|
||||||
|
"fs_freq": integer,
|
||||||
|
"fs_passno": integer
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'freebsd'
|
'linux', 'freebsd'
|
||||||
@ -75,7 +88,8 @@ import jc.utils
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.3'
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
|
version = '1.4'
|
||||||
description = '`/etc/fstab` file parser'
|
description = '`/etc/fstab` file parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -87,7 +101,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def _process(proc_data):
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -97,18 +111,7 @@ def process(proc_data):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
List of Dictionaries. Structured data to conform to the schema.
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"fs_spec": string,
|
|
||||||
"fs_file": string,
|
|
||||||
"fs_vfstype": string,
|
|
||||||
"fs_mntops": string,
|
|
||||||
"fs_freq": integer,
|
|
||||||
"fs_passno": integer
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"""
|
"""
|
||||||
for entry in proc_data:
|
for entry in proc_data:
|
||||||
int_list = ['fs_freq', 'fs_passno']
|
int_list = ['fs_freq', 'fs_passno']
|
||||||
@ -174,4 +177,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if raw:
|
if raw:
|
||||||
return raw_output
|
return raw_output
|
||||||
else:
|
else:
|
||||||
return process(raw_output)
|
return _process(raw_output)
|
||||||
|
@ -9,6 +9,19 @@ Usage (module):
|
|||||||
import jc.parsers.group
|
import jc.parsers.group
|
||||||
result = jc.parsers.group.parse(group_file_output)
|
result = jc.parsers.group.parse(group_file_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"group_name": string,
|
||||||
|
"password": string,
|
||||||
|
"gid": integer,
|
||||||
|
"members": [
|
||||||
|
string
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'aix', 'freebsd'
|
'linux', 'darwin', 'aix', 'freebsd'
|
||||||
@ -99,7 +112,8 @@ import jc.utils
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.1'
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
|
version = '1.2'
|
||||||
description = '`/etc/group` file parser'
|
description = '`/etc/group` file parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -112,7 +126,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def _process(proc_data):
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -122,18 +136,7 @@ def process(proc_data):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
List of Dictionaries. Structured data to conform to the schema.
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"group_name": string,
|
|
||||||
"password": string,
|
|
||||||
"gid": integer,
|
|
||||||
"members": [
|
|
||||||
string
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"""
|
"""
|
||||||
for entry in proc_data:
|
for entry in proc_data:
|
||||||
int_list = ['gid']
|
int_list = ['gid']
|
||||||
@ -193,4 +196,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if raw:
|
if raw:
|
||||||
return raw_output
|
return raw_output
|
||||||
else:
|
else:
|
||||||
return process(raw_output)
|
return _process(raw_output)
|
||||||
|
@ -9,6 +9,21 @@ Usage (module):
|
|||||||
import jc.parsers.gshadow
|
import jc.parsers.gshadow
|
||||||
result = jc.parsers.gshadow.parse(gshadow_file_output)
|
result = jc.parsers.gshadow.parse(gshadow_file_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"group_name": string,
|
||||||
|
"password": string,
|
||||||
|
"administrators": [
|
||||||
|
string
|
||||||
|
],
|
||||||
|
"members": [
|
||||||
|
string
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'aix', 'freebsd'
|
'linux', 'aix', 'freebsd'
|
||||||
@ -65,7 +80,8 @@ import jc.utils
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.1'
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
|
version = '1.2'
|
||||||
description = '`/etc/gshadow` file parser'
|
description = '`/etc/gshadow` file parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -78,7 +94,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def _process(proc_data):
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -88,20 +104,7 @@ def process(proc_data):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
List of Dictionaries. Structured data to conform to the schema.
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"group_name": string,
|
|
||||||
"password": string,
|
|
||||||
"administrators": [
|
|
||||||
string
|
|
||||||
],
|
|
||||||
"members": [
|
|
||||||
string
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"""
|
"""
|
||||||
for entry in proc_data:
|
for entry in proc_data:
|
||||||
if entry['administrators'] == ['']:
|
if entry['administrators'] == ['']:
|
||||||
@ -155,4 +158,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if raw:
|
if raw:
|
||||||
return raw_output
|
return raw_output
|
||||||
else:
|
else:
|
||||||
return process(raw_output)
|
return _process(raw_output)
|
||||||
|
@ -9,6 +9,15 @@ Usage (module):
|
|||||||
import jc.parsers.hash
|
import jc.parsers.hash
|
||||||
result = jc.parsers.hash.parse(hash_command_output)
|
result = jc.parsers.hash.parse(hash_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"command": string,
|
||||||
|
"hits": integer
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
||||||
@ -32,7 +41,8 @@ import jc.parsers.universal
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.0'
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
|
version = '1.1'
|
||||||
description = '`hash` command parser'
|
description = '`hash` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -44,7 +54,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def _process(proc_data):
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -54,14 +64,7 @@ def process(proc_data):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
List of Dictionaries. Structured data to conform to the schema.
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"command": string,
|
|
||||||
"hits": integer
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"""
|
"""
|
||||||
for entry in proc_data:
|
for entry in proc_data:
|
||||||
# change to int
|
# change to int
|
||||||
@ -105,4 +108,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if raw:
|
if raw:
|
||||||
return raw_output
|
return raw_output
|
||||||
else:
|
else:
|
||||||
return process(raw_output)
|
return _process(raw_output)
|
||||||
|
@ -23,6 +23,15 @@ Usage (module):
|
|||||||
import jc.parsers.hashsum
|
import jc.parsers.hashsum
|
||||||
result = jc.parsers.hashsum.parse(md5sum_command_output)
|
result = jc.parsers.hashsum.parse(md5sum_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"filename": string,
|
||||||
|
"hash": string,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
||||||
@ -62,7 +71,8 @@ import jc.utils
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.0'
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
|
version = '1.1'
|
||||||
description = 'hashsum command parser (`md5sum`, `shasum`, etc.)'
|
description = 'hashsum command parser (`md5sum`, `shasum`, etc.)'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -76,7 +86,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def _process(proc_data):
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -86,14 +96,7 @@ def process(proc_data):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
List of Dictionaries. Structured data to conform to the schema.
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"filename": string,
|
|
||||||
"hash": string,
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# no further processing for this parser
|
# no further processing for this parser
|
||||||
@ -142,4 +145,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if raw:
|
if raw:
|
||||||
return raw_output
|
return raw_output
|
||||||
else:
|
else:
|
||||||
return process(raw_output)
|
return _process(raw_output)
|
||||||
|
@ -13,6 +13,57 @@ Usage (module):
|
|||||||
import jc.parsers.hciconfig
|
import jc.parsers.hciconfig
|
||||||
result = jc.parsers.hciconfig.parse(hciconfig_command_output)
|
result = jc.parsers.hciconfig.parse(hciconfig_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"device": string,
|
||||||
|
"type": string,
|
||||||
|
"bus": string,
|
||||||
|
"bd_address": string,
|
||||||
|
"acl_mtu": integer,
|
||||||
|
"acl_mtu_packets": integer,
|
||||||
|
"sco_mtu": integer,
|
||||||
|
"sco_mtu_packets": integer,
|
||||||
|
"state": [
|
||||||
|
string
|
||||||
|
],
|
||||||
|
"rx_bytes": integer,
|
||||||
|
"rx_acl": integer,
|
||||||
|
"rx_sco": integer,
|
||||||
|
"rx_events": integer,
|
||||||
|
"rx_errors": integer,
|
||||||
|
"tx_bytes": integer,
|
||||||
|
"tx_acl": integer,
|
||||||
|
"tx_sco": integer,
|
||||||
|
"tx_commands": integer,
|
||||||
|
"tx_errors": integer,
|
||||||
|
"features": [
|
||||||
|
string
|
||||||
|
],
|
||||||
|
"packet_type": [
|
||||||
|
string
|
||||||
|
],
|
||||||
|
"link_policy": [
|
||||||
|
string
|
||||||
|
],
|
||||||
|
"link_mode": [
|
||||||
|
string
|
||||||
|
],
|
||||||
|
"name": string,
|
||||||
|
"class": string,
|
||||||
|
"service_classes": [
|
||||||
|
string # 'Unspecified' is null
|
||||||
|
],
|
||||||
|
"device_class": string,
|
||||||
|
"hci_version": string,
|
||||||
|
"hci_revision": string,
|
||||||
|
"lmp_version": string,
|
||||||
|
"lmp_subversion": string,
|
||||||
|
"manufacturer": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux'
|
'linux'
|
||||||
@ -269,7 +320,8 @@ import jc.utils
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.0'
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
|
version = '1.1'
|
||||||
description = '`hciconfig` command parser'
|
description = '`hciconfig` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -283,7 +335,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def _process(proc_data):
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -293,56 +345,7 @@ def process(proc_data):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
List of Dictionaries. Structured data to conform to the schema.
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"device": string,
|
|
||||||
"type": string,
|
|
||||||
"bus": string,
|
|
||||||
"bd_address": string,
|
|
||||||
"acl_mtu": integer,
|
|
||||||
"acl_mtu_packets": integer,
|
|
||||||
"sco_mtu": integer,
|
|
||||||
"sco_mtu_packets": integer,
|
|
||||||
"state": [
|
|
||||||
string
|
|
||||||
],
|
|
||||||
"rx_bytes": integer,
|
|
||||||
"rx_acl": integer,
|
|
||||||
"rx_sco": integer,
|
|
||||||
"rx_events": integer,
|
|
||||||
"rx_errors": integer,
|
|
||||||
"tx_bytes": integer,
|
|
||||||
"tx_acl": integer,
|
|
||||||
"tx_sco": integer,
|
|
||||||
"tx_commands": integer,
|
|
||||||
"tx_errors": integer,
|
|
||||||
"features": [
|
|
||||||
string
|
|
||||||
],
|
|
||||||
"packet_type": [
|
|
||||||
string
|
|
||||||
],
|
|
||||||
"link_policy": [
|
|
||||||
string
|
|
||||||
],
|
|
||||||
"link_mode": [
|
|
||||||
string
|
|
||||||
],
|
|
||||||
"name": string,
|
|
||||||
"class": string,
|
|
||||||
"service_classes": [
|
|
||||||
string # 'Unspecified' is null
|
|
||||||
],
|
|
||||||
"device_class": string,
|
|
||||||
"hci_version": string,
|
|
||||||
"hci_revision": string,
|
|
||||||
"lmp_version": string,
|
|
||||||
"lmp_subversion": string,
|
|
||||||
"manufacturer": string
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
for entry in proc_data:
|
for entry in proc_data:
|
||||||
@ -526,4 +529,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if raw:
|
if raw:
|
||||||
return raw_output
|
return raw_output
|
||||||
else:
|
else:
|
||||||
return process(raw_output)
|
return _process(raw_output)
|
||||||
|
@ -11,6 +11,15 @@ Usage (module):
|
|||||||
import jc.parsers.history
|
import jc.parsers.history
|
||||||
result = jc.parsers.history.parse(history_command_output)
|
result = jc.parsers.history.parse(history_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"line": integer,
|
||||||
|
"command": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
||||||
@ -51,7 +60,8 @@ import jc.utils
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.3'
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
|
version = '1.4'
|
||||||
description = '`history` command parser'
|
description = '`history` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -64,7 +74,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def _process(proc_data):
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -74,14 +84,7 @@ def process(proc_data):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
List of Dictionaries. Structured data to conform to the schema.
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"line": integer,
|
|
||||||
"command": string
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# rebuild output for added semantic information
|
# rebuild output for added semantic information
|
||||||
@ -132,4 +135,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if raw:
|
if raw:
|
||||||
return raw_output
|
return raw_output
|
||||||
else:
|
else:
|
||||||
return process(raw_output)
|
return _process(raw_output)
|
||||||
|
@ -9,6 +9,17 @@ Usage (module):
|
|||||||
import jc.parsers.hosts
|
import jc.parsers.hosts
|
||||||
result = jc.parsers.hosts.parse(hosts_file_output)
|
result = jc.parsers.hosts.parse(hosts_file_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"ip": string,
|
||||||
|
"hostname": [
|
||||||
|
string
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
||||||
@ -66,7 +77,8 @@ import jc.utils
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.2'
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
|
version = '1.3'
|
||||||
description = '`/etc/hosts` file parser'
|
description = '`/etc/hosts` file parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -78,7 +90,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def _process(proc_data):
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -88,16 +100,7 @@ def process(proc_data):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
List of Dictionaries. Structured data to conform to the schema.
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"ip": string,
|
|
||||||
"hostname": [
|
|
||||||
string
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# no additional processing needed
|
# no additional processing needed
|
||||||
@ -157,4 +160,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if raw:
|
if raw:
|
||||||
return raw_output
|
return raw_output
|
||||||
else:
|
else:
|
||||||
return process(raw_output)
|
return _process(raw_output)
|
||||||
|
@ -13,6 +13,35 @@ Usage (module):
|
|||||||
import jc.parsers.id
|
import jc.parsers.id
|
||||||
result = jc.parsers.id.parse(id_command_output)
|
result = jc.parsers.id.parse(id_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
{
|
||||||
|
"uid": {
|
||||||
|
"id": integer,
|
||||||
|
"name": string
|
||||||
|
},
|
||||||
|
"gid": {
|
||||||
|
"id": integer,
|
||||||
|
"name": string
|
||||||
|
},
|
||||||
|
"groups": [
|
||||||
|
{
|
||||||
|
"id": integer,
|
||||||
|
"name": string
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": integer,
|
||||||
|
"name": string
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"context": {
|
||||||
|
"user": string,
|
||||||
|
"role": string,
|
||||||
|
"type": string,
|
||||||
|
"level": string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin', 'aix', 'freebsd'
|
'linux', 'darwin', 'aix', 'freebsd'
|
||||||
@ -79,7 +108,8 @@ import jc.utils
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.1'
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
|
version = '1.2'
|
||||||
description = '`id` command parser'
|
description = '`id` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -93,7 +123,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def _process(proc_data):
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -103,34 +133,7 @@ def process(proc_data):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
Dictionary. Structured data with the following schema:
|
Dictionary. Structured data to conform to the schema.
|
||||||
|
|
||||||
{
|
|
||||||
"uid": {
|
|
||||||
"id": integer,
|
|
||||||
"name": string
|
|
||||||
},
|
|
||||||
"gid": {
|
|
||||||
"id": integer,
|
|
||||||
"name": string
|
|
||||||
},
|
|
||||||
"groups": [
|
|
||||||
{
|
|
||||||
"id": integer,
|
|
||||||
"name": string
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": integer,
|
|
||||||
"name": string
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"context": {
|
|
||||||
"user": string,
|
|
||||||
"role": string,
|
|
||||||
"type": string,
|
|
||||||
"level": string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"""
|
"""
|
||||||
if 'uid' in proc_data:
|
if 'uid' in proc_data:
|
||||||
if 'id' in proc_data['uid']:
|
if 'id' in proc_data['uid']:
|
||||||
@ -221,4 +224,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if raw:
|
if raw:
|
||||||
return raw_output
|
return raw_output
|
||||||
else:
|
else:
|
||||||
return process(raw_output)
|
return _process(raw_output)
|
||||||
|
@ -15,6 +15,41 @@ Usage (module):
|
|||||||
import jc.parsers.ifconfig
|
import jc.parsers.ifconfig
|
||||||
result = jc.parsers.ifconfig.parse(ifconfig_command_output)
|
result = jc.parsers.ifconfig.parse(ifconfig_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": string,
|
||||||
|
"flags": integer,
|
||||||
|
"state": [
|
||||||
|
string
|
||||||
|
],
|
||||||
|
"mtu": integer,
|
||||||
|
"ipv4_addr": string,
|
||||||
|
"ipv4_mask": string,
|
||||||
|
"ipv4_bcast": string,
|
||||||
|
"ipv6_addr": string,
|
||||||
|
"ipv6_mask": integer,
|
||||||
|
"ipv6_scope": string,
|
||||||
|
"mac_addr": string,
|
||||||
|
"type": string,
|
||||||
|
"rx_packets": integer,
|
||||||
|
"rx_bytes": integer,
|
||||||
|
"rx_errors": integer,
|
||||||
|
"rx_dropped": integer,
|
||||||
|
"rx_overruns": integer,
|
||||||
|
"rx_frame": integer,
|
||||||
|
"tx_packets": integer,
|
||||||
|
"tx_bytes": integer,
|
||||||
|
"tx_errors": integer,
|
||||||
|
"tx_dropped": integer,
|
||||||
|
"tx_overruns": integer,
|
||||||
|
"tx_carrier": integer,
|
||||||
|
"tx_collisions": integer,
|
||||||
|
"metric": integer
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'aix', 'freebsd', 'darwin'
|
'linux', 'aix', 'freebsd', 'darwin'
|
||||||
@ -156,7 +191,8 @@ import jc.utils
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.8'
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
|
version = '1.9'
|
||||||
description = '`ifconfig` command parser'
|
description = '`ifconfig` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -384,7 +420,7 @@ class InterfaceNotFound(Exception):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def _process(proc_data):
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -394,40 +430,7 @@ def process(proc_data):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
List of Dictionaries. Structured data with the following schema:
|
List of Dictionaries. Structured data to conform to the schema.
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"name": string,
|
|
||||||
"flags": integer,
|
|
||||||
"state": [
|
|
||||||
string
|
|
||||||
],
|
|
||||||
"mtu": integer,
|
|
||||||
"ipv4_addr": string,
|
|
||||||
"ipv4_mask": string,
|
|
||||||
"ipv4_bcast": string,
|
|
||||||
"ipv6_addr": string,
|
|
||||||
"ipv6_mask": integer,
|
|
||||||
"ipv6_scope": string,
|
|
||||||
"mac_addr": string,
|
|
||||||
"type": string,
|
|
||||||
"rx_packets": integer,
|
|
||||||
"rx_bytes": integer,
|
|
||||||
"rx_errors": integer,
|
|
||||||
"rx_dropped": integer,
|
|
||||||
"rx_overruns": integer,
|
|
||||||
"rx_frame": integer,
|
|
||||||
"tx_packets": integer,
|
|
||||||
"tx_bytes": integer,
|
|
||||||
"tx_errors": integer,
|
|
||||||
"tx_dropped": integer,
|
|
||||||
"tx_overruns": integer,
|
|
||||||
"tx_carrier": integer,
|
|
||||||
"tx_collisions": integer,
|
|
||||||
"metric": integer
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"""
|
"""
|
||||||
for entry in proc_data:
|
for entry in proc_data:
|
||||||
int_list = ['flags', 'mtu', 'ipv6_mask', 'rx_packets', 'rx_bytes', 'rx_errors', 'rx_dropped', 'rx_overruns',
|
int_list = ['flags', 'mtu', 'ipv6_mask', 'rx_packets', 'rx_bytes', 'rx_errors', 'rx_dropped', 'rx_overruns',
|
||||||
@ -496,4 +499,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if raw:
|
if raw:
|
||||||
return raw_output
|
return raw_output
|
||||||
else:
|
else:
|
||||||
return process(raw_output)
|
return _process(raw_output)
|
||||||
|
BIN
man/jc.1.gz
BIN
man/jc.1.gz
Binary file not shown.
Reference in New Issue
Block a user