1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-12-07 23:35:16 +02:00

doc update

This commit is contained in:
Kelly Brazil
2025-10-12 18:09:31 -07:00
parent d270ddc6ce
commit 1feb000231
16 changed files with 787 additions and 50 deletions

View File

@@ -245,6 +245,8 @@ option.
| `--mpstat-s` | `mpstat` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/mpstat_s) |
| `--needrestart` | `needrestart -b` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/needrestart) |
| `--netstat` | `netstat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/netstat) |
| `--net-localgroup` | `net localgroup` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/net_localgroup) |
| `--net-user` | `net user` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/net_user) |
| `--nmcli` | `nmcli` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/nmcli) |
| `--nsd-control` | `nsd-control` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/nsd_control) |
| `--ntpq` | `ntpq -p` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ntpq) |
@@ -271,6 +273,7 @@ option.
| `--ps` | `ps` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ps) |
| `--resolve-conf` | `/etc/resolve.conf` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/resolve_conf) |
| `--route` | `route` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/route) |
| `--route-print` | `route print` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/route_print) |
| `--rpm-qi` | `rpm -qi` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/rpm_qi) |
| `--rsync` | `rsync` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/rsync) |
| `--rsync-s` | `rsync` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/rsync_s) |
@@ -302,6 +305,7 @@ option.
| `--top-s` | `top -b` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/top_s) |
| `--tracepath` | `tracepath` and `tracepath6` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/tracepath) |
| `--traceroute` | `traceroute` and `traceroute6` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/traceroute) |
| `--traceroute-s` | `traceroute` and `traceroute6` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/traceroute_s) |
| `--tune2fs` | `tune2fs -l` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/tune2fs) |
| `--udevadm` | `udevadm info` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/udevadm) |
| `--ufw` | `ufw status` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ufw) |

View File

@@ -3,8 +3,8 @@ _jc()
local cur prev words cword jc_commands jc_parsers jc_options \
jc_about_options jc_about_mod_options jc_help_options jc_special_options
jc_commands=(acpi airport amixer apt-cache apt-get arp blkid bluetoothctl cbt certbot chage cksum crontab curl date debconf-show df dig dmidecode dpkg du efibootmgr env ethtool file findmnt finger free git gpg hciconfig host id ifconfig iostat ip ipconfig iptables iw iwconfig jobs last lastb ls lsattr lsb_release lsblk lsmod lsof lspci lsusb md5 md5sum mdadm mount mpstat needrestart netstat nmcli nsd-control ntpq os-prober pacman pidstat ping ping6 pip pip3 postconf printenv ps route rpm rsync sfdisk sha1sum sha224sum sha256sum sha384sum sha512sum shasum ss ssh sshd stat sum swapon sysctl systemctl systeminfo timedatectl top tracepath tracepath6 traceroute traceroute6 tune2fs udevadm ufw uname update-alternatives upower uptime vdir veracrypt vmstat w wc wg who xrandr zipinfo zpool)
jc_parsers=(--acpi --airport --airport-s --amixer --apt-cache-show --apt-get-sqq --arp --asciitable --asciitable-m --blkid --bluetoothctl --cbt --cef --cef-s --certbot --chage --cksum --clf --clf-s --crontab --crontab-u --csv --csv-s --curl-head --date --datetime-iso --debconf-show --df --dig --dir --dmidecode --dpkg-l --du --efibootmgr --email-address --env --ethtool --file --find --findmnt --finger --free --fstab --git-log --git-log-s --git-ls-remote --gpg --group --gshadow --hash --hashsum --hciconfig --history --host --hosts --http-headers --id --ifconfig --ini --ini-dup --iostat --iostat-s --ip-address --ipconfig --iptables --ip-route --iw-scan --iwconfig --jar-manifest --jobs --jwt --kv --kv-dup --last --ls --ls-s --lsattr --lsb-release --lsblk --lsmod --lsof --lspci --lsusb --m3u --mdadm --mount --mpstat --mpstat-s --needrestart --netstat --nmcli --nsd-control --ntpq --openvpn --os-prober --os-release --pacman --passwd --path --path-list --pci-ids --pgpass --pidstat --pidstat-s --ping --ping-s --pip-list --pip-show --pkg-index-apk --pkg-index-deb --plist --postconf --proc --proc-buddyinfo --proc-cmdline --proc-consoles --proc-cpuinfo --proc-crypto --proc-devices --proc-diskstats --proc-filesystems --proc-interrupts --proc-iomem --proc-ioports --proc-loadavg --proc-locks --proc-meminfo --proc-modules --proc-mtrr --proc-pagetypeinfo --proc-partitions --proc-slabinfo --proc-softirqs --proc-stat --proc-swaps --proc-uptime --proc-version --proc-vmallocinfo --proc-vmstat --proc-zoneinfo --proc-driver-rtc --proc-net-arp --proc-net-dev --proc-net-dev-mcast --proc-net-if-inet6 --proc-net-igmp --proc-net-igmp6 --proc-net-ipv6-route --proc-net-netlink --proc-net-netstat --proc-net-packet --proc-net-protocols --proc-net-route --proc-net-tcp --proc-net-unix --proc-pid-fdinfo --proc-pid-io --proc-pid-maps --proc-pid-mountinfo --proc-pid-numa-maps --proc-pid-smaps --proc-pid-stat --proc-pid-statm --proc-pid-status --ps --resolve-conf --route --rpm-qi --rsync --rsync-s --semver --sfdisk --shadow --srt --ss --ssh-conf --sshd-conf --stat --stat-s --swapon --sysctl --syslog --syslog-s --syslog-bsd --syslog-bsd-s --systemctl --systemctl-lj --systemctl-ls --systemctl-luf --systeminfo --time --timedatectl --timestamp --toml --top --top-s --tracepath --traceroute --tune2fs --udevadm --ufw --ufw-appinfo --uname --update-alt-gs --update-alt-q --upower --uptime --url --ver --veracrypt --vmstat --vmstat-s --w --wc --wg-show --who --x509-cert --x509-crl --x509-csr --xml --xrandr --yaml --zipinfo --zpool-iostat --zpool-status)
jc_commands=(acpi airport amixer apt-cache apt-get arp blkid bluetoothctl cbt certbot chage cksum crontab curl date debconf-show df dig dmidecode dpkg du efibootmgr env ethtool file findmnt finger free git gpg hciconfig host id ifconfig iostat ip ipconfig iptables iw iwconfig jobs last lastb ls lsattr lsb_release lsblk lsmod lsof lspci lsusb md5 md5sum mdadm mount mpstat needrestart net netstat nmcli nsd-control ntpq os-prober pacman pidstat ping ping6 pip pip3 postconf printenv ps route rpm rsync sfdisk sha1sum sha224sum sha256sum sha384sum sha512sum shasum ss ssh sshd stat sum swapon sysctl systemctl systeminfo timedatectl top tracepath tracepath6 traceroute traceroute6 tune2fs udevadm ufw uname update-alternatives upower uptime vdir veracrypt vmstat w wc wg who xrandr yay zipinfo zpool)
jc_parsers=(--acpi --airport --airport-s --amixer --apt-cache-show --apt-get-sqq --arp --asciitable --asciitable-m --blkid --bluetoothctl --cbt --cef --cef-s --certbot --chage --cksum --clf --clf-s --crontab --crontab-u --csv --csv-s --curl-head --date --datetime-iso --debconf-show --df --dig --dir --dmidecode --dpkg-l --du --efibootmgr --email-address --env --ethtool --file --find --findmnt --finger --free --fstab --git-log --git-log-s --git-ls-remote --gpg --group --gshadow --hash --hashsum --hciconfig --history --host --hosts --http-headers --id --ifconfig --ini --ini-dup --iostat --iostat-s --ip-address --ipconfig --iptables --ip-route --iw-scan --iwconfig --jar-manifest --jobs --jwt --kv --kv-dup --last --ls --ls-s --lsattr --lsb-release --lsblk --lsmod --lsof --lspci --lsusb --m3u --mdadm --mount --mpstat --mpstat-s --needrestart --netstat --net-localgroup --net-user --nmcli --nsd-control --ntpq --openvpn --os-prober --os-release --pacman --passwd --path --path-list --pci-ids --pgpass --pidstat --pidstat-s --ping --ping-s --pip-list --pip-show --pkg-index-apk --pkg-index-deb --plist --postconf --proc --proc-buddyinfo --proc-cmdline --proc-consoles --proc-cpuinfo --proc-crypto --proc-devices --proc-diskstats --proc-filesystems --proc-interrupts --proc-iomem --proc-ioports --proc-loadavg --proc-locks --proc-meminfo --proc-modules --proc-mtrr --proc-pagetypeinfo --proc-partitions --proc-slabinfo --proc-softirqs --proc-stat --proc-swaps --proc-uptime --proc-version --proc-vmallocinfo --proc-vmstat --proc-zoneinfo --proc-driver-rtc --proc-net-arp --proc-net-dev --proc-net-dev-mcast --proc-net-if-inet6 --proc-net-igmp --proc-net-igmp6 --proc-net-ipv6-route --proc-net-netlink --proc-net-netstat --proc-net-packet --proc-net-protocols --proc-net-route --proc-net-tcp --proc-net-unix --proc-pid-fdinfo --proc-pid-io --proc-pid-maps --proc-pid-mountinfo --proc-pid-numa-maps --proc-pid-smaps --proc-pid-stat --proc-pid-statm --proc-pid-status --ps --resolve-conf --route --route-print --rpm-qi --rsync --rsync-s --semver --sfdisk --shadow --srt --ss --ssh-conf --sshd-conf --stat --stat-s --swapon --sysctl --syslog --syslog-s --syslog-bsd --syslog-bsd-s --systemctl --systemctl-lj --systemctl-ls --systemctl-luf --systeminfo --time --timedatectl --timestamp --toml --top --top-s --tracepath --traceroute --traceroute-s --tune2fs --udevadm --ufw --ufw-appinfo --uname --update-alt-gs --update-alt-q --upower --uptime --url --ver --veracrypt --vmstat --vmstat-s --w --wc --wg-show --who --x509-cert --x509-crl --x509-csr --xml --xrandr --yaml --zipinfo --zpool-iostat --zpool-status)
jc_options=(--force-color -C --debug -d --monochrome -m --meta-out -M --pretty -p --quiet -q --raw -r --slurp -s --unbuffer -u --yaml-out -y)
jc_about_options=(--about -a)
jc_about_mod_options=(--pretty -p --yaml-out -y --monochrome -m --force-color -C)

View File

@@ -9,7 +9,7 @@ _jc() {
jc_help_options jc_help_options_describe \
jc_special_options jc_special_options_describe
jc_commands=(acpi airport amixer apt-cache apt-get arp blkid bluetoothctl cbt certbot chage cksum crontab curl date debconf-show df dig dmidecode dpkg du efibootmgr env ethtool file findmnt finger free git gpg hciconfig host id ifconfig iostat ip ipconfig iptables iw iwconfig jobs last lastb ls lsattr lsb_release lsblk lsmod lsof lspci lsusb md5 md5sum mdadm mount mpstat needrestart netstat nmcli nsd-control ntpq os-prober pacman pidstat ping ping6 pip pip3 postconf printenv ps route rpm rsync sfdisk sha1sum sha224sum sha256sum sha384sum sha512sum shasum ss ssh sshd stat sum swapon sysctl systemctl systeminfo timedatectl top tracepath tracepath6 traceroute traceroute6 tune2fs udevadm ufw uname update-alternatives upower uptime vdir veracrypt vmstat w wc wg who xrandr zipinfo zpool)
jc_commands=(acpi airport amixer apt-cache apt-get arp blkid bluetoothctl cbt certbot chage cksum crontab curl date debconf-show df dig dmidecode dpkg du efibootmgr env ethtool file findmnt finger free git gpg hciconfig host id ifconfig iostat ip ipconfig iptables iw iwconfig jobs last lastb ls lsattr lsb_release lsblk lsmod lsof lspci lsusb md5 md5sum mdadm mount mpstat needrestart net netstat nmcli nsd-control ntpq os-prober pacman pidstat ping ping6 pip pip3 postconf printenv ps route rpm rsync sfdisk sha1sum sha224sum sha256sum sha384sum sha512sum shasum ss ssh sshd stat sum swapon sysctl systemctl systeminfo timedatectl top tracepath tracepath6 traceroute traceroute6 tune2fs udevadm ufw uname update-alternatives upower uptime vdir veracrypt vmstat w wc wg who xrandr yay zipinfo zpool)
jc_commands_describe=(
'acpi:run "acpi" command with magic syntax.'
'airport:run "airport" command with magic syntax.'
@@ -68,6 +68,7 @@ _jc() {
'mount:run "mount" command with magic syntax.'
'mpstat:run "mpstat" command with magic syntax.'
'needrestart:run "needrestart" command with magic syntax.'
'net:run "net" command with magic syntax.'
'netstat:run "netstat" command with magic syntax.'
'nmcli:run "nmcli" command with magic syntax.'
'nsd-control:run "nsd-control" command with magic syntax.'
@@ -122,10 +123,11 @@ _jc() {
'wg:run "wg" command with magic syntax.'
'who:run "who" command with magic syntax.'
'xrandr:run "xrandr" command with magic syntax.'
'yay:run "yay" command with magic syntax.'
'zipinfo:run "zipinfo" command with magic syntax.'
'zpool:run "zpool" command with magic syntax.'
)
jc_parsers=(--acpi --airport --airport-s --amixer --apt-cache-show --apt-get-sqq --arp --asciitable --asciitable-m --blkid --bluetoothctl --cbt --cef --cef-s --certbot --chage --cksum --clf --clf-s --crontab --crontab-u --csv --csv-s --curl-head --date --datetime-iso --debconf-show --df --dig --dir --dmidecode --dpkg-l --du --efibootmgr --email-address --env --ethtool --file --find --findmnt --finger --free --fstab --git-log --git-log-s --git-ls-remote --gpg --group --gshadow --hash --hashsum --hciconfig --history --host --hosts --http-headers --id --ifconfig --ini --ini-dup --iostat --iostat-s --ip-address --ipconfig --iptables --ip-route --iw-scan --iwconfig --jar-manifest --jobs --jwt --kv --kv-dup --last --ls --ls-s --lsattr --lsb-release --lsblk --lsmod --lsof --lspci --lsusb --m3u --mdadm --mount --mpstat --mpstat-s --needrestart --netstat --nmcli --nsd-control --ntpq --openvpn --os-prober --os-release --pacman --passwd --path --path-list --pci-ids --pgpass --pidstat --pidstat-s --ping --ping-s --pip-list --pip-show --pkg-index-apk --pkg-index-deb --plist --postconf --proc --proc-buddyinfo --proc-cmdline --proc-consoles --proc-cpuinfo --proc-crypto --proc-devices --proc-diskstats --proc-filesystems --proc-interrupts --proc-iomem --proc-ioports --proc-loadavg --proc-locks --proc-meminfo --proc-modules --proc-mtrr --proc-pagetypeinfo --proc-partitions --proc-slabinfo --proc-softirqs --proc-stat --proc-swaps --proc-uptime --proc-version --proc-vmallocinfo --proc-vmstat --proc-zoneinfo --proc-driver-rtc --proc-net-arp --proc-net-dev --proc-net-dev-mcast --proc-net-if-inet6 --proc-net-igmp --proc-net-igmp6 --proc-net-ipv6-route --proc-net-netlink --proc-net-netstat --proc-net-packet --proc-net-protocols --proc-net-route --proc-net-tcp --proc-net-unix --proc-pid-fdinfo --proc-pid-io --proc-pid-maps --proc-pid-mountinfo --proc-pid-numa-maps --proc-pid-smaps --proc-pid-stat --proc-pid-statm --proc-pid-status --ps --resolve-conf --route --rpm-qi --rsync --rsync-s --semver --sfdisk --shadow --srt --ss --ssh-conf --sshd-conf --stat --stat-s --swapon --sysctl --syslog --syslog-s --syslog-bsd --syslog-bsd-s --systemctl --systemctl-lj --systemctl-ls --systemctl-luf --systeminfo --time --timedatectl --timestamp --toml --top --top-s --tracepath --traceroute --tune2fs --udevadm --ufw --ufw-appinfo --uname --update-alt-gs --update-alt-q --upower --uptime --url --ver --veracrypt --vmstat --vmstat-s --w --wc --wg-show --who --x509-cert --x509-crl --x509-csr --xml --xrandr --yaml --zipinfo --zpool-iostat --zpool-status)
jc_parsers=(--acpi --airport --airport-s --amixer --apt-cache-show --apt-get-sqq --arp --asciitable --asciitable-m --blkid --bluetoothctl --cbt --cef --cef-s --certbot --chage --cksum --clf --clf-s --crontab --crontab-u --csv --csv-s --curl-head --date --datetime-iso --debconf-show --df --dig --dir --dmidecode --dpkg-l --du --efibootmgr --email-address --env --ethtool --file --find --findmnt --finger --free --fstab --git-log --git-log-s --git-ls-remote --gpg --group --gshadow --hash --hashsum --hciconfig --history --host --hosts --http-headers --id --ifconfig --ini --ini-dup --iostat --iostat-s --ip-address --ipconfig --iptables --ip-route --iw-scan --iwconfig --jar-manifest --jobs --jwt --kv --kv-dup --last --ls --ls-s --lsattr --lsb-release --lsblk --lsmod --lsof --lspci --lsusb --m3u --mdadm --mount --mpstat --mpstat-s --needrestart --netstat --net-localgroup --net-user --nmcli --nsd-control --ntpq --openvpn --os-prober --os-release --pacman --passwd --path --path-list --pci-ids --pgpass --pidstat --pidstat-s --ping --ping-s --pip-list --pip-show --pkg-index-apk --pkg-index-deb --plist --postconf --proc --proc-buddyinfo --proc-cmdline --proc-consoles --proc-cpuinfo --proc-crypto --proc-devices --proc-diskstats --proc-filesystems --proc-interrupts --proc-iomem --proc-ioports --proc-loadavg --proc-locks --proc-meminfo --proc-modules --proc-mtrr --proc-pagetypeinfo --proc-partitions --proc-slabinfo --proc-softirqs --proc-stat --proc-swaps --proc-uptime --proc-version --proc-vmallocinfo --proc-vmstat --proc-zoneinfo --proc-driver-rtc --proc-net-arp --proc-net-dev --proc-net-dev-mcast --proc-net-if-inet6 --proc-net-igmp --proc-net-igmp6 --proc-net-ipv6-route --proc-net-netlink --proc-net-netstat --proc-net-packet --proc-net-protocols --proc-net-route --proc-net-tcp --proc-net-unix --proc-pid-fdinfo --proc-pid-io --proc-pid-maps --proc-pid-mountinfo --proc-pid-numa-maps --proc-pid-smaps --proc-pid-stat --proc-pid-statm --proc-pid-status --ps --resolve-conf --route --route-print --rpm-qi --rsync --rsync-s --semver --sfdisk --shadow --srt --ss --ssh-conf --sshd-conf --stat --stat-s --swapon --sysctl --syslog --syslog-s --syslog-bsd --syslog-bsd-s --systemctl --systemctl-lj --systemctl-ls --systemctl-luf --systeminfo --time --timedatectl --timestamp --toml --top --top-s --tracepath --traceroute --traceroute-s --tune2fs --udevadm --ufw --ufw-appinfo --uname --update-alt-gs --update-alt-q --upower --uptime --url --ver --veracrypt --vmstat --vmstat-s --w --wc --wg-show --who --x509-cert --x509-crl --x509-csr --xml --xrandr --yaml --zipinfo --zpool-iostat --zpool-status)
jc_parsers_describe=(
'--acpi:`acpi` command parser'
'--airport:`airport -I` command parser'
@@ -217,6 +219,8 @@ _jc() {
'--mpstat-s:`mpstat` command streaming parser'
'--needrestart:`needrestart -b` command parser'
'--netstat:`netstat` command parser'
'--net-localgroup:`net localgroup` command parser'
'--net-user:`net user` command parser'
'--nmcli:`nmcli` command parser'
'--nsd-control:`nsd-control` command parser'
'--ntpq:`ntpq -p` command parser'
@@ -294,6 +298,7 @@ _jc() {
'--ps:`ps` command parser'
'--resolve-conf:`/etc/resolve.conf` file parser'
'--route:`route` command parser'
'--route-print:`route print` command parser'
'--rpm-qi:`rpm -qi` command parser'
'--rsync:`rsync` command parser'
'--rsync-s:`rsync` command streaming parser'
@@ -325,6 +330,7 @@ _jc() {
'--top-s:`top -b` command streaming parser'
'--tracepath:`tracepath` and `tracepath6` command parser'
'--traceroute:`traceroute` and `traceroute6` command parser'
'--traceroute-s:`traceroute` and `traceroute6` command streaming parser'
'--tune2fs:`tune2fs -l` command parser'
'--udevadm:`udevadm info` command parser'
'--ufw:`ufw status` command parser'

View File

@@ -69,6 +69,7 @@ a controller and a device but there might be fields corresponding to one entity.
"blocked": string,
"connected": string,
"legacy_pairing": string,
"cable_pairing": string,
"rssi": int,
"txpower": int,
"uuids": array,
@@ -136,4 +137,4 @@ Compatibility: linux
Source: [`jc/parsers/bluetoothctl.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/bluetoothctl.py)
Version 1.4 by Jake Ob (iakopap at gmail.com)
Version 1.5 by Jake Ob (iakopap at gmail.com)

