Advertisement
rfmonk

unzip3.py

Nov 20th, 2013
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. #! /usr/bin/env python
  2.  
  3. import zipfile
  4. import optparse
  5. from threading import Thread
  6.  
  7. def extractFile(zFile, password):
  8.     try:
  9.         zFile.extractall(pwd=password)
  10.         print '[+] Found password ' + password + '\n'
  11.     except:
  12.         pass
  13. def main():
  14.     parser = optparse.OptionParser("usage%prog "+\
  15.         "-f <zipfile> -d <dictionary>")
  16.     parser.add_option('-f', dest='zname', type='string',\
  17.         help=' specify zip file')
  18.     parser.add_option('-d', dest='dname', type='string',\
  19.         help=' specify dictionary file')
  20.     (options, args) = parser.parse_args()
  21.     if (options.zname == None) | (options.dname == None):
  22.         print parser.usage
  23.         exit(0)
  24.     else:
  25.         zname = options.zname
  26.         dname = options.dname
  27.     zFile = zipfile.ZipFile(zname)
  28.     passFile = open(dname)
  29.     for line in passFile.readlines():
  30.         password = line.strip('\n')
  31.         t = Thread(target=extractFile, args=(zFile, password))
  32.         t.start()
  33.     if __name__ == '__main__':
  34.         main()
  35.  
  36. """ credit goes to the book violent python """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement