python暴力破解zip密码文件

用的是3.6,要记住密码,会删除掉~!!!!!!

#!/usr/bin/python

import zipfile
import threading


def extractfile(zFile, password):
    try:
        zFile.extractall(path='./', pwd=password)
        #写入压缩文件名
        print('test.zip')
        print('password:' + password.decode() + '\n')


    except:
        pass


def main():
    print('start')
##写入压缩文件名
    zFile = zipfile.ZipFile('test.zip')
#打开字典
    password_file = open('1.txt')


    for line in password_file.readlines():
        password = line.strip('\n')
        # index = extractfile(zFile, password.encode())
        # if index == 0:
        #     break
        t = threading.Thread(target=extractfile, args=(zFile, password.encode()))
        t.start()


if __name__ == '__main__':
    main()


# zFile = zipfile.ZipFile('1.zip')
# zFile.extractall(path='./', pwd='123'.encode())

你可能感兴趣的:(Python)