2012-12-31 22:11:37 +00:00
|
|
|
#!/usr/bin/env python
|
2016-07-28 20:19:04 +00:00
|
|
|
# coding=utf-8
|
2012-12-31 22:11:37 +00:00
|
|
|
#
|
|
|
|
# Python installer
|
|
|
|
#
|
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
import os
|
2013-01-01 15:32:48 +00:00
|
|
|
import platform
|
2012-12-31 22:11:37 +00:00
|
|
|
|
|
|
|
# if nix then run installer
|
2013-01-01 15:32:48 +00:00
|
|
|
if platform.system() == "Linux":
|
2012-12-31 22:11:37 +00:00
|
|
|
# give installer a null value
|
2013-12-18 06:06:29 +00:00
|
|
|
installer = False
|
2016-01-14 20:52:38 +00:00
|
|
|
|
|
|
|
# Check user ID
|
2015-05-24 22:02:03 +00:00
|
|
|
if os.getuid() != 0:
|
|
|
|
print("Are you root? Please execute as root")
|
|
|
|
exit()
|
2012-12-31 22:11:37 +00:00
|
|
|
|
|
|
|
try:
|
|
|
|
# if our command option is true then install stuff
|
|
|
|
if sys.argv[1] == "install":
|
|
|
|
installer = True
|
|
|
|
|
|
|
|
# if index is out of range then flag options
|
|
|
|
except IndexError:
|
2016-07-22 16:52:36 +00:00
|
|
|
print("** SET Dependency Installer **")
|
2015-05-24 22:02:03 +00:00
|
|
|
print("** Written by: Dave Kennedy (ReL1K) **")
|
|
|
|
print("** Visit: https://www.trustedsec.com **")
|
|
|
|
print("\nTo install: setup.py install")
|
2012-12-31 22:11:37 +00:00
|
|
|
|
|
|
|
# if user specified install then lets to the installation
|
2013-12-18 06:06:29 +00:00
|
|
|
if installer is True:
|
2012-12-31 22:11:37 +00:00
|
|
|
|
|
|
|
# if we trigger on sources.list then we know its ubuntu
|
|
|
|
if os.path.isfile("/etc/apt/sources.list"):
|
2013-03-16 19:47:25 +00:00
|
|
|
|
|
|
|
# force install of debian packages
|
2016-07-28 20:19:04 +00:00
|
|
|
subprocess.Popen("apt-get --force-yes -y install "
|
2016-12-02 03:54:03 +00:00
|
|
|
"git apache2 python-requests libapache2-mod-php5 "
|
2016-07-28 20:19:04 +00:00
|
|
|
"python-pymssql build-essential python-pexpect "
|
|
|
|
"python-pefile python-crypto python-openssl", shell=True).wait()
|
2012-12-31 22:11:37 +00:00
|
|
|
|
2015-05-24 22:02:03 +00:00
|
|
|
# If pacman.conf exists, we have a Arch based system
|
|
|
|
elif os.path.isfile("/etc/pacman.conf"):
|
2016-07-28 20:19:04 +00:00
|
|
|
subprocess.Popen("pacman -S --noconfirm --needed git python2 "
|
|
|
|
"python2-beautifulsoup3 python2-pexpect python2-crypto", shell=True).wait()
|
|
|
|
|
2016-11-15 13:08:26 +00:00
|
|
|
subprocess.Popen("wget https://github.com/erocarrera/pefile/archive/master.zip", shell=True).wait()
|
|
|
|
subprocess.Popen("unzip master.zip", shell=True).wait()
|
|
|
|
subprocess.Popen("chmod a+x pefile-master/setup.py", shell=True).wait()
|
|
|
|
subprocess.Popen("rm -rf pefile-master*", shell=True).wait()
|
2016-01-14 20:52:38 +00:00
|
|
|
|
2016-02-08 15:02:17 +00:00
|
|
|
# if dnf.conf is there, we are dealing with a >= fedora 22 - added thanks to whoismath pr
|
|
|
|
elif os.path.isfile("/etc/dnf/dnf.conf"):
|
|
|
|
subprocess.Popen("dnf -y install git python-pexpect python-pefile python-crypto pyOpenSSL", shell=True).wait()
|
|
|
|
|
2016-01-14 20:52:38 +00:00
|
|
|
# if sources.list or pacman.conf is not available then we're running
|
|
|
|
# something offset
|
2012-12-31 22:11:37 +00:00
|
|
|
else:
|
2016-07-28 20:19:04 +00:00
|
|
|
print("[!] You're not running a Debian, Fedora or Arch variant. Installer not finished for this type of Linux distro.")
|
2015-05-24 22:02:03 +00:00
|
|
|
print("[!] Install git, python-pexpect, python-crypto, python-openssl, python-pefile manually for all of SET dependancies.")
|
2012-12-31 22:11:37 +00:00
|
|
|
sys.exit()
|
2013-01-01 15:32:48 +00:00
|
|
|
|
2013-04-15 14:26:00 +00:00
|
|
|
if os.path.isdir("/usr/share/setoolkit"):
|
2016-07-28 20:19:04 +00:00
|
|
|
print("[!] SET is already installed in /usr/share/setoolkit. Remove and start again.")
|
2013-04-15 14:26:00 +00:00
|
|
|
sys.exit()
|
|
|
|
|
|
|
|
if not os.path.isfile("/usr/bin/git"):
|
2015-05-24 22:02:03 +00:00
|
|
|
print("[-] Install failed. GIT is not installed. SET will not continue.")
|
|
|
|
print("[!] Install GIT and run the installer again.")
|
2013-04-15 14:26:00 +00:00
|
|
|
sys.exit()
|
|
|
|
|
2016-07-21 11:23:56 +00:00
|
|
|
print("[*] Copying SET into the /usr/share/setoolkit directory...")
|
2016-06-23 01:19:03 +00:00
|
|
|
cwdpath = os.getcwd()
|
2016-07-22 16:52:36 +00:00
|
|
|
subprocess.Popen("cd ..;cp -rf %s /usr/share/setoolkit" % cwdpath, shell=True).wait()
|
2015-05-24 22:02:03 +00:00
|
|
|
print("[*] Installing setoolkit installer to /usr/bin/setoolkit...")
|
2016-07-28 20:19:04 +00:00
|
|
|
subprocess.Popen("echo #!/bin/bash > /usr/bin/setoolkit", shell=True).wait()
|
|
|
|
subprocess.Popen("echo cd /usr/share/setoolkit >> /usr/bin/setoolkit", shell=True).wait()
|
|
|
|
subprocess.Popen("echo exec python2 setoolkit $@ >> /usr/bin/setoolkit", shell=True).wait()
|
|
|
|
subprocess.Popen("cp /usr/share/setoolkit/seupdate /usr/bin/", shell=True).wait()
|
2013-07-25 12:46:13 +00:00
|
|
|
subprocess.Popen("chmod +x /usr/bin/setoolkit", shell=True).wait()
|
2016-06-23 01:19:03 +00:00
|
|
|
#print("[*] Note you will manually need to install Core Security 'Impacket'")
|
|
|
|
#print("[*] Download link: http://corelabs.coresecurity.com/index.php?module=Wiki&action=view&type=tool&name=Impacket")
|
2013-05-27 13:01:05 +00:00
|
|
|
# https://impacket.googlecode.com/files/impacket-0.9.10.tar.gz
|
2016-07-21 11:23:56 +00:00
|
|
|
#print("[*] Once downloaded, tar -zxvf impacket*, go to the directory and run python setup.py install.")
|
2015-05-24 22:02:03 +00:00
|
|
|
print("[*] We are now finished! To run SET, type setoolkit...")
|
2013-04-15 14:26:00 +00:00
|
|
|
|
2016-01-14 20:52:38 +00:00
|
|
|
if platform.system() == 'Darwin':
|
2016-07-28 20:19:04 +00:00
|
|
|
subprocess.Popen("easy_install pexpect pycrypto pyopenssl pefile", shell=True).wait()
|
2013-01-01 15:32:48 +00:00
|
|
|
|
2016-07-28 20:19:04 +00:00
|
|
|
if platform.system() not in ["Linux", "Darwin"]:
|
|
|
|
print("[!] Sorry this installer is not designed for any other system other "
|
|
|
|
"than Linux and Mac. Please install the Python dependencies manually.")
|