Fixed smtpt virus message

This commit is contained in:
Benjamin Renard 2013-04-17 00:00:34 +02:00
parent 38d11a83d4
commit 276dcf6550
2 changed files with 13 additions and 3 deletions

6
debian/changelog vendored
View file

@ -1,3 +1,9 @@
mailt (1.3-1) unstable; urgency=low
* Fixed smtpt virus test message
-- Benjamin Renard <brenard@easter-eggs.com> Tue, 16 Apr 2013 23:59:47 +0200
mailt (1.2-1) unstable; urgency=low mailt (1.2-1) unstable; urgency=low
* Added POP support * Added POP support

10
smtpt
View file

@ -167,9 +167,7 @@ You should send this test mail from an account outside of your network."""
elif options.virus: elif options.virus:
if options.subject == default_subject: if options.subject == default_subject:
options.subject = "Test virus message" options.subject = "Test virus message"
options.content="""This is the EICAR standard antivirus test string : options.content="The attached file contain the EICAR standard antivirus test string."
X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*"""
if not options.port: if not options.port:
if options.ssl: if options.ssl:
@ -207,6 +205,12 @@ if options.attach:
part.add_header('Content-Disposition', 'attachment; filename="%s"' % os.path.basename(filepath)) part.add_header('Content-Disposition', 'attachment; filename="%s"' % os.path.basename(filepath))
msg.attach(part) msg.attach(part)
if options.virus:
part = MIMEBase('application', "octet-stream")
part.set_payload("X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*")
part.add_header('Content-Disposition', 'attachment; filename="eicar.bin"')
msg.attach(part)
if options.ssl: if options.ssl:
logging.info("Establish SSL connexion to server") logging.info("Establish SSL connexion to server")
server = smtplib.SMTP_SSL(options.host,options.port) server = smtplib.SMTP_SSL(options.host,options.port)