Difference between revisions of "Pyrit setup"

From ivc wiki
Jump to navigationJump to search
Line 146: Line 146:
  sudo aptitude install libqt4-core
  sudo aptitude install libqt4-core
  ./atioc # from an X session of course
  ./atioc # from an X session of course
To make changes persistent over reboots, try ''System->Preferences->Startup Applications'' or ''/etc/gdm/init/Default''.


'''References:'''
'''References:'''

Revision as of 20:59, 9 April 2010

Pyrit is a tool used to pre-compute all possible SSID:PASSWORD combinations to generate a list of PMK tokens.

Pre-requisite

Pyrit version 0.3.0 and up depend on Scapy2 (package inspection) and SQLAlchemy 0.5.6 (database interface).

Scapy: On a Debian bases distribution, get the package using aptitude. Backtrack 4 final include the Scapy2.

sudo aptitude update
sudo aptitude install python-scapy scapy2

Install

Main App

Download the latest pyrit from pyrit.googlecode.com.

wget http://pyrit.googlecode.com/files/pyrit-0.3.0.tar.gz

Extract, build and install the package.

tar zxvf pyrit-0.3.0.tar.gz
cd pyrit-0.3.0
python setup.py build
sudo python setup.py install

If errors like this occurs:

cpyrit/_cpyrit_cpu.c:21:20: error: Python.h: No such file or directory

On Ubuntu, try to install python2.6-dev along with the other dev packages.

Test to verify the core modules work.

pyrit eval
pyrit list_cores
pyrit -e linksys create_essid

If these operations execute without error, everything should be set.

GPU Cores

Now, to install the GPU accelerated modules. A good tip is to pick a desktop distro with the graphical interface already configured, as the cpyrit modules require X Window to be running when in use. X11vnc also comes in handy when remotely administering the system.

OpenCL (Nvidia/AMD/Cell)

OpenCL support requires the OpenCL SDK; Nvidia OpenCL SDK or ATI Stream SDK.

But before installing the SDK, the (proprietary) graphics drivers for the video card has to be installed and set-up beforehand. This is normally a procedure covered on great detail in the distro wiki or help forum, as it's something most Linux users need to do to get GPU acceleration up and running (games). For Ubuntu, see Check the ATI Binary Driver Howto and cchtml Installation Guide.

Here is a summary, for ATI Catalyst 10.3 on a 64-bit setup:

Install binary drivers under System->Administration->Hardware Drivers
Enable the Source Code repository from the Synaptic Package Manger
wget https://a248.e.akamai.net/f/674/9206/0/www2.ati.com/drivers/linux/ati-driver-installer-10-3-x86.x86_64.run
sudo apt-get update
sudo apt-get install libqtgui4
sudo sh ./ati-driver-installer-10-3-x86.x86_64.run --buildpkg Ubuntu/karmic # will install dependencies and build packages
sudo apt-get install ia32-libs # only for 64-bit systems
sudo dpkg -i *.deb
In case of broken packages, open Synaptic Package Manager and click on Fix Broken Packages from Edit menu
sudo aticonfig --initial -f # generates /etc/X11/xorg.conf
fglrxinfo # when logged into X window

To install the ATI SDK, follow these steps to set up the paths (there are no packages or anything to compile).

Download the ATI SDK package from the official ATI Stream SDK page.

wget http://download2-developer.amd.com/amd/Stream20GA/ati-stream-sdk-v2.01-lnx64.tgz
tar zxvf ati-stream-sdk-v2.01-lnx64.tgz
mv ati-stream-sdk-v2.01-lnx64 ~/ati-stream-sdk

As per the installation notes, set the paths.

pico ~/.bashrc
paste the following lines and correct the username/64-bit path:
export ATISTREAMSDKROOT=/home/ivc/ati-stream-sdk
export ATISTREAMSDKSAMPLESROOT=/home/ivc/ati-stream-sdk/samples
export LD_LIBRARY_PATH=$ATISTREAMSDKROOT/lib/x86_64:$LD_LIBRARY_PATH

The cpyrit setup.ph script doesn't know where to find the cl.h header files and will report this error:

_cpyrit_opencl.c:23:19: error: CL/cl.h: No such file or directory

Edit setup.py and at the top add the path for /home/ivc/ati-stream-sdk/include to the list:

for path in ('/usr/local/opencl/OpenCL/common/inc', \
           '/opt/opencl/OpenCL/common/inc', \
           '/home/ivc/ati-stream-sdk/include', \
           '/usr/local/opencl/include'):

I had problems with the build and ld reporting it couldn't find the OpenCL library:

/usr/bin/ld: cannot find -lOpenCL
collect2: ld returned 1 exit status

