Added python3 compliance to setoolkit

This commit is contained in:
TrustedSec 2016-01-12 22:29:04 -05:00
parent 283477cea8
commit d027a44998
2 changed files with 34 additions and 34 deletions

View file

@ -11,9 +11,9 @@ if os.path.isfile("setoolkit"):
# check where we are and load default directory
elif os.path.isdir("/usr/share/setoolkit"):
if not os.path.isfile("setoolkit"):
os.chdir("/usr/share/setoolkit")
sys.path.append("/usr/share/setoolkit")
if not os.path.isfile("setoolkit"):
os.chdir("/usr/share/setoolkit")
sys.path.append("/usr/share/setoolkit")
# check where we are and load default directory
elif os.path.isdir("/usr/share/set"):
@ -30,12 +30,13 @@ if not os.path.isfile("/etc/setoolkit/set.config"):
shutil.copyfile("src/core/config.baseline", "/etc/setoolkit/set.config")
# here we check to ensure we have the latest version
data = file("/etc/setoolkit/set.config").read()
data = open("/etc/setoolkit/set.config", "r").read()
if not "CONFIG_VERSION=7.0" in data:
print ("[*] Overwriting old config for updates to SET. Backing up your old one in /etc/setoolkit/")
shutil.move("/etc/setoolkit/set.config", "/etc/setoolkit/set.config.bak")
shutil.copyfile("src/core/config.baseline", "/etc/setoolkit/set.config")
from src.core.setcore import *
from src.core.menu import text
from src.core.update_config import update_config
@ -43,11 +44,11 @@ import shutil
import re
if check_kali() == "Kali":
if check_config("BLEEDING_EDGE=").lower() != "on":
print_status("Kali bleeding edge was not detected to be on...")
print_status("Kali install detected. Note that if you are not using bleeding edge repositories, your version of SET will be roughly 4 months behind.")
print_status("It is recommended to switch to bleeding-edge repos to ensure you are running the latest version of SET and other tools.")
pause = raw_input("Press [enter] to accept that SET is several months out of date and probably contains bugs and issues.")
if check_config("BLEEDING_EDGE=").lower() != "on":
print_status("Kali bleeding edge was not detected to be on...")
print_status("Kali install detected. Note that if you are not using bleeding edge repositories, your version of SET will be roughly 4 months behind.")
print_status("It is recommended to switch to bleeding-edge repos to ensure you are running the latest version of SET and other tools.")
pause = raw_input("Press [enter] to accept that SET is several months out of date and probably contains bugs and issues.")
# check directory and make it
if not os.path.isdir("src/logs/"):
@ -86,7 +87,7 @@ try:
from Crypto.Cipher import AES
except ImportError:
print "[!] The python-pycrypto python module not installed. You will lose the ability to use multi-pyinjector."
print ("[!] The python-pycrypto python module not installed. You will lose the ability to use multi-pyinjector.")
pass
#########################################
@ -136,8 +137,8 @@ if operating_system == "posix":
################################################
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"
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()
# if there isn't a set_config.py file yet, create one
@ -161,19 +162,19 @@ try:
if not os.path.isfile("src/agreement4"):
fileopen = file("readme/LICENSE", "r")
for line in fileopen:
print line.rstrip()
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 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
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)
choice = raw_input("\nDo you agree to the terms of service [y/n]: ")
choice += " " #b/c method below
if choice[0].lower() == "y":
filewrite = file("src/agreement4", "w")
filewrite.write("user accepted")
filewrite.close()
print bcolors.ENDC
print (bcolors.ENDC)
else:
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()
while True:
@ -181,26 +182,25 @@ The Social-Engineer Toolkit is designed purely for good and not evil. If you are
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'
print ('\n 99) Exit the Social-Engineer Toolkit\n')
# main core menu
# main core menu
main_menu_choice = (raw_input(setprompt("0", "")))
# funny
# edit: you're hilarious.
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 == "freehugs":
print_warning("HUGS ARE ALWAYS FREE! NEVER CHARGE! ALWAYS HUG.")
pause = raw_input("\nDo not press return until giving someone a hug.")
# funny2
if main_menu_choice == "freehugs":
print_warning("HUGS ARE ALWAYS FREE! NEVER CHARGE! ALWAYS HUG.")
pause = raw_input("\nDo not press return until giving someone a hug.")
# funny3
if main_menu_choice == "derbycon":
print_warning(bcolors.BOLD + "YAYYYYYYYYYYYYYYYYYYYYYY DerbyCon.\n\nDerbyCon 5.0 -- September 23th - 27th 2015" + bcolors.ENDC)
pause = raw_input(bcolors.BOLD + "\nDon't miss it! Sep 23 - Sep 27th! Press {return} to continue." + bcolors.ENDC)
print_warning(bcolors.BOLD + "YAYYYYYYYYYYYYYYYYYYYYYY DerbyCon.\n\nDerbyCon 6.0 -- September 23th - 25th 2016" + bcolors.ENDC)
pause = raw_input(bcolors.BOLD + "\nDon't miss it! Sep 23 - Sep 25th! Press {return} to continue." + bcolors.ENDC)
# quit out
if main_menu_choice == 'exit' or main_menu_choice == "99" or main_menu_choice == "quit":
@ -244,12 +244,12 @@ The Social-Engineer Toolkit is designed purely for good and not evil. If you are
# handle keyboard interrupts
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"
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")
# handle exceptions
except Exception, error:
except Exception as error:
log(error)
print "\n\n[!] Something went wrong, printing the error: "+ str(error)
print ("\n\n[!] Something went wrong, printing the error: "+ str(error))
# cleanup routine
cleanup_routine()

View file

@ -233,7 +233,7 @@ def print_error(message):
print bcolors.RED + bcolors.BOLD + "[!] " + bcolors.ENDC + bcolors.RED + str(message) + bcolors.ENDC
def get_version():
define_version = '6.5.9'
define_version = '7.0'
return define_version
class create_menu:
@ -792,8 +792,8 @@ def show_banner(define_version,graphic):
print bcolors.BLUE + """
[---] The Social-Engineer Toolkit ("""+bcolors.YELLOW+"""SET"""+bcolors.BLUE+""") [---]
[---] Created by:""" + bcolors.RED+""" David Kennedy """+bcolors.BLUE+"""("""+bcolors.YELLOW+"""ReL1K"""+bcolors.BLUE+""") [---]
[---] Version: """+bcolors.RED+"""%s""" % (define_version) +bcolors.BLUE+""" [---]
[---] Codename: '""" + bcolors.YELLOW + """Mr. Robot""" + bcolors.BLUE + """' [---]
[---] Version: """+bcolors.RED+"""%s""" % (define_version) +bcolors.BLUE+""" [---]
[---] Codename: '""" + bcolors.YELLOW + """S.O.B.""" + bcolors.BLUE + """' [---]
[---] Follow us on Twitter: """ + bcolors.PURPLE+ """@TrustedSec""" + bcolors.BLUE+""" [---]
[---] Follow me on Twitter: """ + bcolors.PURPLE+ """@HackingDave""" + bcolors.BLUE+""" [---]
[---] Homepage: """ + bcolors.YELLOW + """https://www.trustedsec.com""" + bcolors.BLUE+""" [---]