#!
/usr/bin/env python3
# coding=utf-8
import os
import re
import shutil
import subprocess
import sys
# Py2/3 compatibility
# Python3 renamed raw_input to input
try:
input = raw_input
except NameError:
pass
# import main core functionality into SET
import [Link] as core
# check which operating system
operating_system = core.check_os()
if operating_system == "posix":
#
# ROOT CHECK
#
if [Link]() != 0:
print("\n The Social-Engineer Toolkit (SET) - by David Kennedy (ReL1K)")
print("\n Not running as root. \n\nExiting the Social-Engineer Toolkit
(SET).\n")
core.exit_set()
# if we are running in the path no need to change
if [Link]("setoolkit"):
pass
# check where we are and load default directory
elif [Link]("/usr/local/share/setoolkit"):
if not [Link]("setoolkit"):
[Link]("/usr/local/share/setoolkit")
[Link]("/usr/local/share/setoolkit")
# check where we are and load default directory
elif [Link]("/usr/local/share/set"):
if not [Link]("setoolkit"):
[Link]("/usr/local/share/set")
[Link]("/usr/local/share/set")
# make sure the config file is located in /etc/setoolkit
if not [Link]("/etc/setoolkit/"):
[Link]("/etc/setoolkit/")
[Link]("src/core/[Link]", "/etc/setoolkit/[Link]")
if not [Link]("/etc/setoolkit/[Link]"):
[Link]("src/core/[Link]", "/etc/setoolkit/[Link]")
# here we check to ensure we have the latest version
with open("/etc/setoolkit/[Link]") as fileopen:
data = [Link]()
if "CONFIG_VERSION=7.7.9" not in data:
print("[*] Overwriting old config for updates to SET. Backing up your old one
in /etc/setoolkit/")
[Link]("/etc/setoolkit/[Link]", "/etc/setoolkit/[Link]")
[Link]("src/core/[Link]", "/etc/setoolkit/[Link]")
# import after config checks have been properly created
from [Link] import text
from [Link].update_config import update_config
if [Link]([Link]([Link], "[Link]")):
[Link]([Link]([Link], "[Link]"))
# check directory and make it
if not [Link]("src/logs/"):
[Link]("src/logs/")
# check set logfile
if not [Link]("src/logs/set_logfile.log"):
# create new log
with open("src/logs/set_logfile.log", "w") as filewrite:
[Link]("")
# use ~/.set
if operating_system == "posix":
if not [Link]([Link]):
# create the set variables
[Link]([Link])
# if for some reason it failed to pull the path
userdir = [Link]([Link]('~'), '.set')
if not [Link](userdir):
[Link](userdir)
if not [Link]([Link]([Link], "reports")):
[Link]([Link]([Link], "reports"))
# check to see if we have python-pycrypto
try:
from [Link] import AES
except ImportError:
print("[!] The python-pycrypto python module not installed. You will lose the
ability to use multi-pyinjector.")
pass
#
# The Social-Engineer Toolkit (SET) #
# Written by: David Kennedy (ReL1K) #
#
#
# this is the main menu structure for SET
# main menu
# update the main config per load
update_config()
# chmod routine
if operating_system == "posix":
# change permissions if nix
[Link]("chmod +x seautomate;"
"chmod +x set-update;"
"chmod +x [Link];"
"chmod +x set-proxy;"
"chmod +x src/payloads/ratte/ratteserver;"
"chmod +x src/payloads/set_payloads/[Link]",
stdout=[Link], stderr=[Link], shell=True)
dns = core.check_config("DNS_SERVER=")
if [Link]() == "on":
import [Link]
from [Link] import detect_public_ip
[Link].start_dns_server(detect_public_ip())
# remove old files
for root, dirs, files in [Link]([Link]):
for f in files:
try:
match = [Link](".svn|entries|all-wcprops|props|text-base|prop-base|
tmp", f)
if not match:
[Link]([Link](root, f))
# if they are being used then ignore
except:
pass
# loop through all the directories
for d in dirs:
try:
match = [Link](".svn|entries|all-wcprops|props|text-base|prop-base|
tmp", d)
if not match:
[Link]([Link](root, d))
except:
pass
# if there isn't a set_config.py file yet, create one
if not [Link]("/etc/setoolkit/set_config.py"):
update_config()
define_version = core.get_version()
# create the [Link] routine
with open([Link]([Link], "[Link]"), "w") as filewrite:
[Link]("{This is the main SET configuration file for all options used
in SET}\n")
try:
# Remove old Signed_Updates
if [Link]([Link]([Link], "Signed_Update.jar")):
[Link]([Link]([Link], "Signed_Update.jar"))
# initial user menu
if not [Link]("src/agreement4"):
with open("readme/LICENSE") as fileopen:
for line in fileopen:
print(([Link]()))
print("{0}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.{1}".format([Link],
[Link]))
print([Link])
choice = input("\nDo you agree to the terms of service [y/n]: ")
choice += " " # b/c method below
if choice[0].lower() == "y":
with open("src/agreement4", "w") as filewrite:
[Link]("user accepted")
print([Link])
else:
print([Link] + "[!] Exiting the Social-Engineer Toolkit,
have a nice day." + [Link])
[Link]()
while True:
core.show_banner(define_version, '1')
show_main_menu = core.create_menu(text.main_text, text.main_menu)
# special case of list item 99
print('\n 99) Exit the Social-Engineer Toolkit\n')
# main core menu
main_menu_choice = (input([Link]("0", "")))
# funny
if main_menu_choice == "hugs":
core.print_warning("Have you given someone a hug today? Remember a hug
can change the world.")
pause = input("\nPlease give someone a hug then press {return} to
continue.")
# funny2
if main_menu_choice == "freehugs":
core.print_warning("HUGS ARE ALWAYS FREE! NEVER CHARGE! ALWAYS HUG.")
pause = input("\nDo not press return until giving someone a hug.")
# funny3
if main_menu_choice == "derbycon":
core.print_warning([Link] + "YAYYYYYYYYYYYYYYYYYYYYYY
DerbyCon.\n\nDerbyCon 7.0 'Legacy' -- September 22th - 24th 2017" +
[Link])
pause = input([Link] + "\nDon't miss it! Sep 23 - Sep 25th!
Press {return} to continue." + [Link])
# rance
if main_menu_choice == "rance":
core.print_warning([Link] + "We miss you buddy. David Jones
(Rance) changed a lot of us and you'll always be apart of our lives (and SET). Fuck
Cancer." + [Link])
pause = input("Press {return} to continue.")
# cavs
if main_menu_choice == "cavs":
core.print_warning([Link] + "2015-2016 CHAMPS BABY!!! C l e
e e e e e v eeee l a a n n d d d d d d d d d d d " + [Link])
pause = input("Press {return} to continue.")
# quit out
if main_menu_choice == 'exit' or main_menu_choice == "99" or
main_menu_choice == "quit":
core.exit_set()
# cleans up stale processes from SET
try:
# kill anything python running on 80
core.kill_proc("80", "python")
# kill anything on 443 ruby which is generally a rogue listener
core.kill_proc("443", "ruby")
except:
pass
# load set
if main_menu_choice == '1':
try:
core.module_reload([Link])
except:
import [Link]
# load fasttrack
if main_menu_choice == '2':
try:
core.module_reload([Link])
except:
import [Link]
# third party modules
if main_menu_choice == '3':
try:
core.module_reload([Link].module_handler)
except:
import [Link].module_handler
# update set
if main_menu_choice == '4':
core.update_set()
# credits
if main_menu_choice == '5':
update_config()
# update config
if main_menu_choice == '6':
core.help_menu()
# handle keyboard interrupts
except KeyboardInterrupt:
print(("\n\nThank you for {0}shopping{1} with the Social-Engineer Toolkit."
"\n\nHack the Gibson...and remember...hugs are worth more "
"than handshakes.\n".format([Link], [Link])))
# handle exceptions
except Exception as error:
[Link](error)
print("\n\n[!] Something went wrong, printing the error: " + str(error))
# cleanup routine
core.cleanup_routine()