Skip to content

Commit bfe33a9

Browse files
committed
Use local ieee-data if exists
1 parent b718869 commit bfe33a9

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

support/data

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,23 @@ determine_manufacturer () {
3333
#EXCEPTION FOR SUSPECT PRODUCTS
3434
[[ $address =~ ^FF:FF ]] && manufacturer="SIG Unassigned or Noncompliant OEM"
3535

36+
# If no cache try if we have ieee-data
37+
if [ -z "$manufacturer" ] ; then
38+
_temp=$(echo ${address:0:8} | sed 's/://gi')
39+
_found=false
40+
local remote_result=''
41+
if [ ! ${_found} ] && [ -f /var/lib/ieee-data/oui.csv ] ; then
42+
remote_result=$(egrep ",${_temp}," /var/lib/ieee-data/oui.csv | cut -d\, -f3)
43+
_found=true
44+
fi
45+
if [ ! ${_found} ] && [ -f /usr/share/ieee-data/oui.csv ] ; then
46+
remote_result=$(egrep ",${_temp}," /var/lib/ieee-data/oui.csv | cut -d\, -f3)
47+
_found=true
48+
fi
49+
[ -n "$remote_result" ] && echo "${address:0:8} $remote_result" >> .manufacturer_cache
50+
manufacturer="$remote_result"
51+
fi
52+
3653
#IF CACHE DOES NOT EXIST, USE MACVENDORS.COM
3754
if [ -z "$manufacturer" ]; then
3855
local remote_result=$(curl -sL https://api.macvendors.com/${address:0:8} | grep -vi "error" | head -1 | sed 's/[^A-Za-z ]//gi')
@@ -48,4 +65,4 @@ determine_manufacturer () {
4865
[ -z "$manufacturer" ] && manufacturer="Unknown" && echo "${address:0:8} Unknown" >> .manufacturer_cache
4966
echo "$manufacturer"
5067
fi
51-
}
68+
}

0 commit comments

Comments
 (0)