Table of Contents

Airolib-ng

Description

Airolib-ng is an aircrack-ng suite tool designed to store and manage essid and password lists, compute their Pairwise Master Keys (PMKs) and use them in WPA/WPA2 cracking. The program uses the lightweight SQLite3 database as the storage mechanism which is available on most platforms. The SQLite3 database was selected taking in consideration platform availability plus management, memory and disk overhead.

WPA/WPA2 cracking involves calculating the pairwise master key, from which the private transient key (PTK) is derived. Using the PTK, we can compute the frame message identity code (MIC) for a given packet and will potentially find the MIC to be identical to the packet's thus the PTK was correct therefore the PMK was correct as well.

Calculating the PMK is very slow since it uses the pbkdf2 algorithm. Yet the PMK is always the same for a given ESSID and password combination. This allows us to pre-compute the PMK for given combinations and speed up cracking the wpa/wpa2 handshake. Tests have shown that using this technique in aircrack-ng can check more than 50 000 passwords per second using pre-computed PMK tables.

Computing the PMK is still required, yet we can:

To learn more about WPA/WPA2:

To learn more about coWPAtty:

As stated above, this program requires the SQLite3 database environment. You must be running version 3.3.17 or above. You may obtain the latest version from the SQLite download page.

Usage

Usage: airolib <database> <operation> [options]

Where:

Here are the valid operations:

Usage Examples

Here are usage examples for each operation.

Status Operation

Enter:

 airolib-ng testdb --stats

Where:

The system responds:

 statsThere are 2 ESSIDs and 232 passwords in the database. 464 out of 464 possible combinations have been computed (100%).
 
 ESSID   Priority        Done
 Harkonen        64      100.0
 teddy   64      100.0

SQL Operation

The following example will give the SSID “VeryImportantESSID” maximum priority.

Enter:

 airolib-ng testdb --sql 'update essid set prio=(select min(prio)-1 from essid) where essid="VeryImportantESSID";'

The system responds:

 update essid set prio=(select min(prio)-1 from essid) where essid="VeryImportantESSID";
 Query done. 1 rows affected.

The following example will look for very important patterns in the pmk.

Enter:

 airolib-ng testdb --sql 'select hex(pmk) from pmk where hex(pmk) like "%DEADBEEF%"'

The system responds:

 hex(pmk) BF3F122D3CE9ED6C6E7E1D7D13505E0A41EC4C5A3DEADBEEFFEFF597387AFCE3

Clean Operation

To do a basic cleaning, enter:

 airolib-ng testdb --clean

The system responds:

 cleanDeleting invalid ESSIDs and passwords...
 Deleting unreferenced PMKs...
 Analysing index structure...
 Done.

To do a basic cleaning, reduce the file size if possible and run an integrity check., enter:

 airolib-ng testdb --clean all

The system responds:

 cleanDeleting invalid ESSIDs and passwords...
 Deleting unreferenced PMKs...
 Analysing index structure...
 Vacuum-cleaning the database. This could take a while...
 Checking database integrity...
 integrity_check
 ok
 Query done. 2 rows affected.
 Done.

Batch Operation

Enter:

 airolib-ng testdb --batch

The system responds:

 Computed 464 PMK in 10 seconds (46 PMK/s, 0 in buffer). No free ESSID found. Will try determining new ESSID in 5 minutes...

Verify Operation

To verify a 1000 random PMKs, enter:

 airolib-ng testdb --verify

The system responds:

 verifyChecking ~10.000 randomly chosen PMKs...
 ESSID   CHECKED STATUS
 Harkonen        233     OK
 teddy   233     OK

To verify all PMKs, enter:

 airolib-ng testdb --verify all

The system responds:

 verifyChecking all PMKs. This could take a while...
 ESSID   PASSWORD        PMK_DB  CORRECT

Cowpatty table Export Operation

Enter:

 airolib-ng testdb --export cowpatty test cowexportoftest

The system responds:

 exportExporting...
 Done.

