My favorites | Sign in
Logo
                
Search
for
Updated Oct 05, 2009 by lukas.lueg
Labels: Featured
Installation  
How to get Pyrit working on your system.

Introduction

This document will guide you through the installation of Pyrit and it's modules.

Pyrit compiles and runs on Linux, FreeBSD and MacOS. Windows is not (and probably never will be) supported; there are however some reports of successful installations on Windows with the help of MinGW.

Pyrit consists of basically two parts:

  • The main module features the commandline-client, the scheduling- and database-code and a basic extension-module that uses the CPU for computation. The main module is required for everyone...
  • There are currently three extension modules that add support for more advanced hardware. The extension modules for Nvidia-CUDA and ATI-Stream may be installed optionally and are used if available and supported by local hardware. There is also a extension module for OpenCL which currently lacks supporting hardware-vendors :-)

You may want to take a look at this page to find out if your hardware supports Nvidia-CUDA. People with interest in ATI-Stream can take a look here. Nvidia is currently the only vendor with a working software implementation of OpenCL; other possible OpenCL-platforms like IBM's Cell B.E. (that powers the Playstation 3) are still waiting for supporting drivers.

Compiling from sources

Compiling from source-code is the preferred way of getting Pyrit onto your system. Linux users running a binary distribution may need to install the development packages for Python (e.g. python-devel), OpenSSL (e.g. openssl-devel or libssl-dev) and Zlib (e.g. zlib-devel). You also need a C-compiler like gcc. Users of MacOS probably only need to have Xcode installed.

From time to time Pyrit get's packed into (hopefully) stable packages. In general you should download, compile and install these source-code packages from the Download area. The more adventurous among you may instead want to try the latest source-code in Pyrit's repository. The code in svn-trunk may include more features and provide better performance but also may cause random problems or even not compile at all. Use the fixed packages when in doubt.

Stable: Source-code from fixed packages

Download the source-code package for Pyrit and (optionally) a extension-module.

Now unpack the source-code into a new directory like this:

tar xvzf Pyrit-0.2.4.tar.gz
tar xvzf CPyrit-CUDA-0.2.4.tar.gz

Continue with the compiling as explained below.

Adventurous: Source-code from svn-trunk

You need to install a subversion-client before you can use Pyrit's source-code repository; most Linux distributions provide a package for that. Do the initial checkout from svn-trunk like this:

svn checkout http://pyrit.googlecode.com/svn/trunk/ pyrit_svn

This will create a new directory 'pyrit_svn' that holds all of Pyrit's latest source-code. Execute svn update inside that directory to keep track of changes.

Compiling and installing

... the main module

Switch to the main module's directory which should be 'Pyrit-0.2.4' (if you used a source-code package) or 'pyrit_svn/pyrit' (if you're on svn). We use Python's distutils to compile and install the code:

cd Pyrit-0.2.4
python setup.py build

If everything went well and no errors are thrown at you, use distutils again to install Pyrit:

sudo python setup.py install

You can now execute 'pyrit' from your commandline; leave the source-code's directory before doing so to prevent Python from getting confused with module-lookups.

... support for Nvidia-CUDA

Get yourself a copy of the CUDA-Toolkit from http://www.nvidia.com/object/cuda_get.html. You need to modify either $PATH and ldconfig or setup.py if you choose not to install the Toolkit into either '/usr/local/cuda' or '/opt/cuda' so CPyrit-CUDA's installation routine can find Nvidia's compiler 'nvcc'.

Switch to the directory holding CPyrit-CUDA's source-code and compile and install it just like you did with Pyrit:

cd CPyrit-CUDA-0.2.4
python setup.py build
sudo python setup.py install

You also need to have Nvidia's proprietary hardware-drivers installed in the way that fits your OS.

... support for ATI-Stream

Download the ATI-Stream SDK from here and install it. You need to modify setup.py or modify $PATH and ldconfig if you choose not to install into either '/usr/local/atibrook/sdk' or '/opt/atibrook/sdk'. As ATI's software is (once again) of extremely bad quality, you probably need to apply a series of workarounds for common bugs in the Stream-SDK. See here, here and here. Building CPyrit-Stream requires a C++-compiler which should be provided by your distribution (e.g. gcc-c++).

