ZR-Cracker: Zip & Rar Password Recovery

ZR-Cracker is a tool designed for recovering lost passwords for ZIP and RAR files. It leverages Python libraries to systematically test passwords and determine if a given password is correct.

How to Check a ZIP File Password

The following function verifies if a password is correct for a ZIP file using the pyzipper library. If the password is incorrect, it throws a RuntimeError.

import pyzipper import time def check_zip_password(a, zip_path, password, start_time): try: with pyzipper.AESZipFile(zip_path, 'r') as zf: _ = zf.read(zf.namelist()[0], pwd=password.encode('utf-8')) total_time = time.time() - start_time print("===============================================") print(f"Total time taken ::: {total_time:.2f} seconds") print("Total password tries ::: {}".format(a)) print("Password Found ::: {}".format(password)) print("===============================================") return False except RuntimeError: return True except: time.sleep(4)

How to Check a RAR File Password

This function verifies if a password is correct for a RAR file using the rarfile library. If the password is incorrect, it throws a rarfile.BadRarFile exception.

import rarfile import time def check_rar_password(a, rar_path, password, start_time): with rarfile.RarFile(rar_path) as rf: try: rf.testrar(pwd=password.encode('utf-8')) total_time = time.time() - start_time print("===============================================") print(f"Total time taken ::: {total_time:.2f} seconds") print("Total password tries ::: {}".format(a)) print("Password Found ::: {}".format(password)) print("===============================================") return False except rarfile.BadRarFile: return True except: time.sleep(4)

How to Generate a Random Password

This function generates a random password between 4 and 11 characters using the secrets library. The password contains a mix of letters, numbers, and symbols.

import secrets import string def generate_random_password(): length = secrets.choice(range(4, 11)) characters = string.ascii_letters + string.digits + string.punctuation password = ''.join(secrets.choice(characters) for _ in range(length)) return password

Protecting Your Files

While ZR-Cracker helps recover lost passwords, it's essential to implement strong security measures for protecting your compressed files:

Disclaimer

This tool is intended for educational purposes only. Unauthorized use of password-cracking techniques is illegal. Always use this knowledge responsibly.