forked from Nick-the-Greek/Aerial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAerial.sh
executable file
·8071 lines (7511 loc) · 392 KB
/
Aerial.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/sh
#################################################################################################################
# _________________________________________ #
# | Aerial | #
# | | #
# | Multi-mode wireless LAN | #
# | based on a Software Access Point | #
# | | #
# | version 0.14.1.0 | #
# |________________________________________| #
# #
# Copyright (c) 2014 Nick_the_Greek #
# #
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General #
# Public License as published by the Free Software Foundation, version 2 of the License. #
# #
# This script is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the #
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. #
# See the GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License along with this script. #
# If not, see <http://www.gnu.org/licenses/>. #
# #
# Credits to: Gitsnik #
# #
# Additional info from: Deathray, fifo_thekid, hm2075, g0tmi1k, Philipp C. Heckel #
#################################################################################################################
#################################################################################################################
# Friendly name: It will be used for home - working dir and for the certificates name/description #
#################################################################################################################
export friendly_name="Aerial"
#################################################################################################################
# DEPEND_DIR: Dependencies directory #
# HOME_DIR: Our home and working directory #
# MEM_DIR: Shared memory #
#################################################################################################################
export DEPEND_DIR="`pwd`"
export HOME_DIR=""`pwd`"/$friendly_name"
export MEM_DIR="/dev/shm"
export MODE=0
#################################################################################################################
# OS Detection: Kali? BackTrack 5R3? Insert correct paths, files, variables,DNS servers. #
#################################################################################################################
if [ -n "`cat /etc/issue | grep "BackTrack 5 R3"`" ];then
export OS="BackTrack_5R3"
export cecho="echo -e"
export necho="echo -n -e"
export proxyresolv_path="/bin"
export proxychains_path="/bin"
export aircrack_path="/usr/local/sbin"
export i2prouter_path="/usr/local/i2p"
export i2prouter_conf="/usr/local/i2p"
# Alternative DNS server (in this case OPEN DNS servers)
export Alt_DNS1="208.67.222.222"
export Alt_DNS2="208.67.220.220"
export blklist_file1="blacklist-ath_pci.conf"
export blklist_file2="blacklist.conf"
export ATH_PROMPT="no"
export udhcpd_lease="11"
export no_out=" > /dev/null 2>&1"
elif [ -n "`cat /etc/issue | grep "Kali"`" ];then
export OS="KALI_linux"
export cecho="echo "
export necho="echo -n"
export proxyresolv_path="/usr/lib/proxychains3"
export proxychains_path="/usr/bin"
export aircrack_path="/usr/sbin"
export i2prouter_path="/usr/bin"
export i2prouter_conf="/usr/share/i2p"
# Alternative DNS server (in this case OPEN DNS servers)
export Alt_DNS1="208.67.222.222"
export Alt_DNS2="208.67.220.220"
export blklist_file1="blacklist-ath_pci.conf"
export blklist_file2="kali-blacklist.conf"
export ATH_PROMPT="no"
export udhcpd_lease="864000"
export no_out=" > /dev/null 2>&1"
#export no_out=""
fi
#################################################################################################################
# Centered Text Function #
# You can use with : echo "Some text" | centered_text #
#################################################################################################################
centered_text(){
C=$(tput cols)
IFS=""
while read L; do
S=$((($C-${#L})/2+${#L}))
printf "%${S}s\n" $L
done
}
#################################################################################################################
# Colors #
#################################################################################################################
if [ "$OS" = "BackTrack_5R3" ];then
export GREEN="\033[1;32m"
export RED="\033[1;31m"
export BLUE="\033[1;34m"
export END="\033[1;37m"
elif [ "$OS" = "KALI_linux" ];then
export GREEN=$(tput setaf 2)
export RED=$(tput setaf 1)
export BLUE=$(tput setaf 6)
export END=$(tput sgr0)
fi
#################################################################################################################
# Colored dialogs - Let's enable colored dialogs in the terminal, if they are disabled #
#################################################################################################################
if [ -n "`grep '# force_color_prompt=yes' /root/.bashrc`" ];then
sed 's%# force_color_prompt=yes%force_color_prompt=yes%g' /root/.bashrc > /root/.bashrc1 && mv /root/.bashrc1 /root/.bashrc
source /root/.bashrc
fi
#################################################################################################################
# Get Internet Gateway. #
#################################################################################################################
export INET_Gateway="`ip r | grep default | cut -d ' ' -f 3`"
#################################################################################################################
# Must be root and connected to the Internet to continue. #
#################################################################################################################
if [ "`whoami`" != "root" ] || [ "`ping -q -w 1 -c 1 $INET_Gateway > /dev/null && echo ok || echo error`" != "ok" ];then
if [ "`whoami`" != "root" ] && [ "`ping -q -w 1 -c 1 $INET_Gateway > /dev/null && echo ok || echo error`" != "ok" ];then
clear
$cecho ""$RED"To continue you must be connected to the Internet and have root privileges."$END""
$cecho$ ""GREEN"Exit..."$END""
exit 1
fi
if [ "`whoami`" != "root" ];then
clear
$cecho ""$RED"To continue you must have root privileges."$END""
$cecho ""$GREEN"Exit..."$END""
exit 1
fi
if [ "`ping -q -w 1 -c 1 $INET_Gateway > /dev/null && echo ok || echo error`" != "ok" ];then
clear
$cecho ""$RED"To continue you must be connected to the Internet."$END""
$cecho ""$GREEN"Exit..."$END""
exit 1
fi
fi
#################################################################################################################
# Setting default browser. - What window manager is the one actively running in the current session? #
#################################################################################################################
if [ -n "`env | grep 'GNOME'`" ];then
export browser="/usr/bin/iceweasel"
elif [ -n "`env | grep 'KDE'`" ];then
export browser="konqueror"
fi
#################################################################################################################
# DISCLAIMER - You must Agree to proceed. Run it only once. #
#################################################################################################################
if [ ! -f $HOME_DIR/aerial.conf ];then
while :
do
clear
export title1=""$GREEN"D I S C L A I M E R"$END""
export title2=""$RED"This script is for educational and research purposes only."$END""
export title3=""$RED"\nAny actions and or activities related to this script is solely your responsibility. The misuse of this script can result in criminal charges brought against the persons in question. The author will not be held responsible in the event any criminal charges be brought against any individuals misusing this script to break the law. Refer to the laws in your province/country before using, or in any other way utilizing this script. Do not attempt to violate the law with anything contained in this script. If this is your intention, then press NO! Neither author of this script, or anyone else affiliated in any way,is going to accept responsibility for your actions."$END""
$cecho $title1 | centered_text
echo
echo
$cecho $title2 | centered_text
echo
$cecho $title3 | centered_text
echo
$necho "Do you agree with this? "$GREEN"[y]es"$END" / "$GREEN"[n]o"$END": "
read yno
case $yno in
[yY] | [yY][Ee][Ss] )
#echo
#$cecho "Don't forget, you: "$GREEN"Agreed"$END""
#read -p 'Press ENTER to continue...' string;echo;clear
break;;
[nN] | [nN][Oo] )
echo
$cecho ""$RED"Not agreed, Sorry, you can't proceed.\033[1;25m"
exit 1
;;
"")
$cecho "! ! ! "$RED"BLANK"$END" is an invalid option ! ! !"
read -p 'Press ENTER to continue...' string
;;
*)
$cecho "! ! ! "$RED""$yno""$END" is an invalid option ! ! !"
read -p 'Press ENTER to continue...' string
;;
esac
done
fi
#################################################################################################################
# Making a working and a backup directory, if it doesn't exist #
#################################################################################################################
if [ ! -d $HOME_DIR ];then
mkdir $HOME_DIR
mkdir $HOME_DIR/backup
fi
#################################################################################################################
# Create aerial.conf if it doesn't exist.Those are the default values. #
# They will be created for the first time and they will be changed #
# while the script is running. #
#################################################################################################################
if [ ! -f $HOME_DIR/aerial.conf ];then
# Those are the default values in aerial.conf file.
# Please don't change any of them here. When this file it's
# created in your preferred folder then you can make any
# changes that you like.
cat > $HOME_DIR/aerial.conf << EOF
##############################################################
# Aerial Configuration File #
##############################################################
# Please have in mind that to do changes from "yes" to "no"
# (without double quotes) you must run the script at least one time.
# You can make any compination of yes to no or no to yes stings.
# For example if you want to be prompted only for essid channel etc
# every time you run the script set only this flag to yes and
# set everything else to no.
# Don't forget to leave a space before the yes or no strings.
# If you don't want to be prompt every time to restore
# your files, iptables etc you can set the following to "no" (without double quotes).
# Default value: yes
RESTORE_MODE yes
# If you don't want to be prompted every time for your
# Internet and the wirelless NICs interface names that you will
# use for the creation of the softAP you can set the following to "no"
# (without double quotes).
# Default value: yes
INET_WIRELESS_PROMPT yes
# If you don't want to be prompted every time for how you
# will create the softAP (hostap or airbase-ng)
# you can set the following to "no" (without double quotes).
# Default value: yes
HOSTAP_AIRBASE_PROMPT yes
# If you don't want to be prompted every time for, essid
# MAC address, channel, crda, mode (a/g/n), encryption, key
# you can set the following to "no" (without double quotes).
# Default value: yes
ESSID_MAC_CHAN_PROMPT yes
# If you want to reconfigure sarg to change language, date format,
# long/short URLs you can set the following to "yes" (without double quotes).
# Default value: no
SARG_RECONF no
# If set to "yes" (without double quotes) nbpps (number of packets per second)
# and MTU (maximum transmission unit) will be used in airbase-ng based softAP.
# Nbpps's default value is 100. In my cards i've seen differences up to 300
# to 400 values. You can "play" with nbpps values and run some tests to find
# the optimum value for you card. If you're having troubles, set it to 100.
# Default values: yes nbpps: 300 and MTU: 1500
Nbpps_USE yes
Nbpps_VALUE 300
MTU_MON 1500
# Don't bother with this. It will re-download and re-install
# sslstrip if set it to yes (without double quotes). Left from BT4PF days -:)
# Default value: no
SSLSTRIP_DL no
# Don't bother with this also in Kali. If set it to yes (without double quotes)
# it will enable the master mode prompt for ath5k and ath9k drivers.
# YOU CANNOT USE THIS IN KALI AND/OR BT5R3. Madwifi-ng compiling
# and installation process is broken. You will end up with a broken box.
# Default value: get it from OS detection (above)
ATH_PROMPT $ATH_PROMPT
# When apt-get will get updated the script will set the following to yes.
# Default value: no
SYSTEM_UPDATED no
################ IF YOU DONT KNOW WHAT ARE DOING ##############
################ DO NOT MODIFY BELOW THIS LINE ##############
INET_CONX
WIRELS_IFACE
WIFACE_MON
ESSID
MC_ADDRS
CHANNEL
CRDA
IEEE_802_11_mode
IEEE_802_11n
HT_CAPAB
ENCRYPTION
KEY
WPS_PIN
EOF
fi
#################################################################################################################
# Insert script's variables from aerial.conf #
#################################################################################################################
export RESTORE_MODE="`grep 'RESTORE_MODE' $HOME_DIR/aerial.conf | awk '{print $2}'`"
export SSLSTRIP_DL="`grep 'SSLSTRIP_DL' $HOME_DIR/aerial.conf | awk '{print $2}'`"
export SARG_RECONF="`grep 'SARG_RECONF' $HOME_DIR/aerial.conf | awk '{print $2}'`"
export ATH_PROMPT="`grep 'ATH_PROMPT' $HOME_DIR/aerial.conf | awk '{print $2}'`"
export INET_WIRELESS_PROMPT="`grep 'INET_WIRELESS_PROMPT' $HOME_DIR/aerial.conf | awk '{print $2}'`"
export HOSTAP_AIRBASE_PROMPT="`grep "HOSTAP_AIRBASE_PROMPT" $HOME_DIR/aerial.conf | awk '{print $2}'`"
export ESSID_MAC_CHAN_PROMPT="`grep 'ESSID_MAC_CHAN_PROMPT' $HOME_DIR/aerial.conf | awk '{print $2}'`"
export ENCR_TYPE="`grep 'ENCRYPTION' $HOME_DIR/aerial.conf | awk '{print $2}'`"
export AP_KEY="`grep 'KEY' $HOME_DIR/aerial.conf | awk '{print $2}'`"
export CRDA="`grep 'CRDA' $HOME_DIR/aerial.conf | awk '{print $2}'`"
export Nbpps_USE="`grep 'Nbpps_USE' $HOME_DIR/aerial.conf | awk '{print $2}'`"
export Nbpps_VALUE="`grep 'Nbpps_VALUE' $HOME_DIR/aerial.conf | awk '{print $2}'`"
export MTU_SIZE="`grep 'MTU_MON' $HOME_DIR/aerial.conf | awk '{print $2}'`"
#################################################################################################################
# Do we have a Atheros based, PCI wireless network adapter? #
# DON'T BOTHER WITH THIS IN KALI #
#################################################################################################################
export ATH="`lspci | grep 'Atheros' | grep 'Wireless' | grep 'Network'`"
#################################################################################################################
# Restore of system's iptables rules, proxyresolv, proxychains.conf, squid.conf, sarg.conf #
# apache2.conf, udhcpd.conf, torrc, i2ptunnel.config, i2prouter, crda #
# /etc/network/interfaces /var/www/html/ folder and/or madwifi-ng drivers #
# #
# if RESTORE_MODE is set to yes from aerial.conf file #
#################################################################################################################
if [ "$RESTORE_MODE" = "yes" ] && [ -f $HOME_DIR/backup/iptables.original ] && [ -f $HOME_DIR/backup/proxychains.conf ] && [ -f $HOME_DIR/backup/proxyresolv ] && [ -f $HOME_DIR/backup/sarg.conf ] && [ -f $HOME_DIR/backup/squid.conf ] && [ -f $HOME_DIR/backup/apache2.conf ];then
clear
export YN=4
if [ -d $HOME_DIR/madwifi-ng ] && [ -f /lib/modules/`uname -r`/net/ath_pci.ko ] && [ -f $HOME_DIR/backup/ath/ath5k/ath5k.ko ] && [ -f $HOME_DIR/backup/ath/ath9k/ath9k.ko ] && [ -f $HOME_DIR/backup/ath/ath.ko ];then
$cecho ""$BLUE"B a c k u p / R e s t o r e - M E N U:"$END"" | centered_text
echo
echo "Restoring files, iptables - uninstalling madwifi-ng drivers"
echo
echo
else
$cecho ""$BLUE"B a c k u p / R e s t o r e - M E N U:"$END"" | centered_text
echo
echo
fi
echo "Please have in mind that if you DON'T want to be prompted every time to restore"
$cecho "files, iptables etc you can set "$RED"RESTORE_MODE yes"$END" to "$GREEN"RESTORE_MODE no"$END""
$cecho "in "$GREEN"$HOME_DIR/aerial.conf"$END" file"
echo
echo "Would you like to:"
echo
echo "1. Restore files (proxychains.conf, proxyresolv, squid.conf, sarg.conf,"
echo " apache2.conf, udhcpd.conf, torrc, i2ptunnel.config, i2prouter,"
echo " crda, /etc/network/interfaces /var/www/html/ folder) and exit"
echo "2. Restore iptables rules and exit"
if [ -d $HOME_DIR/madwifi-ng ] && [ -f /lib/modules/`uname -r`/net/ath_pci.ko ] && [ -f $HOME_DIR/backup/ath/ath5k/ath5k.ko ] && [ -f $HOME_DIR/backup/ath/ath9k/ath9k.ko ] && [ -f $HOME_DIR/backup/ath/ath.ko ];then
echo "3. Uninstall madwifi-ng drivers and continue"
export YN=5
fi
if [ "$YN" = "5" ];then
echo "4. Continue"
echo
$necho "Please enter your choice (1 - 4): "
else
echo "3. Continue"
echo
$necho "Please enter your choice (1 - 3): "
fi
if [ "$YN" = "5" ];then
while [ "$YN" = "5" ];do
read YN
if [ "$YN" = "1" ] || [ "$YN" = "2" ] || [ "$YN" = "3" ] || [ "$YN" = "4" ];then
if [ "$YN" = "1" ];then
clear
$cecho " Restoring proxychains.conf, proxyresolv, squid.conf, sarg.conf, apache2.conf"
$necho "[....] udhcpd.conf, torrc, i2ptunnel.config, i2prouter, crda, /etc/network/interfaces, /var/www/html/ folder."
cp $HOME_DIR/backup/proxychains.conf /etc/proxychains.conf
cp $HOME_DIR/backup/proxyresolv $proxyresolv_path/proxyresolv
cp $HOME_DIR/backup/squid.conf /etc/squid/squid.conf
cp $HOME_DIR/backup/sarg.conf /etc/sarg/sarg.conf
cp $HOME_DIR/backup/apache2.conf /etc/apache2/apache2.conf
cp $HOME_DIR/backup/udhcpd.conf /etc/udhcpd.conf
cp $HOME_DIR/backup/torrc /etc/tor/torrc
cp $HOME_DIR/backup/i2ptunnel.config $i2prouter_conf/i2ptunnel.config
cp $HOME_DIR/backup/i2prouter $i2prouter_path/i2prouter
cp $HOME_DIR/backup/interfaces /etc/network/interfaces
cp $HOME_DIR/backup/crda /etc/default/crda
rm -f -r /var/www/html/*
#rm -r /var/www/html/ajaxscript/
#rm -r /var/www/html/aw_tpl/
#rm -r /var/www/html/black_tpl/
#rm -r /var/www/html/smilies/
cp -r $HOME_DIR/backup/www/* /var/www/html/
$cecho "\r[ "$GREEN"ok"$END" ] udhcpd.conf, torrc, i2ptunnel.config, i2prouter, crda, /etc/network/interfaces, /var/www/html/ folder."
echo "Exit..."
exit 1
fi
if [ "$YN" = "2" ];then
clear
$necho "[....] Restoring iptables."
/sbin/iptables-restore < $HOME_DIR/backup/iptables.original
$cecho "\r[ "$GREEN"ok"$END" ] Restoring iptables."
$necho "[....] Disabling IP forward"
echo 0 > /proc/sys/net/ipv4/ip_forward
$cecho "\r[ "$GREEN"ok"$END" ] Disabling IP forward"
echo "Exit..."
exit 1
fi
if [ "$YN" = "3" ];then
clear
echo
$cecho ""$RED"Uninstalling madwifi-ng drivers revision 4181"$END""
echo
$cecho ""$RED"Wireless interface down..."$END""
export WIFACE_MON="ath0"
if [ "`/sbin/ifconfig | grep "$WIFACE_MON" | awk '{print $1}'`" = "$WIFACE_MON" ];then
wlanconfig "$WIFACE_MON" destroy
fi
ifconfig wifi0 down
if [ -f /usr/bin/jockey-text ];then
$cecho ""$GREEN"jockey-text found in your system"$END""
echo
else
$cecho ""$RED"Installing jockey-text"$END""
apt-get install -y jockey-common
fi
#Load modules ath5k and/or ath9k before uninstalling ath_pci (madwifi-ng) to avoid kernel oops
if [ -n "`lspci -v | grep 'ath5k'`" ];then
modprobe ath5k
fi
if [ -n "`lspci -v | grep 'ath9k'`" ];then
modprobe ath9k
fi
#Disable ath_pci with jockey-text
jockey-text -d kmod:ath_pci
#Now you can unload ath_pci (madwifi-ng)
$cecho ""$RED"Unloading drivers..."$END""
if [ -n "`lsmod | grep 'ath_pci'`" ];then
echo "Removing module: ath_pci"
rmmod ath_pci
fi
if [ -n "`lsmod | grep 'ath_rate_sample'`" ];then
echo "Removing module: ath_rate_sample"
rmmod ath_rate_sample
fi
if [ -n "`lsmod | grep 'wlan'`" ];then
echo "Removing module: wlan"
rmmod wlan
fi
if [ -n "`lsmod | grep 'ath_hal'`" ];then
echo "Removing module: ath_hal"
rmmod ath_hal
fi
if [ -n "`lsmod | grep 'ath_rate_amrr'`" ];then
echo "Removing module: ath_rate_amrr"
rmmod ath_rate_amrr
fi
if [ -n "`lsmod | grep 'ath_rate_onoe'`" ];then
echo "Removing module: ath_rate_onoe"
rmmod ath_rate_onoe
fi
if [ -n "`lsmod | grep 'wlan_acl'`" ];then
echo "Removing module: wlan_acl"
rmmod wlan_acl
fi
if [ -n "`lsmod | grep 'wlan_ccmp'`" ];then
echo "Removing module: wlan_ccmp"
rmmod wlan_ccmp
fi
if [ -n "`lsmod | grep 'wlan_scan_ap'`" ];then
echo "Removing module: wlan_scan_ap"
rmmod wlan_scan_ap
fi
if [ -n "`lsmod | grep 'wlan_scan_sta'`" ];then
echo "Removing module: wlan_scan_sta"
rmmod wlan_scan_sta
fi
if [ -n "`lsmod | grep 'wlan_tkip'`" ];then
echo "Removing module: wlan_tkip"
rmmod wlan_tkip
fi
if [ -n "`lsmod | grep 'wlan_wep'`" ];then
echo "Removing module: wlan_wep"
rmmod wlan_wep
fi
if [ -n "`lsmod | grep 'wlan_xauth'`" ];then
echo "Removing module: wlan_xauth"
rmmod wlan_xauth
fi
#Unload ath5k and/or ath9k
if [ -n "`lspci -v | grep 'ath5k'`" ];then
modprobe -r ath5k
fi
if [ -n "`lspci -v | grep 'ath9k'`" ];then
modprobe -r ath9k
fi
$cecho ""$GREEN"Done..."$END""
#cd $HOME_DIR/madwifi-ng
#./scripts/madwifi-unload
#make uninstall
#$cecho ""$GREEN"Done..."$END""
#$cecho ""$RED"Restoring ath5k and ath9k kernel modules to your system"$END""
#cp -r $HOME_DIR/backup/ath/ath.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless/ath/ath.ko
#cp -r $HOME_DIR/backup/ath/ath5k /lib/modules/`uname -r`/kernel/drivers/net/wireless/ath/ath5k
#cp -r $HOME_DIR/backup/ath/ath9k /lib/modules/`uname -r`/kernel/drivers/net/wireless/ath/ath9k
#$cecho ""$GREEN"Done..."$END""
echo
# Let's blacklist ath_pci and unblacklist ath5k and/or ath9k
$cecho ""$RED"Blacklisting madwifi-ng driver (ath_pci)"$END""
sed 's%#blacklist ath_pci%blacklist ath_pci%g' /etc/modprobe.d/$blklist_file1 > /etc/modprobe.d/temp.conf && mv /etc/modprobe.d/temp.conf /etc/modprobe.d/$blklist_file1
sed 's%#blacklist ath_pci%blacklist ath_pci%g' /etc/modprobe.d/$blklist_file2 > /etc/modprobe.d/temp.conf && mv /etc/modprobe.d/temp.conf /etc/modprobe.d/$blklist_file2
sed -i '/ath_pci/d' /etc/modules
$cecho ""$GREEN"Done..."$END""
$cecho ""$RED"Unblacklisting ath, ath5k and ath9k drivers"$END""
sed -i '/blacklist ath5k/d' /etc/modprobe.d/$blklist_file1
sed -i '/blacklist ath9k/d' /etc/modprobe.d/$blklist_file1
sed -i '/blacklist ath/d' /etc/modprobe.d/$blklist_file1
$cecho ""$GREEN"Done..."$END""
#depmod -aq
$cecho ""$RED"Loading ath5k and/or ath9k drivers..."$END""
#modprobe ath
if [ -n "`lspci -v | grep 'ath5k'`" ];then
modprobe ath5k
fi
if [ -n "`lspci -v | grep 'ath9k'`" ];then
modprobe ath9k
fi
$cecho ""$GREEN"Done..."$END""
$cecho ""$RED"Bringing wireless interface up..."$END""
ifconfig wlan0 up
sed 's%WIRELS_IFACE.*%WIRELS_IFACE%g' $HOME_DIR/aerial.conf > $HOME_DIR/aerial1.conf && mv $HOME_DIR/aerial1.conf $HOME_DIR/aerial.conf
sed 's%WIFACE_MON.*%WIFACE_MON%g' $HOME_DIR/aerial.conf > $HOME_DIR/aerial1.conf && mv $HOME_DIR/aerial1.conf $HOME_DIR/aerial.conf
$cecho ""$GREEN"Done..."$END""
echo
$cecho ""$GREEN"Uninstallation completed."$END""
echo
$cecho ""$RED"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"$END""
$cecho ""$RED"!Notice that your wireless interface name from now will be wlanX!"$END""
$cecho ""$RED"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"$END""
echo
read -p 'Press ENTER to continue...' string;echo
fi
if [ "$YN" = "4" ];then
echo "Continue.."
YN=3
fi
else
clear
export YN=5
$cecho ""$BLUE"B a c k u p / R e s t o r e - M E N U:"$END"" | centered_text
echo
echo
echo "Please have in mind that if you DON'T want to be prompted every time to restore"
$cecho "files, iptables etc you can set "$RED"RESTORE_MODE yes"$END" to "$GREEN"RESTORE_MODE no"$END""
$cecho "in "$GREEN"$HOME_DIR/aerial.conf"$END" file"
echo
echo "Restoring files, iptables - uninstalling madwifi-ng drivers"
echo "Would you like to:"
echo
echo "1. Restore files (proxychains.conf, proxyresolv, squid.conf, sarg.conf,"
echo " apache2.conf, udhcpd.conf, torrc, i2ptunnel.config, i2prouter,"
echo " crda, /etc/network/interfaces /var/www/html/ folder) and exit"
echo "2. Restore iptables rules and exit"
echo "3. Uninstall madwifi-ng drivers and continue"
echo "4. Continue"
echo
$cecho ""$RED"!!! Wrong input !!!"$END""
$necho "Please enter your choice (1 - 4): "
fi
done
fi
if [ "$YN" = "4" ];then
while [ "$YN" = "4" ];do
read YN
if [ "$YN" = "1" ] || [ "$YN" = "2" ] || [ "$YN" = "3" ];then
if [ "$YN" = "1" ];then
clear
$cecho " Restoring proxychains.conf, proxyresolv, squid.conf, sarg.conf, apache2.conf"
$necho "[....] udhcpd.conf, torrc, i2ptunnel.config, i2prouter, crda, /etc/network/interfaces, /var/www/html/ folder."
cp $HOME_DIR/backup/proxychains.conf /etc/proxychains.conf
cp $HOME_DIR/backup/proxyresolv $proxyresolv_path/proxyresolv
cp $HOME_DIR/backup/squid.conf /etc/squid/squid.conf
cp $HOME_DIR/backup/sarg.conf /etc/sarg/sarg.conf
cp $HOME_DIR/backup/apache2.conf /etc/apache2/apache2.conf
cp $HOME_DIR/backup/udhcpd.conf /etc/udhcpd.conf
cp $HOME_DIR/backup/torrc /etc/tor/torrc
cp $HOME_DIR/backup/i2ptunnel.config $i2prouter_conf/i2ptunnel.config
cp $HOME_DIR/backup/i2prouter $i2prouter_path/i2prouter
cp $HOME_DIR/backup/interfaces /etc/network/interfaces
cp $HOME_DIR/backup/crda /etc/default/crda
rm -r -f /var/www/html/*
#rm -r /var/www/html/ajaxscript/
#rm -r /var/www/html/aw_tpl/
#rm -r /var/www/html/black_tpl/
#rm -r /var/www/html/smilies/
cp -r $HOME_DIR/backup/www/* /var/www/html/
$cecho "\r[ "$GREEN"ok"$END" ] udhcpd.conf, torrc, i2ptunnel.config, i2prouter, crda, /etc/network/interfaces, /var/www/html/ folder."
echo "Exit..."
exit 1
fi
if [ "$YN" = "2" ];then
clear
$necho "[....] Restoring iptables."
/sbin/iptables-restore < $HOME_DIR/backup/iptables.original
$cecho "\r[ "$GREEN"ok"$END" ] Restoring iptables."
$necho "[....] Disabling IP forward"
echo 0 > /proc/sys/net/ipv4/ip_forward
$cecho "\r[ "$GREEN"ok"$END" ] Disabling IP forward"
echo "Exit..."
exit 1
fi
else
clear
export YN=4
$cecho ""$BLUE"B a c k u p / R e s t o r e - M E N U:"$END"" | centered_text
echo
echo
echo "Please have in mind that if you DON'T want to be prompted every time to restore"
$cecho "files, iptables etc you can set "$RED"RESTORE_MODE yes"$END" to "$GREEN"RESTORE_MODE no"$END""
$cecho "in "$GREEN"$HOME_DIR/aerial.conf"$END" file"
echo
echo "Would you like to:"
echo
echo "1. Restore files (proxychains.conf, proxyresolv, squid.conf, sarg.conf,"
echo " apache2.conf, udhcpd.conf, torrc, i2ptunnel.config, i2prouter,"
echo " crda, /etc/network/interfaces /var/www/html/ folder) and exit"
echo "2. Restore iptables rules and exit"
echo "3. Continue"
echo
$cecho ""$RED"!!! Wrong input !!!"$END""
$necho "Please enter your choice (1 - 3): "
fi
done
fi
fi
clear
#################################################################################################################
# Update APT list #
#################################################################################################################
echo ""$BLUE"D e p e n d e n c i e s :"$END"" | centered_text
if [ -f $HOME_DIR/aerial.conf ] && [ "`grep 'SYSTEM_UPDATED' $HOME_DIR/aerial.conf | awk '{print $2}'`" = "no" ];then
$necho "[....] Updating APT (Advanced Packaging Tool) list."
eval apt-get update $no_out
sed 's%SYSTEM_UPDATED no%SYSTEM_UPDATED yes%g' $HOME_DIR/aerial.conf > $HOME_DIR/aerial1.conf && mv $HOME_DIR/aerial1.conf $HOME_DIR/aerial.conf
$cecho "\r[ "$GREEN"ok"$END" ] Updating APT (Advanced Packaging Tool) list."
else
$cecho "[ "$GREEN"updated"$END" ] apt-get list."
fi
#################################################################################################################
# Download all the necessary programs that we will use and their dependencies if they are absent. #
# sslstrip, aircrack-ng suite, Proxychains, Mogrify, jp2a, Apache2, dnsmasq, UDHCPD, Squid3, Sarg, sslsplit #
# Hostapd 2.x devel, TOR, ARM, I2P router, mitmproxy, Honeyproxy and check #
# if Squid3 v3.3.8 SSL and airchat are present. #
#################################################################################################################
# Download and install UDHCPD only if it isn't installed - no backup needed
if [ -f /usr/sbin/udhcpd ];then
$cecho "[ "$GREEN"found"$END" ] UDHCPD: Very small Busybox based DHCP server."
else
$necho "[....] Installing udhcpd - very small Busybox based DHCP server."
eval apt-get install -y udhcpd $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Installing udhcpd - very small Busybox based DHCP server."
# Let's enable udhcpd - (Disabled by default)
if [ -n "`grep 'DHCPD_ENABLED="no"' /etc/default/udhcpd`" ];then
$necho "[....] Enabling UDHCPD - (Disabled by default)"
sed 's%DHCPD_ENABLED="no"%DHCPD_ENABLED="yes"%g' /etc/default/udhcpd > /etc/default/udhcpd1 && mv /etc/default/udhcpd1 /etc/default/udhcpd
$cecho "\r[ "$GREEN"ok"$END" ] Enabling UDHCPD - (Disabled by default)."
fi
$necho "[....] Do not start UDHCPD on Start Up."
eval update-rc.d udhcpd disable $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Do not start UDHCPD on Start Up."
fi
# Download and install aircrack-ng suite only if it isn't installed
if [ -f $aircrack_path/airbase-ng ];then
$cecho "[ "$GREEN"found"$END" ] Aircrack-ng: Wireless WEP/WPA cracking utilities."
else
$necho "[....] Installing aircrack-ng suite."
eval apt-get install -y aircrack-ng $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Installing aircrack-ng suite."
fi
# Download and install Proxychains only if it isn't installed
if [ -f $proxychains_path/proxychains ] && [ -f $proxyresolv_path/proxyresolv ];then
$cecho "[ "$GREEN"found"$END" ] Proxychains: Redirect connections through proxy servers."
$cecho "[ "$GREEN"found"$END" ] Proxyresolv: DNS resolving."
else
$necho "[....] Installing proxychains."
eval apt-get install -y proxychains $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Installing proxychains."
fi
# Download and install Mogrify only if it isn't installed
if [ -f /usr/bin/mogrify ];then
$cecho "[ "$GREEN"found"$END" ] ImageMagick's Mogrify: Image manipulation programs."
else
$necho "[....] Installing ImageMagick."
eval apt-get install -y imagemagick $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Installing ImageMagick."
fi
# Download and install jp2a only if it isn't installed
if [ -f /usr/bin/jp2a ];then
$cecho "[ "$GREEN"found"$END" ] jp2a: Converts jpg images to ASCII."
else
$necho "[....] Installing jp2a: Converts jpg images to ASCII."
eval apt-get install -y jp2a $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Installing jp2a: Converts jpg images to ASCII."
fi
# Download and install ghostscript only if it isn't installed
if [ -f /usr/bin/ghostscript ];then
$cecho "[ "$GREEN"found"$END" ] Ghostscript: Interpreter for the PostScript language and for PDF."
else
$necho "[....] Installing ghostscript."
eval apt-get install -y ghostscript $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Installing ghostscript."
fi
# Download and install Apache2 only if it isn't installed
if [ -f /usr/sbin/apache2 ] && [ -f /usr/sbin/apache2ctl ];then
$cecho "[ "$GREEN"found"$END" ] Apache2: HTTP Server."
else
$necho "[....] Installing Apache2 - Web server."
eval apt-get install -y apache2 apache2-mpm-prefork apache2.2-common $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Installing Apache2 - Web server."
$necho "[....] Do not start Apache2 on Start Up."
eval update-rc.d apache2 disable $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Do not start Apache2 on Start Up."
echo
fi
# Download and install dnsmasq only if it isn't installed
if [ -f /usr/sbin/dnsmasq ];then
$cecho "[ "$GREEN"found"$END" ] DNSmasq: A small caching DNS proxy and DHCP/TFTP server."
else
$necho "[....] Installing DNSmasq."
eval apt-get install -y dnsmasq $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Installing DNSmasq."
$necho "[....] Do not start dnsmasq on Start Up."
eval update-rc.d dnsmasq disable $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Do not start dnsmasq on Start Up."
fi
# Download and install haveged only if it isn't installed
if [ -f /usr/sbin/haveged ];then
$cecho "[ "$GREEN"found"$END" ] Haveged: Linux entropy source using the HAVEGE algorithm."
else
$necho "[....] Installing Haveged: Linux entropy source using the HAVEGE algorithm."
eval apt-get install -y haveged $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Installing Haveged: Linux entropy source using the HAVEGE algorithm."
$necho "[....] Do not start Haveged on Start Up."
eval update-rc.d haveged disable $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Do not start Haveged on Start Up."
fi
# Download and install Squid3 only if it isn't installed
if [ -f /usr/sbin/squid3 ];then
$necho "[ "$GREEN"found"$END" ] Squid3 v"`squid3 -v | grep "Version" | awk '{print $4}'`": Full featured Web Proxy cache (HTTP proxy)"
if [ -n "`squid3 -v | grep -o "'--enable-ssl-crtd'"`" ] && [ -n "`squid3 -v | grep -o "'--enable-ssl'"`" ];then
$cecho " with SSL support."
else
$cecho " without SSL support."
fi
else
$necho "[....] Installing Squid3 - Proxy caching server for web clients."
eval apt-get install -y squid3 squid3-common squid-langpack $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Installing Squid3 - Proxy caching server for web clients."
#$necho "[....] Creating Squid HTTP Proxy 3.x cache structure."
#eval squid3 -z $no_out
#$cecho "\r[ "$GREEN"ok"$END" ] Creating Squid HTTP Proxy 3.x cache structure."
$necho "[....] Do not start Squid3 on Start Up."
eval update-rc.d squid3 disable $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Do not start Squid3 on Start Up."
fi
# Download and install Sarg only if it isn't installed
if [ -f /usr/bin/sarg ];then
$cecho "[ "$GREEN"found"$END" ] Sarg: Squid Analysis Report Generator."
else
$necho "[....] Installing Sarg - Squid Analysis Report Generator."
eval apt-get install -y udo sarg $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Installing Sarg - Squid Analysis Report Generator."
echo
fi
# Download and install Hostapd v2.3 devel only if it isn't installed.
if [ "$OS" = "BackTrack_5R3" ];then
if [ -f /usr/bin/hostapd ] || [ -f /usr/local/bin/hostapd ] || [ -f /usr/sbin/hostapd ];then
hostapd -v 2> $HOME_DIR/hostapd_version.txt
if [ -n "`grep 'v2.3-devel' $HOME_DIR/hostapd_version.txt`" ];then
$cecho "[ "$GREEN"found"$END" ] Hostapd v2.3-devel: User space IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator."
rm $HOME_DIR/hostapd_version.txt
fi
else
$cecho "----Installing Hostapd v2.3 devel----"
if [ ! -d /usr/src/linux-headers-"`uname -r`" ];then
$necho "[....] Installing - linux-headers-"`uname -r`", build-essential."
eval apt-get install -y linux-headers-"`uname -r`" build-essential $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Installing - linux-headers-"`uname -r`", build-essential."
fi
$necho "[....] Installing - libnl-dev, libssl-dev, libssl0.9.8"
eval apt-get install -y libnl-dev libssl-dev libssl0.9.8 $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Installing - libnl-dev, libssl-dev, libssl0.9.8"
$necho "[....] Downloading - Hostapd v2.3 devel."
cd $HOME_DIR
# We are going to download hostapd v2.2 stable or v2.3 devel?
eval git clone git://w1.fi/srv/git/hostap.git $no_out
#wget http://hostap.epitest.fi/releases/hostapd-2.2.tar.gz
#tar zxf hostapd-2.2.tar.gz
#rm $HOME_DIR/hostapd-2.2.tar.gz
$cecho "\r[ "$GREEN"ok"$END" ] Downloading - Hostapd v2.x devel."
if [ -n "$ATH" ] && [ ! -d $HOME_DIR/madwifi-ng ] && [ "$ATH_PROMPT" = "yes" ];then
$necho "[....] Downloading - Madwifi-ng revision 4181 - (madwifi driver for Hostapd)"
cd $HOME_DIR
wget -q http://snapshots.madwifi-project.org/madwifi-trunk/madwifi-trunk-r4181-20140204.tar.gz
eval tar zxf madwifi-trunk-r4181-20140204.tar.gz $no_out
mv madwifi-trunk-r4181-20140204 madwifi-ng
$cecho "\r[ "$GREEN"ok"$END" ] Downloading - Madwifi-ng revision 4181 - (madwifi driver for Hostapd)"
$necho "[....] Downloading madwifi-ng patch for injection from aircrack-ng."
wget -q http://patches.aircrack-ng.org/madwifi-ng-r4073.patch
$cecho "\r[ "$GREEN"ok"$END" ] Downloading madwifi-ng patch for injection from aircrack-ng."
echo
$necho "[....] Patching madwifi-ng drivers for injection."
eval patch -N -p 0 -i $HOME_DIR/madwifi-ng-r4073.patch $no_out
rm $HOME_DIR/madwifi-ng-r4073.patch
$cecho "\r[ "$GREEN"ok"$END" ] Patching madwifi-ng drivers for injection."
$necho "[....] Modifying hostapd's defconfig file to be able to compile madwifi-ng driver."
sed 's%#CONFIG_DRIVER_MADWIFI=y%CONFIG_DRIVER_MADWIFI=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CFLAGS += -I../../madwifi # change to the madwifi source directory%CFLAGS += -I'$HOME_DIR'/madwifi-ng # change to the madwifi source directory%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
$cecho "\r[ "$GREEN"ok"$END" ] Modifying hostapd's defconfig file to be able to compile madwifi-ng driver."
fi
cd $HOME_DIR/hostap/hostapd
# Set to yes: CONFIG_DRIVER_HOSTAP, CONFIG_DRIVER_NL80211, CONFIG_LIBNL32, CONFIG_IEEE80211N, CONFIG_IEEE80211AC, CONFIG_ACS
# Use openssl libraries
# Enable: WPS and UPnP support for external WPS Registrars
sed 's%#CONFIG_DRIVER_HOSTAP=y%CONFIG_DRIVER_HOSTAP=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_DRIVER_NL80211=y%CONFIG_DRIVER_NL80211=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_LIBNL32=y%CONFIG_LIBNL32=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_IEEE80211N=y%CONFIG_IEEE80211N=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_IEEE80211AC=y%CONFIG_IEEE80211AC=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_ACS=y%CONFIG_ACS=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_TLS=openssl%CONFIG_TLS=openssl%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_WPS=y%CONFIG_WPS=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_WPS_UPNP=y%CONFIG_WPS_UPNP=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
cp $HOME_DIR/hostap/hostapd/defconfig $HOME_DIR/hostap/hostapd/.config
# http://www.brunsware.de/blog/gentoo/hostapd-40mhz-disable-neighbor-check.html
# Disable bss neighbor check/force 40 MHz channels in hostapd
# We disable this: (from hostapd)
# "Please note that 40 MHz channels may switch their primary and secondary channels if needed or creation of 40 MHz channel maybe rejected based
# on overlapping BSSes. These changes are done automatically when hostapd is setting up the 40 MHz channel."
$necho "[....] Creating patch file: Disable bss neighbor check."
cat > $HOME_DIR/hostap/src/ap/hw_features.patch << EOF
--- hw_features.c 2014-08-26 22:33:04.636022614 +0000
+++ hw_features.c 2014-08-26 23:06:39.360048788 +0000
@@ -539,7 +539,7 @@
iface->conf->channel,
iface->conf->channel +
iface->conf->secondary_channel * 4);
- iface->conf->secondary_channel = 0;
+ /* iface->conf->secondary_channel = 0; */
if (iface->drv_flags & WPA_DRIVER_FLAGS_HT_2040_COEX) {
/*
* TODO: Could consider scheduling another scan to check
EOF
$cecho "\r[ "$GREEN"ok"$END" ] Creating patch file: Disable bss neighbor check."
$necho "[....] Patching: Disable bss neighbor check/force 40 MHz channels in hostapd."
eval patch $HOME_DIR/hostap/src/ap/hw_features.c < $HOME_DIR/hostap/src/ap/hw_features.patch $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Patching: Disable bss neighbor check/force 40 MHz channels in hostapd."
$necho "[....] Compiling Hostapd v2.3 devel. - Please wait..."
eval make clean $no_out
eval make $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Compiling Hostapd v2.3 devel. "
$necho "[....] Installing Hostapd v2.3 devel."
eval make install $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Installing Hostapd v2.3 devel."
rm -r -f $HOME_DIR/hostap
echo
fi
elif [ "$OS" = "KALI_linux" ];then
if [ -f /usr/bin/hostapd ] || [ -f /usr/local/bin/hostapd ] || [ -f /usr/sbin/hostapd ];then
hostapd -v 2> $HOME_DIR/hostapd_version.txt
if [ -n "`grep 'v2' $HOME_DIR/hostapd_version.txt`" ];then
$cecho "[ "$GREEN"found"$END" ] Hostapd v2.3-devel: User space IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator."
rm $HOME_DIR/hostapd_version.txt
fi
else
$cecho "----Installing Hostapd v2.3 devel----"
if [ ! -d /usr/src/linux-headers-"`uname -r`" ];then
$necho "[....] Installing - linux-headers-"`uname -r`", build-essential."
eval apt-get install -y linux-headers-"`uname -r`" build-essential $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Installing - linux-headers-"`uname -r`", build-essential."
fi
$necho "[....] Installing - libnl-3-dev, libssl-dev, libssl1.0.0"
eval apt-get install -y libnl-3-dev libssl-dev libssl1.0.0 $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Installing - libnl-3-dev, libssl-dev, libssl1.0.0"
# Creating symbolic links
if [ "`getconf LONG_BIT`" = 32 ];then
if [ ! -f /lib/"`dpkg --print-architecture`"-linux-gnu/libnl.so ] || [ ! -f /lib/"`dpkg --print-architecture`"-linux-gnu/libnl-genl.so ] || [ ! -f /lib/"`dpkg --print-architecture`"-linux-gnu/libnl-genl-3.so ] || [ ! -e /usr/include/netlink ];then
if [ ! -e /usr/include/netlink ];then
ln -s /usr/include/libnl3/netlink/ /usr/include/
fi
ln -s /lib/"`dpkg --print-architecture`"-linux-gnu/libnl-3.so.200.5.2 /lib/"`dpkg --print-architecture`"-linux-gnu/libnl.so
ln -s /lib/"`dpkg --print-architecture`"-linux-gnu/libnl-genl-3.so.200.5.2 /lib/"`dpkg --print-architecture`"-linux-gnu/libnl-genl.so
ln -s /lib/"`dpkg --print-architecture`"-linux-gnu/libnl-genl-3.so.200.5.2 /lib/"`dpkg --print-architecture`"-linux-gnu/libnl-genl-3.so
fi
elif [ "`getconf LONG_BIT`" = 64 ];then
if [ ! -f /lib/"`uname -m`"-linux-gnu/libnl.so ] || [ ! -f /lib/"`uname -m`"-linux-gnu/libnl-genl.so ] || [ ! -f /lib/"`uname -m`"-linux-gnu/libnl-genl-3.so ] || [ ! -e /usr/include/netlink ];then
if [ ! -e /usr/include/netlink ];then
ln -s /usr/include/libnl3/netlink/ /usr/include/
fi
ln -s /lib/"`uname -m`"-linux-gnu/libnl-3.so.200.5.2 /lib/"`uname -m`"-linux-gnu/libnl.so
ln -s /lib/"`uname -m`"-linux-gnu/libnl-genl-3.so.200.5.2 /lib/"`uname -m`"-linux-gnu/libnl-genl.so
ln -s /lib/"`uname -m`"-linux-gnu/libnl-genl-3.so.200.5.2 /lib/"`uname -m`"-linux-gnu/libnl-genl-3.so
fi
fi
$necho "[....] Downloading - Hostapd v2.3 devel."
cd $HOME_DIR
# We are going to download hostapd v2.2 stable or v2.3 devel?
eval git clone git://w1.fi/srv/git/hostap.git $no_out
#wget http://hostap.epitest.fi/releases/hostapd-2.2.tar.gz
#tar zxf hostapd-2.2.tar.gz
#rm $HOME_DIR/hostapd-2.2.tar.gz
$cecho "\r[ "$GREEN"ok"$END" ] Downloading - Hostapd v2.x devel."
if [ -n "$ATH" ] && [ ! -d $HOME_DIR/madwifi-ng ] && [ "$ATH_PROMPT" = "yes" ];then
$necho "[....] Downloading - Madwifi-ng revision 4181 beta - (madwifi driver for Hostapd)"
cd $HOME_DIR
eval git clone https://github.com/proski/madwifi $HOME_DIR/madwifi-ng $no_out
$cecho "\r[ "$GREEN"ok"$END" ] Downloading - Madwifi-ng revision 4181 beta - (madwifi driver for Hostapd)"
$necho "[....] Downloading madwifi-ng patch for injection from aircrack-ng."
wget -q http://patches.aircrack-ng.org/madwifi-ng-r4073.patch
$cecho "\r[ "$GREEN"ok"$END" ] Downloading madwifi-ng patch for injection from aircrack-ng."
echo
$necho "[....] Patching madwifi-ng drivers for injection."
eval patch -N -p 0 -i $HOME_DIR/madwifi-ng-r4073.patch $no_out
rm $HOME_DIR/madwifi-ng-r4073.patch
$cecho "\r[ "$GREEN"ok"$END" ] Patching madwifi-ng drivers for injection."
$necho "[....] Modifying hostapd's defconfig file to be able to compile madwifi-ng driver."
sed 's%#CONFIG_DRIVER_MADWIFI=y%CONFIG_DRIVER_MADWIFI=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CFLAGS += -I../../madwifi # change to the madwifi source directory%CFLAGS += -I'$HOME_DIR'/madwifi-ng # change to the madwifi source directory%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
$cecho "\r[ "$GREEN"ok"$END" ] Modifying hostapd's defconfig file to be able to compile madwifi-ng driver."
fi
cd $HOME_DIR/hostap/hostapd
# Set to yes: CONFIG_DRIVER_HOSTAP, CONFIG_DRIVER_NL80211, CONFIG_LIBNL32, CONFIG_IEEE80211N, CONFIG_IEEE80211AC, CONFIG_ACS
# Use openssl libraries
# Enable: WPS and UPnP support for external WPS Registrars
sed 's%#CONFIG_DRIVER_HOSTAP=y%CONFIG_DRIVER_HOSTAP=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_DRIVER_NL80211=y%CONFIG_DRIVER_NL80211=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_LIBNL32=y%CONFIG_LIBNL32=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_IEEE80211N=y%CONFIG_IEEE80211N=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_IEEE80211AC=y%CONFIG_IEEE80211AC=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_ACS=y%CONFIG_ACS=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_TLS=openssl%CONFIG_TLS=openssl%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_WPS=y%CONFIG_WPS=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_WPS_UPNP=y%CONFIG_WPS_UPNP=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
cp $HOME_DIR/hostap/hostapd/defconfig $HOME_DIR/hostap/hostapd/.config
# http://www.brunsware.de/blog/gentoo/hostapd-40mhz-disable-neighbor-check.html
# Disable bss neighbor check/force 40 MHz channels in hostapd
# We disable this: (from hostapd)v2.3 devel
# "Please note that 40 MHz channels may switch their primary and secondary channels if needed or creation of 40 MHz channel maybe rejected based
# on overlapping BSSes. These changes are done automatically when hostapd is setting up the 40 MHz channel."
$necho "[....] Creating patch file: Disable bss neighbor check/force 40 MHz channels."
cat > $HOME_DIR/hostap/src/ap/hw_features.patch << EOF
--- hw_features.c 2014-08-26 22:33:04.636022614 +0000
+++ hw_features.c 2014-08-26 23:06:39.360048788 +0000
@@ -539,7 +539,7 @@
iface->conf->channel,
iface->conf->channel +
iface->conf->secondary_channel * 4);
- iface->conf->secondary_channel = 0;
+ /* iface->conf->secondary_channel = 0; */
if (iface->drv_flags & WPA_DRIVER_FLAGS_HT_2040_COEX) {
/*
* TODO: Could consider scheduling another scan to check
EOF