Import Operation

SSID

To import an ascii list of SSIDs and create the database if it does not exist, enter:

 airolib-ng testdb --import essid ssidlist.txt

Where:

The system responds:

 importReading...
 Writing...
 Done.

Passwords

To import an ascii list of passwords and create the database if it does not exist, enter:

 airolib-ng testdb --import passwd password.lst

Where:

The system responds:

 importReading...
 Writing... read, 1814 invalid lines ignored.
 Done.

Cowpatty tables

Imports a cowpatty table and create the database if it does not exist, enter:

 airolib-ng testdb --import cowpatty  cowexportoftest

Where:

The system responds:

 importReading header...
 Reading...
 Updating references...
 Writing...

Aircrack-ng Usage Example

The ultimate objective is to speed up WPA/WPA2 cracking under aircrack-ng. To use the tables you have built using airolib-ng then use the “-r” option to specify the database containing the pre-calculated PMKs.

Enter:

 aircrack-ng  -r testdb  wpa2.eapol.cap

Where:

Note: All the other standard options which are applicable to WPA/WPA2 may also be used. This is a very limited example.

Usage Tips

Creating your own database example

To test the tool yourself…

 Database <testdb> does not already exist, creating it...
 Database <testdb> sucessfully created
 Reading file...
 Writing...
 Done.
 Reading file...
 Writing...
 Done.
 Computed 1 PMK in 0 seconds (1 PMK/s, 0 in buffer). All ESSID processed.
 There are 1 ESSIDs and 1 passwords in the database. 1 out of 1 possible combinations have been computed (100%).
 
 ESSID   Priority        Done
 Harkonen        64      100.0
 KEY FOUND! [ 12345678 ]

Using a sample pre-made database

Another way to test for yourself is to download a pre-made database called passphrases.db. This file is also located in the test directory of the aircrack-ng sources. Then try this database with the two test WPA/WPA2 files supplied in the test directory of the aircrack-ng sources. The WPA/WPA2 test files are called “wpa.cap” and “wpa2.eapol.cap”.

The commands are either of:

 aircrack-ng -r passphrases.db wpa.cap
 aircrack-ng -r passphrases.db wpa2.eapol.cap

This should give you the passphase. Success indicates that your setup is working correctly.

Usage Troubleshooting

Enabling Airolib-ng

Airolib-ng is not compiled by default. To enable compiling, do “make sqlite=true” and “make sqlite=true install”.

Compile Error

Although this is not a usage troubleshooting tip, it is a common problem during the compilation of the 1.0dev version. As a reminder, SQLite must be version 3.3.13 or above. This is the compile error you receive when your version of SQLite is less then the requirement:

gcc -g -W -Wall -Werror -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=`../evalrev` -I/usr/local/include -Iinclude -DHAVE_SQLITE   -c -o airolib-ng.o airolib-ng.c
airolib-ng.c: In function `sql_prepare':
airolib-ng.c:129: warning: implicit declaration of function `sqlite3_prepare_v2'
make[1]: *** [airolib-ng.o] Error 1
make[1]: Leaving directory `/root/1.0-dev/src'
make: *** [all] Error 2

When is the SQLite patch needed?

The SQLite patch included with aircrack-ng sources is only needed when compiling under Windows. It is required to remove some elements which will not compile under windows and are not required.

It is not required for linux installations.

Airolib-ng fails to open or create the database

On windows only, opening/creating a database doesn't work when airolib-ng is in directories containing special characters like 'ç', 'é', 'è', 'à', … (directories containing spaces are not affected).

The solution is to move airolib-ng and its database in another directory without these special characters.

"invalid lines ignored" error message

This error message may occur when importing passwords or ESSIDs. It is the number of records with invalid passwords or ESSIDs lengths. The valid lengths are:

"Quitting aircrack-ng..." error message

If you subsequently run aircrack-ng and only receive “Quitting aircrack-ng…” then the ESSID is missing from the database. You need to load it plus rerun the batch option.