Password Cracker program coded in C++ Language
by applying Brute Force Algorithm
and Parallelizing
it using MPI and OpenMP. You can look at detailed description Here.
-
Copy the content of
/etc/shadow
into a fileshadow.txt
and place it into your current working directory:sudo cat /etc/shadow > shadow.txt
-
Use following command to
Compile the Code
:mpic++ -fopenmp main.cpp -lcrypt -o main
-
Create a file named as
machinefile
in your current working directory:touch machinefile
-
The
machinefile
should have the hostname of your pc and the number of processes you want to run on it in parallel i.e, sameet is the hostname of my pc and I want to run 5 processes in parallel. So, its format should be like:sameet:5
-
Use following commands to
Execute the Code
. Here 5 represents total number of processes to create:mpiexec -n 5 -f machinefile ./main
- The
/etc/shadow
file stores all the users of the pc and their respective passwords in encryped form. - The encryption of their passwords are done using
SHA-512 Algorithm
in Ubuntu Linux. - We can encrypt any string using the
crypt()
function fromcrypt.h Library
. It returns us Salt and Encyrpted Password both in a single appended string. It requires two arguments:- The string to encrypt.
- The salt used to encrypt the string.
- We can extract the salt used to encrypt the password from
shadow
file and then use it to encrypt all the strings obtained from brute force and compare with the password. - In
shadow
file, the username, salt, and password are stored in the following format:Username
before first:
- Then
Salt
until three$
signs - And
Encrypted Password
after that