class Inspec::Resources::Interfaces::WindowsInterfaceLister
Public Instance Methods
scan_interfaces()
click to toggle source
# File lib/inspec/resources/interfaces.rb, line 101 def scan_interfaces iface_data = [] cmd = inspec.command("Get-NetAdapter | Select-Object -Property Name | ConvertTo-Json") begin adapter_info = JSON.parse(cmd.stdout) # May be a Hash if only one, or Array if multiple - normalize to Array adapter_info = [ adapter_info ] if adapter_info.is_a? Hash rescue JSON::ParserError => _e return nil end adapter_info.each do |info| iface_data << { "name" => info["Name"] } end iface_data end