inspec/test/unit/mock/cmd/netstat-tulpen
Adam Leff 8e693a4ad9 Fix port resource for invalid IP address in netstat output
Netstat will sometimes output an IPv6 address that is not
formatted correctly; the address is either truncated or uses
or implies the `::` shorthand notation twice. This yields an
invalid IPv6 address and causes IPAddr.new to choke.

This change guards against invalid IP addresses and ensures they
do not end up in the port resource's entries list.

Signed-off-by: Adam Leff <adam@leff.co>
2017-03-29 08:33:50 +02:00

8 lines
No EOL
830 B
Text

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 0 21699 1/sshd
tcp6 0 48 2601:1:ad80:1445::54776 2620:0:861:52:208::6667 LISTEN 0 21702 2043/pidgin
tcp6 0 0 :::22 :::* LISTEN 0 21701 1/sshd
udp 0 0 0.0.0.0:111 0.0.0.0:* 0 8689 545/rpcbind
tcp6 0 0 192.168.1.123:8005 :::* LISTEN 0 21703 1234/java
udp6 0 0 fe80::42:acff:fe11::123 :::* 0 54550 3335/ntpd