monkey/monkey/infection_monkey
Mike Salvatore 46da0b7b1f agent: Add ITelem interface
Create a telemetry interface that sits above the BaseTelem abstract
class to allow telemetries to be extended without inheritance.
2021-06-24 12:07:14 -04:00
..
exploit Replace "remote_user_pwd" with "random_password" 2021-05-17 22:51:14 +05:30
model Remove unused variables `GENERAL_CMDLINE_LINUX` and `MONKEY_CMDLINE_HTTP` in `infection_monkey/model/__init__.py` 2021-05-05 19:20:05 +05:30
network Remove unused import in infection_monkey/network/info.py 2021-05-06 22:42:28 +05:30
post_breach Replace "remote_user_pwd" with "random_password" 2021-05-17 22:51:14 +05:30
pyinstaller_hooks Reformat all python with black v20.8b1 2021-04-06 09:20:18 -04:00
ransomware agent: Rename RansomwareBitflipEncryptor -> BitflipEncryptor 2021-06-23 11:05:34 -04:00
system_info Remove unused const `WMI_LDAP_CLASSES` in `infection_monkey/system_info/wmi_consts.py` 2021-05-06 14:13:55 +05:30
telemetry agent: Add ITelem interface 2021-06-24 12:07:14 -04:00
transport Remove unused `proxy_via` in `infection_monkey/transport/http.py` 2021-05-06 14:02:32 +05:30
utils agent: Add utility functions for flipping bits 2021-06-23 06:57:31 -04:00
Pipfile Added altpgraph to the Pipfile. 2021-06-15 14:53:30 -04:00
Pipfile.lock Added altpgraph to the Pipfile. 2021-06-15 14:53:30 -04:00
__init__.py Reformat all python with black v20.8b1 2021-04-06 09:20:18 -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 Refactor ransomware configuration option from flattened to a dict that encompasses any ransomware options 2021-06-22 16:42:09 +03:00
control.py Fix DUO123 warnings 2021-04-28 10:46:41 -04:00
dropper.py agent: Add TODOs regarding string templates. 2021-04-28 11:00:53 -04:00
example.conf Generate password randomly when creating a new user for Create User PBA and exploit MS08_67 using https://docs.python.org/3.7/library/secrets.html#secrets.token_urlsafe 2021-05-17 19:10:40 +05:30
main.py Fixed screwed up formatting with black 2021-04-07 13:40:01 -04:00
monkey.ico Move everything under monkey 2018-05-23 16:05:41 +03:00
monkey.py telem: Add ransomware telemetry 2021-06-24 10:26:00 -04:00
monkey.spec Removed unnecessary explicit ScoutSuite import in monkey spec file 2021-03-23 14:15:57 +02:00
monkeyfs.py Remove unused `_mode` in `infection_monkey/monkeyfs.py` 2021-05-06 16:16:20 +05:30
pyinstaller_utils.py All E501 errors fixed, but formatting screwed up 2021-04-07 13:40:01 -04:00
readme.md Added troubleshooting section to infection monkey readme and monkey_island readme. 2021-06-16 06:57:40 -04:00
system_singleton.py Remove unused property `locked` in `infection_monkey/system_singleton.py` 2021-05-06 14:09:28 +05:30
tunnel.py Fixed screwed up formatting with black 2021-04-07 13:40:01 -04:00
windows_upgrader.py agent: Add TODOs regarding string templates. 2021-04-28 11:00:53 -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.
  • Traceroute binaries - Two linux binaries, 32/64bit.

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. 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
    • 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

Traceroute

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.

  1. Build traceroute yourself
  2. Download our pre-built traceroute 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