Code: Select all
#!/usr/bin/python
#E-bomber
#This code for education purpose only.
#Use it at your own risk !!!
import os
import smtplib
import getpass
import sys
server = raw_input ('MailServer gmail/yahoo: ')
user = raw_input('Email: ')
passwd = getpass.getpass('Password: ')
list = raw_input('List with targets: ')
subject = raw_input('Subject: ')
body = raw_input('Message: ')
if server == 'gmail':
smtp_server = 'smtp.gmail.com'
port = 587
elif server == 'yahoo':
smtp_server = 'smtp.mail.yahoo.com'
port = 25
else:
print 'Applies only to gmail and yahoo.'
sys.exit()
print ''
try:
server = smtplib.SMTP(smtp_server,port)
server.ehlo()
if smtp_server == "smtp.gmail.com":
server.starttls()
server.login(user,passwd)
print ''
file = open(list)
for to in file:
to = to.strip()
msg = 'From: ' + user + '\nTo: ' + to + '\nSubject: ' + subject + '\n' + body
server.sendmail(user,to,msg)
print "\rE-mail sent to " + to + "!"
sys.stdout.flush()
server.quit()
print '\n Done !!!'
except KeyboardInterrupt:
print '[-] Canceled'
sys.exit()
except smtplib.SMTPAuthenticationError:
print '\n[!] The username or password you entered is incorrect.'
sys.exit()