View File

@@ -0,0 +1,81 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.net_localgroup"></a>
# jc.parsers.net_localgroup
jc - JSON Convert `net localgroup` command output parser
Usage (cli):
$ net localgroup | jc --net-localgroup
$ net localgroup /domain | jc --net-localgroup
$ net localgroup Administrators | jc --net-localgroup
$ net localgroup Administrators /domain | jc --net-localgroup
Usage (module):
import jc
result = jc.parse('net_localgroup', net_localgroup_command_output)
Schema:
{
"account_origin": string,
"domain": string,
"comment": string,
"groups": [
{
"name": string
"members": [
string
]
}
],
}
Examples:
$ net localgroup | jc --net-localgroup -p
{
"account_origin": null,
"comment": null,
"domain": null,
"groups": [
{
"name": "Administrators",
"members": [
"Administrator",
"Operator",
"ansible",
"user1"
]
}
]
}
<a id="jc.parsers.net_localgroup.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
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:
Parsed dictionary. The raw and processed data structures are the same.
### Parser Information
Compatibility: win32
Source: [`jc/parsers/net_localgroup.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/net_localgroup.py)
Version 1.0 by joehacksalot (joehacksalot@gmail.com)

212
docs/parsers/net_user.md Normal file
View File

@@ -0,0 +1,212 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.net_user"></a>
# jc.parsers.net_user
jc - JSON Convert `net user` command output parser
Usage (cli):
$ net users | jc --net-user
$ net users /domain | jc --net-user
$ net users User1 | jc --net-user
$ net users User1 /domain | jc --net-user
Usage (module):
import jc
result = jc.parse('net_user', net_user_command_output)
Schema:
{
"domain": string,
"account_origin": string,
"user_accounts": [
{
"user_name": string,
"full_name": string,
"comment": string,
"user_comment": string,
"country_region_code": string,
"account_active": boolean,
"account_expires": string,
"password_last_set": string,
"password_expires": string,
"password_changeable": string,
"password_required": boolean,
"user_may_change_password": boolean,
"workstations_allowed": string,
"logon_script": string,
"user_profile": string,
"home_directory": string,
"last_logon": string,
"logon_hours_allowed": string,
"local_group_memberships": [
string,
],
"global_group_memberships": [
string,
]
}
]
}
Examples:
$ net users | jc --net-user -p
{
"account_origin": "\\\\WIN-SERVER16",
"domain": "",
"user_accounts": [
{
"user_name": "Administrator"
},
{
"user_name": "DefaultAccount"
},
{
"user_name": "Guest"
},
{
"user_name": "pentera_BnlLQVnd7p"
},
{
"user_name": "user1"
}
]
}
$ net users /domain | jc --net-user -p
{
"account_origin": "\\\\DESKTOP-WIN10-PRO.somecompany.corp",
"domain": "somecompany.corp",
"user_accounts": [
{
"user_name": "aaron"
},
{
"user_name": "addison"
},
{
"user_name": "Administrator"
},
{
"user_name": "ansible"
},
{
"user_name": "da"
},
{
"user_name": "DefaultAccount"
},
{
"user_name": "Guest"
},
{
"user_name": "harrison"
},
{
"user_name": "james"
},
{
"user_name": "krbtgt"
},
{
"user_name": "liam"
},
{
"user_name": "localadmin"
},
{
"user_name": "tiffany"
}
]
}
$ net users Administrator | jc --net-user -p
{
"domain": "",
"user_accounts": [
{
"account_active": true,
"account_expires": "Never",
"comment": "Built-in account for administering the computer/domain",
"country_region_code": "000 (System Default)",
"global_group_memberships": [],
"last_logon": "2024-08-23T13:47:11",
"local_group_memberships": [
"Administrators"
],
"logon_hours_allowed": "All",
"password_changeable": "2021-12-17T11:07:14",
"password_expires": "2022-01-27T11:07:14",
"password_last_set": "2021-12-16T11:07:14",
"password_required": true,
"user_may_change_password": true,
"user_name": "Administrators",
"workstations_allowed": "All"
}
]
}
$ net users Administrator /domain | jc --net-user -p | jq
{
"domain": "somecompany.corp",
"user_accounts": [
{
"account_active": true,
"account_expires": "Never",
"comment": "Built-in account for administering the computer/domain",
"country_region_code": "000 (System Default)",
"global_group_memberships": [
"Domain Admins",
"Domain Users",
"Group Policy Creator",
"Enterprise Admins",
"Schema Admins"
],
"last_logon": "2024-07-17T13:46:12",
"local_group_memberships": [
"Administrators"
],
"logon_hours_allowed": "All",
"password_changeable": "2023-09-30T11:44:26",
"password_expires": "Never",
"password_last_set": "2023-09-29T11:44:26",
"password_required": true,
"user_may_change_password": true,
"user_name": "Administrators",
"workstations_allowed": "All"
}
]
}
<a id="jc.parsers.net_user.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
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:
Parsed dictionary. The raw and processed data structures are the same.
### Parser Information
Compatibility: win32
Source: [`jc/parsers/net_user.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/net_user.py)
Version 1.0 by joehacksalot (joehacksalot@gmail.com)

