fixed counter bug

Change-Id: I7ef9a9cd62c2b7e4064715712eea23d2846fdf36
Signed-off-by: SJ <sj@acts.hu>
This commit is contained in:
SJ 2016-08-21 12:13:31 +02:00
parent ec98ba33ac
commit e477ef062e

View File

@ -105,14 +105,17 @@ parser.add_argument("--pem", type=str, help="pem file for starttls", default="")
args = parser.parse_args() args = parser.parse_args()
if args.starttls and args.pem == "": if args.starttls and args.pem == "":
sys.exit("make a pem file for starttls, and add --pem <pem file>") sys.exit("make a pem file for starttls")
with open(dictionary) as f: with open(dictionary) as f:
words = f.readlines() words = f.readlines()
i = 0 i = 0
total_count = 0
while i < args.count: while i < args.count:
server = smtplib.SMTP(args.server, args.port, args.helo, 10) server = smtplib.SMTP(args.server, args.port, args.helo, 10)
@ -127,13 +130,15 @@ while i < args.count:
server.sendmail(args.sender, args.rcpt, message) server.sendmail(args.sender, args.rcpt, message)
k += 1 k += 1
i += 1 total_count += 1
if args.debug == 0: if args.debug == 0:
sys.stdout.write('%s\r' % str(i)) sys.stdout.write('%s\r' % str(total_count))
sys.stdout.flush() sys.stdout.flush()
server.quit() server.quit()
i += 1
if args.debug == 0: if args.debug == 0:
print print