From: Einar Jørgen Haraldseid Date: Sat, 18 Apr 2026 10:05:05 +0000 (+0200) Subject: Kjapt lite MAC-vendor-oppslagscript X-Git-Url: https://git.slaskete.net/einar-bin/commitdiff_plain/f29f5b82a458901bd0e591d6968fb8bdb4e3b0d9?ds=inline Kjapt lite MAC-vendor-oppslagscript --- diff --git a/macvendor.sh b/macvendor.sh new file mode 100755 index 0000000..c4dd1b2 --- /dev/null +++ b/macvendor.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +prefixesfile=/home/einar/ownCloud/Datadumper/master_oui.txt + +if [[ ! -f $prefixesfile ]]; then + echo "Could not find MAC prefixes file $prefixesfile, please download from https://raw.githubusercontent.com/Ringmast4r/OUI-Master-Database/main/LISTS/master_oui.txt and save to some suitable " + exit 1 +fi + +hexregex="^[[:xdigit:]]{6,12}$" + +prefix=${1//:/} # strip : +prefix=${prefix//-/} # strip - +prefix=${prefix//./} # strip . +prefix=${prefix^^} # uppercase + +if [[ $prefix =~ $hexregex ]]; then + prefix=${prefix:0:6} # we only need first 6 chars + grep "$prefix" "$prefixesfile" +else + echo "Input parameter does not resemble a MAC address" + exit 1 +fi