Cracking wpa passwords with pyrit using AWS

Lot’s of people uses pyrit to crack wireless passworkds and don’t have a decent display card in home(GPU),  but some of them might want to crack WPA2 encryption with a nice speed.

So here I come up with this idea: I can go to Amazon and brought a ec2 with GPU acceleration an hour for about 1dollar. ( you will be completely free if you haven’t used amazon’s service before. ). Therefore I don’t need to use a lot of money to buy a costly Nvidia card for only one shot.

There’s pros and cons though. Pros are already listed above, cons are configuring ec2 into a cracking machine is really not easy. Especially we need to use the GPU capability.

So let’s get started.

Generally speaking, we have the following things to do.

  • Prepare EC2 environment
  • Install the Nvidia driver
  • Install Cuda
  • Install dependencies
  • Install Scapy
  • Install Pyrit
  • Install cpyrit-cuda
  • Trouble shooting

All the command you need to execute will be highlighted by blue color like this: ‘command

Prepare EC2 environment

In this whole tutorial, I assume you’ve created an EC2 machine installed Amazon Linux 64 Bit with a external IP address. And I will also assume that your EC2 machine has access to the Internet.

I strongly recommend you to buy the instance with 8 cpu cores and 1 gpu core ( Pyrit benchmark can up to approximately 25000/sec with 550/cpu•sec 20000/gpu•sec ).  If you need to be more faster you can choose 32 cup cores and 1 gpu core ( Pyrit benchmark approximately up to 40000/sec with the same rate above ).

So first you need to login to your server and update your ‘yum sources’ by executing the command ‘yum update‘ .

The second step is to install developmental tools which will be used in nvidia driver installation. Yum got a very fantastic method call groupinstall that will install a specific bunch of software with just one command, in this case we need to execute: ‘yum groupinstall -y “Development tools”‘ (type with quotes) (A little bit hint here: ‘-y’ parameter stands for assuming yes for every interactive question. )

Here comes with the third step: install the Linux kernel sources. We do this because during the driver compilation Linux’s kernel sources plays a very important part( as part of the sources ). So just type in ‘yum install kernel-devel-$(uname -r)

Till now, all of the preparation work are done.

 

Install Nvidia driver

This is the most difficult part, I spent three hours till I find the correct way, hope you won’t walk the same path. If you met errors please go to the <trouble shooting> below. If you met some troubles I didn’t mention, please let me know in the comment section.

Let’s get started.

First you need to determine which graphics card you’re using. You can check on it here: Amazon document

Only G2 instance is still on the stock and it is using GRID K520 from Nvidia ( Last check: 4/24/2016 )

You need to check the document before proceeding because every steps below is only adapted to GRID K520. 

Next you need to go to nvidia website to download the driver installation script. ( Nvidia searching page )

THIS IS FOR ONLY GRID K520-http://us.download.nvidia.com/XFree86/Linux-x86_64/361.42/NVIDIA-Linux-x86_64-361.42.run

You can download this using ‘wget http://us.download.nvidia.com/XFree86/Linux-x86_64/361.42/NVIDIA-Linux-x86_64-361.42.run‘.
Then you need to change the permission of the file to get it runnable – ‘chmod +x *.run

