[ale] Need help with a Python Script

Stephen Haywood stephen at averagesecurityguy.info
Thu Nov 17 22:30:19 EST 2011


Try making the changes below and then running the script again. Make sure
you have an email server listening on localhost.

=============start script=============

>
> #!/usr/bin/python
>
> import os, smtplib
> system_name = os.getenv('HOSTNAME')
>
>
> SERVER = localhost <-- This should be: SERVER = "localhost"
>
> FROM = "me at abc.com"
> TO = ["you at nbc.com"]
>
> SUBJECT = "Mail from",os.getenv('HOSTNAME') <-- You've already stored
> this in the variable system_name, use it instead.
>
> TEXT = "This message is from",os.getenv('HOSTNAME') <-- See above.
>
> message = """\
> From: %s
> To: %s
> Subject: %s
>
> %s
> """ % (FROM, ", ".join(TO), SUBJECT, TEXT)
>
> # Send message
>
> server = smtplib.STMP(SERVER) <-- Should be: server = smtplib.SMTP(SERVER)
> server.sendmail(FROM, TO, message)
> server.quit()
>
> =============end script=============
>
-- 
Stephen Haywood
Information Security Consultant
CISSP, GPEN, OSCP
T: @averagesecguy
W: averagesecurityguy.info
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.ale.org/pipermail/ale/attachments/20111117/297f693c/attachment.html 


More information about the Ale mailing list