Index of /~plonka/mac2vendor

[ICO]NameLast modifiedSizeDescription

[PARENTDIR]Parent Directory  -  
[   ]COPYING1996-12-17 14:59 18K 
[   ]mac2vendor2019-03-24 04:54 83K 
[DIR]old/2019-03-24 04:55 -  

README for "mac2vendor" tool

This tool is a filter that annotates ethernet mac addresses with the vendor/ manufacter information using the IEEE OUI database that it downloads from the URL embedded within.

NOTE: The script has a very old OUI database embedded within it, that is only used if you haven't had it download a current database.
Be sure to download a new version of the database using the -u option (or, as shown below, via crontab.)

The tool requires "getopts.pl" and the LWP::Simple module to be installed, for example:

$ sudo apt-get install libperl4-corelibs-perl

$ sudo cpan
...
> install LWP

$ mac2vendor -h
usage: mac2vendor [-h] [ -r [-u] ] [-c cache_file] [ -p printf_format ] [ file [...] ]
       -h - help (shows this usage information)
       -r - refresh the OUI cache with current information glommed from
	    "http://standards.ieee.org/regauth/oui/oui.txt".
       -c cache_file - use the OUI database in this cache file.
		       If "-c" is not specified, the cache file name defaults to
		       "/tmp/mac2vendor.dat".
		       If "-r" and "-u" are used the cache file will be updated.
       -u - update the cache file (see "-c")
       -p printf_format - use this printf format for MAC address and vendor,
			  respectively.
			  The default format is '%s-(%s)'.
			  To supress the printing of the mac address, one could
			  use '%.0s%s'.
			  To maintain column widths (since the vendor string
			  varies in lenght), a format like this may be useful:
			  '%-12.12s [%-20.20s]'
       -v - verbose (for debugging, etc.)

Sample use:

$ ifconfig  |grep HWaddr
p15p1     Link encap:Ethernet  HWaddr a0:42:3f:2f:c6:2e
$ ifconfig  |grep HWaddr |~/perl/mac2vendor
p15p1     Link encap:Ethernet  HWaddr a0:42:3f:2f:c6:2e-(Tyan Computer Corp)

The tool can optionally update the IEEE database in a local file, e.g., in your crontab, weekly:

# m h  dom mon dow   command
30 * * * 0 /bin/rm -f /tmp/mac2vendor.$$ && $HOME/perl/mac2vendor -ruc /tmp/mac2vendor.$$ </dev/null && test -s /tmp/mac2vendor.$$ && /bin/mv /tmp/mac2vendor.$$ /tmp/mac2vendor.dat

Dave Plonka, Mar 24 2019