Fork me on GitHub

python暴力破解zip压缩文件密码

最近学习想玩点比较有意思的,然后刚好看了Violent Python这本书,就写个这个
脚本。

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
import zipfile
from threading import Thread
filePath = input("请输入需要爆破的zip文件路径:")
dictPath = input("请输入爆破所需的字典路径:")
def extractFile(zFile, password):
try:
zFile.extractall(pwd=password.encode('ascii'))
print("Found Passwd:", password)
print('Password=', password)
return password
except Exception as e:
pass
def main():
zFile = zipfile.ZipFile(filePath)
passFile = open(dictPath)
for line in passFile.readlines():
password = line.strip('\n')
t = Thread(target=extractFile, args=(zFile, password))
t.start()
if __name__ == '__main__':
main()