module MacVendors

Constants

VERSION

Private Class Methods

download() click to toggle source
# File lib/macvendors.rb, line 42
def self.download
  Dir.mkdir "#{Dir.home}/.macvendors" if File.directory?("#{Dir.home}/.macvendors") == false
  open("#{Dir.home}/.macvendors/oui.csv", 'wb') do |file|
    file << open('http://standards-oui.ieee.org/oui/oui.csv').read
  end
  puts "downloaded vendors"
end
find(string) click to toggle source
# File lib/macvendors.rb, line 75
def self.find string
  string = string.gsub(":", "")
  string = string.gsub("-", "")
  return search(string[0..5].upcase)
end
find2(string) click to toggle source
# File lib/macvendors.rb, line 68
def self.find2 string
  MacVendors.setup
  string = string.gsub(":", "")
  string = string.gsub("-", "")
  return search(string[0..5].upcase)
end
setup() click to toggle source
# File lib/macvendors.rb, line 63
def self.setup
  path = "#{Dir.home}/.macvendors/oui.csv"
  @answer = CSV.read(path,:headers=> true, :encoding => "ISO8859-1:utf-8") #TODO: is this a data
end
update() click to toggle source
# File lib/macvendors.rb, line 34
def self.update
  path_to_file = "#{Dir.home}/.macvendors/oui.csv"
  File.delete(path_to_file) if File.exist?(path_to_file)
  puts "vendors removed."
  MacVendors.download()
end