Liner improvements

This commit is contained in:
VakarisZ 2019-11-18 16:31:11 +02:00
parent 05acd504fb
commit 9a53337319
2 changed files with 124 additions and 112 deletions

View File

@ -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: <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
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
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
<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: <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.
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 <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.
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 <https://github.com/guardicore/mimikatz/releases/tag/1.1.0>
- 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: <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
- Available here:
- 32bit: <https://github.com/guardicore/monkey/releases/download/1.6/traceroute32>
- 64bit: <https://github.com/guardicore/monkey/releases/download/1.6/traceroute64>

View File

@ -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 <PATH TO BIN>\Python37" Where <PATH TO BIN> is the path to the bin folder created on step 1.
- Run "python -m virtualenv --relocatable <PATH TO BIN>\Python37"
- Install the required python libraries using "<PATH TO BIN>\Python37\Scripts\python -m pip install -r monkey_island\requirements.txt"
- Copy DLLs from installation path (Usually C:\Python27\DLLs) to <PATH TO BIN>\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: <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 <PATH TO BIN>\Python37" Where <PATH TO BIN> is the path to the bin folder created on step 1.
- Run "python -m virtualenv --relocatable <PATH TO BIN>\Python37"
- Install the required python libraries using "<PATH TO BIN>\Python37\Scripts\python -m pip install -r monkey_island\requirements.txt"
- Copy DLLs from installation path (Usually C:\Python27\DLLs) to <PATH TO BIN>\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: <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
- Use already running instance of mongodb
1. Run 'set MONKEY_MONGO_URL="mongodb://<SERVER ADDR>:27017/monkeyisland"'. Replace '<SERVER ADDR>' with address of mongo server
1. Run 'set MONKEY_MONGO_URL="mongodb://<SERVER ADDR>:27017/monkeyisland"'. Replace '<SERVER ADDR>' 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: <https://indy.fulgan.com/SSL/Archive/openssl-1.0.2l-i386-win32.zip>
- 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: <https://go.microsoft.com/fwlink/?LinkId=746572>
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: <https://www.npmjs.com/get-npm>
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://<SERVER ADDR>:27017/monkeyisland"`. Replace '<SERVER ADDR>' 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)