Skip to content

Instantly share code, notes, and snippets.

@chabala
Last active October 30, 2016 01:15
Show Gist options
  • Save chabala/e85128517ca628a8c4ca to your computer and use it in GitHub Desktop.
Save chabala/e85128517ca628a8c4ca to your computer and use it in GitHub Desktop.
Lookup hardware manufacturers by MAC address
#!/usr/bin/env bash
# Lookup MAC address owners via http://standards.ieee.org/develop/regauth/oui/public.html
# parameter is in triple octet form, e.g. CC-6D-A0
set -o errexit
set -o nounset
mac=${1//:/-}
url="https://services13.ieee.org/RST/standards-ra-web/rest/assignments/download/?registry=MA-L&format=html&text=$mac"
if command -v lynx >/dev/null 2>&1; then
#if you have lynx installed
curl --silent --fail --show-error "$url" | lynx -stdin -dump -nolist
else
curl --silent --fail --show-error "$url"
fi
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment