Crack zip file passwords in Kali Linux using John the Ripper

In this article you will learn, how to create encrypted zip files in linux machine. As well as if there is any encrypted zip file then how you will be able to crack it’s password using the “John the Ripper Tool”.

Crack zip file passwords in Kali Linux using John the Ripper
Crack zip file passwords in Kali Linux using John the Ripper

If you want to create a new zip file for the folder /var/log you can use the following command:

zip -er filename.zip /var/log

The above command will ask you to enter a new password and after entering it, it will create a new zip archive called filename.zip in the present working directory.

You can try to unzip content of newly created file using the following command:

unzip filename.zip

Suppose you forgot the password that you have created for this file then you will have to break it. For that we are going to use Kali Linux OS and it’s pre-installed tool called “John the Ripper”.

Before using this tool we need to generate a dictionary file which contains list of possible password combinations.

crunch 3 6 0123456789 -o dictionary.txt

The above command will create a new file dictionary.txt which will contain minimum 3 digit to maximum 6 digit length of password combination which contains numerical from 0 to 9.

Once the dictionary is generated then you can get the hash values from the newly created zip using the following command:

zip2john filename.zip > hash.txt

It will create a new file hash.txt which will contain file name and it’s hash value which we are going to crack.

Now let’s try to crack the hashes with our password combinations:

john — wordlist=dictionary.txt hash.txt

This will crack the password of the zip file. If you want to display the password from the hash.txt without re-cracking it then use the following command:

john hash.txt — show

If you try to crack password using the next command then it will use default dictionary /usr/share/john/password.lst to crack the password

john hash.txt

I hope you like this article, for more articles you can follow my profile.

Video Tutorial on YouTube

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store