Pyrit is one of the most useful security tool to crack WPA or WPA2-PSK passphrase, simply a powerful wi-fi password hacking tool.
Why it's crazy fast ? Because it uses the processing power of multicore CPU, SSE2 CPU extension, OennCL platform on Radeon GPUs, CUDA platform on NVDIA GPUs or the Padlock cryptographic accelator of VIA CPUs.
In this tutorial we are going to install and configure pyrit with CUDA to take the advantage of massive parallel processing power of the NVIDIA GPU. Here is the system configuration
- Hardware: CPU Intel Core i5 2410M, GPU NVIDIA GeForce GT 540M
- OS: Debian testing, currently stretch
- Kernel version: Linux 4.2.1-2
- NVIDIA driver version: 340.93
- CUDA toolkit version: 6.5.14-2
1. Install nvidia drivers and minimal cuda
CUDA is not supported with the opensource nouveau drivers, we have to install propitiatory nvidia drivers to get nvidia cuda working. If you have a NVIDIA Optimus system, check this detailed article about installing and configuring nvidia optimus in Debian/Kali Linux.
Installing nvidia drivers
Before installing anything, you must have to enable the non-free repository, to do so, put the line bellow in the
deb http://ftp.debian.org/debian/ stretch main contrib non-free
Change the word stretch according to your disrto, like if you are using the Kali Linux, replace the above line with suitable Kali Linux repository URL. If you are not sure what I’m talking about, have a look at there and check out how to add the non-free repository.
sudo apt-get update sudo apt-get install gcc make linux-headers-amd64 sudo apt-get install nvidia-kernel-dkms nvidia-xconfig nvidia-settings sudo apt-get install nvidia-vdpau-driver vdpau-va-driver mesa-utils
Install minimal cuda
After rebooting, Just run this command bellow, this will install a minimal version of CUDA, less packages and fast installation.
sudo apt-get --no-install-recomands install nvidia-cuda-toolkit
Link the cuda install directory to /usr/local, this is step is necessary,
sudo ln -s /usr/lib/nvidia-cuda-toolkit/ /usr/local/cuda
2. Install various development headers
Various development header files are necessay to compile pyrit from sorce, lets install them.
sudo apt-get install python2.7-dev libssl-dev zlib1g-dev libpcap-dev
3. Download latest pyrit and cpyrit-cuda
Pyrit is hosted on google code, Download it from there,
cd ~/ wget -c https://pyrit.googlecode.com/files/pyrit-0.4.0.tar.gz wget -c https://pyrit.googlecode.com/files/cpyrit-cuda-0.4.0.tar.gz
NOTE: It seems that pyrit development is stalled, and it is available as a read-only project at google code.
4. Compile and install pyrit
tar -xf pyrit-0.4.0.tar.gz cd cd pyrit-0.4.0/ python setup.py build sudo python setup.py install
These commands will bulid and install the pyrit, with CPU only support, lest test run pyrit
pyrit -help # prints a help message
This command should return a result something like bellow,
5. Compile and install cpyrit-cuda
Cpyrit-cuda is a pyrit extension, written in C and used as a loadable shared library. With this, pyrit tekes advantage of the NVIDIA GPU to significantly speed up the whole cracking processs. Lets install cpyrit cuda,
tar -xf cpyrit-cuda-0.4.0.tar.gz cd cpyrit-cuda-0.4.0/ python setup.py build sudo python setup.py install
installation is complete, now again test pyrit with cuda compatibility.
Alternetively if you have a laptop with nvidia optimus GPU like me, run this command
optirun pyrit lsit_cores
6. Pyrit CUDA benchmark testing
A benchmark test will clearly show the advange of GPU based cracking. The performance differance between GPU based and only CPU based cracking is surprising, lets check it out
optirun pyrit benchmark # for NVIDIA optimus systems
Compare the results with the previous CPU only benchmark, it was about 4.4 times faster than the CPU alone. My system got about 7340 PMKs/s with a NVIDIA GeForce GT540M GPU.
7. Few tips
I got some performance boost with pyrit if the system running a lightweight desktop environment like LXDE, LXQt or Openbox. It's simply because the CPU has to do less with a lightweight desktop.
After extensive bug reporting and bug fixing, now compiling and installing pyrit and cpyrit-cuda is really smooth and easy.
Both Debian and Kali Linux 2.0 don't complain about anything while compiling it. I faced no problem with a Debian testing system, if you have any problem/bug, please let me know, leave a comment here.
So that's it, the whole installation process is pretty straight forward. I hope this guide will help you, if you find this article useful, don't hesitate to share it with your friends.