2015-12-04 14:47:52 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Author: Gabriele Gristina <matrix@hashcat.net>
|
2016-01-01 16:41:03 +00:00
|
|
|
# Revision: 1.03
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
## global vars
|
2016-01-24 15:39:51 +00:00
|
|
|
DEPS="make gcc g++ gcc-multilib g++-multilib libc6-dev-i386 mingw-w64 build-essential unzip opencl-headers ocl-icd-libopencl1 dos2unix"
|
2016-01-03 12:17:14 +00:00
|
|
|
DEPS_AMD_DEV="ocl-icd-opencl-dev"
|
2016-01-24 15:39:51 +00:00
|
|
|
DOWNLOAD_DEPS="ADL_SDK9.zip R352-developer.zip gdk_linux_amd64_352_55_release.run"
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2015-12-09 14:55:06 +00:00
|
|
|
## enter the deps directory
|
2015-12-09 12:33:21 +00:00
|
|
|
cur_directory=$(dirname ${0})
|
|
|
|
script_directory=$(cd ${cur_directory} && pwd -P)
|
2015-12-09 14:55:06 +00:00
|
|
|
deps_dir=${script_directory}/../deps
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2015-12-09 14:55:06 +00:00
|
|
|
mkdir -p ${deps_dir} # but it should already exist (is part of the repository)
|
|
|
|
cd ${deps_dir}
|
2015-12-09 12:33:21 +00:00
|
|
|
|
2015-12-09 14:55:06 +00:00
|
|
|
## cleanup the directories under the 'deps' folder
|
2016-01-03 12:17:14 +00:00
|
|
|
rm -rf {adl-sdk*,nvidia-gdk,R352-developer} && \
|
2016-01-03 13:32:50 +00:00
|
|
|
mkdir -p {tmp,adl-sdk,nvidia-gdk,R352-developer} && \
|
2015-12-09 12:33:21 +00:00
|
|
|
cd tmp/
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if [ $? -ne 0 ]; then
|
2015-12-09 14:55:06 +00:00
|
|
|
echo "! Cannot create deps directories."
|
2015-12-06 10:29:29 +00:00
|
|
|
exit 1
|
2015-12-04 14:47:52 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
## check dependencies
|
|
|
|
i=0
|
|
|
|
for d in ${DOWNLOAD_DEPS}; do
|
2015-12-06 10:29:29 +00:00
|
|
|
if [ ! -f "${d}" ]; then
|
|
|
|
echo "! ${d} not found."
|
|
|
|
((i++))
|
|
|
|
fi
|
2015-12-04 14:47:52 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
if [ ${i} -gt 0 ]; then
|
2015-12-09 14:55:06 +00:00
|
|
|
echo "! Please manually download all the above dependencies to the deps/tmp/ directory"
|
2015-12-06 10:29:29 +00:00
|
|
|
exit 1
|
2015-12-04 14:47:52 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
## installing needed packages
|
|
|
|
for pkg in ${DEPS}; do
|
2015-12-09 12:33:21 +00:00
|
|
|
|
|
|
|
# check if the package is already installed
|
|
|
|
dpkg -s ${pkg} &>/dev/null
|
2015-12-06 10:29:29 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
2016-01-24 15:39:51 +00:00
|
|
|
sudo apt-get -y install ${pkg}
|
2015-12-09 12:33:21 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "! failed to install ${pkg}"
|
|
|
|
exit 1
|
|
|
|
fi
|
2015-12-06 10:29:29 +00:00
|
|
|
fi
|
2015-12-04 14:47:52 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
## extract ADL SDK
|
2016-01-24 15:39:51 +00:00
|
|
|
unzip ADL_SDK9.zip -d ${deps_dir}/adl-sdk-9
|
2015-12-04 14:47:52 +00:00
|
|
|
ret=$?
|
|
|
|
|
|
|
|
if [[ ${ret} -ne 0 ]] && [[ ${ret} -ne 1 ]]; then
|
2015-12-06 10:29:29 +00:00
|
|
|
echo "! failed to extract ADL SDK"
|
|
|
|
exit 1
|
2015-12-04 14:47:52 +00:00
|
|
|
fi
|
|
|
|
|
2016-01-24 15:39:51 +00:00
|
|
|
rm -rf ${deps_dir}/adl-sdk && ln -s ${deps_dir}/adl-sdk-9 ${deps_dir}/adl-sdk
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if [ $? -ne 0 ]; then
|
2015-12-06 10:29:29 +00:00
|
|
|
echo "! failed to setup ADL SDK link"
|
|
|
|
exit 1
|
2015-12-04 14:47:52 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
## extract NVAPI
|
2015-12-09 14:55:06 +00:00
|
|
|
unzip R352-developer.zip -d ${deps_dir}
|
2015-12-04 14:47:52 +00:00
|
|
|
ret=$?
|
|
|
|
|
|
|
|
if [[ ${ret} -ne 0 ]] && [[ ${ret} -ne 1 ]]; then
|
2015-12-06 10:29:29 +00:00
|
|
|
echo "! failed to extract NVAPI"
|
|
|
|
exit 1
|
2015-12-04 14:47:52 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
## install NVIDIA GPU Deployment Kit
|
|
|
|
chmod +x gdk_linux_amd64_352_55_release.run && \
|
2015-12-09 14:55:06 +00:00
|
|
|
./gdk_linux_amd64_352_55_release.run --silent --installdir=${deps_dir}/nvidia-gdk
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if [ $? -ne 0 ]; then
|
2015-12-06 10:29:29 +00:00
|
|
|
echo "! failed to install NVIDIA GPU Deployment Kit"
|
|
|
|
exit 1
|
2015-12-04 14:47:52 +00:00
|
|
|
fi
|
|
|
|
|
2016-01-03 12:17:14 +00:00
|
|
|
## check if libOpenCL.so is available (and if not install DEPS_AMD_DEV)
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-03 12:17:14 +00:00
|
|
|
ls /usr/lib/*/libOpenCL.so &> /dev/null
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if [ $? -ne 0 ]; then
|
2016-01-24 15:39:51 +00:00
|
|
|
sudo apt-get -y install ${DEPS_AMD_DEV}
|
2016-01-03 12:17:14 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "! failed to install ${DEPS_AMD_DEV}"
|
|
|
|
exit 1
|
|
|
|
fi
|
2015-12-04 14:47:52 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "> oclHashcat dependencies have been resolved."
|