Method: Inspec::Resources::FreeBsdPorts#info
- Defined in:
- lib/resources/port.rb
#info ⇒ Object
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
# File 'lib/resources/port.rb', line 339 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 |