Benjamin Renard commited on 2013-04-16 22:00:34
Showing 2 changed files, with 13 additions and 3 deletions.
... | ... |
@@ -167,9 +167,7 @@ You should send this test mail from an account outside of your network.""" |
167 | 167 |
elif options.virus: |
168 | 168 |
if options.subject == default_subject: |
169 | 169 |
options.subject = "Test virus message" |
170 |
- options.content="""This is the EICAR standard antivirus test string : |
|
171 |
- |
|
172 |
-X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*""" |
|
170 |
+ options.content="The attached file contain the EICAR standard antivirus test string." |
|
173 | 171 |
|
174 | 172 |
if not options.port: |
175 | 173 |
if options.ssl: |
... | ... |
@@ -207,6 +205,12 @@ if options.attach: |
207 | 205 |
part.add_header('Content-Disposition', 'attachment; filename="%s"' % os.path.basename(filepath)) |
208 | 206 |
msg.attach(part) |
209 | 207 |
|
208 |
+if options.virus: |
|
209 |
+ part = MIMEBase('application', "octet-stream") |
|
210 |
+ part.set_payload("X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*") |
|
211 |
+ part.add_header('Content-Disposition', 'attachment; filename="eicar.bin"') |
|
212 |
+ msg.attach(part) |
|
213 |
+ |
|
210 | 214 |
if options.ssl: |
211 | 215 |
logging.info("Establish SSL connexion to server") |
212 | 216 |
server = smtplib.SMTP_SSL(options.host,options.port) |
213 | 217 |