Switch to the directory holding CPyrit-Stream's source-code and compile and install it just like you did with Pyrit:

cd CPyrit-Stream-0.2.4
python setup.py build
sudo python setup.py install

You also need to have ATI's proprietary hardware-drivers 'fglrx' installed in the way that fits your OS.

... support for OpenCL

Vendor-support for OpenCL is in a very early stage and currently Nvidia is the only provider of a working OpenCL environment. Other hardware-platforms, including IBM's Cell B.E., should however support OpenCL in the near future.

You can use Pyrit's OpenCL-core if you happen to have a working OpenCL-environment:

cd CPyrit-OpenCL-0.2.4
python setup.py build
sudo python setup.py install

Please notice that the OpenCL-Core is not used for Nvidia-GPUs if CPyrit-CUDA is also installed.

Using binary packages

Binary packages are not directly supported. The Pentoo- and the Backtrack4-LiveCD include Pyrit as pre-build packages.


Comment by laurent.wilkin, Jul 25, 2009

Great documentation and very usefull. I'm using Ubuntu 9.04 and now was able to install correctly Pyrit. Greant, tranks a lot. Tamalo

Comment by laurent.wilkin, Jul 30, 2009

hi, when installing this : "sudo apt-get install xorg-driver-fglrx pyrit-stream" all my system (ubuntu 9.04) crash after reboot. i try so correct, solve... nothing. must réinstall all... PC is Q6600 with 4850 asus. thanks

Comment by lukas.lueg, Jul 30, 2009

Got kernel 2.6.29 ? fglrx will crash that kernel.... You should have rebooted into runlevel 3 and disable fglrx

Comment by cpmitch23, Aug 04, 2009

Can you help with this error? Running BT4Pre-Final, I've downloaded r146 from svn as per instructions, and performed the install and build commands in each directory(~/pyrit_svn/pyrit and ~/pyrit_svn/cpyrit_cuda), as root. But running pyrit results in:

root@pwnsauce-desktop:~/pyrit_svn/cpyrit_cuda# pyrit Traceback: File "/usr/bin/pyrit", line 32, in <module>

import cpyrit_util as util
File "/usr/lib/python2.5/site-packages/cpyrit_util.py", line 53, in <module>
import scapy.config
ImportError?: No module named config

I'm sure the answer is staring me in the face. Scapy is installed and located in /usr/bin/scapy

Thanks in advance.

Comment by lukas.lueg, Aug 04, 2009

Scapy should be version 2.0.10 I think the one in bt4 is 1.

Comment by cpmitch23, Aug 04, 2009

Good news: Yes indeed pyrit is happy with scapy 2.0.1 in case anybody comes across this error on a BT4Pre-Final system, just do this after upgrading pyrit from svn:

$ cd /tmp $ wget scapy.net $ unzip scapy-latest.zip $ cd scapy-2. $ sudo python setup.py install

Works for me; Many Thanks!

Comment by cpmitch23, Aug 06, 2009

Just upgraded from svn once more. All compile steps OK, but command pyrit list_cores tells me that:

WARNING: Version mismatch between main module ('0.2.4-dev (svn r151)') and CPyrit-CUDA ('0.2.4-dev (svn r147)')

I've done all the steps as outlined, but something was missed. Is my box good to go, or further work necessary. Note that the list_cores command completed showing my hardware, and no other errors were observed. Thank you in advance.

Comment by lukas.lueg, Aug 06, 2009

The API used between Pyrit and the extension-modules may change between versions. That's why Pyrit keeps track of what svn-revision the modules were compiled from and issues a warning if they do not match.

Most of the time you can safely ignore this warning.

To get rid of this message (and ensure that the CUDA-extension is compatible to Pyrit) you should also svn-update the cpyrit-cuda extension and re-compile & install.

Comment by aquila421, Aug 19, 2009

Mine is also probably staring me in the face. Compile error on build:

gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fPIC -I/usr/include/python2.4 -c cpyrit/pckttools.c -o build/temp.linux-i686-2.4/cpyrit/pckttools.o cpyrit/pckttools.c: In function ‘eapolcracker_solve’: cpyrit/pckttools.c:102: error: ‘Py_ssize_t’ undeclared (first use in this function) cpyrit/pckttools.c:102: error: (Each undeclared identifier is reported only once cpyrit/pckttools.c:102: error: for each function it appears in.) cpyrit/pckttools.c:102: error: expected ‘;’ before ‘buffersize’ cpyrit/pckttools.c:119: error: ‘buffersize’ undeclared (first use in this function) error: command 'gcc' failed with exit status 1

Comment by aquila421, Aug 19, 2009

Answered my own question. I had python 2.4 installed. Upgrading to 2.6 did the trick. =)

Comment by alexei.pastuchov, Aug 31, 2009

i tried to build cpyrit_cuda Revision: 170 on MacBookPro? with Mac OS X 10.5.8 and current CUDA 2.3 and got an error:

ld: library not found for -lcuda

To build CUDA-Extension I added library_dirs argument in setup.py to

cuda_extension = Extension(
...
library_dirs = ['/usr/local/cuda/lib']
...
)
Comment by zhuhaidong98, Oct 11, 2009

Mac OS X 10.6.1 When i do: python setup.py build, i got below errors: gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c cpyrit/cpyrit_cpu.c -o build/temp.macosx-10.3-fat-2.6/cpyrit/cpyrit_cpu.o -DVERSION="0.2.5-dev (svn r179)" In file included from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/unicodeobject.h:4,

from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:85, from cpyrit/cpyrit_cpu.c:21:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory In file included from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/unicodeobject.h:4,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:85, from cpyrit/cpyrit_cpu.c:21:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory cpyrit/cpyrit_cpu.c: In function ‘segv_action’: cpyrit/cpyrit_cpu.c:126: error: ‘struct mcontext’ has no member named ‘ss’ lipo: can't figure out the architecture type of: /var/folders/1l/1lbjeQ4KH5qKT2LIXl9Y4E+++TI/-Tmp-//ccGGV7jg.out error: command 'gcc' failed with exit status 1

Comment by rogilvie, Oct 18, 2009

has anyone had success running pyrit on OS X? I'm able to get everything up and running, pyrit list_cores (including GPU/benchmark/batch all work but analyze, attack_batch, attack_db all state an error around the requirement of scapy 2.x to be installed.

I've installed scapy 2.x multiple times from compiling to using macports (port install scapy) etc etc.

If anyone has the latest version running on OSX Leopard, had the same scapy issues and have a fix let me know! may just be a case of having too much installed on my mac - might be time for a fresh install.. Cheers.

Comment by tmachinecorp, Oct 19, 2009

Similar issue as "rogilvie" on All versions of Slackware.

$pyrit -f wpa.txt import_passwords

Traceback (most recent call last): File "/usr/bin/pyrit", line 6, in <module> pyrit_cli.Pyrit_CLI().initFromArgv()
File "/usr/lib/python2.5/site-packages/pyrit_cli.py", line 62, in initFromArgv args, commands = getopt.getopt(sys.argv1:?, 'u:v:c:e:i:o:r:b:') File "/usr/lib
/python2.5/getopt.py", line 91, in getopt opts, args = do_shorts(opts, args0?1:?, shortopts, args1:?) File "/usr/lib/python2.5/getopt.py", line 191, in do_shorts if short_has_arg(opt, shortopts): File "/usr/lib/python2.5/getopt.py", line 207, in short_has_arg raise GetoptError???('option -%s not recognized' % opt, opt) getopt.GetoptError???: option -f not recognized
Comment by lukas.lueg, Oct 19, 2009

The option '-f' has been split into '-i' for input- and '-o' for output-files.

Comment by wingen, Nov 23, 2009

Hi, I'm trying to get CPyrit-OpenCL to work with my shiny new HD5870. As AMD has released OpenCL-compatible drivers and an SDK, I wanted to try that instead of Stream.

I have downloaded and installed the driver (ati-opencl-beta-driver-v2.0-beta4-lnx) and the SDK (ati-stream-sdk-v2.0-beta4-lnx32), and made an adjustment to setup.py to look for the OpenCL headers in the Stream SDK 2.0 include folder (in my case, ~/ati-stream-sdk-v2.0-beta4-lnx32/include) instead of /usr/local/OpenCL/opencl/common/inc.

