From 92a1d017206d4d136950b8877582396ee07710ce Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Mon, 18 Nov 2019 12:52:49 +0200 Subject: [PATCH 1/9] Improved infection monkey and monkey island readme documentation --- .../{readme.txt => readme.md} | 50 +++++----- monkey/monkey_island/readme.md | 98 +++++++++++++++++++ monkey/monkey_island/readme.txt | 91 ----------------- 3 files changed, 126 insertions(+), 113 deletions(-) rename monkey/infection_monkey/{readme.txt => readme.md} (72%) create mode 100644 monkey/monkey_island/readme.md delete mode 100644 monkey/monkey_island/readme.txt diff --git a/monkey/infection_monkey/readme.txt b/monkey/infection_monkey/readme.md similarity index 72% rename from monkey/infection_monkey/readme.txt rename to monkey/infection_monkey/readme.md index 06bf449da..03fb8c42f 100644 --- a/monkey/infection_monkey/readme.txt +++ b/monkey/infection_monkey/readme.md @@ -1,5 +1,7 @@ -To get development versions of Monkey Island and Monkey look into deployment scripts folder. -If you only want to build monkey from scratch you may reference instructions below. +>To easily setup development environment for Monkey Island and the Monkey look into deployment scripts folder. + +>If you want to setup dev. env. for the Monkey manually, refer to the instructions below. + The monkey is composed of three separate parts. * The Infection Monkey itself - PyInstaller compressed python archives @@ -7,20 +9,18 @@ The monkey is composed of three separate parts. * Mimikatz binaries - Two windows binaries, 32/64 bit. * Traceroute binaries - Two linux binaries, 32/64bit. ---- Windows --- +##Windows -1. Install python 2.7.15 - Download and install from: https://www.python.org/downloads/release/python-2715/ -2. Add python directories to PATH environment variable (if you didn't install ActiveState Python) - a. Run the following command on a cmd console (Replace C:\Python27 with your python directory if it's different) - setx /M PATH "%PATH%;C:\Python27;C:\Python27\Scripts - b. Close the console, make sure you execute all commands in a new cmd console from now on. -3. Install further dependencies - a. install VCForPython27.msi - https://aka.ms/vcpython27 - b. if not installed, install Microsoft Visual C++ 2010 SP1 Redistributable Package - 32bit: http://www.microsoft.com/en-us/download/details.aspx?id=8328 - 64bit: http://www.microsoft.com/en-us/download/details.aspx?id=13523 +1. Install python 3.7.4 + Download and install from: https://www.python.org/ftp/python/3.7.4/ +2. Add python directories to PATH environment variable + 1. Run the following command on a cmd console (Replace C:\Python37 with your python directory if it's different) + `setx /M PATH "%PATH%;C:\Python37;C:\Python37\Scripts` + 2. Close the console, make sure you execute all commands in a new cmd console from now on. +3. Install further dependencies + 1. if not installed, install Microsoft Visual C++ 2017 SP1 Redistributable Package + 32bit: https://aka.ms/vs/16/release/vc_redist.x86.exe + 64bit: https://go.microsoft.com/fwlink/?LinkId=746572 4. Download the dependent python packages using pip install -r requirements_windows.txt 5. Download and extract UPX binary to [source-path]\monkey\infection_monkey\bin\upx.exe: @@ -35,14 +35,20 @@ The monkey is composed of three separate parts. --- Linux --- -Tested on Ubuntu 16.04 and 17.04. - -1. Install dependencies by running: - sudo apt-get update - sudo apt-get install python-pip python-dev libffi-dev upx libssl-dev libc++1 +Tested on Ubuntu 16.04. +0. On older distributions of Ubuntu (16.04) you'll need to download python3.7 via ppa: + 1. `sudo add-apt-repository ppa:deadsnakes/ppa` + 2. `sudo apt-get update` + 3. `sudo apt install python3.7` +1. Install dependencies by running: + 1. `sudo apt install python3-pip` + 2. `python3.7 -m pip install pip` + 3. `sudo apt-get install python3.7-dev` + 4. `sudo apt-get install libffi-dev upx libssl-dev libc++1` + Install the python packages listed in requirements.txt using pip - cd [code location]/infection_monkey - pip install -r requirements_linux.txt + `cd [code location]/infection_monkey` + `python3.7 -m pip install -r requirements_linux.txt` 2. Build Sambacry binaries a. Build/Download according to sections at the end of this readme. b. Place the binaries under [code location]\infection_monkey\bin, under the names 'sc_monkey_runner32.so', 'sc_monkey_runner64.so' diff --git a/monkey/monkey_island/readme.md b/monkey/monkey_island/readme.md new file mode 100644 index 000000000..2e99c4842 --- /dev/null +++ b/monkey/monkey_island/readme.md @@ -0,0 +1,98 @@ +>To easily setup development environment for Monkey Island and the Monkey look into deployment scripts folder. + +>If you want to setup dev. env. for Island manually, refer to the instructions below. + +##How to set up the Monkey Island server: + +## On Windows: +0. Exclude the folder you are planning to install the Monkey in from your AV software, as it might block or delete files from the installation. +1. Create folder "bin" under monkey_island +2. Place portable version of Python 3.7.4 + 1. Download and install from: https://www.python.org/ftp/python/3.7.4/ + 2. Install virtualenv using "python -m pip install virtualenv" + 3. Create a virtualenv using "python -m virtualenv --always-copy \Python37" Where is the path to the bin folder created on step 1. + 4. Run "python -m virtualenv --relocatable \Python37" + 5. Install the required python libraries using "\Python37\Scripts\python -m pip install -r monkey_island\requirements.txt" + 6. Copy DLLs from installation path (Usually C:\Python27\DLLs) to \Python37\DLLs + 7. (Optional) You may uninstall Python3.7 if you like. +3. Setup mongodb (Use one of the following two options): + 1. Place portable version of mongodb + 1. Download from: https://downloads.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-latest.zip + 2. Extract contents from bin folder to monkey_island\bin\mongodb. + 3. Create monkey_island\db folder. + + OR + 3. Use already running instance of mongodb + 1. Run 'set MONKEY_MONGO_URL="mongodb://:27017/monkeyisland"'. Replace '' with address of mongo server + +4. Place portable version of OpenSSL + 1. Download from: https://indy.fulgan.com/SSL/Archive/openssl-1.0.2l-i386-win32.zip + 2. Extract content from bin folder to monkey_island\bin\openssl +5. Download and install Microsoft Visual C++ redistributable for Visual Studio 2017 + 1. Download and install from: https://go.microsoft.com/fwlink/?LinkId=746572 +6. Generate SSL Certificate + 1. run create_certificate.bat when your current working directory is monkey_island +7. Create the monkey_island\cc\binaries folder and put Infection Monkey binaries inside (binaries can be found in releases on github) + monkey-linux-64 - monkey binary for linux 64bit + monkey-linux-32 - monkey binary for linux 32bit + monkey-windows-32.exe - monkey binary for windows 32bit + monkey-windows-64.exe - monkey binary for windows 64bit +8. Install npm + 1. Download and install from: https://www.npmjs.com/get-npm +9. Build Monkey Island frontend + 1. cd to 'monkey_island\cc\ui' + 2. run 'npm update' + 3. run 'npm run dist' + +###How to run: +1. When your current working directory is monkey_island, run monkey_island\windows\run_server.bat + +##On Linux: +0. Get python 3.7 and pip if your linux distribution doesn't have it built in (following steps are for Ubuntu 16): + 1. `sudo add-apt-repository ppa:deadsnakes/ppa` + 2. `sudo apt-get update` + 3. `sudo apt install python3.7` + 4. `sudo apt install python3-pip` + 5. `python3.7 -m pip install pip` + 6. `sudo apt-get install python3.7-dev` +1. Install required packages: + 1. `sudo apt-get install libffi-dev upx libssl-dev libc++1 openssl` +2. Create the following directories in monkey island folder (execute from ./monkey): + 1. `mkdir -p ./monkey_island/bin/mongodb` + 2. `mkdir -p ./monkey_island/db` + 3. `mkdir -p ./monkey_island/cc/binaries` + +2. Install the packages from monkey_island/requirements.txt: + 1. `sudo python3.7 -m pip install -r ./monkey_island/requirements.txt` + +3. Put monkey binaries in /monkey_island/cc/binaries (binaries can be found in releases on github) + monkey-linux-64 - monkey binary for linux 64bit + monkey-linux-32 - monkey binary for linux 32bit + monkey-windows-32.exe - monkey binary for windows 32bit + monkey-windows-64.exe - monkey binary for windows 64bi + +4. Setup MongoDB (Use one of the two following options): + 1. Download MongoDB and extract it to /var/monkey_island/bin/mongodb: + 1. Run `./monkey_island/linux/install_mongo.sh ./monkey_island/bin/mongodb`. This will download and extract the relevant mongoDB for your OS. + + OR + 1. Use already running instance of mongodb + 1. Run `set MONKEY_MONGO_URL="mongodb://:27017/monkeyisland"`. Replace '' with address of mongo server + +6. Generate SSL Certificate: + 1. `cd ./monkey_island` + 2. `./linux/create_certificate.sh` + +8. Install npm and node by running: + 1. `sudo apt-get install curl` + 2. `curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -` + 3. `sudo apt-get install -y nodejs` + +9. Build Monkey Island frontend + 1. cd to 'monkey_island/cc/ui' + 4. `npm install sass-loader node-sass webpack --save-dev` + 5. `npm update` + 3. `npm run dist` + +###How to run: +1. When your current working directory is monkey, run ./monkey_island/linux/run.sh (located under /linux) diff --git a/monkey/monkey_island/readme.txt b/monkey/monkey_island/readme.txt deleted file mode 100644 index 87b2f8c40..000000000 --- a/monkey/monkey_island/readme.txt +++ /dev/null @@ -1,91 +0,0 @@ -To get development versions of Monkey Island and Monkey look into deployment scripts folder. -If you only want to run the software from source you may refer to the instructions below. - -How to set up the Monkey Island server: - ----------------- On Windows ----------------: -0. Exclude the folder you are planning to install the Monkey in from your AV software, as it might block or delete files from the installation. -1. Create folder "bin" under monkey_island -2. Place portable version of Python 2.7.15 - 2.1. Download and install from: https://www.python.org/downloads/release/python-2715/ - 2.2. Install virtualenv using "python -m pip install virtualenv" - 2.3. Create a virtualenv using "python -m virtualenv --always-copy \Python27" Where is the path to the bin folder created on step 1. - 2.4. Run "python -m virtualenv --relocatable \Python27" - 2.5. Install the required python libraries using "\Python27\Scripts\python -m pip install -r monkey_island\requirements.txt" - 2.6. Copy DLLs from installation path (Usually C:\Python27\DLLs) to \Python27\DLLs - 2.7. (Optional) You may uninstall Python27 if you like. -3. Setup mongodb (Use one of the following two options): - 3.a Place portable version of mongodb - 3.a.1. Download from: https://downloads.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-latest.zip - 3.a.2. Extract contents from bin folder to monkey_island\bin\mongodb. - 3.a.3. Create monkey_island\db folder. - OR - 3.b. Use already running instance of mongodb - 3.b.1. Run 'set MONKEY_MONGO_URL="mongodb://:27017/monkeyisland"'. Replace '' with address of mongo server - -4. Place portable version of OpenSSL - 4.1. Download from: https://indy.fulgan.com/SSL/Archive/openssl-1.0.2l-i386-win32.zip - 4.2. Extract content from bin folder to monkey_island\bin\openssl -5. Download and install Microsoft Visual C++ redistributable for Visual Studio 2017 - 5.1. Download and install from: https://go.microsoft.com/fwlink/?LinkId=746572 -6. Generate SSL Certificate - 6.1. run create_certificate.bat when your current working directory is monkey_island -7. Create the monkey_island\cc\binaries folder and put Infection Monkey binaries inside - monkey-linux-64 - monkey binary for linux 64bit - monkey-linux-32 - monkey binary for linux 32bit - monkey-windows-32.exe - monkey binary for windows 32bit - monkey-windows-64.exe - monkey binary for windows 64bit -8. Install npm - 8.1. Download and install from: https://www.npmjs.com/get-npm -9. Build Monkey Island frontend - 9.1. cd to 'monkey_island\cc\ui' - 9.2. run 'npm update' - 9.3. run 'npm run dist' - -How to run: -1. When your current working directory is monkey_island, run monkey_island\windows\run_server.bat - ----------------- On Linux ----------------: -1. Create the following directories: - sudo mkdir /var/monkey_island - sudo chmod 777 /var/monkey_island - mkdir -p /var/monkey_island/bin/mongodb - mkdir -p /var/monkey_island/db - mkdir -p /var/monkey_island/cc/binaries - -2. Install the packages from monkey_island/requirements.txt: - sudo python -m pip install -r /var/monkey_island/requirements.txt - If pip is not installed, install the python-pip package. Make sure the server is running Python 2.7 and not Python 3+. - -3. put monkey binaries in /var/monkey_island/cc/binaries - monkey-linux-64 - monkey binary for linux 64bit - monkey-linux-32 - monkey binary for linux 32bit - monkey-windows-32.exe - monkey binary for windows 32bit - monkey-windows-64.exe - monkey binary for windows 64bi - -4. Setup MongoDB (Use one of the two following options): - 4.a. Download MongoDB and extract it to /var/monkey_island/bin/mongodb - 4.a.1. Run '/var/monkey_island/linux/install_mongo.sh /var/monkey_island/bin/mongodb' - This will download and extract the relevant mongoDB for your OS. - OR - 4.b. Use already running instance of mongodb - 4.b.1. Run 'set MONKEY_MONGO_URL="mongodb://:27017/monkeyisland"'. Replace '' with address of mongo server - -5. install OpenSSL - sudo apt-get install openssl - -6. Generate SSL Certificate, Run create_certificate.sh (located under /linux) - -7. Copy monkey island server to /var/monkey_island: - cp -r [monkey_island_source]/cc /var/monkey_island/ - -8. Install npm - 8.1. Download and install from: https://www.npmjs.com/get-npm - -9. Build Monkey Island frontend - 9.1. cd to 'monkey_island/cc/ui' - 9.2. run 'npm update' - 9.3. run 'npm run dist' - -How to run: -1. When your current working directory is monkey, run ./monkey_island/linux/run.sh (located under /linux) From 9ce83110dc1e5379e7247611e8d320e09b00cba4 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Mon, 18 Nov 2019 12:53:20 +0200 Subject: [PATCH 2/9] Altered linux deployment files to fix minor bugs/fit documentation --- deployment_scripts/deploy_linux.sh | 2 ++ monkey/monkey_island/linux/create_certificate.sh | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/deployment_scripts/deploy_linux.sh b/deployment_scripts/deploy_linux.sh index 488911f15..f4c179141 100644 --- a/deployment_scripts/deploy_linux.sh +++ b/deployment_scripts/deploy_linux.sh @@ -70,6 +70,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-get update sudo apt install python3.7 log_message "Python 3.7 is now available with command 'python3.7'." python_cmd="python3.7" @@ -126,6 +127,7 @@ openssl x509 -req -days 366 -in cc/server.csr -signkey cc/server.key -out cc/ser # Update node log_message "Installing nodejs" cd "$ISLAND_PATH/cc/ui" || handle_error +sudo apt-get install curl curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - sudo apt-get install -y nodejs npm install sass-loader node-sass webpack --save-dev diff --git a/monkey/monkey_island/linux/create_certificate.sh b/monkey/monkey_island/linux/create_certificate.sh index 0aae17558..2c19945db 100644 --- a/monkey/monkey_island/linux/create_certificate.sh +++ b/monkey/monkey_island/linux/create_certificate.sh @@ -1,6 +1,6 @@ #!/bin/bash -cd /var/monkey/monkey_island -openssl genrsa -out cc/server.key 2048 -openssl req -new -key cc/server.key -out cc/server.csr -subj "/C=GB/ST=London/L=London/O=Global Security/OU=Monkey Department/CN=monkey.com" -openssl x509 -req -days 366 -in cc/server.csr -signkey cc/server.key -out cc/server.crt +openssl genrsa -out ./cc/server.key 2048 +openssl req -new -key ./cc/server.key -out ./cc/server.csr -subj "/C=GB/ST=London/L=London/O=Global Security/OU=Monkey Department/CN=monkey.com" +openssl x509 -req -days 366 -in ./cc/server.csr -signkey ./cc/server.key -out ./cc/server.crt + From 85ee605088449f3e04f1c87db0434b11ffeedda4 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Mon, 18 Nov 2019 13:13:13 +0200 Subject: [PATCH 3/9] Header fixes --- monkey/infection_monkey/readme.md | 10 +++++----- monkey/monkey_island/readme.md | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/monkey/infection_monkey/readme.md b/monkey/infection_monkey/readme.md index 03fb8c42f..e9477610b 100644 --- a/monkey/infection_monkey/readme.md +++ b/monkey/infection_monkey/readme.md @@ -9,7 +9,7 @@ The monkey is composed of three separate parts. * Mimikatz binaries - Two windows binaries, 32/64 bit. * Traceroute binaries - Two linux binaries, 32/64bit. -##Windows +## Windows 1. Install python 3.7.4 Download and install from: https://www.python.org/ftp/python/3.7.4/ @@ -33,7 +33,7 @@ The monkey is composed of three separate parts. build_windows.bat output is placed under dist\monkey.exe ---- Linux --- +## Linux Tested on Ubuntu 16.04. 0. On older distributions of Ubuntu (16.04) you'll need to download python3.7 via ppa: @@ -61,7 +61,7 @@ Tested on Ubuntu 16.04. ./build_linux.sh output is placed under dist/monkey --- Sambacry -- +### Sambacry Sambacry requires two standalone binaries to execute remotely. a. Build sambacry binaries yourself @@ -76,7 +76,7 @@ b. Download our pre-built sambacry binaries 32bit: https://github.com/guardicore/monkey/releases/download/1.6/sc_monkey_runner32.so 64bit: https://github.com/guardicore/monkey/releases/download/1.6/sc_monkey_runner64.so --- Mimikatz -- +### Mimikatz Mimikatz is required for the Monkey to be able to steal credentials on Windows. It's possible to either compile binaries from source (requires Visual Studio 2013 and up) or download them from our repository. a. Build Mimikatz yourself @@ -93,7 +93,7 @@ b. Download our pre-built mimikatz binaries b.1. Download both 32 and 64 bit zipped DLLs from https://github.com/guardicore/mimikatz/releases/tag/1.1.0 b.2. Place them under [code location]\infection_monkey\bin --- Traceroute -- +### Traceroute Traceroute requires two standalone binaries to execute remotely. The monkey carries the standalone binaries since traceroute isn't built in all Linux distributions. diff --git a/monkey/monkey_island/readme.md b/monkey/monkey_island/readme.md index 2e99c4842..1d2929a88 100644 --- a/monkey/monkey_island/readme.md +++ b/monkey/monkey_island/readme.md @@ -2,9 +2,9 @@ >If you want to setup dev. env. for Island manually, refer to the instructions below. -##How to set up the Monkey Island server: +## How to set up the Monkey Island server: -## On Windows: +### On Windows: 0. Exclude the folder you are planning to install the Monkey in from your AV software, as it might block or delete files from the installation. 1. Create folder "bin" under monkey_island 2. Place portable version of Python 3.7.4 @@ -44,10 +44,10 @@ 2. run 'npm update' 3. run 'npm run dist' -###How to run: +#### How to run: 1. When your current working directory is monkey_island, run monkey_island\windows\run_server.bat -##On Linux: +### On Linux: 0. Get python 3.7 and pip if your linux distribution doesn't have it built in (following steps are for Ubuntu 16): 1. `sudo add-apt-repository ppa:deadsnakes/ppa` 2. `sudo apt-get update` @@ -94,5 +94,5 @@ 5. `npm update` 3. `npm run dist` -###How to run: +#### How to run: 1. When your current working directory is monkey, run ./monkey_island/linux/run.sh (located under /linux) From 38f7a6d7f694d15c023e15669fe5c114c2660ecd Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Mon, 18 Nov 2019 14:14:29 +0200 Subject: [PATCH 4/9] Style fixes --- monkey/infection_monkey/readme.md | 89 +++++++++++++++---------------- monkey/monkey_island/readme.md | 78 +++++++++++++-------------- 2 files changed, 83 insertions(+), 84 deletions(-) diff --git a/monkey/infection_monkey/readme.md b/monkey/infection_monkey/readme.md index e9477610b..58c634a35 100644 --- a/monkey/infection_monkey/readme.md +++ b/monkey/infection_monkey/readme.md @@ -21,14 +21,14 @@ The monkey is composed of three separate parts. 1. if not installed, install Microsoft Visual C++ 2017 SP1 Redistributable Package 32bit: https://aka.ms/vs/16/release/vc_redist.x86.exe 64bit: https://go.microsoft.com/fwlink/?LinkId=746572 -4. Download the dependent python packages using +4. Download the dependent python packages using pip install -r requirements_windows.txt -5. Download and extract UPX binary to [source-path]\monkey\infection_monkey\bin\upx.exe: +5. Download and extract UPX binary to [source-path]\monkey\infection_monkey\bin\upx.exe: https://github.com/upx/upx/releases/download/v3.94/upx394w.zip -6. Build/Download Sambacry and Mimikatz binaries - a. Build/Download according to sections at the end of this readme. - b. Place the binaries under [code location]\infection_monkey\bin -7. To build the final exe: +6. Build/Download Sambacry and Mimikatz binaries + - Build/Download according to sections at the end of this readme. + - Place the binaries under [code location]\infection_monkey\bin +7. To build the final exe: cd [code location]/infection_monkey build_windows.bat output is placed under dist\monkey.exe @@ -37,24 +37,24 @@ The monkey is composed of three separate parts. Tested on Ubuntu 16.04. 0. On older distributions of Ubuntu (16.04) you'll need to download python3.7 via ppa: - 1. `sudo add-apt-repository ppa:deadsnakes/ppa` - 2. `sudo apt-get update` - 3. `sudo apt install python3.7` + - `sudo add-apt-repository ppa:deadsnakes/ppa` + - `sudo apt-get update` + - `sudo apt install python3.7` 1. Install dependencies by running: - 1. `sudo apt install python3-pip` - 2. `python3.7 -m pip install pip` - 3. `sudo apt-get install python3.7-dev` - 4. `sudo apt-get install libffi-dev upx libssl-dev libc++1` + - `sudo apt install python3-pip` + - `python3.7 -m pip install pip` + - `sudo apt-get install python3.7-dev` + - `sudo apt-get install libffi-dev upx libssl-dev libc++1` Install the python packages listed in requirements.txt using pip `cd [code location]/infection_monkey` `python3.7 -m pip install -r requirements_linux.txt` 2. Build Sambacry binaries - a. Build/Download according to sections at the end of this readme. - b. Place the binaries under [code location]\infection_monkey\bin, under the names 'sc_monkey_runner32.so', 'sc_monkey_runner64.so' + - Build/Download according to sections at the end of this readme. + - Place the binaries under [code location]\infection_monkey\bin, under the names 'sc_monkey_runner32.so', 'sc_monkey_runner64.so' 3. Build Traceroute binaries - a. Build/Download according to sections at the end of this readme. - b. Place the binaries under [code location]\infection_monkey\bin, under the names 'traceroute32', 'traceroute64' + - Build/Download according to sections at the end of this readme. + - Place the binaries under [code location]\infection_monkey\bin, under the names 'traceroute32', 'traceroute64' 4. To build, run in terminal: cd [code location]/infection_monkey chmod +x build_linux.sh @@ -64,34 +64,33 @@ Tested on Ubuntu 16.04. ### Sambacry Sambacry requires two standalone binaries to execute remotely. -a. Build sambacry binaries yourself - a.1. Install gcc-multilib if it's not installed - sudo apt-get install gcc-multilib - a.2. Build the binaries - cd [code location]/infection_monkey/exploit/sambacry_monkey_runner - ./build.sh +1. Build sambacry binaries yourself + - Install gcc-multilib if it's not installed `sudo apt-get install gcc-multilib` + - Build the binaries + 1. `cd [code location]/infection_monkey/exploit/sambacry_monkey_runner` + 2. `./build.sh` -b. Download our pre-built sambacry binaries - b.1. Available here: - 32bit: https://github.com/guardicore/monkey/releases/download/1.6/sc_monkey_runner32.so - 64bit: https://github.com/guardicore/monkey/releases/download/1.6/sc_monkey_runner64.so +2. Download our pre-built sambacry binaries + - Available here: + - 32bit: https://github.com/guardicore/monkey/releases/download/1.6/sc_monkey_runner32.so + - 64bit: https://github.com/guardicore/monkey/releases/download/1.6/sc_monkey_runner64.so ### Mimikatz Mimikatz is required for the Monkey to be able to steal credentials on Windows. It's possible to either compile binaries from source (requires Visual Studio 2013 and up) or download them from our repository. -a. Build Mimikatz yourself - a.0. Building mimikatz requires Visual Studio 2013 and up - a.1. Clone our version of mimikatz from https://github.com/guardicore/mimikatz/tree/1.1.0 - a.2. Build using Visual Studio. - a.3. Put each version in a zip file - a.3.1. The zip should contain only the Mimikatz DLL named tmpzipfile123456.dll - a.3.2. It should be protected using the password 'VTQpsJPXgZuXhX6x3V84G'. - a.3.3. The zip file should be named mk32.zip/mk64.zip accordingly. - a.3.4. Zipping with 7zip has been tested. Other zipping software may not work. +1. Build Mimikatz yourself + - Building mimikatz requires Visual Studio 2013 and up + - Clone our version of mimikatz from https://github.com/guardicore/mimikatz/tree/1.1.0 + - Build using Visual Studio. + - Put each version in a zip file + 1. The zip should contain only the Mimikatz DLL named tmpzipfile123456.dll + 2. It should be protected using the password 'VTQpsJPXgZuXhX6x3V84G'. + 3. The zip file should be named mk32.zip/mk64.zip accordingly. + 4. Zipping with 7zip has been tested. Other zipping software may not work. -b. Download our pre-built mimikatz binaries - b.1. Download both 32 and 64 bit zipped DLLs from https://github.com/guardicore/mimikatz/releases/tag/1.1.0 - b.2. Place them under [code location]\infection_monkey\bin +2. Download our pre-built mimikatz binaries + - Download both 32 and 64 bit zipped DLLs from https://github.com/guardicore/mimikatz/releases/tag/1.1.0 + - Place them under [code location]\infection_monkey\bin ### Traceroute @@ -99,9 +98,9 @@ Traceroute requires two standalone binaries to execute remotely. The monkey carries the standalone binaries since traceroute isn't built in all Linux distributions. You can either build them yourself or download pre-built binaries. -a. Build traceroute yourself - a.1. The sources of traceroute are available here with building instructions: http://traceroute.sourceforge.net -b. Download our pre-built traceroute binaries - b.1. Available here: - 32bit: https://github.com/guardicore/monkey/releases/download/1.6/traceroute32 - 64bit: https://github.com/guardicore/monkey/releases/download/1.6/traceroute64 +1. Build traceroute yourself + - The sources of traceroute are available here with building instructions: http://traceroute.sourceforge.net +1. Download our pre-built traceroute binaries + - Available here: + - 32bit: https://github.com/guardicore/monkey/releases/download/1.6/traceroute32 + - 64bit: https://github.com/guardicore/monkey/releases/download/1.6/traceroute64 diff --git a/monkey/monkey_island/readme.md b/monkey/monkey_island/readme.md index 1d2929a88..e475ff203 100644 --- a/monkey/monkey_island/readme.md +++ b/monkey/monkey_island/readme.md @@ -8,62 +8,62 @@ 0. Exclude the folder you are planning to install the Monkey in from your AV software, as it might block or delete files from the installation. 1. Create folder "bin" under monkey_island 2. Place portable version of Python 3.7.4 - 1. Download and install from: https://www.python.org/ftp/python/3.7.4/ - 2. Install virtualenv using "python -m pip install virtualenv" - 3. Create a virtualenv using "python -m virtualenv --always-copy \Python37" Where is the path to the bin folder created on step 1. - 4. Run "python -m virtualenv --relocatable \Python37" - 5. Install the required python libraries using "\Python37\Scripts\python -m pip install -r monkey_island\requirements.txt" - 6. Copy DLLs from installation path (Usually C:\Python27\DLLs) to \Python37\DLLs - 7. (Optional) You may uninstall Python3.7 if you like. + - Download and install from: https://www.python.org/ftp/python/3.7.4/ + - Install virtualenv using "python -m pip install virtualenv" + - Create a virtualenv using "python -m virtualenv --always-copy \Python37" Where is the path to the bin folder created on step 1. + - Run "python -m virtualenv --relocatable \Python37" + - Install the required python libraries using "\Python37\Scripts\python -m pip install -r monkey_island\requirements.txt" + - Copy DLLs from installation path (Usually C:\Python27\DLLs) to \Python37\DLLs + - (Optional) You may uninstall Python3.7 if you like. 3. Setup mongodb (Use one of the following two options): - 1. Place portable version of mongodb + - Place portable version of mongodb 1. Download from: https://downloads.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-latest.zip 2. Extract contents from bin folder to monkey_island\bin\mongodb. 3. Create monkey_island\db folder. OR - 3. Use already running instance of mongodb + - Use already running instance of mongodb 1. Run 'set MONKEY_MONGO_URL="mongodb://:27017/monkeyisland"'. Replace '' with address of mongo server 4. Place portable version of OpenSSL - 1. Download from: https://indy.fulgan.com/SSL/Archive/openssl-1.0.2l-i386-win32.zip - 2. Extract content from bin folder to monkey_island\bin\openssl + - Download from: https://indy.fulgan.com/SSL/Archive/openssl-1.0.2l-i386-win32.zip + - Extract content from bin folder to monkey_island\bin\openssl 5. Download and install Microsoft Visual C++ redistributable for Visual Studio 2017 - 1. Download and install from: https://go.microsoft.com/fwlink/?LinkId=746572 + - Download and install from: https://go.microsoft.com/fwlink/?LinkId=746572 6. Generate SSL Certificate - 1. run create_certificate.bat when your current working directory is monkey_island + - run create_certificate.bat when your current working directory is monkey_island 7. Create the monkey_island\cc\binaries folder and put Infection Monkey binaries inside (binaries can be found in releases on github) monkey-linux-64 - monkey binary for linux 64bit monkey-linux-32 - monkey binary for linux 32bit monkey-windows-32.exe - monkey binary for windows 32bit monkey-windows-64.exe - monkey binary for windows 64bit 8. Install npm - 1. Download and install from: https://www.npmjs.com/get-npm + - Download and install from: https://www.npmjs.com/get-npm 9. Build Monkey Island frontend - 1. cd to 'monkey_island\cc\ui' - 2. run 'npm update' - 3. run 'npm run dist' + - cd to 'monkey_island\cc\ui' + - run 'npm update' + - run 'npm run dist' #### How to run: 1. When your current working directory is monkey_island, run monkey_island\windows\run_server.bat ### On Linux: 0. Get python 3.7 and pip if your linux distribution doesn't have it built in (following steps are for Ubuntu 16): - 1. `sudo add-apt-repository ppa:deadsnakes/ppa` - 2. `sudo apt-get update` - 3. `sudo apt install python3.7` - 4. `sudo apt install python3-pip` - 5. `python3.7 -m pip install pip` - 6. `sudo apt-get install python3.7-dev` + - `sudo add-apt-repository ppa:deadsnakes/ppa` + - `sudo apt-get update` + - `sudo apt install python3.7` + - `sudo apt install python3-pip` + - `python3.7 -m pip install pip` + - `sudo apt-get install python3.7-dev` 1. Install required packages: - 1. `sudo apt-get install libffi-dev upx libssl-dev libc++1 openssl` + - `sudo apt-get install libffi-dev upx libssl-dev libc++1 openssl` 2. Create the following directories in monkey island folder (execute from ./monkey): - 1. `mkdir -p ./monkey_island/bin/mongodb` - 2. `mkdir -p ./monkey_island/db` - 3. `mkdir -p ./monkey_island/cc/binaries` + - `mkdir -p ./monkey_island/bin/mongodb` + - `mkdir -p ./monkey_island/db` + - `mkdir -p ./monkey_island/cc/binaries` 2. Install the packages from monkey_island/requirements.txt: - 1. `sudo python3.7 -m pip install -r ./monkey_island/requirements.txt` + - `sudo python3.7 -m pip install -r ./monkey_island/requirements.txt` 3. Put monkey binaries in /monkey_island/cc/binaries (binaries can be found in releases on github) monkey-linux-64 - monkey binary for linux 64bit @@ -72,27 +72,27 @@ monkey-windows-64.exe - monkey binary for windows 64bi 4. Setup MongoDB (Use one of the two following options): - 1. Download MongoDB and extract it to /var/monkey_island/bin/mongodb: + - Download MongoDB and extract it to /var/monkey_island/bin/mongodb: 1. Run `./monkey_island/linux/install_mongo.sh ./monkey_island/bin/mongodb`. This will download and extract the relevant mongoDB for your OS. OR - 1. Use already running instance of mongodb + - Use already running instance of mongodb 1. Run `set MONKEY_MONGO_URL="mongodb://:27017/monkeyisland"`. Replace '' with address of mongo server 6. Generate SSL Certificate: - 1. `cd ./monkey_island` - 2. `./linux/create_certificate.sh` + - `cd ./monkey_island` + - `./linux/create_certificate.sh` 8. Install npm and node by running: - 1. `sudo apt-get install curl` - 2. `curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -` - 3. `sudo apt-get install -y nodejs` + - `sudo apt-get install curl` + - `curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -` + - `sudo apt-get install -y nodejs` 9. Build Monkey Island frontend - 1. cd to 'monkey_island/cc/ui' - 4. `npm install sass-loader node-sass webpack --save-dev` - 5. `npm update` - 3. `npm run dist` + - cd to 'monkey_island/cc/ui' + - `npm install sass-loader node-sass webpack --save-dev` + - `npm update` + - `npm run dist` #### How to run: 1. When your current working directory is monkey, run ./monkey_island/linux/run.sh (located under /linux) From 05acd504fb12ac6f2b896d60bbc3bc972fdd18b8 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Mon, 18 Nov 2019 15:21:20 +0200 Subject: [PATCH 5/9] Added link to deployment scripts --- monkey/infection_monkey/readme.md | 2 +- monkey/monkey_island/readme.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/monkey/infection_monkey/readme.md b/monkey/infection_monkey/readme.md index 58c634a35..ea367ff9e 100644 --- a/monkey/infection_monkey/readme.md +++ b/monkey/infection_monkey/readme.md @@ -1,4 +1,4 @@ ->To easily setup development environment for Monkey Island and the Monkey look into deployment scripts folder. +>To easily setup development environment for Monkey Island and the Monkey look into [deployment scripts](../../deployment_scripts) folder. >If you want to setup dev. env. for the Monkey manually, refer to the instructions below. diff --git a/monkey/monkey_island/readme.md b/monkey/monkey_island/readme.md index e475ff203..33856d309 100644 --- a/monkey/monkey_island/readme.md +++ b/monkey/monkey_island/readme.md @@ -1,4 +1,4 @@ ->To easily setup development environment for Monkey Island and the Monkey look into deployment scripts folder. +>To easily setup development environment for Monkey Island and the Monkey look into [deployment scripts](../../deployment_scripts) folder. >If you want to setup dev. env. for Island manually, refer to the instructions below. From 9a53337319a764c150b88750aad34d09ccfecaed Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Mon, 18 Nov 2019 16:31:11 +0200 Subject: [PATCH 6/9] Liner improvements --- monkey/infection_monkey/readme.md | 117 +++++++++++++++-------------- monkey/monkey_island/readme.md | 119 ++++++++++++++++-------------- 2 files changed, 124 insertions(+), 112 deletions(-) diff --git a/monkey/infection_monkey/readme.md b/monkey/infection_monkey/readme.md index ea367ff9e..cadf1e5d8 100644 --- a/monkey/infection_monkey/readme.md +++ b/monkey/infection_monkey/readme.md @@ -1,37 +1,38 @@ ->To easily setup development environment for Monkey Island and the Monkey look into [deployment scripts](../../deployment_scripts) folder. +# Monkey island dev. env. setup guide +>To easily setup development environment for Monkey Island and the Monkey look into [deployment scripts](../../deployment_scripts) folder. >If you want to setup dev. env. for the Monkey manually, refer to the instructions below. - The monkey is composed of three separate parts. -* The Infection Monkey itself - PyInstaller compressed python archives -* Sambacry binaries - Two linux binaries, 32/64 bit. -* Mimikatz binaries - Two windows binaries, 32/64 bit. -* Traceroute binaries - Two linux binaries, 32/64bit. + +- The Infection Monkey itself - PyInstaller compressed python archives +- Sambacry binaries - Two linux binaries, 32/64 bit. +- Mimikatz binaries - Two windows binaries, 32/64 bit. +- Traceroute binaries - Two linux binaries, 32/64bit. ## Windows 1. Install python 3.7.4 - Download and install from: https://www.python.org/ftp/python/3.7.4/ + Download and install from: 2. Add python directories to PATH environment variable 1. Run the following command on a cmd console (Replace C:\Python37 with your python directory if it's different) `setx /M PATH "%PATH%;C:\Python37;C:\Python37\Scripts` 2. Close the console, make sure you execute all commands in a new cmd console from now on. 3. Install further dependencies - 1. if not installed, install Microsoft Visual C++ 2017 SP1 Redistributable Package - 32bit: https://aka.ms/vs/16/release/vc_redist.x86.exe - 64bit: https://go.microsoft.com/fwlink/?LinkId=746572 + 1. if not installed, install Microsoft Visual C++ 2017 SP1 Redistributable Package + 32bit: + 64bit: 4. Download the dependent python packages using - pip install -r requirements_windows.txt + pip install -r requirements_windows.txt 5. Download and extract UPX binary to [source-path]\monkey\infection_monkey\bin\upx.exe: - https://github.com/upx/upx/releases/download/v3.94/upx394w.zip + 6. Build/Download Sambacry and Mimikatz binaries - - Build/Download according to sections at the end of this readme. - - Place the binaries under [code location]\infection_monkey\bin + - Build/Download according to sections at the end of this readme. + - Place the binaries under [code location]\infection_monkey\bin 7. To build the final exe: - cd [code location]/infection_monkey - build_windows.bat - output is placed under dist\monkey.exe + - `cd [code location]/infection_monkey` + - `build_windows.bat` + - `output is placed under dist\monkey.exe` ## Linux @@ -40,57 +41,63 @@ Tested on Ubuntu 16.04. - `sudo add-apt-repository ppa:deadsnakes/ppa` - `sudo apt-get update` - `sudo apt install python3.7` + 1. Install dependencies by running: - - `sudo apt install python3-pip` + - `sudo apt install python3-pip` - `python3.7 -m pip install pip` - `sudo apt-get install python3.7-dev` - `sudo apt-get install libffi-dev upx libssl-dev libc++1` - - Install the python packages listed in requirements.txt using pip - `cd [code location]/infection_monkey` - `python3.7 -m pip install -r requirements_linux.txt` -2. Build Sambacry binaries - - Build/Download according to sections at the end of this readme. - - Place the binaries under [code location]\infection_monkey\bin, under the names 'sc_monkey_runner32.so', 'sc_monkey_runner64.so' -3. Build Traceroute binaries - - Build/Download according to sections at the end of this readme. - - Place the binaries under [code location]\infection_monkey\bin, under the names 'traceroute32', 'traceroute64' -4. To build, run in terminal: - cd [code location]/infection_monkey - chmod +x build_linux.sh - ./build_linux.sh - output is placed under dist/monkey + +2. Install the python packages listed in requirements.txt using pip + - `cd [code location]/infection_monkey` + - `python3.7 -m pip install -r requirements_linux.txt` + +3. Build Sambacry binaries + - Build/Download according to sections at the end of this readme. + - Place the binaries under [code location]\infection_monkey\bin, under the names 'sc_monkey_runner32.so', 'sc_monkey_runner64.so' + +4. Build Traceroute binaries + - Build/Download according to sections at the end of this readme. + - Place the binaries under [code location]\infection_monkey\bin, under the names 'traceroute32', 'traceroute64' + +5. To build, run in terminal: + `cd [code location]/infection_monkey` + `chmod +x build_linux.sh` + `./build_linux.sh` + `output is placed under dist/monkey` ### Sambacry Sambacry requires two standalone binaries to execute remotely. + 1. Build sambacry binaries yourself - - Install gcc-multilib if it's not installed `sudo apt-get install gcc-multilib` - - Build the binaries - 1. `cd [code location]/infection_monkey/exploit/sambacry_monkey_runner` - 2. `./build.sh` + - Install gcc-multilib if it's not installed `sudo apt-get install gcc-multilib` + - Build the binaries + 1. `cd [code location]/infection_monkey/exploit/sambacry_monkey_runner` + 2. `./build.sh` 2. Download our pre-built sambacry binaries - - Available here: - - 32bit: https://github.com/guardicore/monkey/releases/download/1.6/sc_monkey_runner32.so - - 64bit: https://github.com/guardicore/monkey/releases/download/1.6/sc_monkey_runner64.so + - Available here: + - 32bit: + - 64bit: ### Mimikatz Mimikatz is required for the Monkey to be able to steal credentials on Windows. It's possible to either compile binaries from source (requires Visual Studio 2013 and up) or download them from our repository. + 1. Build Mimikatz yourself - - Building mimikatz requires Visual Studio 2013 and up - - Clone our version of mimikatz from https://github.com/guardicore/mimikatz/tree/1.1.0 - - Build using Visual Studio. - - Put each version in a zip file - 1. The zip should contain only the Mimikatz DLL named tmpzipfile123456.dll - 2. It should be protected using the password 'VTQpsJPXgZuXhX6x3V84G'. - 3. The zip file should be named mk32.zip/mk64.zip accordingly. - 4. Zipping with 7zip has been tested. Other zipping software may not work. - + - Building mimikatz requires Visual Studio 2013 and up + - Clone our version of mimikatz from + - Build using Visual Studio. + - Put each version in a zip file + 1. The zip should contain only the Mimikatz DLL named tmpzipfile123456.dll + 2. It should be protected using the password 'VTQpsJPXgZuXhX6x3V84G'. + 3. The zip file should be named mk32.zip/mk64.zip accordingly. + 4. Zipping with 7zip has been tested. Other zipping software may not work. + 2. Download our pre-built mimikatz binaries - - Download both 32 and 64 bit zipped DLLs from https://github.com/guardicore/mimikatz/releases/tag/1.1.0 - - Place them under [code location]\infection_monkey\bin + - Download both 32 and 64 bit zipped DLLs from + - Place them under [code location]\infection_monkey\bin ### Traceroute @@ -99,8 +106,8 @@ The monkey carries the standalone binaries since traceroute isn't built in all L You can either build them yourself or download pre-built binaries. 1. Build traceroute yourself - - The sources of traceroute are available here with building instructions: http://traceroute.sourceforge.net + - The sources of traceroute are available here with building instructions: 1. Download our pre-built traceroute binaries - - Available here: - - 32bit: https://github.com/guardicore/monkey/releases/download/1.6/traceroute32 - - 64bit: https://github.com/guardicore/monkey/releases/download/1.6/traceroute64 + - Available here: + - 32bit: + - 64bit: diff --git a/monkey/monkey_island/readme.md b/monkey/monkey_island/readme.md index 33856d309..7bbc53166 100644 --- a/monkey/monkey_island/readme.md +++ b/monkey/monkey_island/readme.md @@ -1,98 +1,103 @@ ->To easily setup development environment for Monkey Island and the Monkey look into [deployment scripts](../../deployment_scripts) folder. +# Monkey island dev. env. setup guide +>To easily setup development environment for Monkey Island and the Monkey look into [deployment scripts](../../deployment_scripts) folder. >If you want to setup dev. env. for Island manually, refer to the instructions below. -## How to set up the Monkey Island server: +## How to set up the Monkey Island server -### On Windows: -0. Exclude the folder you are planning to install the Monkey in from your AV software, as it might block or delete files from the installation. -1. Create folder "bin" under monkey_island -2. Place portable version of Python 3.7.4 - - Download and install from: https://www.python.org/ftp/python/3.7.4/ - - Install virtualenv using "python -m pip install virtualenv" - - Create a virtualenv using "python -m virtualenv --always-copy \Python37" Where is the path to the bin folder created on step 1. - - Run "python -m virtualenv --relocatable \Python37" - - Install the required python libraries using "\Python37\Scripts\python -m pip install -r monkey_island\requirements.txt" - - Copy DLLs from installation path (Usually C:\Python27\DLLs) to \Python37\DLLs - - (Optional) You may uninstall Python3.7 if you like. -3. Setup mongodb (Use one of the following two options): +### On Windows + +1. Exclude the folder you are planning to install the Monkey in from your AV software, as it might block or delete files from the installation. +2. Create folder "bin" under monkey_island +3. Place portable version of Python 3.7.4 + - Download and install from: + - Install virtualenv using "python -m pip install virtualenv" + - Create a virtualenv using "python -m virtualenv --always-copy \Python37" Where is the path to the bin folder created on step 1. + - Run "python -m virtualenv --relocatable \Python37" + - Install the required python libraries using "\Python37\Scripts\python -m pip install -r monkey_island\requirements.txt" + - Copy DLLs from installation path (Usually C:\Python27\DLLs) to \Python37\DLLs + - (Optional) You may uninstall Python3.7 if you like. +4. Setup mongodb (Use one of the following two options): - Place portable version of mongodb - 1. Download from: https://downloads.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-latest.zip - 2. Extract contents from bin folder to monkey_island\bin\mongodb. - 3. Create monkey_island\db folder. - - OR + 1. Download from: + 2. Extract contents from bin folder to monkey_island\bin\mongodb. + 3. Create monkey_island\db folder. + + OR - Use already running instance of mongodb - 1. Run 'set MONKEY_MONGO_URL="mongodb://:27017/monkeyisland"'. Replace '' with address of mongo server + 1. Run 'set MONKEY_MONGO_URL="mongodb://:27017/monkeyisland"'. Replace '' with address of mongo server -4. Place portable version of OpenSSL - - Download from: https://indy.fulgan.com/SSL/Archive/openssl-1.0.2l-i386-win32.zip - - Extract content from bin folder to monkey_island\bin\openssl -5. Download and install Microsoft Visual C++ redistributable for Visual Studio 2017 - - Download and install from: https://go.microsoft.com/fwlink/?LinkId=746572 -6. Generate SSL Certificate - - run create_certificate.bat when your current working directory is monkey_island -7. Create the monkey_island\cc\binaries folder and put Infection Monkey binaries inside (binaries can be found in releases on github) - monkey-linux-64 - monkey binary for linux 64bit - monkey-linux-32 - monkey binary for linux 32bit - monkey-windows-32.exe - monkey binary for windows 32bit - monkey-windows-64.exe - monkey binary for windows 64bit -8. Install npm - - Download and install from: https://www.npmjs.com/get-npm -9. Build Monkey Island frontend - - cd to 'monkey_island\cc\ui' - - run 'npm update' - - run 'npm run dist' +5. Place portable version of OpenSSL + - Download from: + - Extract content from bin folder to monkey_island\bin\openssl +6. Download and install Microsoft Visual C++ redistributable for Visual Studio 2017 + - Download and install from: +7. Generate SSL Certificate + - run create_certificate.bat when your current working directory is monkey_island +8. Create the monkey_island\cc\binaries folder and put Infection Monkey binaries inside (binaries can be found in releases on github) + monkey-linux-64 - monkey binary for linux 64bit + monkey-linux-32 - monkey binary for linux 32bit + monkey-windows-32.exe - monkey binary for windows 32bit + monkey-windows-64.exe - monkey binary for windows 64bit +9. Install npm + - Download and install from: +10. Build Monkey Island frontend + - cd to 'monkey_island\cc\ui' + - run 'npm update' + - run 'npm run dist' + +#### How to run -#### How to run: 1. When your current working directory is monkey_island, run monkey_island\windows\run_server.bat -### On Linux: -0. Get python 3.7 and pip if your linux distribution doesn't have it built in (following steps are for Ubuntu 16): +### On Linux + +1. Get python 3.7 and pip if your linux distribution doesn't have it built in (following steps are for Ubuntu 16): - `sudo add-apt-repository ppa:deadsnakes/ppa` - `sudo apt-get update` - `sudo apt install python3.7` - - `sudo apt install python3-pip` + - `sudo apt install python3-pip` - `python3.7 -m pip install pip` - `sudo apt-get install python3.7-dev` -1. Install required packages: +2. Install required packages: - `sudo apt-get install libffi-dev upx libssl-dev libc++1 openssl` -2. Create the following directories in monkey island folder (execute from ./monkey): +3. Create the following directories in monkey island folder (execute from ./monkey): - `mkdir -p ./monkey_island/bin/mongodb` - `mkdir -p ./monkey_island/db` - `mkdir -p ./monkey_island/cc/binaries` -2. Install the packages from monkey_island/requirements.txt: - - `sudo python3.7 -m pip install -r ./monkey_island/requirements.txt` +4. Install the packages from monkey_island/requirements.txt: + - `sudo python3.7 -m pip install -r ./monkey_island/requirements.txt` -3. Put monkey binaries in /monkey_island/cc/binaries (binaries can be found in releases on github) +5. Put monkey binaries in /monkey_island/cc/binaries (binaries can be found in releases on github) monkey-linux-64 - monkey binary for linux 64bit - monkey-linux-32 - monkey binary for linux 32bit - monkey-windows-32.exe - monkey binary for windows 32bit - monkey-windows-64.exe - monkey binary for windows 64bi + monkey-linux-32 - monkey binary for linux 32bit + monkey-windows-32.exe - monkey binary for windows 32bit + monkey-windows-64.exe - monkey binary for windows 64bi -4. Setup MongoDB (Use one of the two following options): +6. Setup MongoDB (Use one of the two following options): - Download MongoDB and extract it to /var/monkey_island/bin/mongodb: 1. Run `./monkey_island/linux/install_mongo.sh ./monkey_island/bin/mongodb`. This will download and extract the relevant mongoDB for your OS. - + OR - Use already running instance of mongodb 1. Run `set MONKEY_MONGO_URL="mongodb://:27017/monkeyisland"`. Replace '' with address of mongo server -6. Generate SSL Certificate: +7. Generate SSL Certificate: - `cd ./monkey_island` - `./linux/create_certificate.sh` 8. Install npm and node by running: - - `sudo apt-get install curl` + - `sudo apt-get install curl` - `curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -` - `sudo apt-get install -y nodejs` 9. Build Monkey Island frontend - - cd to 'monkey_island/cc/ui' + - cd to 'monkey_island/cc/ui' - `npm install sass-loader node-sass webpack --save-dev` - `npm update` - - `npm run dist` + - `npm run dist` + +#### How to run -#### How to run: 1. When your current working directory is monkey, run ./monkey_island/linux/run.sh (located under /linux) From a6a8ae9783cad28791dc9b3918d81057ef95938a Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Tue, 19 Nov 2019 10:59:04 +0200 Subject: [PATCH 7/9] run_cc.bat bugfix and more readme style improvements --- monkey/infection_monkey/readme.md | 44 +++++++++++++------------ monkey/monkey_island/readme.md | 23 +++++++------ monkey/monkey_island/windows/run_cc.bat | 4 +-- 3 files changed, 36 insertions(+), 35 deletions(-) diff --git a/monkey/infection_monkey/readme.md b/monkey/infection_monkey/readme.md index cadf1e5d8..6db622eeb 100644 --- a/monkey/infection_monkey/readme.md +++ b/monkey/infection_monkey/readme.md @@ -12,25 +12,27 @@ The monkey is composed of three separate parts. ## Windows -1. Install python 3.7.4 +1. Install python 3.7.4 and choose **ADD to PATH** option when installing. + Download and install from: -2. Add python directories to PATH environment variable - 1. Run the following command on a cmd console (Replace C:\Python37 with your python directory if it's different) + + In case you still need to add python directories to path: + - Run the following command on a cmd console (Replace C:\Python37 with your python directory if it's different) `setx /M PATH "%PATH%;C:\Python37;C:\Python37\Scripts` - 2. Close the console, make sure you execute all commands in a new cmd console from now on. -3. Install further dependencies - 1. if not installed, install Microsoft Visual C++ 2017 SP1 Redistributable Package - 32bit: - 64bit: -4. Download the dependent python packages using - pip install -r requirements_windows.txt -5. Download and extract UPX binary to [source-path]\monkey\infection_monkey\bin\upx.exe: + - Close the console, make sure you execute all commands in a new cmd console from now on. +2. Install further dependencies + - if not installed, install Microsoft Visual C++ 2017 SP1 Redistributable Package + - 32bit: + - 64bit: +3. Download the dependent python packages using + `pip install -r requirements_windows.txt` +4. Download and extract UPX binary to monkey\infection_monkey\bin\upx.exe: -6. Build/Download Sambacry and Mimikatz binaries +5. Build/Download Sambacry and Mimikatz binaries - Build/Download according to sections at the end of this readme. - - Place the binaries under [code location]\infection_monkey\bin -7. To build the final exe: - - `cd [code location]/infection_monkey` + - Place the binaries under monkey\infection_monkey\bin +6. To build the final exe: + - `cd monkey\infection_monkey` - `build_windows.bat` - `output is placed under dist\monkey.exe` @@ -45,8 +47,7 @@ Tested on Ubuntu 16.04. 1. Install dependencies by running: - `sudo apt install python3-pip` - `python3.7 -m pip install pip` - - `sudo apt-get install python3.7-dev` - - `sudo apt-get install libffi-dev upx libssl-dev libc++1` + - `sudo apt-get install python3.7-dev libffi-dev upx libssl-dev libc++1` 2. Install the python packages listed in requirements.txt using pip - `cd [code location]/infection_monkey` @@ -61,10 +62,11 @@ Tested on Ubuntu 16.04. - Place the binaries under [code location]\infection_monkey\bin, under the names 'traceroute32', 'traceroute64' 5. To build, run in terminal: - `cd [code location]/infection_monkey` - `chmod +x build_linux.sh` - `./build_linux.sh` - `output is placed under dist/monkey` + - `cd [code location]/infection_monkey` + - `chmod +x build_linux.sh` + - `./build_linux.sh` + + output is placed under dist/monkey ### Sambacry diff --git a/monkey/monkey_island/readme.md b/monkey/monkey_island/readme.md index 7bbc53166..b333dab94 100644 --- a/monkey/monkey_island/readme.md +++ b/monkey/monkey_island/readme.md @@ -11,16 +11,12 @@ 2. Create folder "bin" under monkey_island 3. Place portable version of Python 3.7.4 - Download and install from: - - Install virtualenv using "python -m pip install virtualenv" - - Create a virtualenv using "python -m virtualenv --always-copy \Python37" Where is the path to the bin folder created on step 1. - - Run "python -m virtualenv --relocatable \Python37" - - Install the required python libraries using "\Python37\Scripts\python -m pip install -r monkey_island\requirements.txt" - - Copy DLLs from installation path (Usually C:\Python27\DLLs) to \Python37\DLLs - - (Optional) You may uninstall Python3.7 if you like. +4. Install Island's requirements + - `python -m pip install -r monkey_island\requirements.txt` 4. Setup mongodb (Use one of the following two options): - Place portable version of mongodb 1. Download from: - 2. Extract contents from bin folder to monkey_island\bin\mongodb. + 2. Extract contents of bin folder to monkey_island\bin\mongodb. 3. Create monkey_island\db folder. OR @@ -29,12 +25,12 @@ 5. Place portable version of OpenSSL - Download from: - - Extract content from bin folder to monkey_island\bin\openssl + - Extract contents to monkey_island\bin\openssl 6. Download and install Microsoft Visual C++ redistributable for Visual Studio 2017 - Download and install from: 7. Generate SSL Certificate - - run create_certificate.bat when your current working directory is monkey_island -8. Create the monkey_island\cc\binaries folder and put Infection Monkey binaries inside (binaries can be found in releases on github) + - run `./windows/create_certificate.bat` when your current working directory is monkey_island +8. Put Infection Monkey binaries inside monkey_island/cc/binaries (binaries can be found in releases on github or build from source) monkey-linux-64 - monkey binary for linux 64bit monkey-linux-32 - monkey binary for linux 32bit monkey-windows-32.exe - monkey binary for windows 32bit @@ -48,7 +44,7 @@ #### How to run -1. When your current working directory is monkey_island, run monkey_island\windows\run_server.bat +1. When your current working directory is monkey_island, run monkey_island\windows\run_server_py.bat ### On Linux @@ -73,7 +69,10 @@ monkey-linux-64 - monkey binary for linux 64bit monkey-linux-32 - monkey binary for linux 32bit monkey-windows-32.exe - monkey binary for windows 32bit - monkey-windows-64.exe - monkey binary for windows 64bi + monkey-windows-64.exe - monkey binary for windows 64bit + Also, if you're going to run monkeys on local machine execute: + - `chmod 755 ./monkey_island/cc/binaries/monkey-linux-64` + - `chmod 755 ./monkey_island/cc/binaries/monkey-linux-32` 6. Setup MongoDB (Use one of the two following options): - Download MongoDB and extract it to /var/monkey_island/bin/mongodb: diff --git a/monkey/monkey_island/windows/run_cc.bat b/monkey/monkey_island/windows/run_cc.bat index c1a2fd88e..c87f04cec 100644 --- a/monkey/monkey_island/windows/run_cc.bat +++ b/monkey/monkey_island/windows/run_cc.bat @@ -1,5 +1,5 @@ REM - Runs Monkey Island Server using python - @title C^&C Server @pushd .. -@monkey_island\bin\Python27\Scripts\python monkey_island.py -@popd \ No newline at end of file +@python monkey_island.py +@popd From 2656d021ae4be167bdd4e53e8d6db6c3117c9674 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Tue, 19 Nov 2019 12:46:46 +0200 Subject: [PATCH 8/9] CR improvement --- monkey/monkey_island/readme.md | 8 +++----- monkey/monkey_island/windows/create_certificate.bat | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/monkey/monkey_island/readme.md b/monkey/monkey_island/readme.md index b333dab94..5c15fc9a6 100644 --- a/monkey/monkey_island/readme.md +++ b/monkey/monkey_island/readme.md @@ -15,7 +15,7 @@ - `python -m pip install -r monkey_island\requirements.txt` 4. Setup mongodb (Use one of the following two options): - Place portable version of mongodb - 1. Download from: + 1. Download from: 2. Extract contents of bin folder to monkey_island\bin\mongodb. 3. Create monkey_island\db folder. @@ -24,7 +24,7 @@ 1. Run 'set MONKEY_MONGO_URL="mongodb://:27017/monkeyisland"'. Replace '' with address of mongo server 5. Place portable version of OpenSSL - - Download from: + - Download from: - Extract contents to monkey_island\bin\openssl 6. Download and install Microsoft Visual C++ redistributable for Visual Studio 2017 - Download and install from: @@ -51,10 +51,8 @@ 1. Get python 3.7 and pip if your linux distribution doesn't have it built in (following steps are for Ubuntu 16): - `sudo add-apt-repository ppa:deadsnakes/ppa` - `sudo apt-get update` - - `sudo apt install python3.7` - - `sudo apt install python3-pip` + - `sudo apt install python3.7 python3-pip python3.7-dev` - `python3.7 -m pip install pip` - - `sudo apt-get install python3.7-dev` 2. Install required packages: - `sudo apt-get install libffi-dev upx libssl-dev libc++1 openssl` 3. Create the following directories in monkey island folder (execute from ./monkey): diff --git a/monkey/monkey_island/windows/create_certificate.bat b/monkey/monkey_island/windows/create_certificate.bat index 0af3e9960..645c6fa25 100644 --- a/monkey/monkey_island/windows/create_certificate.bat +++ b/monkey/monkey_island/windows/create_certificate.bat @@ -14,5 +14,5 @@ copy "%mydir%windows\openssl.cfg" "%mydir%bin\openssl\openssl.cfg" @echo on "%mydir%bin\openssl\openssl.exe" genrsa -out "%mydir%cc\server.key" 1024 -"%mydir%bin\openssl\openssl.exe" req -new -config "%mydir%bin\openssl\openssl.cfg" -key "%mydir%cc\server.key" -out "%mydir%cc\server.csr" -subj "/C=GB/ST=London/L=London/O=Global Security/OU=Monkey Department/CN=monkey.com" -"%mydir%bin\openssl\openssl.exe" x509 -req -days 366 -in "%mydir%cc\server.csr" -signkey "%mydir%cc\server.key" -out "%mydir%cc\server.crt" \ No newline at end of file +"%mydir%bin\openssl\openssl.exe" req -new -config "%mydir%bin\openssl\openssl.cfg" -key "%mydir%cc\server.key" -out "%mydir%cc\server.csr" -subj "/OU=Monkey Department/CN=monkey.com" +"%mydir%bin\openssl\openssl.exe" x509 -req -days 366 -in "%mydir%cc\server.csr" -signkey "%mydir%cc\server.key" -out "%mydir%cc\server.crt" From bcd0046a09c2aa75c7e52dddd6f003c041b6e731 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Tue, 19 Nov 2019 13:13:00 +0200 Subject: [PATCH 9/9] removed unnecessary certificate subject keys in create_certificate.sh and improved the style a bit in readme.md --- monkey/monkey_island/linux/create_certificate.sh | 2 +- monkey/monkey_island/readme.md | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/monkey/monkey_island/linux/create_certificate.sh b/monkey/monkey_island/linux/create_certificate.sh index 2c19945db..72aace118 100644 --- a/monkey/monkey_island/linux/create_certificate.sh +++ b/monkey/monkey_island/linux/create_certificate.sh @@ -1,6 +1,6 @@ #!/bin/bash openssl genrsa -out ./cc/server.key 2048 -openssl req -new -key ./cc/server.key -out ./cc/server.csr -subj "/C=GB/ST=London/L=London/O=Global Security/OU=Monkey Department/CN=monkey.com" +openssl req -new -key ./cc/server.key -out ./cc/server.csr -subj "/OU=Monkey Department/CN=monkey.com" openssl x509 -req -days 366 -in ./cc/server.csr -signkey ./cc/server.key -out ./cc/server.crt diff --git a/monkey/monkey_island/readme.md b/monkey/monkey_island/readme.md index 5c15fc9a6..e0c04e0bb 100644 --- a/monkey/monkey_island/readme.md +++ b/monkey/monkey_island/readme.md @@ -8,15 +8,15 @@ ### On Windows 1. Exclude the folder you are planning to install the Monkey in from your AV software, as it might block or delete files from the installation. -2. Create folder "bin" under monkey_island +2. Create folder "bin" under monkey\monkey_island 3. Place portable version of Python 3.7.4 - Download and install from: 4. Install Island's requirements - - `python -m pip install -r monkey_island\requirements.txt` + - `python -m pip install -r monkey\monkey_island\requirements.txt` 4. Setup mongodb (Use one of the following two options): - Place portable version of mongodb 1. Download from: - 2. Extract contents of bin folder to monkey_island\bin\mongodb. + 2. Extract contents of bin folder to \monkey\monkey_island\bin\mongodb. 3. Create monkey_island\db folder. OR @@ -63,17 +63,22 @@ 4. Install the packages from monkey_island/requirements.txt: - `sudo python3.7 -m pip install -r ./monkey_island/requirements.txt` -5. Put monkey binaries in /monkey_island/cc/binaries (binaries can be found in releases on github) +5. Put monkey binaries in /monkey_island/cc/binaries (binaries can be found in releases on github). + monkey-linux-64 - monkey binary for linux 64bit + monkey-linux-32 - monkey binary for linux 32bit + monkey-windows-32.exe - monkey binary for windows 32bit + monkey-windows-64.exe - monkey binary for windows 64bit + Also, if you're going to run monkeys on local machine execute: - `chmod 755 ./monkey_island/cc/binaries/monkey-linux-64` - `chmod 755 ./monkey_island/cc/binaries/monkey-linux-32` 6. Setup MongoDB (Use one of the two following options): - - Download MongoDB and extract it to /var/monkey_island/bin/mongodb: + - Download MongoDB and extract it to monkey/monkey_island/bin/mongodb: 1. Run `./monkey_island/linux/install_mongo.sh ./monkey_island/bin/mongodb`. This will download and extract the relevant mongoDB for your OS. OR @@ -82,6 +87,7 @@ 7. Generate SSL Certificate: - `cd ./monkey_island` + - `chmod 755 ./linux/create_certificate.sh` - `./linux/create_certificate.sh` 8. Install npm and node by running: