December 7, 2021

Enable monitor mode in linux without disconnecting Wi-Fi

 To hack a Wi-Fi network using Linux, you need a wireless card which support monitor mode and packet injction. To carry out these attacks, we need to connect an external wifi adapter that supports monitor mode, but if we want to use the Internet, the adapter disconnects from the wifi network and enters monitor mode. So, if we want internet connectivity, we need to connect another Wi-Fi adapter. So, to overcome this problem, there is a solution that helps you to use Wi-Fi connectivity and packet injection at the same time using only one adapter. So follow these steps to use the same adapter for both purposes at the same time.


  • Steps -

1) Open terminal and open nano editor


 nano

2) Now paste this code in editor


#!/bin/bash
echo "## Enabling monitor mode on mon0 ##"
echo
sudo iw phy phy0 interface add mon0 type monitor && sudo ifconfig mon0 up
echo "## mon0 should be up:"
sudo ip link show dev mon0

3) Now press 'Ctrl + X' and 'Y' and give filename as 'mon0up'



4) Again, open nano editor and paste this code


#!/bin/bash
echo "## Shutting down monitor mode on mon0 ##"
echo
sudo ifconfig mon0 down && sudo iw dev mon0 del
echo "## mon0 should no longer exist:" 
sudo ip link show dev mon0

5) Now press 'Ctrl + X' and 'Y' and give filename as 'mon0down'



6) We have two files mon0up and mon0down. Now we need to give execution permission to these files. So run these commands one by one -


$ sudo chmod +x mon0up
$ sudo chmod +x mon0down

7) Now copy these files to /usr/local/bin


$ sudo cp mon0up /usr/local/bin/
$ sudo cp mon0down /usr/local/bin/

8) Now you can enable monitor mode by typing 'mon0up' and disable it by typing 'mon0down' without disconnecting internet connectivity. To check mon0 interface, run 'iwconfig' command. You will get this output -

9) Now to crack wifi network, you need to use 'mon0' interface instead of 'wlan0mon' or any other else. Just like this -

$ sudo airodump-ng mon0

 

That's it ! If you have any issue regarding this, please leasve a comment.


Also read -

How to do phishing attack in termux using socialfish

How to do rouge AP attack using wifipumpkin3