Shootmai, Anonymous email sender


SUBMITTED BY: Guest

DATE: Oct. 9, 2012, 12:01 p.m.

FORMAT: Python

SIZE: 2.0 kB

HITS: 1559

  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # ShootMail anonymous email sender by Multiversum
  4. import smtplib
  5. from email.MIMEText import MIMEText
  6. from optparse import OptionParser
  7. defaultmx = "aspmx.l.google.com"
  8. def shootMail(fro, to, subj, text, server=defaultmx):
  9. """
  10. The function that actually gets all the job done.
  11. Supply source address, destination address, message subject,
  12. message text and (optionally) vulnerable mail exchanger address.
  13. """
  14. mail = MIMEText(text)
  15. mail['From'], mail['Subject'], mail['To'] = fro, subj, to
  16. smtp = smtplib.SMTP(server)
  17. smtp.sendmail(fro, [to], mail.as_string())
  18. smtp.close()
  19. if __name__ == "__main__":
  20. parser = OptionParser()
  21. parser.add_option("-f", dest="fromaddr", help="sender email", metavar="from@example.com")
  22. parser.add_option("-t", dest="destaddr", help="receiver email", metavar="to@example.com")
  23. parser.add_option("-s", dest="subj", help="message subject", metavar="subject")
  24. parser.add_option("-m", dest="msg", help="message text", metavar="text")
  25. parser.add_option("-x", dest="smtp", help="mail exchanger address (default: Google's primary MX)", metavar="mx.example.com")
  26. (options, args) = parser.parse_args()
  27. if not options.fromaddr:
  28. options.fromaddr = raw_input('From: ')
  29. if not options.destaddr:
  30. options.destaddr = raw_input('To: ')
  31. if not options.subj:
  32. options.subj = raw_input('Subject: ')
  33. if not options.smtp:
  34. options.smtp = defaultmx
  35. if not options.msg:
  36. print "Enter your message, end with two newlines:"
  37. options.msg = ''
  38. while True:
  39. mline = raw_input('> ')
  40. if mline:
  41. options.msg = options.msg+mline+"\n"
  42. else:
  43. break
  44. print "Sending message..."
  45. shootMail(options.fromaddr, options.destaddr, options.subj, options.msg, options.smtp)
  46. print "Message sent"

comments powered by Disqus