Most times we find ourselves having zip files that are password protected. In this tutorial, I am going to show you how we can use python to crack the password.
- First we are going encrypt the sample file “test.txt” with the password – “pass” and save the zip file as “sample.zip”
- For cracking the password we going to use the password list from the text file (you can use the rockyou text file in the Kali Linux)
- Open the IDE and paste the below code
a=input(“Enter the file name with the extension”)
for i in passfile:
b = bytes(i, ‘utf-8’)
print(“Currently in process”)
- We are using the zipline library for handling the zip file
- We are using the variable a to read the file name.
- Using passfile variable we are going to open the file which contain the list of passwords.
- Using for loop we check for every possible combination of the password and the correct password will be displayed when found.