mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-17 00:07:37 +02:00
doc update
This commit is contained in:
@ -249,6 +249,7 @@ option.
|
||||
| ` --wc` | `wc` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/wc) |
|
||||
| ` --who` | `who` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/who) |
|
||||
| ` --xml` | XML file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/xml) |
|
||||
| ` --x509-cert` | X.509 PEM and DER certificate file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/x509_cert) |
|
||||
| ` --xrandr` | `xrandr` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/xrandr) |
|
||||
| ` --yaml` | YAML file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/yaml) |
|
||||
| ` --zipinfo` | `zipinfo` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/zipinfo) |
|
||||
|
62
docs/parsers/x509_cert.md
Normal file
62
docs/parsers/x509_cert.md
Normal file
@ -0,0 +1,62 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.x509_cert"></a>
|
||||
|
||||
# jc.parsers.x509\_cert
|
||||
|
||||
jc - JSON Convert X.509 Certificate format file parser
|
||||
|
||||
This parser will convert DER and PEM encoded X.509 certificates.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cat certificate.pem | jc --x509-cert
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('x509_cert', x509_cert_file_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"x509_cert": string,
|
||||
"bar": boolean,
|
||||
"baz": integer
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ cat certificate.pem | jc --x509-cert -p
|
||||
[]
|
||||
|
||||
$ cat certificate.der | jc --x509-cert -p -r
|
||||
[]
|
||||
|
||||
<a id="jc.parsers.x509_cert.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: Union[str, bytes],
|
||||
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, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
@ -102,20 +102,23 @@ Returns:
|
||||
### has\_data
|
||||
|
||||
```python
|
||||
def has_data(data: str) -> bool
|
||||
def has_data(data: Union[str, bytes]) -> bool
|
||||
```
|
||||
|
||||
Checks if the input contains data. If there are any non-whitespace
|
||||
characters then return `True`, else return `False`.
|
||||
Checks if the string input contains data. If there are any
|
||||
non-whitespace characters then return `True`, else return `False`.
|
||||
|
||||
For bytes, returns True if there is any data.
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) input to check whether it contains data
|
||||
data: (string, bytes) input to check whether it contains data
|
||||
|
||||
Returns:
|
||||
|
||||
Boolean True if input string (data) contains non-whitespace
|
||||
characters, otherwise False
|
||||
characters, otherwise False. For bytes data, returns
|
||||
True if there is any data, otherwise False.
|
||||
|
||||
<a id="jc.utils.convert_to_int"></a>
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
"""jc - JSON Convert X.509 Certificate format file parser
|
||||
|
||||
This parser will convert DER, PEM, and PKCS#12 encoded X.509 certificates.
|
||||
This parser will convert DER and PEM encoded X.509 certificates.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
@ -40,7 +40,7 @@ from jc.parsers.asn1crypto import pem, x509
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.0'
|
||||
description = 'X.509 certificate file parser'
|
||||
description = 'X.509 PEM and DER certificate file parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
details = 'Using the asn1crypto library at https://github.com/wbond/asn1crypto/releases/tag/1.5.1'
|
||||
|
7
man/jc.1
7
man/jc.1
@ -1,4 +1,4 @@
|
||||
.TH jc 1 2022-06-30 1.20.1 "JSON Convert"
|
||||
.TH jc 1 2022-07-05 1.20.1 "JSON Convert"
|
||||
.SH NAME
|
||||
\fBjc\fP \- JSON Convert JSONifies the output of many CLI tools and file-types
|
||||
.SH SYNOPSIS
|
||||
@ -522,6 +522,11 @@ Key/Value file parser
|
||||
\fB--xml\fP
|
||||
XML file parser
|
||||
|
||||
.TP
|
||||
.B
|
||||
\fB--x509-cert\fP
|
||||
X.509 PEM and DER certificate file parser
|
||||
|
||||
.TP
|
||||
.B
|
||||
\fB--xrandr\fP
|
||||
|
Reference in New Issue
Block a user