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

146 lines
3.2 KiB
Markdown
Raw Permalink Normal View History

2022-09-06 17:29:56 -07:00
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_crypto"></a>
2024-03-14 22:46:52 -07:00
# jc.parsers.proc_crypto
2022-09-06 17:29:56 -07:00
jc - JSON Convert `/proc/crypto` file parser
Usage (cli):
$ cat /proc/crypto | jc --proc
2022-09-07 12:31:17 -07:00
or
$ jc /proc/crypto
2022-09-06 17:29:56 -07:00
or
$ cat /proc/crypto | jc --proc-crypto
Usage (module):
import jc
result = jc.parse('proc', proc_crypto_file)
or
import jc
result = jc.parse('proc_crypto', proc_crypto_file)
Schema:
"Well-known" keys like `priority` and `refcnt` are converted to integers.
Also, keynames ending in "size" are converted to integers.
If this is not desired, then use the `--raw` (CLI) or `raw=True` (Module)
option.
[
{
"name": string,
"driver": string,
"module": string,
"priority": integer,
"refcnt": integer,
"selftest": string,
"internal": string,
"type": string,
"*size": integer
}
]
Examples:
$ cat /proc/crypto | jc --proc -p
[
{
"name": "ecdh",
"driver": "ecdh-generic",
"module": "ecdh_generic",
"priority": 100,
"refcnt": 1,
"selftest": "passed",
"internal": "no",
"type": "kpp"
},
{
"name": "blake2b-512",
"driver": "blake2b-512-generic",
"module": "blake2b_generic",
"priority": 100,
"refcnt": 1,
"selftest": "passed",
"internal": "no",
"type": "shash",
"blocksize": 128,
"digestsize": 64
},
...
]
2022-09-15 16:57:45 -07:00
$ cat /proc/crypto | jc --proc_crypto -p -r
2022-09-06 17:29:56 -07:00
[
{
"name": "ecdh",
"driver": "ecdh-generic",
"module": "ecdh_generic",
"priority": "100",
"refcnt": "1",
"selftest": "passed",
"internal": "no",
"type": "kpp"
},
{
"name": "blake2b-512",
"driver": "blake2b-512-generic",
"module": "blake2b_generic",
"priority": "100",
"refcnt": "1",
"selftest": "passed",
"internal": "no",
"type": "shash",
"blocksize": "128",
"digestsize": "64"
},
{
"name": "blake2b-384",
"driver": "blake2b-384-generic",
"module": "blake2b_generic",
"priority": "100",
"refcnt": "1",
"selftest": "passed",
"internal": "no",
"type": "shash",
"blocksize": "128",
"digestsize": "48"
},
...
]
<a id="jc.parsers.proc_crypto.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
2023-12-21 14:55:21 -08:00
Source: [`jc/parsers/proc_crypto.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/proc_crypto.py)
2022-09-06 17:29:56 -07:00
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)