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/shadowinto a fileshadow.txtand 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
machinefilein your current working directory:touch machinefile -
The
machinefileshould 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/shadowfile stores all the users of the pc and their respective passwords in encryped form. - The encryption of their passwords are done using
SHA-512 Algorithmin 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
shadowfile and then use it to encrypt all the strings obtained from brute force and compare with the password. - In
shadowfile, the username, salt, and password are stored in the following format:Usernamebefore first:- Then
Saltuntil three$signs - And
Encrypted Passwordafter that