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

85 lines
2.1 KiB
Markdown
Raw Normal View History

2022-05-11 16:12:29 -07:00
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.chage"></a>
# jc.parsers.chage
jc - JSON Convert `chage --list` command output parser
Supports `chage -l <username>` or `chage --list <username>`
Usage (cli):
$ chage -l johndoe | jc --chage
2022-08-15 13:51:48 -07:00
or
2022-05-11 16:12:29 -07:00
$ jc chage -l johndoe
Usage (module):
import jc
result = jc.parse('chage', chage_command_output)
Schema:
{
"password_last_changed": string,
"password_expires": string,
"password_inactive": string,
"account_expires": string,
"min_days_between_password_change": integer,
"max_days_between_password_change": integer,
"warning_days_before_password_expires": integer
}
Examples:
2022-05-12 10:47:14 -07:00
$ chage --list joeuser | jc --chage -p
2022-05-11 16:12:29 -07:00
{
"password_last_changed": "never",
"password_expires": "never",
"password_inactive": "never",
"account_expires": "never",
"min_days_between_password_change": 0,
"max_days_between_password_change": 99999,
"warning_days_before_password_expires": 7
}
2022-05-12 10:47:14 -07:00
$ chage --list joeuser | jc --chage -p -r
2022-05-11 16:12:29 -07:00
{
"password_last_changed": "never",
"password_expires": "never",
"password_inactive": "never",
"account_expires": "never",
"min_days_between_password_change": "0",
"max_days_between_password_change": "99999",
"warning_days_before_password_expires": "7"
}
<a id="jc.parsers.chage.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> 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:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux
2023-12-21 14:55:21 -08:00
Source: [`jc/parsers/chage.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/chage.py)
2022-07-16 20:52:19 -07:00
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)