|
2 | 2 | #Title........: airgeddon.sh
|
3 | 3 | #Description..: This is a multi-use bash script for Linux systems to audit wireless networks.
|
4 | 4 | #Author.......: v1s1t0r
|
5 |
| -#Date.........: 20170505 |
6 |
| -#Version......: 7.0 |
| 5 | +#Date.........: 20170508 |
| 6 | +#Version......: 7.01 |
7 | 7 | #Usage........: bash airgeddon.sh
|
8 | 8 | #Bash Version.: 4.2 or later
|
9 | 9 |
|
@@ -106,8 +106,8 @@ declare -A possible_alias_names=(
|
106 | 106 | )
|
107 | 107 |
|
108 | 108 | #General vars
|
109 |
| -airgeddon_version="7.0" |
110 |
| -language_strings_expected_version="7.0-1" |
| 109 | +airgeddon_version="7.01" |
| 110 | +language_strings_expected_version="7.01-1" |
111 | 111 | standardhandshake_filename="handshake-01.cap"
|
112 | 112 | tmpdir="/tmp/"
|
113 | 113 | osversionfile_dir="/etc/"
|
@@ -751,7 +751,7 @@ function calculate_easybox_algorithm() {
|
751 | 751 | Z1=$((0x${hexi[2]} ^ hex_to_dec[3]))
|
752 | 752 | Z2=$((0x${hexi[3]} ^ hex_to_dec[2]))
|
753 | 753 |
|
754 |
| - easybox_pin=$(printf '%08d\n' "$((0x$X1$X2$Y1$Y2$Z1$Z2$X3))" | rev | cut -c -7 | rev) |
| 754 | + 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}') |
755 | 755 | }
|
756 | 756 |
|
757 | 757 | #Calculate the last digit on pin following the checksum rule
|
@@ -874,7 +874,7 @@ function prepare_et_interface() {
|
874 | 874 | et_initial_state=${ifacemode}
|
875 | 875 |
|
876 | 876 | if [ "${ifacemode}" != "Managed" ]; then
|
877 |
| - new_interface=$(${airmon} stop "${interface}" 2> /dev/null | grep station) |
| 877 | + new_interface=$(${airmon} stop "${interface}" 2> /dev/null | grep station | head -n 1) |
878 | 878 | ifacemode="Managed"
|
879 | 879 | [[ ${new_interface} =~ \]?([A-Za-z0-9]+)\)?$ ]] && new_interface="${BASH_REMATCH[1]}"
|
880 | 880 | if [ "${interface}" != "${new_interface}" ]; then
|
@@ -909,6 +909,14 @@ function restore_et_interface() {
|
909 | 909 | ifacemode="Managed"
|
910 | 910 | else
|
911 | 911 | new_interface=$(${airmon} start "${interface}" 2> /dev/null | grep monitor)
|
| 912 | + desired_interface_name="" |
| 913 | + [[ ${new_interface} =~ ^You[[:space:]]already[[:space:]]have[[:space:]]a[[:space:]]([A-Za-z0-9]+)[[:space:]]device ]] && desired_interface_name="${BASH_REMATCH[1]}" |
| 914 | + if [ -n "${desired_interface_name}" ]; then |
| 915 | + echo |
| 916 | + language_strings "${language}" 435 "red" |
| 917 | + language_strings "${language}" 115 "read" |
| 918 | + return |
| 919 | + fi |
912 | 920 | ifacemode="Monitor"
|
913 | 921 | [[ ${new_interface} =~ \]?([A-Za-z0-9]+)\)?$ ]] && new_interface="${BASH_REMATCH[1]}"
|
914 | 922 | if [ "${interface}" != "${new_interface}" ]; then
|
@@ -943,7 +951,7 @@ function managed_option() {
|
943 | 951 | language_strings "${language}" 17 "blue"
|
944 | 952 | ifconfig "${interface}" up
|
945 | 953 |
|
946 |
| - new_interface=$(${airmon} stop "${interface}" 2> /dev/null | grep station) |
| 954 | + new_interface=$(${airmon} stop "${interface}" 2> /dev/null | grep station | head -n 1) |
947 | 955 | ifacemode="Managed"
|
948 | 956 | [[ ${new_interface} =~ \]?([A-Za-z0-9]+)\)?$ ]] && new_interface="${BASH_REMATCH[1]}"
|
949 | 957 |
|
@@ -993,6 +1001,16 @@ function monitor_option() {
|
993 | 1001 | fi
|
994 | 1002 |
|
995 | 1003 | new_interface=$(${airmon} start "${interface}" 2> /dev/null | grep monitor)
|
| 1004 | + |
| 1005 | + desired_interface_name="" |
| 1006 | + [[ ${new_interface} =~ ^You[[:space:]]already[[:space:]]have[[:space:]]a[[:space:]]([A-Za-z0-9]+)[[:space:]]device ]] && desired_interface_name="${BASH_REMATCH[1]}" |
| 1007 | + if [ -n "${desired_interface_name}" ]; then |
| 1008 | + echo |
| 1009 | + language_strings "${language}" 435 "red" |
| 1010 | + language_strings "${language}" 115 "read" |
| 1011 | + return |
| 1012 | + fi |
| 1013 | + |
996 | 1014 | ifacemode="Monitor"
|
997 | 1015 | [[ ${new_interface} =~ \]?([A-Za-z0-9]+)\)?$ ]] && new_interface="${BASH_REMATCH[1]}"
|
998 | 1016 |
|
@@ -2855,7 +2873,30 @@ function clean_routing_rules() {
|
2855 | 2873 | echo "${original_routing_state}" > /proc/sys/net/ipv4/ip_forward
|
2856 | 2874 | fi
|
2857 | 2875 |
|
2858 |
| - clean_iptables |
| 2876 | + if [ "${iptables_saved}" -eq 1 ]; then |
| 2877 | + restore_iptables |
| 2878 | + else |
| 2879 | + clean_iptables |
| 2880 | + fi |
| 2881 | +} |
| 2882 | + |
| 2883 | +#Save iptables rules |
| 2884 | +function save_iptables() { |
| 2885 | + |
| 2886 | + debug_print |
| 2887 | + |
| 2888 | + iptables-save > "${tmpdir}ag.iptables" 2> /dev/null |
| 2889 | + if [ "$?" = "0" ]; then |
| 2890 | + iptables_saved=1 |
| 2891 | + fi |
| 2892 | +} |
| 2893 | + |
| 2894 | +#Restore iptables rules |
| 2895 | +function restore_iptables() { |
| 2896 | + |
| 2897 | + debug_print |
| 2898 | + |
| 2899 | + iptables-restore < "${tmpdir}ag.iptables" 2> /dev/null |
2859 | 2900 | }
|
2860 | 2901 |
|
2861 | 2902 | #Clean iptables rules
|
@@ -4705,9 +4746,13 @@ function set_std_internet_routing_rules() {
|
4705 | 4746 |
|
4706 | 4747 | debug_print
|
4707 | 4748 |
|
4708 |
| - routing_toclean=1 |
4709 |
| - original_routing_state=$(cat /proc/sys/net/ipv4/ip_forward) |
| 4749 | + if [ "${routing_modified}" -eq 0 ]; then |
| 4750 | + original_routing_state=$(cat /proc/sys/net/ipv4/ip_forward) |
| 4751 | + save_iptables |
| 4752 | + fi |
| 4753 | + |
4710 | 4754 | ifconfig "${interface}" ${et_ip_router} netmask ${std_c_mask} > /dev/null 2>&1
|
| 4755 | + routing_modified=1 |
4711 | 4756 |
|
4712 | 4757 | clean_iptables
|
4713 | 4758 |
|
@@ -7747,7 +7792,7 @@ function exit_script_option() {
|
7747 | 7792 | echo -e "${green_color} Ok\r${normal_color}"
|
7748 | 7793 | fi
|
7749 | 7794 |
|
7750 |
| - if [ ${routing_toclean} -eq 1 ]; then |
| 7795 | + if [ ${routing_modified} -eq 1 ]; then |
7751 | 7796 | action_on_exit_taken=1
|
7752 | 7797 | language_strings "${language}" 297 "multiline"
|
7753 | 7798 | clean_routing_rules
|
@@ -7793,7 +7838,7 @@ function hardcore_exit() {
|
7793 | 7838 | clean_tmpfiles
|
7794 | 7839 | fi
|
7795 | 7840 |
|
7796 |
| - if [ ${routing_toclean} -eq 1 ]; then |
| 7841 | + if [ ${routing_modified} -eq 1 ]; then |
7797 | 7842 | clean_routing_rules
|
7798 | 7843 | killall dhcpd > /dev/null 2>&1
|
7799 | 7844 | killall hostapd > /dev/null 2>&1
|
@@ -8318,7 +8363,9 @@ function check_if_kill_needed() {
|
8318 | 8363 |
|
8319 | 8364 | if [ "${nm_system_version}" != "" ]; then
|
8320 | 8365 |
|
8321 |
| - [[ ${nm_system_version} =~ ^([0-9]{1,2})\.([0-9]{1,2})\.([0-9]+).*?$ ]] && nm_main_system_version="${BASH_REMATCH[1]}" && nm_system_subversion="${BASH_REMATCH[2]}" && nm_system_subversion2="${BASH_REMATCH[3]}" |
| 8366 | + [[ ${nm_system_version} =~ ^([0-9]{1,2})\.([0-9]{1,2})\.?(([0-9]+)|.+)? ]] && nm_main_system_version="${BASH_REMATCH[1]}" && nm_system_subversion="${BASH_REMATCH[2]}" && nm_system_subversion2="${BASH_REMATCH[3]}" |
| 8367 | +
|
| 8368 | + [[ ${nm_system_subversion2} =~ [a-zA-Z] ]] && nm_system_subversion2="0" |
8322 | 8369 |
|
8323 | 8370 | if [ "${nm_main_system_version}" -lt ${nm_min_main_version} ]; then
|
8324 | 8371 | check_kill_needed=1
|
@@ -8654,7 +8701,8 @@ function initialize_script_settings() {
|
8654 | 8701 | airmon_fix
|
8655 | 8702 | autochanged_language=0
|
8656 | 8703 | tmpfiles_toclean=0
|
8657 |
| - routing_toclean=0 |
| 8704 | + routing_modified=0 |
| 8705 | + iptables_saved=0 |
8658 | 8706 | spoofed_mac=0
|
8659 | 8707 | mac_spoofing_desired=0
|
8660 | 8708 | dhcpd_path_changed=0
|
|
0 commit comments