#coding=utf8
import zipfile
from threading import Thread
import argparse
def extractFile (zFile,password):
try:
zipfile.extractall(pwd = password)
print ‘password is Found:‘ + password
except :
pass
def main ():
parser = argparse.ArgumentParser(usage=‘%prog‘ + ‘-f <zipfile> -d <dictionary>‘)
parser.add_argument(‘-f‘, dest=zname, type=argparse.FileType(‘zipfile‘) , help =‘specify zip file‘)
parser.add_argument(‘-d‘, dest=dname, type=argparse.FileType(‘txt‘) , help =‘specify dictioary file‘)
#(argument,args) = parser.parse_args()
if(zname == None) | (dname == None):
print parser.usage
exit(0)
else:
dname=Argument.dname
zname=Argument.zname
zFile = zipfile.ZipFile(zname)
passFiles =open(dname)
for line in passFiles.readlines() :
password = line.strip(‘\n‘)
t = Thread(target = extractFile, args = (zFile,password))
t.start()
if __name__==‘__main__‘:
main()
这是我新完善的代码,但在执行过程中总出错,目前还不知道怎么解决,还不清楚官方文档的解读方法,如果有哪位大神懂这些,希望不吝赐教,在下不胜感激。