-
Notifications
You must be signed in to change notification settings - Fork 154
/
check-ieee-reg
executable file
·59 lines (56 loc) · 2.08 KB
/
check-ieee-reg
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
#!/bin/sh
# arp-scan is Copyright (C) 2005-2024 Roy Hills
#
# This file is part of arp-scan.
#
# arp-scan is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# arp-scan is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with arp-scan. If not, see <http://www.gnu.org/licenses/>.
#
# check-ieee-reg - Shell script to test IEEE registry lookup
#
# Author: Roy Hills
# Date: 01 November 2022
#
# This script checks that arp-scan correctly decodes and displays the vendor
# details for selected entries in each of the IEEE Ethernet registries.
#
ARPSCANOUTPUT=/tmp/arp-scan-output.$$.tmp
EXAMPLEOUTPUT=/tmp/example-output.$$.tmp
#
SAMPLE01="$srcdir/testdata/pkt-ieee-regcheck.pcap"
# Responses from one MAC address in each of IAB, MA-M, MA-L and MA-S registries
echo "Checking IEEE registry decode using $SAMPLE01 ..."
cat >"$EXAMPLEOUTPUT" <<_EOF_
192.168.14.1,00:50:c2:7d:50:00,DEUTA-WERKE GmbH
192.168.14.2,74:1a:e0:90:00:00,Private
192.168.14.3,00:22:72:00:00:00,American Micro-Fuel Device Corp.
192.168.14.4,70:b3:d5:f2:f0:00,TELEPLATFORMS
_EOF_
ARPARGS="--retry=1 --ouifile=$srcdir/ieee-oui.txt --macfile=$srcdir/mac-vendor.txt --format=\${ip},\${mac},\${vendor}"
./arp-scan $ARPARGS --readpktfromfile="$SAMPLE01" 192.168.14.0/29 | grep -v '^Starting arp-scan ' | grep -v '^Interface: ' | grep -v '^Ending arp-scan ' | grep -v '^[0-9]* packets received ' > "$ARPSCANOUTPUT" 2>&1
if test $? -ne 0; then
rm -f "$ARPSCANOUTPUT"
rm -f "$EXAMPLEOUTPUT"
echo "FAILED"
exit 1
fi
cmp -s "$ARPSCANOUTPUT" "$EXAMPLEOUTPUT"
if test $? -ne 0; then
rm -f "$ARPSCANOUTPUT"
rm -f "$EXAMPLEOUTPUT"
echo "FAILED"
exit 1
fi
echo "ok"
rm -f "$ARPSCANOUTPUT"
rm -f "$EXAMPLEOUTPUT"