mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-13 01:20:24 +02:00
2
.github/workflows/pythonapp.yml
vendored
2
.github/workflows/pythonapp.yml
vendored
@ -10,6 +10,7 @@ on:
|
||||
|
||||
jobs:
|
||||
old_python:
|
||||
if: github.event.pull_request.draft == false
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
@ -37,6 +38,7 @@ jobs:
|
||||
python -m unittest discover tests
|
||||
|
||||
latest_python:
|
||||
if: github.event.pull_request.draft == false
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
|
22
CHANGELOG
22
CHANGELOG
@ -1,8 +1,30 @@
|
||||
jc changelog
|
||||
|
||||
20241125 v1.25.4
|
||||
- Add `ipconfig` command parser (`ipconfig` for Windows)
|
||||
- Add `pacman` command parser
|
||||
- Add `wg show` command parser
|
||||
- Enhance `ethtool` parser to support `link_partner_advertised_link_modes`
|
||||
- Enhance `ifconfig` parser to support `utun` interfaces with assigned IPv4 addresses on macOS
|
||||
- Enhance `nsd-control` parser with additional state fields
|
||||
- Enhance `ping-s` streaming parser to support error replies
|
||||
- Fix `bluetoothctl` parser when extra attributes like `manufacturer` and `version` exist
|
||||
- Fix `df` parser to correctly output binary vs. decimal size outputs
|
||||
- Fix `ip-address` parser for Python 3.13 changes to IPv4 mapped IPv6 addresses
|
||||
- Fix `iw-scan` parser to output more fields (still beta quality)
|
||||
- Fix `mount` parser for cases where there are spaces in the filesystem name
|
||||
- Fix `netstat` parser for cases where there are spaces in the program name
|
||||
- Fix `pkg-index-deb`, `apt-cache-show`, and `rpm-qi` parsers to correctly convert contiguous packages with the same name
|
||||
- Fix `traceroute` parser to support extreme IPv6 cases
|
||||
- Fix `uptime` parser for data that contains `user` instead of `users`
|
||||
- Fix `yaml` parser to support values that start with an equal sign
|
||||
- Enhance `jc.utils.convert_size_to_int()` to add `posix_mode` and `decimal_bias` parameters
|
||||
- Enhance cli to coerce any non-JSON-serializable objects to a string
|
||||
|
||||
20240609 v1.25.3
|
||||
- Enhance `bluetoothctl` parser with added `battery_percentage` field
|
||||
- Enhance `git-log` standard and streaming parsers with added `lines_changed` field under `file_stats`
|
||||
- Fix `lspci` parser to handle `physlot` fields with a range value
|
||||
- Fix `pci-ids` parser to correctly handle multiple subdevices
|
||||
- Fix `pip-show` parser to handle multi-line fields with a beginning blank line
|
||||
- Fix `ss` parser to correctly handle the `Recv-Q` field being too close to the `Status` field
|
||||
|
@ -218,6 +218,7 @@ option.
|
||||
| `--iostat` | `iostat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/iostat) |
|
||||
| `--iostat-s` | `iostat` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/iostat_s) |
|
||||
| `--ip-address` | IPv4 and IPv6 Address string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ip_address) |
|
||||
| `--ipconfig` | `ipconfig` Windows command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ipconfig) |
|
||||
| `--iptables` | `iptables` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/iptables) |
|
||||
| `--ip-route` | `ip route` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ip_route) |
|
||||
| `--iw-scan` | `iw dev [device] scan` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/iw_scan) |
|
||||
@ -250,6 +251,7 @@ option.
|
||||
| `--openvpn` | openvpn-status.log file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/openvpn) |
|
||||
| `--os-prober` | `os-prober` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/os_prober) |
|
||||
| `--os-release` | `/etc/os-release` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/os_release) |
|
||||
| `--pacman` | `pacman` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pacman) |
|
||||
| `--passwd` | `/etc/passwd` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/passwd) |
|
||||
| `--path` | POSIX path string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/path) |
|
||||
| `--path-list` | POSIX path list string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/path_list) |
|
||||
@ -316,6 +318,7 @@ option.
|
||||
| `--vmstat-s` | `vmstat` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/vmstat_s) |
|
||||
| `--w` | `w` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/w) |
|
||||
| `--wc` | `wc` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/wc) |
|
||||
| `--wg-show` | `wg show` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/wg_show) |
|
||||
| `--who` | `who` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/who) |
|
||||
| `--x509-cert` | X.509 PEM and DER certificate file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/x509_cert) |
|
||||
| `--x509-csr` | X.509 PEM and DER certificate request file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/x509_csr) |
|
||||
|
@ -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 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 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 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 who xrandr zipinfo zpool)
|
||||
jc_parsers=(--acpi --airport --airport-s --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 --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 --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 --who --x509-cert --x509-csr --xml --xrandr --yaml --zipinfo --zpool-iostat --zpool-status)
|
||||
jc_commands=(acpi airport 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 --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-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)
|
||||
|
@ -9,7 +9,7 @@ _jc() {
|
||||
jc_help_options jc_help_options_describe \
|
||||
jc_special_options jc_special_options_describe
|
||||
|
||||
jc_commands=(acpi airport 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 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 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 who xrandr zipinfo zpool)
|
||||
jc_commands=(acpi airport 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_describe=(
|
||||
'acpi:run "acpi" command with magic syntax.'
|
||||
'airport:run "airport" command with magic syntax.'
|
||||
@ -46,6 +46,7 @@ _jc() {
|
||||
'ifconfig:run "ifconfig" command with magic syntax.'
|
||||
'iostat:run "iostat" command with magic syntax.'
|
||||
'ip:run "ip" command with magic syntax.'
|
||||
'ipconfig:run "ipconfig" command with magic syntax.'
|
||||
'iptables:run "iptables" command with magic syntax.'
|
||||
'iw:run "iw" command with magic syntax.'
|
||||
'iwconfig:run "iwconfig" command with magic syntax.'
|
||||
@ -71,6 +72,7 @@ _jc() {
|
||||
'nsd-control:run "nsd-control" command with magic syntax.'
|
||||
'ntpq:run "ntpq" command with magic syntax.'
|
||||
'os-prober:run "os-prober" command with magic syntax.'
|
||||
'pacman:run "pacman" command with magic syntax.'
|
||||
'pidstat:run "pidstat" command with magic syntax.'
|
||||
'ping:run "ping" command with magic syntax.'
|
||||
'ping6:run "ping6" command with magic syntax.'
|
||||
@ -116,12 +118,13 @@ _jc() {
|
||||
'vmstat:run "vmstat" command with magic syntax.'
|
||||
'w:run "w" command with magic syntax.'
|
||||
'wc:run "wc" command with magic syntax.'
|
||||
'wg:run "wg" command with magic syntax.'
|
||||
'who:run "who" command with magic syntax.'
|
||||
'xrandr:run "xrandr" command with magic syntax.'
|
||||
'zipinfo:run "zipinfo" command with magic syntax.'
|
||||
'zpool:run "zpool" command with magic syntax.'
|
||||
)
|
||||
jc_parsers=(--acpi --airport --airport-s --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 --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 --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 --who --x509-cert --x509-csr --xml --xrandr --yaml --zipinfo --zpool-iostat --zpool-status)
|
||||
jc_parsers=(--acpi --airport --airport-s --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-csr --xml --xrandr --yaml --zipinfo --zpool-iostat --zpool-status)
|
||||
jc_parsers_describe=(
|
||||
'--acpi:`acpi` command parser'
|
||||
'--airport:`airport -I` command parser'
|
||||
@ -185,6 +188,7 @@ _jc() {
|
||||
'--iostat:`iostat` command parser'
|
||||
'--iostat-s:`iostat` command streaming parser'
|
||||
'--ip-address:IPv4 and IPv6 Address string parser'
|
||||
'--ipconfig:`ipconfig` Windows command parser'
|
||||
'--iptables:`iptables` command parser'
|
||||
'--ip-route:`ip route` command parser'
|
||||
'--iw-scan:`iw dev [device] scan` command parser'
|
||||
@ -217,6 +221,7 @@ _jc() {
|
||||
'--openvpn:openvpn-status.log file parser'
|
||||
'--os-prober:`os-prober` command parser'
|
||||
'--os-release:`/etc/os-release` file parser'
|
||||
'--pacman:`pacman` command parser'
|
||||
'--passwd:`/etc/passwd` file parser'
|
||||
'--path:POSIX path string parser'
|
||||
'--path-list:POSIX path list string parser'
|
||||
@ -334,6 +339,7 @@ _jc() {
|
||||
'--vmstat-s:`vmstat` command streaming parser'
|
||||
'--w:`w` command parser'
|
||||
'--wc:`wc` command parser'
|
||||
'--wg-show:`wg show` command parser'
|
||||
'--who:`who` command parser'
|
||||
'--x509-cert:X.509 PEM and DER certificate file parser'
|
||||
'--x509-csr:X.509 PEM and DER certificate request file parser'
|
||||
|
@ -33,6 +33,8 @@ a controller and a device but there might be fields corresponding to one entity.
|
||||
Controller:
|
||||
[
|
||||
{
|
||||
"manufacturer": string,
|
||||
"version": string,
|
||||
"name": string,
|
||||
"is_default": boolean,
|
||||
"is_public": boolean,
|
||||
@ -134,4 +136,4 @@ Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/bluetoothctl.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/bluetoothctl.py)
|
||||
|
||||
Version 1.2 by Jake Ob (iakopap at gmail.com)
|
||||
Version 1.3 by Jake Ob (iakopap at gmail.com)
|
||||
|
@ -124,4 +124,4 @@ Compatibility: linux, darwin, freebsd
|
||||
|
||||
Source: [`jc/parsers/df.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/df.py)
|
||||
|
||||
Version 2.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Version 2.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -194,4 +194,4 @@ Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/ethtool.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ethtool.py)
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -242,4 +242,4 @@ Compatibility: linux, aix, freebsd, darwin
|
||||
|
||||
Source: [`jc/parsers/ifconfig.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ifconfig.py)
|
||||
|
||||
Version 2.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Version 2.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -556,4 +556,4 @@ Source: [`jc/parsers/ip_address.py`](https://github.com/kellyjonbrazil/jc/blob/m
|
||||
|
||||
This parser can be used with the `--slurp` command-line option.
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
461
docs/parsers/ipconfig.md
Normal file
461
docs/parsers/ipconfig.md
Normal file
@ -0,0 +1,461 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ipconfig"></a>
|
||||
|
||||
# jc.parsers.ipconfig
|
||||
|
||||
jc - JSON Convert `ipconfig` Windows command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ ipconfig /all | jc --ipconfig
|
||||
$ ipconfig | jc --ipconfig
|
||||
$ jc ipconfig /all
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('ipconfig', ipconfig_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"host_name": string,
|
||||
"primary_dns_suffix": string,
|
||||
"node_type": string,
|
||||
"ip_routing_enabled": boolean,
|
||||
"wins_proxy_enabled": boolean,
|
||||
"dns_suffix_search_list": [
|
||||
string
|
||||
],
|
||||
"adapters": [
|
||||
{
|
||||
"name_long": string,
|
||||
"name": string,
|
||||
"type": string,
|
||||
"connection_specific_dns_suffix": string,
|
||||
"connection_specific_dns_suffix_search_list": [
|
||||
string
|
||||
]
|
||||
"description": string,
|
||||
"physical_address": string,
|
||||
"dhcp_enabled": boolean,
|
||||
"autoconfiguration_enabled": boolean,
|
||||
"ipv6_addresses": [
|
||||
{
|
||||
"address": string,
|
||||
"status": string,
|
||||
},
|
||||
],
|
||||
"temporary_ipv6_addresses": [
|
||||
{
|
||||
"address": string,
|
||||
"status": string,
|
||||
},
|
||||
],
|
||||
"link_local_ipv6_addresses": [
|
||||
{
|
||||
"address": string,
|
||||
"status": string,
|
||||
"prefix_length": integer,
|
||||
}
|
||||
],
|
||||
"ipv4_addresses": [
|
||||
{
|
||||
"address": string, # [2]
|
||||
"subnet_mask": string,
|
||||
"status": string,
|
||||
"autoconfigured": boolean # [1]
|
||||
}
|
||||
],
|
||||
"default_gateways": [
|
||||
string
|
||||
],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": string,
|
||||
"dhcpv6_client_duid": string,
|
||||
"dns_servers": [
|
||||
string
|
||||
],
|
||||
"primary_wins_server": string,
|
||||
"lease_expires": string,
|
||||
"lease_expires_epoch": integer, # [0]
|
||||
"lease_expires_iso": string,
|
||||
"lease_obtained": string,
|
||||
"lease_obtained_epoch": integer, # [0]
|
||||
"lease_obtained_iso": string,
|
||||
"netbios_over_tcpip": boolean,
|
||||
"media_state": string,
|
||||
"extras": [
|
||||
<string>: string
|
||||
]
|
||||
}
|
||||
],
|
||||
"extras": []
|
||||
}
|
||||
|
||||
Notes:
|
||||
[0] - The epoch calculated timestamp field is naive. (i.e. based on
|
||||
the local time of the system the parser is run on)
|
||||
[1] - 'autoconfigured' under 'ipv4_address' is only providing
|
||||
indication if the ipv4 address was labeled as "Autoconfiguration
|
||||
IPv4 Address" vs "IPv4 Address". It does not infer any
|
||||
information from other fields
|
||||
[2] - Windows XP uses 'IP Address' instead of 'IPv4 Address'. Both
|
||||
values are parsed to the 'ipv4_address' object for consistency
|
||||
|
||||
Examples:
|
||||
|
||||
$ ipconfig /all | jc --ipconfig -p
|
||||
{
|
||||
"host_name": "DESKTOP-WIN11-HOME",
|
||||
"primary_dns_suffix": null,
|
||||
"node_type": "Hybrid",
|
||||
"ip_routing_enabled": false,
|
||||
"wins_proxy_enabled": false,
|
||||
"dns_suffix_search_list": [
|
||||
"localdomain"
|
||||
],
|
||||
"adapters": [
|
||||
{
|
||||
"name_long": "Ethernet adapter Ethernet",
|
||||
"name": "Ethernet",
|
||||
"type": "Ethernet",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "Intel(R) I211 Gigabit Network Connection",
|
||||
"physical_address": "24-4B-FE-AB-43-C3",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": null,
|
||||
"dhcpv6_client_duid": null,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": null,
|
||||
"media_state": "Media disconnected",
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Ethernet adapter Ethernet 2",
|
||||
"name": "Ethernet 2",
|
||||
"type": "Ethernet",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "Realtek PCIe 2.5GbE Family Controller",
|
||||
"physical_address": "24-4B-FE-57-3D-F2",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": null,
|
||||
"dhcpv6_client_duid": null,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": null,
|
||||
"media_state": "Media disconnected",
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Unknown adapter OpenVPN Data Channel Offload for NordVPN",
|
||||
"name": "OpenVPN Data Channel Offload for NordVPN",
|
||||
"type": "Unknown",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "OpenVPN Data Channel Offload",
|
||||
"physical_address": null,
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": null,
|
||||
"dhcpv6_client_duid": null,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": null,
|
||||
"media_state": "Media disconnected",
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Unknown adapter Local Area Connection",
|
||||
"name": "Local Area Connection",
|
||||
"type": "Unknown",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "TAP-NordVPN Windows Adapter V9",
|
||||
"physical_address": "00-FF-4C-F4-5E-49",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": null,
|
||||
"dhcpv6_client_duid": null,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": null,
|
||||
"media_state": "Media disconnected",
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Wireless LAN adapter Local Area Connection* 1",
|
||||
"name": "Local Area Connection* 1",
|
||||
"type": "Wireless LAN",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "Microsoft Wi-Fi Direct Virtual Adapter",
|
||||
"physical_address": "A8-7E-EA-5A-7F-DE",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": null,
|
||||
"dhcpv6_client_duid": null,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": null,
|
||||
"media_state": "Media disconnected",
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Wireless LAN adapter Local Area Connection* 2",
|
||||
"name": "Local Area Connection* 2",
|
||||
"type": "Wireless LAN",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "Microsoft Wi-Fi Direct Virtual Adapter #2",
|
||||
"physical_address": "AA-7E-EA-F3-64-C3",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": null,
|
||||
"dhcpv6_client_duid": null,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": null,
|
||||
"media_state": "Media disconnected",
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Ethernet adapter VMware Network Adapter VMnet1",
|
||||
"name": "VMware Network Adapter VMnet1",
|
||||
"type": "Ethernet",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "VMware Virtual Ethernet Adapter for VMnet1",
|
||||
"physical_address": "00-50-56-CC-27-73",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [
|
||||
{
|
||||
"address": "fe80::f47d:9c7f:69dc:591e",
|
||||
"prefix_length": 8,
|
||||
"status": "Preferred"
|
||||
}
|
||||
],
|
||||
"ipv4_addresses": [
|
||||
{
|
||||
"address": "192.168.181.1",
|
||||
"subnet_mask": "255.255.255.0",
|
||||
"status": "Preferred",
|
||||
"autoconfigured": false
|
||||
}
|
||||
],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": "192.168.181.254",
|
||||
"dhcpv6_iaid": "771772502",
|
||||
"dhcpv6_client_duid": "00-01-00-01-2C-CF-19-EB-24-4B-FE-5B-9B-E6",
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": "2024-09-19T18:01:29",
|
||||
"lease_obtained": "2024-09-19T08:31:29",
|
||||
"netbios_over_tcpip": true,
|
||||
"media_state": null,
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Ethernet adapter VMware Network Adapter VMnet8",
|
||||
"name": "VMware Network Adapter VMnet8",
|
||||
"type": "Ethernet",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "VMware Virtual Ethernet Adapter for VMnet8",
|
||||
"physical_address": "00-50-56-C9-A3-78",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [
|
||||
{
|
||||
"address": "fe80::4551:bf0d:59dd:a4f0",
|
||||
"prefix_length": 10,
|
||||
"status": "Preferred"
|
||||
}
|
||||
],
|
||||
"ipv4_addresses": [
|
||||
{
|
||||
"address": "192.168.213.1",
|
||||
"subnet_mask": "255.255.255.0",
|
||||
"status": "Preferred",
|
||||
"autoconfigured": false
|
||||
}
|
||||
],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": "192.168.213.254",
|
||||
"dhcpv6_iaid": "788549718",
|
||||
"dhcpv6_client_duid": "00-01-00-01-2C-CF-19-EB-24-4B-FE-5B-9B-E6",
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": "192.168.213.2",
|
||||
"lease_expires": "2024-09-19T18:01:29",
|
||||
"lease_obtained": "2024-09-19T08:31:29",
|
||||
"netbios_over_tcpip": true,
|
||||
"media_state": null,
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Wireless LAN adapter Wi-Fi",
|
||||
"name": "Wi-Fi",
|
||||
"type": "Wireless LAN",
|
||||
"connection_specific_dns_suffix": "localdomain",
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "Intel(R) Wi-Fi 6 AX200 160MHz",
|
||||
"physical_address": "A8-7E-EA-55-26-B0",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [
|
||||
{
|
||||
"address": "fd63:cc9c:65eb:3f95:57c2:aa:10d8:db08",
|
||||
"status": "Preferred"
|
||||
}
|
||||
],
|
||||
"temporary_ipv6_addresses": [
|
||||
{
|
||||
"address": "fd63:cc9c:65eb:3f95:8928:348e:d692:b7ef",
|
||||
"status": "Preferred"
|
||||
}
|
||||
],
|
||||
"link_local_ipv6_addresses": [
|
||||
{
|
||||
"address": "fe80::4fae:1380:5a1b:8b6b",
|
||||
"prefix_length": 11,
|
||||
"status": "Preferred"
|
||||
}
|
||||
],
|
||||
"ipv4_addresses": [
|
||||
{
|
||||
"address": "192.168.1.169",
|
||||
"subnet_mask": "255.255.255.0",
|
||||
"status": "Preferred",
|
||||
"autoconfigured": false
|
||||
}
|
||||
],
|
||||
"default_gateways": [
|
||||
"192.168.1.1"
|
||||
],
|
||||
"dhcp_server": "192.168.1.1",
|
||||
"dhcpv6_iaid": "162037482",
|
||||
"dhcpv6_client_duid": "00-01-00-01-2C-CF-19-EB-24-4B-FE-5B-9B-E6",
|
||||
"dns_servers": [
|
||||
"192.168.1.1"
|
||||
],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": "2024-09-20T08:31:30",
|
||||
"lease_obtained": "2024-09-19T08:31:30",
|
||||
"netbios_over_tcpip": true,
|
||||
"media_state": null,
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Ethernet adapter Bluetooth Network Connection",
|
||||
"name": "Bluetooth Network Connection",
|
||||
"type": "Ethernet",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "Bluetooth Device (Personal Area Network)",
|
||||
"physical_address": "A8-7E-EA-43-23-14",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": null,
|
||||
"dhcpv6_client_duid": null,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": null,
|
||||
"media_state": "Media disconnected",
|
||||
"extras": []
|
||||
}
|
||||
],
|
||||
"extras": []
|
||||
}
|
||||
|
||||
<a id="jc.parsers.ipconfig.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: windows
|
||||
|
||||
Source: [`jc/parsers/ipconfig.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ipconfig.py)
|
||||
|
||||
Version 1.0 by joehacksalot (joehacksalot@gmail.com)
|
@ -146,4 +146,4 @@ Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/iw_scan.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/iw_scan.py)
|
||||
|
||||
Version 0.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Version 0.75 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -100,4 +100,4 @@ Compatibility: linux, darwin, freebsd, aix
|
||||
|
||||
Source: [`jc/parsers/mount.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/mount.py)
|
||||
|
||||
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Version 1.10 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -380,4 +380,4 @@ Compatibility: linux, darwin, freebsd, win32
|
||||
|
||||
Source: [`jc/parsers/netstat.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/netstat.py)
|
||||
|
||||
Version 1.15 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Version 1.16 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -22,20 +22,24 @@ Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"version": string,
|
||||
"verbosity": integer,
|
||||
"ratelimit": integer
|
||||
"version": string,
|
||||
"verbosity": integer,
|
||||
"ratelimit": integer
|
||||
}
|
||||
]
|
||||
|
||||
[
|
||||
{
|
||||
"zone": string
|
||||
"zone": string
|
||||
"status": {
|
||||
"state": string,
|
||||
"served-serial": string,
|
||||
"commit-serial": string,
|
||||
"wait": string
|
||||
"state": string,
|
||||
"pattern": string, # Additional
|
||||
"catalog-member-id": string, # Additional
|
||||
"served-serial": string,
|
||||
"commit-serial": string,
|
||||
"notified-serial": string, # Conditional
|
||||
"wait": string,
|
||||
"transfer": string # Conditional
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -89,4 +93,4 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/nsd_control.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/nsd_control.py)
|
||||
|
||||
Version 1.1 by Pettai (pettai@sunet.se)
|
||||
Version 1.2 by Pettai (pettai@sunet.se)
|
||||
|
208
docs/parsers/pacman.md
Normal file
208
docs/parsers/pacman.md
Normal file
@ -0,0 +1,208 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.pacman"></a>
|
||||
|
||||
# jc.parsers.pacman
|
||||
|
||||
jc - JSON Convert `pacman` command output parser
|
||||
|
||||
Supports the following `pacman` arguments:
|
||||
|
||||
- `-Si`
|
||||
- `-Sii`
|
||||
- `-Qi`
|
||||
- `-Qii`
|
||||
|
||||
The `*_epoch` calculated timestamp fields are naive. (i.e. based on the
|
||||
local time of the system the parser is run on)
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ pacman -Si <package> | jc --pacman
|
||||
|
||||
or
|
||||
|
||||
$ jc pacman -Si <package>
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('pacman', pacman_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"repository": string,
|
||||
"name": string,
|
||||
"version": string,
|
||||
"description": string,
|
||||
"architecture": string,
|
||||
"url": string,
|
||||
"licenses": [
|
||||
string
|
||||
],
|
||||
"groups": [
|
||||
string
|
||||
],
|
||||
"provides": [
|
||||
string
|
||||
],
|
||||
"depends_on": [
|
||||
string
|
||||
],
|
||||
"optional_deps": [
|
||||
{
|
||||
"name": string,
|
||||
"description": string
|
||||
}
|
||||
],
|
||||
"optional_for": [
|
||||
string
|
||||
],
|
||||
"conflicts_with": [
|
||||
string
|
||||
],
|
||||
"replaces": [
|
||||
string
|
||||
],
|
||||
"download_size": string,
|
||||
"download_size_bytes": integer [0]
|
||||
"installed_size": string,
|
||||
"installed_size_bytes": integer, [0]
|
||||
"packager": string,
|
||||
"build_date": string,
|
||||
"build_date_epoch": integer, [0]
|
||||
"install_date": string,
|
||||
"install_date_epoch": integer, [0]
|
||||
"validated_by": [
|
||||
string
|
||||
],
|
||||
"backup_files": [
|
||||
string
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
[0] Field exists if conversion successful
|
||||
|
||||
Examples:
|
||||
|
||||
$ pacman -qii zstd | jc --pacman -p
|
||||
[
|
||||
{
|
||||
"name": "zstd",
|
||||
"version": "1.5.6-1",
|
||||
"description": "Zstandard - Fast real-time compression algorithm",
|
||||
"architecture": "x86_64",
|
||||
"url": "https://facebook.github.io/zstd/",
|
||||
"licenses": [
|
||||
"BSD-3-Clause",
|
||||
"GPL-2.0-only"
|
||||
],
|
||||
"groups": [],
|
||||
"provides": [
|
||||
"libzstd.so=1-64"
|
||||
],
|
||||
"depends_on": [
|
||||
"glibc",
|
||||
"gcc-libs",
|
||||
"zlib",
|
||||
"xz",
|
||||
"lz4"
|
||||
],
|
||||
"required_by": [
|
||||
"android-tools",
|
||||
"appstream",
|
||||
...
|
||||
"tiled",
|
||||
"vulkan-radeon",
|
||||
"wireshark-cli"
|
||||
],
|
||||
"optional_for": [
|
||||
"xarchiver"
|
||||
],
|
||||
"conflicts_with": [],
|
||||
"replaces": [],
|
||||
"installed_size": "1527.00 KiB",
|
||||
"installed_size_bytes": 1563648,
|
||||
"packager": "Levente Polyak <anthraxx@archlinux.org>",
|
||||
"build_date": "Sat 11 May 2024 06:14:19 AM +08",
|
||||
"build_date_epoch": 1715433259,
|
||||
"install_date": "Fri 24 May 2024 09:50:31 AM +08",
|
||||
"install_date_epoch": 1715663342,
|
||||
"install_reason": "Installed as a dependency for another package",
|
||||
"install_script": "No",
|
||||
"validated_by": [
|
||||
"Signature"
|
||||
],
|
||||
"extended_data": "pkgtype=pkg"
|
||||
}
|
||||
]
|
||||
|
||||
$ pacman -qii zstd | jc --pacman -p -r
|
||||
[
|
||||
{
|
||||
"name": "zstd",
|
||||
"version": "1.5.6-1",
|
||||
"description": "Zstandard - Fast real-time compression algorithm",
|
||||
"architecture": "x86_64",
|
||||
"url": "https://facebook.github.io/zstd/",
|
||||
"licenses": "BSD-3-Clause GPL-2.0-only",
|
||||
"groups": null,
|
||||
"provides": "libzstd.so=1-64",
|
||||
"depends_on": "glibc gcc-libs zlib xz lz4",
|
||||
"required_by": [
|
||||
"android-tools appstream avr-gcc binutils blender blosc",
|
||||
"boost-libs btrfs-progs cloudflare-warp-bin comgr curl",
|
||||
"dolphin-emu file flatpak gcc gdal gnutls karchive",
|
||||
"karchive5 kmod lib32-zstd libarchive libelf libtiff",
|
||||
"libva-mesa-driver libxmlb libzip lld llvm-libs mariadb-libs",
|
||||
"mesa mesa-vdpau minizip-ng mkinitcpio mold netcdf",
|
||||
"opencl-clover-mesa opencl-rusticl-mesa openucx postgresql",
|
||||
"postgresql-libs ppsspp qemu-img qemu-system-riscv",
|
||||
"qemu-system-x86 qgis qt6-base qt6-tools rsync rustup",
|
||||
"squashfs-tools squashfuse systemd-libs tiled vulkan-radeon",
|
||||
"wireshark-cli"
|
||||
],
|
||||
"optional_for": "xarchiver",
|
||||
"conflicts_with": null,
|
||||
"replaces": null,
|
||||
"installed_size": "1527.00 KiB",
|
||||
"packager": "Levente Polyak <anthraxx@archlinux.org>",
|
||||
"build_date": "Sat 11 May 2024 06:14:19 AM +08",
|
||||
"install_date": "Fri 24 May 2024 09:50:31 AM +08",
|
||||
"install_reason": "Installed as a dependency for another package",
|
||||
"install_script": "No",
|
||||
"validated_by": "Signature",
|
||||
"extended_data": "pkgtype=pkg"
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.pacman.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str,
|
||||
raw: bool = False,
|
||||
quiet: bool = False) -> List[Dict[str, Any]]
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
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)
|
@ -109,4 +109,4 @@ Compatibility: linux, darwin, freebsd
|
||||
|
||||
Source: [`jc/parsers/ping_s.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ping_s.py)
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -31,7 +31,7 @@ or
|
||||
|
||||
or
|
||||
|
||||
$ cat /proc/meminfo | jc --proc-memifno
|
||||
$ cat /proc/meminfo | jc --proc-meminfo
|
||||
|
||||
Usage (module):
|
||||
|
||||
|
@ -210,4 +210,4 @@ Compatibility: linux
|
||||
|
||||
Source: [`jc/parsers/rpm_qi.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/rpm_qi.py)
|
||||
|
||||
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -145,4 +145,4 @@ Compatibility: linux, darwin, freebsd
|
||||
|
||||
Source: [`jc/parsers/traceroute.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/traceroute.py)
|
||||
|
||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -92,4 +92,4 @@ Source: [`jc/parsers/uptime.py`](https://github.com/kellyjonbrazil/jc/blob/maste
|
||||
|
||||
This parser can be used with the `--slurp` command-line option.
|
||||
|
||||
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Version 1.10 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
172
docs/parsers/wg_show.md
Normal file
172
docs/parsers/wg_show.md
Normal file
@ -0,0 +1,172 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.wg_show"></a>
|
||||
|
||||
# jc.parsers.wg_show
|
||||
|
||||
jc - JSON Convert `wg show` command output parser
|
||||
|
||||
Parses the output of the `wg show all dump` command, providing structured JSON output for easy integration and analysis.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ wg show all dump | jc --wg-show
|
||||
|
||||
or
|
||||
|
||||
$ jc wg show all dump
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('wg-show', wg_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"device": string,
|
||||
"private_key": string,
|
||||
"public_key": string,
|
||||
"listen_port": integer,
|
||||
"fwmark": integer,
|
||||
"peers": [
|
||||
{
|
||||
"public_key": string,
|
||||
"preshared_key": string,
|
||||
"endpoint": string,
|
||||
"latest_handshake": integer,
|
||||
"transfer_rx": integer,
|
||||
"transfer_sx": integer,
|
||||
"persistent_keepalive": integer,
|
||||
"allowed_ips": [
|
||||
string
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ wg show all dump | jc --wg-show -p
|
||||
[
|
||||
{
|
||||
"device": "wg0",
|
||||
"private_key": "aEbVdvHSEp3oofHDNVCsUoaRSxk1Og8/pTLof5yF+1M=",
|
||||
"public_key": "OIxbQszw1chdO5uigAxpsl4fc/h04yMYafl72gUbakM=",
|
||||
"listen_port": 51820,
|
||||
"fwmark": null,
|
||||
"peers": [
|
||||
{
|
||||
"public_key": "sQFGAhSdx0aC7DmTFojzBOW8Ccjv1XV5+N9FnkZu5zc=",
|
||||
"preshared_key": null,
|
||||
"endpoint": "79.134.136.199:40036",
|
||||
"latest_handshake": 1728809756,
|
||||
"transfer_rx": 1378724,
|
||||
"transfer_sx": 406524,
|
||||
"persistent_keepalive": null,
|
||||
"allowed_ips": ["10.10.0.2/32"]
|
||||
},
|
||||
{
|
||||
"public_key": "B9csmpvrv4Q7gpjc6zAbNNO8hIOYfpBqxmik2aNpwwE=",
|
||||
"preshared_key": null,
|
||||
"endpoint": "79.134.136.199:35946",
|
||||
"latest_handshake": 1728809756,
|
||||
"transfer_rx": 4884248,
|
||||
"transfer_sx": 3544596,
|
||||
"persistent_keepalive": null,
|
||||
"allowed_ips": ["10.10.0.3/32"]
|
||||
},
|
||||
{
|
||||
"public_key": "miiSYR5UdevREhlWpmnci+vv/dEGLHbNtKu7u1CuOD4=",
|
||||
"preshared_key": null,
|
||||
"allowed_ips": ["10.10.0.4/32"]
|
||||
},
|
||||
{
|
||||
"public_key": "gx9+JHLHJvOfBNjTmZ8KQAnThFFiZMQrX1kRaYcIYzw=",
|
||||
"preshared_key": null,
|
||||
"endpoint": "173.244.225.194:45014",
|
||||
"latest_handshake": 1728809827,
|
||||
"transfer_rx": 1363652,
|
||||
"transfer_sx": 458252,
|
||||
"persistent_keepalive": null,
|
||||
"allowed_ips": ["10.10.0.5/32"]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
$ wg show all dump | jc --wg-show -p -r
|
||||
[
|
||||
{
|
||||
"device": "wg0",
|
||||
"private_key": "aEbVdvHSEp3oofHDNVCsUoaRSxk1Og8/pTLof5yF+1M=",
|
||||
"public_key": "OIxbQszw1chdO5uigAxpsl4fc/h04yMYafl72gUbakM=",
|
||||
"listen_port": 51820,
|
||||
"fwmark": null,
|
||||
"peers": {
|
||||
"sQFGAhSdx0aC7DmTFojzBOW8Ccjv1XV5+N9FnkZu5zc=": {
|
||||
"preshared_key": null,
|
||||
"endpoint": "79.134.136.199:40036",
|
||||
"latest_handshake": 1728809756,
|
||||
"transfer_rx": 1378724,
|
||||
"transfer_sx": 406524,
|
||||
"persistent_keepalive": -1,
|
||||
"allowed_ips": ["10.10.0.2/32"]
|
||||
},
|
||||
"B9csmpvrv4Q7gpjc6zAbNNO8hIOYfpBqxmik2aNpwwE=": {
|
||||
"preshared_key": null,
|
||||
"endpoint": "79.134.136.199:35946",
|
||||
"latest_handshake": 1728809756,
|
||||
"transfer_rx": 4884248,
|
||||
"transfer_sx": 3544596,
|
||||
"persistent_keepalive": -1,
|
||||
"allowed_ips": ["10.10.0.3/32"]
|
||||
},
|
||||
"miiSYR5UdevREhlWpmnci+vv/dEGLHbNtKu7u1CuOD4=": {
|
||||
"preshared_key": null,
|
||||
"allowed_ips": ["10.10.0.4/32"]
|
||||
},
|
||||
"gx9+JHLHJvOfBNjTmZ8KQAnThFFiZMQrX1kRaYcIYzw=": {
|
||||
"preshared_key": null,
|
||||
"endpoint": "173.244.225.194:45014",
|
||||
"latest_handshake": 1728809827,
|
||||
"transfer_rx": 1363652,
|
||||
"transfer_sx": 458252,
|
||||
"persistent_keepalive": -1,
|
||||
"allowed_ips": ["10.10.0.5/32"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.wg_show.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str,
|
||||
raw: bool = False,
|
||||
quiet: bool = False) -> List[Dict[str, Any]]
|
||||
```
|
||||
|
||||
Main text parsing function.
|
||||
|
||||
Parses the output of the `wg` command, specifically `wg show all dump`, into structured JSON format.
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (str) Text data to parse, typically the output from `wg show all dump`
|
||||
raw: (bool) If True, returns unprocessed output
|
||||
quiet: (bool) Suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List[Dict]: Parsed data in JSON-friendly format, either raw or processed.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/wg_show.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/wg_show.py)
|
||||
|
||||
Version 1.0 by Hamza Saht (hamzasaht01@gmail.com)
|
@ -111,4 +111,4 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/yaml.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/yaml.py)
|
||||
|
||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -55,7 +55,10 @@ Returns:
|
||||
### convert_size_to_int
|
||||
|
||||
```python
|
||||
def convert_size_to_int(size: str, binary: bool = False) -> Optional[int]
|
||||
def convert_size_to_int(size: str,
|
||||
binary: bool = False,
|
||||
posix_mode: bool = False,
|
||||
decimal_bias: bool = False) -> Optional[int]
|
||||
```
|
||||
|
||||
Parse a human readable data size and return the number of bytes.
|
||||
@ -66,6 +69,12 @@ Parameters:
|
||||
binary: (boolean) `True` to use binary multiples of bytes
|
||||
(base-2) for ambiguous unit symbols and names,
|
||||
`False` to use decimal multiples of bytes (base-10).
|
||||
posix_mode: (boolean) Treat one-letter units (k, m, g, etc.) as
|
||||
binary.
|
||||
decimal_bias: (boolean) `True` to treat slightly ambiguous two-
|
||||
letter unit symbols ending in "i" (e.g. Ki, Gi) to
|
||||
use decimal multiples of bytes (base-10). `False`
|
||||
(default) to use binary multiples of bytes.
|
||||
Returns:
|
||||
|
||||
integer/None Integer if successful conversion, otherwise None
|
||||
@ -85,6 +94,10 @@ gigabytes, terabytes and petabytes. Some examples:
|
||||
1000
|
||||
>>> convert_size_to_int('1 KiB')
|
||||
1024
|
||||
>>> convert_size_to_int('1 Ki')
|
||||
1024
|
||||
>>> convert_size_to_int('1 Ki', decimal_bias=True)
|
||||
1000
|
||||
>>> convert_size_to_int('1 KB', binary=True)
|
||||
1024
|
||||
>>> convert_size_to_int('1.5 GB')
|
||||
|
@ -401,11 +401,16 @@ class JcCli():
|
||||
self.json_indent = 2
|
||||
self.json_separators = None
|
||||
|
||||
# Convert any non-serializable object to a string
|
||||
def string_serializer(data):
|
||||
return str(data)
|
||||
|
||||
j_string = json.dumps(
|
||||
self.data_out,
|
||||
indent=self.json_indent,
|
||||
separators=self.json_separators,
|
||||
ensure_ascii=self.ascii_only
|
||||
ensure_ascii=self.ascii_only,
|
||||
default=string_serializer
|
||||
)
|
||||
|
||||
if not self.mono and PYGMENTS_INSTALLED:
|
||||
|
@ -3,6 +3,7 @@
|
||||
import sys
|
||||
from typing import Any, Dict, List, Tuple, Iterator, Optional, Union
|
||||
|
||||
CustomColorType = Dict[Any, str]
|
||||
JSONDictType = Dict[str, Any]
|
||||
StreamingOutputType = Iterator[Union[JSONDictType, Tuple[BaseException, str]]]
|
||||
|
||||
@ -42,11 +43,3 @@ if sys.version_info >= (3, 8):
|
||||
else:
|
||||
ParserInfoType = Dict
|
||||
TimeStampFormatType = Dict
|
||||
|
||||
|
||||
try:
|
||||
from pygments.token import (Name, Number, String, Keyword)
|
||||
CustomColorType = Dict[Union[Name.Tag, Number, String, Keyword], str]
|
||||
|
||||
except Exception:
|
||||
CustomColorType = Dict # type: ignore
|
||||
|
@ -10,7 +10,7 @@ from jc import appdirs
|
||||
from jc import utils
|
||||
|
||||
|
||||
__version__ = '1.25.3'
|
||||
__version__ = '1.25.4'
|
||||
|
||||
parsers: List[str] = [
|
||||
'acpi',
|
||||
@ -75,6 +75,7 @@ parsers: List[str] = [
|
||||
'iostat',
|
||||
'iostat-s',
|
||||
'ip-address',
|
||||
'ipconfig',
|
||||
'iptables',
|
||||
'ip-route',
|
||||
'iw-scan',
|
||||
@ -107,6 +108,7 @@ parsers: List[str] = [
|
||||
'openvpn',
|
||||
'os-prober',
|
||||
'os-release',
|
||||
'pacman',
|
||||
'passwd',
|
||||
'path',
|
||||
'path-list',
|
||||
@ -224,6 +226,7 @@ parsers: List[str] = [
|
||||
'vmstat-s',
|
||||
'w',
|
||||
'wc',
|
||||
'wg-show',
|
||||
'who',
|
||||
'x509-cert',
|
||||
'x509-csr',
|
||||
|
@ -28,6 +28,8 @@ a controller and a device but there might be fields corresponding to one entity.
|
||||
Controller:
|
||||
[
|
||||
{
|
||||
"manufacturer": string,
|
||||
"version": string,
|
||||
"name": string,
|
||||
"is_default": boolean,
|
||||
"is_public": boolean,
|
||||
@ -110,7 +112,7 @@ import jc.utils
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.2'
|
||||
version = '1.3'
|
||||
description = '`bluetoothctl` command parser'
|
||||
author = 'Jake Ob'
|
||||
author_email = 'iakopap at gmail.com'
|
||||
@ -127,6 +129,8 @@ try:
|
||||
Controller = TypedDict(
|
||||
"Controller",
|
||||
{
|
||||
"manufacturer": str,
|
||||
"version": str,
|
||||
"name": str,
|
||||
"is_default": bool,
|
||||
"is_public": bool,
|
||||
@ -175,7 +179,9 @@ except ImportError:
|
||||
_controller_head_pattern = r"Controller (?P<address>([0-9A-F]{2}:){5}[0-9A-F]{2}) (?P<name>.+)"
|
||||
|
||||
_controller_line_pattern = (
|
||||
r"(\s*Name:\s*(?P<name>.+)"
|
||||
r"(\s*Manufacturer:\s*(?P<manufacturer>.+)"
|
||||
+ r"|\s*Version:\s*(?P<version>.+)"
|
||||
+ r"|\s*Name:\s*(?P<name>.+)"
|
||||
+ r"|\s*Alias:\s*(?P<alias>.+)"
|
||||
+ r"|\s*Class:\s*(?P<class>.+)"
|
||||
+ r"|\s*Powered:\s*(?P<powered>.+)"
|
||||
@ -203,6 +209,8 @@ def _parse_controller(next_lines: List[str]) -> Optional[Controller]:
|
||||
return None
|
||||
|
||||
controller: Controller = {
|
||||
"manufacturer": '',
|
||||
"version": '',
|
||||
"name": '',
|
||||
"is_default": False,
|
||||
"is_public": False,
|
||||
@ -241,7 +249,11 @@ def _parse_controller(next_lines: List[str]) -> Optional[Controller]:
|
||||
|
||||
matches = result.groupdict()
|
||||
|
||||
if matches["name"]:
|
||||
if matches["manufacturer"]:
|
||||
controller["manufacturer"] = matches["manufacturer"]
|
||||
elif matches["version"]:
|
||||
controller["version"] = matches["version"]
|
||||
elif matches["name"]:
|
||||
controller["name"] = matches["name"]
|
||||
elif matches["alias"]:
|
||||
controller["alias"] = matches["alias"]
|
||||
|
@ -101,7 +101,7 @@ import jc.parsers.universal
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '2.0'
|
||||
version = '2.1'
|
||||
description = '`df` command parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
@ -127,6 +127,7 @@ def _process(proc_data):
|
||||
"""
|
||||
int_list = {'use_percent', 'capacity_percent', 'ifree', 'iused', 'iused_percent'}
|
||||
size_list = {'size', 'used', 'available'}
|
||||
posix_mode = False
|
||||
|
||||
for entry in proc_data:
|
||||
if 'avail' in entry:
|
||||
@ -134,6 +135,7 @@ def _process(proc_data):
|
||||
|
||||
if 'use%' in entry:
|
||||
entry['use_percent'] = entry.pop('use%')
|
||||
posix_mode = True
|
||||
|
||||
if 'capacity' in entry:
|
||||
entry['capacity_percent'] = entry.pop('capacity')
|
||||
@ -159,7 +161,7 @@ def _process(proc_data):
|
||||
# parse the size, used, and available fields to bytes
|
||||
for key in entry:
|
||||
if key in size_list:
|
||||
entry[key] = jc.utils.convert_size_to_int(entry[key])
|
||||
entry[key] = jc.utils.convert_size_to_int(entry[key], posix_mode=posix_mode)
|
||||
|
||||
# convert integers
|
||||
for key in entry:
|
||||
|
@ -172,7 +172,7 @@ import jc.utils
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.0'
|
||||
version = '1.1'
|
||||
description = '`ethtool` command parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
@ -248,10 +248,11 @@ def _parse_default(data: str) -> JSONDictType:
|
||||
supported_link_modes: List[str] = []
|
||||
supported_fec_modes: List[str] = []
|
||||
advertised_link_modes: List[str] = []
|
||||
link_partner_advertised_link_modes: List[str] = []
|
||||
advertised_fec_modes: List[str] = []
|
||||
current_message_level: List[str] = []
|
||||
mode: str = '' # supported_link_modes, supported_fec_modes, advertised_link_modes,
|
||||
# advertised_fec_modes, current_message_level
|
||||
# link_partner_advertised_link_modes, advertised_fec_modes, current_message_level
|
||||
|
||||
for line in filter(None, data.splitlines()):
|
||||
|
||||
@ -294,6 +295,14 @@ def _parse_default(data: str) -> JSONDictType:
|
||||
mode = 'advertised_link_modes'
|
||||
continue
|
||||
|
||||
if 'Link partner advertised link modes:' in line and 'Not reported' not in line:
|
||||
_, val = line.split(':', maxsplit=1)
|
||||
val = val.strip()
|
||||
val_list = val.split()
|
||||
link_partner_advertised_link_modes.extend(val_list)
|
||||
mode = 'link_partner_advertised_link_modes'
|
||||
continue
|
||||
|
||||
if 'Advertised FEC modes:' in line and 'Not reported' not in line:
|
||||
_, val = line.split(':', maxsplit=1)
|
||||
val = val.strip()
|
||||
@ -326,6 +335,12 @@ def _parse_default(data: str) -> JSONDictType:
|
||||
advertised_link_modes.extend(val_list)
|
||||
continue
|
||||
|
||||
if mode == 'link_partner_advertised_link_modes':
|
||||
val = line.strip()
|
||||
val_list = val.split()
|
||||
link_partner_advertised_link_modes.extend(val_list)
|
||||
continue
|
||||
|
||||
if mode == 'advertised_fec_modes':
|
||||
val = line.strip()
|
||||
val_list = val.split()
|
||||
@ -346,6 +361,7 @@ def _parse_default(data: str) -> JSONDictType:
|
||||
(supported_link_modes, 'supported_link_modes'),
|
||||
(supported_fec_modes, 'supported_fec_modes'),
|
||||
(advertised_link_modes, 'advertised_link_modes'),
|
||||
(link_partner_advertised_link_modes, 'link_partner_advertised_link_modes'),
|
||||
(advertised_fec_modes, 'advertised_fec_modes'),
|
||||
(current_message_level, 'current_message_level')
|
||||
]
|
||||
|
@ -212,14 +212,14 @@ Examples:
|
||||
"""
|
||||
import re
|
||||
from ipaddress import IPv4Network
|
||||
from typing import List, Dict, Optional
|
||||
from typing import List, Dict
|
||||
from jc.jc_types import JSONDictType
|
||||
import jc.utils
|
||||
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '2.3'
|
||||
version = '2.4'
|
||||
description = '`ifconfig` command parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
@ -548,6 +548,11 @@ def parse(
|
||||
broadcast\s+(?P<broadcast>(?:[0-9]{1,3}\.){3}[0-9]{1,3}))?
|
||||
''', re.IGNORECASE | re.VERBOSE
|
||||
)
|
||||
re_freebsd_ipv4_utun = re.compile(r'''
|
||||
inet\s(?P<address>(?:[0-9]{1,3}\.){3}[0-9]{1,3})\s-->\s(?:(?:[0-9]{1,3}\.){3}[0-9]{1,3})\s
|
||||
netmask\s(?P<mask>\S*)
|
||||
''', re.IGNORECASE | re.VERBOSE
|
||||
)
|
||||
re_freebsd_ipv6 = re.compile(r'''
|
||||
\s?inet6\s(?P<address>.*?)
|
||||
(?:\%(?P<scope_id>\w+\d+))?\s
|
||||
@ -624,14 +629,14 @@ def parse(
|
||||
re_openbsd_rx_stats, re_openbsd_tx, re_openbsd_tx_stats
|
||||
]
|
||||
re_freebsd = [
|
||||
re_freebsd_interface, re_freebsd_ipv4, re_freebsd_ipv4_v2, re_freebsd_ipv6,
|
||||
re_freebsd_interface, re_freebsd_ipv4, re_freebsd_ipv4_v2, re_freebsd_ipv4_utun, re_freebsd_ipv6,
|
||||
re_freebsd_details, re_freebsd_status, re_freebsd_nd6_options, re_freebsd_plugged,
|
||||
re_freebsd_vendor_pn_sn_date, re_freebsd_temp_volts, re_freebsd_hwaddr, re_freebsd_media,
|
||||
re_freebsd_tx_rx_power, re_freebsd_options
|
||||
]
|
||||
|
||||
interface_patterns = [re_linux_interface, re_openbsd_interface, re_freebsd_interface]
|
||||
ipv4_patterns = [re_linux_ipv4, re_openbsd_ipv4, re_freebsd_ipv4, re_freebsd_ipv4_v2]
|
||||
ipv4_patterns = [re_linux_ipv4, re_openbsd_ipv4, re_freebsd_ipv4, re_freebsd_ipv4_v2, re_freebsd_ipv4_utun]
|
||||
ipv6_patterns = [re_linux_ipv6, re_openbsd_ipv6, re_freebsd_ipv6]
|
||||
|
||||
if jc.utils.has_data(data):
|
||||
|
@ -533,7 +533,7 @@ import jc.utils
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.4'
|
||||
version = '1.5'
|
||||
description = 'IPv4 and IPv6 Address string parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
@ -661,8 +661,18 @@ def parse(
|
||||
|
||||
if interface.version == 4:
|
||||
ip_split = ip_exploded.split('.')
|
||||
|
||||
else:
|
||||
ip_split = ip_exploded.split(':')
|
||||
# regular IPv6
|
||||
if not '.' in ip_exploded:
|
||||
ip_split = ip_exploded.split(':')
|
||||
|
||||
# IPv4 mapped IPv6
|
||||
else:
|
||||
ip_split_v6 = ip_exploded.split(':')[:-1]
|
||||
ip_split_v4_mapped_str = ip_exploded.split(':')[-1]
|
||||
ip_split_v4_mapped = ip_split_v4_mapped_str.split('.')
|
||||
ip_split = ip_split_v6 + ip_split_v4_mapped
|
||||
|
||||
# fix for ipv6-only attributes
|
||||
scope_id = None
|
||||
|
809
jc/parsers/ipconfig.py
Normal file
809
jc/parsers/ipconfig.py
Normal file
@ -0,0 +1,809 @@
|
||||
r"""jc - JSON Convert `ipconfig` Windows command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ ipconfig /all | jc --ipconfig
|
||||
$ ipconfig | jc --ipconfig
|
||||
$ jc ipconfig /all
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('ipconfig', ipconfig_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"host_name": string,
|
||||
"primary_dns_suffix": string,
|
||||
"node_type": string,
|
||||
"ip_routing_enabled": boolean,
|
||||
"wins_proxy_enabled": boolean,
|
||||
"dns_suffix_search_list": [
|
||||
string
|
||||
],
|
||||
"adapters": [
|
||||
{
|
||||
"name_long": string,
|
||||
"name": string,
|
||||
"type": string,
|
||||
"connection_specific_dns_suffix": string,
|
||||
"connection_specific_dns_suffix_search_list": [
|
||||
string
|
||||
]
|
||||
"description": string,
|
||||
"physical_address": string,
|
||||
"dhcp_enabled": boolean,
|
||||
"autoconfiguration_enabled": boolean,
|
||||
"ipv6_addresses": [
|
||||
{
|
||||
"address": string,
|
||||
"status": string,
|
||||
},
|
||||
],
|
||||
"temporary_ipv6_addresses": [
|
||||
{
|
||||
"address": string,
|
||||
"status": string,
|
||||
},
|
||||
],
|
||||
"link_local_ipv6_addresses": [
|
||||
{
|
||||
"address": string,
|
||||
"status": string,
|
||||
"prefix_length": integer,
|
||||
}
|
||||
],
|
||||
"ipv4_addresses": [
|
||||
{
|
||||
"address": string, # [2]
|
||||
"subnet_mask": string,
|
||||
"status": string,
|
||||
"autoconfigured": boolean # [1]
|
||||
}
|
||||
],
|
||||
"default_gateways": [
|
||||
string
|
||||
],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": string,
|
||||
"dhcpv6_client_duid": string,
|
||||
"dns_servers": [
|
||||
string
|
||||
],
|
||||
"primary_wins_server": string,
|
||||
"lease_expires": string,
|
||||
"lease_expires_epoch": integer, # [0]
|
||||
"lease_expires_iso": string,
|
||||
"lease_obtained": string,
|
||||
"lease_obtained_epoch": integer, # [0]
|
||||
"lease_obtained_iso": string,
|
||||
"netbios_over_tcpip": boolean,
|
||||
"media_state": string,
|
||||
"extras": [
|
||||
<string>: string
|
||||
]
|
||||
}
|
||||
],
|
||||
"extras": []
|
||||
}
|
||||
|
||||
Notes:
|
||||
[0] - The epoch calculated timestamp field is naive. (i.e. based on
|
||||
the local time of the system the parser is run on)
|
||||
[1] - 'autoconfigured' under 'ipv4_address' is only providing
|
||||
indication if the ipv4 address was labeled as "Autoconfiguration
|
||||
IPv4 Address" vs "IPv4 Address". It does not infer any
|
||||
information from other fields
|
||||
[2] - Windows XP uses 'IP Address' instead of 'IPv4 Address'. Both
|
||||
values are parsed to the 'ipv4_address' object for consistency
|
||||
|
||||
Examples:
|
||||
|
||||
$ ipconfig /all | jc --ipconfig -p
|
||||
{
|
||||
"host_name": "DESKTOP-WIN11-HOME",
|
||||
"primary_dns_suffix": null,
|
||||
"node_type": "Hybrid",
|
||||
"ip_routing_enabled": false,
|
||||
"wins_proxy_enabled": false,
|
||||
"dns_suffix_search_list": [
|
||||
"localdomain"
|
||||
],
|
||||
"adapters": [
|
||||
{
|
||||
"name_long": "Ethernet adapter Ethernet",
|
||||
"name": "Ethernet",
|
||||
"type": "Ethernet",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "Intel(R) I211 Gigabit Network Connection",
|
||||
"physical_address": "24-4B-FE-AB-43-C3",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": null,
|
||||
"dhcpv6_client_duid": null,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": null,
|
||||
"media_state": "Media disconnected",
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Ethernet adapter Ethernet 2",
|
||||
"name": "Ethernet 2",
|
||||
"type": "Ethernet",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "Realtek PCIe 2.5GbE Family Controller",
|
||||
"physical_address": "24-4B-FE-57-3D-F2",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": null,
|
||||
"dhcpv6_client_duid": null,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": null,
|
||||
"media_state": "Media disconnected",
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Unknown adapter OpenVPN Data Channel Offload for NordVPN",
|
||||
"name": "OpenVPN Data Channel Offload for NordVPN",
|
||||
"type": "Unknown",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "OpenVPN Data Channel Offload",
|
||||
"physical_address": null,
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": null,
|
||||
"dhcpv6_client_duid": null,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": null,
|
||||
"media_state": "Media disconnected",
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Unknown adapter Local Area Connection",
|
||||
"name": "Local Area Connection",
|
||||
"type": "Unknown",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "TAP-NordVPN Windows Adapter V9",
|
||||
"physical_address": "00-FF-4C-F4-5E-49",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": null,
|
||||
"dhcpv6_client_duid": null,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": null,
|
||||
"media_state": "Media disconnected",
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Wireless LAN adapter Local Area Connection* 1",
|
||||
"name": "Local Area Connection* 1",
|
||||
"type": "Wireless LAN",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "Microsoft Wi-Fi Direct Virtual Adapter",
|
||||
"physical_address": "A8-7E-EA-5A-7F-DE",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": null,
|
||||
"dhcpv6_client_duid": null,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": null,
|
||||
"media_state": "Media disconnected",
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Wireless LAN adapter Local Area Connection* 2",
|
||||
"name": "Local Area Connection* 2",
|
||||
"type": "Wireless LAN",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "Microsoft Wi-Fi Direct Virtual Adapter #2",
|
||||
"physical_address": "AA-7E-EA-F3-64-C3",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": null,
|
||||
"dhcpv6_client_duid": null,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": null,
|
||||
"media_state": "Media disconnected",
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Ethernet adapter VMware Network Adapter VMnet1",
|
||||
"name": "VMware Network Adapter VMnet1",
|
||||
"type": "Ethernet",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "VMware Virtual Ethernet Adapter for VMnet1",
|
||||
"physical_address": "00-50-56-CC-27-73",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [
|
||||
{
|
||||
"address": "fe80::f47d:9c7f:69dc:591e",
|
||||
"prefix_length": 8,
|
||||
"status": "Preferred"
|
||||
}
|
||||
],
|
||||
"ipv4_addresses": [
|
||||
{
|
||||
"address": "192.168.181.1",
|
||||
"subnet_mask": "255.255.255.0",
|
||||
"status": "Preferred",
|
||||
"autoconfigured": false
|
||||
}
|
||||
],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": "192.168.181.254",
|
||||
"dhcpv6_iaid": "771772502",
|
||||
"dhcpv6_client_duid": "00-01-00-01-2C-CF-19-EB-24-4B-FE-5B-9B-E6",
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": "2024-09-19T18:01:29",
|
||||
"lease_obtained": "2024-09-19T08:31:29",
|
||||
"netbios_over_tcpip": true,
|
||||
"media_state": null,
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Ethernet adapter VMware Network Adapter VMnet8",
|
||||
"name": "VMware Network Adapter VMnet8",
|
||||
"type": "Ethernet",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "VMware Virtual Ethernet Adapter for VMnet8",
|
||||
"physical_address": "00-50-56-C9-A3-78",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [
|
||||
{
|
||||
"address": "fe80::4551:bf0d:59dd:a4f0",
|
||||
"prefix_length": 10,
|
||||
"status": "Preferred"
|
||||
}
|
||||
],
|
||||
"ipv4_addresses": [
|
||||
{
|
||||
"address": "192.168.213.1",
|
||||
"subnet_mask": "255.255.255.0",
|
||||
"status": "Preferred",
|
||||
"autoconfigured": false
|
||||
}
|
||||
],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": "192.168.213.254",
|
||||
"dhcpv6_iaid": "788549718",
|
||||
"dhcpv6_client_duid": "00-01-00-01-2C-CF-19-EB-24-4B-FE-5B-9B-E6",
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": "192.168.213.2",
|
||||
"lease_expires": "2024-09-19T18:01:29",
|
||||
"lease_obtained": "2024-09-19T08:31:29",
|
||||
"netbios_over_tcpip": true,
|
||||
"media_state": null,
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Wireless LAN adapter Wi-Fi",
|
||||
"name": "Wi-Fi",
|
||||
"type": "Wireless LAN",
|
||||
"connection_specific_dns_suffix": "localdomain",
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "Intel(R) Wi-Fi 6 AX200 160MHz",
|
||||
"physical_address": "A8-7E-EA-55-26-B0",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [
|
||||
{
|
||||
"address": "fd63:cc9c:65eb:3f95:57c2:aa:10d8:db08",
|
||||
"status": "Preferred"
|
||||
}
|
||||
],
|
||||
"temporary_ipv6_addresses": [
|
||||
{
|
||||
"address": "fd63:cc9c:65eb:3f95:8928:348e:d692:b7ef",
|
||||
"status": "Preferred"
|
||||
}
|
||||
],
|
||||
"link_local_ipv6_addresses": [
|
||||
{
|
||||
"address": "fe80::4fae:1380:5a1b:8b6b",
|
||||
"prefix_length": 11,
|
||||
"status": "Preferred"
|
||||
}
|
||||
],
|
||||
"ipv4_addresses": [
|
||||
{
|
||||
"address": "192.168.1.169",
|
||||
"subnet_mask": "255.255.255.0",
|
||||
"status": "Preferred",
|
||||
"autoconfigured": false
|
||||
}
|
||||
],
|
||||
"default_gateways": [
|
||||
"192.168.1.1"
|
||||
],
|
||||
"dhcp_server": "192.168.1.1",
|
||||
"dhcpv6_iaid": "162037482",
|
||||
"dhcpv6_client_duid": "00-01-00-01-2C-CF-19-EB-24-4B-FE-5B-9B-E6",
|
||||
"dns_servers": [
|
||||
"192.168.1.1"
|
||||
],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": "2024-09-20T08:31:30",
|
||||
"lease_obtained": "2024-09-19T08:31:30",
|
||||
"netbios_over_tcpip": true,
|
||||
"media_state": null,
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Ethernet adapter Bluetooth Network Connection",
|
||||
"name": "Bluetooth Network Connection",
|
||||
"type": "Ethernet",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "Bluetooth Device (Personal Area Network)",
|
||||
"physical_address": "A8-7E-EA-43-23-14",
|
||||
"dhcp_enabled": true,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": null,
|
||||
"dhcpv6_client_duid": null,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": null,
|
||||
"media_state": "Media disconnected",
|
||||
"extras": []
|
||||
}
|
||||
],
|
||||
"extras": []
|
||||
}
|
||||
"""
|
||||
from datetime import datetime
|
||||
import re
|
||||
import jc.utils
|
||||
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.0'
|
||||
description = '`ipconfig` Windows command parser'
|
||||
author = 'joehacksalot'
|
||||
author_email = 'joehacksalot@gmail.com'
|
||||
compatible = ['windows']
|
||||
magic_commands = ['ipconfig']
|
||||
tags = ['command']
|
||||
|
||||
|
||||
__version__ = info.version
|
||||
|
||||
|
||||
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.
|
||||
"""
|
||||
jc.utils.compatibility(__name__, info.compatible, quiet)
|
||||
jc.utils.input_type_check(data)
|
||||
|
||||
raw_output = {}
|
||||
if jc.utils.has_data(data):
|
||||
# Initialize the parsed output dictionary with all fields set to None or empty lists
|
||||
raw_output = _parse(data)
|
||||
|
||||
return raw_output if raw else _process(raw_output)
|
||||
|
||||
|
||||
def _process_ipv6_address(ip_address):
|
||||
address_split = ip_address["address"].split('%')
|
||||
try:
|
||||
if len(address_split) > 1:
|
||||
address = address_split[0]
|
||||
prefix_length = int(address_split[1])
|
||||
else:
|
||||
address = ip_address["address"]
|
||||
prefix_length = None
|
||||
except:
|
||||
address = ip_address["address"]
|
||||
prefix_length = None
|
||||
return {
|
||||
"address": address,
|
||||
"prefix_length": prefix_length,
|
||||
"status": ip_address["status"]
|
||||
}
|
||||
|
||||
|
||||
def _process_ipv4_address(ip_address):
|
||||
autoconfigured = True if ip_address.get("autoconfigured","") is not None and 'autoconfigured' in ip_address.get("autoconfigured","") else False
|
||||
subnet_mask = ip_address["subnet_mask"]
|
||||
return {
|
||||
"address": ip_address["address"],
|
||||
"subnet_mask": subnet_mask,
|
||||
"status": ip_address["status"],
|
||||
"autoconfigured": autoconfigured
|
||||
}
|
||||
|
||||
|
||||
def _process(proc_data):
|
||||
"""
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (Dictionary) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
Processed Dictionary. Structured data to conform to the schema.
|
||||
"""
|
||||
processed = proc_data
|
||||
|
||||
if "ip_routing_enabled" in processed and processed["ip_routing_enabled"] is not None:
|
||||
processed["ip_routing_enabled"] = (processed["ip_routing_enabled"].lower() == "yes")
|
||||
|
||||
if "wins_proxy_enabled" in processed and processed["wins_proxy_enabled"] is not None:
|
||||
processed["wins_proxy_enabled"] = (processed["wins_proxy_enabled"].lower() == "yes")
|
||||
|
||||
for adapter in processed["adapters"]:
|
||||
if "dhcp_enabled" in adapter and adapter["dhcp_enabled"] is not None:
|
||||
adapter["dhcp_enabled"] = (adapter["dhcp_enabled"].lower() == "yes")
|
||||
|
||||
if "autoconfiguration_enabled" in adapter and adapter["autoconfiguration_enabled"] is not None:
|
||||
adapter["autoconfiguration_enabled"] = (adapter["autoconfiguration_enabled"].lower() == "yes")
|
||||
|
||||
if "netbios_over_tcpip" in adapter and adapter["netbios_over_tcpip"] is not None:
|
||||
adapter["netbios_over_tcpip"] = (adapter["netbios_over_tcpip"].lower() == "enabled")
|
||||
|
||||
if "lease_expires" in adapter and adapter["lease_expires"]:
|
||||
ts = jc.utils.timestamp(adapter['lease_expires'], format_hint=(1720,))
|
||||
adapter["lease_expires_epoch"] = ts.naive
|
||||
adapter["lease_expires_iso"] = ts.iso
|
||||
|
||||
if "lease_obtained" in adapter and adapter["lease_obtained"]:
|
||||
ts = jc.utils.timestamp(adapter['lease_obtained'], format_hint=(1720,))
|
||||
adapter["lease_obtained_epoch"] = ts.naive
|
||||
adapter["lease_obtained_iso"] = ts.iso
|
||||
|
||||
adapter["link_local_ipv6_addresses"] = [_process_ipv6_address(address) for address in adapter.get("link_local_ipv6_addresses", [])]
|
||||
adapter["ipv4_addresses"] = [_process_ipv4_address(address) for address in adapter.get("ipv4_addresses", [])]
|
||||
|
||||
return processed
|
||||
|
||||
|
||||
class _PushbackIterator:
|
||||
def __init__(self, iterator):
|
||||
self.iterator = iterator
|
||||
self.pushback_stack = []
|
||||
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def __next__(self):
|
||||
if self.pushback_stack:
|
||||
return self.pushback_stack.pop()
|
||||
else:
|
||||
return next(self.iterator)
|
||||
|
||||
def pushback(self, value):
|
||||
self.pushback_stack.append(value)
|
||||
|
||||
|
||||
def _parse(data):
|
||||
# Initialize the parsed output dictionary with all fields set to None or empty lists
|
||||
parse_output = {
|
||||
"host_name": None,
|
||||
"primary_dns_suffix": None,
|
||||
"node_type": None,
|
||||
"ip_routing_enabled": None,
|
||||
"wins_proxy_enabled": None,
|
||||
"dns_suffix_search_list": [],
|
||||
"adapters": [],
|
||||
"extras": [] # To store unrecognized fields
|
||||
}
|
||||
|
||||
lines = data.splitlines()
|
||||
lines = [line.rstrip() for line in lines if line.strip() != ""]
|
||||
|
||||
line_iter = _PushbackIterator(iter(lines))
|
||||
adapter = None
|
||||
in_adapter_section = False
|
||||
|
||||
for line in line_iter:
|
||||
line = line.rstrip()
|
||||
|
||||
# Skip empty lines
|
||||
if not line.strip():
|
||||
continue
|
||||
|
||||
# Header Section
|
||||
if not in_adapter_section:
|
||||
if "Windows IP Configuration" in line:
|
||||
continue
|
||||
elif _is_adapter_start_line(line):
|
||||
# Start of Adapter Section
|
||||
in_adapter_section = True
|
||||
adapter_name = line.strip(":").strip()
|
||||
adapter = _initialize_adapter(adapter_name)
|
||||
parse_output["adapters"].append(adapter)
|
||||
elif line.startswith(" "):
|
||||
key, value = _parse_line(line)
|
||||
if key:
|
||||
_parse_header_line(parse_output, key, value, line_iter)
|
||||
else:
|
||||
continue
|
||||
else:
|
||||
# Adapter Sections
|
||||
if _is_adapter_start_line(line):
|
||||
# Start of new adapter
|
||||
adapter_name = line.strip(":").strip()
|
||||
adapter = _initialize_adapter(adapter_name)
|
||||
parse_output["adapters"].append(adapter)
|
||||
elif line.startswith(" "):
|
||||
key, value = _parse_line(line)
|
||||
if key:
|
||||
_parse_adapter_line(adapter, key, value, line_iter)
|
||||
else:
|
||||
continue
|
||||
|
||||
return parse_output
|
||||
|
||||
|
||||
def _is_adapter_start_line(line):
|
||||
# Detect adapter start lines, e.g., "Ethernet adapter Ethernet:"
|
||||
return re.match(r"^[^\s].*adapter.*:", line, re.IGNORECASE)
|
||||
|
||||
|
||||
def _initialize_adapter(adapter_name):
|
||||
adapter_name_split = adapter_name.split(" adapter ", 1)
|
||||
if len(adapter_name_split) > 1:
|
||||
adapter_type = adapter_name_split[0]
|
||||
adapter_short_name = adapter_name_split[1]
|
||||
else:
|
||||
adapter_type = None
|
||||
adapter_short_name = adapter_name
|
||||
|
||||
# Initialize adapter dictionary with all fields set to None or empty lists
|
||||
return {
|
||||
"name_long": adapter_name,
|
||||
"name": adapter_short_name,
|
||||
"type": adapter_type,
|
||||
"connection_specific_dns_suffix": None,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": None,
|
||||
"physical_address": None,
|
||||
"dhcp_enabled": None,
|
||||
"autoconfiguration_enabled": None,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": None,
|
||||
"dhcpv6_iaid": None,
|
||||
"dhcpv6_client_duid": None,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": None,
|
||||
"lease_expires": None,
|
||||
"lease_obtained": None,
|
||||
"netbios_over_tcpip": None,
|
||||
"media_state": None,
|
||||
"extras": [] # To store unrecognized fields
|
||||
}
|
||||
|
||||
|
||||
def _parse_line(line):
|
||||
# Split the line into key and value using ':' or multiple spaces
|
||||
key_value = re.split(r":", line.strip(), 1)
|
||||
if len(key_value) == 2:
|
||||
key, value = key_value
|
||||
key = key.strip().rstrip('. ')
|
||||
key = re.sub(r'[^\w]+', '_', key.lower())
|
||||
value = value.strip() if value.strip() != "" else None
|
||||
return key, value
|
||||
else:
|
||||
return None, None
|
||||
|
||||
|
||||
def _parse_header_line(result, key, value, line_iter):
|
||||
if key in ["host_name", "primary_dns_suffix", "node_type", "ip_routing_enabled", "wins_proxy_enabled"]:
|
||||
result[key] = value
|
||||
elif key == "dns_suffix_search_list":
|
||||
if value:
|
||||
result["dns_suffix_search_list"].append(value)
|
||||
# Process additional entries
|
||||
_parse_additional_entries(result["dns_suffix_search_list"], line_iter)
|
||||
else:
|
||||
# Store unrecognized fields in extras
|
||||
result["extras"].append({key: value})
|
||||
|
||||
|
||||
def _parse_adapter_line(adapter, key, value, line_iter):
|
||||
if key in ["connection_specific_dns_suffix","media_state", "description", "physical_address", "dhcp_enabled",
|
||||
"autoconfiguration_enabled", "dhcpv6_iaid", "dhcpv6_client_duid", "netbios_over_tcpip", "dhcp_server",
|
||||
"lease_obtained", "lease_expires", "primary_wins_server"]:
|
||||
adapter[key] = value
|
||||
|
||||
elif key in ["ipv6_address", "temporary_ipv6_address", "link_local_ipv6_address"]:
|
||||
address_dict = _parse_ipv6_address(value)
|
||||
if key == "ipv6_address":
|
||||
adapter["ipv6_addresses"].append(address_dict)
|
||||
elif key == "temporary_ipv6_address":
|
||||
adapter["temporary_ipv6_addresses"].append(address_dict)
|
||||
elif key == "link_local_ipv6_address":
|
||||
adapter["link_local_ipv6_addresses"].append(address_dict)
|
||||
|
||||
elif key in ["ipv4_address", "autoconfiguration_ipv4_address", "ip_address", "autoconfiguration_ip_address"]:
|
||||
ipv4_address_dict = _parse_ipv4_address(value, key, line_iter)
|
||||
adapter["ipv4_addresses"].append(ipv4_address_dict)
|
||||
|
||||
elif key == "connection_specific_dns_suffix_search_list":
|
||||
if value:
|
||||
adapter["connection_specific_dns_suffix_search_list"].append(value)
|
||||
# Process additional connection specific dns suffix search list entries
|
||||
_parse_additional_entries(adapter["connection_specific_dns_suffix_search_list"], line_iter)
|
||||
|
||||
elif key == "default_gateway":
|
||||
if value:
|
||||
adapter["default_gateways"].append(value)
|
||||
# Process additional gateways
|
||||
_parse_additional_entries(adapter["default_gateways"], line_iter)
|
||||
|
||||
elif key == "dns_servers":
|
||||
if value:
|
||||
adapter["dns_servers"].append(value)
|
||||
# Process additional DNS servers
|
||||
_parse_additional_entries(adapter["dns_servers"], line_iter)
|
||||
|
||||
elif key == "subnet_mask":
|
||||
# Subnet Mask should be associated with the last IPv4 address
|
||||
if adapter["ipv4_addresses"]:
|
||||
adapter["ipv4_addresses"][-1]["subnet_mask"] = value
|
||||
|
||||
else:
|
||||
# Store unrecognized fields in extras
|
||||
adapter["extras"].append({key: value})
|
||||
|
||||
|
||||
def _parse_ipv6_address(value):
|
||||
# Handle multiple status indicators
|
||||
match = re.match(r"([^\(]+)\((.*)\)", value) if value else None
|
||||
if match:
|
||||
address = match.group(1).strip()
|
||||
status = match.group(2).strip('()')
|
||||
else:
|
||||
address = value
|
||||
status = None
|
||||
return {
|
||||
"address": address,
|
||||
"status": status
|
||||
}
|
||||
|
||||
|
||||
def _parse_ipv4_address(value, key, line_iter):
|
||||
# Handle autoconfigured status
|
||||
match = re.match(r"([^\(]+)\((.*)\)", value) if value else None
|
||||
if match:
|
||||
address = match.group(1).strip()
|
||||
status = match.group(2).strip('()')
|
||||
autoconfigured = 'autoconfigured' if 'autoconfiguration' in key or 'autoconfigured' in status else None
|
||||
else:
|
||||
address = value
|
||||
status = None
|
||||
autoconfigured = 'autoconfigured' if 'autoconfiguration' in key else None
|
||||
# Get subnet mask
|
||||
subnet_mask = None
|
||||
# Peek ahead for "Subnet Mask" line
|
||||
try:
|
||||
next_line = next(line_iter)
|
||||
next_key, next_value = _parse_line(next_line)
|
||||
if next_key == "subnet_mask":
|
||||
subnet_mask = next_value
|
||||
else:
|
||||
# If it's not "Subnet Mask", put it back into the iterator
|
||||
line_iter.pushback(next_line)
|
||||
except StopIteration:
|
||||
pass
|
||||
return {
|
||||
"address": address,
|
||||
"subnet_mask": subnet_mask,
|
||||
"autoconfigured": autoconfigured,
|
||||
"status": status
|
||||
}
|
||||
|
||||
|
||||
def _parse_additional_entries(entry_list, line_iter):
|
||||
# Process additional lines that belong to the current entry (e.g., additional DNS servers, DNS Suffix Search List)
|
||||
while True:
|
||||
try:
|
||||
next_line = next(line_iter)
|
||||
if not next_line.strip():
|
||||
continue # Skip empty lines
|
||||
|
||||
# Check if the line is indented (starts with whitespace)
|
||||
if re.match(r"^\s\s\s\s", next_line):
|
||||
# It's an indented line; append the stripped line to entry_list
|
||||
entry_list.append(next_line.strip())
|
||||
else:
|
||||
# Not an indented line; push it back and exit
|
||||
line_iter.pushback(next_line)
|
||||
break
|
||||
except StopIteration:
|
||||
break
|
@ -122,7 +122,7 @@ import jc.utils
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '0.7'
|
||||
version = '0.75'
|
||||
description = '`iw dev [device] scan` command parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
@ -298,6 +298,7 @@ def parse(data, raw=False, quiet=False):
|
||||
|
||||
raw_output = []
|
||||
section = {}
|
||||
header = ''
|
||||
|
||||
if jc.utils.has_data(data):
|
||||
|
||||
@ -323,7 +324,9 @@ def parse(data, raw=False, quiet=False):
|
||||
split_line[0] = split_line[0].lower().replace('*', '').replace('(', '')\
|
||||
.replace(')', '').replace(',', '').replace('-', '_')\
|
||||
.strip().replace(' ', '_')
|
||||
section[split_line[0]] = split_line[1].strip()
|
||||
if split_line[1] == '':
|
||||
header = split_line[0] + '_'
|
||||
section[header + split_line[0]] = split_line[1].strip()
|
||||
|
||||
continue
|
||||
|
||||
|
@ -77,7 +77,7 @@ import jc.utils
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.9'
|
||||
version = '1.10'
|
||||
description = '`mount` command parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
@ -138,16 +138,19 @@ def _linux_parse(data):
|
||||
|
||||
pattern = re.compile(
|
||||
r'''
|
||||
(?P<filesystem>\S+)\s+
|
||||
on\s+
|
||||
(?P<mount_point>.*?)\s+
|
||||
type\s+
|
||||
(?P<type>\S+)\s+
|
||||
\((?P<options>.*?)\)\s*''',
|
||||
re.VERBOSE)
|
||||
(?P<filesystem>.*)
|
||||
\son\s
|
||||
(?P<mount_point>.*?)
|
||||
\stype\s
|
||||
(?P<type>\S+)
|
||||
\s+
|
||||
\((?P<options>.*?)\)
|
||||
\s*
|
||||
''', re.VERBOSE
|
||||
)
|
||||
|
||||
match = pattern.match(entry)
|
||||
groups = match.groupdict()
|
||||
mymatch = pattern.match(entry)
|
||||
groups = mymatch.groupdict()
|
||||
|
||||
if groups:
|
||||
output_line['filesystem'] = groups["filesystem"]
|
||||
@ -223,7 +226,4 @@ def parse(data, raw=False, quiet=False):
|
||||
else:
|
||||
raw_output = _linux_parse(cleandata)
|
||||
|
||||
if raw:
|
||||
return raw_output
|
||||
else:
|
||||
return _process(raw_output)
|
||||
return raw_output if raw else _process(raw_output)
|
||||
|
@ -355,7 +355,7 @@ import jc.utils
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.15'
|
||||
version = '1.16'
|
||||
description = '`netstat` command parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
|
@ -1,5 +1,6 @@
|
||||
r"""jc - JSON Convert Linux netstat Parser"""
|
||||
import string
|
||||
import re
|
||||
|
||||
|
||||
def normalize_headers(header):
|
||||
@ -38,7 +39,7 @@ def parse_network(headers, entry):
|
||||
]
|
||||
|
||||
# split entry based on presence of value in "State" column
|
||||
contains_state = any(state in entry for state in LIST_OF_STATES)
|
||||
contains_state = any(re.search(rf"\b{re.escape(state)}\b", entry) for state in LIST_OF_STATES)
|
||||
split_modifier = 1 if contains_state else 2
|
||||
entry = entry.split(maxsplit=len(headers) - split_modifier)
|
||||
|
||||
|
@ -17,20 +17,24 @@ Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"version": string,
|
||||
"verbosity": integer,
|
||||
"ratelimit": integer
|
||||
"version": string,
|
||||
"verbosity": integer,
|
||||
"ratelimit": integer
|
||||
}
|
||||
]
|
||||
|
||||
[
|
||||
{
|
||||
"zone": string
|
||||
"zone": string
|
||||
"status": {
|
||||
"state": string,
|
||||
"served-serial": string,
|
||||
"commit-serial": string,
|
||||
"wait": string
|
||||
"state": string,
|
||||
"pattern": string, # Additional
|
||||
"catalog-member-id": string, # Additional
|
||||
"served-serial": string,
|
||||
"commit-serial": string,
|
||||
"notified-serial": string, # Conditional
|
||||
"wait": string,
|
||||
"transfer": string # Conditional
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -65,7 +69,7 @@ import jc.utils
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.1'
|
||||
version = '1.2'
|
||||
description = '`nsd-control` command parser'
|
||||
author = 'Pettai'
|
||||
author_email = 'pettai@sunet.se'
|
||||
@ -89,7 +93,7 @@ def _process(proc_data):
|
||||
|
||||
List of Dictionaries. Structured to conform to the schema.
|
||||
"""
|
||||
int_list = {'verbosity', 'ratelimit', 'wait'}
|
||||
int_list = {'verbosity', 'ratelimit', 'wait', 'transfer'}
|
||||
|
||||
for entry in proc_data:
|
||||
for key in entry:
|
||||
@ -229,6 +233,20 @@ def parse(data: str, raw: bool = False, quiet: bool = False):
|
||||
raw_output.append(zonename)
|
||||
continue
|
||||
|
||||
if line.startswith('notified-serial:'):
|
||||
linedata = line.split(': ', maxsplit=1)
|
||||
notified = linedata[1].strip('"').rstrip('"')
|
||||
zstatus.update({'notified-serial': notified})
|
||||
continue
|
||||
|
||||
if line.startswith('transfer:'):
|
||||
linedata = line.split(': ', maxsplit=1)
|
||||
transfer = linedata[1].strip('"').rstrip('"')
|
||||
zstatus.update({'transfer': transfer})
|
||||
zonename.update({'status': zstatus})
|
||||
raw_output.append(zonename)
|
||||
continue
|
||||
|
||||
# stats
|
||||
if line.startswith('server') or line.startswith('num.') or line.startswith('size.') or line.startswith('time.') or line.startswith('zone.'):
|
||||
itrparse = True
|
||||
|
348
jc/parsers/pacman.py
Normal file
348
jc/parsers/pacman.py
Normal file
@ -0,0 +1,348 @@
|
||||
r"""jc - JSON Convert `pacman` command output parser
|
||||
|
||||
Supports the following `pacman` arguments:
|
||||
|
||||
- `-Si`
|
||||
- `-Sii`
|
||||
- `-Qi`
|
||||
- `-Qii`
|
||||
|
||||
The `*_epoch` calculated timestamp fields are naive. (i.e. based on the
|
||||
local time of the system the parser is run on)
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ pacman -Si <package> | jc --pacman
|
||||
|
||||
or
|
||||
|
||||
$ jc pacman -Si <package>
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('pacman', pacman_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"repository": string,
|
||||
"name": string,
|
||||
"version": string,
|
||||
"description": string,
|
||||
"architecture": string,
|
||||
"url": string,
|
||||
"licenses": [
|
||||
string
|
||||
],
|
||||
"groups": [
|
||||
string
|
||||
],
|
||||
"provides": [
|
||||
string
|
||||
],
|
||||
"depends_on": [
|
||||
string
|
||||
],
|
||||
"optional_deps": [
|
||||
{
|
||||
"name": string,
|
||||
"description": string
|
||||
}
|
||||
],
|
||||
"optional_for": [
|
||||
string
|
||||
],
|
||||
"conflicts_with": [
|
||||
string
|
||||
],
|
||||
"replaces": [
|
||||
string
|
||||
],
|
||||
"download_size": string,
|
||||
"download_size_bytes": integer [0]
|
||||
"installed_size": string,
|
||||
"installed_size_bytes": integer, [0]
|
||||
"packager": string,
|
||||
"build_date": string,
|
||||
"build_date_epoch": integer, [0]
|
||||
"install_date": string,
|
||||
"install_date_epoch": integer, [0]
|
||||
"validated_by": [
|
||||
string
|
||||
],
|
||||
"backup_files": [
|
||||
string
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
[0] Field exists if conversion successful
|
||||
|
||||
Examples:
|
||||
|
||||
$ pacman -qii zstd | jc --pacman -p
|
||||
[
|
||||
{
|
||||
"name": "zstd",
|
||||
"version": "1.5.6-1",
|
||||
"description": "Zstandard - Fast real-time compression algorithm",
|
||||
"architecture": "x86_64",
|
||||
"url": "https://facebook.github.io/zstd/",
|
||||
"licenses": [
|
||||
"BSD-3-Clause",
|
||||
"GPL-2.0-only"
|
||||
],
|
||||
"groups": [],
|
||||
"provides": [
|
||||
"libzstd.so=1-64"
|
||||
],
|
||||
"depends_on": [
|
||||
"glibc",
|
||||
"gcc-libs",
|
||||
"zlib",
|
||||
"xz",
|
||||
"lz4"
|
||||
],
|
||||
"required_by": [
|
||||
"android-tools",
|
||||
"appstream",
|
||||
...
|
||||
"tiled",
|
||||
"vulkan-radeon",
|
||||
"wireshark-cli"
|
||||
],
|
||||
"optional_for": [
|
||||
"xarchiver"
|
||||
],
|
||||
"conflicts_with": [],
|
||||
"replaces": [],
|
||||
"installed_size": "1527.00 KiB",
|
||||
"installed_size_bytes": 1563648,
|
||||
"packager": "Levente Polyak <anthraxx@archlinux.org>",
|
||||
"build_date": "Sat 11 May 2024 06:14:19 AM +08",
|
||||
"build_date_epoch": 1715433259,
|
||||
"install_date": "Fri 24 May 2024 09:50:31 AM +08",
|
||||
"install_date_epoch": 1715663342,
|
||||
"install_reason": "Installed as a dependency for another package",
|
||||
"install_script": "No",
|
||||
"validated_by": [
|
||||
"Signature"
|
||||
],
|
||||
"extended_data": "pkgtype=pkg"
|
||||
}
|
||||
]
|
||||
|
||||
$ pacman -qii zstd | jc --pacman -p -r
|
||||
[
|
||||
{
|
||||
"name": "zstd",
|
||||
"version": "1.5.6-1",
|
||||
"description": "Zstandard - Fast real-time compression algorithm",
|
||||
"architecture": "x86_64",
|
||||
"url": "https://facebook.github.io/zstd/",
|
||||
"licenses": "BSD-3-Clause GPL-2.0-only",
|
||||
"groups": null,
|
||||
"provides": "libzstd.so=1-64",
|
||||
"depends_on": "glibc gcc-libs zlib xz lz4",
|
||||
"required_by": [
|
||||
"android-tools appstream avr-gcc binutils blender blosc",
|
||||
"boost-libs btrfs-progs cloudflare-warp-bin comgr curl",
|
||||
"dolphin-emu file flatpak gcc gdal gnutls karchive",
|
||||
"karchive5 kmod lib32-zstd libarchive libelf libtiff",
|
||||
"libva-mesa-driver libxmlb libzip lld llvm-libs mariadb-libs",
|
||||
"mesa mesa-vdpau minizip-ng mkinitcpio mold netcdf",
|
||||
"opencl-clover-mesa opencl-rusticl-mesa openucx postgresql",
|
||||
"postgresql-libs ppsspp qemu-img qemu-system-riscv",
|
||||
"qemu-system-x86 qgis qt6-base qt6-tools rsync rustup",
|
||||
"squashfs-tools squashfuse systemd-libs tiled vulkan-radeon",
|
||||
"wireshark-cli"
|
||||
],
|
||||
"optional_for": "xarchiver",
|
||||
"conflicts_with": null,
|
||||
"replaces": null,
|
||||
"installed_size": "1527.00 KiB",
|
||||
"packager": "Levente Polyak <anthraxx@archlinux.org>",
|
||||
"build_date": "Sat 11 May 2024 06:14:19 AM +08",
|
||||
"install_date": "Fri 24 May 2024 09:50:31 AM +08",
|
||||
"install_reason": "Installed as a dependency for another package",
|
||||
"install_script": "No",
|
||||
"validated_by": "Signature",
|
||||
"extended_data": "pkgtype=pkg"
|
||||
}
|
||||
]
|
||||
"""
|
||||
from typing import List, Dict
|
||||
from jc.jc_types import JSONDictType
|
||||
import jc.utils
|
||||
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.0'
|
||||
description = '`pacman` command parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
compatible = ['linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd']
|
||||
tags = ['command', 'file']
|
||||
magic_commands = ['pacman']
|
||||
|
||||
|
||||
__version__ = info.version
|
||||
|
||||
|
||||
def _process(proc_data: List[JSONDictType]) -> List[JSONDictType]:
|
||||
"""
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of Dictionaries. Structured to conform to the schema.
|
||||
"""
|
||||
split_fields = {
|
||||
'licenses', 'groups', 'provides', 'depends_on', 'conflicts_with',
|
||||
'replaces', 'optional_for'
|
||||
}
|
||||
space_split_fields = {
|
||||
'required_by', 'groups', 'provides', 'depends_on',
|
||||
'conflicts_with', 'replaces', 'validated_by'
|
||||
}
|
||||
two_space_fields = {'licenses', 'validated_by'}
|
||||
name_description_fields = {'optional_deps'}
|
||||
size_fields = {'download_size', 'installed_size'}
|
||||
date_fields = {'build_date', 'install_date'}
|
||||
|
||||
# initial split for field lists
|
||||
for item in proc_data:
|
||||
for key, val in item.copy().items():
|
||||
if key in split_fields:
|
||||
if val is None:
|
||||
item[key] = []
|
||||
else:
|
||||
item[key] = val.split()
|
||||
|
||||
# fixup for specific lists
|
||||
if key in space_split_fields and isinstance(val, List):
|
||||
val_list = [x.split() for x in val]
|
||||
item[key] = [x for xs in val_list for x in xs] # flatten the list
|
||||
|
||||
if key in two_space_fields and isinstance(val, str):
|
||||
item[key] = val.split(' ')
|
||||
|
||||
if key in name_description_fields and isinstance(val, list):
|
||||
new_list = []
|
||||
for name_desc in val:
|
||||
n, *d = name_desc.split(': ')
|
||||
if d == []:
|
||||
d = ''
|
||||
else:
|
||||
d = d[0]
|
||||
new_obj = {'name': n, 'description': d}
|
||||
new_list.append(new_obj)
|
||||
item[key] = new_list
|
||||
|
||||
if key in size_fields:
|
||||
bts = jc.utils.convert_size_to_int(val)
|
||||
if bts:
|
||||
item[key + '_bytes'] = bts
|
||||
|
||||
if key in date_fields:
|
||||
# need to append '00' to date for conversion
|
||||
ts = jc.utils.timestamp(val + '00', format_hint=(3100,))
|
||||
if ts.naive:
|
||||
item[key + '_epoch'] = ts.naive
|
||||
else:
|
||||
# try taking off the text TZ identifier
|
||||
ts = jc.utils.timestamp(val[:-4], format_hint=(3000,))
|
||||
if ts.naive:
|
||||
item[key + '_epoch'] = ts.naive
|
||||
|
||||
return proc_data
|
||||
|
||||
|
||||
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.
|
||||
"""
|
||||
jc.utils.compatibility(__name__, info.compatible, quiet)
|
||||
jc.utils.input_type_check(data)
|
||||
|
||||
raw_output: List[Dict] = []
|
||||
entry_obj: Dict = {}
|
||||
multiline_fields = {'required_by', 'optional_deps', 'backup_files'}
|
||||
multiline_list: List = []
|
||||
multiline_key = ''
|
||||
|
||||
if jc.utils.has_data(data):
|
||||
|
||||
for line in filter(None, data.splitlines()):
|
||||
splitline = line.split(' : ', maxsplit=1)
|
||||
|
||||
if len(splitline) == 2:
|
||||
# this is a key/value pair
|
||||
key, val = splitline
|
||||
key = key.strip()
|
||||
key = jc.utils.normalize_key(key)
|
||||
val = val.strip()
|
||||
|
||||
# new entries can start with "Repository" or "Name"
|
||||
if (key == 'name' or key == 'repository') and len(entry_obj) > 2:
|
||||
if multiline_list:
|
||||
entry_obj[multiline_key] = multiline_list
|
||||
multiline_list = []
|
||||
multiline_key = ''
|
||||
if entry_obj:
|
||||
raw_output.append(entry_obj)
|
||||
entry_obj = {}
|
||||
entry_obj[key] = val
|
||||
continue
|
||||
|
||||
if key in multiline_fields:
|
||||
if multiline_list:
|
||||
entry_obj[multiline_key] = multiline_list
|
||||
multiline_list = []
|
||||
if val != 'None':
|
||||
multiline_list.append(val)
|
||||
multiline_key = key
|
||||
continue
|
||||
|
||||
if key not in multiline_fields:
|
||||
if multiline_list:
|
||||
entry_obj[multiline_key] = multiline_list
|
||||
multiline_list = []
|
||||
multiline_key = ''
|
||||
entry_obj[key] = val if val != 'None' else None
|
||||
continue
|
||||
|
||||
# multiline field continuation lines
|
||||
multiline_list.append(line.strip())
|
||||
continue
|
||||
|
||||
# grab the last entry
|
||||
if entry_obj:
|
||||
if multiline_list:
|
||||
entry_obj[multiline_key] = multiline_list
|
||||
multiline_list = []
|
||||
multiline_key = ''
|
||||
raw_output.append(entry_obj)
|
||||
|
||||
return raw_output if raw else _process(raw_output)
|
@ -88,7 +88,7 @@ from jc.exceptions import ParseError
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.5'
|
||||
version = '1.6'
|
||||
description = '`ping` and `ping6` command streaming parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
@ -169,7 +169,7 @@ def _ipv6_in(line):
|
||||
return ipv6
|
||||
|
||||
|
||||
def _error_type(line):
|
||||
def _error_type_v4(line):
|
||||
# from https://github.com/dgibson/iputils/blob/master/ping.c
|
||||
# https://android.googlesource.com/platform/external/ping/+/8fc3c91cf9e7f87bc20b9e6d3ea2982d87b70d9a/ping.c
|
||||
# https://opensource.apple.com/source/network_cmds/network_cmds-328/ping.tproj/ping.c
|
||||
@ -207,6 +207,37 @@ def _error_type(line):
|
||||
return None
|
||||
|
||||
|
||||
def _error_type_v6(line):
|
||||
type_map = {
|
||||
'Destination unreachable': 'destination_unreachable',
|
||||
'Packet too big': 'packet_too_big',
|
||||
'Time exceeded:': 'time_exceeded',
|
||||
'Parameter problem:': 'parameter_problem',
|
||||
}
|
||||
code_map = {
|
||||
'destination_unreachable': {
|
||||
'No route': 'no_route',
|
||||
'Administratively prohibited': 'administratively_prohibited',
|
||||
"Beyond scope of source address": 'beyond_scope_of_source_address',
|
||||
'Address unreachable': 'address_unreachable',
|
||||
'Port unreachable': 'port_unreachable',
|
||||
},
|
||||
'time_exceeded': {
|
||||
'Hop limit': 'hop_limit',
|
||||
'Fragment reassembly time exceeded': 'fragment_reassembly_time_exceeded',
|
||||
},
|
||||
}
|
||||
|
||||
return_code = None
|
||||
for err_type, code in type_map.items():
|
||||
if err_type in line:
|
||||
return_code = code
|
||||
for err_code, code_name in code_map[code].items():
|
||||
if err_code in line:
|
||||
return_code += '_' + code_name
|
||||
return return_code
|
||||
|
||||
|
||||
def _bsd_parse(line, s):
|
||||
output_line = {}
|
||||
|
||||
@ -263,6 +294,24 @@ def _bsd_parse(line, s):
|
||||
|
||||
# ping response lines
|
||||
|
||||
err = None
|
||||
if s.ipv4:
|
||||
err = _error_type_v4(line)
|
||||
else:
|
||||
err = _error_type_v6(line)
|
||||
|
||||
if err:
|
||||
output_line = {
|
||||
'type': err
|
||||
}
|
||||
try:
|
||||
output_line['sent_bytes'] = line.split()[0]
|
||||
output_line['destination_ip'] = s.destination_ip
|
||||
output_line['response_ip'] = line.split()[4].strip(':').strip('(').strip(')')
|
||||
except Exception:
|
||||
pass
|
||||
return output_line
|
||||
|
||||
# ipv4 lines
|
||||
if not _ipv6_in(line):
|
||||
|
||||
@ -279,7 +328,7 @@ def _bsd_parse(line, s):
|
||||
return output_line
|
||||
|
||||
# catch error responses
|
||||
err = _error_type(line)
|
||||
err = _error_type_v4(line)
|
||||
if err:
|
||||
output_line = {
|
||||
'type': err
|
||||
@ -444,25 +493,40 @@ def _linux_parse(line, s):
|
||||
}
|
||||
return output_line
|
||||
|
||||
# if timestamp option is specified, then shift icmp sequence field right by one
|
||||
timestamp = False
|
||||
if line[0] == '[':
|
||||
timestamp = True
|
||||
|
||||
timestamp_offset = 1 if timestamp else 0
|
||||
|
||||
# ping response lines
|
||||
err = None
|
||||
if s.ipv4:
|
||||
err = _error_type_v4(line)
|
||||
else:
|
||||
err = _error_type_v6(line)
|
||||
|
||||
if err:
|
||||
output_line = {
|
||||
'type': err,
|
||||
'destination_ip': s.destination_ip or None,
|
||||
'sent_bytes': s.sent_bytes or None,
|
||||
'response_ip': line.split()[timestamp_offset + 1] if type != 'timeout' else None,
|
||||
'icmp_seq': line.replace('=', ' ').split()[timestamp_offset + 3],
|
||||
'timestamp': line.split()[0].lstrip('[').rstrip(']') if timestamp else None,
|
||||
}
|
||||
return output_line
|
||||
|
||||
# request timeout
|
||||
if 'no answer yet for icmp_seq=' in line:
|
||||
timestamp = False
|
||||
isequence = 5
|
||||
|
||||
# if timestamp option is specified, then shift icmp sequence field right by one
|
||||
if line[0] == '[':
|
||||
timestamp = True
|
||||
isequence = 6
|
||||
|
||||
output_line = {
|
||||
'type': 'timeout',
|
||||
'destination_ip': s.destination_ip or None,
|
||||
'sent_bytes': s.sent_bytes or None,
|
||||
'pattern': s.pattern or None,
|
||||
'timestamp': line.split()[0].lstrip('[').rstrip(']') if timestamp else None,
|
||||
'icmp_seq': line.replace('=', ' ').split()[isequence]
|
||||
'icmp_seq': line.replace('=', ' ').split()[timestamp_offset + 5]
|
||||
}
|
||||
|
||||
return output_line
|
||||
@ -473,20 +537,16 @@ def _linux_parse(line, s):
|
||||
line = line.replace('(', ' ').replace(')', ' ').replace('=', ' ')
|
||||
|
||||
# positions of items depend on whether ipv4/ipv6 and/or ip/hostname is used
|
||||
param_positions = None
|
||||
if s.ipv4 and not s.hostname:
|
||||
bts, rip, iseq, t2l, tms = (0, 3, 5, 7, 9)
|
||||
param_positions = (0, 3, 5, 7, 9)
|
||||
elif s.ipv4 and s.hostname:
|
||||
bts, rip, iseq, t2l, tms = (0, 4, 7, 9, 11)
|
||||
param_positions = (0, 4, 7, 9, 11)
|
||||
elif not s.ipv4 and not s.hostname:
|
||||
bts, rip, iseq, t2l, tms = (0, 3, 5, 7, 9)
|
||||
param_positions = (0, 3, 5, 7, 9)
|
||||
elif not s.ipv4 and s.hostname:
|
||||
bts, rip, iseq, t2l, tms = (0, 4, 7, 9, 11)
|
||||
|
||||
# if timestamp option is specified, then shift everything right by one
|
||||
timestamp = False
|
||||
if line[0] == '[':
|
||||
timestamp = True
|
||||
bts, rip, iseq, t2l, tms = (bts + 1, rip + 1, iseq + 1, t2l + 1, tms + 1)
|
||||
param_positions = (0, 4, 7, 9, 11)
|
||||
bts, rip, iseq, t2l, tms = (x + timestamp_offset for x in param_positions)
|
||||
|
||||
output_line = {
|
||||
'type': 'reply',
|
||||
|
@ -26,7 +26,7 @@ or
|
||||
|
||||
or
|
||||
|
||||
$ cat /proc/meminfo | jc --proc-memifno
|
||||
$ cat /proc/meminfo | jc --proc-meminfo
|
||||
|
||||
Usage (module):
|
||||
|
||||
|
@ -185,7 +185,7 @@ import jc.utils
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.8'
|
||||
version = '1.9'
|
||||
description = '`rpm -qi` command parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
@ -256,8 +256,6 @@ def parse(data, raw=False, quiet=False):
|
||||
|
||||
raw_output = []
|
||||
entry_obj = {}
|
||||
last_entry = None
|
||||
this_entry = None
|
||||
desc_entry = False
|
||||
desc_en_entry = False
|
||||
description = []
|
||||
@ -268,17 +266,13 @@ def parse(data, raw=False, quiet=False):
|
||||
split_line = line.split(': ', maxsplit=1)
|
||||
|
||||
if (split_line[0].startswith('Name') or split_line[0] == 'Package') and len(split_line) == 2:
|
||||
this_entry = split_line[1].strip()
|
||||
|
||||
if this_entry != last_entry:
|
||||
if entry_obj:
|
||||
if description:
|
||||
entry_obj['description'] = ' '.join(description)
|
||||
raw_output.append(entry_obj)
|
||||
entry_obj = {}
|
||||
last_entry = this_entry
|
||||
desc_entry = False
|
||||
desc_en_entry = False
|
||||
if entry_obj:
|
||||
if description:
|
||||
entry_obj['description'] = ' '.join(description)
|
||||
raw_output.append(entry_obj)
|
||||
entry_obj = {}
|
||||
desc_entry = False
|
||||
desc_en_entry = False
|
||||
|
||||
if line.startswith('Description :'):
|
||||
desc_entry = True
|
||||
|
@ -123,7 +123,7 @@ from copy import deepcopy
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.7'
|
||||
version = '1.8'
|
||||
description = '`traceroute` and `traceroute6` command parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
@ -167,7 +167,7 @@ SOFTWARE.
|
||||
RE_HEADER = re.compile(r'(\S+)\s+\((\d+\.\d+\.\d+\.\d+|[0-9a-fA-F:]+)\)')
|
||||
RE_PROBE_NAME_IP = re.compile(r'(\S+)\s+\((\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|[0-9a-fA-F:]+)\)+')
|
||||
RE_PROBE_IP_ONLY = re.compile(r'(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s+([^\(])')
|
||||
RE_PROBE_IPV6_ONLY = re.compile(r'(([a-f0-9:]+:+)+[a-f0-9]+)')
|
||||
RE_PROBE_IPV6_ONLY = re.compile(r'(([a-f0-9]*:)+[a-f0-9]+)')
|
||||
RE_PROBE_BSD_IPV6 = re.compile(r'\b(?:[A-Fa-f0-9]{1,4}:){7}[A-Fa-f0-9]{1,4}\b')
|
||||
RE_HOP = re.compile(r'^\s*(\d+)?\s+(.+)$')
|
||||
RE_PROBE_ASN = re.compile(r'\[AS(\d+)\]')
|
||||
|
@ -65,7 +65,7 @@ import jc.utils
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.9'
|
||||
version = '1.10'
|
||||
description = '`uptime` command parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
@ -162,7 +162,7 @@ def parse(data, raw=False, quiet=False):
|
||||
raw_output = {}
|
||||
|
||||
if jc.utils.has_data(data):
|
||||
if 'users' in data:
|
||||
if 'user' in data:
|
||||
# standard uptime output
|
||||
time, _, *uptime, users, _, _, _, load_1m, load_5m, load_15m = data.split()
|
||||
|
||||
|
273
jc/parsers/wg_show.py
Normal file
273
jc/parsers/wg_show.py
Normal file
@ -0,0 +1,273 @@
|
||||
r"""jc - JSON Convert `wg show` command output parser
|
||||
|
||||
Parses the output of the `wg show all dump` command, providing structured JSON output for easy integration and analysis.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ wg show all dump | jc --wg-show
|
||||
|
||||
or
|
||||
|
||||
$ jc wg show all dump
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('wg-show', wg_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"device": string,
|
||||
"private_key": string,
|
||||
"public_key": string,
|
||||
"listen_port": integer,
|
||||
"fwmark": integer,
|
||||
"peers": [
|
||||
{
|
||||
"public_key": string,
|
||||
"preshared_key": string,
|
||||
"endpoint": string,
|
||||
"latest_handshake": integer,
|
||||
"transfer_rx": integer,
|
||||
"transfer_sx": integer,
|
||||
"persistent_keepalive": integer,
|
||||
"allowed_ips": [
|
||||
string
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ wg show all dump | jc --wg-show -p
|
||||
[
|
||||
{
|
||||
"device": "wg0",
|
||||
"private_key": "aEbVdvHSEp3oofHDNVCsUoaRSxk1Og8/pTLof5yF+1M=",
|
||||
"public_key": "OIxbQszw1chdO5uigAxpsl4fc/h04yMYafl72gUbakM=",
|
||||
"listen_port": 51820,
|
||||
"fwmark": null,
|
||||
"peers": [
|
||||
{
|
||||
"public_key": "sQFGAhSdx0aC7DmTFojzBOW8Ccjv1XV5+N9FnkZu5zc=",
|
||||
"preshared_key": null,
|
||||
"endpoint": "79.134.136.199:40036",
|
||||
"latest_handshake": 1728809756,
|
||||
"transfer_rx": 1378724,
|
||||
"transfer_sx": 406524,
|
||||
"persistent_keepalive": null,
|
||||
"allowed_ips": ["10.10.0.2/32"]
|
||||
},
|
||||
{
|
||||
"public_key": "B9csmpvrv4Q7gpjc6zAbNNO8hIOYfpBqxmik2aNpwwE=",
|
||||
"preshared_key": null,
|
||||
"endpoint": "79.134.136.199:35946",
|
||||
"latest_handshake": 1728809756,
|
||||
"transfer_rx": 4884248,
|
||||
"transfer_sx": 3544596,
|
||||
"persistent_keepalive": null,
|
||||
"allowed_ips": ["10.10.0.3/32"]
|
||||
},
|
||||
{
|
||||
"public_key": "miiSYR5UdevREhlWpmnci+vv/dEGLHbNtKu7u1CuOD4=",
|
||||
"preshared_key": null,
|
||||
"allowed_ips": ["10.10.0.4/32"]
|
||||
},
|
||||
{
|
||||
"public_key": "gx9+JHLHJvOfBNjTmZ8KQAnThFFiZMQrX1kRaYcIYzw=",
|
||||
"preshared_key": null,
|
||||
"endpoint": "173.244.225.194:45014",
|
||||
"latest_handshake": 1728809827,
|
||||
"transfer_rx": 1363652,
|
||||
"transfer_sx": 458252,
|
||||
"persistent_keepalive": null,
|
||||
"allowed_ips": ["10.10.0.5/32"]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
$ wg show all dump | jc --wg-show -p -r
|
||||
[
|
||||
{
|
||||
"device": "wg0",
|
||||
"private_key": "aEbVdvHSEp3oofHDNVCsUoaRSxk1Og8/pTLof5yF+1M=",
|
||||
"public_key": "OIxbQszw1chdO5uigAxpsl4fc/h04yMYafl72gUbakM=",
|
||||
"listen_port": 51820,
|
||||
"fwmark": null,
|
||||
"peers": {
|
||||
"sQFGAhSdx0aC7DmTFojzBOW8Ccjv1XV5+N9FnkZu5zc=": {
|
||||
"preshared_key": null,
|
||||
"endpoint": "79.134.136.199:40036",
|
||||
"latest_handshake": 1728809756,
|
||||
"transfer_rx": 1378724,
|
||||
"transfer_sx": 406524,
|
||||
"persistent_keepalive": -1,
|
||||
"allowed_ips": ["10.10.0.2/32"]
|
||||
},
|
||||
"B9csmpvrv4Q7gpjc6zAbNNO8hIOYfpBqxmik2aNpwwE=": {
|
||||
"preshared_key": null,
|
||||
"endpoint": "79.134.136.199:35946",
|
||||
"latest_handshake": 1728809756,
|
||||
"transfer_rx": 4884248,
|
||||
"transfer_sx": 3544596,
|
||||
"persistent_keepalive": -1,
|
||||
"allowed_ips": ["10.10.0.3/32"]
|
||||
},
|
||||
"miiSYR5UdevREhlWpmnci+vv/dEGLHbNtKu7u1CuOD4=": {
|
||||
"preshared_key": null,
|
||||
"allowed_ips": ["10.10.0.4/32"]
|
||||
},
|
||||
"gx9+JHLHJvOfBNjTmZ8KQAnThFFiZMQrX1kRaYcIYzw=": {
|
||||
"preshared_key": null,
|
||||
"endpoint": "173.244.225.194:45014",
|
||||
"latest_handshake": 1728809827,
|
||||
"transfer_rx": 1363652,
|
||||
"transfer_sx": 458252,
|
||||
"persistent_keepalive": -1,
|
||||
"allowed_ips": ["10.10.0.5/32"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
"""
|
||||
|
||||
from typing import List, Dict, Optional, Union
|
||||
from jc.jc_types import JSONDictType
|
||||
import jc.utils
|
||||
import re
|
||||
|
||||
PeerData = Dict[str, Union[Optional[str], Optional[int], List[str]]]
|
||||
DeviceData = Dict[str, Union[Optional[str], Optional[int], Dict[str, PeerData]]]
|
||||
|
||||
|
||||
class info:
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
|
||||
version = "1.0"
|
||||
description = "`wg show` command parser"
|
||||
author = "Hamza Saht"
|
||||
author_email = "hamzasaht01@gmail.com"
|
||||
compatible = ["linux", "darwin", "cygwin", "win32", "aix", "freebsd"]
|
||||
tags = ["command"]
|
||||
magic_commands = ["wg show"]
|
||||
|
||||
|
||||
__version__ = info.version
|
||||
|
||||
|
||||
def _process(proc_data: List[DeviceData]) -> List[JSONDictType]:
|
||||
"""
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (List[Dict]) Raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List[Dict]: Structured data that conforms to the schema
|
||||
"""
|
||||
processed_data: List[JSONDictType] = []
|
||||
for device in proc_data:
|
||||
processed_device = {
|
||||
"device": device["device"],
|
||||
"private_key": device.get("private_key"),
|
||||
"public_key": device.get("public_key"),
|
||||
"listen_port": device.get("listen_port"),
|
||||
"fwmark": device.get("fwmark"),
|
||||
"peers": [
|
||||
{
|
||||
"public_key": peer_key,
|
||||
"preshared_key": peer_data.get("preshared_key"),
|
||||
"endpoint": peer_data.get("endpoint"),
|
||||
"latest_handshake": peer_data.get("latest_handshake", 0),
|
||||
"transfer_rx": peer_data.get("transfer_rx", 0),
|
||||
"transfer_sx": peer_data.get("transfer_sx", 0),
|
||||
"persistent_keepalive": peer_data.get("persistent_keepalive", -1),
|
||||
"allowed_ips": peer_data.get("allowed_ips", []),
|
||||
}
|
||||
for peer_key, peer_data in device.get("peers", {}).items()
|
||||
],
|
||||
}
|
||||
processed_data.append(processed_device)
|
||||
return processed_data
|
||||
|
||||
|
||||
def parse(data: str, raw: bool = False, quiet: bool = False) -> List[JSONDictType]:
|
||||
"""
|
||||
Main text parsing function.
|
||||
|
||||
Parses the output of the `wg` command, specifically `wg show all dump`, into structured JSON format.
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (str) Text data to parse, typically the output from `wg show all dump`
|
||||
raw: (bool) If True, returns unprocessed output
|
||||
quiet: (bool) Suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List[Dict]: Parsed data in JSON-friendly format, either raw or processed.
|
||||
"""
|
||||
jc.utils.compatibility(__name__, info.compatible, quiet)
|
||||
jc.utils.input_type_check(data)
|
||||
|
||||
raw_output: List[DeviceData] = []
|
||||
current_device: Optional[str] = None
|
||||
device_data: DeviceData = {}
|
||||
|
||||
if jc.utils.has_data(data):
|
||||
for line in filter(None, data.splitlines()):
|
||||
fields = re.split(r"\s+", line.strip())
|
||||
if len(fields) == 5:
|
||||
device, private_key, public_key, listen_port, fwmark = fields
|
||||
if current_device:
|
||||
raw_output.append({"device": current_device, **device_data})
|
||||
current_device = device
|
||||
device_data = {
|
||||
"private_key": private_key if private_key != "(none)" else None,
|
||||
"public_key": public_key if public_key != "(none)" else None,
|
||||
"listen_port": int(listen_port) if listen_port != "0" else None,
|
||||
"fwmark": int(fwmark) if fwmark != "off" else None,
|
||||
"peers": {},
|
||||
}
|
||||
elif len(fields) == 9:
|
||||
(
|
||||
interface,
|
||||
public_key,
|
||||
preshared_key,
|
||||
endpoint,
|
||||
allowed_ips,
|
||||
latest_handshake,
|
||||
transfer_rx,
|
||||
transfer_tx,
|
||||
persistent_keepalive,
|
||||
) = fields
|
||||
peer_data: PeerData = {
|
||||
"preshared_key": preshared_key
|
||||
if preshared_key != "(none)"
|
||||
else None,
|
||||
"endpoint": endpoint if endpoint != "(none)" else None,
|
||||
"latest_handshake": int(latest_handshake),
|
||||
"transfer_rx": int(transfer_rx),
|
||||
"transfer_sx": int(transfer_tx),
|
||||
"persistent_keepalive": int(persistent_keepalive)
|
||||
if persistent_keepalive != "off"
|
||||
else -1,
|
||||
"allowed_ips": allowed_ips.split(",")
|
||||
if allowed_ips != "(none)"
|
||||
else [],
|
||||
}
|
||||
device_data["peers"][public_key] = {
|
||||
k: v for k, v in peer_data.items() if v is not None
|
||||
}
|
||||
|
||||
if current_device:
|
||||
raw_output.append({"device": current_device, **device_data})
|
||||
|
||||
return raw_output if raw else _process(raw_output)
|
@ -87,7 +87,7 @@ from jc.exceptions import LibraryNotInstalled
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.7'
|
||||
version = '1.8'
|
||||
description = 'YAML file parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
@ -111,7 +111,6 @@ def _process(proc_data):
|
||||
|
||||
List of Dictionaries. Each dictionary represents a YAML document.
|
||||
"""
|
||||
|
||||
# No further processing
|
||||
return proc_data
|
||||
|
||||
@ -148,17 +147,20 @@ def parse(data, raw=False, quiet=False):
|
||||
# plugin code is incompatible with the pyoxidizer packager
|
||||
YAML.official_plug_ins = lambda a: []
|
||||
|
||||
yaml = YAML(typ='safe')
|
||||
# use the default `typ` to correctly load values that start with a literal "="
|
||||
yaml = YAML(typ=None)
|
||||
|
||||
# modify the timestamp constructor to output datetime objects as
|
||||
# strings since JSON does not support datetime objects
|
||||
yaml.constructor.yaml_constructors['tag:yaml.org,2002:timestamp'] = \
|
||||
yaml.constructor.yaml_constructors['tag:yaml.org,2002:str']
|
||||
|
||||
# modify the value constructor to output values starting with a
|
||||
# literal "=" as a string.
|
||||
yaml.constructor.yaml_constructors['tag:yaml.org,2002:value'] = \
|
||||
yaml.constructor.yaml_constructors['tag:yaml.org,2002:str']
|
||||
|
||||
for document in yaml.load_all(data):
|
||||
raw_output.append(document)
|
||||
|
||||
if raw:
|
||||
return raw_output
|
||||
else:
|
||||
return _process(raw_output)
|
||||
return raw_output if raw else _process(raw_output)
|
||||
|
38
jc/utils.py
38
jc/utils.py
@ -365,7 +365,11 @@ def convert_to_bool(value: object) -> bool:
|
||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
def convert_size_to_int(size: str, binary: bool = False) -> Optional[int]:
|
||||
def convert_size_to_int(
|
||||
size: str,
|
||||
binary: bool = False,
|
||||
posix_mode: bool = False,
|
||||
decimal_bias: bool = False) -> Optional[int]:
|
||||
"""
|
||||
Parse a human readable data size and return the number of bytes.
|
||||
|
||||
@ -375,6 +379,12 @@ def convert_size_to_int(size: str, binary: bool = False) -> Optional[int]:
|
||||
binary: (boolean) `True` to use binary multiples of bytes
|
||||
(base-2) for ambiguous unit symbols and names,
|
||||
`False` to use decimal multiples of bytes (base-10).
|
||||
posix_mode: (boolean) Treat one-letter units (k, m, g, etc.) as
|
||||
binary.
|
||||
decimal_bias: (boolean) `True` to treat slightly ambiguous two-
|
||||
letter unit symbols ending in "i" (e.g. Ki, Gi) to
|
||||
use decimal multiples of bytes (base-10). `False`
|
||||
(default) to use binary multiples of bytes.
|
||||
Returns:
|
||||
|
||||
integer/None Integer if successful conversion, otherwise None
|
||||
@ -394,6 +404,10 @@ def convert_size_to_int(size: str, binary: bool = False) -> Optional[int]:
|
||||
1000
|
||||
>>> convert_size_to_int('1 KiB')
|
||||
1024
|
||||
>>> convert_size_to_int('1 Ki')
|
||||
1024
|
||||
>>> convert_size_to_int('1 Ki', decimal_bias=True)
|
||||
1000
|
||||
>>> convert_size_to_int('1 KB', binary=True)
|
||||
1024
|
||||
>>> convert_size_to_int('1.5 GB')
|
||||
@ -441,17 +455,33 @@ def convert_size_to_int(size: str, binary: bool = False) -> Optional[int]:
|
||||
# Convert plural units to singular units, for details:
|
||||
# https://github.com/xolox/python-humanfriendly/issues/26
|
||||
normalized_unit = normalized_unit.rstrip('s')
|
||||
|
||||
# Handle POSIX mode units where `k`, `m`, etc. are treated as binary
|
||||
# https://www.gnu.org/software/coreutils/manual/html_node/Block-size.html
|
||||
if len(normalized_unit) == 1 and posix_mode:
|
||||
normalized_unit = normalized_unit + 'ib'
|
||||
|
||||
# Handle two-letter units (Ki, Gi, etc.) These are somewhat
|
||||
# ambiguous, but are treated as binary by default. This can be
|
||||
# changed with the `decimal_bias` parameter
|
||||
if len(normalized_unit) == 2 and normalized_unit[1].lower() == 'i':
|
||||
if decimal_bias:
|
||||
normalized_unit = normalized_unit[0]
|
||||
else:
|
||||
normalized_unit = normalized_unit + 'b'
|
||||
|
||||
for unit in disk_size_units:
|
||||
# First we check for unambiguous symbols (KiB, MiB, GiB, etc)
|
||||
# and names (kibibyte, mebibyte, gibibyte, etc) because their
|
||||
# handling is always the same.
|
||||
if normalized_unit in (unit.binary.symbol.lower(), unit.binary.name.lower()):
|
||||
return int(tokens[0] * unit.binary.divider)
|
||||
|
||||
# Now we will deal with ambiguous prefixes (K, M, G, etc),
|
||||
# symbols (KB, MB, GB, etc) and names (kilobyte, megabyte,
|
||||
# gigabyte, etc) according to the caller's preference.
|
||||
if (normalized_unit in (unit.decimal.symbol.lower(), unit.decimal.name.lower()) or
|
||||
normalized_unit.startswith(unit.decimal.symbol[0].lower())):
|
||||
if (normalized_unit in (unit.decimal.symbol.lower(), unit.decimal.name.lower())
|
||||
or normalized_unit.startswith(unit.decimal.symbol[0].lower())):
|
||||
return int(tokens[0] * (unit.binary.divider if binary else unit.decimal.divider))
|
||||
# We failed to parse the size specification.
|
||||
return None
|
||||
@ -666,12 +696,14 @@ class timestamp:
|
||||
{'id': 1700, 'format': '%m/%d/%Y, %I:%M:%S %p', 'locale': None}, # Windows english format wint non-UTC tz (found in systeminfo cli output): 3/22/2021, 1:15:51 PM (UTC-0600)
|
||||
{'id': 1705, 'format': '%m/%d/%Y, %I:%M:%S %p %Z', 'locale': None}, # Windows english format with UTC tz (found in systeminfo cli output): 3/22/2021, 1:15:51 PM (UTC)
|
||||
{'id': 1710, 'format': '%m/%d/%Y, %I:%M:%S %p UTC%z', 'locale': None}, # Windows english format with UTC tz (found in systeminfo cli output): 3/22/2021, 1:15:51 PM (UTC+0000)
|
||||
{'id': 1720, 'format': '%A, %B %d, %Y %I:%M:%S %p', 'locale': None}, # ipconfig cli output format: Thursday, June 22, 2023 10:39:04 AM
|
||||
{'id': 1750, 'format': '%Y/%m/%d-%H:%M:%S.%f', 'locale': None}, # Google Big Table format with no timezone: 1970/01/01-01:00:00.000000
|
||||
{'id': 1755, 'format': '%Y/%m/%d-%H:%M:%S.%f%z', 'locale': None}, # Google Big Table format with timezone: 1970/01/01-01:00:00.000000+00:00
|
||||
{'id': 1760, 'format': '%Y-%m-%d %H:%M:%S%z', 'locale': None}, # certbot format with timezone: 2023-06-12 01:35:30+00:00
|
||||
{'id': 1800, 'format': '%d/%b/%Y:%H:%M:%S %z', 'locale': None}, # Common Log Format: 10/Oct/2000:13:55:36 -0700
|
||||
{'id': 2000, 'format': '%a %d %b %Y %I:%M:%S %p %Z', 'locale': None}, # en_US.UTF-8 local format (found in upower cli output): Tue 23 Mar 2021 04:12:11 PM UTC
|
||||
{'id': 3000, 'format': '%a %d %b %Y %I:%M:%S %p', 'locale': None}, # en_US.UTF-8 local format with non-UTC tz (found in upower cli output): Tue 23 Mar 2021 04:12:11 PM IST
|
||||
{'id': 3100, 'format': '%a %d %b %Y %I:%M:%S %p %z', 'locale': None}, # pacman format - append 00 to end to make it work: # Sat 11 May 2024 06:14:19 AM +0800
|
||||
{'id': 3500, 'format': '%a, %d %b %Y %H:%M:%S %Z', 'locale': None}, # HTTP header time format (always GMT so assume UTC): Wed, 31 Jan 2024 00:39:28 GMT
|
||||
{'id': 4000, 'format': '%A %d %B %Y %I:%M:%S %p %Z', 'locale': None}, # European-style local format (found in upower cli output): Tuesday 01 October 2019 12:50:41 PM UTC
|
||||
{'id': 5000, 'format': '%A %d %B %Y %I:%M:%S %p', 'locale': None}, # European-style local format with non-UTC tz (found in upower cli output): Tuesday 01 October 2019 12:50:41 PM IST
|
||||
|
17
man/jc.1
17
man/jc.1
@ -1,4 +1,4 @@
|
||||
.TH jc 1 2024-06-09 1.25.3 "JSON Convert"
|
||||
.TH jc 1 2024-11-25 1.25.4 "JSON Convert"
|
||||
.SH NAME
|
||||
\fBjc\fP \- JSON Convert JSONifies the output of many CLI tools, file-types,
|
||||
and strings
|
||||
@ -347,6 +347,11 @@ INI with duplicate key file parser
|
||||
\fB--ip-address\fP
|
||||
IPv4 and IPv6 Address string parser
|
||||
|
||||
.TP
|
||||
.B
|
||||
\fB--ipconfig\fP
|
||||
`ipconfig` Windows command parser
|
||||
|
||||
.TP
|
||||
.B
|
||||
\fB--iptables\fP
|
||||
@ -507,6 +512,11 @@ openvpn-status.log file parser
|
||||
\fB--os-release\fP
|
||||
`/etc/os-release` file parser
|
||||
|
||||
.TP
|
||||
.B
|
||||
\fB--pacman\fP
|
||||
`pacman` command parser
|
||||
|
||||
.TP
|
||||
.B
|
||||
\fB--passwd\fP
|
||||
@ -1092,6 +1102,11 @@ Version string parser
|
||||
\fB--wc\fP
|
||||
`wc` command parser
|
||||
|
||||
.TP
|
||||
.B
|
||||
\fB--wg-show\fP
|
||||
`wg show` command parser
|
||||
|
||||
.TP
|
||||
.B
|
||||
\fB--who\fP
|
||||
|
2
setup.py
2
setup.py
@ -5,7 +5,7 @@ with open('README.md', 'r') as f:
|
||||
|
||||
setuptools.setup(
|
||||
name='jc',
|
||||
version='1.25.3',
|
||||
version='1.25.4',
|
||||
author='Kelly Brazil',
|
||||
author_email='kellyjonbrazil@gmail.com',
|
||||
description='Converts the output of popular command-line tools and file-types to JSON.',
|
||||
|
2
tests/fixtures/centos-7.7/df-h.json
vendored
2
tests/fixtures/centos-7.7/df-h.json
vendored
@ -1 +1 @@
|
||||
[{"filesystem":"devtmpfs","size":1900000000,"used":0,"mounted_on":"/dev","available":1900000000,"use_percent":0},{"filesystem":"tmpfs","size":1900000000,"used":0,"mounted_on":"/dev/shm","available":1900000000,"use_percent":0},{"filesystem":"tmpfs","size":1900000000,"used":12000000,"mounted_on":"/run","available":1900000000,"use_percent":1},{"filesystem":"tmpfs","size":1900000000,"used":0,"mounted_on":"/sys/fs/cgroup","available":1900000000,"use_percent":0},{"filesystem":"/dev/mapper/centos-root","size":17000000000,"used":1800000000,"mounted_on":"/","available":16000000000,"use_percent":11},{"filesystem":"/dev/sda1","size":1014000000,"used":233000000,"mounted_on":"/boot","available":782000000,"use_percent":23},{"filesystem":"tmpfs","size":378000000,"used":0,"mounted_on":"/run/user/1000","available":378000000,"use_percent":0}]
|
||||
[{"filesystem":"devtmpfs","size":2040109465,"used":0,"mounted_on":"/dev","available":2040109465,"use_percent":0},{"filesystem":"tmpfs","size":2040109465,"used":0,"mounted_on":"/dev/shm","available":2040109465,"use_percent":0},{"filesystem":"tmpfs","size":2040109465,"used":12582912,"mounted_on":"/run","available":2040109465,"use_percent":1},{"filesystem":"tmpfs","size":2040109465,"used":0,"mounted_on":"/sys/fs/cgroup","available":2040109465,"use_percent":0},{"filesystem":"/dev/mapper/centos-root","size":18253611008,"used":1932735283,"mounted_on":"/","available":17179869184,"use_percent":11},{"filesystem":"/dev/sda1","size":1063256064,"used":244318208,"mounted_on":"/boot","available":819986432,"use_percent":23},{"filesystem":"tmpfs","size":396361728,"used":0,"mounted_on":"/run/user/1000","available":396361728,"use_percent":0}]
|
||||
|
2
tests/fixtures/centos-7.7/iw-scan0.json
vendored
2
tests/fixtures/centos-7.7/iw-scan0.json
vendored
@ -1 +1 @@
|
||||
[{"bssid": "00:19:a9:cd:c6:80", "interface": "wlan0", "freq": 2412, "capability": "ESS ShortPreamble ShortSlotTime (0x0421)", "ssid": "Cisco1240", "supported_rates": [1.0, 2.0, 5.5, 6.0, 9.0, 11.0, 12.0, 18.0], "erp": "<no flags>", "extended_supported_rates": [24.0, 36.0, 48.0, 54.0], "wmm": "Parameter version 1", "be": "CW 15-1023, AIFSN 3", "bk": "CW 15-1023, AIFSN 7", "vi": "CW 7-15, AIFSN 2, TXOP 3008 usec", "vo": "CW 3-7, AIFSN 2, TXOP 1504 usec", "tsf_usec": 2984923701, "beacon_interval_tus": 100, "signal_dbm": -45.0, "last_seen_ms": 429, "selected_rates": [1.0, 2.0, 5.5, 11.0], "ds_parameter_set_channel": 1}, {"bssid": "d0:d0:fd:69:ca:70", "interface": "wlan0", "freq": 2462, "capability": "ESS ShortPreamble ShortSlotTime (0x0421)", "ssid": "Cisco1250", "supported_rates": [1.0, 2.0, 5.5, 6.0, 9.0, 11.0, 12.0, 18.0], "erp": "<no flags>", "extended_supported_rates": [24.0, 36.0, 48.0, 54.0], "wmm": "Parameter version 1", "be": "CW 15-1023, AIFSN 3", "bk": "CW 15-1023, AIFSN 7", "vi": "CW 7-15, AIFSN 2, TXOP 3008 usec", "vo": "acm CW 3-7, AIFSN 2, TXOP 1504 usec", "tsf_usec": 2968648942, "beacon_interval_tus": 102, "signal_dbm": -70.0, "last_seen_ms": 328, "selected_rates": [1.0, 2.0, 5.5, 11.0], "ds_parameter_set_channel": 11}]
|
||||
[{"bssid":"00:19:a9:cd:c6:80","interface":"wlan0","freq":2412,"capability":"ESS ShortPreamble ShortSlotTime (0x0421)","ssid":"Cisco1240","supported_rates":[1.0,2.0,5.5,6.0,9.0,11.0,12.0,18.0],"erp":"<no flags>","extended_supported_rates":[24.0,36.0,48.0,54.0],"wmm":"Parameter version 1","be":"CW 15-1023, AIFSN 3","bk":"CW 15-1023, AIFSN 7","vi":"CW 7-15, AIFSN 2, TXOP 3008 usec","vo":"CW 3-7, AIFSN 2, TXOP 1504 usec","tsf_usec":2984923701,"beacon_interval_tus":100,"signal_dbm":-45.0,"last_seen_ms":429,"selected_rates":[1.0,2.0,5.5,11.0],"ds_parameter_set_channel":1},{"bssid":"d0:d0:fd:69:ca:70","interface":"wlan0","freq":2462,"capability":"ESS ShortPreamble ShortSlotTime (0x0421)","ssid":"Cisco1250","supported_rates":[1.0,2.0,5.5,6.0,9.0,11.0,12.0,18.0],"erp":"<no flags>","extended_supported_rates":[24.0,36.0,48.0,54.0],"wmm":"Parameter version 1","be":"CW 15-1023, AIFSN 3","bk":"CW 15-1023, AIFSN 7","vi":"CW 7-15, AIFSN 2, TXOP 3008 usec","vo":"acm CW 3-7, AIFSN 2, TXOP 1504 usec","tsf_usec":2968648942,"beacon_interval_tus":102,"signal_dbm":-70.0,"last_seen_ms":328,"selected_rates":[1.0,2.0,5.5,11.0],"ds_parameter_set_channel":11}]
|
||||
|
2
tests/fixtures/centos-7.7/iw-scan1.json
vendored
2
tests/fixtures/centos-7.7/iw-scan1.json
vendored
File diff suppressed because one or more lines are too long
1
tests/fixtures/centos-7.7/iw-scan2.json
vendored
Normal file
1
tests/fixtures/centos-7.7/iw-scan2.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
[{"bssid":"xx:xx:xx:xx:3e:41","interface":"wlan0-1","freq":2412,"capability":"ESS (0x1431)","information_elements_from_probe_response_frame_ssid":"Troubleshooting","information_elements_from_probe_response_frame_rsn":"Version: 1","information_elements_from_probe_response_frame_group_cipher":"CCMP","information_elements_from_probe_response_frame_pairwise_ciphers":"CCMP","information_elements_from_probe_response_frame_authentication_suites":"PSK","information_elements_from_probe_response_frame_capabilities":"16-PTKSA-RC 1-GTKSA-RC (0x000c)","ht_capabilities_capabilities":"0x1ef","ht_capabilities_max_amsdu_length":"3839 bytes","ht_capabilities_minimum_rx_ampdu_time_spacing":"No restriction (0x00)","ht_capabilities_ht_rx_mcs_rate_indexes_supported":"0-15","ht_operation_primary_channel":1,"ht_operation_secondary_channel_offset":"no secondary","ht_operation_sta_channel_width":"20 MHz","vht_capabilities_0x33800192_max_mpdu_length":11454,"vht_capabilities_0x33800192_supported_channel_width":"neither 160 nor 80 80","vht_rx_mcs_set_1_streams":"MCS 0-9","vht_rx_mcs_set_2_streams":"MCS 0-9","vht_rx_mcs_set_3_streams":"not supported","vht_rx_mcs_set_4_streams":"not supported","vht_rx_mcs_set_5_streams":"not supported","vht_rx_mcs_set_6_streams":"not supported","vht_rx_mcs_set_7_streams":"not supported","vht_rx_mcs_set_8_streams":"not supported","vht_rx_mcs_set_vht_rx_highest_supported":"780 Mbps","vht_tx_mcs_set_1_streams":"MCS 0-9","vht_tx_mcs_set_2_streams":"MCS 0-9","vht_tx_mcs_set_3_streams":"not supported","vht_tx_mcs_set_4_streams":"not supported","vht_tx_mcs_set_5_streams":"not supported","vht_tx_mcs_set_6_streams":"not supported","vht_tx_mcs_set_7_streams":"not supported","vht_tx_mcs_set_8_streams":"not supported","vht_tx_mcs_set_vht_tx_highest_supported":"780 Mbps","vht_tx_mcs_set_vht_extended_nss":"not supported","vht_operation_channel_width":"0 (20 or 40 MHz)","vht_operation_center_freq_segment_1":0,"vht_operation_center_freq_segment_2":0,"vht_operation_vht_basic_mcs_set":"0xfffa","he_mac_capabilities_0x010102000040_minimum_payload_size_of_128_bytes":1,"he_mac_capabilities_0x010102000040_he_phy_capabilities":"(0x06304c090c008008020c00):","he_mac_capabilities_0x010102000040_device_class":1,"he_mac_capabilities_0x010102000040_dcm_max_constellation":1,"he_mac_capabilities_0x010102000040_dcm_max_constellation_rx":1,"he_mac_capabilities_0x010102000040_beamformee_sts_<=_80mhz":3,"he_mac_capabilities_0x010102000040_max_nc":1,"he_mac_capabilities_0x010102000040_1_streams":"MCS 0-11","he_mac_capabilities_0x010102000040_2_streams":"MCS 0-11","he_mac_capabilities_0x010102000040_3_streams":"not supported","he_mac_capabilities_0x010102000040_4_streams":"not supported","he_mac_capabilities_0x010102000040_5_streams":"not supported","he_mac_capabilities_0x010102000040_6_streams":"not supported","he_mac_capabilities_0x010102000040_7_streams":"not supported","he_mac_capabilities_0x010102000040_8_streams":"not supported","tsf_usec":608162896731,"beacon_interval_tus":100,"signal_dbm":-54.0,"last_seen_ms":1410}]
|
109
tests/fixtures/centos-7.7/iw-scan2.out
vendored
Normal file
109
tests/fixtures/centos-7.7/iw-scan2.out
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
BSS xx:xx:xx:xx:3e:41(on wlan0-1)
|
||||
last seen: 4206.107s [boottime]
|
||||
TSF: 608162896731 usec (7d, 00:56:02)
|
||||
freq: 2412
|
||||
beacon interval: 100 TUs
|
||||
capability: ESS (0x1431)
|
||||
signal: -54.00 dBm
|
||||
last seen: 1410 ms ago
|
||||
Information elements from Probe Response frame:
|
||||
SSID: Troubleshooting
|
||||
RSN: * Version: 1
|
||||
* Group cipher: CCMP
|
||||
* Pairwise ciphers: CCMP
|
||||
* Authentication suites: PSK
|
||||
* Capabilities: 16-PTKSA-RC 1-GTKSA-RC (0x000c)
|
||||
HT capabilities:
|
||||
Capabilities: 0x1ef
|
||||
RX LDPC
|
||||
HT20/HT40
|
||||
SM Power Save disabled
|
||||
RX HT20 SGI
|
||||
RX HT40 SGI
|
||||
TX STBC
|
||||
RX STBC 1-stream
|
||||
Max AMSDU length: 3839 bytes
|
||||
No DSSS/CCK HT40
|
||||
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
|
||||
Minimum RX AMPDU time spacing: No restriction (0x00)
|
||||
HT RX MCS rate indexes supported: 0-15
|
||||
HT TX MCS rate indexes are undefined
|
||||
HT operation:
|
||||
* primary channel: 1
|
||||
* secondary channel offset: no secondary
|
||||
* STA channel width: 20 MHz
|
||||
VHT capabilities:
|
||||
VHT Capabilities (0x33800192):
|
||||
Max MPDU length: 11454
|
||||
Supported Channel Width: neither 160 nor 80 80
|
||||
RX LDPC
|
||||
TX STBC
|
||||
RX antenna pattern consistency
|
||||
TX antenna pattern consistency
|
||||
VHT RX MCS set:
|
||||
1 streams: MCS 0-9
|
||||
2 streams: MCS 0-9
|
||||
3 streams: not supported
|
||||
4 streams: not supported
|
||||
5 streams: not supported
|
||||
6 streams: not supported
|
||||
7 streams: not supported
|
||||
8 streams: not supported
|
||||
VHT RX highest supported: 780 Mbps
|
||||
VHT TX MCS set:
|
||||
1 streams: MCS 0-9
|
||||
2 streams: MCS 0-9
|
||||
3 streams: not supported
|
||||
4 streams: not supported
|
||||
5 streams: not supported
|
||||
6 streams: not supported
|
||||
7 streams: not supported
|
||||
8 streams: not supported
|
||||
VHT TX highest supported: 780 Mbps
|
||||
VHT extended NSS: not supported
|
||||
VHT operation:
|
||||
* channel width: 0 (20 or 40 MHz)
|
||||
* center freq segment 1: 0
|
||||
* center freq segment 2: 0
|
||||
* VHT basic MCS set: 0xfffa
|
||||
HE capabilities:
|
||||
HE MAC Capabilities (0x010102000040):
|
||||
HTC HE Supported
|
||||
Minimum Payload size of 128 bytes: 1
|
||||
OM Control
|
||||
A-MSDU in A-MPDU
|
||||
HE PHY Capabilities: (0x06304c090c008008020c00):
|
||||
HE40/2.4GHz
|
||||
HE40/HE80/5GHz
|
||||
Device Class: 1
|
||||
LDPC Coding in Payload
|
||||
STBC Tx <= 80MHz
|
||||
STBC Rx <= 80MHz
|
||||
Full Bandwidth UL MU-MIMO
|
||||
DCM Max Constellation: 1
|
||||
DCM Max Constellation Rx: 1
|
||||
Beamformee STS <= 80Mhz: 3
|
||||
PPE Threshold Present
|
||||
Max NC: 1
|
||||
20MHz in 40MHz HE PPDU 2.4GHz
|
||||
TX 1024-QAM
|
||||
RX 1024-QAM
|
||||
HE RX MCS and NSS set <= 80 MHz
|
||||
1 streams: MCS 0-11
|
||||
2 streams: MCS 0-11
|
||||
3 streams: not supported
|
||||
4 streams: not supported
|
||||
5 streams: not supported
|
||||
6 streams: not supported
|
||||
7 streams: not supported
|
||||
8 streams: not supported
|
||||
HE TX MCS and NSS set <= 80 MHz
|
||||
1 streams: MCS 0-11
|
||||
2 streams: MCS 0-11
|
||||
3 streams: not supported
|
||||
4 streams: not supported
|
||||
5 streams: not supported
|
||||
6 streams: not supported
|
||||
7 streams: not supported
|
||||
8 streams: not supported
|
||||
PPE Threshold 0x19 0x1c 0xc7 0x71
|
37
tests/fixtures/generic/bluetoothctl_controller_with_manufacturer.out
vendored
Normal file
37
tests/fixtures/generic/bluetoothctl_controller_with_manufacturer.out
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
Controller 48:A4:72:3C:96:63 (public)
|
||||
Manufacturer: 0x0002 (2)
|
||||
Version: 0x08 (8)
|
||||
Name: ubuntu
|
||||
Alias: ubuntu
|
||||
Class: 0x007c0104 (8126724)
|
||||
Powered: yes
|
||||
Discoverable: yes
|
||||
DiscoverableTimeout: 0x000000b4 (180)
|
||||
Pairable: yes
|
||||
UUID: Message Notification Se.. (00001133-0000-1000-8000-00805f9b34fb)
|
||||
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
|
||||
UUID: OBEX Object Push (00001105-0000-1000-8000-00805f9b34fb)
|
||||
UUID: Message Access Server (00001132-0000-1000-8000-00805f9b34fb)
|
||||
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
|
||||
UUID: IrMC Sync (00001104-0000-1000-8000-00805f9b34fb)
|
||||
UUID: Vendor specific (00005005-0000-1000-8000-0002ee000001)
|
||||
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
|
||||
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
|
||||
UUID: Phonebook Access Server (0000112f-0000-1000-8000-00805f9b34fb)
|
||||
UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)
|
||||
UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
|
||||
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
|
||||
UUID: Handsfree Audio Gateway (0000111f-0000-1000-8000-00805f9b34fb)
|
||||
UUID: Audio Source (0000110a-0000-1000-8000-00805f9b34fb)
|
||||
UUID: OBEX File Transfer (00001106-0000-1000-8000-00805f9b34fb)
|
||||
UUID: Handsfree (0000111e-0000-1000-8000-00805f9b34fb)
|
||||
Modalias: usb:v1D6Bp0246d0548
|
||||
Discovering: yes
|
||||
Roles: central
|
||||
Roles: peripheral
|
||||
Advertising Features:
|
||||
ActiveInstances: 0x00 (0)
|
||||
SupportedInstances: 0x05 (5)
|
||||
SupportedIncludes: tx-power
|
||||
SupportedIncludes: appearance
|
||||
SupportedIncludes: local-name
|
1
tests/fixtures/generic/ethtool--link-partner-advertised-link-modes.json
vendored
Normal file
1
tests/fixtures/generic/ethtool--link-partner-advertised-link-modes.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"name":"eth0","supported_pause_frame_use":"Symmetric Receive-only","supports_auto_negotiation":true,"supported_fec_modes":[],"advertised_pause_frame_use":false,"advertised_auto_negotiation":true,"advertised_fec_modes":[],"link_partner_advertised_pause_frame_use":"Symmetric","link_partner_advertised_auto_negotiation":"Yes","link_partner_advertised_fec_modes":"Not reported","speed":"100Mb/s","duplex":"Full","port":"Twisted Pair","phyad":"0","transceiver":"external","auto_negotiation":false,"mdi_x":"Unknown","supports_wake_on":"d","wake_on":"d","link_detected":true,"supported_ports":["TP","MII"],"supported_link_modes":["10baseT/Half","10baseT/Full","100baseT/Half","100baseT/Full","1000baseT/Half","1000baseT/Full"],"advertised_link_modes":["10baseT/Half","10baseT/Full","100baseT/Half","100baseT/Full","1000baseT/Half","1000baseT/Full"],"link_partner_advertised_link_modes":["10baseT/Half","10baseT/Full","100baseT/Half","100baseT/Full"],"current_message_level":["0x00000007 (7)","drv probe link"],"speed_bps":100000000}
|
31
tests/fixtures/generic/ethtool--link-partner-advertised-link-modes.out
vendored
Normal file
31
tests/fixtures/generic/ethtool--link-partner-advertised-link-modes.out
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
Settings for eth0:
|
||||
Supported ports: [ TP MII ]
|
||||
Supported link modes: 10baseT/Half 10baseT/Full
|
||||
100baseT/Half 100baseT/Full
|
||||
1000baseT/Half 1000baseT/Full
|
||||
Supported pause frame use: Symmetric Receive-only
|
||||
Supports auto-negotiation: Yes
|
||||
Supported FEC modes: Not reported
|
||||
Advertised link modes: 10baseT/Half 10baseT/Full
|
||||
100baseT/Half 100baseT/Full
|
||||
1000baseT/Half 1000baseT/Full
|
||||
Advertised pause frame use: Symmetric Receive-only
|
||||
Advertised auto-negotiation: Yes
|
||||
Advertised FEC modes: Not reported
|
||||
Link partner advertised link modes: 10baseT/Half 10baseT/Full
|
||||
100baseT/Half 100baseT/Full
|
||||
Link partner advertised pause frame use: Symmetric
|
||||
Link partner advertised auto-negotiation: Yes
|
||||
Link partner advertised FEC modes: Not reported
|
||||
Speed: 100Mb/s
|
||||
Duplex: Full
|
||||
Port: Twisted Pair
|
||||
PHYAD: 0
|
||||
Transceiver: external
|
||||
Auto-negotiation: on
|
||||
MDI-X: Unknown
|
||||
Supports Wake-on: d
|
||||
Wake-on: d
|
||||
Current message level: 0x00000007 (7)
|
||||
drv probe link
|
||||
Link detected: yes
|
1
tests/fixtures/generic/mount-spaces-in-filename.json
vendored
Normal file
1
tests/fixtures/generic/mount-spaces-in-filename.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
[{"filesystem":"//10.100.1.237/Bilder und Videos","mount_point":"/mnt/smb/thw/media","type":"cifs","options":["rw","nosuid","nodev","relatime","vers=2.1","cache=strict","username=iweinmann","uid=1000","noforceuid","gid=1000","noforcegid","addr=10.100.1.237","file_mode=0755","dir_mode=0755","iocharset=utf8","soft","nounix","serverino","mapposix","rsize=1048576","wsize=1048576","bsize=1048576","retrans=1","echo_interval=60","actimeo=1","closetimeo=1","user=ingo"]}]
|
1
tests/fixtures/generic/mount-spaces-in-filename.out
vendored
Normal file
1
tests/fixtures/generic/mount-spaces-in-filename.out
vendored
Normal file
@ -0,0 +1 @@
|
||||
//10.100.1.237/Bilder und Videos on /mnt/smb/thw/media type cifs (rw,nosuid,nodev,relatime,vers=2.1,cache=strict,username=iweinmann,uid=1000,noforceuid,gid=1000,noforcegid,addr=10.100.1.237,file_mode=0755,dir_mode=0755,iocharset=utf8,soft,nounix,serverino,mapposix,rsize=1048576,wsize=1048576,bsize=1048576,retrans=1,echo_interval=60,actimeo=1,closetimeo=1,user=ingo)
|
@ -1 +1 @@
|
||||
[{"zone":"sunet.se","status":{"state":"ok","served-serial":"2023091302 since 2023-09-14T00:50:11","commit-serial":"2023091302 since 2023-09-14T07:04:05","wait":"27023 sec between attempts"}},{"zone":"catz.sunet.se","status":{"pattern":"example.catalog","catalog-member-id":"4b6f6ce2de5929e4.zones.example.catalog.","state":"ok","served-serial":"1705484863 since 2024-01-17T13:06:02","commit-serial":"1705484863 since 2024-01-17T13:06:02","wait":"21341 sec between attempts"}}]
|
||||
[{"zone":"sunet.se","status":{"state":"ok","served-serial":"2023091302 since 2023-09-14T00:50:11","commit-serial":"2023091302 since 2023-09-14T07:04:05","wait":"27023 sec between attempts"}},{"zone":"sunet.dev","status":{"state":"refreshing","served-serial":"2023095893 since 2024-10-10T10:10:35","commit-serial":"2023095893 since 2024-10-18T10:00:45","notified-serial":"2023095880 since 2024-10-19T06:11:35","transfer":"TCP connected to 192.168.1.100"}},{"zone":"catz.sunet.se","status":{"pattern":"example.catalog","catalog-member-id":"4b6f6ce2de5929e4.zones.example.catalog.","state":"ok","served-serial":"1705484863 since 2024-01-17T13:06:02","commit-serial":"1705484863 since 2024-01-17T13:06:02","wait":"21341 sec between attempts"}}]
|
||||
|
@ -3,6 +3,12 @@ zone: sunet.se
|
||||
served-serial: "2023091302 since 2023-09-14T00:50:11"
|
||||
commit-serial: "2023091302 since 2023-09-14T07:04:05"
|
||||
wait: "27023 sec between attempts"
|
||||
zone: sunet.dev
|
||||
state: refreshing
|
||||
served-serial: "2023095893 since 2024-10-10T10:10:35"
|
||||
commit-serial: "2023095893 since 2024-10-18T10:00:45"
|
||||
notified-serial: "2023095880 since 2024-10-19T06:11:35"
|
||||
transfer: "TCP connected to 192.168.1.100"
|
||||
zone: catz.sunet.se
|
||||
pattern: example.catalog
|
||||
catalog-member-id: 4b6f6ce2de5929e4.zones.example.catalog.
|
||||
|
1
tests/fixtures/generic/pacman--packages.json
vendored
Normal file
1
tests/fixtures/generic/pacman--packages.json
vendored
Normal file
File diff suppressed because one or more lines are too long
2011
tests/fixtures/generic/pacman--packages.out
vendored
Normal file
2011
tests/fixtures/generic/pacman--packages.out
vendored
Normal file
File diff suppressed because one or more lines are too long
1
tests/fixtures/generic/pacman--qii-zstd.json
vendored
Normal file
1
tests/fixtures/generic/pacman--qii-zstd.json
vendored
Normal file
File diff suppressed because one or more lines are too long
334
tests/fixtures/generic/pacman--qii-zstd.out
vendored
Normal file
334
tests/fixtures/generic/pacman--qii-zstd.out
vendored
Normal file
@ -0,0 +1,334 @@
|
||||
Name : zstd
|
||||
Version : 1.5.6-1
|
||||
Description : Zstandard - Fast real-time compression algorithm
|
||||
Architecture : x86_64
|
||||
URL : https://facebook.github.io/zstd/
|
||||
Licenses : BSD-3-Clause GPL-2.0-only
|
||||
Groups : None
|
||||
Provides : libzstd.so=1-64
|
||||
Depends On : glibc gcc-libs zlib xz lz4
|
||||
Optional Deps : None
|
||||
Required By : android-tools appstream avr-gcc binutils blender blosc
|
||||
boost-libs btrfs-progs cloudflare-warp-bin comgr curl
|
||||
dolphin-emu file flatpak gcc gdal gnutls karchive
|
||||
karchive5 kmod lib32-zstd libarchive libelf libtiff
|
||||
libva-mesa-driver libxmlb libzip lld llvm-libs mariadb-libs
|
||||
mesa mesa-vdpau minizip-ng mkinitcpio mold netcdf
|
||||
opencl-clover-mesa opencl-rusticl-mesa openucx postgresql
|
||||
postgresql-libs ppsspp qemu-img qemu-system-riscv
|
||||
qemu-system-x86 qgis qt6-base qt6-tools rsync rustup
|
||||
squashfs-tools squashfuse systemd-libs tiled vulkan-radeon
|
||||
wireshark-cli
|
||||
Optional For : xarchiver
|
||||
Conflicts With : None
|
||||
Replaces : None
|
||||
Installed Size : 1527.00 KiB
|
||||
Packager : Levente Polyak <anthraxx@archlinux.org>
|
||||
Build Date : Sat 11 May 2024 06:14:19 AM +08
|
||||
Install Date : Fri 24 May 2024 09:50:31 AM +08
|
||||
Install Reason : Installed as a dependency for another package
|
||||
Install Script : No
|
||||
Validated By : Signature
|
||||
Backup Files : None
|
||||
Extended Data : pkgtype=pkg
|
||||
|
||||
Name : apparmor
|
||||
Version : 3.1.7-4
|
||||
Description : Mandatory Access Control (MAC) using Linux Security Module (LSM)
|
||||
Architecture : x86_64
|
||||
URL : https://gitlab.com/apparmor/apparmor
|
||||
Licenses : GPL-2.0-only LGPL-2.0-only LGPL-2.1-only
|
||||
Groups : None
|
||||
Provides : libapparmor.so=1-64
|
||||
Depends On : audit bash gcc-libs glibc pam python
|
||||
Optional Deps : perl: for perl bindings [installed]
|
||||
python-notify2: for aa-notify
|
||||
python-psutil: for aa-notify [installed]
|
||||
ruby: for ruby bindings
|
||||
Required By : firejail
|
||||
Optional For : podman
|
||||
Conflicts With : None
|
||||
Replaces : None
|
||||
Installed Size : 4.11 MiB
|
||||
Packager : Antonio Rojas <arojas@archlinux.org>
|
||||
Build Date : Sun 01 Sep 2024 07:43:58 PM +08
|
||||
Install Date : Thu 05 Sep 2024 06:01:08 AM +08
|
||||
Install Reason : Explicitly installed
|
||||
Install Script : No
|
||||
Validated By : Signature
|
||||
Backup Files : /etc/apparmor/easyprof.conf [unmodified]
|
||||
/etc/apparmor/logprof.conf [unmodified]
|
||||
/etc/apparmor/notify.conf [unmodified]
|
||||
/etc/apparmor/parser.conf [unmodified]
|
||||
/etc/apparmor/severity.db [unmodified]
|
||||
/etc/apparmor.d/abi/3.0 [unmodified]
|
||||
/etc/apparmor.d/abi/kernel-5.4-outoftree-network [unmodified]
|
||||
/etc/apparmor.d/abi/kernel-5.4-vanilla [unmodified]
|
||||
/etc/apparmor.d/abstractions/X [unmodified]
|
||||
/etc/apparmor.d/abstractions/apache2-common [unmodified]
|
||||
/etc/apparmor.d/abstractions/apparmor_api/change_profile [unmodified]
|
||||
/etc/apparmor.d/abstractions/apparmor_api/examine [unmodified]
|
||||
/etc/apparmor.d/abstractions/apparmor_api/find_mountpoint [unmodified]
|
||||
/etc/apparmor.d/abstractions/apparmor_api/introspect [unmodified]
|
||||
/etc/apparmor.d/abstractions/apparmor_api/is_enabled [unmodified]
|
||||
/etc/apparmor.d/abstractions/aspell [unmodified]
|
||||
/etc/apparmor.d/abstractions/audio [unmodified]
|
||||
/etc/apparmor.d/abstractions/authentication [unmodified]
|
||||
/etc/apparmor.d/abstractions/base [unmodified]
|
||||
/etc/apparmor.d/abstractions/bash [unmodified]
|
||||
/etc/apparmor.d/abstractions/consoles [unmodified]
|
||||
/etc/apparmor.d/abstractions/crypto [unmodified]
|
||||
/etc/apparmor.d/abstractions/cups-client [unmodified]
|
||||
/etc/apparmor.d/abstractions/dbus [unmodified]
|
||||
/etc/apparmor.d/abstractions/dbus-accessibility [unmodified]
|
||||
/etc/apparmor.d/abstractions/dbus-accessibility-strict [unmodified]
|
||||
/etc/apparmor.d/abstractions/dbus-network-manager-strict [unmodified]
|
||||
/etc/apparmor.d/abstractions/dbus-session [unmodified]
|
||||
/etc/apparmor.d/abstractions/dbus-session-strict [unmodified]
|
||||
/etc/apparmor.d/abstractions/dbus-strict [unmodified]
|
||||
/etc/apparmor.d/abstractions/dconf [unmodified]
|
||||
/etc/apparmor.d/abstractions/dovecot-common [unmodified]
|
||||
/etc/apparmor.d/abstractions/dri-common [unmodified]
|
||||
/etc/apparmor.d/abstractions/dri-enumerate [unmodified]
|
||||
/etc/apparmor.d/abstractions/enchant [unmodified]
|
||||
/etc/apparmor.d/abstractions/exo-open [unmodified]
|
||||
/etc/apparmor.d/abstractions/fcitx [unmodified]
|
||||
/etc/apparmor.d/abstractions/fcitx-strict [unmodified]
|
||||
/etc/apparmor.d/abstractions/fonts [unmodified]
|
||||
/etc/apparmor.d/abstractions/freedesktop.org [unmodified]
|
||||
/etc/apparmor.d/abstractions/gio-open [unmodified]
|
||||
/etc/apparmor.d/abstractions/gnome [unmodified]
|
||||
/etc/apparmor.d/abstractions/gnupg [unmodified]
|
||||
/etc/apparmor.d/abstractions/groff [unmodified]
|
||||
/etc/apparmor.d/abstractions/gtk [unmodified]
|
||||
/etc/apparmor.d/abstractions/gvfs-open [unmodified]
|
||||
/etc/apparmor.d/abstractions/hosts_access [unmodified]
|
||||
/etc/apparmor.d/abstractions/ibus [unmodified]
|
||||
/etc/apparmor.d/abstractions/kde [unmodified]
|
||||
/etc/apparmor.d/abstractions/kde-globals-write [unmodified]
|
||||
/etc/apparmor.d/abstractions/kde-icon-cache-write [unmodified]
|
||||
/etc/apparmor.d/abstractions/kde-language-write [unmodified]
|
||||
/etc/apparmor.d/abstractions/kde-open5 [unmodified]
|
||||
/etc/apparmor.d/abstractions/kerberosclient [unmodified]
|
||||
/etc/apparmor.d/abstractions/ldapclient [unmodified]
|
||||
/etc/apparmor.d/abstractions/libpam-systemd [unmodified]
|
||||
/etc/apparmor.d/abstractions/likewise [unmodified]
|
||||
/etc/apparmor.d/abstractions/mdns [unmodified]
|
||||
/etc/apparmor.d/abstractions/mesa [unmodified]
|
||||
/etc/apparmor.d/abstractions/mir [unmodified]
|
||||
/etc/apparmor.d/abstractions/mozc [unmodified]
|
||||
/etc/apparmor.d/abstractions/mysql [unmodified]
|
||||
/etc/apparmor.d/abstractions/nameservice [unmodified]
|
||||
/etc/apparmor.d/abstractions/nis [unmodified]
|
||||
/etc/apparmor.d/abstractions/nss-systemd [unmodified]
|
||||
/etc/apparmor.d/abstractions/nvidia [unmodified]
|
||||
/etc/apparmor.d/abstractions/opencl [unmodified]
|
||||
/etc/apparmor.d/abstractions/opencl-common [unmodified]
|
||||
/etc/apparmor.d/abstractions/opencl-intel [unmodified]
|
||||
/etc/apparmor.d/abstractions/opencl-mesa [unmodified]
|
||||
/etc/apparmor.d/abstractions/opencl-nvidia [unmodified]
|
||||
/etc/apparmor.d/abstractions/opencl-pocl [unmodified]
|
||||
/etc/apparmor.d/abstractions/openssl [unmodified]
|
||||
/etc/apparmor.d/abstractions/orbit2 [unmodified]
|
||||
/etc/apparmor.d/abstractions/p11-kit [unmodified]
|
||||
/etc/apparmor.d/abstractions/perl [unmodified]
|
||||
/etc/apparmor.d/abstractions/php [unmodified]
|
||||
/etc/apparmor.d/abstractions/php-worker [unmodified]
|
||||
/etc/apparmor.d/abstractions/php5 [unmodified]
|
||||
/etc/apparmor.d/abstractions/postfix-common [unmodified]
|
||||
/etc/apparmor.d/abstractions/private-files [unmodified]
|
||||
/etc/apparmor.d/abstractions/private-files-strict [unmodified]
|
||||
/etc/apparmor.d/abstractions/python [unmodified]
|
||||
/etc/apparmor.d/abstractions/qt5 [unmodified]
|
||||
/etc/apparmor.d/abstractions/qt5-compose-cache-write [unmodified]
|
||||
/etc/apparmor.d/abstractions/qt5-settings-write [unmodified]
|
||||
/etc/apparmor.d/abstractions/recent-documents-write [unmodified]
|
||||
/etc/apparmor.d/abstractions/ruby [unmodified]
|
||||
/etc/apparmor.d/abstractions/samba [unmodified]
|
||||
/etc/apparmor.d/abstractions/samba-rpcd [unmodified]
|
||||
/etc/apparmor.d/abstractions/smbpass [unmodified]
|
||||
/etc/apparmor.d/abstractions/snap_browsers [unmodified]
|
||||
/etc/apparmor.d/abstractions/ssl_certs [unmodified]
|
||||
/etc/apparmor.d/abstractions/ssl_keys [unmodified]
|
||||
/etc/apparmor.d/abstractions/svn-repositories [unmodified]
|
||||
/etc/apparmor.d/abstractions/trash [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-bittorrent-clients [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-browsers [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-browsers.d/chromium-browser [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-browsers.d/java [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-browsers.d/kde [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-browsers.d/mailto [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-browsers.d/multimedia [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-browsers.d/plugins-common [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-browsers.d/productivity [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-browsers.d/text-editors [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-browsers.d/ubuntu-integration [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-browsers.d/ubuntu-integration-xul [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-browsers.d/user-files [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-console-browsers [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-console-email [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-email [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-feed-readers [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-gnome-terminal [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-helpers [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-konsole [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-media-players [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-unity7-base [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-unity7-launcher [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-unity7-messaging [unmodified]
|
||||
/etc/apparmor.d/abstractions/ubuntu-xterm [unmodified]
|
||||
/etc/apparmor.d/abstractions/user-download [unmodified]
|
||||
/etc/apparmor.d/abstractions/user-mail [unmodified]
|
||||
/etc/apparmor.d/abstractions/user-manpages [unmodified]
|
||||
/etc/apparmor.d/abstractions/user-tmp [unmodified]
|
||||
/etc/apparmor.d/abstractions/user-write [unmodified]
|
||||
/etc/apparmor.d/abstractions/video [unmodified]
|
||||
/etc/apparmor.d/abstractions/vulkan [unmodified]
|
||||
/etc/apparmor.d/abstractions/wayland [unmodified]
|
||||
/etc/apparmor.d/abstractions/web-data [unmodified]
|
||||
/etc/apparmor.d/abstractions/winbind [unmodified]
|
||||
/etc/apparmor.d/abstractions/wutmp [unmodified]
|
||||
/etc/apparmor.d/abstractions/xad [unmodified]
|
||||
/etc/apparmor.d/abstractions/xdg-desktop [unmodified]
|
||||
/etc/apparmor.d/abstractions/xdg-open [unmodified]
|
||||
/etc/apparmor.d/apache2.d/phpsysinfo [unmodified]
|
||||
/etc/apparmor.d/bin.ping [unmodified]
|
||||
/etc/apparmor.d/local/README [unmodified]
|
||||
/etc/apparmor.d/local/bin.ping [unmodified]
|
||||
/etc/apparmor.d/local/lsb_release [unmodified]
|
||||
/etc/apparmor.d/local/nvidia_modprobe [unmodified]
|
||||
/etc/apparmor.d/local/php-fpm [unmodified]
|
||||
/etc/apparmor.d/local/samba-bgqd [unmodified]
|
||||
/etc/apparmor.d/local/samba-dcerpcd [unmodified]
|
||||
/etc/apparmor.d/local/samba-rpcd [unmodified]
|
||||
/etc/apparmor.d/local/samba-rpcd-classic [unmodified]
|
||||
/etc/apparmor.d/local/samba-rpcd-spoolss [unmodified]
|
||||
/etc/apparmor.d/local/sbin.klogd [unmodified]
|
||||
/etc/apparmor.d/local/sbin.syslog-ng [unmodified]
|
||||
/etc/apparmor.d/local/sbin.syslogd [unmodified]
|
||||
/etc/apparmor.d/local/usr.lib.apache2.mpm-prefork.apache2 [unmodified]
|
||||
/etc/apparmor.d/local/usr.lib.dovecot.anvil [unmodified]
|
||||
/etc/apparmor.d/local/usr.lib.dovecot.auth [unmodified]
|
||||
/etc/apparmor.d/local/usr.lib.dovecot.config [unmodified]
|
||||
/etc/apparmor.d/local/usr.lib.dovecot.deliver [unmodified]
|
||||
/etc/apparmor.d/local/usr.lib.dovecot.dict [unmodified]
|
||||
/etc/apparmor.d/local/usr.lib.dovecot.director [unmodified]
|
||||
/etc/apparmor.d/local/usr.lib.dovecot.doveadm-server [unmodified]
|
||||
/etc/apparmor.d/local/usr.lib.dovecot.dovecot-auth [unmodified]
|
||||
/etc/apparmor.d/local/usr.lib.dovecot.dovecot-lda [unmodified]
|
||||
/etc/apparmor.d/local/usr.lib.dovecot.imap [unmodified]
|
||||
/etc/apparmor.d/local/usr.lib.dovecot.imap-login [unmodified]
|
||||
/etc/apparmor.d/local/usr.lib.dovecot.lmtp [unmodified]
|
||||
/etc/apparmor.d/local/usr.lib.dovecot.log [unmodified]
|
||||
/etc/apparmor.d/local/usr.lib.dovecot.managesieve [unmodified]
|
||||
/etc/apparmor.d/local/usr.lib.dovecot.managesieve-login [unmodified]
|
||||
/etc/apparmor.d/local/usr.lib.dovecot.pop3 [unmodified]
|
||||
/etc/apparmor.d/local/usr.lib.dovecot.pop3-login [unmodified]
|
||||
/etc/apparmor.d/local/usr.lib.dovecot.replicator [unmodified]
|
||||
/etc/apparmor.d/local/usr.lib.dovecot.script-login [unmodified]
|
||||
/etc/apparmor.d/local/usr.lib.dovecot.ssl-params [unmodified]
|
||||
/etc/apparmor.d/local/usr.lib.dovecot.stats [unmodified]
|
||||
/etc/apparmor.d/local/usr.sbin.apache2 [unmodified]
|
||||
/etc/apparmor.d/local/usr.sbin.avahi-daemon [unmodified]
|
||||
/etc/apparmor.d/local/usr.sbin.dnsmasq [unmodified]
|
||||
/etc/apparmor.d/local/usr.sbin.dovecot [unmodified]
|
||||
/etc/apparmor.d/local/usr.sbin.identd [unmodified]
|
||||
/etc/apparmor.d/local/usr.sbin.mdnsd [unmodified]
|
||||
/etc/apparmor.d/local/usr.sbin.nmbd [unmodified]
|
||||
/etc/apparmor.d/local/usr.sbin.nscd [unmodified]
|
||||
/etc/apparmor.d/local/usr.sbin.ntpd [unmodified]
|
||||
/etc/apparmor.d/local/usr.sbin.smbd [unmodified]
|
||||
/etc/apparmor.d/local/usr.sbin.smbldap-useradd [unmodified]
|
||||
/etc/apparmor.d/local/usr.sbin.traceroute [unmodified]
|
||||
/etc/apparmor.d/local/usr.sbin.winbindd [unmodified]
|
||||
/etc/apparmor.d/local/zgrep [unmodified]
|
||||
/etc/apparmor.d/lsb_release [unmodified]
|
||||
/etc/apparmor.d/nvidia_modprobe [unmodified]
|
||||
/etc/apparmor.d/php-fpm [unmodified]
|
||||
/etc/apparmor.d/samba-bgqd [unmodified]
|
||||
/etc/apparmor.d/samba-dcerpcd [unmodified]
|
||||
/etc/apparmor.d/samba-rpcd [unmodified]
|
||||
/etc/apparmor.d/samba-rpcd-classic [unmodified]
|
||||
/etc/apparmor.d/samba-rpcd-spoolss [unmodified]
|
||||
/etc/apparmor.d/sbin.klogd [unmodified]
|
||||
/etc/apparmor.d/sbin.syslog-ng [unmodified]
|
||||
/etc/apparmor.d/sbin.syslogd [unmodified]
|
||||
/etc/apparmor.d/tunables/alias [unmodified]
|
||||
/etc/apparmor.d/tunables/apparmorfs [unmodified]
|
||||
/etc/apparmor.d/tunables/dovecot [unmodified]
|
||||
/etc/apparmor.d/tunables/etc [unmodified]
|
||||
/etc/apparmor.d/tunables/global [unmodified]
|
||||
/etc/apparmor.d/tunables/home [unmodified]
|
||||
/etc/apparmor.d/tunables/home.d/site.local [unmodified]
|
||||
/etc/apparmor.d/tunables/kernelvars [unmodified]
|
||||
/etc/apparmor.d/tunables/multiarch [unmodified]
|
||||
/etc/apparmor.d/tunables/multiarch.d/site.local [unmodified]
|
||||
/etc/apparmor.d/tunables/ntpd [unmodified]
|
||||
/etc/apparmor.d/tunables/proc [unmodified]
|
||||
/etc/apparmor.d/tunables/run [unmodified]
|
||||
/etc/apparmor.d/tunables/securityfs [unmodified]
|
||||
/etc/apparmor.d/tunables/share [unmodified]
|
||||
/etc/apparmor.d/tunables/sys [unmodified]
|
||||
/etc/apparmor.d/tunables/xdg-user-dirs [unmodified]
|
||||
/etc/apparmor.d/tunables/xdg-user-dirs.d/site.local [unmodified]
|
||||
/etc/apparmor.d/usr.lib.apache2.mpm-prefork.apache2 [unmodified]
|
||||
/etc/apparmor.d/usr.lib.dovecot.anvil [unmodified]
|
||||
/etc/apparmor.d/usr.lib.dovecot.auth [unmodified]
|
||||
/etc/apparmor.d/usr.lib.dovecot.config [unmodified]
|
||||
/etc/apparmor.d/usr.lib.dovecot.deliver [unmodified]
|
||||
/etc/apparmor.d/usr.lib.dovecot.dict [unmodified]
|
||||
/etc/apparmor.d/usr.lib.dovecot.director [unmodified]
|
||||
/etc/apparmor.d/usr.lib.dovecot.doveadm-server [unmodified]
|
||||
/etc/apparmor.d/usr.lib.dovecot.dovecot-auth [unmodified]
|
||||
/etc/apparmor.d/usr.lib.dovecot.dovecot-lda [unmodified]
|
||||
/etc/apparmor.d/usr.lib.dovecot.imap [unmodified]
|
||||
/etc/apparmor.d/usr.lib.dovecot.imap-login [unmodified]
|
||||
/etc/apparmor.d/usr.lib.dovecot.lmtp [unmodified]
|
||||
/etc/apparmor.d/usr.lib.dovecot.log [unmodified]
|
||||
/etc/apparmor.d/usr.lib.dovecot.managesieve [unmodified]
|
||||
/etc/apparmor.d/usr.lib.dovecot.managesieve-login [unmodified]
|
||||
/etc/apparmor.d/usr.lib.dovecot.pop3 [unmodified]
|
||||
/etc/apparmor.d/usr.lib.dovecot.pop3-login [unmodified]
|
||||
/etc/apparmor.d/usr.lib.dovecot.replicator [unmodified]
|
||||
/etc/apparmor.d/usr.lib.dovecot.script-login [unmodified]
|
||||
/etc/apparmor.d/usr.lib.dovecot.ssl-params [unmodified]
|
||||
/etc/apparmor.d/usr.lib.dovecot.stats [unmodified]
|
||||
/etc/apparmor.d/usr.sbin.apache2 [unmodified]
|
||||
/etc/apparmor.d/usr.sbin.avahi-daemon [unmodified]
|
||||
/etc/apparmor.d/usr.sbin.dnsmasq [unmodified]
|
||||
/etc/apparmor.d/usr.sbin.dovecot [unmodified]
|
||||
/etc/apparmor.d/usr.sbin.identd [unmodified]
|
||||
/etc/apparmor.d/usr.sbin.mdnsd [unmodified]
|
||||
/etc/apparmor.d/usr.sbin.nmbd [unmodified]
|
||||
/etc/apparmor.d/usr.sbin.nscd [unmodified]
|
||||
/etc/apparmor.d/usr.sbin.ntpd [unmodified]
|
||||
/etc/apparmor.d/usr.sbin.smbd [unmodified]
|
||||
/etc/apparmor.d/usr.sbin.smbldap-useradd [unmodified]
|
||||
/etc/apparmor.d/usr.sbin.traceroute [unmodified]
|
||||
/etc/apparmor.d/usr.sbin.winbindd [unmodified]
|
||||
/etc/apparmor.d/zgrep [unmodified]
|
||||
Extended Data : pkgtype=pkg
|
||||
|
||||
Name : apulse
|
||||
Version : 0.1.13-1
|
||||
Description : PulseAudio emulation for ALSA
|
||||
Architecture : x86_64
|
||||
URL : https://github.com/i-rinat/apulse
|
||||
Licenses : custom:MIT
|
||||
Groups : None
|
||||
Provides : None
|
||||
Depends On : alsa-lib glib2
|
||||
Optional Deps : None
|
||||
Required By : None
|
||||
Optional For : None
|
||||
Conflicts With : None
|
||||
Replaces : None
|
||||
Installed Size : 135.71 KiB
|
||||
Packager : Unknown Packager
|
||||
Build Date : Fri 05 Aug 2022 04:06:57 AM +08
|
||||
Install Date : Fri 05 Aug 2022 04:07:04 AM +08
|
||||
Install Reason : Explicitly installed
|
||||
Install Script : Yes
|
||||
Validated By : None
|
||||
Backup Files : None
|
||||
Extended Data : None
|
1
tests/fixtures/generic/pacman--si-graphicsmagick.json
vendored
Normal file
1
tests/fixtures/generic/pacman--si-graphicsmagick.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
[{"repository":"extra","name":"graphicsmagick","version":"1.3.43-1","description":"Image processing system","architecture":"x86_64","url":"http://www.graphicsmagick.org/","licenses":["MIT"],"groups":[],"provides":["Magick.so","libGraphicsMagickWand.so=2-64","libGraphicsMagick.so=3-64","libGraphicsMagick++-Q16.so"],"depends_on":["bzip2","freetype2","lcms2","libltdl","libpng","libsm","libtiff","libwebp","libxext","xz"],"optional_deps":[{"name":"jasper","description":"jp2 module"},{"name":"libwmf","description":"wmf module"},{"name":"libxml2","description":"msl, svg, url modules"},{"name":"ghostscript","description":"pdf, ps modules"},{"name":"libheif","description":"heic module"},{"name":"libjxl","description":"jpeg-xl module"}],"conflicts_with":[],"replaces":[],"download_size":"2.58 MiB","installed_size":"13.97 MiB","packager":"Caleb Maclennan <alerque@archlinux.org>","build_date":"Sat 23 Mar 2024 09:55:47 PM CET","validated_by":["MD5 Sum","SHA-256 Sum","Signature"],"download_size_bytes":2705326,"installed_size_bytes":14648606,"build_date_epoch":1711256147}]
|
23
tests/fixtures/generic/pacman--si-graphicsmagick.out
vendored
Normal file
23
tests/fixtures/generic/pacman--si-graphicsmagick.out
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
Repository : extra
|
||||
Name : graphicsmagick
|
||||
Version : 1.3.43-1
|
||||
Description : Image processing system
|
||||
Architecture : x86_64
|
||||
URL : http://www.graphicsmagick.org/
|
||||
Licenses : MIT
|
||||
Groups : None
|
||||
Provides : Magick.so libGraphicsMagickWand.so=2-64 libGraphicsMagick.so=3-64 libGraphicsMagick++-Q16.so
|
||||
Depends On : bzip2 freetype2 lcms2 libltdl libpng libsm libtiff libwebp libxext xz
|
||||
Optional Deps : jasper: jp2 module
|
||||
libwmf: wmf module
|
||||
libxml2: msl, svg, url modules
|
||||
ghostscript: pdf, ps modules
|
||||
libheif: heic module
|
||||
libjxl: jpeg-xl module
|
||||
Conflicts With : None
|
||||
Replaces : None
|
||||
Download Size : 2.58 MiB
|
||||
Installed Size : 13.97 MiB
|
||||
Packager : Caleb Maclennan <alerque@archlinux.org>
|
||||
Build Date : Sat 23 Mar 2024 09:55:47 PM CET
|
||||
Validated By : MD5 Sum SHA-256 Sum Signature
|
2
tests/fixtures/generic/pkg-index-deb.json
vendored
2
tests/fixtures/generic/pkg-index-deb.json
vendored
File diff suppressed because one or more lines are too long
2
tests/fixtures/osx-10.11.6/df-h.json
vendored
2
tests/fixtures/osx-10.11.6/df-h.json
vendored
@ -1 +1 @@
|
||||
[{"filesystem":"/dev/disk1s1","size":466000000000,"used":137000000000,"iused":674413,"ifree":9223372036854101394,"mounted_on":"/","available":326000000000,"capacity_percent":30,"iused_percent":0},{"filesystem":"devfs","size":188000,"used":188000,"iused":650,"ifree":0,"mounted_on":"/dev","available":0,"capacity_percent":100,"iused_percent":100},{"filesystem":"/dev/disk1s4","size":466000000000,"used":2000000000,"iused":2,"ifree":9223372036854775805,"mounted_on":"/private/var/vm","available":326000000000,"capacity_percent":1,"iused_percent":0},{"filesystem":"map -hosts","size":0,"used":0,"iused":0,"ifree":0,"mounted_on":"/net","available":0,"capacity_percent":100,"iused_percent":100},{"filesystem":"map auto_home","size":0,"used":0,"iused":0,"ifree":0,"mounted_on":"/home","available":0,"capacity_percent":100,"iused_percent":100},{"filesystem":"//brazil@MyCloudEX2Ultra._afpovertcp._tcp.local/brazil","size":3500000000000,"used":1100000000000,"iused":301134832,"ifree":649465741,"mounted_on":"/Volumes/brazil","available":2400000000000,"capacity_percent":32,"iused_percent":32}]
|
||||
[{"filesystem":"/dev/disk1s1","size":500363689984,"used":147102629888,"iused":674413,"ifree":9223372036854101394,"mounted_on":"/","available":350039834624,"capacity_percent":30,"iused_percent":0},{"filesystem":"devfs","size":192512,"used":192512,"iused":650,"ifree":0,"mounted_on":"/dev","available":0,"capacity_percent":100,"iused_percent":100},{"filesystem":"/dev/disk1s4","size":500363689984,"used":2147483648,"iused":2,"ifree":9223372036854775805,"mounted_on":"/private/var/vm","available":350039834624,"capacity_percent":1,"iused_percent":0},{"filesystem":"map -hosts","size":0,"used":0,"iused":0,"ifree":0,"mounted_on":"/net","available":0,"capacity_percent":100,"iused_percent":100},{"filesystem":"map auto_home","size":0,"used":0,"iused":0,"ifree":0,"mounted_on":"/home","available":0,"capacity_percent":100,"iused_percent":100},{"filesystem":"//brazil@MyCloudEX2Ultra._afpovertcp._tcp.local/brazil","size":3848290697216,"used":1209462790553,"iused":301134832,"ifree":649465741,"mounted_on":"/Volumes/brazil","available":2638827906662,"capacity_percent":32,"iused_percent":32}]
|
||||
|
2
tests/fixtures/osx-10.14.6/df-h.json
vendored
2
tests/fixtures/osx-10.14.6/df-h.json
vendored
@ -1 +1 @@
|
||||
[{"filesystem":"/dev/disk1s1","size":466000000000,"used":144000000000,"iused":1507697,"ifree":9223372036853268110,"mounted_on":"/","available":315000000000,"capacity_percent":32,"iused_percent":0},{"filesystem":"devfs","size":334000,"used":334000,"iused":1154,"ifree":0,"mounted_on":"/dev","available":0,"capacity_percent":100,"iused_percent":100},{"filesystem":"/dev/disk1s4","size":466000000000,"used":6000000000,"iused":6,"ifree":9223372036854775801,"mounted_on":"/private/var/vm","available":315000000000,"capacity_percent":2,"iused_percent":0},{"filesystem":"map -hosts","size":0,"used":0,"iused":0,"ifree":0,"mounted_on":"/net","available":0,"capacity_percent":100,"iused_percent":100},{"filesystem":"map auto_home","size":0,"used":0,"iused":0,"ifree":0,"mounted_on":"/home","available":0,"capacity_percent":100,"iused_percent":100},{"filesystem":"/dev/disk2s2","size":6900000000,"used":5200000000,"iused":8,"ifree":4294967271,"mounted_on":"/Volumes/InstallESD","available":1700000000,"capacity_percent":76,"iused_percent":0},{"filesystem":"com.apple.TimeMachine.2019-11-29-075900@/dev/disk1s1","size":466000000000,"used":132000000000,"iused":1459164,"ifree":9223372036853316643,"mounted_on":"/Volumes/com.apple.TimeMachine.localsnapshots/Backups.backupdb/kbrazil-mac/2019-11-29-075900/Macintosh HD","available":315000000000,"capacity_percent":30,"iused_percent":0},{"filesystem":"//brazil@MyCloudEX2Ultra._afpovertcp._tcp.local/brazil","size":3500000000000,"used":1100000000000,"iused":301134832,"ifree":649465741,"mounted_on":"/Volumes/brazil","available":2400000000000,"capacity_percent":32,"iused_percent":32}]
|
||||
[{"filesystem":"/dev/disk1s1","size":500363689984,"used":154618822656,"iused":1507697,"ifree":9223372036853268110,"mounted_on":"/","available":338228674560,"capacity_percent":32,"iused_percent":0},{"filesystem":"devfs","size":342016,"used":342016,"iused":1154,"ifree":0,"mounted_on":"/dev","available":0,"capacity_percent":100,"iused_percent":100},{"filesystem":"/dev/disk1s4","size":500363689984,"used":6442450944,"iused":6,"ifree":9223372036854775801,"mounted_on":"/private/var/vm","available":338228674560,"capacity_percent":2,"iused_percent":0},{"filesystem":"map -hosts","size":0,"used":0,"iused":0,"ifree":0,"mounted_on":"/net","available":0,"capacity_percent":100,"iused_percent":100},{"filesystem":"map auto_home","size":0,"used":0,"iused":0,"ifree":0,"mounted_on":"/home","available":0,"capacity_percent":100,"iused_percent":100},{"filesystem":"/dev/disk2s2","size":7408818585,"used":5583457484,"iused":8,"ifree":4294967271,"mounted_on":"/Volumes/InstallESD","available":1825361100,"capacity_percent":76,"iused_percent":0},{"filesystem":"com.apple.TimeMachine.2019-11-29-075900@/dev/disk1s1","size":500363689984,"used":141733920768,"iused":1459164,"ifree":9223372036853316643,"mounted_on":"/Volumes/com.apple.TimeMachine.localsnapshots/Backups.backupdb/kbrazil-mac/2019-11-29-075900/Macintosh HD","available":338228674560,"capacity_percent":30,"iused_percent":0},{"filesystem":"//brazil@MyCloudEX2Ultra._afpovertcp._tcp.local/brazil","size":3848290697216,"used":1209462790553,"iused":301134832,"ifree":649465741,"mounted_on":"/Volumes/brazil","available":2638827906662,"capacity_percent":32,"iused_percent":32}]
|
||||
|
1
tests/fixtures/osx-10.14.6/df-hh.json
vendored
Normal file
1
tests/fixtures/osx-10.14.6/df-hh.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
[{"filesystem":"/dev/disk3s3s1","size":494000000000,"used":16000000000,"iused":356840,"ifree":3660412200,"mounted_on":"/","available":375000000000,"capacity_percent":5,"iused_percent":0},{"filesystem":"devfs","size":215000,"used":215000,"iused":729,"ifree":0,"mounted_on":"/dev","available":0,"capacity_percent":100,"iused_percent":100},{"filesystem":"/dev/disk3s6","size":494000000000,"used":20000,"iused":0,"ifree":3660412200,"mounted_on":"/System/Volumes/VM","available":375000000000,"capacity_percent":1,"iused_percent":0},{"filesystem":"/dev/disk3s4","size":494000000000,"used":11000000000,"iused":1466,"ifree":3660412200,"mounted_on":"/System/Volumes/Preboot","available":375000000000,"capacity_percent":3,"iused_percent":0},{"filesystem":"/dev/disk3s2","size":494000000000,"used":349000000,"iused":162,"ifree":3660412200,"mounted_on":"/System/Volumes/Update","available":375000000000,"capacity_percent":1,"iused_percent":0},{"filesystem":"/dev/disk1s2","size":524000000,"used":6300000,"iused":1,"ifree":4933600,"mounted_on":"/System/Volumes/xarts","available":505000000,"capacity_percent":2,"iused_percent":0},{"filesystem":"/dev/disk1s1","size":524000000,"used":6500000,"iused":31,"ifree":4933600,"mounted_on":"/System/Volumes/iSCPreboot","available":505000000,"capacity_percent":2,"iused_percent":0},{"filesystem":"/dev/disk1s3","size":524000000,"used":1300000,"iused":63,"ifree":4933600,"mounted_on":"/System/Volumes/Hardware","available":505000000,"capacity_percent":1,"iused_percent":0},{"filesystem":"/dev/disk3s1","size":494000000000,"used":90000000000,"iused":724666,"ifree":3660412200,"mounted_on":"/System/Volumes/Data","available":375000000000,"capacity_percent":20,"iused_percent":0},{"filesystem":"map auto_home","size":0,"used":0,"iused":0,"ifree":0,"mounted_on":"/System/Volumes/Data/home","available":0,"capacity_percent":100,"iused_percent":100},{"filesystem":"/dev/disk2s1","size":5400000000,"used":1700000000,"iused":62,"ifree":35253480,"mounted_on":"/System/Volumes/Update/SFR/mnt1","available":3600000000,"capacity_percent":33,"iused_percent":0},{"filesystem":"/dev/disk3s3","size":494000000000,"used":16000000000,"iused":404477,"ifree":3660412200,"mounted_on":"/System/Volumes/Update/mnt1","available":375000000000,"capacity_percent":5,"iused_percent":0}]
|
13
tests/fixtures/osx-10.14.6/df-hh.out
vendored
Normal file
13
tests/fixtures/osx-10.14.6/df-hh.out
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
|
||||
/dev/disk3s3s1 494G 16G 375G 5% 356840 3660412200 0% /
|
||||
devfs 215k 215k 0B 100% 729 0 100% /dev
|
||||
/dev/disk3s6 494G 20k 375G 1% 0 3660412200 0% /System/Volumes/VM
|
||||
/dev/disk3s4 494G 11G 375G 3% 1466 3660412200 0% /System/Volumes/Preboot
|
||||
/dev/disk3s2 494G 349M 375G 1% 162 3660412200 0% /System/Volumes/Update
|
||||
/dev/disk1s2 524M 6.3M 505M 2% 1 4933600 0% /System/Volumes/xarts
|
||||
/dev/disk1s1 524M 6.5M 505M 2% 31 4933600 0% /System/Volumes/iSCPreboot
|
||||
/dev/disk1s3 524M 1.3M 505M 1% 63 4933600 0% /System/Volumes/Hardware
|
||||
/dev/disk3s1 494G 90G 375G 20% 724666 3660412200 0% /System/Volumes/Data
|
||||
map auto_home 0B 0B 0B 100% 0 0 100% /System/Volumes/Data/home
|
||||
/dev/disk2s1 5.4G 1.7G 3.6G 33% 62 35253480 0% /System/Volumes/Update/SFR/mnt1
|
||||
/dev/disk3s3 494G 16G 375G 5% 404477 3660412200 0% /System/Volumes/Update/mnt1
|
2
tests/fixtures/ubuntu-18.04/df-h.json
vendored
2
tests/fixtures/ubuntu-18.04/df-h.json
vendored
@ -1 +1 @@
|
||||
[{"filesystem":"udev","size":955000000,"used":0,"mounted_on":"/dev","available":955000000,"use_percent":0},{"filesystem":"tmpfs","size":198000000,"used":1200000,"mounted_on":"/run","available":196000000,"use_percent":1},{"filesystem":"/dev/sda2","size":20000000000,"used":5500000000,"mounted_on":"/","available":14000000000,"use_percent":30},{"filesystem":"tmpfs","size":986000000,"used":0,"mounted_on":"/dev/shm","available":986000000,"use_percent":0},{"filesystem":"tmpfs","size":5000000,"used":0,"mounted_on":"/run/lock","available":5000000,"use_percent":0},{"filesystem":"tmpfs","size":986000000,"used":0,"mounted_on":"/sys/fs/cgroup","available":986000000,"use_percent":0},{"filesystem":"/dev/loop0","size":55000000,"used":55000000,"mounted_on":"/snap/core18/1223","available":0,"use_percent":100},{"filesystem":"/dev/loop1","size":11000000,"used":11000000,"mounted_on":"/snap/slcli/383","available":0,"use_percent":100},{"filesystem":"/dev/loop2","size":89000000,"used":89000000,"mounted_on":"/snap/core/7396","available":0,"use_percent":100},{"filesystem":"/dev/loop3","size":67000000,"used":67000000,"mounted_on":"/snap/google-cloud-sdk/103","available":0,"use_percent":100},{"filesystem":"/dev/loop5","size":55000000,"used":55000000,"mounted_on":"/snap/core18/1074","available":0,"use_percent":100},{"filesystem":"/dev/loop7","size":8700000,"used":8700000,"mounted_on":"/snap/doctl/187","available":0,"use_percent":100},{"filesystem":"/dev/loop8","size":3200000,"used":3200000,"mounted_on":"/snap/stress-ng/847","available":0,"use_percent":100},{"filesystem":"/dev/loop10","size":90000000,"used":90000000,"mounted_on":"/snap/core/7917","available":0,"use_percent":100},{"filesystem":"/dev/loop11","size":3300000,"used":3300000,"mounted_on":"/snap/stress-ng/924","available":0,"use_percent":100},{"filesystem":"tmpfs","size":197000000,"used":0,"mounted_on":"/run/user/1000","available":197000000,"use_percent":0},{"filesystem":"/dev/loop9","size":8700000,"used":8700000,"mounted_on":"/snap/doctl/215","available":0,"use_percent":100},{"filesystem":"/dev/loop4","size":67000000,"used":67000000,"mounted_on":"/snap/google-cloud-sdk/104","available":0,"use_percent":100}]
|
||||
[{"filesystem":"udev","size":1001390080,"used":0,"mounted_on":"/dev","available":1001390080,"use_percent":0},{"filesystem":"tmpfs","size":207618048,"used":1258291,"mounted_on":"/run","available":205520896,"use_percent":1},{"filesystem":"/dev/sda2","size":21474836480,"used":5905580032,"mounted_on":"/","available":15032385536,"use_percent":30},{"filesystem":"tmpfs","size":1033895936,"used":0,"mounted_on":"/dev/shm","available":1033895936,"use_percent":0},{"filesystem":"tmpfs","size":5242880,"used":0,"mounted_on":"/run/lock","available":5242880,"use_percent":0},{"filesystem":"tmpfs","size":1033895936,"used":0,"mounted_on":"/sys/fs/cgroup","available":1033895936,"use_percent":0},{"filesystem":"/dev/loop0","size":57671680,"used":57671680,"mounted_on":"/snap/core18/1223","available":0,"use_percent":100},{"filesystem":"/dev/loop1","size":11534336,"used":11534336,"mounted_on":"/snap/slcli/383","available":0,"use_percent":100},{"filesystem":"/dev/loop2","size":93323264,"used":93323264,"mounted_on":"/snap/core/7396","available":0,"use_percent":100},{"filesystem":"/dev/loop3","size":70254592,"used":70254592,"mounted_on":"/snap/google-cloud-sdk/103","available":0,"use_percent":100},{"filesystem":"/dev/loop5","size":57671680,"used":57671680,"mounted_on":"/snap/core18/1074","available":0,"use_percent":100},{"filesystem":"/dev/loop7","size":9122611,"used":9122611,"mounted_on":"/snap/doctl/187","available":0,"use_percent":100},{"filesystem":"/dev/loop8","size":3355443,"used":3355443,"mounted_on":"/snap/stress-ng/847","available":0,"use_percent":100},{"filesystem":"/dev/loop10","size":94371840,"used":94371840,"mounted_on":"/snap/core/7917","available":0,"use_percent":100},{"filesystem":"/dev/loop11","size":3460300,"used":3460300,"mounted_on":"/snap/stress-ng/924","available":0,"use_percent":100},{"filesystem":"tmpfs","size":206569472,"used":0,"mounted_on":"/run/user/1000","available":206569472,"use_percent":0},{"filesystem":"/dev/loop9","size":9122611,"used":9122611,"mounted_on":"/snap/doctl/215","available":0,"use_percent":100},{"filesystem":"/dev/loop4","size":70254592,"used":70254592,"mounted_on":"/snap/google-cloud-sdk/104","available":0,"use_percent":100}]
|
||||
|
1
tests/fixtures/ubuntu-18.04/netstat-sudo-lnp-space.json
vendored
Normal file
1
tests/fixtures/ubuntu-18.04/netstat-sudo-lnp-space.json
vendored
Normal file
File diff suppressed because one or more lines are too long
51
tests/fixtures/ubuntu-18.04/netstat-sudo-lnp-space.out
vendored
Normal file
51
tests/fixtures/ubuntu-18.04/netstat-sudo-lnp-space.out
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
Active Internet connections (only servers)
|
||||
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
|
||||
tcp 0 0 0.0.0.0:9898 0.0.0.0:* LISTEN 1178/pgpool
|
||||
tcp 0 0 192.168.68.116:9102 0.0.0.0:* LISTEN 584/bareos-fd
|
||||
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 600/sshd: /usr/sbin
|
||||
tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 1178/pgpool
|
||||
tcp 0 0 0.0.0.0:5433 0.0.0.0:* LISTEN 1676/postgres
|
||||
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 928/exim4
|
||||
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 1817931/zabbix_agen
|
||||
tcp 0 0 0.0.0.0:9000 0.0.0.0:* LISTEN 1187/pgpool: watchd
|
||||
tcp6 0 0 :::9898 :::* LISTEN 1178/pgpool
|
||||
tcp6 0 0 :::22 :::* LISTEN 600/sshd: /usr/sbin
|
||||
tcp6 0 0 :::5432 :::* LISTEN 1178/pgpool
|
||||
tcp6 0 0 :::5433 :::* LISTEN 1676/postgres
|
||||
tcp6 0 0 :::10050 :::* LISTEN 1817931/zabbix_agen
|
||||
udp 0 0 0.0.0.0:68 0.0.0.0:* 535/dhclient
|
||||
udp 0 0 0.0.0.0:37300 0.0.0.0:* 1204/pgpool: heartb
|
||||
udp 0 0 0.0.0.0:9694 0.0.0.0:* 1205/pgpool: heartb
|
||||
udp 0 0 0.0.0.0:9694 0.0.0.0:* 1203/pgpool: heartb
|
||||
udp 0 0 0.0.0.0:44649 0.0.0.0:* 1206/pgpool: heartb
|
||||
udp 0 0 0.0.0.0:52868 0.0.0.0:* 494/rsyslogd
|
||||
tcp 0 0 127.0.0.1:42351 0.0.0.0:* LISTEN 1112/containerd
|
||||
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 885/systemd-resolve
|
||||
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1127/sshd
|
||||
tcp6 0 0 :::22 :::* LISTEN 1127/sshd
|
||||
udp 0 0 127.0.0.53:53 0.0.0.0:* 885/systemd-resolve
|
||||
udp 0 0 192.168.71.131:68 0.0.0.0:* 867/systemd-network
|
||||
raw6 0 0 :::58 :::* 7 867/systemd-network
|
||||
Active UNIX domain sockets (only servers)
|
||||
Proto RefCnt Flags Type State I-Node PID/Program name Path
|
||||
unix 2 [ ACC ] SEQPACKET LISTENING 20812 1/init /run/udev/control
|
||||
unix 2 [ ACC ] STREAM LISTENING 33765 1723/systemd /run/user/1000/systemd/private
|
||||
unix 2 [ ACC ] STREAM LISTENING 33808 1723/systemd /run/user/1000/gnupg/S.gpg-agent.ssh
|
||||
unix 2 [ ACC ] STREAM LISTENING 33809 1723/systemd /run/user/1000/gnupg/S.dirmngr
|
||||
unix 2 [ ACC ] STREAM LISTENING 33810 1723/systemd /run/user/1000/gnupg/S.gpg-agent.browser
|
||||
unix 2 [ ACC ] STREAM LISTENING 33811 1723/systemd /run/user/1000/gnupg/S.gpg-agent
|
||||
unix 2 [ ACC ] STREAM LISTENING 33812 1723/systemd /run/user/1000/gnupg/S.gpg-agent.extra
|
||||
unix 2 [ ACC ] STREAM LISTENING 20655 1/init /run/systemd/private
|
||||
unix 2 [ ACC ] STREAM LISTENING 20662 1/init /run/lvm/lvmetad.socket
|
||||
unix 2 [ ACC ] STREAM LISTENING 20664 1/init /run/systemd/journal/stdout
|
||||
unix 2 [ ACC ] STREAM LISTENING 20891 1/init /run/lvm/lvmpolld.socket
|
||||
unix 2 [ ACC ] STREAM LISTENING 27473 1/init /run/acpid.socket
|
||||
unix 2 [ ACC ] STREAM LISTENING 27443 1/init /run/snapd.socket
|
||||
unix 2 [ ACC ] STREAM LISTENING 27445 1/init /run/snapd-snap.socket
|
||||
unix 2 [ ACC ] STREAM LISTENING 27475 1/init /run/uuidd/request
|
||||
unix 2 [ ACC ] STREAM LISTENING 27481 1/init /var/run/docker.sock
|
||||
unix 2 [ ACC ] STREAM LISTENING 27489 1/init /var/run/dbus/system_bus_socket
|
||||
unix 2 [ ACC ] STREAM LISTENING 27468 1/init /var/lib/lxd/unix.socket
|
||||
unix 2 [ ACC ] STREAM LISTENING 30726 1112/containerd /run/containerd/containerd.sock
|
||||
unix 2 [ ACC ] STREAM LISTENING 27436 1/init @ISCSIADM_ABSTRACT_NAMESPACE
|
||||
unix 2 [ ACC ] STREAM LISTENING 25548 607/VGAuthService /var/run/vmware/guestServicePipe
|
@ -1 +1 @@
|
||||
{"type":"summary","destination_ip":"10.0.3.22","sent_bytes":56,"pattern":null,"packets_transmitted":3,"packets_received":0,"packet_loss_percent":100.0,"duplicates":0,"errors":3,"corrupted":null,"time_ms":2049.0,"round_trip_ms_min":null,"round_trip_ms_avg":null,"round_trip_ms_max":null,"round_trip_ms_stddev":null}
|
||||
[{"type": "destination_host_unreachable", "destination_ip": "10.0.3.22", "sent_bytes": 56, "response_ip": "10.0.0.1", "icmp_seq": 1, "timestamp": null}, {"type": "destination_host_unreachable", "destination_ip": "10.0.3.22", "sent_bytes": 56, "response_ip": "10.0.0.1", "icmp_seq": 2, "timestamp": null}, {"type": "destination_host_unreachable", "destination_ip": "10.0.3.22", "sent_bytes": 56, "response_ip": "10.0.0.1", "icmp_seq": 3, "timestamp": null}, {"type": "summary", "destination_ip": "10.0.3.22", "sent_bytes": 56, "pattern": null, "packets_transmitted": 3, "packets_received": 0, "packet_loss_percent": 100.0, "duplicates": 0, "errors": 3, "corrupted": null, "time_ms": 2049.0, "round_trip_ms_min": null, "round_trip_ms_avg": null, "round_trip_ms_max": null, "round_trip_ms_stddev": null}]
|
||||
|
95
tests/fixtures/ubuntu-22.04/wg_show--one_device.json
vendored
Normal file
95
tests/fixtures/ubuntu-22.04/wg_show--one_device.json
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
[
|
||||
{
|
||||
"device": "wg0",
|
||||
"private_key": "ZkG2dvJSUq5ohkDFNWBqToaVSyk4Pp8/bULaf6yX+3N=",
|
||||
"public_key": "PQsbRs4w2fidQ7uhjgCypl5fc/804bHZbfl83gGvakN=",
|
||||
"listen_port": 51820,
|
||||
"fwmark": null,
|
||||
"peers": [
|
||||
{
|
||||
"public_key": "rQFRAjRdx1aD8DnTFpkcBOY9Edjt3ZU7+P9HokZv7xe=",
|
||||
"preshared_key": null,
|
||||
"endpoint": "82.132.137.204:50024",
|
||||
"latest_handshake": 1829439251,
|
||||
"transfer_rx": 1536642,
|
||||
"transfer_sx": 492320,
|
||||
"persistent_keepalive": -1,
|
||||
"allowed_ips": [
|
||||
"10.10.0.2/32"
|
||||
]
|
||||
},
|
||||
{
|
||||
"public_key": "A0fsnrwsv7S9hrk8yzCgOON9gKPYfpCrzqil4bPpxAE=",
|
||||
"preshared_key": null,
|
||||
"endpoint": "82.132.137.204:49732",
|
||||
"latest_handshake": 1829439125,
|
||||
"transfer_rx": 5641359,
|
||||
"transfer_sx": 4206783,
|
||||
"persistent_keepalive": -1,
|
||||
"allowed_ips": [
|
||||
"10.10.0.3/32"
|
||||
]
|
||||
},
|
||||
{
|
||||
"public_key": "pkjVZR5VdfnSFhlWsqnkf+wv/eHGLHzOtKu8v2CvOD5=",
|
||||
"preshared_key": null,
|
||||
"endpoint": null,
|
||||
"latest_handshake": 0,
|
||||
"transfer_rx": 0,
|
||||
"transfer_sx": 0,
|
||||
"persistent_keepalive": -1,
|
||||
"allowed_ips": [
|
||||
"10.10.0.4/32"
|
||||
]
|
||||
},
|
||||
{
|
||||
"public_key": "hz0+KJRHJyXfDNjUnZ9LRAnShFFjZNTrW2jRbXjIazx=",
|
||||
"preshared_key": null,
|
||||
"endpoint": "180.255.226.203:21678",
|
||||
"latest_handshake": 1829439243,
|
||||
"transfer_rx": 1555523,
|
||||
"transfer_sx": 544780,
|
||||
"persistent_keepalive": -1,
|
||||
"allowed_ips": [
|
||||
"10.10.0.5/32"
|
||||
]
|
||||
},
|
||||
{
|
||||
"public_key": "kujr4Z8eutQ8ebzFf33DLc3PNKrO3J+ZVy3jkrR1cUZ=",
|
||||
"preshared_key": null,
|
||||
"endpoint": "82.132.137.204:67130",
|
||||
"latest_handshake": 0,
|
||||
"transfer_rx": 0,
|
||||
"transfer_sx": 0,
|
||||
"persistent_keepalive": -1,
|
||||
"allowed_ips": [
|
||||
"10.10.0.6/32"
|
||||
]
|
||||
},
|
||||
{
|
||||
"public_key": "XcgkMRmxhQiIgXowYqsxUt1SlwUydXJd4Zmi8dgGeYe=",
|
||||
"preshared_key": null,
|
||||
"endpoint": "180.255.226.203:56092",
|
||||
"latest_handshake": 1829439121,
|
||||
"transfer_rx": 1900247,
|
||||
"transfer_sx": 1352639,
|
||||
"persistent_keepalive": -1,
|
||||
"allowed_ips": [
|
||||
"10.10.0.8/32"
|
||||
]
|
||||
},
|
||||
{
|
||||
"public_key": "tB9yFqLmyvcDD1rJ1rTgeKtKK98hdUL1jefMRt4XbDh=",
|
||||
"preshared_key": null,
|
||||
"endpoint": "82.132.137.204:60184",
|
||||
"latest_handshake": 1829037182,
|
||||
"transfer_rx": 75047,
|
||||
"transfer_sx": 184725,
|
||||
"persistent_keepalive": -1,
|
||||
"allowed_ips": [
|
||||
"10.10.0.7/32"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
9
tests/fixtures/ubuntu-22.04/wg_show--one_device.out
vendored
Normal file
9
tests/fixtures/ubuntu-22.04/wg_show--one_device.out
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
wg0 ZkG2dvJSUq5ohkDFNWBqToaVSyk4Pp8/bULaf6yX+3N= PQsbRs4w2fidQ7uhjgCypl5fc/804bHZbfl83gGvakN= 51820 off
|
||||
wg0 rQFRAjRdx1aD8DnTFpkcBOY9Edjt3ZU7+P9HokZv7xe= (none) 82.132.137.204:50024 10.10.0.2/32 1829439251 1536642 492320 off
|
||||
wg0 A0fsnrwsv7S9hrk8yzCgOON9gKPYfpCrzqil4bPpxAE= (none) 82.132.137.204:49732 10.10.0.3/32 1829439125 5641359 4206783 off
|
||||
wg0 pkjVZR5VdfnSFhlWsqnkf+wv/eHGLHzOtKu8v2CvOD5= (none) (none) 10.10.0.4/32 0 0 0 off
|
||||
wg0 hz0+KJRHJyXfDNjUnZ9LRAnShFFjZNTrW2jRbXjIazx= (none) 180.255.226.203:21678 10.10.0.5/32 1829439243 1555523 544780 off
|
||||
wg0 kujr4Z8eutQ8ebzFf33DLc3PNKrO3J+ZVy3jkrR1cUZ= (none) 82.132.137.204:67130 10.10.0.6/32 0 0 0 off
|
||||
wg0 XcgkMRmxhQiIgXowYqsxUt1SlwUydXJd4Zmi8dgGeYe= (none) 180.255.226.203:56092 10.10.0.8/32 1829439121 1900247 1352639 off
|
||||
wg0 tB9yFqLmyvcDD1rJ1rTgeKtKK98hdUL1jefMRt4XbDh= (none) 82.132.137.204:60184 10.10.0.7/32 1829037182 75047 184725 off
|
||||
|
1
tests/fixtures/ubuntu-22.04/wg_show--two_devices.json
vendored
Normal file
1
tests/fixtures/ubuntu-22.04/wg_show--two_devices.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
[{"device":"wg0","private_key":"ZkG2dvJSUq5ohkDFNWBqToaVSyk4Pp8/bULaf6yX+3N=","public_key":"PQsbRs4w2fidQ7uhjgCypl5fc/804bHZbfl83gGvakN=","listen_port":51820,"fwmark":null,"peers":[{"public_key":"rQFRAjRdx1aD8DnTFpkcBOY9Edjt3ZU7+P9HokZv7xe=","preshared_key":null,"endpoint":"82.132.137.204:50024","latest_handshake":1829439251,"transfer_rx":1536642,"transfer_sx":492320,"persistent_keepalive":-1,"allowed_ips":["10.10.0.2/32"]},{"public_key":"A0fsnrwsv7S9hrk8yzCgOON9gKPYfpCrzqil4bPpxAE=","preshared_key":null,"endpoint":"82.132.137.204:49732","latest_handshake":1829439125,"transfer_rx":5641359,"transfer_sx":4206783,"persistent_keepalive":-1,"allowed_ips":["10.10.0.3/32"]},{"public_key":"pkjVZR5VdfnSFhlWsqnkf+wv/eHGLHzOtKu8v2CvOD5=","preshared_key":null,"endpoint":null,"latest_handshake":0,"transfer_rx":0,"transfer_sx":0,"persistent_keepalive":-1,"allowed_ips":["10.10.0.4/32"]},{"public_key":"hz0+KJRHJyXfDNjUnZ9LRAnShFFjZNTrW2jRbXjIazx=","preshared_key":null,"endpoint":"180.255.226.203:21678","latest_handshake":1829439243,"transfer_rx":1555523,"transfer_sx":544780,"persistent_keepalive":-1,"allowed_ips":["10.10.0.5/32"]},{"public_key":"kujr4Z8eutQ8ebzFf33DLc3PNKrO3J+ZVy3jkrR1cUZ=","preshared_key":null,"endpoint":"82.132.137.204:67130","latest_handshake":0,"transfer_rx":0,"transfer_sx":0,"persistent_keepalive":-1,"allowed_ips":["10.10.0.6/32"]},{"public_key":"XcgkMRmxhQiIgXowYqsxUt1SlwUydXJd4Zmi8dgGeYe=","preshared_key":null,"endpoint":"180.255.226.203:56092","latest_handshake":1829439121,"transfer_rx":1900247,"transfer_sx":1352639,"persistent_keepalive":-1,"allowed_ips":["10.10.0.8/32"]},{"public_key":"tB9yFqLmyvcDD1rJ1rTgeKtKK98hdUL1jefMRt4XbDh=","preshared_key":null,"endpoint":"82.132.137.204:60184","latest_handshake":1829037182,"transfer_rx":75047,"transfer_sx":184725,"persistent_keepalive":-1,"allowed_ips":["10.10.0.7/32"]},{"public_key":"JH8Fz8KGH5vDYu3eUuWwRcTUcvRqFHZfMlNtsg2xZwF=","preshared_key":null,"endpoint":"91.142.150.210:51478","latest_handshake":1829037123,"transfer_rx":985632,"transfer_sx":723582,"persistent_keepalive":-1,"allowed_ips":["10.10.0.9/32"]},{"public_key":"Yx6kNq8xhPmKhYq0YqTxVt2ZmxZvdYKg5Ymj9fgHkGh=","preshared_key":null,"endpoint":"92.233.144.193:61112","latest_handshake":1829037212,"transfer_rx":1350235,"transfer_sx":945301,"persistent_keepalive":-1,"allowed_ips":["10.10.0.10/32"]}]},{"device":"wg1","private_key":"JnR8bwIHKq7yqfNDOWBlTohSTxl7Wa9/sTLcf6tQ+4O=","public_key":"MUocVr6x4gjhT9vkkDrzm6hc/906dJHYcgk93iHvbmR=","listen_port":51821,"fwmark":null,"peers":[{"public_key":"yQHRBjVgy2fC9EkUFlhdDPZ0Lekv4YM9+Q0GmnXw9gf=","preshared_key":null,"endpoint":"72.144.138.212:50135","latest_handshake":1929850372,"transfer_rx":1678923,"transfer_sx":513470,"persistent_keepalive":-1,"allowed_ips":["10.10.1.2/32"]},{"public_key":"C1gsotwrx9S9jsq9yzJgPPO0hNRYgrDsblmj6dSrkZE=","preshared_key":null,"endpoint":"59.232.145.213:49364","latest_handshake":1929850156,"transfer_rx":5982563,"transfer_sx":4378204,"persistent_keepalive":-1,"allowed_ips":["10.10.1.3/32"]},{"public_key":"qjkYZR6WfgnTGjnXrqokf+xw/fIFMHyPtLu9w3DwOF6=","preshared_key":null,"endpoint":null,"latest_handshake":0,"transfer_rx":0,"transfer_sx":0,"persistent_keepalive":-1,"allowed_ips":["10.10.1.4/32"]}]},{"device":"wg1","private_key":"JpK6HvHKLp9zmqDFQXBqUmxTSvW6Vp9/zTLbf6pT+7N=","public_key":"LQdcXs5y5dkgU0vmkCszm8hf/907fKHYdhk94jHvbnQ=","listen_port":51821,"fwmark":null,"peers":[{"public_key":"tRFGGjUhy3hD0GmVEljeDQY0Mhlv5YM7+Q2HmnWy9je=","preshared_key":null,"endpoint":"69.157.149.222:51049","latest_handshake":1929851223,"transfer_rx":1680921,"transfer_sx":523451,"persistent_keepalive":-1,"allowed_ips":["10.10.1.5/32"]},{"public_key":"K2hzotyrx8S1jsq0yzHgTQO1kOYVhrDwblmj7eTrkZF=","preshared_key":null,"endpoint":"61.242.155.214:48012","latest_handshake":1929851045,"transfer_rx":6052145,"transfer_sx":4435280,"persistent_keepalive":-1,"allowed_ips":["10.10.1.6/32"]},{"public_key":"VliYZS7WggpUFkWNralkg+wz/eIHMHyStMpu0x4EoEJ=","preshared_key":null,"endpoint":null,"latest_handshake":0,"transfer_rx":0,"transfer_sx":0,"persistent_keepalive":-1,"allowed_ips":["10.10.1.7/32"]},{"public_key":"kB8yFrKmyvaDF1uL2uUgeOsLL99jeUL2kefKRt3ZoFh=","preshared_key":null,"endpoint":"72.132.145.206:62084","latest_handshake":1929137285,"transfer_rx":95023,"transfer_sx":197982,"persistent_keepalive":-1,"allowed_ips":["10.10.1.8/32"]},{"public_key":"Z9fsqvwty8U9jqj1zyKgPRQ1hOXYgrFtcmli8fSprHF=","preshared_key":null,"endpoint":"68.243.154.222:54321","latest_handshake":1929137125,"transfer_rx":1200475,"transfer_sx":890678,"persistent_keepalive":-1,"allowed_ips":["10.10.1.9/32"]},{"public_key":"Lx9lNq9xhPnJhYr1YqYxVt3ZmyawdZLg5Zmj0fhGlJk=","preshared_key":null,"endpoint":"71.233.144.204:59012","latest_handshake":1929137243,"transfer_rx":1450234,"transfer_sx":1006235,"persistent_keepalive":-1,"allowed_ips":["10.10.1.10/32"]}]}]
|
22
tests/fixtures/ubuntu-22.04/wg_show--two_devices.out
vendored
Normal file
22
tests/fixtures/ubuntu-22.04/wg_show--two_devices.out
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
wg0 ZkG2dvJSUq5ohkDFNWBqToaVSyk4Pp8/bULaf6yX+3N= PQsbRs4w2fidQ7uhjgCypl5fc/804bHZbfl83gGvakN= 51820 off
|
||||
wg0 rQFRAjRdx1aD8DnTFpkcBOY9Edjt3ZU7+P9HokZv7xe= (none) 82.132.137.204:50024 10.10.0.2/32 1829439251 1536642 492320 off
|
||||
wg0 A0fsnrwsv7S9hrk8yzCgOON9gKPYfpCrzqil4bPpxAE= (none) 82.132.137.204:49732 10.10.0.3/32 1829439125 5641359 4206783 off
|
||||
wg0 pkjVZR5VdfnSFhlWsqnkf+wv/eHGLHzOtKu8v2CvOD5= (none) (none) 10.10.0.4/32 0 0 0 off
|
||||
wg0 hz0+KJRHJyXfDNjUnZ9LRAnShFFjZNTrW2jRbXjIazx= (none) 180.255.226.203:21678 10.10.0.5/32 1829439243 1555523 544780 off
|
||||
wg0 kujr4Z8eutQ8ebzFf33DLc3PNKrO3J+ZVy3jkrR1cUZ= (none) 82.132.137.204:67130 10.10.0.6/32 0 0 0 off
|
||||
wg0 XcgkMRmxhQiIgXowYqsxUt1SlwUydXJd4Zmi8dgGeYe= (none) 180.255.226.203:56092 10.10.0.8/32 1829439121 1900247 1352639 off
|
||||
wg0 tB9yFqLmyvcDD1rJ1rTgeKtKK98hdUL1jefMRt4XbDh= (none) 82.132.137.204:60184 10.10.0.7/32 1829037182 75047 184725 off
|
||||
wg0 JH8Fz8KGH5vDYu3eUuWwRcTUcvRqFHZfMlNtsg2xZwF= (none) 91.142.150.210:51478 10.10.0.9/32 1829037123 985632 723582 off
|
||||
wg0 Yx6kNq8xhPmKhYq0YqTxVt2ZmxZvdYKg5Ymj9fgHkGh= (none) 92.233.144.193:61112 10.10.0.10/32 1829037212 1350235 945301 off
|
||||
wg1 JnR8bwIHKq7yqfNDOWBlTohSTxl7Wa9/sTLcf6tQ+4O= MUocVr6x4gjhT9vkkDrzm6hc/906dJHYcgk93iHvbmR= 51821 off
|
||||
wg1 yQHRBjVgy2fC9EkUFlhdDPZ0Lekv4YM9+Q0GmnXw9gf= (none) 72.144.138.212:50135 10.10.1.2/32 1929850372 1678923 513470 off
|
||||
wg1 C1gsotwrx9S9jsq9yzJgPPO0hNRYgrDsblmj6dSrkZE= (none) 59.232.145.213:49364 10.10.1.3/32 1929850156 5982563 4378204 off
|
||||
wg1 qjkYZR6WfgnTGjnXrqokf+xw/fIFMHyPtLu9w3DwOF6= (none) (none) 10.10.1.4/32 0 0 0 off
|
||||
wg1 JpK6HvHKLp9zmqDFQXBqUmxTSvW6Vp9/zTLbf6pT+7N= LQdcXs5y5dkgU0vmkCszm8hf/907fKHYdhk94jHvbnQ= 51821 off
|
||||
wg1 tRFGGjUhy3hD0GmVEljeDQY0Mhlv5YM7+Q2HmnWy9je= (none) 69.157.149.222:51049 10.10.1.5/32 1929851223 1680921 523451 off
|
||||
wg1 K2hzotyrx8S1jsq0yzHgTQO1kOYVhrDwblmj7eTrkZF= (none) 61.242.155.214:48012 10.10.1.6/32 1929851045 6052145 4435280 off
|
||||
wg1 VliYZS7WggpUFkWNralkg+wz/eIHMHyStMpu0x4EoEJ= (none) (none) 10.10.1.7/32 0 0 0 off
|
||||
wg1 kB8yFrKmyvaDF1uL2uUgeOsLL99jeUL2kefKRt3ZoFh= (none) 72.132.145.206:62084 10.10.1.8/32 1929137285 95023 197982 off
|
||||
wg1 Z9fsqvwty8U9jqj1zyKgPRQ1hOXYgrFtcmli8fSprHF= (none) 68.243.154.222:54321 10.10.1.9/32 1929137125 1200475 890678 off
|
||||
wg1 Lx9lNq9xhPnJhYr1YqYxVt3ZmyawdZLg5Zmj0fhGlJk= (none) 71.233.144.204:59012 10.10.1.10/32 1929137243 1450234 1006235 off
|
||||
|
1
tests/fixtures/windows/windows-10/ipconfig.json
vendored
Normal file
1
tests/fixtures/windows/windows-10/ipconfig.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"host_name":"DESKTOP-WIN10-PRO","primary_dns_suffix":null,"node_type":"Hybrid","ip_routing_enabled":false,"wins_proxy_enabled":false,"dns_suffix_search_list":["tailff123.ts.net","internal.companyname.com"],"adapters":[{"name_long":"Unknown adapter Tailscale","name":"Tailscale","type":"Unknown","connection_specific_dns_suffix":"tailff123.ts.net","connection_specific_dns_suffix_search_list":["tailff123.ts.net"],"description":"Tailscale Tunnel","physical_address":null,"dhcp_enabled":false,"autoconfiguration_enabled":true,"ipv6_addresses":[{"address":"fd7a:115c:a1e0:ab12:4843:cd96:6293:47b2","status":"Preferred"}],"temporary_ipv6_addresses":[],"link_local_ipv6_addresses":[{"address":"fe80::99d0:ec2d:b2e7:536b","prefix_length":8,"status":"Preferred"}],"ipv4_addresses":[{"address":"100.115.71.66","subnet_mask":"255.255.255.255","status":"Preferred","autoconfigured":false}],"default_gateways":[],"dhcp_server":null,"dhcpv6_iaid":null,"dhcpv6_client_duid":null,"dns_servers":["fec0:0:0:ffff::1%1","fec0:0:0:ffff::2%1","fec0:0:0:ffff::3%1"],"primary_wins_server":null,"lease_expires":null,"lease_obtained":null,"netbios_over_tcpip":true,"media_state":null,"extras":[]},{"name_long":"Ethernet adapter Ethernet 2","name":"Ethernet 2","type":"Ethernet","connection_specific_dns_suffix":"internal.companyname.com","connection_specific_dns_suffix_search_list":[],"description":"ASIX AX88179 USB 3.0 to Gigabit Ethernet Adapter #2","physical_address":"F8-E4-3B-AD-F2-6D","dhcp_enabled":true,"autoconfiguration_enabled":true,"ipv6_addresses":[],"temporary_ipv6_addresses":[],"link_local_ipv6_addresses":[{"address":"fe80::c936:c2db:79ad:e1c6","prefix_length":16,"status":"Preferred"}],"ipv4_addresses":[{"address":"10.50.13.132","subnet_mask":"255.255.255.0","status":"Preferred","autoconfigured":false}],"default_gateways":["10.50.13.1"],"dhcp_server":"10.50.13.1","dhcpv6_iaid":"351866565","dhcpv6_client_duid":"00-01-00-01-2A-15-C3-11-1C-D3-05-F1-58-E1","dns_servers":["10.50.13.1"],"primary_wins_server":null,"lease_expires":"Monday, September 23, 2024 2:31:46 AM","lease_obtained":"Thursday, June 22, 2023 10:39:04 AM","netbios_over_tcpip":true,"media_state":null,"extras":[],"lease_expires_epoch":1727083906,"lease_expires_iso":"2024-09-23T02:31:46","lease_obtained_epoch":1687455544,"lease_obtained_iso":"2023-06-22T10:39:04"},{"name_long":"Ethernet adapter Bluetooth Network Connection","name":"Bluetooth Network Connection","type":"Ethernet","connection_specific_dns_suffix":null,"connection_specific_dns_suffix_search_list":[],"description":"Bluetooth Device (Personal Area Network)","physical_address":"1C-C1-0C-C3-25-B4","dhcp_enabled":true,"autoconfiguration_enabled":true,"ipv6_addresses":[],"temporary_ipv6_addresses":[],"link_local_ipv6_addresses":[],"ipv4_addresses":[],"default_gateways":[],"dhcp_server":null,"dhcpv6_iaid":null,"dhcpv6_client_duid":null,"dns_servers":[],"primary_wins_server":null,"lease_expires":null,"lease_obtained":null,"netbios_over_tcpip":null,"media_state":"Media disconnected","extras":[]}],"extras":[]}
|
57
tests/fixtures/windows/windows-10/ipconfig.out
vendored
Normal file
57
tests/fixtures/windows/windows-10/ipconfig.out
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
|
||||
Windows IP Configuration
|
||||
|
||||
Host Name . . . . . . . . . . . . : DESKTOP-WIN10-PRO
|
||||
Primary Dns Suffix . . . . . . . :
|
||||
Node Type . . . . . . . . . . . . : Hybrid
|
||||
IP Routing Enabled. . . . . . . . : No
|
||||
WINS Proxy Enabled. . . . . . . . : No
|
||||
DNS Suffix Search List. . . . . . : tailff123.ts.net
|
||||
internal.companyname.com
|
||||
|
||||
Unknown adapter Tailscale:
|
||||
|
||||
Connection-specific DNS Suffix . : tailff123.ts.net
|
||||
Description . . . . . . . . . . . : Tailscale Tunnel
|
||||
Physical Address. . . . . . . . . :
|
||||
DHCP Enabled. . . . . . . . . . . : No
|
||||
Autoconfiguration Enabled . . . . : Yes
|
||||
IPv6 Address. . . . . . . . . . . : fd7a:115c:a1e0:ab12:4843:cd96:6293:47b2(Preferred)
|
||||
Link-local IPv6 Address . . . . . : fe80::99d0:ec2d:b2e7:536b%8(Preferred)
|
||||
IPv4 Address. . . . . . . . . . . : 100.115.71.66(Preferred)
|
||||
Subnet Mask . . . . . . . . . . . : 255.255.255.255
|
||||
Default Gateway . . . . . . . . . :
|
||||
DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
|
||||
fec0:0:0:ffff::2%1
|
||||
fec0:0:0:ffff::3%1
|
||||
NetBIOS over Tcpip. . . . . . . . : Enabled
|
||||
Connection-specific DNS Suffix Search List :
|
||||
tailff123.ts.net
|
||||
|
||||
Ethernet adapter Ethernet 2:
|
||||
|
||||
Connection-specific DNS Suffix . : internal.companyname.com
|
||||
Description . . . . . . . . . . . : ASIX AX88179 USB 3.0 to Gigabit Ethernet Adapter #2
|
||||
Physical Address. . . . . . . . . : F8-E4-3B-AD-F2-6D
|
||||
DHCP Enabled. . . . . . . . . . . : Yes
|
||||
Autoconfiguration Enabled . . . . : Yes
|
||||
Link-local IPv6 Address . . . . . : fe80::c936:c2db:79ad:e1c6%16(Preferred)
|
||||
IPv4 Address. . . . . . . . . . . : 10.50.13.132(Preferred)
|
||||
Subnet Mask . . . . . . . . . . . : 255.255.255.0
|
||||
Lease Obtained. . . . . . . . . . : Thursday, June 22, 2023 10:39:04 AM
|
||||
Lease Expires . . . . . . . . . . : Monday, September 23, 2024 2:31:46 AM
|
||||
Default Gateway . . . . . . . . . : 10.50.13.1
|
||||
DHCP Server . . . . . . . . . . . : 10.50.13.1
|
||||
DHCPv6 IAID . . . . . . . . . . . : 351866565
|
||||
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-2A-15-C3-11-1C-D3-05-F1-58-E1
|
||||
DNS Servers . . . . . . . . . . . : 10.50.13.1
|
||||
NetBIOS over Tcpip. . . . . . . . : Enabled
|
||||
|
||||
Ethernet adapter Bluetooth Network Connection:
|
||||
|
||||
Media State . . . . . . . . . . . : Media disconnected
|
||||
Connection-specific DNS Suffix . :
|
||||
Description . . . . . . . . . . . : Bluetooth Device (Personal Area Network)
|
||||
Physical Address. . . . . . . . . : 1C-C1-0C-C3-25-B4
|
||||
DHCP Enabled. . . . . . . . . . . : Yes
|
||||
Autoconfiguration Enabled . . . . : Yes
|
1
tests/fixtures/windows/windows-10/wg_show.json
vendored
Normal file
1
tests/fixtures/windows/windows-10/wg_show.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
[{"device":"wg0","private_key":"Xa4Bq8AUFrjKp+Z283VDzEUVeOOn2wX/uuLTMUkkJens=","public_key":"mL2Co/VecYWtXSY6YUZAI6cAsFZDCEV+9iZKibNcWTu=","listen_port":45321,"fwmark":null,"peers":[{"public_key":"bN9QoMEqlKUpncq0Q8ye9yURczKwmbXzwVsG7A+RV2B=","preshared_key":null,"endpoint":"123.45.67.89:51820","latest_handshake":0,"transfer_rx":0,"transfer_sx":1532,"persistent_keepalive":-1,"allowed_ips":["0.0.0.0/0"]}]},{"device":"wg0","private_key":"yJ3PoNAqlNUpmcq0P7xv8zURdyKwmbZwwUsG9B+SV3C=","public_key":"kP2Lo/WfgVWtYSY7ZUZAJ7cBsEZECFV+8jYKidOcVTv=","listen_port":53211,"fwmark":null,"peers":[{"public_key":"dQ5AoNAqpOUlncq0P9ze8xURayLwmbYwwVsH8C+TV4D=","preshared_key":null,"endpoint":"203.0.113.4:51820","latest_handshake":0,"transfer_rx":0,"transfer_sx":2001,"persistent_keepalive":-1,"allowed_ips":["192.168.1.0/24"]}]},{"device":"wg0","private_key":"pR6DoOBqmNUlncq0P1wq9zUSeyJwmbVxxWsF7D+RU5E=","public_key":"qN2Mo/XghWWtXSY8YVZBK8cDsFZDCFQ+7kZKjbNcWTx=","listen_port":67514,"fwmark":null,"peers":[{"public_key":"tA8AoPCqoPUlncq0P8xe7xUSayKwmbWxxVsG8E+UV6F=","preshared_key":null,"endpoint":"198.51.100.15:51820","latest_handshake":0,"transfer_rx":0,"transfer_sx":1403,"persistent_keepalive":-1,"allowed_ips":["10.0.0.0/8"]}]},{"device":"wg0","private_key":"zU9CoQCqmQUlncq0P4wo6yUTbyJwmbYyyWsF9F+SV7G=","public_key":"vM2Ko/YigXWtYSY9YUZCJ9dCsGZECFV+5lZLjcOcVVy=","listen_port":79812,"fwmark":null,"peers":[{"public_key":"xC7DoRDqnRUlncq0P2wq9yUScyKwmbXzyWsH8F+TU8H=","preshared_key":null,"endpoint":"172.16.0.1:51820","latest_handshake":0,"transfer_rx":0,"transfer_sx":1872,"persistent_keepalive":-1,"allowed_ips":["172.16.0.0/16"]}]},{"device":"wg0","private_key":"rE4AoSCqnSUlncq0P7wv9zURdyLwmbZxzWsG9G+UV9I=","public_key":"fN2Oo/ZjhYUtXSZ0YUZDK8eDsFZDCFQ+4jYKjcNcVVw=","listen_port":91114,"fwmark":null,"peers":[]}]
|
9
tests/fixtures/windows/windows-10/wg_show.out
vendored
Normal file
9
tests/fixtures/windows/windows-10/wg_show.out
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
wg0 Xa4Bq8AUFrjKp+Z283VDzEUVeOOn2wX/uuLTMUkkJens= mL2Co/VecYWtXSY6YUZAI6cAsFZDCEV+9iZKibNcWTu= 45321 off
|
||||
wg0 bN9QoMEqlKUpncq0Q8ye9yURczKwmbXzwVsG7A+RV2B= (none) 123.45.67.89:51820 0.0.0.0/0 0 0 1532 off
|
||||
wg0 yJ3PoNAqlNUpmcq0P7xv8zURdyKwmbZwwUsG9B+SV3C= kP2Lo/WfgVWtYSY7ZUZAJ7cBsEZECFV+8jYKidOcVTv= 53211 off
|
||||
wg0 dQ5AoNAqpOUlncq0P9ze8xURayLwmbYwwVsH8C+TV4D= (none) 203.0.113.4:51820 192.168.1.0/24 0 0 2001 off
|
||||
wg0 pR6DoOBqmNUlncq0P1wq9zUSeyJwmbVxxWsF7D+RU5E= qN2Mo/XghWWtXSY8YVZBK8cDsFZDCFQ+7kZKjbNcWTx= 67514 off
|
||||
wg0 tA8AoPCqoPUlncq0P8xe7xUSayKwmbWxxVsG8E+UV6F= (none) 198.51.100.15:51820 10.0.0.0/8 0 0 1403 off
|
||||
wg0 zU9CoQCqmQUlncq0P4wo6yUTbyJwmbYyyWsF9F+SV7G= vM2Ko/YigXWtYSY9YUZCJ9dCsGZECFV+5lZLjcOcVVy= 79812 off
|
||||
wg0 xC7DoRDqnRUlncq0P2wq9yUScyKwmbXzyWsH8F+TU8H= (none) 172.16.0.1:51820 172.16.0.0/16 0 0 1872 off
|
||||
wg0 rE4AoSCqnSUlncq0P7wv9zURdyLwmbZxzWsG9G+UV9I= fN2Oo/ZjhYUtXSZ0YUZDK8eDsFZDCFQ+4jYKjcNcVVw= 91114 off
|
1
tests/fixtures/windows/windows-11/ipconfig.json
vendored
Normal file
1
tests/fixtures/windows/windows-11/ipconfig.json
vendored
Normal file
File diff suppressed because one or more lines are too long
130
tests/fixtures/windows/windows-11/ipconfig.out
vendored
Normal file
130
tests/fixtures/windows/windows-11/ipconfig.out
vendored
Normal file
@ -0,0 +1,130 @@
|
||||
|
||||
Windows IP Configuration
|
||||
|
||||
Host Name . . . . . . . . . . . . : DESKTOP-WIN11-HOME
|
||||
Primary Dns Suffix . . . . . . . :
|
||||
Node Type . . . . . . . . . . . . : Hybrid
|
||||
IP Routing Enabled. . . . . . . . : No
|
||||
WINS Proxy Enabled. . . . . . . . : No
|
||||
DNS Suffix Search List. . . . . . : localdomain
|
||||
|
||||
Ethernet adapter Ethernet:
|
||||
|
||||
Media State . . . . . . . . . . . : Media disconnected
|
||||
Connection-specific DNS Suffix . :
|
||||
Description . . . . . . . . . . . : Intel(R) I211 Gigabit Network Connection
|
||||
Physical Address. . . . . . . . . : 24-4B-FE-AB-43-C3
|
||||
DHCP Enabled. . . . . . . . . . . : Yes
|
||||
Autoconfiguration Enabled . . . . : Yes
|
||||
|
||||
Ethernet adapter Ethernet 2:
|
||||
|
||||
Media State . . . . . . . . . . . : Media disconnected
|
||||
Connection-specific DNS Suffix . :
|
||||
Description . . . . . . . . . . . : Realtek PCIe 2.5GbE Family Controller
|
||||
Physical Address. . . . . . . . . : 24-4B-FE-57-3D-F2
|
||||
DHCP Enabled. . . . . . . . . . . : Yes
|
||||
Autoconfiguration Enabled . . . . : Yes
|
||||
|
||||
Unknown adapter OpenVPN Data Channel Offload for NordVPN:
|
||||
|
||||
Media State . . . . . . . . . . . : Media disconnected
|
||||
Connection-specific DNS Suffix . :
|
||||
Description . . . . . . . . . . . : OpenVPN Data Channel Offload
|
||||
Physical Address. . . . . . . . . :
|
||||
DHCP Enabled. . . . . . . . . . . : Yes
|
||||
Autoconfiguration Enabled . . . . : Yes
|
||||
|
||||
Unknown adapter Local Area Connection:
|
||||
|
||||
Media State . . . . . . . . . . . : Media disconnected
|
||||
Connection-specific DNS Suffix . :
|
||||
Description . . . . . . . . . . . : TAP-NordVPN Windows Adapter V9
|
||||
Physical Address. . . . . . . . . : 00-FF-4C-F4-5E-49
|
||||
DHCP Enabled. . . . . . . . . . . : Yes
|
||||
Autoconfiguration Enabled . . . . : Yes
|
||||
|
||||
Wireless LAN adapter Local Area Connection* 1:
|
||||
|
||||
Media State . . . . . . . . . . . : Media disconnected
|
||||
Connection-specific DNS Suffix . :
|
||||
Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter
|
||||
Physical Address. . . . . . . . . : A8-7E-EA-5A-7F-DE
|
||||
DHCP Enabled. . . . . . . . . . . : Yes
|
||||
Autoconfiguration Enabled . . . . : Yes
|
||||
|
||||
Wireless LAN adapter Local Area Connection* 2:
|
||||
|
||||
Media State . . . . . . . . . . . : Media disconnected
|
||||
Connection-specific DNS Suffix . :
|
||||
Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter #2
|
||||
Physical Address. . . . . . . . . : AA-7E-EA-F3-64-C3
|
||||
DHCP Enabled. . . . . . . . . . . : Yes
|
||||
Autoconfiguration Enabled . . . . : Yes
|
||||
|
||||
Ethernet adapter VMware Network Adapter VMnet1:
|
||||
|
||||
Connection-specific DNS Suffix . :
|
||||
Description . . . . . . . . . . . : VMware Virtual Ethernet Adapter for VMnet1
|
||||
Physical Address. . . . . . . . . : 00-50-56-CC-27-73
|
||||
DHCP Enabled. . . . . . . . . . . : Yes
|
||||
Autoconfiguration Enabled . . . . : Yes
|
||||
Link-local IPv6 Address . . . . . : fe80::f47d:9c7f:69dc:591e%8(Preferred)
|
||||
IPv4 Address. . . . . . . . . . . : 192.168.181.1(Preferred)
|
||||
Subnet Mask . . . . . . . . . . . : 255.255.255.0
|
||||
Lease Obtained. . . . . . . . . . : Thursday, September 19, 2024 8:31:29 AM
|
||||
Lease Expires . . . . . . . . . . : Thursday, September 19, 2024 6:01:29 PM
|
||||
Default Gateway . . . . . . . . . :
|
||||
DHCP Server . . . . . . . . . . . : 192.168.181.254
|
||||
DHCPv6 IAID . . . . . . . . . . . : 771772502
|
||||
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-2C-CF-19-EB-24-4B-FE-5B-9B-E6
|
||||
NetBIOS over Tcpip. . . . . . . . : Enabled
|
||||
|
||||
Ethernet adapter VMware Network Adapter VMnet8:
|
||||
|
||||
Connection-specific DNS Suffix . :
|
||||
Description . . . . . . . . . . . : VMware Virtual Ethernet Adapter for VMnet8
|
||||
Physical Address. . . . . . . . . : 00-50-56-C9-A3-78
|
||||
DHCP Enabled. . . . . . . . . . . : Yes
|
||||
Autoconfiguration Enabled . . . . : Yes
|
||||
Link-local IPv6 Address . . . . . : fe80::4551:bf0d:59dd:a4f0%10(Preferred)
|
||||
IPv4 Address. . . . . . . . . . . : 192.168.213.1(Preferred)
|
||||
Subnet Mask . . . . . . . . . . . : 255.255.255.0
|
||||
Lease Obtained. . . . . . . . . . : Thursday, September 19, 2024 8:31:29 AM
|
||||
Lease Expires . . . . . . . . . . : Thursday, September 19, 2024 6:01:29 PM
|
||||
Default Gateway . . . . . . . . . :
|
||||
DHCP Server . . . . . . . . . . . : 192.168.213.254
|
||||
DHCPv6 IAID . . . . . . . . . . . : 788549718
|
||||
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-2C-CF-19-EB-24-4B-FE-5B-9B-E6
|
||||
Primary WINS Server . . . . . . . : 192.168.213.2
|
||||
NetBIOS over Tcpip. . . . . . . . : Enabled
|
||||
|
||||
Wireless LAN adapter Wi-Fi:
|
||||
|
||||
Connection-specific DNS Suffix . : localdomain
|
||||
Description . . . . . . . . . . . : Intel(R) Wi-Fi 6 AX200 160MHz
|
||||
Physical Address. . . . . . . . . : A8-7E-EA-55-26-B0
|
||||
DHCP Enabled. . . . . . . . . . . : Yes
|
||||
Autoconfiguration Enabled . . . . : Yes
|
||||
IPv6 Address. . . . . . . . . . . : fd63:cc9c:65eb:3f95:57c2:aa:10d8:db08(Preferred)
|
||||
Temporary IPv6 Address. . . . . . : fd63:cc9c:65eb:3f95:8928:348e:d692:b7ef(Preferred)
|
||||
Link-local IPv6 Address . . . . . : fe80::4fae:1380:5a1b:8b6b%11(Preferred)
|
||||
IPv4 Address. . . . . . . . . . . : 192.168.1.169(Preferred)
|
||||
Subnet Mask . . . . . . . . . . . : 255.255.255.0
|
||||
Lease Obtained. . . . . . . . . . : Thursday, September 19, 2024 8:31:30 AM
|
||||
Lease Expires . . . . . . . . . . : Friday, September 20, 2024 8:31:30 AM
|
||||
Default Gateway . . . . . . . . . : 192.168.1.1
|
||||
DHCP Server . . . . . . . . . . . : 192.168.1.1
|
||||
DHCPv6 IAID . . . . . . . . . . . : 162037482
|
||||
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-2C-CF-19-EB-24-4B-FE-5B-9B-E6
|
||||
DNS Servers . . . . . . . . . . . : 192.168.1.1
|
||||
NetBIOS over Tcpip. . . . . . . . : Enabled
|
||||
|
||||
Ethernet adapter Bluetooth Network Connection:
|
||||
|
||||
Media State . . . . . . . . . . . : Media disconnected
|
||||
Connection-specific DNS Suffix . :
|
||||
Description . . . . . . . . . . . : Bluetooth Device (Personal Area Network)
|
||||
Physical Address. . . . . . . . . : A8-7E-EA-43-23-14
|
||||
DHCP Enabled. . . . . . . . . . . : Yes
|
||||
Autoconfiguration Enabled . . . . : Yes
|
80
tests/fixtures/windows/windows-2008/ipconfig.json
vendored
Normal file
80
tests/fixtures/windows/windows-2008/ipconfig.json
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
{
|
||||
"host_name": "WIN-SERVER8",
|
||||
"primary_dns_suffix": null,
|
||||
"node_type": "Hybrid",
|
||||
"ip_routing_enabled": false,
|
||||
"wins_proxy_enabled": false,
|
||||
"dns_suffix_search_list": [],
|
||||
"adapters": [
|
||||
{
|
||||
"name_long": "Ethernet adapter Local Area Connection",
|
||||
"name": "Local Area Connection",
|
||||
"type": "Ethernet",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "Intel(R) PRO/1000 MT Network Connection",
|
||||
"physical_address": "00-0C-29-76-C8-D0",
|
||||
"dhcp_enabled": false,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [
|
||||
{
|
||||
"address": "fe80::9595:e8d9:b190:ecac",
|
||||
"prefix_length": 11,
|
||||
"status": "Preferred"
|
||||
}
|
||||
],
|
||||
"ipv4_addresses": [
|
||||
{
|
||||
"address": "192.168.23.154",
|
||||
"subnet_mask": "255.255.255.0",
|
||||
"status": "Preferred",
|
||||
"autoconfigured": false
|
||||
}
|
||||
],
|
||||
"default_gateways": [
|
||||
"192.168.23.1"
|
||||
],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": "234884137",
|
||||
"dhcpv6_client_duid": "00-01-00-01-2D-32-79-97-00-0C-29-76-C8-D0",
|
||||
"dns_servers": [
|
||||
"192.168.23.151"
|
||||
],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": true,
|
||||
"media_state": null,
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Tunnel adapter isatap.{F856FDB3-CE70-489D-A231-704790DC1351}",
|
||||
"name": "isatap.{F856FDB3-CE70-489D-A231-704790DC1351}",
|
||||
"type": "Tunnel",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "Microsoft ISATAP Adapter",
|
||||
"physical_address": "00-00-00-00-00-00-00-E0",
|
||||
"dhcp_enabled": false,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": null,
|
||||
"dhcpv6_client_duid": null,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": null,
|
||||
"media_state": "Media disconnected",
|
||||
"extras": []
|
||||
}
|
||||
],
|
||||
"extras": []
|
||||
}
|
33
tests/fixtures/windows/windows-2008/ipconfig.out
vendored
Normal file
33
tests/fixtures/windows/windows-2008/ipconfig.out
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
|
||||
Windows IP Configuration
|
||||
|
||||
Host Name . . . . . . . . . . . . : WIN-SERVER8
|
||||
Primary Dns Suffix . . . . . . . :
|
||||
Node Type . . . . . . . . . . . . : Hybrid
|
||||
IP Routing Enabled. . . . . . . . : No
|
||||
WINS Proxy Enabled. . . . . . . . : No
|
||||
|
||||
Ethernet adapter Local Area Connection:
|
||||
|
||||
Connection-specific DNS Suffix . :
|
||||
Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Network Connection
|
||||
Physical Address. . . . . . . . . : 00-0C-29-76-C8-D0
|
||||
DHCP Enabled. . . . . . . . . . . : No
|
||||
Autoconfiguration Enabled . . . . : Yes
|
||||
Link-local IPv6 Address . . . . . : fe80::9595:e8d9:b190:ecac%11(Preferred)
|
||||
IPv4 Address. . . . . . . . . . . : 192.168.23.154(Preferred)
|
||||
Subnet Mask . . . . . . . . . . . : 255.255.255.0
|
||||
Default Gateway . . . . . . . . . : 192.168.23.1
|
||||
DHCPv6 IAID . . . . . . . . . . . : 234884137
|
||||
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-2D-32-79-97-00-0C-29-76-C8-D0
|
||||
DNS Servers . . . . . . . . . . . : 192.168.23.151
|
||||
NetBIOS over Tcpip. . . . . . . . : Enabled
|
||||
|
||||
Tunnel adapter isatap.{F856FDB3-CE70-489D-A231-704790DC1351}:
|
||||
|
||||
Media State . . . . . . . . . . . : Media disconnected
|
||||
Connection-specific DNS Suffix . :
|
||||
Description . . . . . . . . . . . : Microsoft ISATAP Adapter
|
||||
Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
|
||||
DHCP Enabled. . . . . . . . . . . : No
|
||||
Autoconfiguration Enabled . . . . : Yes
|
82
tests/fixtures/windows/windows-2016/ipconfig.json
vendored
Normal file
82
tests/fixtures/windows/windows-2016/ipconfig.json
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
{
|
||||
"host_name": "WIN-SERVER16",
|
||||
"primary_dns_suffix": "somecompany.corp",
|
||||
"node_type": "Hybrid",
|
||||
"ip_routing_enabled": false,
|
||||
"wins_proxy_enabled": false,
|
||||
"dns_suffix_search_list": [
|
||||
"somecompany.corp"
|
||||
],
|
||||
"adapters": [
|
||||
{
|
||||
"name_long": "Ethernet adapter Ethernet0",
|
||||
"name": "Ethernet0",
|
||||
"type": "Ethernet",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "Intel(R) 82574L Gigabit Network Connection",
|
||||
"physical_address": "00-0C-29-D6-12-2E",
|
||||
"dhcp_enabled": false,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [
|
||||
{
|
||||
"address": "fe80::40c:2f5f:6658:9ec3",
|
||||
"prefix_length": 2,
|
||||
"status": "Preferred"
|
||||
}
|
||||
],
|
||||
"ipv4_addresses": [
|
||||
{
|
||||
"address": "192.168.22.153",
|
||||
"subnet_mask": "255.255.255.0",
|
||||
"status": "Preferred",
|
||||
"autoconfigured": false
|
||||
}
|
||||
],
|
||||
"default_gateways": [
|
||||
"192.168.22.1"
|
||||
],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": "50334761",
|
||||
"dhcpv6_client_duid": "00-01-00-01-29-4D-1C-4C-00-0C-29-A3-37-4E",
|
||||
"dns_servers": [
|
||||
"192.168.22.151"
|
||||
],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": true,
|
||||
"media_state": null,
|
||||
"extras": []
|
||||
},
|
||||
{
|
||||
"name_long": "Tunnel adapter isatap.{17A4D79E-85D7-47FC-8972-ABBD8B58DC71}",
|
||||
"name": "isatap.{17A4D79E-85D7-47FC-8972-ABBD8B58DC71}",
|
||||
"type": "Tunnel",
|
||||
"connection_specific_dns_suffix": null,
|
||||
"connection_specific_dns_suffix_search_list": [],
|
||||
"description": "Microsoft ISATAP Adapter #2",
|
||||
"physical_address": "00-00-00-00-00-00-00-E0",
|
||||
"dhcp_enabled": false,
|
||||
"autoconfiguration_enabled": true,
|
||||
"ipv6_addresses": [],
|
||||
"temporary_ipv6_addresses": [],
|
||||
"link_local_ipv6_addresses": [],
|
||||
"ipv4_addresses": [],
|
||||
"default_gateways": [],
|
||||
"dhcp_server": null,
|
||||
"dhcpv6_iaid": null,
|
||||
"dhcpv6_client_duid": null,
|
||||
"dns_servers": [],
|
||||
"primary_wins_server": null,
|
||||
"lease_expires": null,
|
||||
"lease_obtained": null,
|
||||
"netbios_over_tcpip": null,
|
||||
"media_state": "Media disconnected",
|
||||
"extras": []
|
||||
}
|
||||
],
|
||||
"extras": []
|
||||
}
|
34
tests/fixtures/windows/windows-2016/ipconfig.out
vendored
Normal file
34
tests/fixtures/windows/windows-2016/ipconfig.out
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
|
||||
Windows IP Configuration
|
||||
|
||||
Host Name . . . . . . . . . . . . : WIN-SERVER16
|
||||
Primary Dns Suffix . . . . . . . : somecompany.corp
|
||||
Node Type . . . . . . . . . . . . : Hybrid
|
||||
IP Routing Enabled. . . . . . . . : No
|
||||
WINS Proxy Enabled. . . . . . . . : No
|
||||
DNS Suffix Search List. . . . . . : somecompany.corp
|
||||
|
||||
Ethernet adapter Ethernet0:
|
||||
|
||||
Connection-specific DNS Suffix . :
|
||||
Description . . . . . . . . . . . : Intel(R) 82574L Gigabit Network Connection
|
||||
Physical Address. . . . . . . . . : 00-0C-29-D6-12-2E
|
||||
DHCP Enabled. . . . . . . . . . . : No
|
||||
Autoconfiguration Enabled . . . . : Yes
|
||||
Link-local IPv6 Address . . . . . : fe80::40c:2f5f:6658:9ec3%2(Preferred)
|
||||
IPv4 Address. . . . . . . . . . . : 192.168.22.153(Preferred)
|
||||
Subnet Mask . . . . . . . . . . . : 255.255.255.0
|
||||
Default Gateway . . . . . . . . . : 192.168.22.1
|
||||
DHCPv6 IAID . . . . . . . . . . . : 50334761
|
||||
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-29-4D-1C-4C-00-0C-29-A3-37-4E
|
||||
DNS Servers . . . . . . . . . . . : 192.168.22.151
|
||||
NetBIOS over Tcpip. . . . . . . . : Enabled
|
||||
|
||||
Tunnel adapter isatap.{17A4D79E-85D7-47FC-8972-ABBD8B58DC71}:
|
||||
|
||||
Media State . . . . . . . . . . . : Media disconnected
|
||||
Connection-specific DNS Suffix . :
|
||||
Description . . . . . . . . . . . : Microsoft ISATAP Adapter #2
|
||||
Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
|
||||
DHCP Enabled. . . . . . . . . . . : No
|
||||
Autoconfiguration Enabled . . . . : Yes
|
1
tests/fixtures/windows/windows-7/ipconfig.json
vendored
Normal file
1
tests/fixtures/windows/windows-7/ipconfig.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"host_name":"DESKTOP-WIN7","primary_dns_suffix":"somecompany.corp","node_type":"Hybrid","ip_routing_enabled":false,"wins_proxy_enabled":false,"dns_suffix_search_list":["somecompany.corp"],"adapters":[{"name_long":"Ethernet adapter Local Area Connection","name":"Local Area Connection","type":"Ethernet","connection_specific_dns_suffix":null,"connection_specific_dns_suffix_search_list":[],"description":"Intel(R) PRO/1000 MT Network Connection","physical_address":"00-0C-29-37-3B-4E","dhcp_enabled":true,"autoconfiguration_enabled":true,"ipv6_addresses":[],"temporary_ipv6_addresses":[],"link_local_ipv6_addresses":[{"address":"fe80::c447:d1ef:c29f:c44c","prefix_length":10,"status":"Preferred"}],"ipv4_addresses":[{"address":"192.168.22.33","subnet_mask":"255.255.255.0","status":"Preferred","autoconfigured":false}],"default_gateways":["192.168.22.1"],"dhcp_server":"192.168.22.1","dhcpv6_iaid":"234881473","dhcpv6_client_duid":"00-01-00-01-29-4E-8F-8A-00-0C-29-88-1B-1F","dns_servers":["192.168.22.151"],"primary_wins_server":null,"lease_expires":"Tuesday, September 24, 2024 7:02:58 AM","lease_obtained":"Friday, September 20, 2024 12:13:59 PM","netbios_over_tcpip":true,"media_state":null,"extras":[],"lease_expires_epoch":1727186578,"lease_expires_iso":"2024-09-24T07:02:58","lease_obtained_epoch":1726859639,"lease_obtained_iso":"2024-09-20T12:13:59"},{"name_long":"Tunnel adapter isatap.{E24F3EA8-436E-3B26-8BB9-CED33928744B}","name":"isatap.{E24F3EA8-436E-3B26-8BB9-CED33928744B}","type":"Tunnel","connection_specific_dns_suffix":null,"connection_specific_dns_suffix_search_list":[],"description":"Microsoft ISATAP Adapter","physical_address":"00-00-00-00-00-00-00-E0","dhcp_enabled":false,"autoconfiguration_enabled":true,"ipv6_addresses":[],"temporary_ipv6_addresses":[],"link_local_ipv6_addresses":[],"ipv4_addresses":[],"default_gateways":[],"dhcp_server":null,"dhcpv6_iaid":null,"dhcpv6_client_duid":null,"dns_servers":[],"primary_wins_server":null,"lease_expires":null,"lease_obtained":null,"netbios_over_tcpip":null,"media_state":"Media disconnected","extras":[]}],"extras":[]}
|
37
tests/fixtures/windows/windows-7/ipconfig.out
vendored
Normal file
37
tests/fixtures/windows/windows-7/ipconfig.out
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
Windows IP Configuration
|
||||
|
||||
Host Name . . . . . . . . . . . . : DESKTOP-WIN7
|
||||
Primary Dns Suffix . . . . . . . : somecompany.corp
|
||||
Node Type . . . . . . . . . . . . : Hybrid
|
||||
IP Routing Enabled. . . . . . . . : No
|
||||
WINS Proxy Enabled. . . . . . . . : No
|
||||
DNS Suffix Search List. . . . . . : somecompany.corp
|
||||
|
||||
Ethernet adapter Local Area Connection:
|
||||
|
||||
Connection-specific DNS Suffix . :
|
||||
Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Network Connection
|
||||
Physical Address. . . . . . . . . : 00-0C-29-37-3B-4E
|
||||
DHCP Enabled. . . . . . . . . . . : Yes
|
||||
Autoconfiguration Enabled . . . . : Yes
|
||||
Link-local IPv6 Address . . . . . : fe80::c447:d1ef:c29f:c44c%10(Preferred)
|
||||
IPv4 Address. . . . . . . . . . . : 192.168.22.33(Preferred)
|
||||
Subnet Mask . . . . . . . . . . . : 255.255.255.0
|
||||
Lease Obtained. . . . . . . . . . : Friday, September 20, 2024 12:13:59 PM
|
||||
Lease Expires . . . . . . . . . . : Tuesday, September 24, 2024 7:02:58 AM
|
||||
Default Gateway . . . . . . . . . : 192.168.22.1
|
||||
DHCP Server . . . . . . . . . . . : 192.168.22.1
|
||||
DHCPv6 IAID . . . . . . . . . . . : 234881473
|
||||
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-29-4E-8F-8A-00-0C-29-88-1B-1F
|
||||
DNS Servers . . . . . . . . . . . : 192.168.22.151
|
||||
NetBIOS over Tcpip. . . . . . . . : Enabled
|
||||
|
||||
Tunnel adapter isatap.{E24F3EA8-436E-3B26-8BB9-CED33928744B}:
|
||||
|
||||
Media State . . . . . . . . . . . : Media disconnected
|
||||
Connection-specific DNS Suffix . :
|
||||
Description . . . . . . . . . . . : Microsoft ISATAP Adapter
|
||||
Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
|
||||
DHCP Enabled. . . . . . . . . . . : No
|
||||
Autoconfiguration Enabled . . . . : Yes
|
1
tests/fixtures/windows/windows-xp/ipconfig.json
vendored
Normal file
1
tests/fixtures/windows/windows-xp/ipconfig.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"host_name":"DESKTOP-PC4","primary_dns_suffix":"somecompany.corp","node_type":"Unknown","ip_routing_enabled":false,"wins_proxy_enabled":false,"dns_suffix_search_list":["somecompany.corp","somecompany.xyz"],"adapters":[{"name_long":"Ethernet adapter Local Area Connection","name":"Local Area Connection","type":"Ethernet","connection_specific_dns_suffix":null,"connection_specific_dns_suffix_search_list":[],"description":"Intel(R) PRO/1000 MT Network Connection","physical_address":"00-0C-29-25-B6-4D","dhcp_enabled":true,"autoconfiguration_enabled":true,"ipv6_addresses":[],"temporary_ipv6_addresses":[],"link_local_ipv6_addresses":[],"ipv4_addresses":[{"address":"192.168.22.135","subnet_mask":"255.255.255.0","status":null,"autoconfigured":false}],"default_gateways":["192.168.22.1"],"dhcp_server":"192.168.22.1","dhcpv6_iaid":null,"dhcpv6_client_duid":null,"dns_servers":["192.168.22.151"],"primary_wins_server":null,"lease_expires":"Sunday, September 22, 2024 10:31:26 PM","lease_obtained":"Saturday, September 21, 2024 10:31:26 PM","netbios_over_tcpip":null,"media_state":null,"extras":[],"lease_expires_epoch":1727069486,"lease_expires_iso":"2024-09-22T22:31:26","lease_obtained_epoch":1726983086,"lease_obtained_iso":"2024-09-21T22:31:26"}],"extras":[]}
|
25
tests/fixtures/windows/windows-xp/ipconfig.out
vendored
Normal file
25
tests/fixtures/windows/windows-xp/ipconfig.out
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
Windows IP Configuration
|
||||
|
||||
Host Name . . . . . . . . . . . . : DESKTOP-PC4
|
||||
Primary Dns Suffix . . . . . . . : somecompany.corp
|
||||
Node Type . . . . . . . . . . . . : Unknown
|
||||
IP Routing Enabled. . . . . . . . : No
|
||||
WINS Proxy Enabled. . . . . . . . : No
|
||||
DNS Suffix Search List. . . . . . : somecompany.corp
|
||||
somecompany.xyz
|
||||
|
||||
Ethernet adapter Local Area Connection:
|
||||
|
||||
Connection-specific DNS Suffix . :
|
||||
Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Network Connection
|
||||
Physical Address. . . . . . . . . : 00-0C-29-25-B6-4D
|
||||
DHCP Enabled. . . . . . . . . . . : Yes
|
||||
Autoconfiguration Enabled . . . . : Yes
|
||||
IP Address. . . . . . . . . . . . : 192.168.22.135
|
||||
Subnet Mask . . . . . . . . . . . : 255.255.255.0
|
||||
Default Gateway . . . . . . . . . : 192.168.22.1
|
||||
DHCP Server . . . . . . . . . . . : 192.168.22.1
|
||||
DNS Servers . . . . . . . . . . . : 192.168.22.151
|
||||
Lease Obtained. . . . . . . . . . : Saturday, September 21, 2024 10:31:26 PM
|
||||
Lease Expires . . . . . . . . . . : Sunday, September 22, 2024 10:31:26 PM
|
BIN
tests/templates/.DS_Store
vendored
Normal file
BIN
tests/templates/.DS_Store
vendored
Normal file
Binary file not shown.
@ -104,6 +104,58 @@ class BluetoothctlTests(unittest.TestCase):
|
||||
if actual:
|
||||
for k, v in expected.items():
|
||||
self.assertEqual(v, actual[0][k], f"Controller regex failed on {k}")
|
||||
|
||||
def test_bluetoothctl_controller_with_manufacturer(self):
|
||||
"""
|
||||
Test 'bluetoothctl' with controller having manufacturer attr
|
||||
"""
|
||||
|
||||
with open("tests/fixtures/generic/bluetoothctl_controller_with_manufacturer.out", "r") as f:
|
||||
output = f.read()
|
||||
|
||||
actual = parse(output, quiet=True)
|
||||
|
||||
self.assertIsNotNone(actual)
|
||||
self.assertIsNotNone(actual[0])
|
||||
|
||||
expected = {
|
||||
"manufacturer": "0x0002 (2)",
|
||||
"version": "0x08 (8)",
|
||||
"address": "48:A4:72:3C:96:63",
|
||||
"is_public": True,
|
||||
"name": "ubuntu",
|
||||
"alias": "ubuntu",
|
||||
"class": "0x007c0104 (8126724)",
|
||||
"powered": "yes",
|
||||
"discoverable": "yes",
|
||||
"discoverable_timeout": "0x000000b4 (180)",
|
||||
"pairable": "yes",
|
||||
"uuids": [
|
||||
"Message Notification Se.. (00001133-0000-1000-8000-00805f9b34fb)",
|
||||
"A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)",
|
||||
"OBEX Object Push (00001105-0000-1000-8000-00805f9b34fb)",
|
||||
"Message Access Server (00001132-0000-1000-8000-00805f9b34fb)",
|
||||
"PnP Information (00001200-0000-1000-8000-00805f9b34fb)",
|
||||
"IrMC Sync (00001104-0000-1000-8000-00805f9b34fb)",
|
||||
"Vendor specific (00005005-0000-1000-8000-0002ee000001)",
|
||||
"A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)",
|
||||
"Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)",
|
||||
"Phonebook Access Server (0000112f-0000-1000-8000-00805f9b34fb)",
|
||||
"Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)",
|
||||
"Device Information (0000180a-0000-1000-8000-00805f9b34fb)",
|
||||
"Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)",
|
||||
"Handsfree Audio Gateway (0000111f-0000-1000-8000-00805f9b34fb)",
|
||||
"Audio Source (0000110a-0000-1000-8000-00805f9b34fb)",
|
||||
"OBEX File Transfer (00001106-0000-1000-8000-00805f9b34fb)",
|
||||
"Handsfree (0000111e-0000-1000-8000-00805f9b34fb)"
|
||||
],
|
||||
"modalias": "usb:v1D6Bp0246d0548",
|
||||
"discovering": "yes"
|
||||
}
|
||||
|
||||
if actual:
|
||||
for k, v in expected.items():
|
||||
self.assertEqual(v, actual[0][k], f"Controller regex failed on {k}")
|
||||
|
||||
def test_bluetoothctl_controllers(self):
|
||||
"""
|
||||
|
@ -33,6 +33,9 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/df-h.out'), 'r', encoding='utf-8') as f:
|
||||
osx_10_14_6_df_h = f.read()
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/df-hh.out'), 'r', encoding='utf-8') as f:
|
||||
osx_10_14_6_df_hh = f.read()
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/df-long-filesystem.out'), 'r', encoding='utf-8') as f:
|
||||
generic_df_long_filesystem = f.read()
|
||||
|
||||
@ -61,6 +64,9 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/df-h.json'), 'r', encoding='utf-8') as f:
|
||||
osx_10_14_6_df_h_json = json.loads(f.read())
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/df-hh.json'), 'r', encoding='utf-8') as f:
|
||||
osx_10_14_6_df_hh_json = json.loads(f.read())
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/df-long-filesystem.json'), 'r', encoding='utf-8') as f:
|
||||
generic_df_long_filesystem_json = json.loads(f.read())
|
||||
|
||||
@ -119,6 +125,12 @@ class MyTests(unittest.TestCase):
|
||||
"""
|
||||
self.assertEqual(jc.parsers.df.parse(self.osx_10_14_6_df_h, quiet=True), self.osx_10_14_6_df_h_json)
|
||||
|
||||
def test_df_hh_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'df -H' on OSX 10.14.6
|
||||
"""
|
||||
self.assertEqual(jc.parsers.df.parse(self.osx_10_14_6_df_hh, quiet=True), self.osx_10_14_6_df_hh_json)
|
||||
|
||||
def test_df_long_filesystem(self):
|
||||
"""
|
||||
Test older version of 'df' with long filesystem data
|
||||
|
@ -148,5 +148,17 @@ class MyTests(unittest.TestCase):
|
||||
"""
|
||||
self.assertEqual(jc.parsers.ifconfig.parse(self.osx_freebsd12_ifconfig_extra_fields4, quiet=True), self.freebsd12_ifconfig_extra_fields4_json)
|
||||
|
||||
def test_ifconfig_utun_ipv4(self):
|
||||
"""
|
||||
Test 'ifconfig' with ipv4 utun addresses (macOS)
|
||||
"""
|
||||
data = r'''utun2: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1400
|
||||
inet 10.85.40.243 --> 10.85.40.243 netmask 0xffffffff
|
||||
inet6 fe80::3af9:d3ff:fe69:1732%utun2 prefixlen 64 scopeid 0xd
|
||||
inet6 fdae:f7e0:9f37:64::146 prefixlen 128
|
||||
nd6 options=201<PERFORMNUD,DAD>'''
|
||||
expected = [{"name":"utun2","flags":8051,"state":["UP","POINTOPOINT","RUNNING","MULTICAST"],"mtu":1400,"type":None,"mac_addr":None,"ipv4_addr":"10.85.40.243","ipv4_mask":"255.255.255.255","ipv4_bcast":None,"ipv6_addr":"fdae:f7e0:9f37:64::146","ipv6_mask":128,"ipv6_scope":None,"ipv6_type":None,"metric":None,"rx_packets":None,"rx_errors":None,"rx_dropped":None,"rx_overruns":None,"rx_frame":None,"tx_packets":None,"tx_errors":None,"tx_dropped":None,"tx_overruns":None,"tx_carrier":None,"tx_collisions":None,"rx_bytes":None,"tx_bytes":None,"ipv6_scope_id":None,"nd6_options":201,"nd6_flags":["PERFORMNUD","DAD"],"ipv4":[{"address":"10.85.40.243","mask":"255.255.255.255"}],"ipv6":[{"address":"fe80::3af9:d3ff:fe69:1732","scope_id":"utun2","mask":64,"scope":"0xd"},{"address":"fdae:f7e0:9f37:64::146","scope_id":None,"mask":128,"scope":None}]}]
|
||||
self.assertEqual(jc.parsers.ifconfig.parse(self.osx_freebsd12_ifconfig_extra_fields4, quiet=True), self.freebsd12_ifconfig_extra_fields4_json)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
@ -88,18 +88,96 @@ class MyTests(unittest.TestCase):
|
||||
"""
|
||||
Test ipv6 address with ipv4 mapped string
|
||||
"""
|
||||
# IPv4 mapped behavior changes in newer versions of python are being backported
|
||||
# to old versions so we are checking if at least one style passes
|
||||
|
||||
data = r'::FFFF:192.168.1.35'
|
||||
expected = json.loads(r'''{"version":6,"max_prefix_length":128,"ip":"::ffff:c0a8:123","ip_compressed":"::ffff:c0a8:123","ip_exploded":"0000:0000:0000:0000:0000:ffff:c0a8:0123","ip_split":["0000","0000","0000","0000","0000","ffff","c0a8","0123"],"scope_id":null,"ipv4_mapped":"192.168.1.35","six_to_four":null,"teredo_client":null,"teredo_server":null,"dns_ptr":"3.2.1.0.8.a.0.c.f.f.f.f.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa","network":"::ffff:c0a8:123","broadcast":"::ffff:c0a8:123","hostmask":"::","netmask":"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff","cidr_netmask":128,"hosts":1,"first_host":"::ffff:c0a8:123","last_host":"::ffff:c0a8:123","is_multicast":false,"is_private":true,"is_global":false,"is_link_local":false,"is_loopback":false,"is_reserved":true,"is_unspecified":false,"int":{"ip":281473913979171,"network":281473913979171,"broadcast":281473913979171,"first_host":281473913979171,"last_host":281473913979171},"hex":{"ip":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23","network":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23","broadcast":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23","hostmask":"00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00","netmask":"ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff","first_host":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23","last_host":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23"},"bin":{"ip":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011","network":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011","broadcast":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011","hostmask":"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","netmask":"11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111","first_host":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011","last_host":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011"}}''')
|
||||
self.assertEqual(jc.parsers.ip_address.parse(data, quiet=True), expected)
|
||||
actual = jc.parsers.ip_address.parse(data, quiet=True)
|
||||
failures = 0
|
||||
failure_msgs = []
|
||||
|
||||
# New-Style IPv4 Mapped output with is_reserved=false
|
||||
expected_ipv4 = '192.168.1.35'
|
||||
expected_ipv4_exploded = '192.168.1.35'
|
||||
expected_ipv4_split = '["0000", "0000", "0000", "0000", "0000", "ffff", "192", "168", "1", "35"]'
|
||||
expected_is_reserved = 'false'
|
||||
expected = json.loads(f'''{{"version":6,"max_prefix_length":128,"ip":"::ffff:{expected_ipv4}","ip_compressed":"::ffff:{expected_ipv4}","ip_exploded":"0000:0000:0000:0000:0000:ffff:{expected_ipv4_exploded}","ip_split":{expected_ipv4_split},"scope_id":null,"ipv4_mapped":"192.168.1.35","six_to_four":null,"teredo_client":null,"teredo_server":null,"dns_ptr":"3.2.1.0.8.a.0.c.f.f.f.f.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa","network":"::ffff:{expected_ipv4}","broadcast":"::ffff:{expected_ipv4}","hostmask":"::","netmask":"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff","cidr_netmask":128,"hosts":1,"first_host":"::ffff:{expected_ipv4}","last_host":"::ffff:{expected_ipv4}","is_multicast":false,"is_private":true,"is_global":false,"is_link_local":false,"is_loopback":false,"is_reserved":{expected_is_reserved},"is_unspecified":false,"int":{{"ip":281473913979171,"network":281473913979171,"broadcast":281473913979171,"first_host":281473913979171,"last_host":281473913979171}},"hex":{{"ip":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23","network":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23","broadcast":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23","hostmask":"00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00","netmask":"ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff","first_host":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23","last_host":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23"}},"bin":{{"ip":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011","network":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011","broadcast":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011","hostmask":"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","netmask":"11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111","first_host":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011","last_host":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011"}}}}''')
|
||||
|
||||
try:
|
||||
self.assertEqual(actual, expected)
|
||||
except AssertionError:
|
||||
failures += 1
|
||||
failure_msgs.append(f'New-style IPv4 Mapped is_reserved=false failure:\n Expected: {expected}\n Actual: {actual}')
|
||||
|
||||
# New-Style IPv4 Mapped output with is_reserved=true
|
||||
expected_is_reserved = 'true'
|
||||
expected = json.loads(f'''{{"version":6,"max_prefix_length":128,"ip":"::ffff:{expected_ipv4}","ip_compressed":"::ffff:{expected_ipv4}","ip_exploded":"0000:0000:0000:0000:0000:ffff:{expected_ipv4_exploded}","ip_split":{expected_ipv4_split},"scope_id":null,"ipv4_mapped":"192.168.1.35","six_to_four":null,"teredo_client":null,"teredo_server":null,"dns_ptr":"3.2.1.0.8.a.0.c.f.f.f.f.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa","network":"::ffff:{expected_ipv4}","broadcast":"::ffff:{expected_ipv4}","hostmask":"::","netmask":"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff","cidr_netmask":128,"hosts":1,"first_host":"::ffff:{expected_ipv4}","last_host":"::ffff:{expected_ipv4}","is_multicast":false,"is_private":true,"is_global":false,"is_link_local":false,"is_loopback":false,"is_reserved":{expected_is_reserved},"is_unspecified":false,"int":{{"ip":281473913979171,"network":281473913979171,"broadcast":281473913979171,"first_host":281473913979171,"last_host":281473913979171}},"hex":{{"ip":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23","network":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23","broadcast":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23","hostmask":"00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00","netmask":"ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff","first_host":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23","last_host":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23"}},"bin":{{"ip":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011","network":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011","broadcast":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011","hostmask":"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","netmask":"11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111","first_host":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011","last_host":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011"}}}}''')
|
||||
|
||||
try:
|
||||
self.assertEqual(actual, expected)
|
||||
except AssertionError:
|
||||
failures += 1
|
||||
failure_msgs.append(f'New-style IPv4 Mapped is_reserved=true failure:\n Expected: {expected}\n Actual: {actual}')
|
||||
|
||||
# Old-Style IPv4 Mapped output with is_reserved=false
|
||||
expected_ipv4 = 'c0a8:123'
|
||||
expected_ipv4_exploded = 'c0a8:0123'
|
||||
expected_ipv4_split = '["0000", "0000", "0000", "0000", "0000", "ffff", "c0a8", "0123"]'
|
||||
expected_is_reserved = 'false'
|
||||
expected = json.loads(f'''{{"version":6,"max_prefix_length":128,"ip":"::ffff:{expected_ipv4}","ip_compressed":"::ffff:{expected_ipv4}","ip_exploded":"0000:0000:0000:0000:0000:ffff:{expected_ipv4_exploded}","ip_split":{expected_ipv4_split},"scope_id":null,"ipv4_mapped":"192.168.1.35","six_to_four":null,"teredo_client":null,"teredo_server":null,"dns_ptr":"3.2.1.0.8.a.0.c.f.f.f.f.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa","network":"::ffff:{expected_ipv4}","broadcast":"::ffff:{expected_ipv4}","hostmask":"::","netmask":"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff","cidr_netmask":128,"hosts":1,"first_host":"::ffff:{expected_ipv4}","last_host":"::ffff:{expected_ipv4}","is_multicast":false,"is_private":true,"is_global":false,"is_link_local":false,"is_loopback":false,"is_reserved":{expected_is_reserved},"is_unspecified":false,"int":{{"ip":281473913979171,"network":281473913979171,"broadcast":281473913979171,"first_host":281473913979171,"last_host":281473913979171}},"hex":{{"ip":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23","network":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23","broadcast":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23","hostmask":"00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00","netmask":"ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff","first_host":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23","last_host":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23"}},"bin":{{"ip":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011","network":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011","broadcast":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011","hostmask":"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","netmask":"11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111","first_host":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011","last_host":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011"}}}}''')
|
||||
|
||||
try:
|
||||
self.assertEqual(actual, expected)
|
||||
except AssertionError:
|
||||
failures += 1
|
||||
failure_msgs.append(f'Old-style IPv4 Mapped is_reserved=false failure:\n Expected: {expected}\n Actual: {actual}')
|
||||
|
||||
# Old-Style IPv4 Mapped output with is_reserved=true
|
||||
expected_is_reserved = 'true'
|
||||
expected = json.loads(f'''{{"version":6,"max_prefix_length":128,"ip":"::ffff:{expected_ipv4}","ip_compressed":"::ffff:{expected_ipv4}","ip_exploded":"0000:0000:0000:0000:0000:ffff:{expected_ipv4_exploded}","ip_split":{expected_ipv4_split},"scope_id":null,"ipv4_mapped":"192.168.1.35","six_to_four":null,"teredo_client":null,"teredo_server":null,"dns_ptr":"3.2.1.0.8.a.0.c.f.f.f.f.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa","network":"::ffff:{expected_ipv4}","broadcast":"::ffff:{expected_ipv4}","hostmask":"::","netmask":"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff","cidr_netmask":128,"hosts":1,"first_host":"::ffff:{expected_ipv4}","last_host":"::ffff:{expected_ipv4}","is_multicast":false,"is_private":true,"is_global":false,"is_link_local":false,"is_loopback":false,"is_reserved":{expected_is_reserved},"is_unspecified":false,"int":{{"ip":281473913979171,"network":281473913979171,"broadcast":281473913979171,"first_host":281473913979171,"last_host":281473913979171}},"hex":{{"ip":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23","network":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23","broadcast":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23","hostmask":"00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00","netmask":"ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff","first_host":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23","last_host":"00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23"}},"bin":{{"ip":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011","network":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011","broadcast":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011","hostmask":"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","netmask":"11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111","first_host":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011","last_host":"00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000101010000000000100100011"}}}}''')
|
||||
|
||||
try:
|
||||
self.assertEqual(actual, expected)
|
||||
except AssertionError:
|
||||
failures += 1
|
||||
failure_msgs.append(f'Old-style IPv4 Mapped is_reserved=true failure:\n Expected: {expected}\n Actual: {actual}')
|
||||
|
||||
if failures > 3:
|
||||
self.fail('\n\n'.join(failure_msgs))
|
||||
|
||||
|
||||
def test_ip_address_ipv6_6to4(self):
|
||||
"""
|
||||
Test ipv6 6to4 address string
|
||||
"""
|
||||
# 6to4 behavior changes in newer versions of python are being backported
|
||||
# to old versions so we are checking if at least one style passes
|
||||
|
||||
data = r'2002:c000:204::/48'
|
||||
expected = json.loads(r'''{"version":6,"max_prefix_length":128,"ip":"2002:c000:204::","ip_compressed":"2002:c000:204::","ip_exploded":"2002:c000:0204:0000:0000:0000:0000:0000","ip_split":["2002","c000","0204","0000","0000","0000","0000","0000"],"scope_id":null,"ipv4_mapped":null,"six_to_four":"192.0.2.4","teredo_client":null,"teredo_server":null,"dns_ptr":"0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.4.0.2.0.0.0.0.c.2.0.0.2.ip6.arpa","network":"2002:c000:204::","broadcast":"2002:c000:204:ffff:ffff:ffff:ffff:ffff","hostmask":"::ffff:ffff:ffff:ffff:ffff","netmask":"ffff:ffff:ffff::","cidr_netmask":48,"hosts":1208925819614629174706174,"first_host":"2002:c000:204::1","last_host":"2002:c000:204:ffff:ffff:ffff:ffff:fffe","is_multicast":false,"is_private":false,"is_global":true,"is_link_local":false,"is_loopback":false,"is_reserved":false,"is_unspecified":false,"int":{"ip":42549574682102084431821433448024768512,"network":42549574682102084431821433448024768512,"broadcast":42549574682103293357641048077199474687,"first_host":42549574682102084431821433448024768513,"last_host":42549574682103293357641048077199474686},"hex":{"ip":"20:02:c0:00:02:04:00:00:00:00:00:00:00:00:00:00","network":"20:02:c0:00:02:04:00:00:00:00:00:00:00:00:00:00","broadcast":"20:02:c0:00:02:04:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff","hostmask":"00:00:00:00:00:00:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff","netmask":"ff:ff:ff:ff:ff:ff:00:00:00:00:00:00:00:00:00:00","first_host":"20:02:c0:00:02:04:00:00:00:00:00:00:00:00:00:01","last_host":"20:02:c0:00:02:04:ff:ff:ff:ff:ff:ff:ff:ff:ff:fe"},"bin":{"ip":"00100000000000101100000000000000000000100000010000000000000000000000000000000000000000000000000000000000000000000000000000000000","network":"00100000000000101100000000000000000000100000010000000000000000000000000000000000000000000000000000000000000000000000000000000000","broadcast":"00100000000000101100000000000000000000100000010011111111111111111111111111111111111111111111111111111111111111111111111111111111","hostmask":"00000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111111","netmask":"11111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000","first_host":"00100000000000101100000000000000000000100000010000000000000000000000000000000000000000000000000000000000000000000000000000000001","last_host":"00100000000000101100000000000000000000100000010011111111111111111111111111111111111111111111111111111111111111111111111111111110"}}''')
|
||||
self.assertEqual(jc.parsers.ip_address.parse(data, quiet=True), expected)
|
||||
actual = jc.parsers.ip_address.parse(data, quiet=True)
|
||||
failures = 0
|
||||
failure_msgs = []
|
||||
|
||||
# New-Style 6to4 output
|
||||
expected_private = r'"is_private":true,"is_global":false'
|
||||
expected = json.loads(r'''{"version":6,"max_prefix_length":128,"ip":"2002:c000:204::","ip_compressed":"2002:c000:204::","ip_exploded":"2002:c000:0204:0000:0000:0000:0000:0000","ip_split":["2002","c000","0204","0000","0000","0000","0000","0000"],"scope_id":null,"ipv4_mapped":null,"six_to_four":"192.0.2.4","teredo_client":null,"teredo_server":null,"dns_ptr":"0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.4.0.2.0.0.0.0.c.2.0.0.2.ip6.arpa","network":"2002:c000:204::","broadcast":"2002:c000:204:ffff:ffff:ffff:ffff:ffff","hostmask":"::ffff:ffff:ffff:ffff:ffff","netmask":"ffff:ffff:ffff::","cidr_netmask":48,"hosts":1208925819614629174706174,"first_host":"2002:c000:204::1","last_host":"2002:c000:204:ffff:ffff:ffff:ffff:fffe","is_multicast":false,''' + expected_private + r''',"is_link_local":false,"is_loopback":false,"is_reserved":false,"is_unspecified":false,"int":{"ip":42549574682102084431821433448024768512,"network":42549574682102084431821433448024768512,"broadcast":42549574682103293357641048077199474687,"first_host":42549574682102084431821433448024768513,"last_host":42549574682103293357641048077199474686},"hex":{"ip":"20:02:c0:00:02:04:00:00:00:00:00:00:00:00:00:00","network":"20:02:c0:00:02:04:00:00:00:00:00:00:00:00:00:00","broadcast":"20:02:c0:00:02:04:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff","hostmask":"00:00:00:00:00:00:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff","netmask":"ff:ff:ff:ff:ff:ff:00:00:00:00:00:00:00:00:00:00","first_host":"20:02:c0:00:02:04:00:00:00:00:00:00:00:00:00:01","last_host":"20:02:c0:00:02:04:ff:ff:ff:ff:ff:ff:ff:ff:ff:fe"},"bin":{"ip":"00100000000000101100000000000000000000100000010000000000000000000000000000000000000000000000000000000000000000000000000000000000","network":"00100000000000101100000000000000000000100000010000000000000000000000000000000000000000000000000000000000000000000000000000000000","broadcast":"00100000000000101100000000000000000000100000010011111111111111111111111111111111111111111111111111111111111111111111111111111111","hostmask":"00000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111111","netmask":"11111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000","first_host":"00100000000000101100000000000000000000100000010000000000000000000000000000000000000000000000000000000000000000000000000000000001","last_host":"00100000000000101100000000000000000000100000010011111111111111111111111111111111111111111111111111111111111111111111111111111110"}}''')
|
||||
try:
|
||||
self.assertEqual(actual, expected)
|
||||
except AssertionError:
|
||||
failures += 1
|
||||
failure_msgs.append(f'New-style 6to4 address failure:\n Expected: {expected}\n Actual: {actual}')
|
||||
|
||||
# Old-Style 6to4 output
|
||||
expected_private = r'"is_private":false,"is_global":true'
|
||||
expected = json.loads(r'''{"version":6,"max_prefix_length":128,"ip":"2002:c000:204::","ip_compressed":"2002:c000:204::","ip_exploded":"2002:c000:0204:0000:0000:0000:0000:0000","ip_split":["2002","c000","0204","0000","0000","0000","0000","0000"],"scope_id":null,"ipv4_mapped":null,"six_to_four":"192.0.2.4","teredo_client":null,"teredo_server":null,"dns_ptr":"0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.4.0.2.0.0.0.0.c.2.0.0.2.ip6.arpa","network":"2002:c000:204::","broadcast":"2002:c000:204:ffff:ffff:ffff:ffff:ffff","hostmask":"::ffff:ffff:ffff:ffff:ffff","netmask":"ffff:ffff:ffff::","cidr_netmask":48,"hosts":1208925819614629174706174,"first_host":"2002:c000:204::1","last_host":"2002:c000:204:ffff:ffff:ffff:ffff:fffe","is_multicast":false,''' + expected_private + r''',"is_link_local":false,"is_loopback":false,"is_reserved":false,"is_unspecified":false,"int":{"ip":42549574682102084431821433448024768512,"network":42549574682102084431821433448024768512,"broadcast":42549574682103293357641048077199474687,"first_host":42549574682102084431821433448024768513,"last_host":42549574682103293357641048077199474686},"hex":{"ip":"20:02:c0:00:02:04:00:00:00:00:00:00:00:00:00:00","network":"20:02:c0:00:02:04:00:00:00:00:00:00:00:00:00:00","broadcast":"20:02:c0:00:02:04:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff","hostmask":"00:00:00:00:00:00:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff","netmask":"ff:ff:ff:ff:ff:ff:00:00:00:00:00:00:00:00:00:00","first_host":"20:02:c0:00:02:04:00:00:00:00:00:00:00:00:00:01","last_host":"20:02:c0:00:02:04:ff:ff:ff:ff:ff:ff:ff:ff:ff:fe"},"bin":{"ip":"00100000000000101100000000000000000000100000010000000000000000000000000000000000000000000000000000000000000000000000000000000000","network":"00100000000000101100000000000000000000100000010000000000000000000000000000000000000000000000000000000000000000000000000000000000","broadcast":"00100000000000101100000000000000000000100000010011111111111111111111111111111111111111111111111111111111111111111111111111111111","hostmask":"00000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111111","netmask":"11111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000","first_host":"00100000000000101100000000000000000000100000010000000000000000000000000000000000000000000000000000000000000000000000000000000001","last_host":"00100000000000101100000000000000000000100000010011111111111111111111111111111111111111111111111111111111111111111111111111111110"}}''')
|
||||
try:
|
||||
self.assertEqual(actual, expected)
|
||||
except AssertionError:
|
||||
failures += 1
|
||||
failure_msgs.append(f'Old-style 6to4 address failure:\n Expected: {expected}\n Actual: {actual}')
|
||||
|
||||
if failures > 1:
|
||||
self.fail('\n\n'.join(failure_msgs))
|
||||
|
||||
|
||||
def test_ip_address_ipv6_teredo(self):
|
||||
|
48
tests/test_ipconfig.py
Normal file
48
tests/test_ipconfig.py
Normal file
@ -0,0 +1,48 @@
|
||||
import json
|
||||
import os
|
||||
import unittest
|
||||
import jc.parsers.ipconfig
|
||||
|
||||
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
||||
class MyTests(unittest.TestCase):
|
||||
test_files = [
|
||||
"tests/fixtures/windows/windows-xp/ipconfig",
|
||||
"tests/fixtures/windows/windows-7/ipconfig",
|
||||
"tests/fixtures/windows/windows-10/ipconfig",
|
||||
"tests/fixtures/windows/windows-11/ipconfig",
|
||||
"tests/fixtures/windows/windows-2008/ipconfig",
|
||||
"tests/fixtures/windows/windows-2016/ipconfig",
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
for tf in MyTests.test_files:
|
||||
in_file = os.path.join(THIS_DIR, os.pardir, f"{tf}.out")
|
||||
out_file = os.path.join(THIS_DIR, os.pardir, f"{tf}.json")
|
||||
|
||||
with open(in_file, "r", encoding="utf-8") as f:
|
||||
setattr(self, self.varName(tf), f.read())
|
||||
with open(out_file, "r", encoding="utf-8") as f:
|
||||
setattr(self, self.varName(tf) + "_json", json.loads(f.read()))
|
||||
|
||||
def varName(self, path):
|
||||
return (
|
||||
path.replace("tests/fixtures/windows", "")
|
||||
.replace("-", "_")
|
||||
.replace("/", "_")
|
||||
)
|
||||
|
||||
def test_windows_ipconfig(self):
|
||||
"""
|
||||
Test a sample Windows "ipconfig" command output
|
||||
"""
|
||||
for tf in MyTests.test_files:
|
||||
in_var = getattr(self, self.varName(tf))
|
||||
out_var = getattr(self, self.varName(tf) + "_json")
|
||||
|
||||
self.assertEqual(jc.parsers.ipconfig.parse(in_var, quiet=True), out_var)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user