From f29f5b82a458901bd0e591d6968fb8bdb4e3b0d9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Einar=20J=C3=B8rgen=20Haraldseid?= Date: Sat, 18 Apr 2026 12:05:05 +0200 Subject: [PATCH 1/1] Kjapt lite MAC-vendor-oppslagscript --- macvendor.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 macvendor.sh 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 -- 2.47.3