-
Notifications
You must be signed in to change notification settings - Fork 57
/
troubleshoot.sh
287 lines (279 loc) · 6.4 KB
/
troubleshoot.sh
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
#!/bin/bash/
#owt trouble shoot
#created by clu3bot (Brennan Mccown)
#colors vars
LBLUE='\033[1;34m'
LRED='\033[1;31m'
LGREEN='\033[1;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NONE='\033[0m'
PURPLE='\033[1;35m'
CYAN='\033[0;36m'
GREEN='\033[0;32m'
#echowrap
e() {
echo -e "$@"
}
#output
output() {
e "${LBLUE}Output${NONE} ${GREEN}GREEN${NONE} is good ${LRED}RED${NONE} is bad"
e "${LBLUE}------------------------------------${NONE}"
}
#check if a wireless interface exists
check_interface() {
iface=$(airmon-ng | awk 'NR==4' | awk '{print $2}')
if [[ -z "${iface// }" ]]; then
iface="null"
fi
}
ifacestatus() {
if [ "${iface}" == "null" ]; then
e "${LRED}No wireless interface found${NONE}"
else
e "${GREEN}Wireless interface found${NONE}"
fi
}
#display for check if a wireless interface exists
display_check_interface() {
clear
output
check_interface
e "${LRED}Checking for wireless interface..${NONE}"
sleep 2
if [[ "${iface}" == "null" ]]; then
e "${LRED}No wireless interface found${NONE}"
else
e "${GREEN}Wireless interface found${NONE}"
fi
sleep 1
clear
if [[ "${iface}" == "null" ]]; then
output
e "${LRED}No wireless interface found${NONE}"
e "${LBLUE}------------------------------------${NONE}"
else
output
e "${GREEN}Wireless interface found${NONE}"
e "${LBLUE}------------------------------------${NONE}"
fi
}
#check if device can be put in monitor mode
check_monitor() {
if [ "${iface}" == "null" ]; then
mode="null"
fi
}
monitorstatus() {
if [ "${mode}" == "null" ]; then
e "${LRED}Interface is not suitable for Monitor Mode${NONE}"
else
e "${GREEN}Interface is suitable for Monitor Mode${NONE}"
fi
}
#display for check if device can be put in monitor mode
display_check_monitor() {
check_monitor
e "${LRED}Checking for interface..${NONE}"
sleep 1
e "${LRED}Checking if interface is suitable for Monitor Mode${NONE}"
sleep 1
if [ "${mode}" == "null" ]; then
e "${LRED}Interface is not suitable for Monitor Mode${NONE}"
else
e "${GREEN}Interface is suitable for Monitor Mode${NONE}"
fi
clear
if [ "${mode}" == "null" ]; then
output
ifacestatus
e "${LRED}Interface is not suitable for Monitor Mode${NONE}"
e "${LBLUE}------------------------------------${NONE}"
else
output
ifacestatus
e "${GREEN}Interface is suitable for Monitor Mode${NONE}"
e "${LBLUE}------------------------------------${NONE}"
fi
}
#check if all dependencies are installed
check_dependencies() {
dependencies=(aircrack-ng mdk3 xterm macchanger)
for d in "${dependencies[*]}"; do
if [ "$(dpkg-query -W -f='${Status}' $d 2>/dev/null | grep -c "ok installed")" -eq 0 ]; then
dependencies="null"
fi
done
}
dependenciesstatus() {
if [[ "${dependencies}" == "null" ]]; then
e "${LRED}Missing Required Dependencies${NONE}"
else
e "${GREEN}All Dependencies Installed${NONE}"
fi
}
#display for check if all dependencies are installed
display_check_dependencies() {
check_dependencies &
e "${LRED}Scanning Directories..${NONE}"
sleep 1.25
e "${LRED}Checking for Dependencies..${NONE}"
sleep 1.25
if [[ "${dependencies}" == "null" ]]; then
e "${LRED}Missing Required Dependencies${NONE}"
else
e "${GREEN}All Dependencies installed${NONE}"
fi
clear
if [ "${dependencies}" == "null" ]; then
output
ifacestatus
monitorstatus
e "${LRED}Missing required Dependencies${NONE}"
e "${LBLUE}------------------------------------${NONE}"
else
output
ifacestatus
monitorstatus
e "${GREEN}All Dependencies installed${NONE}"
e "${LBLUE}------------------------------------${NONE}"
fi
}
#check if user is on a distro of linux that is supported
check_distro() {
di=$(lsb_release -is)
if [[ -z "${di// }" ]]; then
distro="null"
fi
}
distrostatus() {
if [ "${distro}" == "null" ]; then
e "${LRED}The distrobution of linux you are using is not supported${NONE}"
else
e "${GREEN}Compatible Linux Distrobution${NONE}"
fi
}
#display for check if user is on a distro of linux that is supported
display_check_distro() {
check_distro
e "${LRED}Checking linux Distrobution..${NONE}"
sleep 1.25
e "${LRED}Checking compatibility..${NONE}"
sleep 1.25
if [ "${distro}" == "null" ]; then
e "${LRED}The distrobution of linux you are using is not supported${NONE}"
else
e "${GREEN}Compatible Linux Distrobution${NONE}"
fi
clear
if [ "${distro}" == "null" ]; then
output
ifacestatus
monitorstatus
dependenciesstatus
e "${LRED}The distrobution of linux you are using is not supported${NONE}"
e "${LBLUE}------------------------------------${NONE}"
else
output
ifacestatus
monitorstatus
dependenciesstatus
e "${GREEN}Compatible Linux Distrobution${NONE}"
e "${LBLUE}------------------------------------${NONE}"
fi
}
#dns established
dns_established() {
dns="valid"
}
#check if dns can be established
check_dns() {
if ping -q -c 1 -W 1 8.8.8.8 >/dev/null; then
dns_established
fi
}
dnsstatus() {
if [ "${dns}" == "valid" ]; then
e "${GREEN}DNS Connection Established${NONE}"
else
e "${LRED}DNS Could not be Established${NONE}"
fi
}
#display for check if dns can be established
display_check_dns() {
check_dns
e "${LRED}Checking for DNS connection..${NONE}"
sleep 1.4
e "${LRED}Attempting to Connect..${NONE}"
sleep 1.3
if [ "${dns}" == "valid" ]; then
e "${GREEN}DNS Connection Established${NONE}"
else
e "${LRED}DNS Could not be Established${NONE}"
fi
clear
if [ "${dns}" == "valid" ]; then
output
ifacestatus
monitorstatus
dependenciesstatus
distrostatus
e "${GREEN}DNS Connection Established${NONE}"
e "${LBLUE}------------------------------------${NONE}"
else
output
ifacestatus
monitorstatus
dependenciesstatus
distrostatus
e "${LRED}DNS Could not be Established${NONE}"
e "${LBLUE}------------------------------------${NONE}"
fi
}
#check if user is root
check_permission() {
isroot=$(whoami)
if [ "${isroot}" == "root" ]; then
perm="valid"
fi
}
#display for check if user is root
display_check_permission() {
check_permission
e "${LRED}Checking if user is root${NONE}"
sleep 1.4
if [ "${perm}" == "valid" ]; then
e "${GREEN}User is root user${NONE}"
else
e "${LRED}User is not root make sure to run as root${NONE}"
fi
clear
if [ "${perm}" == "valid" ]; then
output
ifacestatus
monitorstatus
dependenciesstatus
distrostatus
dnsstatus
e "${GREEN}User is root user${NONE}"
e "${LBLUE}------------------------------------${NONE}"
else
output
ifacestatus
monitorstatus
dependenciesstatus
distrostatus
dnsstatus
e "${LRED}User is not root make sure to run as root${NONE}"
e "${LBLUE}------------------------------------${NONE}"
fi
}
troubleshoot() {
display_check_interface
display_check_monitor
display_check_dependencies
display_check_distro
display_check_dns
display_check_permission
}
troubleshoot