From 31357498e586ea58a9007130efd36407b315d32f Mon Sep 17 00:00:00 2001 From: Itay Mizeretz Date: Wed, 18 Oct 2017 12:10:52 +0300 Subject: [PATCH 1/4] Remove non-existing module require --- monkey_island/cc/ui/src/components/Main.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/monkey_island/cc/ui/src/components/Main.js b/monkey_island/cc/ui/src/components/Main.js index a05197559..a4d41f2af 100644 --- a/monkey_island/cc/ui/src/components/Main.js +++ b/monkey_island/cc/ui/src/components/Main.js @@ -14,9 +14,8 @@ import LicensePage from 'components/pages/LicensePage'; require('normalize.css/normalize.css'); require('react-data-components/css/table-twbs.css'); -require('styles/App.css') +require('styles/App.css'); require('react-toggle/style.css'); -require('github-markdown-css/github-markdown.css'); let logoImage = require('../images/monkey-logo.png'); let guardicoreLogoImage = require('../images/guardicore-logo.png'); From 93d4f08e90d58b5004c9493305ca6606a27a4ed3 Mon Sep 17 00:00:00 2001 From: Itay Mizeretz Date: Wed, 18 Oct 2017 16:00:52 +0300 Subject: [PATCH 2/4] manually infected machines now show all info shown on infected machines --- monkey_island/cc/ui/src/components/preview-pane/PreviewPane.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monkey_island/cc/ui/src/components/preview-pane/PreviewPane.js b/monkey_island/cc/ui/src/components/preview-pane/PreviewPane.js index 956446f10..842440149 100644 --- a/monkey_island/cc/ui/src/components/preview-pane/PreviewPane.js +++ b/monkey_island/cc/ui/src/components/preview-pane/PreviewPane.js @@ -201,7 +201,7 @@ class PreviewPaneComponent extends React.Component { info = this.scanInfo(this.props.item); break; case 'node': - info = this.props.item.group.includes('monkey') ? + info = this.props.item.group.includes('monkey', 'manual') ? this.infectedAssetInfo(this.props.item) : this.assetInfo(this.props.item); break; case 'island_edge': From 7807a46769f2abeca3c74cb20e127eb1c3213f66 Mon Sep 17 00:00:00 2001 From: Itay Mizeretz Date: Wed, 18 Oct 2017 16:06:03 +0300 Subject: [PATCH 3/4] Add all known telemetry types to dict + don't except when unknown telem_type is received telem_type + data don't have default value --- chaos_monkey/control.py | 4 ++-- monkey_island/cc/resources/telemetry.py | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/chaos_monkey/control.py b/chaos_monkey/control.py index ab5abec83..b4f2769cd 100644 --- a/chaos_monkey/control.py +++ b/chaos_monkey/control.py @@ -97,11 +97,11 @@ class ControlClient(object): return {} @staticmethod - def send_telemetry(tele_type='general', data=''): + def send_telemetry(telem_type, data): if not WormConfiguration.current_server: return try: - telemetry = {'monkey_guid': GUID, 'telem_type': tele_type, 'data': data} + telemetry = {'monkey_guid': GUID, 'telem_type': telem_type, 'data': data} reply = requests.post("https://%s/api/telemetry" % (WormConfiguration.current_server,), data=json.dumps(telemetry), headers={'content-type': 'application/json'}, diff --git a/monkey_island/cc/resources/telemetry.py b/monkey_island/cc/resources/telemetry.py index a5e9bac5b..88b144333 100644 --- a/monkey_island/cc/resources/telemetry.py +++ b/monkey_island/cc/resources/telemetry.py @@ -43,8 +43,12 @@ class Telemetry(flask_restful.Resource): monkey = NodeService.get_monkey_by_guid(telemetry_json['monkey_guid']) try: - TELEM_PROCESS_DICT[telemetry_json.get('telem_type')](telemetry_json) NodeService.update_monkey_modify_time(monkey["_id"]) + telem_type = telemetry_json.get('telem_type') + if telem_type in TELEM_PROCESS_DICT: + TELEM_PROCESS_DICT[telem_type](telemetry_json) + else: + print('Got unknown type of telemetry: %s' % telem_type) except StandardError as ex: print("Exception caught while processing telemetry: %s" % str(ex)) traceback.print_exc() @@ -154,6 +158,10 @@ class Telemetry(flask_restful.Resource): if 'ntlm_hash' in creds[user]: ConfigService.creds_add_ntlm_hash(creds[user]['ntlm_hash']) + @staticmethod + def process_trace_telemetry(telemetry_json): + # Nothing to do + return TELEM_PROCESS_DICT = \ { @@ -162,4 +170,5 @@ TELEM_PROCESS_DICT = \ 'exploit': Telemetry.process_exploit_telemetry, 'scan': Telemetry.process_scan_telemetry, 'system_info_collection': Telemetry.process_system_info_telemetry, + 'trace': Telemetry.process_trace_telemetry } \ No newline at end of file From 35b18c68a991210a71e1f56a1ce962d49acac07c Mon Sep 17 00:00:00 2001 From: Itay Mizeretz Date: Wed, 18 Oct 2017 17:07:27 +0300 Subject: [PATCH 4/4] Update chaos monkey readme after it's tested --- chaos_monkey/readme.txt | 73 +++++++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 28 deletions(-) diff --git a/chaos_monkey/readme.txt b/chaos_monkey/readme.txt index 21f3d0015..bdf267f60 100644 --- a/chaos_monkey/readme.txt +++ b/chaos_monkey/readme.txt @@ -10,44 +10,61 @@ The monkey is composed of three separate parts. 1. Install python 2.7. Preferably you should use ActiveState Python which includes pywin32 built in. You must use an up to date version, at least version 2.7.10 https://www.python.org/download/releases/2.7/ - If not using ActiveState, install pywin32, minimum build 219 - http://sourceforge.net/projects/pywin32/files/pywin32 -3. 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 -4. Download the dependent python packages using - pip install -r requirements.txt -5. Download and extract UPX binary to [source-path]\monkey\chaos_monkey\bin\upx.exe: - https://github.com/upx/upx/releases/download/v3.94/upx394w.zip -6. To build the final exe: - cd [code location]/chaos_monkey - build_windows.bat - output is placed under dist\monkey.exe +2. Install pywin32 (if you didn't install ActiveState Python) + Install pywin32, minimum build 219 + http://sourceforge.net/projects/pywin32/files/pywin32 +3. 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:\Pytohn27\Scripts + b. Close the console, make sure you execute all commands in a new cmd console from now on. +4. Install pip + a. Download and run the pip installer + https://bootstrap.pypa.io/get-pip.py +5. 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 +6. Download the dependent python packages using + pip install -r requirements.txt +7. Download and extract UPX binary to [source-path]\monkey\chaos_monkey\bin\upx.exe: + https://github.com/upx/upx/releases/download/v3.94/upx394w.zip +8. 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]\chaos_monkey\bin +9. To build the final exe: + cd [code location]/chaos_monkey + build_windows.bat + output is placed under dist\monkey.exe --- Linux --- Tested on Ubuntu 16.04 and 17.04. -1. Run: - sudo apt-get update - sudo apt-get install python-pip python-dev libffi-dev upx libssl-dev libc++1 +1. Install dependencies by running: + sudo apt-get update + sudo apt-get install python-pip python-dev libffi-dev upx libssl-dev libc++1 Install the python packages listed in requirements.txt using pip - pip install -r requirements.txt -2. Place the source code in code/monkey/chaos_monkey -3. To build, run in terminal: - cd [code location]/chaos_monkey - chmod +x build_linux.sh - ./build_linux.sh - output is placed under dist/monkey + cd [code location]/chaos_monkey + pip install -r requirements.txt +2. Build Sambacry binaries + a. Build/Download according to sections at the end of this readme. + b. Place the binaries under [code location]\chaos_monkey\bin +3. To build, run in terminal: + cd [code location]/chaos_monkey + chmod +x build_linux.sh + ./build_linux.sh + output is placed under dist/monkey -- Sambacry -- Sambacry requires two standalone binaries to execute remotely. -Compiling them requires gcc. -cd [code location]/chaos_monkey/monkey_utils/sambacry_monkey_runner -./build.sh +1. Install gcc-multilib if it's not installed + sudo apt-get install gcc-multilib +2. Build the binaries + cd [code location]/chaos_monkey/monkey_utils/sambacry_monkey_runner + ./build.sh -- Mimikatz --