I decided that rather than use somebody elses lookup tool for checking MAC addresses against vendors, I’d put my own on line! The first task was to find the list, which was quite straightforward:
http://standards.ieee.org/develop/regauth/oui/oui.txt
When you look at the list you can see its quite long (2.5 MB) and has just over 100k lines in it. The content has this format:
00-00-00 (hex) XEROX CORPORATION 000000 (base 16) XEROX CORPORATION M/S 105-50C 800 PHILLIPS ROAD WEBSTER NY 14580 UNITED STATES 00-00-01 (hex) XEROX CORPORATION 000001 (base 16) XEROX CORPORATION ZEROX SYSTEMS INSTITUTE M/S 105-50C 800 PHILLIPS ROAD WEBSTER NY 14580 UNITED STATES ....
My task was to cut the size down and produce a file with the following format:
CODE VENDOR
Like this:
000000 XEROX CORPORATION 000001 XEROX CORPORATION
A bit of perl soon sorted this out:
#! /usr/bin/perl -w use strict; use LWP::Simple; open MACDB, "> /home/dan/macdb.txt"; my $content = get('http://standards.ieee.org/develop/regauth/oui/oui.txt'); my @data = grep /\(base 16\)/, split('\n', $content); for (@data){ s/\s+\(base 16\)\s+/\t/; print MACDB "$_\n"; } close MACDB;
Now the size is 450K and has a very reasonable 16K lines in it. Now my web page can skim through the lookup table in no time. The finished result is here:
Mac Address Lookup Tool