nexmon – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | #!/bin/sh |
2 | |||
3 | CURL=`which curl 2>/dev/null` |
||
4 | WGET=`which wget 2>/dev/null` |
||
5 | OUI_DOWNLOAD_URL="http://standards-oui.ieee.org/oui.txt" |
||
6 | |||
7 | OUI_PATH0="/etc/aircrack-ng" |
||
8 | OUI_PATH1="/usr/local/etc/aircrack-ng" |
||
9 | OUI_PATH2="/usr/share/aircrack-ng" |
||
10 | if [ -d "$OUI_PATH0" ]; then |
||
11 | OUI_PATH="$OUI_PATH0" |
||
12 | elif [ -d "$OUI_PATH1" ]; then |
||
13 | OUI_PATH="$OUI_PATH1" |
||
14 | elif [ -d "$OUI_PATH2" ]; then |
||
15 | OUI_PATH="$OUI_PATH2" |
||
16 | else |
||
17 | # default |
||
18 | OUI_PATH="$OUI_PATH0" |
||
19 | fi |
||
20 | |||
21 | AIRODUMP_NG_OUI="${OUI_PATH}/airodump-ng-oui.txt" |
||
22 | OUI_IEEE="${OUI_PATH}/oui.txt" |
||
23 | USERID="" |
||
24 | |||
25 | |||
26 | # Make sure the user is root |
||
27 | if [ x"`which id 2> /dev/null`" != "x" ] |
||
28 | then |
||
29 | USERID="`id -u 2> /dev/null`" |
||
30 | fi |
||
31 | |||
32 | if [ x$USERID = "x" -a x$UID != "x" ] |
||
33 | then |
||
34 | USERID=$UID |
||
35 | fi |
||
36 | |||
37 | if [ x$USERID != "x" -a x$USERID != "x0" ] |
||
38 | then |
||
39 | echo Run it as root ; exit ; |
||
40 | fi |
||
41 | |||
42 | |||
43 | if [ ! -d "${OUI_PATH}" ]; then |
||
44 | mkdir -p ${OUI_PATH} |
||
45 | fi |
||
46 | |||
47 | if [ ${CURL} ] || [ ${WGET} ]; then |
||
48 | # Delete previous partially downloaded file (if the script was aborted) |
||
49 | rm -f ${OUI_IEEE} >/dev/null 2>/dev/null |
||
50 | |||
51 | # Download it |
||
52 | echo "[*] Downloading IEEE OUI file..." |
||
53 | |||
54 | if [ ${WGET} ]; then |
||
55 | ${WGET} ${OUI_DOWNLOAD_URL} -O ${OUI_IEEE} >/dev/null 2>/dev/null |
||
56 | else |
||
57 | ${CURL} -L ${OUI_DOWNLOAD_URL} > ${OUI_IEEE} 2>/dev/null |
||
58 | fi |
||
59 | |||
60 | if [ "${?}" -ne 0 ]; then |
||
61 | echo "[*] Error: Failed to download OUI list, aborting..." |
||
62 | exit 1 |
||
63 | fi |
||
64 | |||
65 | # Parse the downloaded OUI list |
||
66 | echo "[*] Parsing OUI file..." |
||
67 | |||
68 | # Keep the previous file |
||
69 | if [ -f "${OUI_DOWNLOADED}" ]; then |
||
70 | mv ${AIRODUMP_NG_OUI} ${OUI}-old |
||
71 | fi |
||
72 | |||
73 | # Parse it |
||
74 | grep "(hex)" ${OUI_IEEE} | sed 's/^[ \t]*//g;s/[ \t]*$//g' > ${AIRODUMP_NG_OUI} |
||
75 | if [ "${?}" -ne 0 ]; then |
||
76 | echo "[*] Error: Failed to parse OUI, aborting..." |
||
77 | exit 1 |
||
78 | fi |
||
79 | |||
80 | # Cleanup |
||
81 | rm -f ${OUI_IEEE} |
||
82 | |||
83 | echo "[*] Airodump-ng OUI file successfully updated" |
||
84 | else |
||
85 | if [ -f "${OUI}" ]; then |
||
86 | echo "[*] Please install curl or wget to update OUI list" |
||
87 | else |
||
88 | echo "[*] Please install curl or wget to install OUI list" |
||
89 | fi |
||
90 | exit 1 |
||
91 | fi |
||
92 | |||
93 | exit 0 |