-
Notifications
You must be signed in to change notification settings - Fork 18
/
zcrack.py
131 lines (128 loc) · 5.45 KB
/
zcrack.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import os
import platform
import time
print("[*] Checking Requirements Module....")
def header():
ascii_banner = pyfiglet.figlet_format("{ZIP CRACKER}").upper()
print(colored(ascii_banner.rstrip("\n"), 'cyan', attrs=['bold']))
print(colored(" <Coded By: Clay> \n", 'yellow', attrs=['bold']))
print(colored(" <Version: 2.0> \n", 'magenta', attrs=['bold']))
return
if platform.system().startswith("Windows"):
try:
from tqdm import tqdm
except ImportError:
os.system("python -m pip install tqdm -q -q -q")
from tqdm import tqdm
try:
import termcolor
except ImportError:
os.system("python -m pip install termcolor -q -q -q")
import termcolor
from termcolor import colored
try:
import pyfiglet
except ImportError:
os.system("python -m pip install pyfiglet -q -q -q")
import pyfiglet
elif platform.system().startswith("Linux"):
try:
from tqdm import tqdm
except ImportError:
os.system("python3 -m pip install tqdm -q -q -q")
from tqdm import tqdm
try:
import termcolor
except ImportError:
os.system("python3 -m pip install termcolor -q -q -q")
import termcolor
from termcolor import colored
try:
import pyfiglet
except ImportError:
os.system("python3 -m pip install pyfiglet -q -q -q")
import pyfiglet
def linuxpdf():
os.system("clear")
header()
zip_filename = input(termcolor.colored("[*] Enter Path Of Your zip file:- ", 'cyan'))
if not os.path.exists(zip_filename):
print(termcolor.colored("\n[ X ] File " + zip_filename + " was not found, Provide Valid FileName And Path!",
'red'))
exit()
print(termcolor.colored("\n[*] Analyzing Zip File:- ", 'blue'), zip_filename)
time.sleep(1)
if zip_filename[-3:] == "zip":
print(termcolor.colored("\n[ ✔ ] Valid ZIP File Found...", 'green'))
else:
print(termcolor.colored("\n[ X ] This is not a valid .zip file...\n", 'red'))
exit()
pwd_filename = input(termcolor.colored("\nEnter Path Of Your Wordlist:- ", 'yellow'))
if not os.path.exists(pwd_filename):
print(termcolor.colored("\n[ X ] File " + pwd_filename + " was not found, Provide Valid FileName And Path!",
'red'))
exit()
with open(pwd_filename, "rb") as passwords:
passwords_list = passwords.readlines()
total_passwords = len(passwords_list)
my_zip_file = zipfile.ZipFile(zip_filename)
for index, password in enumerate(passwords_list):
try:
my_zip_file.extractall(path="Extracted Folder", pwd=password.strip())
print(colored("\n{***********************SUCCESS***********************}", 'green'))
print(colored("[ ✔ ] ZIP FILE Password Found:- ", 'cyan'), password.decode().strip())
break
except:
helo = round((index / total_passwords) * 100, 2)
if helo == '100%':
print(colored("[ X ] ALL ATTEMPTS FAILED", 'red'))
else:
print(colored(f"[*] Trying password:- {password.decode().strip()} ", 'green'))
continue
def winpdf():
os.system("cls")
header()
zip_filename = input(termcolor.colored("Enter Path Of Your zip file:- ", 'cyan'))
if not os.path.exists(zip_filename):
print(termcolor.colored("\n[ X ] File " + zip_filename + " was not found, Provide Valid FileName And Path!",
'red'))
exit()
print(termcolor.colored("\n[*] Analyzing Zip File:- ", 'blue'), zip_filename)
time.sleep(2)
if zip_filename[-3:] == "zip":
print(termcolor.colored("\n[ ✔ ] Valid ZIP File Found...", 'green'))
else:
print(termcolor.colored("\n[ X ] This is not a valid .zip file...\n", 'red'))
exit()
pwd_filename = input(termcolor.colored("\nEnter Path Of Your Wordlist:- ", 'yellow'))
if not os.path.exists(pwd_filename):
print(termcolor.colored("\n[ X ] File " + pwd_filename + " was not found, Provide Valid FileName And Path!",
'red'))
exit()
with open(pwd_filename, "rb") as passwords:
passwords_list = passwords.readlines()
total_passwords = len(passwords_list)
my_zip_file = zipfile.ZipFile(zip_filename)
for index, password in enumerate(passwords_list):
try:
my_zip_file.extractall(path="Extracted Folder", pwd=password.strip())
print(colored("\n{***********************SUCCESS***********************}", 'green'))
print(colored("[ ✔ ] ZIP FILE Password Found:- ", 'cyan'), password.decode().strip())
break
except:
helo = round((index / total_passwords) * 100, 2)
if helo == '100%':
print(colored("[ X ] ALL ATTEMPTS FAILED", 'red'))
else:
print(colored(f"[*] Trying password:- {password.decode().strip()} ", 'green'))
continue
def catc():
try:
if platform.system().startswith("Linux"):
linuxpdf()
elif platform.system().startswith("Windows"):
winpdf()
except KeyboardInterrupt:
print(termcolor.colored("\nYou Pressed The Exit Button!", 'red'))
quit()
catc()