Method: Inspec::Resources::FreeBsdPorts#info
- Defined in:
- lib/resources/port.rb
#info ⇒ Object
619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 |
# File 'lib/resources/port.rb', line 619 def info cmd = inspec.command('sockstat -46l') return nil if cmd.exit_status.to_i != 0 ports = [] # split on each newline cmd.stdout.each_line do |line| port_info = parse_sockstat_line(line) # push data, if not headerfile next unless %w{tcp tcp6 udp udp6}.include?(port_info['protocol']) ports.push(port_info) end ports end |