View File

@@ -41,7 +41,8 @@ These are documented below.
[
{
"<key>": string/integer/float, # [0]
"team_config": object,
"team_config": object/null,
"team_port_config": object/null,
"dhcp4_option_x": {
"name": string,
"value": string/integer/float,
@@ -171,4 +172,4 @@ Compatibility: linux
Source: [`jc/parsers/nmcli.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/nmcli.py)
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -205,4 +205,4 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Source: [`jc/parsers/pacman.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/pacman.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

204
docs/parsers/route_print.md Normal file
View File

@@ -0,0 +1,204 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.route_print"></a>
# jc.parsers.route_print
jc - JSON Convert `route print` command output parser
See also: the `route` command parser
Usage (cli):
$ route print | jc --route-print
Usage (module):
import jc
result = jc.parse('route_print', route_print_command_output)
Schema:
{
"interface_list": [
{
"interface_index": integer,
"mac_address": string,
"description": string
}
],
"ipv4_route_table": {
"active_routes": [
{
"network_destination": string,
"netmask": string,
"gateway": string,
"interface": string,
"metric": integer, # [0]
"metric_set_to_default": boolean # [1]
}
],
"persistent_routes": [
{
"network_address": string,
"netmask": string,
"gateway_address": string,
"metric": integer # [0]
"metric_set_to_default": boolean # [1]
}
]
},
"ipv6_route_table": {
"active_routes": [
{
"interface": integer,
"metric": integer, # [0]
"metric_set_to_default": boolean, # [1]
"network_destination": string,
"gateway": string
}
],
"persistent_routes": [
{
"interface": integer,
"metric": integer, # [0]
"metric_set_to_default": boolean, # [1]
"network_destination": string,
"gateway": string
}
]
}
}
[0] Null/None if "metric" = "Default"
[1] True if "metric" = "Default"
Examples:
$ route print | jc --route-print -p
{
"interface_list": [
{
"interface_index": 28,
"mac_address": null,
"description": "Tailscale Tunnel"
},
{
"interface_index": 12,
"mac_address": "00:1c:42:da:01:6a",
"description": "Parallels VirtIO Ethernet Adapter"
},
{
"interface_index": 1,
"mac_address": null,
"description": "Software Loopback Interface 1"
}
],
"ipv4_route_table": {
"active_routes": [
{
"network_destination": "0.0.0.0",
"netmask": "0.0.0.0",
"gateway": "10.211.55.1",
"interface": "10.211.55.3",
"metric": 15,
"metric_set_to_default": false
},
{
"network_destination": "10.0.0.0",
"netmask": "255.0.0.0",
"gateway": "192.168.22.1",
"interface": "10.211.55.3",
"metric": 16,
"metric_set_to_default": false
},
...
{
"network_destination": "255.255.255.255",
"netmask": "255.255.255.255",
"gateway": "On-link",
"interface": "10.211.55.3",
"metric": null,
"metric_set_to_default": true
}
],
"persistent_routes": [
{
"network_address": "10.0.1.0",
"netmask": "255.255.255.0",
"gateway_address": "192.168.22.1",
"metric": 1,
"metric_set_to_default": false
},
{
"network_address": "10.0.3.0",
"netmask": "255.255.255.0",
"gateway_address": "192.168.22.1",
"metric": 1,
"metric_set_to_default": false
},
...
]
},
"ipv6_route_table": {
"active_routes": [
{
"interface": 1,
"metric": 331,
"network_destination": "::1/128",
"gateway": "On-link",
"metric_set_to_default": false
},
{
"interface": 12,
"metric": 271,
"network_destination": "2001:db8::/64",
"gateway": "fe80::1",
"metric_set_to_default": false
},
...
{
"interface": 12,
"metric": 271,
"network_destination": "ff00::/8",
"gateway": "On-link",
"metric_set_to_default": false
}
],
"persistent_routes": [
{
"interface": 0,
"metric": 4294967295,
"network_destination": "2001:db8::/64",
"gateway": "fe80::1",
"metric_set_to_default": false
}
]
}
}
<a id="jc.parsers.route_print.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
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:
Parsed dictionary. The raw and processed data structures are the same.
### Parser Information
Compatibility: win32
Source: [`jc/parsers/route_print.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/route_print.py)
Version 1.0 by joehacksalot (joehacksalot@gmail.com)

View File

@@ -50,23 +50,31 @@ All `-` values are converted to `null`
"cpu_hardware": float,
"cpu_software": float,
"cpu_steal": float,
"mem_total": float, # [0]
"mem_free": float, # [0]
"mem_used": float, # [0]
"mem_buff_cache": float, # [0]
"swap_total": float, # [0]
"swap_free": float, # [0]
"swap_used": float, # [0]
"mem_available": float, # [0]
"mem_unit": string,
"mem_total": float,
"mem_free": float,
"mem_used": float,
"mem_buff_cache": float,
"swap_unit": string,
"swap_total": float,
"swap_free": float,
"swap_used": float,
"mem_available": float,
"processes": [
{
"pid": integer,
"user": string,
"priority": integer,
"nice": integer,
"virtual_mem": float, # [1]
"resident_mem": float, # [1]
"shared_mem": float, # [1]
"virtual_mem": float,
"virtual_mem_bytes": integer,
"virtual_mem_unit": string,
"resident_mem": float,
"resident_mem_bytes": integer,
"resident_mem_unit": string,
"shared_mem": float,
"shared_mem_bytes": integer,
"shared_mem_unit": string,
"status": string,
"percent_cpu": float,
"percent_mem": float,
@@ -87,9 +95,15 @@ All `-` values are converted to `null`
"thread_count": integer,
"last_used_processor": integer,
"time": string,
"swap": float, # [1]
"code": float, # [1]
"data": float, # [1]
"swap": float,
"swap_bytes": integer,
"swap_unit": string,
"code": float,
"code_bytes": integer,
"code_unit": string,
"data": float,
"data_bytes": integer,
"data_unit": string,
"major_page_fault_count": integer,
"minor_page_fault_count": integer,
"dirty_pages_count": integer,
@@ -108,7 +122,9 @@ All `-` values are converted to `null`
]
"major_page_fault_count_delta": integer,
"minor_page_fault_count_delta": integer,
"used": float, # [1]
"used": float,
"used_bytes": integer,
"used_unit": string,
"ipc_namespace_inode": integer,
"mount_namespace_inode": integer,
"net_namespace_inode": integer,
@@ -129,9 +145,6 @@ All `-` values are converted to `null`
}
]
[0] Values are in the units output by `top`
[1] Unit suffix stripped during float conversion
Examples:
$ top -b -n 3 | jc --top -p
@@ -338,4 +351,4 @@ Compatibility: linux
Source: [`jc/parsers/top.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/top.py)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -48,23 +48,39 @@ Schema:
"cpu_hardware": float,
"cpu_software": float,
"cpu_steal": float,
"mem_total": float, # [0]
"mem_free": float, # [0]
"mem_used": float, # [0]
"mem_buff_cache": float, # [0]
"swap_total": float, # [0]
"swap_free": float, # [0]
"swap_used": float, # [0]
"mem_available": float, # [0]
"mem_unit": string,
"swap_unit": string,
"mem_total": float,
"mem_total_bytes": integer,
"mem_free": float,
"mem_free_bytes": integer,
"mem_used": float,
"mem_used_bytes": integer,
"mem_buff_cache": float,
"mem_buff_cache_bytes": integer,
"swap_total": float,
"swap_total_bytes": integer,
"swap_free": float,
"swap_free_bytes": integer,
"swap_used": float,
"swap_used_bytes": integer,
"mem_available": float,
"mem_available_bytes": integer,
"processes": [
{
"pid": integer,
"user": string,
"priority": integer,
"nice": integer,
"virtual_mem": float, # [1]
"resident_mem": float, # [1]
"shared_mem": float, # [1]
"virtual_mem": float,
"virtual_mem_unit": string,
"virtual_mem_bytes": integer,
"resident_mem": float,
"resident_mem_unit": string,
"resident_mem_bytes": integer,
"shared_mem": float,
"shared_mem_unit": string,
"shared_mem_bytes": integer,
"status": string,
"percent_cpu": float,
"percent_mem": float,
@@ -85,9 +101,15 @@ Schema:
"thread_count": integer,
"last_used_processor": integer,
"time": string,
"swap": float, # [1]
"code": float, # [1]
"data": float, # [1]
"swap": float,
"swap_unit": string,
"swap_bytes": integer,
"code": float,
"code_unit": string,
"code_bytes": integer
"data": float,
"data_unit": string,
"data_bytes": integer,
"major_page_fault_count": integer,
"minor_page_fault_count": integer,
"dirty_pages_count": integer,
@@ -106,7 +128,9 @@ Schema:
]
"major_page_fault_count_delta": integer,
"minor_page_fault_count_delta": integer,
"used": float, # [1]
"used": float,
"used_unit": string,
"used_bytes": integer,
"ipc_namespace_inode": integer,
"mount_namespace_inode": integer,
"net_namespace_inode": integer,
@@ -133,9 +157,6 @@ Schema:
}
}
[0] Values are in the units output by `top`
[1] Unit suffix stripped during float conversion
Examples:
$ top -b | jc --top-s
@@ -178,4 +199,4 @@ Compatibility: linux
Source: [`jc/parsers/top_s.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/top_s.py)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -32,6 +32,8 @@ Schema:
{
"destination_ip": string,
"destination_name": string,
"max_hops": integer,
"data_bytes": integer,
"hops": [
{
"hop": integer,
@@ -54,6 +56,8 @@ Examples:
{
"destination_ip": "216.58.194.46",
"destination_name": "google.com",
"max_hops": 64,
"data_bytes": 50,
"hops": [
{
"hop": 1,
@@ -89,6 +93,8 @@ Examples:
{
"destination_ip": "216.58.194.46",
"destination_name": "google.com",
"max_hops": "64",
"data_bytes": "50",
"hops": [
{
"hop": "1",
@@ -145,4 +151,4 @@ Compatibility: linux, darwin, freebsd
Source: [`jc/parsers/traceroute.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/traceroute.py)
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -0,0 +1,167 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.traceroute_s"></a>
# jc.parsers.traceroute_s
jc - JSON Convert `traceroute` command output streaming parser
> This streaming parser outputs JSON Lines (cli) or returns an Iterable of
> Dictionaries (module)
Supports `traceroute` and `traceroute6` output.
> Note: On some operating systems you will need to redirect `STDERR` to
> `STDOUT` for destination info since the header line is sent to
> `STDERR`. A warning message will be printed to `STDERR` if the
> header row is not found.
>
> e.g. `$ traceroute 8.8.8.8 2>&1 | jc --traceroute-s`
Usage (cli):
$ traceroute 1.2.3.4 | jc --traceroute-s
Usage (module):
import jc
result = jc.parse('traceroute_s', traceroute_command_output.splitlines())
for item in result:
# do something
Schema:
{
# 'header' or 'hop'
"type": string,
# 'header' type has the fields below:
"destination_ip": string,
"destination_name": string,
"max_hops": integer,
"data_bytes": integer,
# 'hop' type has the fields below:
"hop": integer,
"probes": [
{
"annotation": string,
"asn": integer,
"ip": string,
"name": string,
"rtt": float
}
]
# below object only exists if using -qq or ignore_exceptions=True
"_jc_meta": {
"success": boolean, # false if error parsing
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
}
Examples:
$ traceroute google.com | jc --traceroute-s -p
{
"type": "header",
"destination_ip": "216.58.194.46",
"destination_name": "google.com",
"max_hops": 30,
"data_bytes": 60
}
{
"type": "hop",
"hop": 1,
"probes": [
{
"annotation": null,
"asn": null,
"ip": "216.230.231.141",
"name": "216-230-231-141.static.houston.tx.oplink.net",
"rtt": 198.574
},
{
"annotation": null,
"asn": null,
"ip": "216.230.231.141",
"name": "216-230-231-141.static.houston.tx.oplink.net",
"rtt": null
},
{
"annotation": null,
"asn": null,
"ip": "216.230.231.141",
"name": "216-230-231-141.static.houston.tx.oplink.net",
"rtt": 198.65
}
]
}
...
$ traceroute google.com | jc --traceroute-s -p -r
{
"type": "header",
"destination_ip": "216.58.194.46",
"destination_name": "google.com",
"max_hops": "30",
"data_bytes": "60"
}
{
"type": "hop",
"hop": "1",
"probes": [
{
"annotation": null,
"asn": null,
"ip": "216.230.231.141",
"name": "216-230-231-141.static.houston.tx.oplink.net",
"rtt": "198.574"
},
{
"annotation": null,
"asn": null,
"ip": "216.230.231.141",
"name": "216-230-231-141.static.houston.tx.oplink.net",
"rtt": null
},
{
"annotation": null,
"asn": null,
"ip": "216.230.231.141",
"name": "216-230-231-141.static.houston.tx.oplink.net",
"rtt": "198.650"
}
]
}
...
<a id="jc.parsers.traceroute_s.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
```
Main text parsing function. Returns an iterable object.
Parameters:
data: (iterable) line-based text data to parse
(e.g. sys.stdin or str.splitlines())
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
ignore_exceptions: (boolean) ignore parsing exceptions if True
Returns:
Iterable of Dictionaries
### Parser Information
Compatibility: linux, darwin, freebsd
Source: [`jc/parsers/traceroute_s.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/traceroute_s.py)
Version 1.0 by Shintaro Kojima (goodies@codeout.net)

View File

@@ -30,6 +30,7 @@ Schema:
"user": string,
"event": string,
"writeable_tty": string,
"process": string,
"tty": string,
"time": string,
"epoch": integer, # [0]
@@ -160,4 +161,4 @@ Compatibility: linux, darwin, cygwin, aix, freebsd
Source: [`jc/parsers/who.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/who.py)
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -130,7 +130,7 @@ from jc.exceptions import ParseError
class info():
"""Provides parser metadata (version, author, etc.)"""
version = '1.8'
version = '1.9'
description = '`traceroute` and `traceroute6` command parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'

View File

@@ -1,4 +1,4 @@
.TH jc 1 2025-05-27 1.25.6 "JSON Convert"
.TH jc 1 2025-10-12 1.25.6 "JSON Convert"
.SH NAME
\fBjc\fP \- JSON Convert JSONifies the output of many CLI tools, file-types,
and strings
@@ -487,6 +487,16 @@ M3U and M3U8 file parser
\fB--netstat\fP
`netstat` command parser
.TP
.B
\fB--net-localgroup\fP
`net localgroup` command parser
.TP
.B
\fB--net-user\fP
`net user` command parser
.TP
.B
\fB--nmcli\fP
@@ -872,6 +882,11 @@ PLIST file parser
\fB--route\fP
`route` command parser
.TP
.B
\fB--route-print\fP
`route print` command parser
.TP
.B
\fB--rpm-qi\fP
@@ -1027,6 +1042,11 @@ TOML file parser
\fB--traceroute\fP
`traceroute` and `traceroute6` command parser
.TP
.B
\fB--traceroute-s\fP
`traceroute` and `traceroute6` command streaming parser
.TP
.B
\fB--tune2fs\fP