Now run the script – ‘./*.run

You’ll be asked to answer a few questions just remember some key points.

  1. Keep the installation ( you might be told the environment is not good )
  2. Remember to install the 32 bit driver too. ( the url upper is a 64 bit driver but it has already included 32’s version too. And you need to install it too.
  3. And you’ll be asked to choose one between ‘configure Xorg’ or not to. Remember choose you need to configure.
  4. Installation path and et cetera you shouldn’t change it ( if you’re not a pro )

You should not receive any kinds of error sign ( if you do check the troubleshooting )

You don’t need to reboot the system after installation of the driver. 

Install Cuda

Now all of the nvidia drivers are set, but pyrit still can not use them yet, because it need a library to control GPU and that is Cuda.

Cuda is one of the nvidia products, so it maybe only worked with Nvidia( I haven’t tried to let it work with other kinds of graphical cards yet )

You can get cuda’s installation package in Nvidia’s official website too.

The following version works pretty well with cpyrit listed below ( I highly recommend you to use both my recommended version of softwares ).

http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run

You need to run this script by modifying its permission first using the same command as installing the driver did.

During the whole installation process you might be asked following questions.

  1. The path for the install process ( you don’t have to type anything, instead, you can just type enter to continue which stands for using the default values.
  2. Need programming examples or not ( optional, it doesn’t matter, you can choose freely )
  3. You might also be prompted that current environment is not be recommended to proceed ( just continue, it won’t break anything bro.^_^ )

If you haven’t received any kinds of errors then, congratulations, the most difficult part has been completed.

 

Install dependent package

In this part, you don’t need to answer anything, just go and get cup of coffee and watch the jumping of characters.

Just execute the following command: ‘yum -y install python-devel zlib-devel openssl-devel libpcap-devel.x86_64 subversion screen glibc-devel automake autoconf gcc-c++‘ ( It might be a little bit too long, you can install them seperately if you want and know how to do it ).

Install Scapy

First download the scapy package: ‘wget http://www.secdev.org/projects/scapy/files/scapy-latest.tar.gz

Then install it:

tar -xzf scapy-latest.tar.gz
cd scapy-2.1.0
python setup.py build
python setup.py install

It won’t have many problems during this procedure.

Install Pyrit & CPyrit

This is the most exciting part~~! Because we’re going to get pyrit work completely!

1. download the pyrit package first too. – ‘wget http://pyrit.googlecode.com/files/pyrit-0.4.0.tar.gz
2. Decompress the archive: ‘tar xvzf pyrit-0.4.0.tar.gz

3. descend into pyrit’s directory for compilation and installation

– ‘cd pyrit-0.4.0’

– ‘python setup.py build’ [ Compile pyrit ]

– ‘python setup.py’ install’ [ Install and link it to /usr/bin ]

Tada!, pyrit should work properly now, but remember one thing: use pyrit by just typing pyrit in your command window instead descend into pyrit’s directory and type ./pyrit, otherwise you’ll get bunch of errors.

Then, let’s install cpyrit to provide pyrit with Cuda support.

( Almost the same process and the same command )

– ‘wget http://pyrit.googlecode.com/files/cpyrit-cuda-0.4.0.tar.gz
– ‘tar xvzf cpyrit-cuda-0.4.0.tar.gz
– ‘cd cpyrit-cuda-0.4.0
– ‘python setup.py build
– ‘python setup.py install

Now, your pyrit should be working completely great with GPU acceleration.

Here I highly recommend you the tiny tool ‘crunch‘ which can generate the dictionary with proper combination of provided character. crunch can work with the pipe symbol ‘|‘ like this way: ‘crunch 8 8 12345678 | pyrit -i – -r xxx.cap attack_passthough

If you still have some problems, try leaving a comment in the comment zone, thanks!

6 Comments

  1. dzz007 (Post author)

    Please leave a comment in here if you need.

    Reply
  2. Steve Zepp

    Nice write-up and thanks for the advice regarding the NVIDIA drivers. I’m sure this will save me a lot of time.
    One question…maybe I’m missing something, but why is Scapy necessary? If I just want to pipe a huge list created by Crunch through Pyrit in order to crack a WPA2 handshake…why do we need Scapy?

    Reply
    1. dzz007 (Post author)

      Thanks for paying attention to my post. Scapy is just playing a component role for cpyrit-cuda here. In another words, cpyrit-cuda can’t work without it. For more details you can go and check the pages in googlecode(cpyrit-cuda).

      Reply
  3. Jonathan

    Hello,
    It seems the page you have used for the nVidia drivers isn’t up anymore. At least, the Amazon VM doesn’t get any file from there. It shows an 404 error. I tried going manually to the nVidia page to search for the drivers, but there is none compatible with Amazon Linux nor Linux (at least not the one you said to use). Is there anything else to do?

    Reply
  4. be3n

    have you taken a go at the new P2 instances? bigger iron, but i cannot seem to get the gains on the 8x and 16x models. I can pull 40k-50k PMKs per second from a single Tesla K80, but when i run 8 in a box, i cannot crack 170k. thoughts?

    Reply

Leave a Comment

Your email address will not be published. Required fields are marked *