DEV Community

David Disu
David Disu

Posted on

How to crack a 7z zip file on kali linux

Cracking Password-Protected 7z Archives with John the Ripper

Before starting, ensure your system is updated and the necessary utilities are installed:
sudo apt update && sudo apt install john john-data p7zip-full -y


Step 1: Extract the Archive Hash

John the Ripper cannot crack a .7z file directly. You must first extract the password hash into a format that John understands. We use the 7z2john utility for this.

Extract hash

Command:
7z2john secrets.7z > secret_hash.txt


Step 2: Crack the Hash with a Wordlist

Once you have the hash file, use a wordlist (like the standard rockyou.txt) to attempt to crack the password.

crack hash

Command:
john --wordlist=/usr/share/wordlists/rockyou.txt secret_hash.txt

If successful, John will display the cleartext password in the terminal. You can view it again later using the --show flag:
john --show secret_hash.txt


Step 3: Extract the Protected Files

Now that you have the password, use the 7z utility to extract the contents of the archive.

documents revealed

Command:
7z x secrets.7z and password: butterfly

When prompted, enter the password you cracked in the previous step. Your files will be extracted to the current directory.

Top comments (0)