diff --git a/README.md b/README.md index e397cb46..e8cf0ce6 100644 --- a/README.md +++ b/README.md @@ -251,6 +251,7 @@ option. | ` --sfdisk` | `sfdisk` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/sfdisk) | | ` --shadow` | `/etc/shadow` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/shadow) | | ` --ss` | `ss` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ss) | +| ` --ssh-conf` | ssh config file and `ssh -G` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ssh_conf) | | ` --sshd-conf` | sshd config file and `sshd -T` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/sshd_conf) | | ` --stat` | `stat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/stat) | | ` --stat-s` | `stat` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/stat_s) | diff --git a/completions/jc_bash_completion.sh b/completions/jc_bash_completion.sh index f1060a83..74dcf97a 100644 --- a/completions/jc_bash_completion.sh +++ b/completions/jc_bash_completion.sh @@ -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 arp blkid cbt chage cksum crontab date df dig dmidecode dpkg du env file findmnt finger free git gpg hciconfig id ifconfig iostat iptables iw iwconfig jobs last lastb ls lsblk lsmod lsof lspci lsusb md5 md5sum mdadm mount mpstat netstat nmcli ntpq os-prober pidstat ping ping6 pip pip3 postconf printenv ps route rpm rsync sfdisk sha1sum sha224sum sha256sum sha384sum sha512sum shasum ss sshd stat sum sysctl systemctl systeminfo timedatectl top tracepath tracepath6 traceroute traceroute6 udevadm ufw uname update-alternatives upower uptime vdir vmstat w wc who xrandr zipinfo) - jc_parsers=(--acpi --airport --airport-s --arp --asciitable --asciitable-m --blkid --cbt --cef --cef-s --chage --cksum --clf --clf-s --crontab --crontab-u --csv --csv-s --date --datetime-iso --df --dig --dir --dmidecode --dpkg-l --du --email-address --env --file --findmnt --finger --free --fstab --git-log --git-log-s --git-ls-remote --gpg --group --gshadow --hash --hashsum --hciconfig --history --hosts --id --ifconfig --ini --ini-dup --iostat --iostat-s --ip-address --iptables --iw-scan --iwconfig --jar-manifest --jobs --jwt --kv --last --ls --ls-s --lsblk --lsmod --lsof --lspci --lsusb --m3u --mdadm --mount --mpstat --mpstat-s --netstat --nmcli --ntpq --openvpn --os-prober --passwd --pci-ids --pgpass --pidstat --pidstat-s --ping --ping-s --pip-list --pip-show --plist --postconf --proc --proc-buddyinfo --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-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 --route --rpm-qi --rsync --rsync-s --semver --sfdisk --shadow --ss --sshd-conf --stat --stat-s --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 --udevadm --ufw --ufw-appinfo --uname --update-alt-gs --update-alt-q --upower --uptime --url --vmstat --vmstat-s --w --wc --who --x509-cert --xml --xrandr --yaml --zipinfo) + jc_commands=(acpi airport arp blkid cbt chage cksum crontab date df dig dmidecode dpkg du env file findmnt finger free git gpg hciconfig id ifconfig iostat iptables iw iwconfig jobs last lastb ls lsblk lsmod lsof lspci lsusb md5 md5sum mdadm mount mpstat netstat nmcli ntpq os-prober pidstat ping ping6 pip pip3 postconf printenv ps route rpm rsync sfdisk sha1sum sha224sum sha256sum sha384sum sha512sum shasum ss ssh sshd stat sum sysctl systemctl systeminfo timedatectl top tracepath tracepath6 traceroute traceroute6 udevadm ufw uname update-alternatives upower uptime vdir vmstat w wc who xrandr zipinfo) + jc_parsers=(--acpi --airport --airport-s --arp --asciitable --asciitable-m --blkid --cbt --cef --cef-s --chage --cksum --clf --clf-s --crontab --crontab-u --csv --csv-s --date --datetime-iso --df --dig --dir --dmidecode --dpkg-l --du --email-address --env --file --findmnt --finger --free --fstab --git-log --git-log-s --git-ls-remote --gpg --group --gshadow --hash --hashsum --hciconfig --history --hosts --id --ifconfig --ini --ini-dup --iostat --iostat-s --ip-address --iptables --iw-scan --iwconfig --jar-manifest --jobs --jwt --kv --last --ls --ls-s --lsblk --lsmod --lsof --lspci --lsusb --m3u --mdadm --mount --mpstat --mpstat-s --netstat --nmcli --ntpq --openvpn --os-prober --passwd --pci-ids --pgpass --pidstat --pidstat-s --ping --ping-s --pip-list --pip-show --plist --postconf --proc --proc-buddyinfo --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-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 --route --rpm-qi --rsync --rsync-s --semver --sfdisk --shadow --ss --ssh-conf --sshd-conf --stat --stat-s --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 --udevadm --ufw --ufw-appinfo --uname --update-alt-gs --update-alt-q --upower --uptime --url --vmstat --vmstat-s --w --wc --who --x509-cert --xml --xrandr --yaml --zipinfo) jc_options=(--force-color -C --debug -d --monochrome -m --meta-out -M --pretty -p --quiet -q --raw -r --unbuffer -u --yaml-out -y) jc_about_options=(--about -a) jc_about_mod_options=(--pretty -p --yaml-out -y --monochrome -m --force-color -C) diff --git a/completions/jc_zsh_completion.sh b/completions/jc_zsh_completion.sh index d9d1addc..c718ddd2 100644 --- a/completions/jc_zsh_completion.sh +++ b/completions/jc_zsh_completion.sh @@ -9,7 +9,7 @@ _jc() { jc_help_options jc_help_options_describe \ jc_special_options jc_special_options_describe - jc_commands=(acpi airport arp blkid cbt chage cksum crontab date df dig dmidecode dpkg du env file findmnt finger free git gpg hciconfig id ifconfig iostat iptables iw iwconfig jobs last lastb ls lsblk lsmod lsof lspci lsusb md5 md5sum mdadm mount mpstat netstat nmcli ntpq os-prober pidstat ping ping6 pip pip3 postconf printenv ps route rpm rsync sfdisk sha1sum sha224sum sha256sum sha384sum sha512sum shasum ss sshd stat sum sysctl systemctl systeminfo timedatectl top tracepath tracepath6 traceroute traceroute6 udevadm ufw uname update-alternatives upower uptime vdir vmstat w wc who xrandr zipinfo) + jc_commands=(acpi airport arp blkid cbt chage cksum crontab date df dig dmidecode dpkg du env file findmnt finger free git gpg hciconfig id ifconfig iostat iptables iw iwconfig jobs last lastb ls lsblk lsmod lsof lspci lsusb md5 md5sum mdadm mount mpstat netstat nmcli ntpq os-prober pidstat ping ping6 pip pip3 postconf printenv ps route rpm rsync sfdisk sha1sum sha224sum sha256sum sha384sum sha512sum shasum ss ssh sshd stat sum sysctl systemctl systeminfo timedatectl top tracepath tracepath6 traceroute traceroute6 udevadm ufw uname update-alternatives upower uptime vdir vmstat w wc who xrandr zipinfo) jc_commands_describe=( 'acpi:run "acpi" command with magic syntax.' 'airport:run "airport" command with magic syntax.' @@ -76,6 +76,7 @@ _jc() { 'sha512sum:run "sha512sum" command with magic syntax.' 'shasum:run "shasum" command with magic syntax.' 'ss:run "ss" command with magic syntax.' + 'ssh:run "ssh" command with magic syntax.' 'sshd:run "sshd" command with magic syntax.' 'stat:run "stat" command with magic syntax.' 'sum:run "sum" command with magic syntax.' @@ -102,7 +103,7 @@ _jc() { 'xrandr:run "xrandr" command with magic syntax.' 'zipinfo:run "zipinfo" command with magic syntax.' ) - jc_parsers=(--acpi --airport --airport-s --arp --asciitable --asciitable-m --blkid --cbt --cef --cef-s --chage --cksum --clf --clf-s --crontab --crontab-u --csv --csv-s --date --datetime-iso --df --dig --dir --dmidecode --dpkg-l --du --email-address --env --file --findmnt --finger --free --fstab --git-log --git-log-s --git-ls-remote --gpg --group --gshadow --hash --hashsum --hciconfig --history --hosts --id --ifconfig --ini --ini-dup --iostat --iostat-s --ip-address --iptables --iw-scan --iwconfig --jar-manifest --jobs --jwt --kv --last --ls --ls-s --lsblk --lsmod --lsof --lspci --lsusb --m3u --mdadm --mount --mpstat --mpstat-s --netstat --nmcli --ntpq --openvpn --os-prober --passwd --pci-ids --pgpass --pidstat --pidstat-s --ping --ping-s --pip-list --pip-show --plist --postconf --proc --proc-buddyinfo --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-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 --route --rpm-qi --rsync --rsync-s --semver --sfdisk --shadow --ss --sshd-conf --stat --stat-s --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 --udevadm --ufw --ufw-appinfo --uname --update-alt-gs --update-alt-q --upower --uptime --url --vmstat --vmstat-s --w --wc --who --x509-cert --xml --xrandr --yaml --zipinfo) + jc_parsers=(--acpi --airport --airport-s --arp --asciitable --asciitable-m --blkid --cbt --cef --cef-s --chage --cksum --clf --clf-s --crontab --crontab-u --csv --csv-s --date --datetime-iso --df --dig --dir --dmidecode --dpkg-l --du --email-address --env --file --findmnt --finger --free --fstab --git-log --git-log-s --git-ls-remote --gpg --group --gshadow --hash --hashsum --hciconfig --history --hosts --id --ifconfig --ini --ini-dup --iostat --iostat-s --ip-address --iptables --iw-scan --iwconfig --jar-manifest --jobs --jwt --kv --last --ls --ls-s --lsblk --lsmod --lsof --lspci --lsusb --m3u --mdadm --mount --mpstat --mpstat-s --netstat --nmcli --ntpq --openvpn --os-prober --passwd --pci-ids --pgpass --pidstat --pidstat-s --ping --ping-s --pip-list --pip-show --plist --postconf --proc --proc-buddyinfo --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-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 --route --rpm-qi --rsync --rsync-s --semver --sfdisk --shadow --ss --ssh-conf --sshd-conf --stat --stat-s --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 --udevadm --ufw --ufw-appinfo --uname --update-alt-gs --update-alt-q --upower --uptime --url --vmstat --vmstat-s --w --wc --who --x509-cert --xml --xrandr --yaml --zipinfo) jc_parsers_describe=( '--acpi:`acpi` command parser' '--airport:`airport -I` command parser' @@ -250,6 +251,7 @@ _jc() { '--sfdisk:`sfdisk` command parser' '--shadow:`/etc/shadow` file parser' '--ss:`ss` command parser' + '--ssh-conf:ssh config file and `ssh -G` command parser' '--sshd-conf:sshd config file and `sshd -T` command parser' '--stat:`stat` command parser' '--stat-s:`stat` command streaming parser' diff --git a/docs/lib.md b/docs/lib.md index 7853b606..c1a2b488 100644 --- a/docs/lib.md +++ b/docs/lib.md @@ -26,7 +26,7 @@ def parse( data: Union[str, bytes, Iterable[str]], quiet: bool = False, raw: bool = False, - ignore_exceptions: bool = None, + ignore_exceptions: Optional[bool] = None, **kwargs ) -> Union[JSONDictType, List[JSONDictType], Iterator[JSONDictType]] ``` diff --git a/docs/parsers/acpi.md b/docs/parsers/acpi.md index 096db581..22a79f54 100644 --- a/docs/parsers/acpi.md +++ b/docs/parsers/acpi.md @@ -250,4 +250,4 @@ Returns: ### Parser Information Compatibility: linux -Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com) +Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com) diff --git a/docs/parsers/ssh_conf.md b/docs/parsers/ssh_conf.md new file mode 100644 index 00000000..077db643 --- /dev/null +++ b/docs/parsers/ssh_conf.md @@ -0,0 +1,507 @@ +[Home](https://kellyjonbrazil.github.io/jc/) + + +# jc.parsers.ssh\_conf + +jc - JSON Convert ssh configuration file and `ssh -G` command output parser + +This parser will work with `ssh` configuration files or the output of +`ssh -G`. Any `Match` blocks in the `ssh` configuration file will be +ignored. + +Usage (cli): + + $ ssh -G hostname | jc --ssh-conf + +or + + $ jc ssh -G hostname + +or + + $ cat ~/.ssh/config | jc --ssh-conf + +Usage (module): + + import jc + result = jc.parse('ssh_conf', ssh_conf_output) + +Schema: + + [ + { + "host": string, + "addkeystoagent": string, + "addressfamily": string, + "batchmode": string, + "bindaddress": string, + "bindinterface": string, + "canonicaldomains": [ + string + ], + "canonicalizefallbacklocal": string, + "canonicalizehostname": string, + "canonicalizemaxdots": integer, + "canonicalizepermittedcnames": [ + string + ], + "casignaturealgorithms": [ + string + ], + "certificatefile": [ + string + ], + "checkhostip": string, + "ciphers": [ + string + ], + "clearallforwardings": string, + "compression": string, + "connectionattempts": integer, + "connecttimeout": integer, + "controlmaster": string, + "controlpath": string, + "controlpersist": string, + "dynamicforward": string, + "enableescapecommandline": string, + "enablesshkeysign": string, + "escapechar": string, + "exitonforwardfailure": string, + "fingerprinthash": string, + "forkafterauthentication": string, + "forwardagent": string, + "forwardx11": string, + "forwardx11timeout": integer, + "forwardx11trusted": string, + "gatewayports": string, + "globalknownhostsfile": [ + string + ], + "gssapiauthentication": string, + "gssapidelegatecredentials": string, + "hashknownhosts": string, + "hostbasedacceptedalgorithms": [ + string + ], + "hostbasedauthentication": string, + "hostkeyalgorithms": [ + string + ], + "hostkeyalias": string, + "hostname": string, + "identitiesonly": string, + "identityagent": string, + "identityfile": [ + string + ], + "ignoreunknown": string, + "include": [ + string + ], + "ipqos": [ + string + ], + "kbdinteractiveauthentication": string, + "kbdinteractivedevices": [ + string + ], + "kexalgorithms": [ + string + ], + "kexalgorithms_strategy": string, + "knownhostscommand": string, + "localcommand": string, + "localforward": [ + string + ], + "loglevel": string, + "logverbose": [ + string + ], + "macs": [ + string + ], + "macs_strategy": string, + "nohostauthenticationforlocalhost": string, + "numberofpasswordprompts": integer, + "passwordauthentication": string, + "permitlocalcommand": string, + "permitremoteopen": [ + string + ], + "pkcs11provider": string, + "port": integer, + "preferredauthentications": [ + string + ], + "protocol": integer, + "proxycommand": string, + "proxyjump": [ + string + ], + "proxyusefdpass": string, + "pubkeyacceptedalgorithms": [ + string + ], + "pubkeyacceptedalgorithms_strategy": string, + "pubkeyauthentication": string, + "rekeylimit": string, + "remotecommand": string, + "remoteforward": string, + "requesttty": string, + "requiredrsasize": integer, + "revokedhostkeys": string, + "securitykeyprovider": string, + "sendenv": [ + string + ], + "serveralivecountmax": integer, + "serveraliveinterval": integer, + "sessiontype": string, + "setenv": [ + string + ], + "stdinnull": string, + "streamlocalbindmask": string, + "streamlocalbindunlink": string, + "stricthostkeychecking": string, + "syslogfacility": string, + "tcpkeepalive": string, + "tunnel": string, + "tunneldevice": string, + "updatehostkeys": string, + "user": string, + "userknownhostsfile": [ + string + ], + "verifyhostkeydns": string, + "visualhostkey": string, + "xauthlocation": string + } + ] + +Examples: + + $ ssh -G - | jc --ssh-conf -p + [ + { + "user": "foo", + "hostname": "-", + "port": 22, + "addressfamily": "any", + "batchmode": "no", + "canonicalizefallbacklocal": "yes", + "canonicalizehostname": "false", + "checkhostip": "no", + "compression": "no", + "controlmaster": "false", + "enablesshkeysign": "no", + "clearallforwardings": "no", + "exitonforwardfailure": "no", + "fingerprinthash": "SHA256", + "forwardx11": "no", + "forwardx11trusted": "no", + "gatewayports": "no", + "gssapiauthentication": "no", + "gssapidelegatecredentials": "no", + "hashknownhosts": "no", + "hostbasedauthentication": "no", + "identitiesonly": "no", + "kbdinteractiveauthentication": "yes", + "nohostauthenticationforlocalhost": "no", + "passwordauthentication": "yes", + "permitlocalcommand": "no", + "proxyusefdpass": "no", + "pubkeyauthentication": "true", + "requesttty": "auto", + "sessiontype": "default", + "stdinnull": "no", + "forkafterauthentication": "no", + "streamlocalbindunlink": "no", + "stricthostkeychecking": "ask", + "tcpkeepalive": "yes", + "tunnel": "false", + "verifyhostkeydns": "false", + "visualhostkey": "no", + "updatehostkeys": "true", + "applemultipath": "no", + "canonicalizemaxdots": 1, + "connectionattempts": 1, + "forwardx11timeout": 1200, + "numberofpasswordprompts": 3, + "serveralivecountmax": 3, + "serveraliveinterval": 0, + "ciphers": [ + "chacha20-poly1305@openssh.com", + "aes128-ctr", + "aes192-ctr", + "aes256-ctr", + "aes128-gcm@openssh.com", + "aes256-gcm@openssh.com" + ], + "hostkeyalgorithms": [ + "ssh-ed25519-cert-v01@openssh.com", + "ecdsa-sha2-nistp256-cert-v01@openssh.com", + "ecdsa-sha2-nistp384-cert-v01@openssh.com", + "ecdsa-sha2-nistp521-cert-v01@openssh.com", + "rsa-sha2-512-cert-v01@openssh.com", + "rsa-sha2-256-cert-v01@openssh.com", + "ssh-ed25519", + "ecdsa-sha2-nistp256", + "ecdsa-sha2-nistp384", + "ecdsa-sha2-nistp521", + "rsa-sha2-512", + "rsa-sha2-256" + ], + "hostbasedacceptedalgorithms": [ + "ssh-ed25519-cert-v01@openssh.com", + "ecdsa-sha2-nistp256-cert-v01@openssh.com", + "ecdsa-sha2-nistp384-cert-v01@openssh.com", + "ecdsa-sha2-nistp521-cert-v01@openssh.com", + "rsa-sha2-512-cert-v01@openssh.com", + "rsa-sha2-256-cert-v01@openssh.com", + "ssh-ed25519", + "ecdsa-sha2-nistp256", + "ecdsa-sha2-nistp384", + "ecdsa-sha2-nistp521", + "rsa-sha2-512", + "rsa-sha2-256" + ], + "kexalgorithms": [ + "sntrup761x25519-sha512@openssh.com", + "curve25519-sha256", + "curve25519-sha256@libssh.org", + "ecdh-sha2-nistp256", + "ecdh-sha2-nistp384", + "ecdh-sha2-nistp521", + "diffie-hellman-group-exchange-sha256", + "diffie-hellman-group16-sha512", + "diffie-hellman-group18-sha512", + "diffie-hellman-group14-sha256" + ], + "casignaturealgorithms": [ + "ssh-ed25519", + "ecdsa-sha2-nistp256", + "ecdsa-sha2-nistp384", + "ecdsa-sha2-nistp521", + "rsa-sha2-512", + "rsa-sha2-256" + ], + "loglevel": "INFO", + "macs": [ + "umac-64-etm@openssh.com", + "umac-128-etm@openssh.com", + "hmac-sha2-256-etm@openssh.com", + "hmac-sha2-512-etm@openssh.com", + "hmac-sha1-etm@openssh.com", + "umac-64@openssh.com", + "umac-128@openssh.com", + "hmac-sha2-256", + "hmac-sha2-512", + "hmac-sha1" + ], + "securitykeyprovider": "$SSH_SK_PROVIDER", + "pubkeyacceptedalgorithms": [ + "ssh-ed25519-cert-v01@openssh.com", + "ecdsa-sha2-nistp256-cert-v01@openssh.com", + "ecdsa-sha2-nistp384-cert-v01@openssh.com", + "ecdsa-sha2-nistp521-cert-v01@openssh.com", + "rsa-sha2-512-cert-v01@openssh.com", + "rsa-sha2-256-cert-v01@openssh.com", + "ssh-ed25519", + "ecdsa-sha2-nistp256", + "ecdsa-sha2-nistp384", + "ecdsa-sha2-nistp521", + "rsa-sha2-512", + "rsa-sha2-256" + ], + "xauthlocation": "/usr/X11R6/bin/xauth", + "identityfile": [ + "~/.ssh/id_rsa", + "~/.ssh/id_ecdsa", + "~/.ssh/id_ecdsa_sk", + "~/.ssh/id_ed25519", + "~/.ssh/id_ed25519_sk", + "~/.ssh/id_xmss", + "~/.ssh/id_dsa" + ], + "canonicaldomains": [ + "none" + ], + "globalknownhostsfile": [ + "/etc/ssh/ssh_known_hosts", + "/etc/ssh/ssh_known_hosts2" + ], + "userknownhostsfile": [ + "/Users/foo/.ssh/known_hosts", + "/Users/foo/.ssh/known_hosts2" + ], + "sendenv": [ + "LANG", + "LC_*" + ], + "logverbose": [ + "none" + ], + "permitremoteopen": [ + "any" + ], + "addkeystoagent": "false", + "forwardagent": "no", + "connecttimeout": null, + "tunneldevice": "any:any", + "canonicalizepermittedcnames": [ + "none" + ], + "controlpersist": "no", + "escapechar": "~", + "ipqos": [ + "af21", + "cs1" + ], + "rekeylimit": "0 0", + "streamlocalbindmask": "0177", + "syslogfacility": "USER" + } + ] + + $ cat ~/.ssh/config | jc --ssh-conf -p + [ + { + "host": "server1", + "hostname": "server1.cyberciti.biz", + "user": "nixcraft", + "port": 4242, + "identityfile": [ + "/nfs/shared/users/nixcraft/keys/server1/id_rsa" + ] + }, + { + "host": "nas01", + "hostname": "192.168.1.100", + "user": "root", + "identityfile": [ + "~/.ssh/nas01.key" + ] + }, + { + "host": "aws.apache", + "hostname": "1.2.3.4", + "user": "wwwdata", + "identityfile": [ + "~/.ssh/aws.apache.key" + ] + }, + { + "host": "uk.gw.lan uk.lan", + "hostname": "192.168.0.251", + "user": "nixcraft", + "proxycommand": "ssh nixcraft@gateway.uk.cyberciti.biz nc %h %p 2> /dev/null" + }, + { + "host": "proxyus", + "hostname": "vps1.cyberciti.biz", + "user": "breakfree", + "identityfile": [ + "~/.ssh/vps1.cyberciti.biz.key" + ], + "localforward": [ + "3128 127.0.0.1:3128" + ] + }, + { + "host": "*", + "forwardagent": "no", + "forwardx11": "no", + "forwardx11trusted": "yes", + "user": "nixcraft", + "port": 22, + "protocol": 2, + "serveraliveinterval": 60, + "serveralivecountmax": 30 + } + ] + + $ cat ~/.ssh/config | jc --ssh-conf -p -r + [ + { + "host": "server1", + "hostname": "server1.cyberciti.biz", + "user": "nixcraft", + "port": "4242", + "identityfile": [ + "/nfs/shared/users/nixcraft/keys/server1/id_rsa" + ] + }, + { + "host": "nas01", + "hostname": "192.168.1.100", + "user": "root", + "identityfile": [ + "~/.ssh/nas01.key" + ] + }, + { + "host": "aws.apache", + "hostname": "1.2.3.4", + "user": "wwwdata", + "identityfile": [ + "~/.ssh/aws.apache.key" + ] + }, + { + "host": "uk.gw.lan uk.lan", + "hostname": "192.168.0.251", + "user": "nixcraft", + "proxycommand": "ssh nixcraft@gateway.uk.cyberciti.biz nc %h %p 2> /dev/null" + }, + { + "host": "proxyus", + "hostname": "vps1.cyberciti.biz", + "user": "breakfree", + "identityfile": [ + "~/.ssh/vps1.cyberciti.biz.key" + ], + "localforward": [ + "3128 127.0.0.1:3128" + ] + }, + { + "host": "*", + "forwardagent": "no", + "forwardx11": "no", + "forwardx11trusted": "yes", + "user": "nixcraft", + "port": "22", + "protocol": "2", + "serveraliveinterval": "60", + "serveralivecountmax": "30" + } + ] + + + +### parse + +```python +def parse(data: str, + raw: bool = False, + quiet: bool = False) -> List[JSONDictType] +``` + +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, freebsd + +Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com) diff --git a/docs/parsers/sshd_conf.md b/docs/parsers/sshd_conf.md index 18b88afa..2926b684 100644 --- a/docs/parsers/sshd_conf.md +++ b/docs/parsers/sshd_conf.md @@ -504,4 +504,4 @@ Returns: ### Parser Information Compatibility: linux, darwin, freebsd -Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com) +Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com) diff --git a/man/jc.1 b/man/jc.1 index 2011a01f..af9d0613 100644 --- a/man/jc.1 +++ b/man/jc.1 @@ -1,4 +1,4 @@ -.TH jc 1 2023-01-11 1.22.5 "JSON Convert" +.TH jc 1 2023-01-22 1.23.0 "JSON Convert" .SH NAME \fBjc\fP \- JSON Convert JSONifies the output of many CLI tools, file-types, and strings .SH SYNOPSIS @@ -765,6 +765,11 @@ Semantic Version string parser \fB--ss\fP `ss` command parser +.TP +.B +\fB--ssh-conf\fP +ssh config file and `ssh -G` command parser + .TP .B \fB--sshd-conf\fP