Merge pull request #62 from guardicore/bugfix/final-touches

Bugfix/final touches
This commit is contained in:
itaymmguardicore 2017-10-18 18:05:23 +03:00 committed by GitHub
commit ba35136a5f
5 changed files with 59 additions and 34 deletions

View File

@ -97,11 +97,11 @@ class ControlClient(object):
return {} return {}
@staticmethod @staticmethod
def send_telemetry(tele_type='general', data=''): def send_telemetry(telem_type, data):
if not WormConfiguration.current_server: if not WormConfiguration.current_server:
return return
try: 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,), reply = requests.post("https://%s/api/telemetry" % (WormConfiguration.current_server,),
data=json.dumps(telemetry), data=json.dumps(telemetry),
headers={'content-type': 'application/json'}, headers={'content-type': 'application/json'},

View File

@ -10,18 +10,30 @@ The monkey is composed of three separate parts.
1. Install python 2.7. Preferably you should use ActiveState Python which includes pywin32 built in. 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 You must use an up to date version, at least version 2.7.10
https://www.python.org/download/releases/2.7/ https://www.python.org/download/releases/2.7/
If not using ActiveState, install pywin32, minimum build 219 2. Install pywin32 (if you didn't install ActiveState Python)
Install pywin32, minimum build 219
http://sourceforge.net/projects/pywin32/files/pywin32 http://sourceforge.net/projects/pywin32/files/pywin32
3. a. install VCForPython27.msi 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 https://aka.ms/vcpython27
b. if not installed, install Microsoft Visual C++ 2010 SP1 Redistributable Package b. if not installed, install Microsoft Visual C++ 2010 SP1 Redistributable Package
32bit: http://www.microsoft.com/en-us/download/details.aspx?id=8328 32bit: http://www.microsoft.com/en-us/download/details.aspx?id=8328
64bit: http://www.microsoft.com/en-us/download/details.aspx?id=13523 64bit: http://www.microsoft.com/en-us/download/details.aspx?id=13523
4. Download the dependent python packages using 6. Download the dependent python packages using
pip install -r requirements.txt pip install -r requirements.txt
5. Download and extract UPX binary to [source-path]\monkey\chaos_monkey\bin\upx.exe: 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 https://github.com/upx/upx/releases/download/v3.94/upx394w.zip
6. To build the final exe: 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 cd [code location]/chaos_monkey
build_windows.bat build_windows.bat
output is placed under dist\monkey.exe output is placed under dist\monkey.exe
@ -30,12 +42,15 @@ The monkey is composed of three separate parts.
Tested on Ubuntu 16.04 and 17.04. Tested on Ubuntu 16.04 and 17.04.
1. Run: 1. Install dependencies by running:
sudo apt-get update sudo apt-get update
sudo apt-get install python-pip python-dev libffi-dev upx libssl-dev libc++1 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 Install the python packages listed in requirements.txt using pip
cd [code location]/chaos_monkey
pip install -r requirements.txt pip install -r requirements.txt
2. Place the source code in code/monkey/chaos_monkey 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: 3. To build, run in terminal:
cd [code location]/chaos_monkey cd [code location]/chaos_monkey
chmod +x build_linux.sh chmod +x build_linux.sh
@ -45,9 +60,11 @@ Tested on Ubuntu 16.04 and 17.04.
-- Sambacry -- -- Sambacry --
Sambacry requires two standalone binaries to execute remotely. Sambacry requires two standalone binaries to execute remotely.
Compiling them requires gcc. 1. Install gcc-multilib if it's not installed
cd [code location]/chaos_monkey/monkey_utils/sambacry_monkey_runner sudo apt-get install gcc-multilib
./build.sh 2. Build the binaries
cd [code location]/chaos_monkey/monkey_utils/sambacry_monkey_runner
./build.sh
-- Mimikatz -- -- Mimikatz --

View File

@ -43,8 +43,12 @@ class Telemetry(flask_restful.Resource):
monkey = NodeService.get_monkey_by_guid(telemetry_json['monkey_guid']) monkey = NodeService.get_monkey_by_guid(telemetry_json['monkey_guid'])
try: try:
TELEM_PROCESS_DICT[telemetry_json.get('telem_type')](telemetry_json)
NodeService.update_monkey_modify_time(monkey["_id"]) 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: except StandardError as ex:
print("Exception caught while processing telemetry: %s" % str(ex)) print("Exception caught while processing telemetry: %s" % str(ex))
traceback.print_exc() traceback.print_exc()
@ -154,6 +158,10 @@ class Telemetry(flask_restful.Resource):
if 'ntlm_hash' in creds[user]: if 'ntlm_hash' in creds[user]:
ConfigService.creds_add_ntlm_hash(creds[user]['ntlm_hash']) ConfigService.creds_add_ntlm_hash(creds[user]['ntlm_hash'])
@staticmethod
def process_trace_telemetry(telemetry_json):
# Nothing to do
return
TELEM_PROCESS_DICT = \ TELEM_PROCESS_DICT = \
{ {
@ -162,4 +170,5 @@ TELEM_PROCESS_DICT = \
'exploit': Telemetry.process_exploit_telemetry, 'exploit': Telemetry.process_exploit_telemetry,
'scan': Telemetry.process_scan_telemetry, 'scan': Telemetry.process_scan_telemetry,
'system_info_collection': Telemetry.process_system_info_telemetry, 'system_info_collection': Telemetry.process_system_info_telemetry,
'trace': Telemetry.process_trace_telemetry
} }

View File

@ -14,9 +14,8 @@ import LicensePage from 'components/pages/LicensePage';
require('normalize.css/normalize.css'); require('normalize.css/normalize.css');
require('react-data-components/css/table-twbs.css'); require('react-data-components/css/table-twbs.css');
require('styles/App.css') require('styles/App.css');
require('react-toggle/style.css'); require('react-toggle/style.css');
require('github-markdown-css/github-markdown.css');
let logoImage = require('../images/monkey-logo.png'); let logoImage = require('../images/monkey-logo.png');
let guardicoreLogoImage = require('../images/guardicore-logo.png'); let guardicoreLogoImage = require('../images/guardicore-logo.png');

View File

@ -201,7 +201,7 @@ class PreviewPaneComponent extends React.Component {
info = this.scanInfo(this.props.item); info = this.scanInfo(this.props.item);
break; break;
case 'node': 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); this.infectedAssetInfo(this.props.item) : this.assetInfo(this.props.item);
break; break;
case 'island_edge': case 'island_edge':