[python]代码库
#-*-coding utf-8-*-
#-----------------------------------
# python2.7
# description:暴力破解有密码的zip文件
#-------------------------------------
import zipfile
import os
from threading import Thread
import time
#压缩文件的路径
path = r'C:\Users\Administrator\Desktop\moeMaid-master.zip'
#password='1234'
def pojie_zip(path,password):
if path[-4:]=='.zip':
#path = dir+ '\\' +file
#print path
zip = zipfile.ZipFile(path, "r",zipfile.zlib.DEFLATED)
#print zip.namelist()
try:
#若解压成功,则返回True,和密码
zip.extractall(path='C:\\Users\\Administrator\\Desktop\\',members=zip.namelist() , pwd=password)
print ' ----success!,The password is %s' % password
zip.close()
return True
except:
pass #如果发生异常,不报错
print 'error'
def get_pass():
#密码字典的路径
passPath='C:\\Users\\Administrator\\Desktop\\zip.txt'
passFile=open(passPath,'r')
for line in passFile.readlines():
password=line.strip('\n')
print 'Try the password %s' % password
if pojie_zip(path,password):
break
passFile.close()
if __name__=='__main__':
start=time.clock()
get_pass()
print "done (%.2f seconds)" % (time.clock() - start)
初级程序员
by: 云代码会员 发表于:2022-12-29 16:25:19 顶(0) | 踩(0) 回复
nice
回复评论