import zipfile
import sys
import os
from threading import Thread
def extractall(zfile,password):
try:
zfile.extractall(pwd=password)
print '[+]Find the password '+password
exit(0)
except:
return
def main():
if len(sys.argv)==3:
filename=sys.argv[1]
dictionary=sys.argv[2]
if not os.path.isfile(filename):
print '[-]Zipfile is not exist.'
if not os.path.isfile(dictionary):
print '[-]Dictionary is not exist'
print '[+]Successed args!'
zfile=zipfile.ZipFile(filename)
passwordfile=open(dictionary)
for line in passwordfile.readlines():
password=line.strip('\n')
t=Thread(target=extractall, args=(zfile,password))
t.start()
else:
print '[-]Error args'
if __name__ == '__main__':
main()