In this guide, I will show how to install NVIDIA driver kernel Module CUDA, replace stock Pyrit, and install Cpyrit.At the end of this guide, you will be able to use GPU acceleration for enabled applications such as cudaHashcat, Pyrit, crunch etc.
This guide replaces the old guide
This is part 2 of installing NVIDIA driver kernel Module CUDA and Pyrit on Kali Linux Driver series which was divided into two parts:
- Install proprietary NVIDIA driver on Kali Linux – NVIDIA Accelerated Linux Graphics Driver
- Install NVIDIA driver kernel Module CUDA and Pyrit on Kali Linux – CUDA, Pyrit and Cpyrit-cuda
You use the first guide to install NVIDIA Driver on Kali Linux. I would assume you followed the first guide and completed all steps there and would like to enable GPU acceleration, (cudahashcat, GPU pass through etc.) on your Kali Linux.
Table of Contents
CUDA Toolkit
The NVIDIA® CUDA® Toolkit provides a comprehensive development environment for C and C++ developers building GPU-accelerated applications. The CUDA Toolkit includes a compiler for NVIDIA GPUs, math libraries, and tools for debugging and optimizing the performance of your applications. You’ll also find programming guides, user manuals, API reference, and other documentation to help you get started quickly accelerating your application with GPUs. You can read a lot more here in NVIDIA Developers official webpage:
Prerequisites
Following are the prerequisite before you start following this guide:
Prerequisite 1: add Official Kali Linux repository.
I’ve added the correct Kali Official repositories and issued the following commands to update, upgrade and dist-upgrade my Kali Linux.
apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y
Prerequisite 2: Install proprietary NVIDIA driver on Kali Linux
I’ve installed the correct official proprietary NVIDIA driver on Kali Linux – NVIDIA Accelerated Linux Graphics Driver using the previous guide:
If you’ve completed both, move to next instruction.
Step 1: Install NVIDIA CUDA toolkit and openCL
At first we need to install NVIDIA CUDA toolkit and NVIDIA openCL
aptitude install nvidia-cuda-toolkit nvidia-opencl-icd
This will install CUDA packages in your Kali Linux. The total package is pretty large including dependencies, (282MB something), you be patient and let it finish.
Step 2: Download Pyrit and Cpyrit
Download Pyrit and Cpyrit from the official website:
Save them in your /root
folder.
Step 3: Install Pyrit
Follow the instructions below to install Pyrit and it’s prerequisites.
Step 3.a: Install Pyrit prerequisites
apt-get install python2.7-dev python2.7-libpcap libpcap-dev
Step 3.b: Remove existing installation of Pyrit
Remove stock Pyrit using the following command:
apt-get remove pyrit
You get a message stating that it will also remove kali-linux-full
package. It actually doesn’t. All it does updating Kali repo and remove Pyrit. Finish removing Pyrit.
If you are not using a clean install of Kali (not recommended), you may need to issue the following command:
rm -r /usr/local/lib/python2.7/dist-packages/cpyrit/
Step 3.c: Install new Pyrit
Copy paste the following commands to extract downloaded Pyrit in your Kali Linux /root
directory
tar -xzf pyrit-0.4.0.tar.gz cd pyrit-0.4.0
Now build the package
python setup.py build
Once build is complete, you can install Pyrit.
python setup.py install
Up to this point, you shouldn’t receive any errors.
Step 4: Install CPyrit-cuda
Copy paste the following commands to extract downloaded CPyrit-cuda in your Kali Linux /root
directory
tar -xzf cpyrit-cuda-0.4.0.tar.gz cd cpyrit-cuda-0.4.0
Now build the package
python setup.py build
Once build is complete, you can install CPyrit-cuda.
python setup.py install
Again, you shouldn’t receive any errors, if there’s error, go back and review each steps.
Step 5: Testing and troubleshooting
Now that we’ve installed NVIDIA driver kernel Module CUDA and Pyrit on Kali Linux, we should be able to test it. The best way to test is by issuing the following command:
pyrit list_cores
This gave me an error “ bash: /usr/bin/pyrit: No such file or directory
“.
It seems this Pyrit puts its binaries in wrong folder than you’d expect. The actual path for Pyrit is now /usr/local/bin/pyrit
Step 5.a Softlink them or add path to profile
There’s two different ways you can resolve it. You can either softlink or add this /usr/local/bin/
path to your profile. Choice is again yours.
Step 5.a.i: Softlinking
ln -s /usr/local/bin/pyrit /usr/bin/pyrit
Step 5.a.ii: Add path
If you want only to specific user edit ~/.bash_profile
or ~/.bashrc
and put there
export PATH=$PATH:/usr/local/bin
If you want for all users edit /etc/profile and scroll down until you see something like
PATH="/bin:/usr/bin:/sbin:/usr/sbin" export PATH
Append to the end /usr/local/bin. it will be
PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin"
and Finally
Once you’ve either Softlinked or added the correct path to your profile, then following is what you get
root@kali:~# pyrit list_cores Pyrit 0.4.0 (C) 2008-2011 Lukas Lueg http://pyrit.googlecode.com This code is distributed under the GNU General Public License v3+ The following cores seem available... #1: 'CUDA-Device #1 'GeForce 210'' #2: 'CPU-Core (SSE2)' #3: 'CPU-Core (SSE2)' #4: 'CPU-Core (SSE2)'
and of course I did a benchmark with my GeForce 210 card:
root@kali:~# pyrit benchmark Pyrit 0.4.0 (C) 2008-2011 Lukas Lueg http://pyrit.googlecode.com This code is distributed under the GNU General Public License v3+ Running benchmark (2744.1 PMKs/s)... - Computed 2744.11 PMKs/s total. #1: 'CUDA-Device #1 'GeForce 210'': 853.1 PMKs/s (RTT 3.0) #2: 'CPU-Core (SSE2)': 648.1 PMKs/s (RTT 2.8) #3: 'CPU-Core (SSE2)': 647.6 PMKs/s (RTT 2.9) #4: 'CPU-Core (SSE2)': 658.5 PMKs/s (RTT 3.0) root@kali:~#
Conclusion
Pyrit allows to create massive databases, pre-computing part of the IEEE 802.11 WPA/WPA2-PSK authentication phase in a space-time-tradeoff. Exploiting the computational power of Many-Core- and other platforms through ATI-Stream, Nvidia CUDA and OpenCL, it is currently by far the most powerful attack against one of the world’s most used security-protocols.
Here’s a great benchmark done with Pyrit and CUDA for different GPU’s
Thanks for reading. If this guide helped you to install NVIDIA driver kernel Module CUDA and Pyrit on Kali Linux – CUDA, Pyrit and Cpyrit-cuda, please share this article and follow me in Facebook/Twitter.
ah and don’t forget to show off your Pyrit Benchmark. ;)
92 comments
Hi, thanks for the tutorial.. Worked perfectly.
Here is my benchmark
root@M0nst3r:~/cpyrit-cuda-0.4.0# pyrit benchmark
Pyrit 0.4.0 (C) 2008-2011 Lukas Lueg http://pyrit.googlecode.com
This code is distributed under the GNU General Public License v3+
Running benchmark (7862.9 PMKs/s)… /
Computed 7862.87 PMKs/s total.
#1: ‘CUDA-Device #1 ‘Quadro 600”: 5930.2 PMKs/s (RTT 2.8)
#2: ‘CPU-Core (SSE2)’: 394.2 PMKs/s (RTT 2.9)
#3: ‘CPU-Core (SSE2)’: 396.0 PMKs/s (RTT 2.9)
#4: ‘CPU-Core (SSE2)’: 389.3 PMKs/s (RTT 3.1)
#5: ‘CPU-Core (SSE2)’: 400.1 PMKs/s (RTT 3.1)
#6: ‘CPU-Core (SSE2)’: 410.6 PMKs/s (RTT 3.0)
#7: ‘CPU-Core (SSE2)’: 377.2 PMKs/s (RTT 3.0)
#8: ‘CPU-Core (SSE2)’: 404.7 PMKs/s (RTT 2.9)
Cheers
which GPU are you using ? I have GTX 970 but ur benchmark is alot higher than me… am I running with problems?
mine 5092.4 PMKs/s
For most recent information you have to go to see the web and on world-wide-web
I found this site as a best website for newest updates.
I installed pyrit and cpyrit this link: https://github.com/JPaulMora/Pyrit
But CUDA device don’t show up.
Any help?
Thank’s
root@kali:~# pyrit list_cores
Pyrit 0.5.1 (C) 2008-2011 Lukas Lueg – 2015 John Mora
https://github.com/JPaulMora/Pyrit
This code is distributed under the GNU General Public License v3+
The following cores seem available…
#1: ‘CPU-Core (SSE2/AES)’
#2: ‘CPU-Core (SSE2/AES)’
#3: ‘CPU-Core (SSE2/AES)’
#4: ‘CPU-Core (SSE2/AES)’
#5: ‘CPU-Core (SSE2/AES)’
#6: ‘CPU-Core (SSE2/AES)’
#7: ‘CPU-Core (SSE2/AES)’
#8: ‘CPU-Core (SSE2/AES)’
For all those who were getting errors installing pyit on latest Kali 2016 release
here is the fix
no doubt it is an amazing tutorial and thanks for posting such tutorials but one or more commands seems to be not working with latest version of Kali
like
step 3..a
apt-get install python2.7-dev python2.7-libpcap libpcap-dev
if you give this command you will get an error
root@emrys:/home/merlin# apt-get install python2.7-libpcap
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package python2.7-libpcap
E: Couldn’t find any package by glob ‘python2.7-libpcap’
E: Couldn’t find any package by regex ‘python2.7-libpcap’
……………….
so if you skip installing it you will get an error later when building pyrit
root@emrys:~/pyrit-0.4.0# python setup.py build
svn: E155007: ‘/root/pyrit-0.4.0’ is not a working copy
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying pyrit_cli.py -> build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/cpyrit
copying cpyrit/__init__.py -> build/lib.linux-x86_64-2.7/cpyrit
copying cpyrit/cpyrit.py -> build/lib.linux-x86_64-2.7/cpyrit
copying cpyrit/util.py -> build/lib.linux-x86_64-2.7/cpyrit
copying cpyrit/pckttools.py -> build/lib.linux-x86_64-2.7/cpyrit
copying cpyrit/config.py -> build/lib.linux-x86_64-2.7/cpyrit
copying cpyrit/network.py -> build/lib.linux-x86_64-2.7/cpyrit
copying cpyrit/storage.py -> build/lib.linux-x86_64-2.7/cpyrit
running build_ext
building ‘cpyrit._cpyrit_cpu’ extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/cpyrit
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-EkQe1J/python2.7-2.7.12=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c cpyrit/_cpyrit_cpu.c -o build/temp.linux-x86_64-2.7/cpyrit/_cpyrit_cpu.o -Wall -fno-strict-aliasing -DVERSION=”0.4.0″
cpyrit/_cpyrit_cpu.c:35:26: fatal error: openssl/hmac.h: No such file or directory
#include
^
compilation terminated.
error: command ‘x86_64-linux-gnu-gcc’ failed with exit status 1
so these errors wont let you go forward.
……………………………………….
after searching for few minutes I found a solution and it worked too well
here is the fix
you just have to install these packages instead of the old python packages which gave errors earlier
apt-get install python2.7-dev libssl-dev zlib1g-dev libpcap-dev
it will install required packages and after that
go back to pyrit directory i.e cd /pyrit-0.4.0
now give the command aand it will be working
root@emrys:~/pyrit-0.4.0# python setup.py build
svn: E155007: ‘/root/pyrit-0.4.0’ is not a working copy
running build
running build_py
running build_ext
building ‘cpyrit._cpyrit_cpu’ extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-EkQe1J/python2.7-2.7.12=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c cpyrit/_cpyrit_cpu.c -o build/temp.linux-x86_64-2.7/cpyrit/_cpyrit_cpu.o -Wall -fno-strict-aliasing -DVERSION=”0.4.0″
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-EkQe1J/python2.7-2.7.12=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c cpyrit/_cpyrit_cpu_sse2.S -o build/temp.linux-x86_64-2.7/cpyrit/_cpyrit_cpu_sse2.o -Wall -fno-strict-aliasing -DVERSION=”0.4.0″
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-EkQe1J/python2.7-2.7.12=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-EkQe1J/python2.7-2.7.12=. -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/cpyrit/_cpyrit_cpu.o build/temp.linux-x86_64-2.7/cpyrit/_cpyrit_cpu_sse2.o -lcrypto -lpcap -o build/lib.linux-x86_64-2.7/cpyrit/_cpyrit_cpu.so
running build_scripts
creating build/scripts-2.7
copying and adjusting pyrit -> build/scripts-2.7
changing mode of build/scripts-2.7/pyrit from 644 to 755
root@emrys:~/pyrit-0.4.0#
I hope this helps :)
Im running with Nvidia GTX 970 and Intel i7 4770K 16GB DDR3
the benchmark on my system is giving this result
root@emrys:~# pyrit list_cores
Pyrit 0.4.0 (C) 2008-2011 Lukas Lueg http://pyrit.googlecode.com
This code is distributed under the GNU General Public License v3+
The following cores seem available…
#1: ‘CPU-Core (SSE2)’
#2: ‘CPU-Core (SSE2)’
#3: ‘CPU-Core (SSE2)’
#4: ‘CPU-Core (SSE2)’
#5: ‘CPU-Core (SSE2)’
#6: ‘CPU-Core (SSE2)’
#7: ‘CPU-Core (SSE2)’
#8: ‘CPU-Core (SSE2)’
root@emrys:~# pyrit benchmark
Pyrit 0.4.0 (C) 2008-2011 Lukas Lueg http://pyrit.googlecode.com
This code is distributed under the GNU General Public License v3+
Running benchmark (5092.4 PMKs/s)… |
Computed 5092.38 PMKs/s total.
#1: ‘CPU-Core (SSE2)’: 654.2 PMKs/s (RTT 3.0)
#2: ‘CPU-Core (SSE2)’: 661.5 PMKs/s (RTT 3.0)
#3: ‘CPU-Core (SSE2)’: 657.0 PMKs/s (RTT 3.0)
#4: ‘CPU-Core (SSE2)’: 653.0 PMKs/s (RTT 3.0)
#5: ‘CPU-Core (SSE2)’: 659.7 PMKs/s (RTT 3.0)
#6: ‘CPU-Core (SSE2)’: 662.1 PMKs/s (RTT 2.9)
#7: ‘CPU-Core (SSE2)’: 662.3 PMKs/s (RTT 3.0)
#8: ‘CPU-Core (SSE2)’: 663.4 PMKs/s (RTT 3.0)
root@emrys:~#
Isnt it slow ? I mean a card like GTX 970 which was launched last year , it only gives 5092.4 PMKs/s , which should be alot higher than this..
while panda br and monster in earlier comments have higher benchmark than me…. can somone please explain it to me ?
It’s not picking up CUDA, so only CPU core’s are used.
Hey,
Thanks so much fro this post! I’m so glad to see that there is a tutorial available for the installation process! I find these programs very helpful with organizing business data.
Best,
Dennis