-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.py
46 lines (42 loc) · 1.69 KB
/
script.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
###Script###
###Created by Admuad###
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email import encoders
import traceback
import configparser
config = configparser.ConfigParser()
config.read('config.ini')
def send_mail(receiver_email, spoofed_email, spoofed_name, message, subject):
try:
msg = MIMEMultipart("related")
msg['From'] = f"{spoofed_name} <{spoofed_email}>"
msg['To'] = receiver_email
msg['Subject'] = subject
body = message
msg.attach(MIMEText(body, 'plain'))
# Get SMTP settings from config file
smtp_host = config.get('SMTP', 'host')
smtp_port = config.getint('SMTP', 'port')
smtp_username = config.get('SMTP', 'username')
smtp_password = config.get('SMTP', 'password')
# Connect to SMTP server and send email
server = smtplib.SMTP(smtp_host, smtp_port)
server.starttls()
server.login(smtp_username, smtp_password)
text = msg.as_string()
server.sendmail(spoofed_email, receiver_email, text)
server.quit()
print('Spoofed Email sent successfully to '+ str(receiver_email) + ' from ' + str(spoofed_name))
except Exception as e:
# Print the exception
print(traceback.format_exc())
receiver_email = input('Enter the Receiver Email Adress: ')
spoofed_email = input('Enter the Spoofed Email Adress: ')
spoofed_name = input('Enter the Spoofed Name: ')
message = input('Enter the Email body: ')
subject = input('Enter the Email subject: ')
# Invoke send_mail to send email
send_mail(receiver_email,spoofed_email,spoofed_name, message, subject)