Skip to content

Instantly share code, notes, and snippets.

@ndsamuelson
Created December 4, 2021 12:25
Show Gist options
  • Save ndsamuelson/d78d78332f55d681bc64a7a07181e1e2 to your computer and use it in GitHub Desktop.
Save ndsamuelson/d78d78332f55d681bc64a7a07181e1e2 to your computer and use it in GitHub Desktop.
Crack zip files with wordlist
"""[summary]
"""
from tqdm import tqdm
import zipfile
protected_file = input("Zip file: ")
wordlist = input("Choose wordlist: ")
try:
zip_file = zipfile.ZipFile(protected_file)
n_pass = len(list(open(wordlist, "rb")))
except:
print("\a")
print("Not a zip file. Exiting...")
exit(0)
print("Number of password that will be checked:", n_pass)
print('\n')
with open(wordlist, "rb") as wordlist:
for word in tqdm(wordlist, total=n_pass, unit='word'):
try:
zip_file.extractall(pwd=word.strip())
except:
continue
else:
print("\a")
print("[+] Password Found:", word.decode().strip())
print("\a")
print('Exiting...')
exit(0)
print("\a")
print("[X] Password not found in the wordlist, try another one")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment