This commit is contained in:
root 2015-01-20 13:48:04 -05:00
commit 8bb2c60caa
5 changed files with 41 additions and 17 deletions

View file

@ -18,7 +18,7 @@ elif os.path.isdir("/usr/share/set"):
os.chdir("/usr/share/set") os.chdir("/usr/share/set")
sys.path.append("/usr/share/set") sys.path.append("/usr/share/set")
# if we can't see our config then something didn't go good.. # if we can't see our config then something didn't go right...
if not os.path.isfile("config/set_config"): if not os.path.isfile("config/set_config"):
print_error("Cannot locate SET executable. Try running from the local directory.") print_error("Cannot locate SET executable. Try running from the local directory.")
print_error("If this does not work, please run the setup.py install file.") print_error("If this does not work, please run the setup.py install file.")
@ -42,7 +42,7 @@ if not os.path.isfile("src/logs/set_logfile.log"):
filewrite.write("") filewrite.write("")
filewrite.close() filewrite.close()
# grab the operating system # check which operating system
operating_system = check_os() operating_system = check_os()
# use ~/.set # use ~/.set
@ -89,7 +89,8 @@ if operating_system == "posix":
subprocess.Popen("chmod +x seautomate;chmod +x set-update;chmod +x setup.py;chmod +x set-proxy;chmod +x src/payloads/ratte/ratteserver;chmod +x src/payloads/set_payloads/listener.py", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) subprocess.Popen("chmod +x seautomate;chmod +x set-update;chmod +x setup.py;chmod +x set-proxy;chmod +x src/payloads/ratte/ratteserver;chmod +x src/payloads/set_payloads/listener.py", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
dns = check_config("DNS_SERVER=") dns = check_config("DNS_SERVER=")
if dns == "ON" or dns == "on": start_dns() if dns.lower() == "on":
start_dns()
# remove old files # remove old files
for root, dirs, files in os.walk(setdir): for root, dirs, files in os.walk(setdir):
@ -147,7 +148,8 @@ try:
print bcolors.RED + """ print bcolors.RED + """
The Social-Engineer Toolkit is designed purely for good and not evil. If you are planning on using this tool for malicious purposes that are not authorized by the company you are performing assessments for, you are violating the terms of service and license of this toolset. By hitting yes (only one time), you agree to the terms of service and that you will only use this tool for lawful purposes only.""" + bcolors.GREEN The Social-Engineer Toolkit is designed purely for good and not evil. If you are planning on using this tool for malicious purposes that are not authorized by the company you are performing assessments for, you are violating the terms of service and license of this toolset. By hitting yes (only one time), you agree to the terms of service and that you will only use this tool for lawful purposes only.""" + bcolors.GREEN
choice = raw_input("\nDo you agree to the terms of service [y/n]: ") choice = raw_input("\nDo you agree to the terms of service [y/n]: ")
if choice == "yes" or choice == "y": choice += " " #b/c method below
if choice[0].lower() == "y":
filewrite = file("src/agreement4", "w") filewrite = file("src/agreement4", "w")
filewrite.write("user accepted") filewrite.write("user accepted")
filewrite.close() filewrite.close()
@ -156,7 +158,7 @@ The Social-Engineer Toolkit is designed purely for good and not evil. If you are
print bcolors.ENDC + "[!] Exiting the Social-Engineer Toolkit, have a nice day." + bcolors.ENDC print bcolors.ENDC + "[!] Exiting the Social-Engineer Toolkit, have a nice day." + bcolors.ENDC
sys.exit() sys.exit()
while 1: while True:
show_banner(define_version,'1') show_banner(define_version,'1')
show_main_menu = create_menu(text.main_text, text.main_menu) show_main_menu = create_menu(text.main_text, text.main_menu)
@ -167,6 +169,7 @@ The Social-Engineer Toolkit is designed purely for good and not evil. If you are
main_menu_choice = (raw_input(setprompt("0", ""))) main_menu_choice = (raw_input(setprompt("0", "")))
# funny # funny
# edit: you're hilarious.
if main_menu_choice == "hugs": if main_menu_choice == "hugs":
print_warning("Have you given someone a hug today? Remember a hug can change the world.") print_warning("Have you given someone a hug today? Remember a hug can change the world.")
pause = raw_input("\nPlease give someone a hug then press {return} to continue.") pause = raw_input("\nPlease give someone a hug then press {return} to continue.")

Binary file not shown.

Binary file not shown.

View file

@ -12,9 +12,13 @@ import pexpect
import base64 import base64
import thread import thread
from cStringIO import StringIO
from email.MIMEMultipart import MIMEMultipart from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText from email.MIMEText import MIMEText
from email.header import Header
from email.generator import Generator
from email import Charset
from email import Encoders from email import Encoders
# DEFINE SENDMAIL CONFIG # DEFINE SENDMAIL CONFIG
sendmail=0 sendmail=0
@ -22,6 +26,8 @@ sendmail_file=file("config/set_config","r").readlines()
from src.core.setcore import * from src.core.setcore import *
Charset.add_charset('utf-8', Charset.BASE64, Charset.BASE64, 'utf-8')
# Specify if its plain or html # Specify if its plain or html
message_flag="plain" message_flag="plain"
@ -309,14 +315,14 @@ else:
# Define mail send here # Define mail send here
def mail(to, subject, text, attach, prioflag1, prioflag2): def mail(to, subject, text, attach, prioflag1, prioflag2):
msg = MIMEMultipart() msg = MIMEMultipart()
msg['From'] = from_displayname msg['From'] = str(Header(from_displayname, 'UTF-8').encode() + ' <' + from_address + '> ')
msg['To'] = to msg['To'] = to
msg['X-Priority'] = prioflag1 msg['X-Priority'] = prioflag1
msg['X-MSMail-Priority'] = prioflag2 msg['X-MSMail-Priority'] = prioflag2
msg['Subject'] = subject msg['Subject'] = Header(subject, 'UTF-8').encode()
# specify if its html or plain # specify if its html or plain
# body message here # body message here
body_type=MIMEText(text, "%s" % (message_flag)) body_type=MIMEText(text, "%s" % (message_flag), 'UTF-8')
msg.attach(body_type) msg.attach(body_type)
# define connection mimebase # define connection mimebase
part = MIMEBase('application', 'octet-stream') part = MIMEBase('application', 'octet-stream')
@ -326,6 +332,11 @@ def mail(to, subject, text, attach, prioflag1, prioflag2):
# add headers # add headers
part.add_header('Content-Disposition','attachment; filename="%s"' % os.path.basename(attach)) part.add_header('Content-Disposition','attachment; filename="%s"' % os.path.basename(attach))
msg.attach(part) msg.attach(part)
io = StringIO()
msggen = Generator(io, False)
msggen.flatten(msg)
# define connection to smtp server # define connection to smtp server
mailServer = smtplib.SMTP(smtp, int(port)) mailServer = smtplib.SMTP(smtp, int(port))
mailServer.ehlo() mailServer.ehlo()
@ -348,7 +359,7 @@ def mail(to, subject, text, attach, prioflag1, prioflag2):
mailServer.ehlo() mailServer.ehlo()
if len(provideruser) > 0: if len(provideruser) > 0:
mailServer.login(provideruser, pwd) mailServer.login(provideruser, pwd)
mailServer.sendmail(from_address, to, msg.as_string()) mailServer.sendmail(from_address, to, io.getvalue())
except Exception, e: except Exception, e:
print_error("Unable to deliver email. Printing exceptions message below, this is most likely due to an illegal attachment. If using GMAIL they inspect PDFs and is most likely getting caught.") print_error("Unable to deliver email. Printing exceptions message below, this is most likely due to an illegal attachment. If using GMAIL they inspect PDFs and is most likely getting caught.")
raw_input("Press {return} to view error message.") raw_input("Press {return} to view error message.")
@ -360,16 +371,16 @@ def mail(to, subject, text, attach, prioflag1, prioflag2):
print str(e) print str(e)
try: try:
mailServer.login(provideremail, pwd) mailServer.login(provideremail, pwd)
thread.start_new_thread(mailServer.sendmail(from_address, to, msg.as_string())) thread.start_new_thread(mailServer.sendmail(from_address, to, io.getvalue()))
except Exception, e: except Exception, e:
return_continue() return_continue()
if email_provider == "hotmail": if email_provider == "hotmail":
mailServer.login(provideruser, pwd) mailServer.login(provideruser, pwd)
thread.start_new_thread(mailServer.sendmail,(from_address, to, msg.as_string())) thread.start_new_thread(mailServer.sendmail,(from_address, to, io.getvalue()))
if sendmail == 1: if sendmail == 1:
thread.start_new_thread(mailServer.sendmail,(from_address, to, msg.as_string())) thread.start_new_thread(mailServer.sendmail,(from_address, to, io.getvalue()))
if option1 == '1': if option1 == '1':
try: try:

View file

@ -10,11 +10,17 @@ import glob
import random import random
import time import time
import base64 import base64
from cStringIO import StringIO
from email.MIMEMultipart import MIMEMultipart from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText from email.MIMEText import MIMEText
from email.header import Header
from email.generator import Generator
from email import Charset
from email import Encoders from email import Encoders
Charset.add_charset('utf-8', Charset.BASE64, Charset.BASE64, 'utf-8')
# default the email messages to plain text # default the email messages to plain text
# unless otherwise specified # unless otherwise specified
message_flag="plain" message_flag="plain"
@ -241,17 +247,21 @@ if option1 != "99":
def mail(to, subject, prioflag1, prioflag2, text): def mail(to, subject, prioflag1, prioflag2, text):
msg = MIMEMultipart() msg = MIMEMultipart()
msg['From'] = from_displayname msg['From'] = str(Header(from_displayname, 'UTF-8').encode() + ' <' + from_address + '> ')
msg['To'] = to msg['To'] = to
msg['X-Priority'] = prioflag1 msg['X-Priority'] = prioflag1
msg['X-MSMail-Priority'] = prioflag2 msg['X-MSMail-Priority'] = prioflag2
msg['Subject'] = subject msg['Subject'] = Header(subject, 'UTF-8').encode()
body_type=MIMEText(text, "%s" % (message_flag)) body_type=MIMEText(text, "%s" % (message_flag), 'UTF-8')
msg.attach(body_type) msg.attach(body_type)
mailServer = smtplib.SMTP(smtp, port) mailServer = smtplib.SMTP(smtp, port)
io = StringIO()
msggen = Generator(io, False)
msggen.flatten(msg)
if sendmail == 0: if sendmail == 0:
if email_provider == "gmail": if email_provider == "gmail":
@ -266,7 +276,7 @@ def mail(to, subject, prioflag1, prioflag2, text):
try: try:
if provideruser != "" or pwd != "": if provideruser != "" or pwd != "":
mailServer.login(provideruser, pwd) mailServer.login(provideruser, pwd)
mailServer.sendmail(from_address, to, msg.as_string()) mailServer.sendmail(from_address, to, io.getvalue())
except: except:
# try logging in with base64 encoding here # try logging in with base64 encoding here
@ -281,7 +291,7 @@ def mail(to, subject, prioflag1, prioflag2, text):
return_continue() return_continue()
if sendmail == 1: if sendmail == 1:
mailServer.sendmail(from_address, to, msg.as_string()) mailServer.sendmail(from_address, to, io.getvalue())
# if we specified a single address # if we specified a single address
if option1 == '1': if option1 == '1':