-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9bcf712
commit a8a2088
Showing
9 changed files
with
188 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# email-spoofer-py | ||
Simple Python script to spoof emails | ||
# smtp-spoofer | ||
Simple Python script to spoof emails |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
colorama==0.3.9 | ||
freeze==1.0.10 | ||
six==1.11.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
from scripts import util as u | ||
|
||
PORT_OUT_OF_RANGE = 'SMTP port is out-of-range (0-65535)' | ||
PORT_NAN = 'SMTP port must be a number' | ||
|
||
|
||
def get_port(): | ||
while True: | ||
try: | ||
port = int(u.get_required_prompt('SMTP port: ')) | ||
if port < 0: | ||
print(PORT_OUT_OF_RANGE) | ||
elif port > 65535: | ||
print(PORT_OUT_OF_RANGE) | ||
else: | ||
return str(port) | ||
except ValueError: | ||
print(PORT_NAN) | ||
|
||
|
||
def get_from_address(): | ||
return u.get_required_prompt('Sender address (e.g. [email protected]): ') | ||
|
||
|
||
def get_from_name(): | ||
return u.get_required_prompt('Sender name (e.g. John Smith): ') | ||
|
||
|
||
def get_subject(): | ||
return u.get_required_prompt('Subject line: ') | ||
|
||
|
||
def get_to_addresses(): | ||
to_address = u.get_required_prompt('Recipient address (e.g. [email protected]): ') | ||
to_addresses = [to_address] | ||
if is_multi_address(): | ||
while to_address: | ||
to_address = u.get_optional_prompt('Recipient address (blank to continue): ', None) | ||
if to_address: | ||
to_addresses.append(to_address) | ||
return to_addresses | ||
|
||
|
||
def is_multi_address(): | ||
is_multi = u.get_optional_prompt('Enter additional recipients (Y/N)?: ', 'N') | ||
return u.convert_answer_to_int(is_multi) | ||
|
||
|
||
def load_body_from_file(): | ||
load_from_file = u.get_optional_prompt('Load message body from file (Y/N)?: ', 'n') | ||
return u.convert_answer_to_int(load_from_file) | ||
|
||
|
||
def get_body_filename(): | ||
return u.get_required_prompt('Filename: ') | ||
|
||
|
||
def do_send_mail(): | ||
send_mail = u.get_required_prompt('Send message (Y/N)?: ') | ||
return u.convert_answer_to_int(send_mail) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from colorama import init, Fore, Style | ||
|
||
init() | ||
|
||
def header(line): | ||
print(Fore.LIGHTBLACK_EX + line + Style.RESET_ALL) | ||
|
||
|
||
def info(line): | ||
print(Fore.LIGHTCYAN_EX + line + Style.RESET_ALL) | ||
|
||
|
||
def success(line): | ||
print(Fore.LIGHTGREEN_EX + line + Style.RESET_ALL) | ||
|
||
|
||
def error(line): | ||
print(Fore.LIGHTRED_EX + line + Style.RESET_ALL) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import smtplib | ||
from scripts import get_raw as r, smtp as s, util as u, pretty_print as p | ||
|
||
from email.mime.multipart import MIMEMultipart | ||
from email.mime.text import MIMEText | ||
|
||
p.header('==================================================') | ||
p.header(' email-spoofer-py v0.0.2 ') | ||
p.header(' Python 3.x based email spoofer ') | ||
p.header(' https://github.com/mikechabot/email-spoofer-py ') | ||
p.header('==================================================') | ||
|
||
smtp_host = u.get_required_prompt('\nSMTP host: ') | ||
smtp_port = r.get_port() | ||
|
||
server = s.connect(smtp_host, smtp_port) | ||
|
||
s.start_tls(server) | ||
s.evaluate_server(server) | ||
s.login(server) | ||
|
||
from_address = r.get_from_address() | ||
from_name = r.get_from_name() | ||
to_addresses = r.get_to_addresses() | ||
subject = r.get_subject() | ||
|
||
msg = MIMEMultipart('alternative') | ||
msg.set_charset("utf-8") | ||
|
||
msg["From"] = from_name + "<" + from_address + ">" | ||
msg['Subject'] = subject | ||
msg["To"] = u.COMMASPACE.join(to_addresses) | ||
|
||
load_body_from_file = r.load_body_from_file() | ||
|
||
if load_body_from_file: | ||
filename = r.get_body_filename() | ||
with open(filename) as file: | ||
body = MIMEText(file.read(), 'html') | ||
msg.attach(body) | ||
else: | ||
p.info(' > Enter HTML line by line') | ||
p.info(' > To finish, press CTRL+D (*nix) or CTRL-Z (win) on an *empty* line') | ||
html = u.EMPTY_STRING | ||
while True: | ||
try: | ||
line = input(' | ') | ||
html += line + '\n' | ||
except EOFError: | ||
p.success(' > HTML captured.') | ||
break | ||
body = MIMEText(html, 'html') | ||
msg.attach(body) | ||
|
||
p.info(' > Send from ' + from_address + ' as ' + from_name) | ||
p.info(' > Send to ' + u.COMMASPACE.join(to_addresses)) | ||
|
||
if r.do_send_mail(): | ||
try: | ||
p.info(' > Sending spoofed message...') | ||
server.sendmail(from_address, to_addresses, msg.as_string()) | ||
p.success(' > Successfully sent message!') | ||
except smtplib.SMTPException: | ||
p.error(' > Error: Unable to send message. Check TO/FROM and Message body') | ||
else: | ||
p.info(' > Send message cancelled') | ||
|
||
|
||
|
||
|
||
|
Oops, something went wrong.