module Rex::Oui

Constants

OUI_LIST

List acquired from wireshark manuf file

Public Class Methods

check_mac(mac) click to toggle source
# File lib/rex/mac_oui.rb, line 31
def self.check_mac(mac)
  unless mac =~ /(^([A-Fa-f0-9]{2}:){2,5}[A-Fa-f0-9]{2}$)|(^([A-Fa-f0-9]{2}){3,6}$)/
    raise "Mac address is not in a correct format"
  end
end
lookup_oui_company_name(mac) click to toggle source
# File lib/rex/mac_oui.rb, line 18
def self.lookup_oui_company_name(mac)
  check_mac(mac)
  mac = mac.upcase.gsub(':','')[0,6]
  oui = OUI_LIST[mac]
  if oui
    fullname = oui[0]
    fullname = oui[1] if oui[1] != ""
    return fullname
  else
    return 'UNKNOWN'
  end
end
lookup_oui_fullname(mac) click to toggle source
# File lib/rex/mac_oui.rb, line 5
def self.lookup_oui_fullname(mac)
  check_mac(mac)
  mac = mac.upcase.gsub(':','')[0,6]
  oui = OUI_LIST[mac]
  if oui
    fullname = oui[0]
    fullname = oui[0] + ' / ' + oui[1] if oui[1] != ""
    return fullname
  else
    return 'UNKNOWN'
  end
end