title: .zip file password not found (present in .txt file)
body: <p>This code is verbatim from a book titled 'Violent Python'. It is meant to be a simple script that iterates through a .txt file and tries each entry as the password to a locked .zip file.</p>
  
  <p>The script runs and no errors are thrown but no output is given until I
   add a count variable that proves each entry is being checked. Although the correct password is in the file the 'if guess:' statement is never run. </p>
  
  <p>Any help will be greatly appreciated! </p>
  
  <pre><code>import zipfile
  
  def extractFile(zfile,password):
  
      try:
          zFile.extractall(pwd=password)
          return password
  
      except:
          return 
  
  def main():
      count = 0                         #added for debugging 
      zFile = zipfile.ZipFile('secure.zip')
      passFile = open('dictionary.txt')
      for line in passFile.readlines():
          count = count + 1             #added for debugging 
          password = line.strip('\n')
          guess = extractFile(zFile, password)
          print count                   #added for debugging 
          if guess:
              print "[+] Password = " + password + "\n"   
              exit(0)
  if __name__=='__main__':
      main()
  </code></pre>