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)