Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
cache=/var/db/vwash.cache
touch $cache
while read line; do
mac=$(echo "$line" | cut -d: -f1-3)
if echo $mac | grep -i -e '[a-f0-9]\{2\}:' > /dev/null; then
lookup=$(grep "$mac=" $cache)
if [ $? -gt 0 ]; then
lookup=$(wget -qO- http://www.macvendorlookup.com/api/v2/$mac/pipe)
vendor=$(echo $lookup | cut -d\| -f5 | cut -d\ -f1 | cut -c1-10 | sed s/[^a-zA-Z\s]//g)
echo "$mac=$vendor" >> $cache
else
vendor=$(echo $lookup | cut -d= -f2)
fi
printf "%0-17s%s\n" "$vendor" "$line"
else
if echo $line | grep ^BSSID > /dev/null; then
echo "Vendor $line"
else
echo "$line"
fi
fi
done
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.