Crack Passwords using John the Ripper with Multiple CPU Cores (OpenMP)
by Thireus on Dec.05, 2011, under Crack1ng, Guides and tutorials, Hack1ng. 12,420 views

John the Ripper is a fast and famous password cracker.
John can break many password hashes, but one of the primary missing feature was the CPU multiple core support. But today, John the Ripper 1.7.9 supports OpenMP which brings Multi-Processing. Of course this feature was present on some patched versions of John, but since the 1.7.9 version it is officially integrated.
One of the best platform where you should use John the Ripper is UNIX, I personally prefer using john on Debian x86_64.
Let’s try some simple steps to enable and illustrate the new feature
- First go to http://www.openwall.com/john/, and download the latest version. When I write this article the latest stable release was 1.7.9.
$ wget http://www.openwall.com/john/g/john-1.7.9.tar.gz $ tar -xvzf john-1.7.9.tar.gz
- Now let’s make some changes into the Makefile to enable the use of OpenMP
$ cd john-1.7.9/src/ john-1.7.9/src$ nano Makefile
- Locate the following lines
# gcc with OpenMP #OMPFLAGS = -fopenmp #OMPFLAGS = -fopenmp -msse2
- Uncomment OMPFLAGS
# gcc with OpenMP OMPFLAGS = -fopenmp OMPFLAGS = -fopenmp -msse2
- Before compiling john, make sure you have gcc installed! Now, let’s compile john.
john-1.7.9/src$ make
This command will list all the systems where john can be compiled on. As I’m running Debian x86_64, I will choose linux-x86-64.
john-1.7.9/src$ make linux-x86-64
John should be located in the ../run folder.
- Let’s try John
john-1.7.9/src$ cd ../run/ john-1.7.9/run$ ./john --test
Some benches should appear…
Benchmarking: Traditional DES [128/128 BS SSE2-16]... DONE Many salts: 7651K c/s real, 3872K c/s virtual Only one salt: 6876K c/s real, 3487K c/s virtual
And John might use all your CPU cores.
- Now let’s do something fun, if you want John to use a certain amount of cores you can adjust it with the environment variable OMP_NUM_THREADS:
john-1.7.9/run$ OMP_NUM_THREADS=1 ./john --test
Benchmarking: Traditional DES [128/128 BS SSE2-16]... DONE Many salts: 3982K c/s real, 3990K c/s virtual Only one salt: 3770K c/s real, 3770K c/s virtual
As you can see, this bench is twice slower than the previous one. Because I asked OpenMP to use only one core on my dual-core CPU.
Feel free to adjust the number of cores you want to use with OMP_NUM_THREADS
Three other quick tips regarding John the Ripper
- Restore your previous job in background
./john --restore &> /dev/null &
- Get status for the current task
./john --status
- Show cracked passwords
./john --show hash_file
Let’s see if you can crack some of my UNIX accounts
baby:$6$rc7o1BLw$Qsl9hnQx7W3C3KDagDkWXAXDx0vDWqwM0BOOeQyotXzCvUs6DeijTp3zBsbjCw4ou2OoJXKf6qNC5pEGEsjZF/ mat:$6$Ajsi.AJy$GdZ3iGYzaUk.NoTkGrSpTotskDyg3FIrBMjya7un.WE4r.P/RdhwRb2e6mmdJWZrLHgNuCc1CUEVtj5l4qVec1 milou:$6$UYj2H.Jq$ChyawjKf3XQVftrVpnDEsFFph1P0pElDv3GuBXXTy2ICbB3oVE/6mhyo3poCD532B03fYMSWgR3D7E.qFyXnk/ superman:$6$8HZYSst1$F/8U5nPD9grY/kaC3jWVZcqdawRsa3t9PKKWSI6MZwR9T2vCs8jxWajx7vYcHtSPe0FbIf8LnMDJESTrmaAx7. toto:$6$Mzwiuppo$4aSvxLcbDD7hhnWj9vr9js7/VZ5hNhrq/b07PVfMc9Y4SeNMNtHci8XYUTAxF7c3qv3uHqByKzdFPAV3KBBog0 master:$6$Jyv/bLLH$wC1eBBFpPclSwNuS5Lkj1ciqZCtO4d/FQ/8RuWrHRejvAZSn4zSmGDaTYwwgOofytlhwTHD8vE3QuqRYmFdKj0
Have fun with my friend John
March 31st, 2012 on 4:10 am
you are my best friend
April 18th, 2012 on 5:33 am
CPU usage for john went from 98% to 398%, THANK YOU.
June 6th, 2012 on 5:50 pm
As far as I can tell, John is only using OMP for some ciphers not all. Is there a way to fix this?
June 6th, 2012 on 6:04 pm
Hi, unfortunately no, unless you develop your own OMP enabled algorithms.
But I recommend you to use the MPI feature, which splits the work and takes advantage of all your CPU local/remote cores for any algorithms.
Read more about how to use MPI here: “Step by step instructions for grilling the perfect steak… with MPI enabled barbecue” http://blog.thireus.com/john-the-ripped-steak-and-french-fries-with-salt-and-pepper-sauce-for-hungry-password-crackers
Hope it helps
September 27th, 2012 on 2:35 am
Ok, I saved your UNIX accounts you’ve shared and when I load them into John, I get “No password hashes loaded”. Any idea why?
September 27th, 2012 on 3:57 pm
Which version of John do you use?
September 27th, 2012 on 6:04 pm
1.7.3.1 for Mac. I’m testing against a bunch of hashes I’ve made based on old passwords, your user/passes you shared, and the plist files from my mac. I’m letting John run for 24 hours, and then I’m going to see what I can do about creating a cluster for cracking. I dreamed of John all night last night. Pretty good dreams.
September 27th, 2012 on 11:50 pm
Uhm… I don’t know this version. Why don’t you try and build the official latest stable release?
May 30th, 2013 on 11:06 pm
If I don’t specify OMP_NUM_THREADS=2 when running John, it will use only one core? Why is that, if I compiled according to instructions?
May 30th, 2013 on 11:12 pm
If you do not specify OMP_NUM_THREADS it should use all cores, and not only one. If this is not the case then the core number detection by OpenMP fails somehow. Which platform are you using?
http://stackoverflow.com/questions/8368686/openmp-behaviour-detecting-cpu-and-thread
June 7th, 2013 on 12:59 am
Can this be used to crack on GPUs on different systems as well?
June 7th, 2013 on 8:38 am
Not GPU. OpenMP only applies for CPU.