Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ruby scripts to search a vendor name from a MAC address.
require 'open-uri'
class SearchMac
URL_OUI = "http://standards.ieee.org/develop/regauth/oui/oui.txt"
def initialize
@arg = ARGV[0]
end
def exec_main
begin
open(URL_OUI) do |f|
f.each do |line|
if /\s*(.*?)\s*\(hex\)\t*(.*?)\n/ =~ line
puts "#{$1}: #{$2}" if @arg == $1
end
end
end
rescue => e
STDERR.puts "[ERROR][#{self.class.name}.exec_main] #{e}"
exit 1
end
end
end
SearchMac.new.exec_main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.