2015-08-05 18:36:39 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-11-21 23:24:17 +00:00
|
|
|
|
2017-08-16 23:22:12 +00:00
|
|
|
# functions
|
2017-08-14 19:21:12 +00:00
|
|
|
|
2017-08-16 23:22:12 +00:00
|
|
|
# Install Powershell on Linux
|
|
|
|
function install_powershell {
|
|
|
|
if uname | grep -q "Darwin"; then
|
|
|
|
brew install openssl
|
|
|
|
brew install curl --with-openssl
|
|
|
|
brew tap caskroom/cask
|
|
|
|
brew cask install powershell
|
|
|
|
else
|
2017-12-18 07:26:08 +00:00
|
|
|
if [ ! which powershell > /dev/null ] && [ ! which pwsh > /dev/null ]; then
|
2017-09-10 07:12:46 +00:00
|
|
|
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
|
|
|
|
curl https://packages.microsoft.com/config/ubuntu/14.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list
|
|
|
|
apt-get update
|
2017-11-17 03:56:37 +00:00
|
|
|
fi
|
|
|
|
apt-get install -y powershell
|
|
|
|
if ls /opt/microsoft/powershell/*/DELETE_ME_TO_DISABLE_CONSOLEHOST_TELEMETRY; then
|
2017-09-10 07:12:46 +00:00
|
|
|
rm /opt/microsoft/powershell/*/DELETE_ME_TO_DISABLE_CONSOLEHOST_TELEMETRY
|
2017-05-17 02:02:53 +00:00
|
|
|
fi
|
2017-08-16 23:22:12 +00:00
|
|
|
fi
|
|
|
|
mkdir -p /usr/local/share/powershell/Modules
|
|
|
|
cp -r ../lib/powershell/Invoke-Obfuscation /usr/local/share/powershell/Modules
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Ask for the administrator password upfront so sudo is no longer required at Installation.
|
|
|
|
sudo -v
|
2016-09-23 18:04:35 +00:00
|
|
|
|
2015-11-21 23:24:17 +00:00
|
|
|
IFS='/' read -a array <<< pwd
|
|
|
|
|
|
|
|
if [[ "$(pwd)" != *setup ]]
|
|
|
|
then
|
|
|
|
cd ./setup
|
|
|
|
fi
|
|
|
|
|
2017-08-16 23:22:12 +00:00
|
|
|
# Check for PIP otherwise install it
|
|
|
|
if ! which pip > /dev/null; then
|
|
|
|
wget https://bootstrap.pypa.io/get-pip.py
|
|
|
|
python get-pip.py
|
|
|
|
fi
|
|
|
|
|
|
|
|
if uname | grep -q "Darwin"; then
|
|
|
|
install_powershell
|
|
|
|
sudo pip install -r requirements.txt --global-option=build_ext \
|
|
|
|
--global-option="-L/usr/local/opt/openssl/lib" \
|
|
|
|
--global-option="-I/usr/local/opt/openssl/include"
|
|
|
|
# In order to build dependencies these should be exproted.
|
|
|
|
export LDFLAGS=-L/usr/local/opt/openssl/lib
|
|
|
|
export CPPFLAGS=-I/usr/local/opt/openssl/include
|
2015-11-13 23:01:41 +00:00
|
|
|
else
|
2017-08-16 23:22:12 +00:00
|
|
|
|
|
|
|
version=$( lsb_release -r | grep -oP "[0-9]+" | head -1 )
|
|
|
|
if lsb_release -d | grep -q "Fedora"; then
|
|
|
|
Release=Fedora
|
|
|
|
sudo dnf install -y make g++ python-devel m2crypto python-m2ext swig python-iptools python3-iptools libxml2-devel default-jdk openssl-devel libssl1.0.0 libssl-dev
|
|
|
|
sudo pip install -r requirements.txt
|
|
|
|
elif lsb_release -d | grep -q "Kali"; then
|
|
|
|
Release=Kali
|
|
|
|
sudo apt-get install -y make g++ python-dev python-m2crypto swig python-pip libxml2-dev default-jdk libssl1.0.0 libssl-dev
|
|
|
|
sudo pip install -r requirements.txt
|
|
|
|
install_powershell
|
|
|
|
elif lsb_release -d | grep -q "Ubuntu"; then
|
|
|
|
Release=Ubuntu
|
|
|
|
sudo apt-get install -y make g++ python-dev python-m2crypto swig python-pip libxml2-dev default-jdk libssl1.0.0 libssl-dev
|
|
|
|
sudo pip install -r requirements.txt
|
|
|
|
install_powershell
|
|
|
|
else
|
|
|
|
echo "Unknown distro - Debian/Ubuntu Fallback"
|
|
|
|
sudo apt-get install -y make g++ python-dev python-m2crypto swig python-pip libxml2-dev default-jdk libffi-dev libssl1.0.0 libssl-dev
|
|
|
|
sudo pip install -r requirements.txt
|
|
|
|
install_powershell
|
|
|
|
fi
|
2015-11-13 23:01:41 +00:00
|
|
|
fi
|
2017-08-16 23:22:12 +00:00
|
|
|
|
|
|
|
# Installing xar
|
2016-09-29 02:32:56 +00:00
|
|
|
tar -xvf ../data/misc/xar-1.5.2.tar.gz
|
|
|
|
(cd xar-1.5.2 && ./configure)
|
|
|
|
(cd xar-1.5.2 && make)
|
2017-08-16 23:22:12 +00:00
|
|
|
(cd xar-1.5.2 && sudo make install)
|
|
|
|
|
|
|
|
# Installing bomutils
|
2016-09-29 02:32:56 +00:00
|
|
|
git clone https://github.com/hogliux/bomutils.git
|
|
|
|
(cd bomutils && make)
|
2017-08-16 23:22:12 +00:00
|
|
|
|
|
|
|
# NIT: This fails on OSX. Leaving it only on Linux instances.
|
|
|
|
if uname | grep -q "Linux"; then
|
|
|
|
(cd bomutils && make install)
|
|
|
|
fi
|
|
|
|
chmod 755 bomutils/build/bin/mkbom && sudo cp bomutils/build/bin/mkbom /usr/local/bin/.
|
|
|
|
|
|
|
|
|
2015-11-21 23:24:17 +00:00
|
|
|
# set up the database schema
|
2015-08-05 18:36:39 +00:00
|
|
|
./setup_database.py
|
2015-11-21 23:24:17 +00:00
|
|
|
|
|
|
|
# generate a cert
|
|
|
|
./cert.sh
|
|
|
|
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
echo -e '\n [*] Setup complete!\n'
|