mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-08 03:51:59 +01:00
added starttls support for smtp-source.py
Change-Id: I2a1d3a554f525fac771f7b4ec9f493df56c94a4e Signed-off-by: SJ <sj@acts.hu>
This commit is contained in:
parent
64827038de
commit
ec98ba33ac
@ -100,9 +100,14 @@ parser.add_argument("-s", "--server", type=str, help="smtp server", required=Tru
|
|||||||
parser.add_argument("-p", "--port", type=int, help="smtp port", default=25)
|
parser.add_argument("-p", "--port", type=int, help="smtp port", default=25)
|
||||||
parser.add_argument("--subject", type=str, help="subject", default="This is test subject")
|
parser.add_argument("--subject", type=str, help="subject", default="This is test subject")
|
||||||
parser.add_argument("-l", "--msglen", type=int, help="message length (approx.)", default=20000)
|
parser.add_argument("-l", "--msglen", type=int, help="message length (approx.)", default=20000)
|
||||||
|
parser.add_argument("--starttls", help="use STARTTLS", action="store_true")
|
||||||
|
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 == "":
|
||||||
|
sys.exit("make a pem file for starttls, and add --pem <pem file>")
|
||||||
|
|
||||||
|
|
||||||
with open(dictionary) as f:
|
with open(dictionary) as f:
|
||||||
words = f.readlines()
|
words = f.readlines()
|
||||||
@ -111,6 +116,9 @@ i = 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)
|
||||||
|
|
||||||
|
if args.starttls:
|
||||||
|
server.starttls(args.pem, args.pem)
|
||||||
|
|
||||||
k = 0
|
k = 0
|
||||||
|
|
||||||
while i < args.count and k < args.session:
|
while i < args.count and k < args.session:
|
||||||
|
Loading…
Reference in New Issue
Block a user