2012-12-31 22:11:37 +00:00
#!/usr/bin/python
2013-04-15 14:26:00 +00:00
import os
import sys
# check where we are
if os.path.isdir("/usr/share/setoolkit"):
if not os.path.isfile("se-toolkit"):
os.chdir("/usr/share/setoolkit")
2013-04-24 19:41:55 +00:00
# check where we are and load default directory
if os.path.isdir("/usr/share/set"):
if not os.path.isfile("se-toolkit"):
os.chdir("/usr/share/set")
sys.path.append("/usr/share/set")
2013-04-15 14:26:00 +00:00
if not os.path.isfile("config/set_config"):
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.")
sys.exit()
2012-12-31 22:11:37 +00:00
from src.core.setcore import *
from src.core.menu import text
from config.update_config import update_config
import subprocess
import shutil
import re
2013-04-15 14:26:00 +00:00
if not os.path.isfile("src/logs/set_logfile.log"):
filewrite = file("src/logs/set_logfile.log", "w")
filewrite.write("")
filewrite.close()
2013-04-17 18:21:40 +00:00
# grab the operating system
operating_system = check_os()
2013-05-27 22:27:21 +00:00
if not os.path.isdir("src/logs/"):
os.makedirs("src/logs/")
2013-04-17 18:21:40 +00:00
# check set logfile
if not os.path.isfile("src/logs/set_logfile.log"):
# create new log
filewrite = file("src/logs/set_logfile.log", "w")
filewrite.write("")
filewrite.close()
# use ~/.set
if operating_system == "posix":
if not os.path.isdir(setdir):
# create the set variables
os.makedirs(setdir)
# if for some reason it failed to pull the path
if not os.path.isdir("~/.set/"):
os.makedirs("~/.set/")
2013-04-15 14:26:00 +00:00
if not os.path.isdir(setdir + "/reports/"):
os.makedirs(setdir + "/reports")
print """
IMPORTANT NOTICE! The Social-Engineer Toolkit has made some significant
changes due to the folder structure of Kali and FSH (Linux).
All SET dynamic information will now be saved in the ~/.set directory not
in src/program_junk.
"""
try:
print_warning("Please note that you should use se-toolkit from now on.")
print_warning("Launching set by typing 'set' is going away soon...")
print_warning("If on Kali Linux, just type 'se-toolkit' anywhere...")
print_warning("If not on Kali, run python setup.py install and you can use se-toolkit anywhere...")
pause = raw_input("Press {return} to continue into SET.")
except KeyboardInterrupt:
print "\n\nThank you for " + bcolors.RED+"shopping" + bcolors.ENDC+" with the Social-Engineer Toolkit.\n\nHack the Gibson...and remember...hugs are worth more than handshakes.\n"
sys.exit()
2013-02-16 22:13:49 +00:00
2013-02-08 02:05:40 +00:00
# check to see if we have python-pycrypto
try:
2013-03-16 19:47:25 +00:00
from Crypto.Cipher import AES
2013-02-08 02:05:40 +00:00
except ImportError:
2013-03-16 19:47:25 +00:00
print "[!] The python-pycrypto python module not installed. You will loose the ability to use multi-pyinjector."
pass
2013-02-08 02:05:40 +00:00
2012-12-31 22:11:37 +00:00
#########################################
# The Social-Engineer Toolkit (SET) #
# Written by: David Kennedy (ReL1K) #
2013-04-15 14:26:00 +00:00
# #
2012-12-31 22:11:37 +00:00
#########################################
#
# this is the main menu structure for SET
# main menu
# grab the operating system
operating_system = check_os()
# update the main config per load
update_config()
# chmod routine
if operating_system == "posix":
2013-03-16 19:47:25 +00:00
# change permissions if nix
subprocess.Popen("chmod +x set-automate;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)
2012-12-31 22:11:37 +00:00
2013-04-15 14:26:00 +00:00
# check if we want DNS started
2013-04-20 01:32:34 +00:00
dns_check = check_config("DNS_SERVER=")
if dns_check == "on" or dns_check == "ON":
2013-04-15 14:26:00 +00:00
start_dns()
2013-03-16 19:24:58 +00:00
2012-12-31 22:11:37 +00:00
# remove old files
2013-04-15 14:26:00 +00:00
for root, dirs, files in os.walk(str(setdir)):
2012-12-31 22:11:37 +00:00
for f in files:
try:
2013-03-16 19:47:25 +00:00
match = re.search(".svn|entries|all-wcprops|props|text-base|prop-base|tmp", f)
if not match:
os.unlink(os.path.join(root, f))
2012-12-31 22:11:37 +00:00
# if they are being used then ignore
except: pass
# loop through all the directories
for d in dirs:
try:
2013-03-16 19:47:25 +00:00
match = re.search(".svn|entries|all-wcprops|props|text-base|prop-base|tmp", d)
if not match:
shutil.rmtree(os.path.join(root, d))
2012-12-31 22:11:37 +00:00
except: pass
# if windows then do some stuff
if operating_system == "posix":
################################################
# ROOT CHECK
################################################
2013-03-16 19:47:25 +00:00
if os.geteuid() != 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"
exit_set()
2012-12-31 22:11:37 +00:00
# if there isn't a set_config.py file yet, create one
if not os.path.isfile("config/set_config.py"):
update_config()
define_version = get_version()
cleanup_routine()
# create the set.options routine
2013-04-15 14:26:00 +00:00
filewrite = file(str(setdir) + "/set.options", "w")
2012-12-31 22:11:37 +00:00
filewrite.write("{This is the main SET configuration file for all options used in SET}\n")
filewrite.close()
try:
2013-03-16 19:47:25 +00:00
# Remove old Signed_Updates
2013-04-15 14:26:00 +00:00
if os.path.isfile(setdir + "/Signed_Update.jar"):
os.remove(setdir + "/Signed_Update.jar")
2013-03-16 19:47:25 +00:00
# intitial user menu
if not os.path.isfile("src/agreement4"):
fileopen = file("readme/LICENSE", "r")
for line in fileopen:
print line.rstrip()
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
2012-12-31 22:11:37 +00:00
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
2013-03-16 19:47:25 +00:00
choice = raw_input("\nDo you agree to the terms of service [y/n]: ")
if choice == "yes" or choice == "y":
filewrite = file("src/agreement4", "w")
filewrite.write("user accepted")
filewrite.close()
print bcolors.ENDC
else:
print "[!] Exiting the Social-Engineer Toolkit, have a nice day." + bcolors.ENDC
sys.exit()
while 1:
show_banner(define_version,'1')
show_main_menu = create_menu(text.main_text, text.main_menu)
# special case of list item 99
print '\n 99) Exit the Social-Engineer Toolkit\n'
# mainc ore menu
main_menu_choice = (raw_input(setprompt("0", "")))
# funny
if main_menu_choice == "hugs":
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.")
# funny2
if main_menu_choice == "derbycon":
print_warning(bcolors.BOLD + "YAYYYYYYYYYYYYYYYYYYYYYY DerbyCon.\n\nDerbyCon 3.0 -- September 25th through September 29th 2012" + bcolors.ENDC)
pause = raw_input(bcolors.BOLD + "\nDon't miss it! Sep 25 - Sep 29th! Press {return} to continue." + bcolors.ENDC)
# quit out
if main_menu_choice == 'exit' or main_menu_choice == "99" or main_menu_choice == "quit":
exit_set()
# cleans up stale processes from SET
try:
# kill anything python running on 80
kill_proc("80","python")
# kill anything on 443 ruby which is generally a rogue listener
kill_proc("443", "ruby")
except: pass
# load set
if main_menu_choice == '1':
try:
reload(src.core.set)
except:
import src.core.set
# load fasttrack
if main_menu_choice == '2':
try: reload(src.core.fasttrack)
except: import src.core.fasttrack
# third party modules
if main_menu_choice == '3':
try: reload(src.core.module_handler)
except: import src.core.module_handler
# update metasploit
if main_menu_choice == '4':
update_metasploit()
# update set
if main_menu_choice == '5':
update_set()
# credits
if main_menu_choice == '6':
update_config()
# update config
if main_menu_choice == '7':
help_menu()
2012-12-31 22:11:37 +00:00
# handle keyboard interrupts
except KeyboardInterrupt:
2013-03-16 19:47:25 +00:00
print "\n\nThank you for " + bcolors.RED+"shopping" + bcolors.ENDC+" with the Social-Engineer Toolkit.\n\nHack the Gibson...and remember...hugs are worth more than handshakes.\n"
2012-12-31 22:11:37 +00:00
# handle exceptions
2013-03-19 14:54:36 +00:00
except Exception, error:
log(error)
print "\n\n[!] Something went wrong, printing the error: "+ str(error)
2012-12-31 22:11:37 +00:00
# cleanup routine
cleanup_routine()