Skip to content

Instantly share code, notes, and snippets.

@lopes
Last active August 7, 2024 13:32
Show Gist options
  • Save lopes/4620908 to your computer and use it in GitHub Desktop.
Save lopes/4620908 to your computer and use it in GitHub Desktop.
A really simple shell script to identify your NIC's manufacturers according to its MAC addresses. #shell #shellscript #nic #mac
#!/bin/bash
#macaddr.sh
#
# It will catch all of your network interfaces and
# find out what's the manufacturer of each according
# to its OUI.
#
# José Lopes de Oliveira Jr. <indiecode.com.br>
#
# GPLv3
##
NICS="$(ifconfig -a |grep -v "^ " \
|sed -e '/^$/d; /^lo/d' \
|cut -d ' ' -f1 \
|tr '\n' ' ')"
MANU=""
SITE="$(curl -s http://standards.ieee.org/develop/regauth/oui/oui.txt)"
for nic in $NICS; do
MANU="$MANU $(echo "$SITE" |grep "$(ifconfig |grep HWaddr \
|sed -e "s/^.*HWaddr //; s/:/-/g" \
|cut -c-8)" \
|cut -f3)"
done
echo -e NICs.........: $NICS
echo -e Manufacturers: $MANU
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment