forked from v1s1t0r1sh3r3/airgeddon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
airgeddon.sh
11115 lines (9385 loc) · 291 KB
/
airgeddon.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
#!/usr/bin/env bash
#Title........: airgeddon.sh
#Description..: This is a multi-use bash script for Linux systems to audit wireless networks.
#Author.......: v1s1t0r
#Date.........: 20180319
#Version......: 8.01
#Usage........: bash airgeddon.sh
#Bash Version.: 4.2 or later
#Enabled with extra-verbose mode 2 / Enabled 1 / Disabled 0 - Debug mode for faster development skipping intro and initial checks - Default value 0
debug_mode=0
#Enabled 1 / Disabled 0 - Auto update feature (it has no effect on debug mode) - Default value 1
auto_update=1
#Enabled 1 / Disabled 0 - Auto change language feature - Default value 1
auto_change_language=1
#Enabled 1 / Disabled 0 - Allow colorized output - Default value 1
allow_colorization=1
#Language vars
#Change this line to select another default language. Select one from available values in array
language="ENGLISH"
declare -A lang_association=(
["en"]="ENGLISH"
["es"]="SPANISH"
["fr"]="FRENCH"
["ca"]="CATALAN"
["pt"]="PORTUGUESE"
["ru"]="RUSSIAN"
["gr"]="GREEK"
["it"]="ITALIAN"
["pl"]="POLISH"
["de"]="GERMAN"
)
#Tools vars
essential_tools_names=(
"ifconfig"
"iwconfig"
"iw"
"awk"
"airmon-ng"
"airodump-ng"
"aircrack-ng"
"xterm"
)
optional_tools_names=(
"wpaclean"
"crunch"
"aireplay-ng"
"mdk3"
"hashcat"
"hostapd"
"dhcpd"
"iptables"
"ettercap"
"etterlog"
"sslstrip"
"lighttpd"
"dnsspoof"
"wash"
"reaver"
"bully"
"pixiewps"
"unbuffer"
"bettercap"
"beef"
"packetforge-ng"
)
update_tools=("curl")
declare -A possible_package_names=(
[${essential_tools_names[0]}]="net-tools" #ifconfig
[${essential_tools_names[1]}]="wireless-tools / wireless_tools" #iwconfig
[${essential_tools_names[2]}]="iw" #iw
[${essential_tools_names[3]}]="awk / gawk" #awk
[${essential_tools_names[4]}]="aircrack-ng" #airmon-ng
[${essential_tools_names[5]}]="aircrack-ng" #airodump-ng
[${essential_tools_names[6]}]="aircrack-ng" #aircrack-ng
[${essential_tools_names[7]}]="xterm" #xterm
[${optional_tools_names[0]}]="aircrack-ng" #wpaclean
[${optional_tools_names[1]}]="crunch" #crunch
[${optional_tools_names[2]}]="aircrack-ng" #aireplay-ng
[${optional_tools_names[3]}]="mdk3" #mdk3
[${optional_tools_names[4]}]="hashcat" #hashcat
[${optional_tools_names[5]}]="hostapd" #hostapd
[${optional_tools_names[6]}]="isc-dhcp-server / dhcp-server / dhcp" #dhcpd
[${optional_tools_names[7]}]="iptables" #iptables
[${optional_tools_names[8]}]="ettercap / ettercap-text-only / ettercap-graphical" #ettercap
[${optional_tools_names[9]}]="ettercap / ettercap-text-only / ettercap-graphical" #etterlog
[${optional_tools_names[10]}]="sslstrip" #sslstrip
[${optional_tools_names[11]}]="lighttpd" #lighttpd
[${optional_tools_names[12]}]="dsniff" #dnsspoof
[${optional_tools_names[13]}]="reaver" #wash
[${optional_tools_names[14]}]="reaver" #reaver
[${optional_tools_names[15]}]="bully" #bully
[${optional_tools_names[16]}]="pixiewps" #pixiewps
[${optional_tools_names[17]}]="expect / expect-dev" #unbuffer
[${optional_tools_names[18]}]="bettercap" #bettercap
[${optional_tools_names[19]}]="beef-xss / beef-project" #beef
[${optional_tools_names[20]}]="aircrack-ng" #packetforge-ng
[${update_tools[0]}]="curl" #curl
)
#More than one alias can be defined separated by spaces at value
declare -A possible_alias_names=(
["beef"]="beef-xss beef-server"
)
#General vars
airgeddon_version="8.01"
language_strings_expected_version="8.01-1"
standardhandshake_filename="handshake-01.cap"
tmpdir="/tmp/"
osversionfile_dir="/etc/"
minimum_bash_version_required="4.2"
resume_message=224
abort_question=12
pending_of_translation="[PoT]"
escaped_pending_of_translation="\[PoT\]"
standard_resolution="1024x768"
curl_404_error="404: Not Found"
language_strings_file="language_strings.sh"
broadcast_mac="FF:FF:FF:FF:FF:FF"
#5Ghz vars
ghz="Ghz"
band_24ghz="2.4${ghz}"
band_5ghz="5${ghz}"
valid_channels_24_ghz_regexp="([1-9]|1[0-4])"
valid_channels_24_and_5_ghz_regexp="([1-9]|1[0-4]|3[68]|4[0468]|5[246]|6[024]|10[0248]|11[02])"
minimum_wash_dualscan_version="1.6.5"
#aircrack vars
aircrack_tmp_simple_name_file="aircrack"
aircrack_pot_tmp="${aircrack_tmp_simple_name_file}.pot"
#hashcat vars
hashcat3_version="3.0"
hashcat4_version="4.0.0"
hashcat_hccapx_version="3.40"
hashcat_tmp_simple_name_file="hctmp"
hashcat_tmp_file="${hashcat_tmp_simple_name_file}.hccap"
hashcat_pot_tmp="${hashcat_tmp_simple_name_file}.pot"
hashcat_output_file="${hashcat_tmp_simple_name_file}.out"
hccapx_tool="cap2hccapx"
possible_hccapx_converter_known_locations=(
"/usr/lib/hashcat-utils/${hccapx_tool}.bin"
)
#WEP vars
wep_data="wepdata"
wepdir="wep/"
wep_attack_file="ag.wep.sh"
wep_key_handler="ag.wep_key_handler.sh"
wep_processes_file="wep_processes"
#Docker vars
docker_based_distro="Kali"
docker_io_dir="/io"
#WPS vars
minimum_reaver_pixiewps_version="1.5.2"
minimum_bully_pixiewps_version="1.1"
minimum_bully_verbosity4_version="1.1"
minimum_wash_json_version="1.6.2"
known_pins_dbfile="known_pins.db"
pins_dbfile_checksum="pindb_checksum.txt"
wps_default_generic_pin="12345670"
wps_attack_script_file="ag.wpsattack.sh"
wps_out_file="ag.wpsout.txt"
timeout_secs_per_pin="30"
timeout_secs_per_pixiedust="30"
#Repository and contact vars
repository_hostname="github.com"
github_user="v1s1t0r1sh3r3"
github_repository="airgeddon"
branch="master"
script_filename="airgeddon.sh"
urlgithub="https://${repository_hostname}/${github_user}/${github_repository}"
urlscript_directlink="https://raw.githubusercontent.com/${github_user}/${github_repository}/${branch}/${script_filename}"
urlscript_pins_dbfile="https://raw.githubusercontent.com/${github_user}/${github_repository}/${branch}/${known_pins_dbfile}"
urlscript_pins_dbfile_checksum="https://raw.githubusercontent.com/${github_user}/${github_repository}/${branch}/${pins_dbfile_checksum}"
urlscript_language_strings_file="https://raw.githubusercontent.com/${github_user}/${github_repository}/${branch}/${language_strings_file}"
urlgithub_wiki="https://${repository_hostname}/${github_user}/${github_repository}/wiki"
mail="[email protected]"
author="v1s1t0r"
#Dhcpd, Hostapd and misc Evil Twin vars
ip_range="192.168.1.0"
alt_ip_range="172.16.250.0"
router_ip="192.168.1.1"
alt_router_ip="172.16.250.1"
broadcast_ip="192.168.1.255"
alt_broadcast_ip="172.16.250.255"
range_start="192.168.1.33"
range_stop="192.168.1.100"
alt_range_start="172.16.250.33"
alt_range_stop="172.16.250.100"
std_c_mask="255.255.255.0"
ip_mask="255.255.255.255"
dhcpd_file="ag.dhcpd.conf"
internet_dns1="8.8.8.8"
internet_dns2="8.8.4.4"
internet_dns3="139.130.4.5"
sslstrip_port="10000"
bettercap_proxy_port="8080"
bettercap_dns_port="5300"
minimum_bettercap_advanced_options="1.5.9"
minimum_bettercap_fixed_beef_iptables_issue="1.6.2"
sslstrip_file="ag.sslstrip.log"
ettercap_file="ag.ettercap.log"
bettercap_file="ag.bettercap.log"
beef_port="3000"
beef_control_panel_url="http://127.0.0.1:${beef_port}/ui/panel"
jshookfile="hook.js"
beef_file="ag.beef.conf"
beef_pass="airgeddon"
beef_db="beef.db"
beef_installation_url="https://github.com/beefproject/beef/wiki/Installation"
hostapd_file="ag.hostapd.conf"
control_file="ag.control.sh"
webserver_file="ag.lighttpd.conf"
webdir="www/"
indexfile="index.htm"
checkfile="check.htm"
cssfile="portal.css"
jsfile="portal.js"
attemptsfile="ag.et_attempts.txt"
currentpassfile="ag.et_currentpass.txt"
successfile="ag.et_success.txt"
processesfile="ag.et_processes.txt"
channelfile="ag.et_channel.txt"
possible_dhcp_leases_files=(
"/var/lib/dhcp/dhcpd.leases"
"/var/state/dhcp/dhcpd.leases"
"/var/lib/dhcpd/dhcpd.leases"
)
possible_beef_known_locations=(
"/usr/share/beef/"
"/usr/share/beef-xss/"
"/opt/beef/"
"/opt/beef-project/"
#Custom BeEF location (set=0)
)
#Connection vars
ips_to_check_internet=(
"${internet_dns1}"
"${internet_dns2}"
"${internet_dns3}"
)
#Distros vars
known_compatible_distros=(
"Wifislax"
"Kali"
"Parrot"
"Backbox"
"BlackArch"
"Cyborg"
"Ubuntu"
"Debian"
"SuSE"
"CentOS"
"Gentoo"
"Fedora"
"Red Hat"
"Arch"
"OpenMandriva"
)
known_arm_compatible_distros=(
"Raspbian"
"Parrot arm"
"Kali arm"
)
#Hint vars
declare main_hints=(128 134 163 437 438 442 445 516)
declare dos_hints=(129 131 133)
declare handshake_hints=(127 130 132 136)
declare handshake_attack_hints=(142)
declare decrypt_hints=(171 178 179 208 244 163)
declare select_interface_hints=(246)
declare language_hints=(250 438)
declare option_hints=(445 250 448 477)
declare evil_twin_hints=(254 258 264 269 309 328 400 509)
declare evil_twin_dos_hints=(267 268 509)
declare beef_hints=(408)
declare wps_hints=(342 343 344 356 369 390 490)
declare wep_hints=(431 429 428 432 433)
#Charset vars
crunch_lowercasecharset="abcdefghijklmnopqrstuvwxyz"
crunch_uppercasecharset="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
crunch_numbercharset="0123456789"
crunch_symbolcharset="!#$%/=?{}[]-*:;"
hashcat_charsets=("?l" "?u" "?d" "?s")
#Colors vars
green_color="\033[1;32m"
green_color_title="\033[0;32m"
red_color="\033[1;31m"
red_color_slim="\033[0;031m"
blue_color="\033[1;34m"
cyan_color="\033[1;36m"
brown_color="\033[0;33m"
yellow_color="\033[1;33m"
pink_color="\033[1;35m"
white_color="\e[1;97m"
normal_color="\e[1;0m"
#Check coherence between script and language_strings file
function check_language_strings() {
debug_print
if [ -f "${scriptfolder}${language_strings_file}" ]; then
language_file_found=1
language_file_mismatch=0
#shellcheck source=./language_strings.sh
source "${scriptfolder}${language_strings_file}"
set_language_strings_version
if [ "${language_strings_version}" != "${language_strings_expected_version}" ]; then
language_file_mismatch=1
fi
else
language_file_found=0
fi
if [[ "${language_file_found}" -eq 0 ]] || [[ "${language_file_mismatch}" -eq 1 ]]; then
language_strings_handling_messages
generate_dynamic_line "airgeddon" "title"
if [ "${language_file_found}" -eq 0 ]; then
echo_red "${language_strings_no_file[${language}]}"
if [ "${airgeddon_version}" = "6.1" ]; then
echo
echo_yellow "${language_strings_first_time[${language}]}"
fi
elif [ "${language_file_mismatch}" -eq 1 ]; then
echo_red "${language_strings_file_mismatch[${language}]}"
fi
echo
echo_blue "${language_strings_try_to_download[${language}]}"
read -p "${language_strings_key_to_continue[${language}]}" -r
if check_repository_access; then
if download_language_strings_file; then
echo
echo_yellow "${language_strings_successfully_downloaded[${language}]}"
read -p "${language_strings_key_to_continue[${language}]}" -r
clear
return 0
else
echo
echo_red "${language_strings_failed_downloading[${language}]}"
fi
else
echo
echo_red "${language_strings_failed_downloading[${language}]}"
fi
echo
echo_blue "${language_strings_exiting[${language}]}"
echo
hardcore_exit
fi
}
#Download the language strings file
function download_language_strings_file() {
debug_print
local lang_file_downloaded=0
remote_language_strings_file=$(timeout -s SIGTERM 15 curl -L ${urlscript_language_strings_file} 2> /dev/null)
if [[ -n "${remote_language_strings_file}" ]] && [[ "${remote_language_strings_file}" != "${curl_404_error}" ]]; then
lang_file_downloaded=1
else
http_proxy_detect
if [ "${http_proxy_set}" -eq 1 ]; then
remote_language_strings_file=$(timeout -s SIGTERM 15 curl --proxy "${http_proxy}" -L ${urlscript_language_strings_file} 2> /dev/null)
if [[ -n "${remote_language_strings_file}" ]] && [[ "${remote_language_strings_file}" != "${curl_404_error}" ]]; then
lang_file_downloaded=1
fi
fi
fi
if [ "${lang_file_downloaded}" -eq 1 ]; then
echo "${remote_language_strings_file}" > "${scriptfolder}${language_strings_file}"
chmod +x "${scriptfolder}${language_strings_file}" > /dev/null 2>&1
#shellcheck source=./language_strings.sh
source "${scriptfolder}${language_strings_file}"
return 0
else
return 1
fi
}
#Set messages for language_strings handling
function language_strings_handling_messages() {
declare -gA language_strings_no_file
language_strings_no_file["ENGLISH"]="Error. Language strings file not found"
language_strings_no_file["SPANISH"]="Error. No se ha encontrado el fichero de traducciones"
language_strings_no_file["FRENCH"]="Erreur. Fichier contenant les traductions absent"
language_strings_no_file["CATALAN"]="Error. No s'ha trobat el fitxer de traduccions"
language_strings_no_file["PORTUGUESE"]="Erro. O arquivo de tradução não foi encontrado"
language_strings_no_file["RUSSIAN"]="Ошибка. Не найден языковой файл"
language_strings_no_file["GREEK"]="Σφάλμα. Το αρχείο γλωσσών δεν βρέθηκε"
language_strings_no_file["ITALIAN"]="Errore. Non si trova il file delle traduzioni"
language_strings_no_file["POLISH"]="Błąd. Nie znaleziono pliku tłumaczenia"
language_strings_no_file["GERMAN"]="Fehler. Die Übersetzungsdatei wurde nicht gefunden"
declare -gA language_strings_file_mismatch
language_strings_file_mismatch["ENGLISH"]="Error. The language strings file found mismatches expected version"
language_strings_file_mismatch["SPANISH"]="Error. El fichero de traducciones encontrado no es la versión esperada"
language_strings_file_mismatch["FRENCH"]="Erreur. Les traductions trouvées ne sont pas celles attendues"
language_strings_file_mismatch["CATALAN"]="Error. El fitxer de traduccions trobat no és la versió esperada"
language_strings_file_mismatch["PORTUGUESE"]="Erro. O a versão do arquivos de tradução encontrado é a incompatível"
language_strings_file_mismatch["RUSSIAN"]="Ошибка. Языковой файл не соответствует ожидаемой версии"
language_strings_file_mismatch["GREEK"]="Σφάλμα. Το αρχείο γλωσσών που έχει βρεθεί δεν αντιστοιχεί με την προαπαιτούμενη έκδοση"
language_strings_file_mismatch["ITALIAN"]="Errore. Il file delle traduzioni trovato non è la versione prevista"
language_strings_file_mismatch["POLISH"]="Błąd. Znaleziony plik tłumaczenia nie jest oczekiwaną wersją"
language_strings_file_mismatch["GERMAN"]="Fehler. Die gefundene Übersetzungsdatei ist nicht die erwartete Version"
declare -gA language_strings_try_to_download
language_strings_try_to_download["ENGLISH"]="airgeddon will try to download the language strings file..."
language_strings_try_to_download["SPANISH"]="airgeddon intentará descargar el fichero de traducciones..."
language_strings_try_to_download["FRENCH"]="airgeddon va essayer de télécharger les fichiers de traductions..."
language_strings_try_to_download["CATALAN"]="airgeddon intentarà descarregar el fitxer de traduccions..."
language_strings_try_to_download["PORTUGUESE"]="O airgeddon tentará baixar o arquivo de tradução..."
language_strings_try_to_download["RUSSIAN"]="airgeddon попытается загрузить языковой файл..."
language_strings_try_to_download["GREEK"]="Το airgeddon θα προσπαθήσει να κατεβάσει το αρχείο γλωσσών..."
language_strings_try_to_download["ITALIAN"]="airgeddon cercherá di scaricare il file delle traduzioni..."
language_strings_try_to_download["POLISH"]="airgeddon spróbuje pobrać plik tłumaczeń..."
language_strings_try_to_download["GERMAN"]="airgeddon wird versuchen, die Übersetzungsdatei herunterzuladen..."
declare -gA language_strings_successfully_downloaded
language_strings_successfully_downloaded["ENGLISH"]="Language strings file was successfully downloaded"
language_strings_successfully_downloaded["SPANISH"]="Se ha descargado con éxito el fichero de traducciones"
language_strings_successfully_downloaded["FRENCH"]="Les fichiers traduction ont été correctement téléchargés"
language_strings_successfully_downloaded["CATALAN"]="S'ha descarregat amb èxit el fitxer de traduccions"
language_strings_successfully_downloaded["PORTUGUESE"]="O arquivo de tradução foi baixado com sucesso"
language_strings_successfully_downloaded["RUSSIAN"]="Языковой файл был успешно загружен"
language_strings_successfully_downloaded["GREEK"]="Το αρχείο γλωσσών κατέβηκε με επιτυχία"
language_strings_successfully_downloaded["ITALIAN"]="Il file delle traduzioni è stato scaricato con successo"
language_strings_successfully_downloaded["POLISH"]="Plik z tłumaczeniem został pomyślnie pobrany"
language_strings_successfully_downloaded["GERMAN"]="Die Übersetzungsdatei wurde erfolgreich heruntergeladen"
declare -gA language_strings_failed_downloading
language_strings_failed_downloading["ENGLISH"]="The language string file can't be downloaded. Check your internet connection or download it manually from ${normal_color}${urlgithub}"
language_strings_failed_downloading["SPANISH"]="No se ha podido descargar el fichero de traducciones. Comprueba tu conexión a internet o descárgalo manualmente de ${normal_color}${urlgithub}"
language_strings_failed_downloading["FRENCH"]="Impossible de télécharger le fichier traduction. Vérifiez votre connexion à internet ou téléchargez le fichier manuellement ${normal_color}${urlgithub}"
language_strings_failed_downloading["CATALAN"]="No s'ha pogut descarregar el fitxer de traduccions. Comprova la connexió a internet o descarrega'l manualment de ${normal_color}${urlgithub}"
language_strings_failed_downloading["PORTUGUESE"]="Não foi possível baixar o arquivos de tradução. Verifique a sua conexão com a internet ou baixe manualmente em ${normal_color}${urlgithub}"
language_strings_failed_downloading["RUSSIAN"]="Языковой файл не может быть загружен. Проверьте подключение к Интернету или загрузите его вручную с ${normal_color}${urlgithub}"
language_strings_failed_downloading["GREEK"]="Το αρχείο γλωσσών δεν μπορεί να κατέβει. Ελέγξτε τη σύνδεση σας με το διαδίκτυο ή κατεβάστε το χειροκίνητα ${normal_color}${urlgithub}"
language_strings_failed_downloading["ITALIAN"]="Impossibile scaricare il file delle traduzioni. Controlla la tua connessione a internet o scaricalo manualmente ${normal_color}${urlgithub}"
language_strings_failed_downloading["POLISH"]="Nie można pobrać pliku tłumaczenia. Sprawdź połączenie internetowe lub pobierz go ręcznie z ${normal_color}${urlgithub}"
language_strings_failed_downloading["GERMAN"]="Die Übersetzungsdatei konnte nicht heruntergeladen werden. Überprüfen Sie Ihre Internetverbindung oder laden Sie sie manuell von ${normal_color}${urlgithub} runter"
declare -gA language_strings_first_time
language_strings_first_time["ENGLISH"]="If you are seeing this message after an automatic update, don't be scared! It's probably because airgeddon has different file structure since version 6.1. It will be automatically fixed"
language_strings_first_time["SPANISH"]="Si estás viendo este mensaje tras una actualización automática, ¡no te asustes! probablemente es porque a partir de la versión 6.1 la estructura de ficheros de airgeddon ha cambiado. Se reparará automáticamente"
language_strings_first_time["FRENCH"]="Si vous voyez ce message après une mise à jour automatique ne vous inquiétez pas! A partir de la version 6.1 la structure de fichier d'airgeddon a changé. L'ajustement se fera automatiquement"
language_strings_first_time["CATALAN"]="Si estàs veient aquest missatge després d'una actualització automàtica, no t'espantis! probablement és perquè a partir de la versió 6.1 l'estructura de fitxers de airgeddon ha canviat. Es repararà automàticament"
language_strings_first_time["PORTUGUESE"]="Se você está vendo esta mensagem depois de uma atualização automática, não tenha medo! A partir da versão 6.1 da estrutura de arquivos do airgeddon mudou. Isso será corrigido automaticamente"
language_strings_first_time["RUSSIAN"]="Если вы видите это сообщение после автоматического обновления, не переживайте! Вероятно, это объясняется тем, что, начиная с версии 6.1, airgeddon имеет другую структуру файлов. Проблема будет разрешена автоматически"
language_strings_first_time["GREEK"]="Εάν βλέπετε αυτό το μήνυμα μετά από κάποια αυτόματη ενημέρωση, μην τρομάξετε! Πιθανόν είναι λόγω της διαφορετικής δομής του airgeddon μετά από την έκδοση 6.1. Θα επιδιορθωθεί αυτόματα"
language_strings_first_time["ITALIAN"]="Se stai vedendo questo messaggio dopo un aggiornamento automatico, niente panico! probabilmente è perché a partire dalla versione 6.1 é cambiata la struttura dei file di airgeddon. Sarà riparato automaticamente"
language_strings_first_time["POLISH"]="Jeśli widzisz tę wiadomość po automatycznej aktualizacji, nie obawiaj się! To prawdopodobnie dlatego, że w wersji 6.1 zmieniła się struktura plików airgeddon. Naprawi się automatycznie"
language_strings_first_time["GERMAN"]="Wenn Sie diese Nachricht nach einem automatischen Update sehen, haben Sie keine Angst! Das liegt vermutlich daran, dass ab Version 6.1 die Dateistruktur von airgeddon geändert wurde. Es wird automatisch repariert"
declare -gA language_strings_exiting
language_strings_exiting["ENGLISH"]="Exiting airgeddon script v${airgeddon_version} - See you soon! :)"
language_strings_exiting["SPANISH"]="Saliendo de airgeddon script v${airgeddon_version} - Nos vemos pronto! :)"
language_strings_exiting["FRENCH"]="Fermeture du script airgeddon v${airgeddon_version} - A bientôt! :)"
language_strings_exiting["CATALAN"]="Sortint de airgeddon script v${airgeddon_version} - Ens veiem aviat! :)"
language_strings_exiting["PORTUGUESE"]="Saindo do script airgeddon v${airgeddon_version} - Até breve! :)"
language_strings_exiting["RUSSIAN"]="Выход из скрипта airgeddon v${airgeddon_version} - До встречи! :)"
language_strings_exiting["GREEK"]="Κλείσιμο του airgeddon v${airgeddon_version} - Αντίο :)"
language_strings_exiting["ITALIAN"]="Uscendo dallo script airgeddon v${airgeddon_version} - A presto! :)"
language_strings_exiting["POLISH"]="Wyjście z skryptu airgeddon v${airgeddon_version} - Do zobaczenia wkrótce! :)"
language_strings_exiting["GERMAN"]="Sie verlassen airgeddon v${airgeddon_version} - Bis bald! :)"
declare -gA language_strings_key_to_continue
language_strings_key_to_continue["ENGLISH"]="Press [Enter] key to continue..."
language_strings_key_to_continue["SPANISH"]="Pulsa la tecla [Enter] para continuar..."
language_strings_key_to_continue["FRENCH"]="Pressez [Enter] pour continuer..."
language_strings_key_to_continue["CATALAN"]="Prem la tecla [Enter] per continuar..."
language_strings_key_to_continue["PORTUGUESE"]="Pressione a tecla [Enter] para continuar..."
language_strings_key_to_continue["RUSSIAN"]="Нажмите клавишу [Enter] для продолжения..."
language_strings_key_to_continue["GREEK"]="Πατήστε το κουμπί [Enter] για να συνεχίσετε..."
language_strings_key_to_continue["ITALIAN"]="Premere il tasto [Enter] per continuare..."
language_strings_key_to_continue["POLISH"]="Naciśnij klawisz [Enter] aby kontynuować..."
language_strings_key_to_continue["GERMAN"]="Drücken Sie die [Enter]-Taste um fortzufahren..."
}
#Toggle language auto-detection feature
function auto_change_language_toggle() {
debug_print
if [ "${auto_change_language}" -eq 1 ]; then
sed -ri 's:(auto_change_language)=(1):\1=0:' "${scriptfolder}${scriptname}" 2> /dev/null
if ! grep -E "auto_[c]hange_language=0" "${scriptfolder}${scriptname}" > /dev/null; then
return 1
fi
auto_change_language=$((auto_change_language-1))
else
sed -ri 's:(auto_change_language)=(0):\1=1:' "${scriptfolder}${scriptname}" 2> /dev/null
if ! grep -E "auto_[c]hange_language=1" "${scriptfolder}${scriptname}" > /dev/null; then
return 1
fi
auto_change_language=$((auto_change_language+1))
fi
return 0
}
#Toggle allow colorization feature
function allow_colorization_toggle() {
debug_print
if [ "${allow_colorization}" -eq 1 ]; then
sed -ri 's:(allow_colorization)=(1):\1=0:' "${scriptfolder}${scriptname}" 2> /dev/null
if ! grep -E "allow_[c]olorization=0" "${scriptfolder}${scriptname}" > /dev/null; then
return 1
fi
allow_colorization=$((allow_colorization-1))
else
sed -ri 's:(allow_colorization)=(0):\1=1:' "${scriptfolder}${scriptname}" 2> /dev/null
if ! grep -E "allow_[c]olorization=1" "${scriptfolder}${scriptname}" > /dev/null; then
return 1
fi
allow_colorization=$((allow_colorization+1))
fi
initialize_colorized_output
return 0
}
#Toggle auto-update feature
function auto_update_toggle() {
debug_print
if [ "${auto_update}" -eq 1 ]; then
sed -ri 's:(auto_update)=(1):\1=0:' "${scriptfolder}${scriptname}" 2> /dev/null
if ! grep -E "auto_[u]pdate=0" "${scriptfolder}${scriptname}" > /dev/null; then
return 1
fi
auto_update=$((auto_update-1))
else
sed -ri 's:(auto_update)=(0):\1=1:' "${scriptfolder}${scriptname}" 2> /dev/null
if ! grep -E "auto_[u]pdate=1" "${scriptfolder}${scriptname}" > /dev/null; then
return 1
fi
auto_update=$((auto_update+1))
fi
return 0
}
#Get current permanent language
function get_current_permanent_language() {
debug_print
current_permanent_language=$(grep "language=" "${scriptfolder}${scriptname}" | grep -v "auto_change_language" | head -n 1 | awk -F "=" '{print $2}')
current_permanent_language=$(echo "${current_permanent_language}" | sed -e 's/^"//;s/"$//')
}
#Set language as permanent
function set_permanent_language() {
debug_print
sed -ri "s:^([l]anguage)=\"[a-zA-Z]+\":\1=\"${language}\":" "${scriptfolder}${scriptname}" 2> /dev/null
if ! grep -E "^[l]anguage=\"${language}\"" "${scriptfolder}${scriptname}" > /dev/null; then
return 1
fi
return 0
}
#Print the current line of where this was called and the function's name. Applies to some (which are useful) functions
function debug_print() {
if [ ${debug_mode} -eq 2 ]; then
declare excluded_functions=(
"ask_yesno"
"check_pending_of_translation"
"contains_element"
"echo_blue"
"echo_brown"
"echo_cyan"
"echo_green"
"echo_green_title"
"echo_pink"
"echo_red"
"echo_red_slim"
"echo_white"
"echo_yellow"
"generate_dynamic_line"
"interrupt_checkpoint"
"language_strings"
"last_echo"
"physical_interface_finder"
"print_hint"
"print_large_separator"
"print_simple_separator"
"read_yesno"
"remove_warnings"
"special_text_missed_optional_tool"
"store_array"
"under_construction_message"
)
if (IFS=$'\n'; echo "${excluded_functions[*]}") | grep -qFx "${FUNCNAME[1]}"; then
return 1
fi
echo "Line:${BASH_LINENO[1]}" "${FUNCNAME[1]}"
fi
return 0
}
#Set the message to show again after an interrupt ([Ctrl+C] or [Ctrl+Z]) without exiting
function interrupt_checkpoint() {
debug_print
if [ -z "${last_buffered_type1}" ]; then
last_buffered_message1=${1}
last_buffered_message2=${1}
last_buffered_type1=${2}
last_buffered_type2=${2}
else
if [ "${1}" -ne ${resume_message} ]; then
last_buffered_message2=${last_buffered_message1}
last_buffered_message1=${1}
last_buffered_type2=${last_buffered_type1}
last_buffered_type1=${2}
fi
fi
}
#Add the text on a menu when you miss an optional tool
function special_text_missed_optional_tool() {
debug_print
declare -a required_tools=("${!3}")
allowed_menu_option=1
if [ ${debug_mode} -eq 0 ]; then
tools_needed="${optionaltool_needed[${1}]}"
for item in "${required_tools[@]}"; do
if [ "${optional_tools[${item}]}" -eq 0 ]; then
allowed_menu_option=0
tools_needed+="${item} "
fi
done
fi
if [ ${allowed_menu_option} -eq 1 ]; then
last_echo "${arr[${1},${2}]}" "${normal_color}"
else
[[ ${arr[${1},${2}]} =~ ^([0-9]+)\.(.*)$ ]] && forbidden_options+=("${BASH_REMATCH[1]}")
tools_needed=${tools_needed:: -1}
echo_red_slim "${arr[${1},${2}]} (${tools_needed})"
fi
}
#Generate the chars in front of and behind a text for titles and separators
function generate_dynamic_line() {
debug_print
local type=${2}
if [ "${type}" = "title" ]; then
ncharstitle=78
titlechar="*"
elif [ "${type}" = "separator" ]; then
ncharstitle=58
titlechar="-"
fi
titletext=${1}
titlelength=${#titletext}
finaltitle=""
for ((i=0; i < (ncharstitle/2 - titlelength+(titlelength/2)); i++)); do
finaltitle="${finaltitle}${titlechar}"
done
if [ "${type}" = "title" ]; then
finaltitle="${finaltitle} ${titletext} "
elif [ "${type}" = "separator" ]; then
finaltitle="${finaltitle} (${titletext}) "
fi
for ((i=0; i < (ncharstitle/2 - titlelength+(titlelength/2)); i++)); do
finaltitle="${finaltitle}${titlechar}"
done
if [ $((titlelength % 2)) -gt 0 ]; then
finaltitle+="${titlechar}"
fi
if [ "${type}" = "title" ]; then
echo_green_title "${finaltitle}"
elif [ "${type}" = "separator" ]; then
echo_blue "${finaltitle}"
fi
}
#Wrapper to check managed mode on an interface
function check_to_set_managed() {
debug_print
check_interface_mode "${1}"
case "${ifacemode}" in
"Managed")
echo
language_strings "${language}" 0 "red"
language_strings "${language}" 115 "read"
return 1
;;
"(Non wifi card)")
echo
language_strings "${language}" 1 "red"
language_strings "${language}" 115 "read"
return 1
;;
esac
return 0
}
#Wrapper to check monitor mode on an interface
function check_to_set_monitor() {
debug_print
check_interface_mode "${1}"
case "${ifacemode}" in
"Monitor")
echo
language_strings "${language}" 10 "red"
language_strings "${language}" 115 "read"
return 1
;;
"(Non wifi card)")
echo
language_strings "${language}" 13 "red"
language_strings "${language}" 115 "read"
return 1
;;
esac
return 0
}
#Check for monitor mode on an interface
function check_monitor_enabled() {
debug_print
mode=$(iwconfig "${1}" 2> /dev/null | grep Mode: | awk '{print $4}' | cut -d ':' -f 2)
current_iface_on_messages="${1}"
if [[ ${mode} != "Monitor" ]]; then
return 1
fi
return 0
}
#Check if an interface is a wifi card or not
function check_interface_wifi() {
debug_print
execute_iwconfig_fix "${1}"
return $?
}
#Execute the iwconfig fix to know if an interface is a wifi card or not
function execute_iwconfig_fix() {
debug_print
iwconfig_fix
iwcmd="iwconfig ${1} ${iwcmdfix} > /dev/null 2> /dev/null"
eval "${iwcmd}"
return $?
}
#Create a list of interfaces associated to its macs
function renew_ifaces_and_macs_list() {
debug_print
readarray -t IFACES_AND_MACS < <(ip link | grep -E "^[0-9]+" | cut -d ':' -f 2 | awk '{print $1}' | grep lo -v | grep "${interface}" -v)
declare -gA ifaces_and_macs
for iface_name in "${IFACES_AND_MACS[@]}"; do
mac_item=$(cat "/sys/class/net/${iface_name}/address" 2> /dev/null)
if [ -n "${mac_item}" ]; then
ifaces_and_macs[${iface_name}]=${mac_item}
fi
done
declare -gA ifaces_and_macs_switched
for iface_name in "${!ifaces_and_macs[@]}"; do
ifaces_and_macs_switched[${ifaces_and_macs[${iface_name}]}]=${iface_name}
done
}
#Check the interface coherence between interface names and macs
function check_interface_coherence() {
debug_print
renew_ifaces_and_macs_list
interface_auto_change=0
interface_found=0
for iface_name in "${!ifaces_and_macs[@]}"; do
if [ "${interface}" = "${iface_name}" ]; then
interface_found=1
interface_mac=${ifaces_and_macs[${iface_name}]}
break
fi
done
if [ ${interface_found} -eq 0 ]; then
for iface_mac in "${ifaces_and_macs[@]}"; do
iface_mac_tmp=${iface_mac:0:15}
interface_mac_tmp=${interface_mac:0:15}
if [ "${iface_mac_tmp}" = "${interface_mac_tmp}" ]; then
interface=${ifaces_and_macs_switched[${iface_mac}]}
phy_interface=$(physical_interface_finder "${interface}")
check_interface_supported_bands "${phy_interface}" "main_wifi_interface"
interface_auto_change=1
break
fi
done
fi
return ${interface_auto_change}
}
#Add contributing footer to a file
function add_contributing_footer_to_file() {
debug_print
{
echo ""
echo "---------------"
echo ""
echo "${footer_texts[${language},1]}"
} >> "${1}"
}
#Prepare the vars to be used on wps pin database attacks
function set_wps_mac_parameters() {
debug_print
six_wpsbssid_first_digits=${wps_bssid:0:8}
six_wpsbssid_first_digits_clean=${six_wpsbssid_first_digits//:}
six_wpsbssid_last_digits=${wps_bssid: -8}
six_wpsbssid_last_digits_clean=${six_wpsbssid_last_digits//:}
four_wpsbssid_last_digits=${wps_bssid: -5}
four_wpsbssid_last_digits_clean=${four_wpsbssid_last_digits//:}
}
#Check if wash has json option
function check_json_option_on_wash() {
debug_print
wash -h 2>&1 | grep "\-j" > /dev/null
return $?
}
#Check if wash has dual scan option
function check_dual_scan_on_wash() {
debug_print
wash -h 2>&1 | grep "2ghz" > /dev/null
return $?
}
#Perform wash scan using -j (json) option to gather needed data
function wash_json_scan() {
debug_print
tmpfiles_toclean=1
rm -rf "${tmpdir}wps_json_data.txt" > /dev/null 2>&1
rm -rf "${tmpdir}wps_fifo" > /dev/null 2>&1
mkfifo "${tmpdir}wps_fifo"
wash_band_modifier=""
if [ "${wps_channel}" -gt 14 ]; then
if [ "${interface_supported_bands}" = "${band_24ghz}" ]; then
echo
language_strings "${language}" 515 "red"
language_strings "${language}" 115 "read"
return 1
else
wash_band_modifier="-5"
fi
fi
timeout -s SIGTERM 240 wash -i "${interface}" --scan -n 100 -j "${wash_band_modifier}" 2> /dev/null > "${tmpdir}wps_fifo" &
wash_json_pid=$!
tee "${tmpdir}wps_json_data.txt"< <(cat < "${tmpdir}wps_fifo") > /dev/null 2>&1 &
while true; do
sleep 5
wash_json_capture_alive=$(ps uax | awk '{print $2}' | grep -E "^${wash_json_pid}$" 2> /dev/null)
if [ -z "${wash_json_capture_alive}" ]; then
break
fi
if grep "${1}" "${tmpdir}wps_json_data.txt" > /dev/null; then
serial=$(grep "${1}" "${tmpdir}wps_json_data.txt" | awk -F '"wps_serial" : "' '{print $2}' | awk -F '"' '{print $1}' | sed 's/.*\(....\)/\1/' 2> /dev/null)
kill "${wash_json_capture_alive}" &> /dev/null
wait "${wash_json_capture_alive}" 2>/dev/null
break
fi
done
return 0
}
#Calculate pin based on Zhao Chunsheng algorithm (ComputePIN), step 1
function calculate_computepin_algorithm_step1() {
debug_print
hex_to_dec=$(printf '%d\n' 0x"${six_wpsbssid_last_digits_clean}") 2> /dev/null
computepin_pin=$((hex_to_dec % 10000000))
}
#Calculate pin based on Zhao Chunsheng algorithm (ComputePIN), step 2
function calculate_computepin_algorithm_step2() {
debug_print
computepin_pin=$(printf '%08d\n' $((10#${computepin_pin} * 10 + checksum_digit)))
}
#Calculate pin based on Stefan Viehböck algorithm (EasyBox)
function calculate_easybox_algorithm() {
debug_print
hex_to_dec=($(printf "%04d" "0x${four_wpsbssid_last_digits_clean}" | sed 's/.*\(....\)/\1/;s/./& /g'))
[[ ${four_wpsbssid_last_digits_clean} =~ ${four_wpsbssid_last_digits_clean//?/(.)} ]] && hexi=($(printf '%s\n' "${BASH_REMATCH[*]:1}"))
c1=$(printf "%d + %d + %d + %d" "${hex_to_dec[0]}" "${hex_to_dec[1]}" "0x${hexi[2]}" "0x${hexi[3]}")
c2=$(printf "%d + %d + %d + %d" "0x${hexi[0]}" "0x${hexi[1]}" "${hex_to_dec[2]}" "${hex_to_dec[3]}")
K1=$((c1 % 16))
K2=$((c2 % 16))
X1=$((K1 ^ hex_to_dec[3]))
X2=$((K1 ^ hex_to_dec[2]))
X3=$((K1 ^ hex_to_dec[1]))
Y1=$((K2 ^ 0x${hexi[1]}))
Y2=$((K2 ^ 0x${hexi[2]}))
Z1=$((0x${hexi[2]} ^ hex_to_dec[3]))
Z2=$((0x${hexi[3]} ^ hex_to_dec[2]))
easybox_pin=$(printf '%08d\n' "$((0x$X1$X2$Y1$Y2$Z1$Z2$X3))" | awk '{for(i=length; i!=0; i--) x=x substr($0, i, 1);} END {print x}' | cut -c -7 | awk '{for(i=length; i!=0; i--) x=x substr($0, i, 1);} END {print x}')
}
#Calculate pin based on Arcadyan algorithm
function calculate_arcadyan_algorithm() {