A quick workaround was to create a symblink of libOpenCL.so to /lib64:

sudo ln -s /home/ivc/ati-stream-sdk/lib/x86_64/libOpenCL.so /lib64/

And finally, to build the cpyrit OpenCL module:

wget http://pyrit.googlecode.com/files/cpyrit-opencl-0.3.0.tar.gz
tar zxvf cpyrit-opencl-0.3.0
cd cpyrit-opencl-0.3.0
python setup.py build
sudo python setup.py install

X Window has to be attached to at least one display out for each card installed in the system. Enabled them in /etc/xorg.conf, that is, one "Device" + "Monitor" + "Screen" combination for each card installed. Check my xorg.conf for an example for 2x HD 5950 cards setup.

Finally, to test and verify the new module is ready.

pyrit list_cores
pyrit benchmark

The core list should look like this:

Core list and benchmark results on a 2x HD 5850 graphics cards, 4x core i5 processor, 4 GB memory setup:

Pyrit 0.3.0 (C) 2008-2010 Lukas Lueg http://pyrit.googlecode.com
This code is distributed under the GNU General Public License v3+

Running benchmark (72963.2 PMKs/s)... \

Computed 73196.00 PMKs/s total.
#1: 'OpenCL-Device 'Cypress: 34107.9 PMKs/s (RTT 1.7)
#2: 'OpenCL-Device 'Cypress: 34179.9 PMKs/s (RTT 1.8)
#3: 'CPU-Core (SSE2)': 776.6 PMKs/s (RTT 2.8)
#4: 'CPU-Core (SSE2)': 785.4 PMKs/s (RTT 2.8)
#5: 'Network-Clients': 0.0 PMKs/s (RTT 0.0)

A worthy tool to mention is aticonfig; configure, control, and get status reports. Run it in an X session, remote ssh terminal doesn't work/supported.

  • sudo aticonfig --adapter=0,1 --odgt - get the temperature from adapter 0 and 1, mine range from 58 to 79 degrees
  • sudo aticonfig --adapter=0,1 --odgc - see clocks speed and gpu load, mine hovers around 86% when pyrit loaded
  • sudo aticonfig --pplib-cmd 'get fanspeed 0' - check the current fan speed on adapter 0, mine stays in the 58-63% range
  • sudo aticonfig --pplib-cmd 'set fanspeed 0 50' - adjust the fan speed, 50%, mine only seems to work on adapter 0, atioc below can set both though
  • sudo aticonfig --od-enable - for the adventurous, enable Overdrive to release the overclocking potential
    • sudo aticonfig --odsc 775,1125 - set the new core and memory clock speeds
    • sudo aticonfig --odcc - commit, or save, the new clock speeds
    • sudo stop gdm and sudo start gdm - restart X to take advantage of the new speeds
  • aticonfig --help - find all the other goodness, or see this aticonfig help output

Another, GUI, tool I like is ATI Overclocking Utility by sabby. A simple interface showing the current clock speeds, temperature, fanspeed, and also Overdrive panel for overclocking.

wget http://kde-apps.org/CONTENT/content-files/107457-atioc_x86_64_105 # 64-bit version
mv 107457-atioc_x86_64_105 atioc
sudo aptitude install libqt4-core
./atioc # from an X session of course

To make changes persistent over reboots, try System->Preferences->Startup Applications or /etc/gdm/init/Default.

References:

Nvidia CUDA

This module install in a similar way. I have not tested this method. Make sure the Nvidia graphics drivers work with the graphics card. Next install the CUDA-Toolkit to get the required Nvidia compiler.

To install the cpyrit CUDA module:

wget http://pyrit.googlecode.com/files/cpyrit-cuda-0.3.0.tar.gz
tar zxvf cpyrit-cuda-0.3.0
python setup.py build
sudo python setup.py install

Test to verify the new module is ready.

pyrit list_cores

Database Setup

The default file container is a blobspace on the local filesystem, but with the -u parameter an external database can be used for storage.

To begin, the current SQLAlchemy version, 0.4.5, is too old to be used with pyrit. Version 0.5.6 or later is required for pyrit 0.3.0.

Get the latest stable release, extract, build and install.

wget http://downloads.sourceforge.net/project/sqlalchemy/sqlalchemy/0.5.8/SQLAlchemy-0.5.8.tar.gz
tar zxvf SQLAlchemy-0.5.8.tar.gz
cd SQLAlchemy-0.5.8
sudo aptitude install python-setuptools
sudo easy_install SQLAlchemy

Next, to use a MySQL database, install the python-mysqldb package.

sudo aptitude install python-mysqldb

Or else an error like this will let you know:

    return __import__('MySQLdb')
ImportError: No module named MySQLdb

References