During compile of CPyrit-OpenCL, I get these errors:

$ sudo python setup.py build
running build
running build_ext
Building modules...
building 'cpyrit._cpyrit_opencl' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/home/sebastian/Downloads/ati-stream-sdk-v2.0-beta4-lnx32/include -I/usr/include/python2.6 -c _cpyrit_opencl.c -o build/temp.linux-i686-2.6/_cpyrit_opencl.o -DVERSION="0.2.4"
_cpyrit_opencl.c: In function ‘getCLresultMsg’:
_cpyrit_opencl.c:59: error: ‘CL_DEVICE_COMPILER_NOT_AVAILABLE’ undeclared (first use in this function)
_cpyrit_opencl.c:59: error: (Each undeclared identifier is reported only once
_cpyrit_opencl.c:59: error: for each function it appears in.)
error: command 'gcc' failed with exit status 1

I'm guessing it may have something to do with AMD's potentially different OpenCL headers compared to NVIDIA's.

Have you been able to get CPyrit-OpenCL running on an OpenCL-compatible AMD card?

Thanks in advance!

Comment by wingen, Nov 23, 2009

Typo in my original post: I changed the setup.py file to look for OpenCL headers in ~/Downloads/ati-stream-sdk-v2.0-beta4-lnx32/include, not ~/ati-stream-sdk-v2.0-beta4-lnx32/include.

Comment by draganj84, Nov 28 (4 days ago)

Can anyone shed light on this:

trying to compile CPyrit-stream with gcc gives these errors: CPyrit-Stream-0.2.4?# python setup.py build running build running build_ext Skipping rebuild of AMD-Stream kernel ... Building modules... building 'cpyrit.cpyrit_stream' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fPIC -I/usr/local/atibrook/sdk/include -I_brook_tmp -I/usr/include/python2.6 -c brook_tmp/stream.cpp -o build/temp.linux-x86_64-2.6/brook_tmp/stream.o -DVERSION="0.2.5-dev" In file included from /usr/local/atibrook/sdk/include/brook/brook.h:55, from brook_tmp/stream.cpp:7: /usr/local/atibrook/sdk/include/brook/CPU/brtarray.hpp: In member function ‘BrtArray?<VALUE>& BrtArray?<VALUE>::operator=(const BrtArray?<VALUE>&)’: /usr/local/atibrook/sdk/include/brook/CPU/brtarray.hpp:146: error: ‘stderr’ was not declared in this scope /usr/local/atibrook/sdk/include/brook/CPU/brtarray.hpp:146: error: there are no arguments to ‘fprintf’ that depend on a template parameter, so a declaration of ‘fprintf’ must be available /usr/local/atibrook/sdk/include/brook/CPU/brtarray.hpp:146: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated) /usr/local/atibrook/sdk/include/brook/CPU/brtarray.hpp: In copy constructor ‘BrtArray?<VALUE>::BrtArray?(const BrtArray?<VALUE>&)’: /usr/local/atibrook/sdk/include/brook/CPU/brtarray.hpp:180: error: ‘stderr’ was not declared in this scope /usr/local/atibrook/sdk/include/brook/CPU/brtarray.hpp:180: error: there are no arguments to ‘fprintf’ that depend on a template parameter, so a declaration of ‘fprintf’ must be available error: command 'gcc' failed with exit status 1


anyone please?

Comment by lukas.lueg, Nov 28 (4 days ago)

draganj84: See http://pyrit.wordpress.com/2009/10/05/ati-catalyst-9-9-vs-kernel-2-6-30/

You need to eddit btarray.hpp and add the missing "#include <cstdio>"

Comment by lukas.lueg, Nov 28 (4 days ago)

wingen: You can edit cpyrit_opencl.c and simply remove offending line 59. it is only needed to pretty-print error messages

Comment by draganj84, Nov 28 (4 days ago)

Sorry for that mess, forgot to format it. Problem solved,

there is missing #include <cstdio> in /usr/local/atibrook/sdk/include/brook/CPU/brtarray.hpp, if anyone should come across this.

