Crack Passwords using John the Ripper with Multiple CPU Cores (OpenMP)

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 on which you should use John the Ripper is UNIX, I personally prefer running john on Debian x86_64.

Let’s try some simple steps to enable and illustrate the new feature

$ wget

$ tar -xvzf john-1.7.9.tar.gz

  • Now let’s make some changes inside 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. So, because 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

At this stage, John should now 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. That's because I requested 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 the status for the current task

./john --status

  • Display the plain passwords (cracked hashes)

./john --show hash_file

Let’s see if you can crack some of my UNIX accounts


Have fun with my friend John!

Related terms:

Mobile Application Security Engineering Lead & SME | 0076 7E64 293A E3EC 542B 9C72 3A11 417C B43F DB1A