#!/bin/bash
# Global variables
arch="$(uname -m)"
# Edge cases... urgh. There *was* a reason it's like this. It'll get tested further
# later and get cleaned up as required in a later patch.
nukewinedir=""
silent=false
os="$(awk -F '=' '/^ID=/ {print $2}' /etc/os-release 2>&-)"
version="$(awk -F '=' '/^VERSION_ID=/ {print $2}' /etc/os-release 2>&-)"
arg=""
errors=""
outputfolder="/usr/share/veil-output"
runuser="$(whoami)"
if [ "${os}" == "ubuntu" ] || [ "${os}" == "arch" ]; then
trueuser="$(who | tr -d '\n' | cut -d' ' -f1)"
else
trueuser="$(who am i | cut -d' ' -f1)" # If this is blank, we're actually root (kali)
fi
if [ "${runuser}" == "root" ] && [ "${trueuser}" == "" ]; then
trueuser="root"
fi
if [ "${trueuser}" != "root" ]; then
userhomedir="$(echo /home/${trueuser})"
else
userhomedir="${HOME}"
fi
userprimarygroup="$(id -Gn "${trueuser}" | cut -d' ' -f1)"
rootdir=$(cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd)
winedir="${userhomedir}/.config/wine/veil"
winedrive="${winedir}/drive_c"
BOLD="\033[01;01m" # Highlight
RED="\033[01;31m" # Issues/Errors
GREEN="\033[01;32m" # Success
YELLOW="\033[01;33m" # Warnings/Information
RESET="\033[00m" # Normal
########################################################################
# Title function
func_title(){
# Echo title
echo " =========================================================================="
echo " Veil-Evasion (Setup Script) | [Updated]: 2016-09-09"
echo " =========================================================================="
echo " [Web]: https://www.veil-framework.com/ | [Twitter]: @VeilFramework"
echo " =========================================================================="
echo ""
#echo "Debug: winedir = ${winedir}"
#echo "Debug: winedrive = ${winedrive}"
#echo "Debug: userhomedir = ${HOME}"
#echo "Debug: rootdir = ${rootdir}"
#echo "Debug: trueuser = ${trueuser}"
#echo "Debug: userprimarygroup = ${userprimarygroup}"
#echo "Debug: os = ${os}"
#echo "Debug: version = ${version}"
#echo ""
}
# Trap CTRl-C
function ctrl_c() {
echo -e "\n\n${RED}Quitting...${RESET}\n"
exit 2
}
# Environment checks
func_check_env(){
# Check sudo dependency
which sudo >/dev/null 2>&-
if [ "$?" -ne "0" ]; then
echo ""
echo -e " ${RED}[ERROR]: This setup script requires sudo!${RESET}"
echo " Please install and configure sudo then run this setup again."
echo " Example: For Debian/Ubuntu: apt-get -y install sudo"
echo " For Fedora 22+: dnf -y install sudo"
exit 1
fi
# Double check install
if [ "${os}" != "kali" ] || [ "${os}" == "parrot" ]; then
echo -e "\n ${BOLD}[!] NON-KALI Users: Before you begin the install, make sure that you have"
echo -e " the Metasploit-Framework installed before you proceed!${RESET}\n"
fi
if [ "${silent}" == "true" ]; then
echo -e "\n [?] ${BOLD}Are you sure you wish to install Veil-Evasion?${RESET}\n"
echo -e " Continue with installation? ([${BOLD}y${RESET}]/[${GREEN}S${RESET}]ilent/[${BOLD}n${RESET}]o): ${GREEN}S${RESET}"
else
echo -e "\n [?] ${BOLD}Are you sure you wish to install Veil-Evasion?${RESET}\n"
read -p ' Continue with installation? ([y]/[s]ilent/[N]o): ' installveil
if [ "${installveil}" == 's' ]; then
silent=true
elif [ "${installveil}" != 'y' ]; then
echo -e "\n ${RED}[ERROR]: Installation aborted by user.${RESET}\n"
exit 1
fi
fi
func_package_deps
# Check capstone dependency (Required for Backdoor Factory)
if [ -f "/etc/ld.so.conf.d/capstone.conf" ]; then
echo -e "\n\n [*] ${YELLOW}Capstone is already installed... Skipping...${RESET}\n"
else
func_capstone_deps
fi
# Check if (Wine) Python is already installed
if [ -f "${winedrive}/Python27/python27.dll" ] && [ -f "${winedrive}/Python27/python.exe" ] && [ -f "${winedrive}/Python27/Lib/site-packages/win32/win32api.pyd" ]; then
echo -e "\n\n [*] ${YELLOW}(Wine) Python is already installed... Skipping...${RESET}\n"
else
func_python_deps
fi
# Check if (Wine) Ruby is already installed
if [ -f "${winedrive}/Ruby187/bin/ruby.exe" ] && [ -d "${winedrive}/Ruby187/lib/ruby/gems/1.8/gems/win32-api-1.4.8-x86-mingw32/lib/win32/" ]; then
echo -e "\n\n [*] ${YELLOW}(Wine) Ruby is already installed... Skipping...${RESET}\n"
else
func_ruby_deps
fi
# Check if go is installed
if [ -f "/usr/src/go/bin/windows_386/go.exe" ]; then
echo -e "\n\n [*] ${YELLOW}Go is already installed... Skipping...${RESET}\n"
else
func_go_deps
fi
# Finally, update the config
if [ -f "/etc/veil/settings.py" ] && [ -d "${outputfolder}" ]; then
echo -e "\n\n [*] ${YELLOW}Setttings already detected... Skipping...${RESET}\n"
else
func_update_config
fi
}
# Install architecture dependent dependencies
func_package_deps(){
echo -e "\n\n [*] ${YELLOW}Initializing package installation${RESET}\n"
# Begin Wine install for multiple architectures
# Always install 32-bit support for 64-bit architectures
# Debian based distributions
if [ "${os}" == "ubuntu" ] || [ "${os}" == "debian" ] || [ "${os}" == "kali" ] || [ "${os}" == "parrot" ]; then
if [ "${silent}" == "true" ]; then
echo -e "\n\n [*] ${YELLOW}Silent Mode${RESET}: ${GREEN}Enabled${RESET}\n"
arg=" DEBIAN_FRONTEND=noninteractive"
fi
if [ "${arch}" == "x86_64" ]; then
echo -e "\n [*] ${YELLOW}Adding x86 architecture to x86_64 system for Wine${RESET}\n"
sudo dpkg --add-architecture i386
sudo apt-get -qq update
echo -e " [*] ${YELLOW}Installing Wine 32-bit and 64-bit binaries${RESET}"
if [ "${os}" != "ubuntu" ]; then
sudo ${arg} apt-get -y -qq install wine wine64 wine32
else # Special snowflakes... urghbuntu
sudo ${arg} apt-get -y -qq install wine-stable wine1.6 wine1.6-i386
fi
tmp="$?"
if [ "${tmp}" -ne "0" ]; then
msg="Failed to install Wine... Exit code: ${tmp}"
errors="${errors}\n${msg}"
echo -e " ${RED}[ERROR] ${msg}${RESET}\n"
fi
elif [ "${arch}" == "x86" ] || [ "${arch}" == "i686" ]; then
sudo apt-get -qq update
sudo ${arg} apt-get -y -qq install wine32
tmp="$?"
if [ "${tmp}" -ne "0" ]; then
msg="Failed to install Wine... Exit code: ${tmp}"
errors="${errors}\n${msg}"
echo -e " ${RED}[ERROR] ${msg}${RESET}\n"
fi
else # Dead code. We really shouldn't end up here, but, you never know...
echo -e "${RED}[ERROR]: Architecture ${arch} is not supported!\n${RESET}"
exit 1
fi
# Red Hat based distributions
elif [ "${os}" == "fedora" ] || [ "${os}" == "rhel" ] || [ "${os}" == "centos" ]; then
echo -e "\n\n [*] ${YELLOW}Installing Wine 32-bit on x86_64 System${RESET}"
sudo dnf install -y wine.i686 wine
tmp="$?"
if [ "${tmp}" -ne "0" ]; then
msg="Failed to install Wine x86_64... Exit code: ${tmp}"
errors="${errors}\n${msg}"
echo -e " ${RED}[ERROR] ${msg}${RESET}\n"
fi
elif [ "${os}" == "arch" ]; then
if grep -Fxq "#[multilib]" /etc/pacman.conf; then
echo "[multilib]\nInclude = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf
fi
sudo pacman -Syu ${args} --needed --noconfirm wine wine-mono wine_gecko git
tmp="$?"
if [ "${tmp}" -ne "0" ]; then
msg="Failed to install Wine x86_64... Exit code: ${tmp}"
errors="${errors}\n${msg}"
echo -e " ${RED}[ERROR] ${msg}${RESET}\n"
fi
fi
# Setup Wine prefices
# Because Veil currently only supports Win32 binaries, we have to set the WINEARCH PREFIX
# to use Win32. This is a potential issue for the future when Veil has windows 64-bit
# binary support. To get around this in setup and somewhat future proof for that eventuality,
# we're already going to look for an existing veil wine setup (~/.config/veil/
评论0
最新资源