class Inspec::Resources::Interfaces::BsdInterfaceLister

Public Instance Methods

scan_interfaces() click to toggle source
# File lib/inspec/resources/interfaces.rb, line 75
def scan_interfaces
  iface_data = []
  cmd = inspec.command("ifconfig -a")
  cmd.stdout.split("\n").each do |line|
    # lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
    m = line.match(/^(\S+):/)
    if m
      iface_data << { "name" => m[1] }
    end
  end
  iface_data
end