import zipfile from threading import Thread #多线程库 import optparse #选定字典或者文件 def extractFile(zfile,password): try: zfile.extractall(pwd=password) print('[+] found password' + password +' ') except: pass def main(): #zfile=zipfile.ZipFile('decode.zip') #passfile=open('dictionmary.txt') parser=optparse.OptionParser("usage%prog "+ "-f<zipfile> -d <dictionmary>") parser.add_option('-f',dest='zname',type='string', help='specify zip file') parser.add_option('-d',dest='dname',type='string', help='specify sictionary file') (options,args)=parser.parse_args() if (options.zname==None) | (options.dname==None): print(parser.usage) else: zname=options.zname dname=options.dname zfile=zipfile.(zname) passfile=open(dname) for line in passfile.readlines(): password=line.strp(' ') t=Thread(target=extractFile,args=(zfile,password)) t.start() #guess=extractFile(zfile, password) #if guess: # print('[+] Password='+password+' ') # exit(0) if __name__=='__main__': main()