Thursday, September 6, 2012

How to Install Pyrit and Opencl on Ubuntu 11.04 from scratch

This will be a guide on how to install Pyrit with Opencl on a AMD / ATI machine.
Not that the AMD part matters. So break down is Ubuntu 11.04 fresh install and a Radeon HD 5450 (I know it's a low end card but it's what I had laying in a box.)
**NOTES
Your card must be opencl capable or it will not show up when you list cores.

(In the words of the Joker, "And here, We, Go")

First Install Ubuntu 11.04  then install your graphics driver. I prefer the graphical method as it is easiest and we love true.  Restart and open a Terminal.
Test to make sure your card installed properly.

aticonfig --list-adapters

If your card shows up then you are set for the next part!

sudo apt-get install python-scapy libpcap0.8-dev
sudo apt-get install libboost

sudo apt-get install python-dev

Download, extract, and configure the AMD Stream SDK. You can put the sdk in your  /opt folder to keep it out of the way of your future endevors. Here's how you can do it:

wget http://download2-developer.amd.com/amd/APPSDK/AMD-APP-SDK-v2.4-lnx64.tgz

tar xvzf AMD-APP-SDK-v2.4-lnx64.tgz

sudo mv AMD-APP-SDK-v2.4-lnx64/ /opt

echo export AMDAPPSDKROOT=/opt/AMD-APP-SDK-v2.4-lnx64/ >> ~/.bashrc

echo export AMDAPPSDKSAMPLESROOT=/opt/AMD-APP-SDK-v2.4-lnx64/ >> ~/.bashrc

echo 'export LD_LIBRARY_PATH=${AMDAPPSDKROOT}lib/x86_64:${LD_LIBRARY_PATH}' >> ~/.bashrc

source ~/.bashrc

cd /


sudo tar xfz $AMDAPPSDKROOT/icd-registration.tgz

Grab pyrit and cpyrit-opencl, extract both.

wget http://pyrit.googlecode.com/files/pyrit-0.4.0.tar.gz
wget http://pyrit.googlecode.com/files/cpyrit-opencl-0.4.0.tar.gz
tar zxf pyrit-0.4.0.tar.gz
tar zxf cpyrit-opencl-0.4.0.tar.gz

Build pyrit, (this is where I had to install libpcap0.8-dev, because it was missing from my system):


cd pyrit-0.4.0/
python setup.py build
sudo python setup.py build
sudo python setup.py install



Now we build cpyrit-opencl


cd ../cpyrit-opencl-0.4.0/
nano setup.py

Change this (lines 34 & 35):


OPENCL_INC_DIRS = []
OPENCL_LIB_DIRS = []

To this and save the file:


OPENCL_INC_DIRS = ['/opt/AMD-APP-SDK-v2.4-lnx64/include/']
OPENCL_LIB_DIRS = ['/opt/AMD-APP-SDK-v2.4-lnx64/lib/x86_64/']


You should be able to build cpyrit-opencl now normally:


sudo python setup.py build
sudo python setup.py install
Test pyrit with and make sure all of your GPU cores show up:

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: 'OpenCL-Device 'Cayman''
#2: 'CPU-Core (SSE2)'
#3: 'CPU-Core (SSE2)'

2 comments:

  1. I have looked for about 3 days a guide that can help me and yours gets the prize! Thanks for uploading this.

    ReplyDelete