chg: [smtp] Added ident option

pull/61/head
Steve Clement 2021-10-01 11:26:56 +09:00
parent 709efcadb5
commit 01f9541a2b
No known key found for this signature in database
GPG Key ID: 69A20F509BE4AEE9
2 changed files with 8 additions and 2 deletions

View File

@ -54,6 +54,7 @@ if __name__ == '__main__':
parser.add_argument("--host", default='127.0.0.1', help="IP to attach the SMTP server to.")
parser.add_argument("--port", default='2525', help="Port of the SMTP server")
parser.add_argument("--ssl", action='store_true', help="Pure SMTPs.")
parser.add_argument("--ident", default='Python SMTPd', help="SMTPd ident string")
args = parser.parse_args()
configmodule = Path(__file__).as_posix().replace('.py', '_config')
@ -65,6 +66,7 @@ if __name__ == '__main__':
smtp_addr = config.smtp_addr
smtp_port = config.smtp_port
smtps = config.ssl
ident = config.ident
else:
binpath = args.path
binpath_forward = args.path_forward
@ -72,14 +74,15 @@ if __name__ == '__main__':
smtp_addr = args.host
smtp_port = args.port
smtps = args.ssl
ident = args.ident
print("Starting Fake-SMTP-to-MISP server")
handler = CustomSMTPHandler()
if smtps:
server = ControllerSSL(handler, hostname=smtp_addr, port=smtp_port)
server = ControllerSSL(handler, hostname=smtp_addr, port=smtp_port, ident=ident)
else:
server = ControllerSTARTTLS(handler, hostname=smtp_addr, port=smtp_port)
server = ControllerSTARTTLS(handler, hostname=smtp_addr, port=smtp_port, ident=ident)
server.start()
input("Server started. Press Return to quit.")
server.stop()

View File

@ -5,6 +5,9 @@ from pathlib import Path
binpath = Path(__file__).parent / 'mail_to_misp.py'
binpath_forward = Path(__file__).parent / 'mail_to_misp_forward.py'
# default ident: <hostname> Python SMTP 1.4.2
ident = 'ESMTP Postfix (Ubuntu)'
email_forward = 'mail2misp@example.com'
smtp_addr = '127.0.0.1'