Linux Commands Examples

A great documentation place for Linux commands


a 802.11 WEP / WPA-PSK key cracker

see also : airbase-ng - airdecap-ng - airdecloak-ng - airdriver-ng - aireplay-ng - airmon-ng - airodump-ng - airolib-ng - airserv-ng - airtun-ng - buddy-ng - easside-ng - ivstools - kstats - makeivs-ng - packetforge-ng - tkiptun-ng - wesside-ng


aircrack-ng [options] <.cap / .ivs file(s)>

add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!


echo "Error: No target set!"
exit 1
aircrack-ng -b $BSSID /tmp/airodump*.cap

Reaver keeps reapeating the same PIN

The router you're cracking needs to have a relatively strong signal, so if you're hardly in range of a router, you'll likely experience problems, and Reaver may not work.


How to know my wireless card has injection enabled? would appear that your card is in "managed mode".In order to perform the test you will first have to put your card in "monitor" mode ...just search the internet.hope this help.


Removing wlan0mon created by Kismet

If your wireless card runs a netlink compatibile driver (eg. based on the standard mac80211 stack), you can use the following command to delete the interface:

    iw dev wlan0mon del

See iw help output for more info on creating/deleting VIFs:


    dev <devname> interface add <name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*]
    phy <phyname> interface add <name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*]
            Add a new virtual interface with the given configuration.
            Valid interface types are: managed, ibss, monitor, mesh, wds.

            The flags are only used for monitor interfaces, valid flags are:
            none:     no special flags
            fcsfail:  show frames with FCS errors
            control:  show control frames
            otherbss: show frames from other BSSes
            cook:     use cooked mode

            The mesh_id is used only for mesh mode.

    dev <devname> del
            Remove this virtual interface



Aircrack-ng, is it illegal?

I wouldnt say it is illegal, its grey zone, but as long as you are only using it for educational purposes and on your own networks you are in the clear.

As in make sure you dont get caught breaking into other peoples networks.
It does give a very good insight into how insecure wireless connections are.

If you need something to help you alog a bit try Grimwepa and Wifite


-1 fixed channel on mon0 in aircrack

This is a compatibility issue between mac80211 kernel subsystem and aircrack-ng. It landed in mainline linux kernel 2.6.35 and appears to have been there ever since (writing this on kernel 3.1).

There's two workarounds. You can either patch aircrack-ng or wifi drivers. I prefer the latter since it's very simple and, as a side-effect, gives you most recent drivers.

Here's the recipe:

# we need kernel headers and a toolchain to build wifi drivers 
sudo apt-get install build-essentials linux-headers-2.6.38-12-generic

# download current wireless driver source tree

# uncompress
tar xjf compat-wireless-2.6.tar.bz2

# download patch that fixes the problem

# apply patch
cd compat-wireless-20*
patch -p1 < ../channel-negative-one-maxim.patch

# compile and install
sudo make install

# follow simple instructions to reload the drivers without reboot. Eg:
sudo make unload
sudo modprobe ath5k

For some background see here:


Is madwifi-ng driver better for cracking?

I'm going to assume you're using this for internal penetration/security testing, and not doing illegal things like breaking into others' networks.

In terms of 'better', it usually just boils down to whether a particular driver can do injection or not. If the native driver can inject with your card, then it's sufficient. If it can't, then try the madwifi-ng driver. If that driver can't either, then it doesn't really matter which you use, assuming both can monitor all frames being sent wirelessly. If the native driver won't even let you put the card into promiscuous mode, then try the madwifi-ng.

In any case, if you can't use injection, then you will not be able to fully test your network and you should purchase an Atheros or other model USB card which is fully supported by its drivers.


aircrack-ng is an 802.11 WEP and WPA/WPA2-PSK key cracking program.
It can recover the WEP key once enough encrypted packets have been captured with airodump-ng. This part of the aircrack-ng suite determines the WEP key using two fundamental methods. The first method is via the PTW approach (Pyshkin, Tews, Weinmann). The main advantage of the PTW approach is that very few data packets are required to crack the WEP key. The second method is the FMS/KoreK method. The FMS/KoreK method incorporates various statistical attacks to discover the WEP key and uses these in combination with brute forcing.
Additionally, the program offers a dictionary method for determining the WEP key. For cracking WPA/WPA2 pre-shared keys, a wordlist (file or stdin) or an airolib-ng has to be used.


-H, --help

Shows the help screen.

Common options:
-a <amode>

Force the attack mode, 1 or wep for WEP and 2 or wpa for WPA-PSK.

-e <essid>

Select the target network based on the ESSID. This option is also required for WPA cracking if the SSID is cloacked. For SSID containing special characters, see

-b <bssid>

Select the target network based on the access point MAC address.

-p <nbcpu>

Set this option to the number of CPUs to use (only available on SMP systems). By default, it uses all available CPUs


If set, no status information is displayed.

-C <macs>

Merges all those APs MAC (separated by a comma) into a virtual one.

-l <file>

Write the key into a file.

Static WEP cracking options:


Search alpha-numeric characters only.


Search binary coded decimal characters only.


Search the numeric key for Fritz!BOX

-d <mask>

Specify mask of the key. For example: A1:XX:CF

-m <maddr>

Only keep the IVs coming from packets that match this MAC address. Alternatively, use -m ff:ff:ff:ff:ff:ff to use all and every IVs, regardless of the network (this disables ESSID and BSSID filtering).

-n <nbits>

Specify the length of the key: 64 for 40-bit WEP, 128 for 104-bit WEP, etc., until 512 bits of length. The default value is 128.

-i <index>

Only keep the IVs that have this key index (1 to 4). The default behaviour is to ignore the key index in the packet, and use the IV regardless.

-f <fudge>

By default, this parameter is set to 2. Use a higher value to increase the bruteforce level: cracking will take more time, but with a higher likelihood of success.

-k <korek>

There are 17 KoreK attacks. Sometimes one attack creates a huge false positive that prevents the key from being found, even with lots of IVs. Try -k 1, -k 2, ... -k 17 to disable each attack selectively.

-x or -x0

Disable last keybytes bruteforce (not advised).


Enable last keybyte bruteforcing (default)


Enable last two keybytes bruteforcing.


Disable bruteforce multithreading (SMP only).


Shows ASCII version of the key at the right of the screen.


This is an experimental single brute-force attack which should only be used when the standard attack mode fails with more than one million IVs.


Uses PTW (Andrei Pyshkin, Erik Tews and Ralf-Philipp Weinmann) attack (default attack).

-P <num>

PTW debug: 1 Disable klein, 2 PTW.


Use KoreK attacks instead of PTW.


WEP decloak mode.


Run only 1 try to crack key with PTW.

-M <num>

Specify maximum number of IVs to use.

WPA-PSK cracking options:
-w <words>

Path to a dictionary file for wpa cracking. Specify "-" to use stdin. Here is a list of wordlists:

-r <database>

Path to the airolib-ng database. Cannot be used with ’-w’.

see also



This manual page was written by Adam Cecile <> for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 or any later version published by the Free Software Foundation On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL.

How can this site be more helpful to YOU ?

give  feedback