一个跑字典破解ZIP密码的Python3脚本

穷举ZIP密码-脚本如下

脚本如下

For ZIP

需要zipfile库

1
pip3 install zipfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#程序来自
#https://www.jb51.net/article/131149.htm
#部分做修改

import zipfile

zipname = "1.zip" #要破解的ZIP名
passwdtxt_name = "pwd.txt" #字典文件

zfile = zipfile.ZipFile(zipname)
passFile=open(passwdtxt_name) #读取你设定的密码文件
for line in passFile.readlines():
try:
password = line.strip('\n') #要修改某些东西可以再这里加
zfile.extractall(path='.', members=zfile.namelist(), pwd=password.encode('utf-8'))
print("密码:{}".format(password))
break
except:
print("又错了")

For RAR

需要unrar库

1
pip3 install unrar

程序如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from unrar import rarfile

rarname = "1.rar" #要破解的RAR名
passwdtxt_name = "pwd.txt" #字典文件

rarf = rarfile.RarFile(rarname)
passFile=open(passwdtxt_name) #读取你设定的密码文件
for line in passFile.readlines():
try:
password = line.strip('\n') #要修改某些东西可以再这里加
rarf.extractall(path=".", pwd=password)
print("密码:{}".format(password))
break
except:
print("又错了")
错误处理

如果报错

1
2
3
4
5
6
7
8
Traceback (most recent call last):
File "1.py", line 1, in <module>
from unrar import rarfile
File "C:\Users\***\AppData\Roaming\Python\Python38\site-packages\unrar\rarfile.py", line 26, in <module>
from unrar import unrarlib
File "C:\Users\***\AppData\Roaming\Python\Python38\site-packages\unrar\unrarlib.py", line 57, in <module>
raise LookupError("Couldn't find path to unrar library.")
LookupError: Couldn't find path to unrar library.

说明缺少UnRAR.dll
下载地址
下载后请安装在默认的文件夹中

配置

将x64文件下的UnRAR64.dll重命名为unrar.dll

1、

2、

3、

如果依然出错

可能是环境变量(UNRAR_LIB_PATH)没有配好

新建一个变量

填上刚刚改过名字的dll文件的地址(如:C:\Program Files (x86)\UnrarDLL\x64\unrar.dll)

重启电脑之后就好了

附上一些弱口令

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
12345
123456
123456789
test1
password
12345678
zinch
g_czechout
asdf
qwerty
1234567890
1234567
Aa123456.
iloveyou
1234
abc123
111111
123123
dubsmash
test
princess
qwertyuiop
sunshine
BvtTest123
11111
ashley
00000
000000
password1
monkey
livetest
55555
soccer
charlie
asdfghjkl
654321
family
michael
123321
football
baseball
q1w2e3r4t5y6
nicole
jessica
purple
shadow
hannah
chocolate
michelle
daniel
maggie
qwerty123
hello
112233
jordan
tigger

987654321
superman
12345678910
summer
1q2w3e4r5t
fitness
bailey
zxcvbnm
fuckyou
121212
buster
butterfly
dragon
jennifer
amanda
justin
cookie
basketball
shopping
pepper
joshua
hunter
ginger
matthew
abcd1234
taylor
samantha
whatever
andrew
1qaz2wsx3edc
thomas
jasmine
animoto
madison
0987654321
54321
flower
Password
maria
babygirl
lovely
sophie
Chegg123
github

记录一下

EOF