title: Open Password Protected zip file with python
body: <p>I am trying to open a protected zip file I know for a fact that the first 5 characters are Super and the password is eight characters long with no numbers or symbols I am using this code in python to help me but it is not working can anyone help?</p>
  
  <p>code:</p>
  
  <pre><code>import zipfile
  import itertools
  import time
  
  # Function for extracting zip files to test if the password works!
  def extractFile(zip_file, password):
  try:
      zip_file.extractall(pwd=password)
      return True
  except KeyboardInterrupt:
      exit(0)
  except Exception as e:
      pass
  
  # The file name of the zip file.
  zipfilename = 'planz.zip'
  # The first part of the password.
  first_half_password = 'Super'
  # We don't know what characters they add afterwards...
  alphabet = 'abcdefghijklmnopqrstuvwxyz'
  zip_file = zipfile.ZipFile(zipfilename)
  
  # For every possible combination of 3 letters from alphabet...
  for c in itertools.product(alphabet, repeat=3):
     # Add the three letters to the first half of the password.
     password = first_half_password+''.join(c)
     # Try to extract the file.
     print("Trying: %s" % password)
     # If the file was extracted, you found the right password.
  
     if extractFile(zip_file, password):
         print('*' * 20)
         print('Password found: %s' % password)
         print('Files extracted...')
         exit(0)
  
  # If no password was found by the end, let us know!
  print('Password not found.')
  </code></pre>