Juneau LUG

orca

The Juneau Linux Users Group


This script was developed to identify the equipment manufacturer based on mac address.





#!/bin/bash
#########################################################################################
# id-mac.sh
# identifies the equipment manufacturer based on mac address.
# Depends on a current copy of oui.txt from http://standards.ieee.org/regauth/oui/oui.txt
# Depends on the arping utility (unfortunately run as root -- use sudo)
# James Zuelow // Juneau Linux Users Group
# 28 April 2006
#########################################################################################
if [[ -z $1 ]]
then
	echo "Useage:  id-mac.sh (IP ADDRESS)"
	exit 1
else
	OUI=/root/data/oui.txt
	MACID=`arping -c 1 $1 | awk '/index=0/ { print $4 }' | cut -c -8 | sed s/:/-/g`
	MANID=`grep -i ${MACID} ${OUI}`
	if [[ -z ${MANID} ]]
	then
		MANID="${MACID} (hex) UNKNOWN"
	fi
	echo "Manufacturer of device at $1 is:"
	echo ${MANID}
	exit 0
fi