Comment by draganj84, Nov 28 (4 days ago)

Oh hehe, solved it without that link (would made it faster!), but thx for helping, that was lightening fast :)

Comment by draganj84, Nov 28 (4 days ago)

Everything listed in here is installed without errors. But pyrit doesn't see my HD 4870 x2, only i7 cores: 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)'

Is the issue with ATI itself?

Comment by lukas.lueg, Nov 28 (4 days ago)

draganj84: Did you take a look at http://code.google.com/p/pyrit/wiki/Troubleshooting ?

Comment by wingen, Nov 29 (3 days ago)

Thanks for your response, Lukas. I removed line 59 in cpyrit_opencl.c and tried to compile it again. Instead I get this:

/usr/bin/ld: cannot find -lOpenCL

Here is the full output of sudo python setup.py build

~/Downloads/CPyrit-OpenCL-0.2.4$ sudo python setup.py buildrunning build
running build_ext
Building modules...
building 'cpyrit._cpyrit_opencl' extension
creating build
creating build/temp.linux-i686-2.6
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/home/sebastian/Downloads/ati-stream-sdk-v2.0-beta4-lnx32/include -I/usr/include/python2.6 -c _cpyrit_opencl.c -o build/temp.linux-i686-2.6/_cpyrit_opencl.o -DVERSION="0.2.4"
creating build/lib.linux-i686-2.6
creating build/lib.linux-i686-2.6/cpyrit
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-i686-2.6/_cpyrit_opencl.o -lssl -lOpenCL -lz -o build/lib.linux-i686-2.6/cpyrit/_cpyrit_opencl.so
/usr/bin/ld: cannot find -lOpenCL
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

I tried removing OpenCL as an included lib from the setup.py file here:

opencl_extension = Extension('cpyrit._cpyrit_opencl',
                    libraries = ['ssl', 'OpenCL', 'z'],

But once I compile and install it (without errors), there is no binary file found. If I do this: sudo python -c 'from cpyrit import cpyrit_opencl' I get the following:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: /usr/local/lib/python2.6/dist-packages/cpyrit/_cpyrit_opencl.so: undefined symbol: clCreateCommandQueue

I really wish there was a simple package to install ATI Stream 2.0, but right now it's just a compressed folder. No links are made or anything.

Comment by lukas.lueg, Nov 29 (3 days ago)

OpenCl? is needed, you can't just remove the linking :-D

You usually end up with a folder somewhere that holds all OpenCL files from ATI's package. Edit your .bashrc like this to guide the linker:

export LD_LIBRARY_PATH=/home/sebastian/ati-stream-sdk-v2.0-beta4-lnx32/lib/x86:$LD_LIBRARY_PATH

Re-open a terminal and the linker should find the shared library

Comment by wingen, Nov 29 (3 days ago)

Thank you for your speedy response! Unfortunately, your advice didn't work. It still complains about not finding the OpenCL link.

Here is the content of the lib/x86 folder inside Stream 2.0:

~/Downloads/ati-stream-sdk-v2.0-beta4-lnx32/lib/x86$ ls
amdrt_x86.o            builtins_x86-32.bc  libGLEW.so  libOpenCL.so
builtins_amdil_opt.bc  libamuabi.a         libglut.so  libSDKUtil.a

Don't I have to specify somewhere what exactly "OpenCL" is when trying to link to it using -lOpenCL?

Comment by datapirates, Dec 01 (44 hours ago)

Unpacked Stream2 to /usr/local/atistream2. Ubuntu 9.06-64bit. Then symlinked /usr/local/atistream2/lib/x86_64/libOpenCL.so to /usr/lib. pyrit191 compiled and installed fine. list_cores shows a OpenCL-Device, but in benchmark a lot of errors came up. Something with 'core died' :-)

Comment by lukas.lueg, Yesterday (27 hours ago)

datapirates: I've now also installed ATI's OpenCL-implementation. The driver returns wrong results with all API-calls signaling successfull completion - that should not be. The cores kill themselves because Pyrit does a quick self-test during startup in which it compares results coming from the device to precomputed ones.

Given the overall quality of ATI's driver stack, I highly suspect a driver bug....


Sign in to add a comment
Hosted by Google Code