forked from p15670423/monkey
Linux dev. env. deployment altered to support py3
This commit is contained in:
parent
6245be15eb
commit
eaee0451c5
|
@ -14,6 +14,12 @@ WINDOWS_32_BINARY_NAME="monkey-windows-32.exe"
|
||||||
WINDOWS_64_BINARY_URL="https://github.com/guardicore/monkey/releases/download/1.6/monkey-windows-64.exe"
|
WINDOWS_64_BINARY_URL="https://github.com/guardicore/monkey/releases/download/1.6/monkey-windows-64.exe"
|
||||||
WINDOWS_64_BINARY_NAME="monkey-windows-64.exe"
|
WINDOWS_64_BINARY_NAME="monkey-windows-64.exe"
|
||||||
|
|
||||||
|
# Other binaries for monkey
|
||||||
|
TRACEROUTE_64_BINARY_URL="https://github.com/guardicore/monkey/releases/download/1.6/traceroute64"
|
||||||
|
TRACEROUTE_32_BINARY_URL="https://github.com/guardicore/monkey/releases/download/1.6/traceroute32"
|
||||||
|
SAMBACRY_64_BINARY_URL="https://github.com/guardicore/monkey/releases/download/1.6/sc_monkey_runner64.so"
|
||||||
|
SAMBACRY_32_BINARY_URL="https://github.com/guardicore/monkey/releases/download/1.6/sc_monkey_runner32.so"
|
||||||
|
|
||||||
# Mongo url's
|
# Mongo url's
|
||||||
MONGO_DEBIAN_URL="https://downloads.mongodb.org/linux/mongodb-linux-x86_64-debian81-latest.tgz"
|
MONGO_DEBIAN_URL="https://downloads.mongodb.org/linux/mongodb-linux-x86_64-debian81-latest.tgz"
|
||||||
MONGO_UBUNTU_URL="https://downloads.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1604-latest.tgz"
|
MONGO_UBUNTU_URL="https://downloads.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1604-latest.tgz"
|
||||||
|
|
|
@ -11,9 +11,9 @@ fi
|
||||||
ISLAND_PATH="$monkey_home/monkey/monkey_island"
|
ISLAND_PATH="$monkey_home/monkey/monkey_island"
|
||||||
MONKEY_COMMON_PATH="$monkey_home/monkey/common/"
|
MONKEY_COMMON_PATH="$monkey_home/monkey/common/"
|
||||||
MONGO_PATH="$ISLAND_PATH/bin/mongodb"
|
MONGO_PATH="$ISLAND_PATH/bin/mongodb"
|
||||||
MONGO_BIN_PATH="$MONGO_PATH/bin"
|
|
||||||
ISLAND_DB_PATH="$ISLAND_PATH/db"
|
|
||||||
ISLAND_BINARIES_PATH="$ISLAND_PATH/cc/binaries"
|
ISLAND_BINARIES_PATH="$ISLAND_PATH/cc/binaries"
|
||||||
|
INFECTION_MONKEY_DIR="$monkey_home/monkey/infection_monkey"
|
||||||
|
MONKEY_BIN_DIR="$INFECTION_MONKEY_DIR/bin"
|
||||||
|
|
||||||
handle_error () {
|
handle_error () {
|
||||||
echo "Fix the errors above and rerun the script"
|
echo "Fix the errors above and rerun the script"
|
||||||
|
@ -52,25 +52,39 @@ fi
|
||||||
|
|
||||||
# Create folders
|
# Create folders
|
||||||
log_message "Creating island dirs under $ISLAND_PATH"
|
log_message "Creating island dirs under $ISLAND_PATH"
|
||||||
mkdir -p ${MONGO_BIN_PATH}
|
mkdir -p ${MONGO_PATH}
|
||||||
mkdir -p ${ISLAND_DB_PATH}
|
|
||||||
mkdir -p ${ISLAND_BINARIES_PATH} || handle_error
|
mkdir -p ${ISLAND_BINARIES_PATH} || handle_error
|
||||||
|
|
||||||
python_version=`python --version 2>&1`
|
# Detecting command that calls python 3.7
|
||||||
if [[ ${python_version} == *"command not found"* ]] || [[ ${python_version} != *"Python 2.7"* ]]; then
|
python_cmd=""
|
||||||
echo "Python 2.7 is not found or is not a default interpreter for 'python' command..."
|
if [[ `python --version 2>&1` == *"Python 3.7"* ]]; then
|
||||||
exit 1
|
python_cmd="python"
|
||||||
|
fi
|
||||||
|
if [[ `python37 --version 2>&1` == *"Python 3.7"* ]]; then
|
||||||
|
python_cmd="python37"
|
||||||
|
fi
|
||||||
|
if [[ `python3.7 --version 2>&1` == *"Python 3.7"* ]]; then
|
||||||
|
python_cmd="python3.7"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${python_cmd} == "" ]]; then
|
||||||
|
log_message "Python 3.7 command not found. Installing python 3.7."
|
||||||
|
sudo add-apt-repository ppa:deadsnakes/ppa
|
||||||
|
sudo apt install python3.7
|
||||||
|
log_message "Python 3.7 is now available with command 'python3.7'."
|
||||||
|
python_cmd="python3.7"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_message "Updating package list"
|
log_message "Updating package list"
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
|
|
||||||
log_message "Installing pip"
|
log_message "Installing pip"
|
||||||
sudo apt-get install python-pip
|
sudo apt install python3-pip
|
||||||
|
${python_cmd} -m pip install pip
|
||||||
|
|
||||||
log_message "Installing island requirements"
|
log_message "Installing island requirements"
|
||||||
requirements="$ISLAND_PATH/requirements.txt"
|
requirements="$ISLAND_PATH/requirements.txt"
|
||||||
python -m pip install --user -r ${requirements} || handle_error
|
${python_cmd} -m pip install --user --upgrade -r ${requirements} || handle_error
|
||||||
|
|
||||||
# Download binaries
|
# Download binaries
|
||||||
log_message "Downloading binaries"
|
log_message "Downloading binaries"
|
||||||
|
@ -89,7 +103,7 @@ linux_dist=`lsb_release -a 2> /dev/null`
|
||||||
|
|
||||||
# If a user haven't installed mongo manually check if we can install it with our script
|
# If a user haven't installed mongo manually check if we can install it with our script
|
||||||
log_message "Installing MongoDB"
|
log_message "Installing MongoDB"
|
||||||
${ISLAND_PATH}/linux/install_mongo.sh ${MONGO_BIN_PATH} || handle_error
|
${ISLAND_PATH}/linux/install_mongo.sh ${MONGO_PATH} || handle_error
|
||||||
|
|
||||||
log_message "Installing openssl"
|
log_message "Installing openssl"
|
||||||
sudo apt-get install openssl
|
sudo apt-get install openssl
|
||||||
|
@ -106,32 +120,38 @@ openssl x509 -req -days 366 -in cc/server.csr -signkey cc/server.key -out cc/ser
|
||||||
sudo chmod +x ${ISLAND_PATH}/linux/create_certificate.sh || handle_error
|
sudo chmod +x ${ISLAND_PATH}/linux/create_certificate.sh || handle_error
|
||||||
${ISLAND_PATH}/linux/create_certificate.sh || handle_error
|
${ISLAND_PATH}/linux/create_certificate.sh || handle_error
|
||||||
|
|
||||||
|
# Update node
|
||||||
|
log_message "Installing nodejs"
|
||||||
|
sudo apt-get install -y nodejs
|
||||||
|
|
||||||
# Install npm
|
# Install npm
|
||||||
log_message "Installing npm"
|
log_message "Installing npm"
|
||||||
sudo apt-get install npm
|
sudo apt-get install npm
|
||||||
|
npm update
|
||||||
# Update node
|
|
||||||
log_message "Updating node"
|
|
||||||
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
|
|
||||||
sudo apt-get install -y nodejs
|
|
||||||
|
|
||||||
log_message "Generating front end"
|
log_message "Generating front end"
|
||||||
cd "$ISLAND_PATH/cc/ui" || handle_error
|
cd "$ISLAND_PATH/cc/ui" || handle_error
|
||||||
npm update
|
|
||||||
npm run dist
|
npm run dist
|
||||||
|
|
||||||
# Monkey setup
|
# Monkey setup
|
||||||
log_message "Installing monkey requirements"
|
log_message "Installing monkey requirements"
|
||||||
sudo apt-get install python-pip python-dev libffi-dev upx libssl-dev libc++1
|
sudo apt-get install python-dev libffi-dev upx libssl-dev libc++1
|
||||||
cd ${monkey_home}/monkey/infection_monkey || handle_error
|
cd ${monkey_home}/monkey/infection_monkey || handle_error
|
||||||
python -m pip install --user -r requirements_linux.txt || handle_error
|
${python_cmd} -m pip install -r requirements_linux.txt --user --upgrade || handle_error
|
||||||
|
|
||||||
|
# Making dir for binaries
|
||||||
|
mkdir ${MONKEY_BIN_DIR}
|
||||||
|
|
||||||
|
# Download sambacry binaries
|
||||||
|
log_message "Downloading sambacry binaries"
|
||||||
|
wget -c -N -P ${MONKEY_BIN_DIR} ${SAMBACRY_64_BINARY_URL}
|
||||||
|
wget -c -N -P ${MONKEY_BIN_DIR} ${SAMBACRY_32_BINARY_URL}
|
||||||
|
|
||||||
|
# Download traceroute binaries
|
||||||
|
log_message "Downloading tracerout binaries"
|
||||||
|
wget -c -N -P ${MONKEY_BIN_DIR} ${TRACEROUTE_64_BINARY_URL}
|
||||||
|
wget -c -N -P ${MONKEY_BIN_DIR} ${TRACEROUTE_32_BINARY_URL}
|
||||||
|
|
||||||
# Build samba
|
|
||||||
log_message "Building samba binaries"
|
|
||||||
sudo apt-get install gcc-multilib
|
|
||||||
cd ${monkey_home}/monkey/infection_monkey/exploit/sambacry_monkey_runner
|
|
||||||
sudo chmod +x ./build.sh || handle_error
|
|
||||||
./build.sh
|
|
||||||
|
|
||||||
sudo chmod +x ${monkey_home}/monkey/infection_monkey/build_linux.sh
|
sudo chmod +x ${monkey_home}/monkey/infection_monkey/build_linux.sh
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
enum34
|
|
||||||
impacket
|
impacket
|
||||||
pycryptodome
|
pycryptodome
|
||||||
cffi
|
cffi
|
||||||
requests
|
requests
|
||||||
odict
|
odict
|
||||||
paramiko
|
paramiko
|
||||||
psutil==3.4.2
|
psutil
|
||||||
PyInstaller
|
PyInstaller
|
||||||
six
|
six
|
||||||
ecdsa
|
ecdsa
|
||||||
|
@ -14,4 +13,3 @@ ipaddress
|
||||||
wmi
|
wmi
|
||||||
pymssql
|
pymssql
|
||||||
pyftpdlib
|
pyftpdlib
|
||||||
enum34
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ then
|
||||||
elif [[ ${os_version_monkey} == "Ubuntu 18.04"* ]] ;
|
elif [[ ${os_version_monkey} == "Ubuntu 18.04"* ]] ;
|
||||||
then
|
then
|
||||||
echo Detected Ubuntu 18.04
|
echo Detected Ubuntu 18.04
|
||||||
export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.0.8.tgz"
|
export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.2.0.tgz"
|
||||||
elif [[ ${os_version_monkey} == "Debian GNU/Linux 8"* ]] ;
|
elif [[ ${os_version_monkey} == "Debian GNU/Linux 8"* ]] ;
|
||||||
then
|
then
|
||||||
echo Detected Debian 8
|
echo Detected Debian 8
|
||||||
|
@ -31,6 +31,7 @@ tar -xf mongodb.tgz
|
||||||
popd
|
popd
|
||||||
|
|
||||||
mkdir -p ${MONGODB_DIR}/bin
|
mkdir -p ${MONGODB_DIR}/bin
|
||||||
|
mkdir -p ${MONGODB_DIR}/db
|
||||||
cp ${TEMP_MONGO}/mongodb-*/bin/mongod ${MONGODB_DIR}/bin/mongod
|
cp ${TEMP_MONGO}/mongodb-*/bin/mongod ${MONGODB_DIR}/bin/mongod
|
||||||
cp ${TEMP_MONGO}/mongodb-*/LICENSE-Community.txt ${MONGODB_DIR}/
|
cp ${TEMP_MONGO}/mongodb-*/LICENSE-Community.txt ${MONGODB_DIR}/
|
||||||
chmod a+x ${MONGODB_DIR}/bin/mongod
|
chmod a+x ${MONGODB_DIR}/bin/mongod
|
||||||
|
|
|
@ -1,4 +1,16 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cd /var/monkey
|
# Detecting command that calls python 3.7
|
||||||
/var/monkey/monkey_island/bin/python/bin/python monkey_island.py
|
python_cmd=""
|
||||||
|
if [[ `python --version 2>&1` == *"Python 3.7"* ]]; then
|
||||||
|
python_cmd="python"
|
||||||
|
fi
|
||||||
|
if [[ `python37 --version 2>&1` == *"Python 3.7"* ]]; then
|
||||||
|
python_cmd="python37"
|
||||||
|
fi
|
||||||
|
if [[ `python3.7 --version 2>&1` == *"Python 3.7"* ]]; then
|
||||||
|
python_cmd="python3.7"
|
||||||
|
fi
|
||||||
|
|
||||||
|
./bin/mongodb/bin/mongod --dbpath ./bin/mongodb/db
|
||||||
|
${python_cmd} monkey_island.py
|
|
@ -1,4 +1,3 @@
|
||||||
bson
|
|
||||||
python-dateutil
|
python-dateutil
|
||||||
tornado
|
tornado
|
||||||
werkzeug
|
werkzeug
|
||||||
|
|
Loading…
Reference in New Issue