All pastes #463205 Raw Edit

Miscellany

public text v1 · immutable
#463205 ·published 2007-04-28 20:55 UTC
rendered paste body
#!/bin/sh

if [ x"$1" = "x" ]
then
    echo "usage: $0 <MAC address>"
    exit 1
fi


direccion=`echo $1 | cut -d ':' -f 1`
direccion=$direccion"-"`echo $1 | cut -d ':' -f 2`
direccion=$direccion"-"`echo $1 | cut -d ':' -f 3`

#echo $1

if [ -f /tmp/oui2.txt.gz ] ; then
        echo "$1 `zcat /tmp/oui2.txt.gz | grep -i $direccion | cut -d ':' -f 2`"
        exit
fi

if [ -f /etc/oui2.txt.gz ] ; then
        cp /etc/oui2.txt.gz /tmp
        $0 $1
        exit
fi

PWDGOT=`pwd`
cd /tmp
echo "Downloading oui data, please wait..."
wget http://standards.ieee.org/regauth/oui/oui.txt
cat oui.txt | grep '(hex)' | awk '{ print $1":"$3" "$4" "$5" "$6" "$7" "$8" "$9 }' > oui2.txt
rm oui.txt
gzip oui2.txt
cd $PWDGOT
$0 $1