Ubuntu 14.04 LTS. Ноутбук Dell inspiron 5520, с Intel core i7, AMD Radeon HD 7600M.
Мои действия:
1) Поставил AMD Radeon Software Crimson Edition (получилось только по инструкции отсюда:
http://kubuntu.ru/node/13476) Команды, которые я вводил:
sudo apt-get remove --purge fglrx*
sudo apt-get install build-essential cdbs dh-make dkms execstack dh-modaliases libqtgui4 xserver-xorg-dev lib32gcc1
mkdir amd-15.12 && cd amd-15.12
wget --referer='http://support.amd.com/en-us/download/desktop?os=Linux+x86_64' http://www2.ati.com/drivers/linux/radeon-crimson-15.12-15.302-151217a-297685e.zip
unzip radeon-crimson-15.12-15.302-151217a-297685e.zip
cd fglrx-15.302
wget https://aur.archlinux.org/cgit/aur.git/snapshot/catalyst-test.tar.gz
chmod a+x catalyst-test.tar.gz
tar -xvf catalyst-test.tar.gz
chmod +x amd-driver-installer-15.302-x86.x86_64.run
./amd-driver-installer-15.302-x86.x86_64.run --extract ./drv
cd drv/
patch -Np1 --verbose < ../catalyst-test/arch-fglrx-authatieventsd_new.patch
patch -Np1 --verbose < ../catalyst-test/lano1106_fglrx_intel_iommu.patch
patch -Np1 --verbose < ../catalyst-test/lano1106_kcl_agp_13_4.patch
patch -Np1 --verbose < ../catalyst-test/makefile_compat.patch
patch -Np1 --verbose < ../catalyst-test/4.3-gentoo-mtrr.patch
patch -Np1 --verbose < ../catalyst-test/4.3-kolasa-seq_printf.patch
patch -Np1 --verbose < ../catalyst-test/crimson_i686_xg.patch
patch -Np1 --verbose < ../catalyst-test/fglrx_gpl_symbol.patch
patch -Np1 --verbose < ../catalyst-test/4.4-manjaro-xstate.patch
sudo ./ati-installer.sh 15.302 --buildpkg
cd ..
sudo chmod a+x *.deb
sudo dpkg -i fglrx*.deb
sudo amdconfig --initial -f
olengoda@olengoda-PC:~$ fglrxinfo
display: :0 screen: 0
OpenGL vendor string: Advanced Micro Devices, Inc.
OpenGL renderer string: AMD Radeon HD 7600M Series
OpenGL version string: 4.5.13416 Compatibility Profile Context 15.302
2) Установил AMD APP SDK
tar -xvf AMD-APP-SDK-linux-v2.9-1.599.381-GA-x64.tar
./AMD-APP-SDK-v2.9-1.599.381-GA-linux64.sh
добавил в конец файла /root/.bashrc эти строки:
# AMD APP SDK
export AMDAPPSDKROOT=/opt/AMDAPP
export AMDAPPSDKSAMPLESROOT=/opt/AMDAPP/
export LD_LIBRARY_PATH=${AMDAPPSDKROOT}lib/x86_64:${LD_LIBRARY_PATH}
export ATISTREAMSDKROOT=$AMDAPPSDKROOT
olengoda@olengoda-PC:~$ clinfo
Number of platforms: 1
Platform Profile: FULL_PROFILE
Platform Version: OpenCL 2.0 AMD-APP (1912.5)
Platform Name: AMD Accelerated Parallel Processing
Platform Vendor: Advanced Micro Devices, Inc.
Platform Extensions: cl_khr_icd cl_amd_event_callback cl_amd_offline_devices
Platform Name: AMD Accelerated Parallel Processing
Number of devices: 1
Device Type: CL_DEVICE_TYPE_CPU
Vendor ID: 1002h
Board name:
Max compute units: 8
Max work items dimensions: 3
Max work items[0]: 1024
Max work items[1]: 1024
Max work items[2]: 1024
Max work group size: 1024
Preferred vector width char: 16
Preferred vector width short: 8
Preferred vector width int: 4
Preferred vector width long: 2
Preferred vector width float: 8
Preferred vector width double: 4
Native vector width char: 16
Native vector width short: 8
Native vector width int: 4
Native vector width long: 2
Native vector width float: 8
Native vector width double: 4
Max clock frequency: 1471Mhz
Address bits: 64
Max memory allocation: 2147483648
Image support: Yes
Max number of images read arguments: 128
Max number of images write arguments: 64
Max image 2D width: 8192
Max image 2D height: 8192
Max image 3D width: 2048
Max image 3D height: 2048
Max image 3D depth: 2048
Max samplers within kernel: 16
Max size of kernel argument: 4096
Alignment (bits) of base address: 1024
Minimum alignment (bytes) for any datatype: 128
Single precision floating point capability
Denorms: Yes
Quiet NaNs: Yes
Round to nearest even: Yes
Round to zero: Yes
Round to +ve and infinity: Yes
IEEE754-2008 fused multiply-add: Yes
Cache type: Read/Write
Cache line size: 64
Cache size: 32768
Global memory size: 8269094912
Constant buffer size: 65536
Max number of constant args: 8
Local memory type: Global
Local memory size: 32768
Kernel Preferred work group size multiple: 1
Error correction support: 0
Unified memory for Host and Device: 1
Profiling timer resolution: 1
Device endianess: Little
Available: Yes
Compiler available: Yes
Execution capabilities:
Execute OpenCL kernels: Yes
Execute native function: Yes
Queue properties:
Out-of-Order: No
Profiling : Yes
Platform ID: 0x00007f196681ea18
Name: Intel(R) Core(TM) i7-3612QM CPU @ 2.10GHz
Vendor: GenuineIntel
Device OpenCL C version: OpenCL C 1.2
Driver version: 1912.5 (sse2,avx)
Profile: FULL_PROFILE
Version: OpenCL 1.2 AMD-APP (1912.5)
Extensions: cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_gl_sharing cl_ext_device_fission cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_media_ops2 cl_amd_popcnt cl_khr_spir cl_khr_gl_event
3) Скачал с сайта
https://code.google.com/archive/p/pyrit/downloads pyrit-0.4.0.tar.gz и cpyrit-opencl-0.4.0.tar.gz, разархивировал их. Установил pyrit:
cd pyrit-0.4.0
./setup.py build install
4) Пытался ставить cpyrit-opencl:
tar xvf cpyrit-opencl-0.4.0.tar.gz
cd cpyrit-opencl-0.4.0
Поменял в файле setup.py строки:
VERSION = ‘0.4.0’ на VERSION = ‘0.4.1-dev’
OPENCL_INC_DIRS = [] на OPENCL_INC_DIRS = [“/opt/AMDAPPSDK-2.9-1/include“]
OPENCL_LIB_DIRS = [] на OPENCL_INC_DIRS = [“/opt/AMDAPPSDK-2.9-1/lib/x86_64“]
./setup.py build install
The headers required to build the OpenCL-kernel were not found. Trying to continue anyway...
running build
running build_ext
Building modules...
running install
running install_lib
running install_egg_info
Removing /usr/local/lib/python2.7/dist-packages/cpyrit_opencl-0.4.1_dev.egg-info
Writing /usr/local/lib/python2.7/dist-packages/cpyrit_opencl-0.4.1_dev.egg-info
Но Pyrit всё равно не видит видеокарту:
olengoda@olengoda-PC:~$ pyrit list_cores
/usr/local/lib/python2.7/dist-packages/cpyrit/cpyrit.py:63: UserWarning: WARNING: Version mismatch between <module 'cpyrit._cpyrit_cpu' from '/usr/local/lib/python2.7/dist-packages/cpyrit/_cpyrit_cpu.so'> ('0.4.0') and <module 'cpyrit._cpyrit_opencl' from '/usr/local/lib/python2.7/dist-packages/cpyrit/_cpyrit_opencl.so'> ('0.4.1-dev')
"('%s')\n" % (_cpyrit_cpu, _cpyrit_cpu.VERSION, mod, ver))
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)'
Вот содержимое моего файла setup.py от cpyrit-opencl-0.4.0:
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright 2008-2011, Lukas Lueg, lukas.lueg@gmail.com
#
# This file is part of Pyrit.
#
# Pyrit is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pyrit is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Pyrit. If not, see <http://www.gnu.org/licenses/>.
from __future__ import with_statement
from distutils.core import setup, Extension
from distutils.command.build_ext import build_ext
from distutils.command.clean import clean
import os
import re
import subprocess
import sys
import zlib
VERSION = '0.4.1-dev'
OPENCL_INC_DIRS = ['/opt/AMDAPPSDK-2.9-1/include']
OPENCL_LIB_DIRS = ["/opt/AMDAPPSDK-2.9-1/lib/x86_64"]
EXTRA_LINK_ARGS = []
LIBRARIES = ['crypto', 'z']
if sys.platform == 'darwin':
# Use the built-in framework on MacOS
EXTRA_LINK_ARGS.extend(('-framework', 'OpenCL'))
OPENCL_INC_DIRS.append('/System/Library/Frameworks/OpenCL.framework/Headers')
else:
LIBRARIES.append('OpenCL')
try:
if os.path.exists(os.environ['ATISTREAMSDKROOT']):
OPENCL_INC_DIRS.append(os.path.join(os.environ['ATISTREAMSDKROOT'], 'include'))
for path in ('lib/x86_64','lib/x86'):
if os.path.exists(os.path.join(os.environ['ATISTREAMSDKROOT'], path)):
OPENCL_LIB_DIRS.append(os.path.join(os.environ['ATISTREAMSDKROOT'], path))
break
except:
pass
for path in ('/usr/local/opencl/OpenCL/common/inc', \
'/opt/opencl/OpenCL/common/inc', \
'/usr/local/opencl/include', \
'/usr/local/cuda/include'):
if os.path.exists(path):
OPENCL_INC_DIRS.append(path)
break
else:
print >>sys.stderr, "The headers required to build the OpenCL-kernel " \
"were not found. Trying to continue anyway..."
# Get exact version-string from svn
try:
svn_info = subprocess.Popen(('svn', 'info'), \
stdout=subprocess.PIPE).stdout.read()
VERSION += ' (svn r%i)' % \
int(re.compile('Revision: ([0-9]*)').findall(svn_info)[0])
except:
pass
EXTRA_COMPILE_ARGS = ['-Wall', '-fno-strict-aliasing', \
'-DVERSION="%s"' % (VERSION,)]
class GPUBuilder(build_ext):
def run(self):
with open("_cpyrit_opencl.h", 'rb') as f:
header = f.read()
with open("_cpyrit_oclkernel.cl", 'rb') as f:
kernel = f.read()
oclkernel_code = header + '\n' + kernel + '\x00'
oclkernel_inc = zlib.compress(oclkernel_code)
with open("_cpyrit_oclkernel.cl.h", 'wb') as f:
f.write("unsigned char oclkernel_packedprogram[] = {")
f.write(",".join(("0x%02X" % ord(c) for c in oclkernel_inc)))
f.write("};\nsize_t oclkernel_size = %i;\n" % len(oclkernel_code))
print "Building modules..."
build_ext.run(self)
class GPUCleaner(clean):
def _unlink(self, node):
try:
if os.path.isdir(node):
os.rmdir(node)
else:
os.unlink(node)
except OSError:
pass
def run(self):
print "Removing temporary files and pre-built GPU-kernels..."
try:
for f in ('_cpyrit_oclkernel.cl.h',):
self._unlink(f)
except Exception, (errno, sterrno):
print >>sys.stderr, "Exception while cleaning temporary " \
"files ('%s')" % sterrno
clean.run(self)
opencl_extension = Extension('cpyrit._cpyrit_opencl',
libraries = LIBRARIES,
sources = ['_cpyrit_opencl.c'],
include_dirs = OPENCL_INC_DIRS,
library_dirs = OPENCL_LIB_DIRS,
extra_compile_args = EXTRA_COMPILE_ARGS,
extra_link_args = EXTRA_LINK_ARGS)
setup_args = dict(
name = 'cpyrit-opencl',
version = VERSION,
description = 'GPU-accelerated attack against WPA-PSK authentication',
long_description = \
"Pyrit allows to create massive databases, pre-computing part " \
"of the 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, OpenCL " \
"and VIA Padlock, it is currently by far the most powerful " \
"attack against one of the world's most used security-protocols.",
license = 'GNU General Public License v3',
author = 'Lukas Lueg',
author_email = 'lukas.lueg@gmail.com',
url = 'http://pyrit.googlecode.com',
classifiers = \
['Development Status :: 4 - Beta',
'Environment :: Console',
'License :: OSI Approved :: GNU General Public License (GPL)',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Security'],
platforms = ['any'],
ext_modules = [opencl_extension],
cmdclass = {'build_ext': GPUBuilder, 'clean': GPUCleaner},
options = {'install': {'optimize': 1}, \
'bdist_rpm': {'requires': 'pyrit = 0.4.0-1'}}
)
if __name__ == "__main__":
setup(**setup_args)