-
Notifications
You must be signed in to change notification settings - Fork 0
/
rockzip.py
169 lines (102 loc) · 3.66 KB
/
rockzip.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
import zipfile
COLORS = {\
"black":"\u001b[30;1m",
"red": "\u001b[31;1m",
"green":"\u001b[32m",
"yellow":"\u001b[33;1m",
"blue":"\u001b[34;1m",
"magenta":"\u001b[35m",
"cyan": "\u001b[36m",
"white":"\u001b[37m",
"yellow-background":"\u001b[43m",
"black-background":"\u001b[40m",
"cyan-background":"\u001b[46;1m",
}
def colorText(text):
for color in COLORS:
text = text.replace("[[" + color + "]]", COLORS[color])
return text
bannr = """"
[[red]] ____ __ [[green]] _____ _ [[white]]
[[red]] / __ \____ _____/ /_[[green]]/__ / (_)___ [[white]]
[[red]] / /_/ / __ \/ ___/ //_/[[green]] / / / / __ \[[white]]
[[red]] / _, _/ /_/ / /__/ ,< [[green]] / /__/ / /_/ /[[white]]
[[red]]/_/ |_|\____/\___/_/|_| [[green]]/____/_/ .___/ [[white]]
[[red]] [[green]] /_/ [[white]]
"""
banner = colorText(bannr)
fail = "[[red]]Failed[[white]]"
failed = colorText(fail)
succes = "[[green]][+] Password found:[[white]]"
succsesfull = colorText(succes)
oki = "[[white]] => [[white]]"
ok = colorText(oki)
print(banner)
zip_file = input("Your zip file : ")
x = input("Wanna use our wordlist? Y/n: ")
#1
def crack_password1(password_list, obj):
# tracking line no. at which password is found
idx = 0
# open file in read byte mode only as "rockyou.txt"
# file contains some special characters and hence
# UnicodeDecodeError will be generated
with open(password_list, 'rb') as file:
for line in file:
for word in line.split():
try:
idx += 1
obj.extractall(pwd=word)
print("Password found at line", idx)
print(succsesfull+ ok+word.decode())
return True
except:
continue
return False
password_list = "wordlist.txt"
# ZipFile object initialised
obj = zipfile.ZipFile(zip_file)
# count of number of words present in file
#2
def crack_password2(password_list, obj):
# tracking line no. at which password is found
idx = 0
# open file in read byte mode only as "rockyou.txt"
# file contains some special characters and hence
# UnicodeDecodeError will be generated
with open(password_list, 'rb') as file:
for line in file:
for word in line.split():
try:
idx += 1
obj.extractall(pwd=word)
print("Password found at line", idx)
print(succsesfull+ ok+word.decode())
return True
except:
continue
return False
# ZipFile object initialised
obj = zipfile.ZipFile(zip_file)
if x == "y":
password_list1 = "wordlist.txt"
cnt = len(list(open(password_list, "rb")))
print("There are total", cnt,
"number of passwords to test")
if crack_password1(password_list1 , obj) == False:
print("Password not found in this file")
elif x == "n":
z = input("Your worlist url: ")
password_list = z
cnt = len(list(open(password_list, "rb")))
print("There are total", cnt,
"number of passwords to test")
if crack_password2(password_list , obj) == False:
print("Password not found in this file")
else:
password_list1 = "wordlist.txt"
cnt = len(list(open(password_list1, "rb")))
print("There are total", cnt,
"number of passwords to test")
if crack_password1(password_list1 , obj) == False:
print("Password not found in this file")