Saturday, June 18, 2011

Patch, Compile, and Installing coWPAtty 4.6 on Ubuntu

Cowpatty is a great tool for cracking WPA/WPA2 keys via either a dictionary attack or via rainbow tables. All it needs to see it a client connect to the network (this is called a "handshake"). However cowpatty isn't perfect and has a problem with reading handshakes incorrectly. After looking into this I found a way to install it with the patch on my Ubuntu box.

First we need to download the required files. If you already have them you can skip them.

sudo apt-get install build-essential
sudo apt-get install libssl-dev
sudo apt-get install libpcap0.8-dev
sudo apt-get install libdigest-hmac-perl

Next Download cowpatty 4.6

md5sum cowpatty-4.6.tgz

you should get b90fd36ad987c99e7cc1d2a05a565cbd as the MD5 sum. If so, extract and move into the directory using the following

tar -xvf cowpatty-4.6.tgz
cd cowpatty-4.6

Next we need to download the patch and patch the source code.

patch < cowpatty-4.6-fixup16.patch

Next we will compile and install it and then test it

sudo make install
cd ..

If all goes well you should see the cowpatty help menu:

cowpatty 4.6 - WPA-PSK dictionary attack.
cowpatty: Must supply a pcap file with -r

Usage: cowpatty [options]

-f Dictionary file
-d Hash file (genpmk)
-r Packet capture file
-s Network SSID (enclose in quotes if SSID includes spaces)
-c Check for valid 4-way frames, does not crack
-h Print this help information and exit
-v Print verbose information (more -v for more verbosity)
-V Print program version and exit

Now if you're as lazy as me. Here's everything together to work as a script

echo -e "\n \e[1;31m[*] Installing build-essential\e[0m"
sudo apt-get -y install build-essential
echo -e "\n \e[1;34m[*] Installing libssl-dev\e[0m"
sudo apt-get -y install libssl-dev
echo -e "\n \e[1;34m[*] Installing libpcap0.8-dev\e[0m"
sudo apt-get -y install libpcap0.8-dev
echo -e "\n \e[1;34m[*] Installing libdigest-hmac-perl\e[0m"
sudo apt-get -y install libdigest-hmac-perl
echo -e "\n \e[1;34m[*] Downloading cowpatty-4.6.tgz\e[0m"
md5sum cowpatty-4.6.tgz
echo "\e[1;34mMD5 SHOULD BE b90fd36ad987c99e7cc1d2a05a565cbd\e[0m"
echo -e "\n \e[1;34m[*] Extracting cowpatty-4.6.tgz\e[0m"
tar -xvf cowpatty-4.6.tgz > /dev/null
cd cowpatty-4.6 > /dev/null
echo -e "\n \e[1;34m[*] Downloading Cowpatty Patch\e[0m"
echo -e "\n \e[1;34m[*] Patching Cowpatty code"
patch < cowpatty-4.6-fixup16.patch
echo -e "\n \e[1;34m[*] Compiling Cowpatty\e[0m"
echo -e "\n \e[1;34m[*] Installing cowpatty to system\e[0m"
sudo make install
echo -e "\n \e[1;34m[*] Removing Cowpatty Directory\e[0m"
cd .. > /dev/null
rm -r -f cowpatty-4.6 > /dev/null
echo -e "\n \e[1;34m[*] Removing cowpatty-4.6.tgz\e[0m"
rm cowpatty-4.6.tgz > /dev/null
echo -e "\n \e[1;34m[*] testing to see if cowpatty works\e[0m"
echo -e "\n \e[1;34m[*] Done!\e[0m"

Links: - Get coWPAtty here - Patch to fix several issues with cowpatty - A place to get 33GB of Rainbow tables for free download.