diff options
author | tv <tv@also> | 2010-12-28 21:28:05 +0100 |
---|---|---|
committer | tv <tv@also> | 2010-12-28 21:28:05 +0100 |
commit | 353a4587a8c8853fc1abade62226ee293c792c08 (patch) | |
tree | cc80dd1f7078960017da730f6ba0bcfe4a30b47a /modules/sendmail | |
parent | a3edb372bd49b3ad0ba5509030445ae004c5cc93 (diff) | |
parent | 5e0e70d0e4138c89709f29f39b46e293dc31a68b (diff) |
Merge ssh://telnet/~/noise
Diffstat (limited to 'modules/sendmail')
-rwxr-xr-x | modules/sendmail | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/modules/sendmail b/modules/sendmail new file mode 100755 index 00000000..182d96e3 --- /dev/null +++ b/modules/sendmail @@ -0,0 +1,55 @@ +#!/usr/bin/python +import os,sys,smtplib,string +''' + Mail Plugin for the noise telnet suite + See: http://docs.python.org/library/smtplib.html + Author: Felix +''' + +# help +if len(sys.argv) == 2: + if sys.argv[1] == "--help": + print "send an e-mail ( \"TO(s)\" \"SUBJECT\" [string instead of EOF])" + sys.exit(0) + +# sanity +if len(sys.argv) <= 2: + print "wrong number of parameters, see help" + sys.exit(1) + +# write variables +# check of EOF +if len(sys.argv) == 4 : + EOFstring="%s\n"% sys.argv[3] +else: + EOFstring="EOF\n" + +fromaddr=u"Karl Koch<shockspasm@googlemail.com>" +toaddrs=sys.argv[1] +subject=sys.argv[2] + + +#write header: +msg = u"From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n" % (fromaddr, toaddrs,subject) +print "Write your text now, finish with %s" % EOFstring +sys.stdout.flush() # flushing is important to make sure the line is written + +while 1: + try: + line = sys.stdin.readline() + if line == EOFstring: + break + msg = msg + line + except EOFError: + break + +msg = msg + "[!] Written with NOISE telnet" + +print "Thank you for your message! Delivering it now..." +sys.stdout.flush() +server = smtplib.SMTP('localhost') +#server.set_debuglevel(1) +server.sendmail(fromaddr,toaddrs.split(','),msg) +server.quit() +print "mail send successfully" +sys.exit(0) |