The police in the Netherlands are looking for digital detectives. I don’t have an interest to become one, but to find qualified people the police have created a challenge: https://www.cybercrimechallenge.nl/. I like challenges. To make a long story short: I need to get a password for a truecrypt container. I decided to use truecrack as it runs from the command line. To make it faster I wanted to use CUDA. It was rather hard to find how to install it with my current operating system, so I document the steps here in the hope it is useful to somebody. I use a 64bit version of Ubuntu’s development release, so on a 32bit operating system some steps may be slightly different.
Much of the info came from a post on installing CUDA on 12.04. However, recent versions of Ubuntu have a kernel compiled with gcc version 4.7, but CUDA does not support gcc 4.7. Therefore some extra steps are necessary, as outlined below.
First remove all NVIDA modules you may have installed and install needed modules:
sudo apt-get remove nvidia* sudo apt-get install freeglut3 freeglut3-dev build-essential \ libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx \ libglu1-mesa libglu1-mesa-dev gcc g++ gcc-4.4 g++-4.4 \ linux-headers-generic linux-source
Now you have two versions of gcc on your system. By default v4.7 is used. We need to make this configurable:
sudo update-alternatives --remove-all gcc sudo update-alternatives --config gcc sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 20 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 50
Add these modules to /etc/modprobe.d/blacklist.conf:
blacklist amd76x_edac blacklist vga16fb blacklist nouveau blacklist rivafb blacklist nvidiafb blacklist rivatv
To install the CUDA examples an extra link to libglut3 is needed:
sudo ln -s /usr/lib/x86_64-linux-gnu/libglut.so.3 /usr/lib/libglut.so
With the prerequisites ready, it is time to download the necessary installation files. You need the CUDA install file for Ubuntu 11.10 version from the CUDA downloads page. The graphics driver included with that package won’t compile with recent kernels, so you’ll also need a recent driver from the NVIDIA Unix drivers download page. I used the latest, version 310.40.
Drop into a text console (alt-ctrl-F1) and shut down the graphical interface:
sudo /etc/init.d/lightdm stop
verify that the gcc version is 4.7.x, if not, select the right version:
sudo update-alternatives --config gcc #choose 4.7.x
Now install the graphics driver. This should be plain sailing, just accept the defaults and let it do its work.
sudo chmod +x ./NVIDIA-Linux-x86_64-310.40.run sudo ./NVIDIA-Linux-x86_64-310.40.run
Next switch to gcc version 4.4.x:
sudo update-alternatives --config gcc #choose 4.4.x
Next, install CUDA. Accept the license and install CUDA and it’s examples (if desired), but do not install the graphics driver.
sudo chmod +x ./cuda_5.0.35_linux_64_ubuntu11.10-1.run sudo ./cuda_5.0.35_linux_64_ubuntu11.10-1.run
Add “/usr/local/cuda-5.0/bin” to your path and create a file /etc/ld.so.conf.d/cuda.conf with contents:
As root run ldconfig and you’re set. Next restart lightdm or reboot to get back to your desktop. The examples included with the installation files run perfectly. However, in the end, this exercise was to no avail to me. A simple test run with truecrypt container and a short dictionary showed me that truecrack worked perfectly if slowly using just the CPU. Compiled with CUDA support It didn’t find the right passphrase. In other words, the program only runs slowly. Bummer.
UPDATE: john the ripper works with CUDA if the correct flags are applied:
JOHN_CFLAGS='-L/usr/lib/x86_64-linux-gnu -lstdc++' make linux-x86-64-cuda
“/opt/john-cuda/john –format=sha512crypt-cuda passwords.file” is about 11 to 12 times faster than the cpu version (GTX560 vs i7-2600): c/s:312 vs c/s:3670 over longer periods.