monkey/monkey/infection_monkey
VakarisZ b791ee16e1
Merge pull request #1501 from guardicore/tunneling-revert-schema
Changed proxy schema for the agent
2021-09-29 10:54:03 +03:00
..
exploit Zoo: Add second hop bb test 2021-09-24 15:29:11 +02:00
model Remove unnecessary # noqa: F401 from __init__.py files 2021-09-23 13:38:47 -04:00
network Replace "LOG" naming convention with "logger" naming convention. 2021-08-31 09:51:34 -04:00
post_breach Agent: Change trap command signal to TERM 2021-09-02 07:55:47 -04:00
pyinstaller_hooks Agent: Add pyinstaller hooks for pypsrp 2021-08-25 14:44:31 -04:00
ransomware Replace "LOG" naming convention with "logger" naming convention. 2021-08-31 09:51:34 -04:00
system_info Remove the unnecessary "mimikatz" info from telemetry data since the exact same data is stored under "credentials" key 2021-09-28 13:03:10 +03:00
telemetry Remove T1129 attack technique from the codebase 2021-09-17 14:19:42 +03:00
transport Remove unnecessary # noqa: F401 from __init__.py files 2021-09-23 13:38:47 -04:00
utils Merge pull request #1436 from guardicore/1410/ut-autowindowsuser 2021-08-31 20:23:48 +05:30
Pipfile Agent: Remove editable pyspnego degendency 2021-09-23 14:14:32 -04:00
Pipfile.lock Agent: Remove editable pyspnego degendency 2021-09-23 14:14:32 -04:00
__init__.py Remove "__author__" lines from the source code 2021-07-28 12:43:28 -04:00
build_linux.sh Added version argument to monkey build scripts 2020-02-09 15:20:34 +02:00
build_windows.bat Added version argument to monkey build scripts 2020-02-09 15:20:34 +02:00
config.py Agent: Remove internet access check 2021-08-19 14:15:15 -04:00
control.py Agent: Changed proxy schema 2021-09-28 16:21:19 +02:00
dropper.py Replace "LOG" naming convention with "logger" naming convention. 2021-08-31 09:51:34 -04:00
example.conf Agent: Remove internet access check 2021-08-19 14:15:15 -04:00
main.py Replace "LOG" naming convention with "logger" naming convention. 2021-08-31 09:51:34 -04:00
monkey.ico Move everything under monkey 2018-05-23 16:05:41 +03:00
monkey.py Replace "LOG" naming convention with "logger" naming convention. 2021-08-31 09:51:34 -04:00
monkey.spec Agent: Remove traceroute binaries 2021-08-20 16:27:36 -04:00
monkeyfs.py Remove "__author__" lines from the source code 2021-07-28 12:43:28 -04:00
pyinstaller_utils.py Remove "__author__" lines from the source code 2021-07-28 12:43:28 -04:00
readme.md Agent: Remove traceroute binaries 2021-08-20 16:27:36 -04:00
system_singleton.py Replace "LOG" naming convention with "logger" naming convention. 2021-08-31 09:51:34 -04:00
tunnel.py Replace "LOG" naming convention with "logger" naming convention. 2021-08-31 09:51:34 -04:00
windows_upgrader.py Replace "LOG" naming convention with "logger" naming convention. 2021-08-31 09:51:34 -04:00

readme.md

Monkey island dev. env. setup guide

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
  • Sambacry binaries - Two linux binaries, 32/64 bit.

Windows

  1. Install python 3.7.4 and choose ADD to PATH option when installing.

    Download and install from: https://www.python.org/ftp/python/3.7.4/

    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
    • Close the console, make sure you execute all commands in a new cmd console from now on.
  2. Install further dependencies

  3. Download the dependent python packages using pip install -r requirements.txt

  4. Download and extract UPX binary to monkey\infection_monkey\bin\upx.exe: https://github.com/upx/upx/releases/download/v3.94/upx394w.zip

  5. Build/Download Sambacry

    • Build/Download according to sections at the end of this readme.
    • 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\monkey32.exe or dist\monkey64.exe depending on your version of Python

Linux

Tested on Ubuntu 16.04. 0. On older distributions of Ubuntu (16.04) you'll need to download python3.7 via ppa: - 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
    • python3.7 -m pip install pip
    • 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
    • python3.7 -m pipenv lock -r --dev > requirements.txt
    • python3.7 -m pip install -r requirements.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. To build, run in terminal:

    • cd [code location]/infection_monkey
    • chmod +x build_linux.sh
    • pipenv run ./build_linux.sh

    output is placed under dist/monkey32 or dist/monkey64 depending on your version of python

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
  2. Download our pre-built sambacry binaries

Troubleshooting

Some of the possible errors that may come up while trying to build the infection monkey:

Linux

When committing your changes for the first time, you may encounter some errors thrown by the pre-commit hooks. This is most likely because some python dependencies are missing from your system. To resolve this, use pipenv to create a requirements.txt for both the infection_monkey/ and monkey_island/ requirements and install it with pip.

  • cd [code location]/infection_monkey
  • python3.7 -m pipenv lock -r --dev > requirements.txt
  • python3.7 -m pip install -r requirements.txt

and

  • cd [code location]/monkey_island
  • python3.7 -m pipenv lock -r --dev > requirements.txt
  • python3.7 -m pip install -r requirements.txt