-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathcreate_manuf.sh
More file actions
executable file
·104 lines (78 loc) · 2.15 KB
/
create_manuf.sh
File metadata and controls
executable file
·104 lines (78 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
#
# wireshark manuf file creator for use by v6disc.sh by Craig Miller
# 5 June 2025
#
#
# Pulls IEEE OUI files directly from IEEE
# Parses OUI and Manufacturer, reduces string size, and compresses
#
VERSION="0.91"
TMPPATH="/tmp/"
DEBUG=0
# IEEE URLs to OUI files
ieee_url[1]="https://standards-oui.ieee.org/oui/oui.csv"
ieee_url[2]="https://standards-oui.ieee.org/cid/cid.csv"
ieee_url[3]="https://standards-oui.ieee.org/iab/iab.csv"
ieee_url[4]="https://standards-oui.ieee.org/oui28/mam.csv"
ieee_url[5]="https://standards-oui.ieee.org/oui36/oui36.csv"
OUTPUT_FILE=wireshark_oui
usage() {
echo " $0 - Create manuf file (default name = wireshark_oui.gz) "
echo " e.g. $0 -h "
echo " -d debug"
echo " "
echo " By Craig Miller - Version: $VERSION"
exit 1
}
# Parse CLI Options
while getopts "?hdt" opt; do
case "$opt" in
d) DEBUG=1
;;
z) PODNO=$((OPTARG))
PODNAME="pod$PODNO"
;;
t) TEST=1
;;
h) usage
;;
*)
echo "Invalid command option "
usage
;;
esac
done
shift "$((OPTIND -1))"
#check for curl
which /usr/bin/curl
result=$?
if [ $result -ne 0 ]; then
echo "curl not found"
usage
fi
# get 24 bit OUIs
i=1
for i in `seq 1 3`
do
echo "Getting file: $i"
curl ${ieee_url[$i]} | cut -d ',' -f 2,3 | tr -d ' ' | tr -d ',' | tr -d '"' | cut -c '-14' > $TMPPATH/ieee$i
done
# get 28 bit OUI e.g. '0CEFAF700000/28Syntrans'
i=4
echo "Getting file: $i"
curl ${ieee_url[$i]} | cut -d ',' -f 2,3 | sed -r 's;([0-9A-F]{7});\100000/28;' | tr -d ' ' | tr -d ',' | tr -d '"' | cut -c '-23' > $TMPPATH/ieee$i
# get 36 bit OUI e.g. '8C1F64AFA000/36DATAELEC'
i=5
echo "Getting file: $i"
curl ${ieee_url[$i]} | cut -d ',' -f 2,3 | sed -r 's;([0-9A-F]{9});\1000/36;' | tr -d ' ' | tr -d ',' | tr -d '"' | cut -c '-23' > $TMPPATH/ieee$i
# Cat all the files together & compress
rm $TMPPATH/$OUTPUT_FILE 2> /dev/null
i=1
for i in `seq 1 5`
do
cat $TMPPATH/ieee$i >> $TMPPATH/$OUTPUT_FILE
done
echo "Created file is: $TMPPATH/${OUTPUT_FILE}.gz"
gzip -f $TMPPATH/$OUTPUT_FILE
echo "Pau"