From e477ef062e32af2f66c4eb4f845b592a46b03bbd Mon Sep 17 00:00:00 2001 From: SJ Date: Sun, 21 Aug 2016 12:13:31 +0200 Subject: [PATCH] fixed counter bug Change-Id: I7ef9a9cd62c2b7e4064715712eea23d2846fdf36 Signed-off-by: SJ --- contrib/smtp/smtp-source.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/contrib/smtp/smtp-source.py b/contrib/smtp/smtp-source.py index 056acc03..ae174c51 100755 --- a/contrib/smtp/smtp-source.py +++ b/contrib/smtp/smtp-source.py @@ -105,14 +105,17 @@ parser.add_argument("--pem", type=str, help="pem file for starttls", default="") args = parser.parse_args() + if args.starttls and args.pem == "": - sys.exit("make a pem file for starttls, and add --pem ") + sys.exit("make a pem file for starttls") with open(dictionary) as f: words = f.readlines() i = 0 +total_count = 0 + while i < args.count: 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) k += 1 - i += 1 + total_count += 1 if args.debug == 0: - sys.stdout.write('%s\r' % str(i)) + sys.stdout.write('%s\r' % str(total_count)) sys.stdout.flush() server.quit() + i += 1 + if args.debug == 0: print