Install pyrit in Kali Linux/Debian with CUDA

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 non-free 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 /etc/apt/sources.list file

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
pyrit list_cores

This command should return a result something like bellow,

 

debian pyrit lsit_cores commandNow run a benchmark test, and save the results for future reference, my system got about 1660 PMKs/s with a Core i5 CPU.

pyrit benchmark

 

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.

pyrit list_cores

Alternetively if you have a laptop with nvidia optimus GPU like me, run this command

optirun pyrit lsit_cores

pyrit cuda list cores
These command should return a result with a recognized cuda capable device.

 

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

pyrit benchmark
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.

 

7. Troubleshooting

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.

 

58 Responses

  1. Suvajit says:

    Hey why don’t you make a youtube channel

    That is much better

  2. Aamer Shareef says:

    For anyone facing the issues with cpyrit cuda, follow these steps:
    uninstall pyrit: apt-get remove pyrit

    1. download the fresh stable release from
    https://github.com/JPaulMora/Pyrit/releases
    install the latest pyrit version
    2. change the config file
    nano ~/.pyrit/config
    3. enter this line at the end of the file
    use_CUDA = true
    save and exit
    run “optirun pyrit benchmark” and see your gfx card at its full potential ! 😀
    you dont need to install cpyrit cuda, the latest release makes it easier to use the CUDA cores if your nvidia card supports it.

    Hope this helps! 🙂

    Running kali linux – kernel 4.8
    note: do not use apt-get upgrade at the beginning of this tutorial ( you can upgrade later if you need, but it contains many unstable packages) if you are using the latest kali sana 2016.2.
    install the latest linux image, “apt-get install linux-image-4.8*”
    “apt-get install linux-headers-4.8*”
    and then proceed with the tutorial.
    If you have any issues with the bumblebeed service not starting at boot, type
    nano /etc/rc.local
    add “service bumblebeed start” before the “exit 0” line
    save and exit
    reboot and enjoy!

    • Arnab says:

      Thanks Aamer for your feedback, and your desire to share with people ! I too hope this helps others.

      • Aamer says:

        You are welcome Arnab. There still seems to be some issue with the method that I posted above. The work around would be to use the latest pyrit 0.5.1 from the Pyrit-Master branch in git. After performing a clean install ( using python setup.py clean and later building and installing ) and edit the config file as stated above. Go ahead and perform a clean install of cpyrit cuda (in the modules folder ). This should work. Tested on a fresh copy of kali sana on kernel 4.8.

        • Arnab says:

          Man ! Thanks again ! I’m lacking the time and disk space to test it myself, I’ll definitely do that within few days and will update this tutorial.

  3. Lumos says:

    “sudo apt-get install nvidia-kernel-dkms nvidia-xconfig nvidia-settings
    sudo apt-get install nvidia-vdpau-driver vdpau-va-driver mesa-utils”
    it crashed my Kali Linux(

Leave a Reply

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