How to use John to crack zip file?
How to use John to crack a zip file?
Table of contents:-
- What are password-protected zip files
- Preparation for cracking
- cracking
1) What are password-protected zip files?
2) Preparations for Cracking
1) Updating the System
2) Downloading some essential tools
you have to install the wordlist & john tool... The wordlist contains the password we are going to brute-force the password-protected file's hash...
3) Cracking
1) Getting the hash of the password-protected file
2) Cracking the hash of the password-protected file
cd /usr/share/wordlists/
Inside this directory, you will find a file named rockyou.txt.gz. RockYou is the list of most used passwords by the people there are 14 million passwords in the RockYou file.
But in order to use that file, we first have to extract it, for there is a tool named gzip, it comes pre-installed.
Above is the help section for the gzip command, for our purpose we will be using the switches.
Now as you can see above, we also have a file rockyou.txt which we can use in our hash-cracking.gzip -kd rockyou.txt.gz
Now we are actually cracking the hash using the john tool.
As you can see in the above example, the command contains the tool john the wordlist rockyou & the file where the password is stored zip.hashjohn --wordlist=/usr/share/wordlists/rockyou.txt zip.hash
In simple words, the above command is saying 'john take the wordlist rockyou.txt and crack the hash in the zip.hash file using the RockYou file"
As you can also see that we have got the password for our password-protected zip file, it was a easy password it it took a second to crack it, but if it has more complex passwords then it can be a time taking process, or you might never get the password if it is not encluded in the rockyou.txt file.
3) Unzipping the file with the password we got
Now it's the moment of truth, we are going to unzip the password-protected file using the password we have got by cracking the hash.
As you can see, we have successfully extracted the file ( Note:- I have used the -P "password" just for your understanding it is not a best practice to extract a password-protected file as anyone who has the access to the machine can see the history). Instead, use the switchunzip -e encrypted_file.zip
This will give you a prompt to enter a password