Merge branch 'develop' into feature/change-exploit-telemetry

# Conflicts:
#	monkey_island/cc/ui/src/components/pages/MapPage.js
This commit is contained in:
Itay Mizeretz 2017-10-15 14:01:44 +03:00
commit 5b7a7e52d1
15 changed files with 601 additions and 207 deletions

View File

@ -144,13 +144,13 @@ class Configuration(object):
scanner_class = TcpScanner
finger_classes = [SMBFinger, SSHFinger, PingScanner, HTTPFinger, MySQLFinger, ElasticFinger]
exploiter_classes = [SmbExploiter, WmiExploiter, RdpExploiter, Ms08_067_Exploiter, # Windows exploits
exploiter_classes = [SmbExploiter, WmiExploiter, # Windows exploits
SSHExploiter, ShellShockExploiter, SambaCryExploiter, # Linux
ElasticGroovyExploiter, # multi
]
# how many victims to look for in a single scan iteration
victims_max_find = 14
victims_max_find = 30
# how many victims to exploit before stopping
victims_max_exploit = 7

View File

@ -33,8 +33,6 @@
"SSHExploiter",
"SmbExploiter",
"WmiExploiter",
"RdpExploiter",
"Ms08_067_Exploiter",
"ShellShockExploiter",
"ElasticGroovyExploiter",
"SambaCryExploiter",
@ -90,5 +88,5 @@
"timeout_between_iterations": 10,
"use_file_logging": true,
"victims_max_exploit": 7,
"victims_max_find": 14
"victims_max_find": 30
}

View File

@ -61,7 +61,7 @@ class LocalRun(flask_restful.Resource):
body = json.loads(request.data)
if body.get('action') == 'run':
local_run = run_local_monkey()
return jsonify(is_running=local_run[0])
return jsonify(is_running=local_run[0], error_text=local_run[1])
# default action
return make_response({'error': 'Invalid action'}, 500)

View File

@ -6,6 +6,8 @@ from cc.utils import local_ip_addresses
__author__ = "itay.mizeretz"
WARNING_SIGN = u" \u26A0"
SCHEMA = {
"title": "Monkey",
"type": "object",
@ -19,56 +21,56 @@ SCHEMA = {
"enum": [
"SmbExploiter"
],
"title": "SmbExploiter"
"title": "SMB Exploiter"
},
{
"type": "string",
"enum": [
"WmiExploiter"
],
"title": "WmiExploiter"
"title": "WMI Exploiter"
},
{
"type": "string",
"enum": [
"RdpExploiter"
],
"title": "RdpExploiter"
"title": "RDP Exploiter (UNSAFE)"
},
{
"type": "string",
"enum": [
"Ms08_067_Exploiter"
],
"title": "Ms08_067_Exploiter"
"title": "MS08-067 Exploiter (UNSAFE)"
},
{
"type": "string",
"enum": [
"SSHExploiter"
],
"title": "SSHExploiter"
"title": "SSH Exploiter"
},
{
"type": "string",
"enum": [
"ShellShockExploiter"
],
"title": "ShellShockExploiter"
"title": "ShellShock Exploiter"
},
{
"type": "string",
"enum": [
"SambaCryExploiter"
],
"title": "SambaCryExploiter"
"title": "SambaCry Exploiter"
},
{
"type": "string",
"enum": [
"ElasticGroovyExploiter"
],
"title": "ElasticGroovyExploiter"
"title": "ElasticGroovy Exploiter"
},
]
},
@ -123,26 +125,9 @@ SCHEMA = {
},
"properties": {
"basic": {
"title": "Basic",
"title": "Basic - Credentials",
"type": "object",
"properties": {
"network": {
"title": "Network",
"type": "object",
"properties": {
"blocked_ips": {
"title": "Blocked IPs",
"type": "array",
"uniqueItems": True,
"items": {
"type": "string"
},
"default": [
],
"description": "List of IPs to not scan"
}
}
},
"credentials": {
"title": "Credentials",
"type": "object",
@ -180,6 +165,88 @@ SCHEMA = {
}
}
},
"basic_network": {
"title": "Basic - Network",
"type": "object",
"properties": {
"general": {
"title": "General",
"type": "object",
"properties": {
"blocked_ips": {
"title": "Blocked IPs",
"type": "array",
"uniqueItems": True,
"items": {
"type": "string"
},
"default": [
],
"description": "List of IPs to not scan"
},
"local_network_scan": {
"title": "Local network scan",
"type": "boolean",
"default": True,
"description": "Determines whether the monkey should scan its subnets additionally"
},
"depth": {
"title": "Depth" + WARNING_SIGN,
"type": "integer",
"default": 2,
"description": "Amount of hops allowed for the monkey to spread"
}
}
},
"network_range": {
"title": "Network range",
"type": "object",
"properties": {
"range_class": {
"title": "Range class",
"type": "string",
"default": "FixedRange",
"enum": [
"FixedRange",
"RelativeRange",
"ClassCRange"
],
"enumNames": [
"Fixed Range",
"Relative Range",
"Class C Range"
],
"description":
"Determines which class to use to determine scan range."
" Fixed Range will scan only specific IPs listed under Fixed range IP list."
" Relative Range will scan the <Relative range size> closest ips to the machine's IP."
" Class C Range will scan machines in the Class C network the monkey's on."
},
"range_size": {
"title": "Relative range size",
"type": "integer",
"default": 1,
"description":
"Determines the size of the RelativeRange - amount of IPs to scan"
" (Only relevant for Relative Range)"
},
"range_fixed": {
"title": "Fixed range IP list",
"type": "array",
"uniqueItems": True,
"items": {
"type": "string"
},
"default": [
],
"description":
"List of IPs to include when using FixedRange"
" (Only relevant for Fixed Range)"
}
}
}
}
},
"monkey": {
"title": "Monkey",
"type": "object",
@ -193,12 +260,6 @@ SCHEMA = {
"type": "boolean",
"default": True,
"description": "Is the monkey alive"
},
"depth": {
"title": "Depth",
"type": "integer",
"default": 2,
"description": "Amount of hops allowed from this monkey to spread"
}
}
},
@ -239,26 +300,31 @@ SCHEMA = {
"victims_max_find": {
"title": "Max victims to find",
"type": "integer",
"default": 14,
"description": "Determines after how many discovered machines should the monkey stop scanning"
"default": 30,
"description": "Determines the maximum number of machines the monkey is allowed to scan"
},
"victims_max_exploit": {
"title": "Max victims to exploit",
"title": "Max victims to exploit" + WARNING_SIGN,
"type": "integer",
"default": 7,
"description": "Determines after how many infected machines should the monkey stop infecting"
"description":
"Determines the maximum number of machines the monkey"
" is allowed to successfully exploit"
},
"timeout_between_iterations": {
"title": "Wait time between iterations",
"type": "integer",
"default": 100,
"description": "Determines for how long (in seconds) should the monkey wait between iterations"
"description":
"Determines for how long (in seconds) should the monkey wait between iterations"
},
"retry_failed_explotation": {
"title": "Retry failed exploitation",
"type": "boolean",
"default": True,
"description": "Determines whether the monkey should retry exploiting machines it didn't successfuly exploit on previous iterations"
"description":
"Determines whether the monkey should retry exploiting machines"
" it didn't successfuly exploit on previous iterations"
}
}
}
@ -276,7 +342,14 @@ SCHEMA = {
"title": "Singleton mutex name",
"type": "string",
"default": "{2384ec59-0df8-4ab9-918c-843740924a28}",
"description": "The name of the mutex used to determine whether the monkey is already running"
"description":
"The name of the mutex used to determine whether the monkey is already running"
},
"collect_system_info": {
"title": "Collect system info",
"type": "boolean",
"default": True,
"description": "Determines whether to collect system info"
},
"keep_tunnel_open_time": {
"title": "Keep tunnel open time",
@ -318,25 +391,6 @@ SCHEMA = {
"ElasticFinger"
],
"description": "Determines which classes to use for fingerprinting"
},
"exploiter_classes": {
"title": "Exploiter classes",
"type": "array",
"uniqueItems": True,
"items": {
"$ref": "#/definitions/exploiter_classes"
},
"default": [
"SmbExploiter",
"WmiExploiter",
"RdpExploiter",
"Ms08_067_Exploiter",
"SSHExploiter",
"ShellShockExploiter",
"SambaCryExploiter",
"ElasticGroovyExploiter"
],
"description": "Determines which classes to use for exploiting"
}
}
},
@ -366,19 +420,25 @@ SCHEMA = {
"title": "Dropper sets date",
"type": "boolean",
"default": True,
"description": "Determines whether the dropper should set the monkey's file date to be the same as another file"
"description":
"Determines whether the dropper should set the monkey's file date to be the same as"
" another file"
},
"dropper_date_reference_path_windows": {
"title": "Dropper date reference path (Windows)",
"type": "string",
"default": "%windir%\\system32\\kernel32.dll",
"description": "Determines which file the dropper should copy the date from if it's configured to do so on Windows (use fullpath)"
"description":
"Determines which file the dropper should copy the date from if it's configured to do"
" so on Windows (use fullpath)"
},
"dropper_date_reference_path_linux": {
"title": "Dropper date reference path (Linux)",
"type": "string",
"default": "/bin/sh",
"description": "Determines which file the dropper should copy the date from if it's configured to do so on Linux (use fullpath)"
"description":
"Determines which file the dropper should copy the date from if it's configured to do"
" so on Linux (use fullpath)"
},
"dropper_target_path_linux": {
"title": "Dropper target path on Linux",
@ -396,7 +456,9 @@ SCHEMA = {
"title": "Try to move first",
"type": "boolean",
"default": True,
"description": "Determines whether the dropper should try to move itself instead of copying itself to target path"
"description":
"Determines whether the dropper should try to move itsel instead of copying itself"
" to target path"
}
}
},
@ -455,6 +517,19 @@ SCHEMA = {
"description": "List of NTLM hashes to use on exploits using credentials"
}
}
},
"mimikatz": {
"title": "Mimikatz",
"type": "object",
"properties": {
"mimikatz_dll_name": {
"title": "Mimikatz DLL name",
"type": "string",
"default": "mk.dll",
"description":
"Name of Mimikatz DLL (should be the same as in the monkey's pyinstaller spec file)"
}
}
}
}
},
@ -489,7 +564,9 @@ SCHEMA = {
"monkey.guardicore.com",
"www.google.com"
],
"description": "List of internet services to try and communicate with to determine internet connectivity (use either ip or domain)"
"description":
"List of internet services to try and communicate with to determine internet"
" connectivity (use either ip or domain)"
},
"current_server": {
"title": "Current server",
@ -509,11 +586,29 @@ SCHEMA = {
"title": "General",
"type": "object",
"properties": {
"exploiter_classes": {
"title": "Exploits" + WARNING_SIGN,
"type": "array",
"uniqueItems": True,
"items": {
"$ref": "#/definitions/exploiter_classes"
},
"default": [
"SmbExploiter",
"WmiExploiter",
"SSHExploiter",
"ShellShockExploiter",
"SambaCryExploiter",
"ElasticGroovyExploiter"
],
"description": "Determines which exploits to use"
},
"skip_exploit_if_file_exist": {
"title": "Skip exploit if file exists",
"type": "boolean",
"default": False,
"description": "Determines whether the monkey should skip the exploit if the monkey's file is already on the remote machine"
"description": "Determines whether the monkey should skip the exploit if the monkey's file"
" is already on the remote machine"
}
}
},
@ -549,7 +644,8 @@ SCHEMA = {
"title": "Use VBS download",
"type": "boolean",
"default": True,
"description": "Determines whether to use VBS or BITS to download monkey to remote machine (true=VBS, false=BITS)"
"description": "Determines whether to use VBS or BITS to download monkey to remote machine"
" (true=VBS, false=BITS)"
}
}
},
@ -604,7 +700,8 @@ SCHEMA = {
"title": "SMB download timeout",
"type": "integer",
"default": 300,
"description": "Timeout (in seconds) for SMB download operation (used in various exploits using SMB)"
"description":
"Timeout (in seconds) for SMB download operation (used in various exploits using SMB)"
},
"smb_service_name": {
"title": "SMB service name",
@ -616,91 +713,10 @@ SCHEMA = {
}
}
},
"system_info": {
"title": "System info",
"type": "object",
"properties": {
"general": {
"title": "General",
"type": "object",
"properties": {
"collect_system_info": {
"title": "Collect system info",
"type": "boolean",
"default": True,
"description": "Determines whether to collect system info"
}
}
},
"mimikatz": {
"title": "Mimikatz",
"type": "object",
"properties": {
"mimikatz_dll_name": {
"title": "Mimikatz DLL name",
"type": "string",
"default": "mk.dll",
"description": "Name of Mimikatz DLL (should be the same as in the monkey's pyinstaller spec file)"
}
}
}
}
},
"network": {
"title": "Network",
"type": "object",
"properties": {
"general": {
"title": "General",
"type": "object",
"properties": {
"local_network_scan": {
"title": "Local network scan",
"type": "boolean",
"default": True,
"description": "Determines whether monkey should scan its subnets additionally"
}
}
},
"network_range": {
"title": "Network range",
"type": "object",
"properties": {
"range_class": {
"title": "Range class",
"type": "string",
"default": "FixedRange",
"enum": [
"FixedRange",
"RelativeRange",
"ClassCRange"
],
"enumNames": [
"FixedRange",
"RelativeRange",
"ClassCRange"
],
"description": "Determines which class to use to determine scan range"
},
"range_size": {
"title": "Relative range size",
"type": "integer",
"default": 1,
"description": "Determines the size of the RelativeRange - amount of IPs to include"
},
"range_fixed": {
"title": "Fixed range IP list",
"type": "array",
"uniqueItems": True,
"items": {
"type": "string"
},
"default": [
],
"description": "List of IPs to include when using FixedRange"
}
}
},
"tcp_scanner": {
"title": "TCP scanner",
"type": "object",

View File

@ -64,17 +64,22 @@
"bootstrap": "^3.3.7",
"core-js": "^2.5.1",
"fetch": "^1.1.0",
"github-markdown-css": "^2.8.0",
"marked": "^0.3.6",
"normalize.css": "^4.0.0",
"prop-types": "^15.5.10",
"raw-loader": "^0.5.1",
"react": "^15.6.1",
"react-bootstrap": "^0.31.2",
"react-copy-to-clipboard": "^5.0.0",
"react-data-components": "^1.1.1",
"react-dimensions": "^1.3.0",
"react-dom": "^15.6.1",
"react-fa": "^4.2.0",
"react-graph-vis": "^0.1.3",
"react-json-tree": "^0.10.9",
"react-jsonschema-form": "^0.50.1",
"react-modal-dialog": "^4.0.7",
"react-redux": "^5.0.6",
"react-router-dom": "^4.2.2",
"react-toggle": "^4.0.1",

View File

@ -0,0 +1,191 @@
Infection Monkey
====================
### Data center Security Testing Tool
------------------------
Welcome to the Infection Monkey!
The Infection Monkey is an open source security tool for testing a data center's resiliency to perimeter breaches and internal server infection. The Monkey uses various methods to self propagate across a data center and reports success to a centralized C&C server. To read more about the Monkey, visit https://www.guardicore.com/infectionmonkey/
### http://www.guardicore.com/the-infected-chaos-monkey/
Features include:
* Multiple propagation techniques:
* Predefined passwords
* Common exploits
* Multiple exploit methods:
* SSH
* SMB
* RDP
* WMI
* Shellshock
* A C&C server with a dedicated UI to visualize the Monkey's progress inside the data center
Getting Started
---------------
The Infection Monkey is comprised of two parts: the Monkey and the C&C server.
The monkey is the tool which infects other machines and propagates to them, while the C&C server collects all Monkey reports and displays them to the user.
### Requirements
The C&C Server has been tested on Ubuntu 14.04,15.04 and 16.04.
The Monkey itself has been tested on Windows XP, 7, 8.1 and 10. The Linux build has been tested on Ubuntu server 14.04 and 15.10.
### Installation
Warning! The Debian package will uninstall the python library 'bson' because of an issue with pymongo. You can reinstall it later, but monkey island will probably not work.
For off-the-shelf use, download our Debian package from our website and follow the guide [written in our blog](https://www.guardicore.com/2016/07/infection-monkey-loose-2/).
To manually set up and the C&C server follow the instructions on [Monkey Island readme](monkey_island/readme.txt). If you wish to compile the binaries yourself, follow the instructions under Building the Monkey from Source.
### Initial configuration.
Whether you're downloading or building the Monkey from source, the Infection Monkey is comprised of 4 executable files for different platforms plus a default configuration file.
Monkey configuration is stored in two places:
1. By default, the Monkey uses a local configuration file (usually, config.bin). This configuration file must include the address of the Monkey's C&C server.
2. After successfully connecting to the C&C server, the monkey downloads a new configuration from the server and discards the local configuration. It is possible to change the default configuration from the C&C server's UI.
In both cases the command server hostname should be modified to point to your local instance of the Monkey Island (note that this doesn't require connectivity right off the bat). In addition, to improve the Monkey's chances of spreading, you can pre-seed it with credentials and usernames commonly used.
Both configuration options use a JSON format for specifying options; see "Options" below for details.
### Running the C&C Server
To run the C&C Server, install our infected Monkey debian package on a specific server. The initial infected machine doesn't require a direct link to this server.
### Unleashing the Monkey
Once configured, run the monkey using ```./monkey-linux-64 m0nk3y -c config.bin -s 41.50.73.31:5000``` (Windows is identical). This can be done at multiple points in the network simultaneously.
Command line options include:
* `-c`, `--config`: set configuration file. JSON file with configuration values, will override compiled configuration.
* `-p`, `--parent`: set monkeys parent uuid, allows better recognition of exploited monkeys in c&c
* `-t`, `--tunnel`: ip:port, set default tunnel for Monkey when connecting to c&c.
* `-d`, `--depth` : sets the Monkey's current operation depth.
How the Monkey works
---------------------
1. Wakeup connection to c&c, sends basic info of the current machine and the configuration the monkey uses to the c&c.
1. First try direct connection to c&c.
2. If direct connection fails, try connection through a tunnel, a tunnel is found according to specified parameter (the default tunnel) or by sending a multicast query and waiting for another monkey to answer.
3. If no connection can be made to c&c, continue without it.
2. If a firewall app is running on the machine (supports Windows Firewall for Win XP and Windows Advanced Firewall for Win 7+), try to add a rule to allow all our traffic.
3. Startup of tunnel for other Monkeys (if connection to c&c works).
1. Firewall is checked to allow listening sockets (if we failed to add a rule to Windows firewall for example, the tunnel will not be created)
2. Will answer multicast requests from other Monkeys in search of a tunnel.
4. Running exploitation sessions, will run x sessions according to configuration:
1. Connect to c&c and get the latest configuration
2. Scan ip ranges according to configuration.
3. Try fingerprinting each host that answers, using the classes defined in the configuration (SMBFinger, SSHFinger, etc)
4. Try exploitation on each host found, for each exploit class in configuration:
1. check exploit class supports target host (can be disabled by configuration)
2. each exploitation class will use the data acquired in fingerprinting, or during the exploit, to find the suitable Monkey executable for the host from the c&c.
1. If c&c connection fails, and the source monkeys executable is suitable, we use it.
2. If a suitable executable isnt found, exploitation will fail.
3. Executables are cached in memory.
5. will skip hosts that are already exploited in next run
6. will skip hosts that failed during exploitation in next run (can be disabled by configuration)
5. Close tunnel before exiting
Wait for monkeys using the tunnel to unregister for it
Cleanup
Remove firewall rules if added
Configuration Options
---------------------
Key | Type | Description | Possible Values
--- | ---- | ----------- | ---------------
alive | bool | sets whether or not the monkey is alive. if false will stop scanning and exploiting
command_servers | array | addresses of c&c servers to try to connect | example: ["russian-mail-brides.com:5000"]
singleton_mutex_name | string | string of the mutex name for single instance | example: {2384ec59-0df8-4ab9-918c-843740924a28}
self_delete_in_cleanup | bool | sets whether or not to self delete the monkey executable when stopped
use_file_logging | bool | sets whether or not to use a log file
monkey_log_path_[windows/linux] | string | file path for monkey logger.
kill_file_path_[windows/linux] | string | file path that the Monkey checks to prevent running
timeout_between_iterations | int | how long to wait between scan iterations
max_iterations | int | how many scan iterations to perform on each run
internet_services | array | addresses of internet servers to ping and check if the monkey has internet acccess
victims_max_find | int | how many victims to look for in a single scan iteration
victims_max_exploit | int | how many victims to exploit before stopping
retry_failed_explotation | bool | sets whether or not to retry failed hosts on next scan
local_network_scan | bool | sets whether to auto detect and scan local subnets
range_class | class name | sets which ip ranges class is used to construct the list of ips to scan | `FixedRange` - scan list is a static ips list, `RelativeRange` - scan list will be constructed according to ip address of the machine and size of the scan, `ClassCRange` - will scan the entire class c the machine is in.
range_fixed | tuple of strings | list of ips to scan
RelativeRange range_size | int | number of hosts to scan in relative range
scanner_class | class name | sets which scan class to use when scanning for hosts to exploit | `TCPScanner` - searches for hosts according to open tcp ports, `PingScanner` - searches for hosts according to ping scan
finger_classes | tuple of class names | sets which fingerprinting classes to use | in the list: `SMBFinger` - get host os info by checking smb info, `SSHFinger` - get host os info by checking ssh banner, `PingScanner` - get host os type by checking ping ttl. For example: `(SMBFinger, SSHFinger, PingScanner)`
exploiter_classes | tuple of class names | | `SmbExploiter` - exploit using smb connection, `WmiExploiter` - exploit using wmi connection, `RdpExploiter` - exploit using rdp connection, `Ms08_067_Exploiter` - exploit using ms08_067 smb exploit, `SSHExploiter` - exploit using ssh connection
tcp_target_ports | list of int | which ports to scan using TCPScanner
tcp_scan_timeout | int | timeout for tcp connection in tcp scan (in milliseconds)
tcp_scan_interval | int | time to wait between ports in the tcp scan (in milliseconds)
tcp_scan_get_banner | bool | sets whether or not to read a banner from the tcp ports when scanning
ping_scan_timeout | int | timeout for the ping command (in milliseconds) utilised by PingScanner
skip_exploit_if_file_exist | bool | sets whether or not to abort exploit if the monkey already exists in target, used by SmbExploiter
psexec_user | string | user to use for connection, utilised by SmbExploiter/WmiExploiter/RdpExploiter
psexec_passwords | list of strings | list of passwords to use when trying to exploit
rdp_use_vbs_download | bool | sets whether to use vbs payload for rdp exploitation in RdpExploiter. If false, bits payload is used (will fail if bitsadmin.exe doesnt exist)
ms08_067_exploit_attempt | int | number of times to try and exploit using ms08_067 exploit
ms08_067_remote_user_add | string | user to add to target when using ms08_067 exploit
ms08_067_remote_user_pass | string | password of the user the exploit will add
ssh_user | string | user to use for ssh connection, used by SSHExploiter
ssh_passwords | list of strings | list of passwords to use when trying to exploit using SSHExploiter
dropper_set_date | bool | whether or not to change the monkey file date to match other files
dropper_target_path_[windows/linux] | string | path for the dropper
serialize_config | bool | sets whether or not to locally save the running configuration after finishing
Building the Monkey from source
-------------------------------
If you want to build the monkey from source instead of using our provided packages, follow the instructions at the readme files under [chaos_monkey](chaos_monkey) and [monkey_island](monkey_island).
License
=======
Copyright (c) 2016 Guardicore Ltd
See the [LICENSE](LICENSE) file for license rights and limitations (GPLv3).
Dependent packages
---------------------
Dependency | License | Notes
----------------------------|----------------------------|----------------------------
libffi-dev | https://github.com/atgreen/libffi/blob/master/LICENSE
PyCrypto | Public domain
upx | Custom license, http://upx.sourceforge.net/upx-license.html
bson | BSD
enum34 | BSD
pyasn1 | BSD
psutil | BSD
flask | BSD
flask-Pymongo | BSD
Flask-Restful | BSD
python-dateutil | Simplified BSD
zope | ZPL 2.1
Bootstrap | MIT
Bootstrap Switch | Apache 2.0
Bootstrap Dialog | MIT
JSON Editor | MIT
Datatables | MIT
jQuery | MIT
cffi | MIT
twisted | MIT
typeahead.js | MIT
Font Awesome | MIT
vis.js | MIT/Apache 2.0
impacket | Apache Modified
Start Bootstrap (UI Theme) | Apache 2.0
requests | Apache 2.0
grequests | BSD
odict | Python Software Foundation License
paramiko | LGPL
rdpy | GPL-3
winbind | GPL-3
pyinstaller | GPL
Celery | BSD
mimikatz | CC BY 4.0 | We use an altered version of mimikatz made by gentilkiwi: https://github.com/guardicore/mimikatz

View File

@ -10,11 +10,13 @@ import MapPage from 'components/pages/MapPage';
import TelemetryPage from 'components/pages/TelemetryPage';
import StartOverPage from 'components/pages/StartOverPage';
import ReportPage from 'components/pages/ReportPage';
import ReadMePage from 'components/pages/ReadMePage';
require('normalize.css/normalize.css');
require('react-data-components/css/table-twbs.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');
@ -114,6 +116,7 @@ class AppComponent extends React.Component {
<ul>
<li><NavLink to="/configure">Configuration</NavLink></li>
<li><NavLink to="/infection/telemetry">Monkey Telemetry</NavLink></li>
<li><NavLink to="/readme">Read Me</NavLink></li>
</ul>
<hr/>
@ -133,6 +136,7 @@ class AppComponent extends React.Component {
<Route path="/infection/telemetry" render={(props) => ( <TelemetryPage onStatusChange={this.updateStatus} /> )} />
<Route path="/start-over" render={(props) => ( <StartOverPage onStatusChange={this.updateStatus} /> )} />
<Route path="/report" render={(props) => ( <ReportPage onStatusChange={this.updateStatus} /> )} />
<Route path="/readme" render={(props) => ( <ReadMePage onStatusChange={this.updateStatus} /> )} />
</Col>
</Row>
</Grid>

View File

@ -8,6 +8,7 @@ class ConfigurePageComponent extends React.Component {
this.currentSection = 'basic';
this.currentFormData = {};
this.sectionsOrder = ['basic', 'basic_network', 'monkey', 'cnc', 'network', 'exploits', 'internal'];
// set schema from server
this.state = {
@ -23,15 +24,18 @@ class ConfigurePageComponent extends React.Component {
componentDidMount() {
fetch('/api/configuration')
.then(res => res.json())
.then(res => this.setState({
.then(res => {
let sections = [];
for (let sectionKey of this.sectionsOrder) {
sections.push({key: sectionKey, title: res.schema.properties[sectionKey].title});
}
this.setState({
schema: res.schema,
configuration: res.configuration,
sections: Object.keys(res.schema.properties)
.map(key => {
return {key: key, title: res.schema.properties[key].title}
}),
sections: sections,
selectedSection: 'basic'
}));
})
});
}
onSubmit = ({formData}) => {
@ -105,7 +109,6 @@ class ConfigurePageComponent extends React.Component {
return (
<Col xs={8}>
<h1 className="page-title">Monkey Configuration</h1>
<Nav bsStyle="tabs" justified
activeKey={this.state.selectedSection} onSelect={this.setSelectedSection}
style={{'marginBottom': '2em'}}>
@ -113,31 +116,54 @@ class ConfigurePageComponent extends React.Component {
<NavItem key={section.key} eventKey={section.key}>{section.title}</NavItem>
)}
</Nav>
{
this.state.selectedSection === 'basic_network' ?
<div className="alert alert-info">
<i className="glyphicon glyphicon-info-sign" style={{'marginRight': '5px'}}/>
The Monkey scans its subnet if "Local network scan" is ticked. Additionally the monkey will scan machines
according to its range class.
</div>
: <div />
}
{ this.state.selectedSection ?
<Form schema={displayedSchema}
formData={this.state.configuration[this.state.selectedSection]}
onSubmit={this.onSubmit}
onChange={this.onChange} />
: ''}
<a onClick={this.resetConfig} className="btn btn-danger btn-lg">Reset to defaults</a>
onChange={this.onChange}>
<div>
<div className="alert alert-info">
<i className="glyphicon glyphicon-info-sign" style={{'marginRight': '5px'}}/>
This configuration will only apply to new infections.
Changing the configuration will only apply to new infections.
</div>
<div className="alert alert-warning">
<i className="glyphicon glyphicon-warning-sign" style={{'marginRight': '5px'}}/>
Changing config values with the &#9888; mark may result in the monkey propagating too far or using dangerous exploits.
</div>
<div className="text-center">
<button type="submit" className="btn btn-success btn-lg" style={{margin: '5px'}}>
Submit
</button>
<button type="button" onClick={this.resetConfig} className="btn btn-danger btn-lg" style={{margin: '5px'}}>
Reset to defaults
</button>
</div>
{ this.state.reset ?
<div className="alert alert-info">
<i className="glyphicon glyphicon-info-sign" style={{'marginRight': '5px'}}/>
<div className="alert alert-success">
<i className="glyphicon glyphicon-ok-sign" style={{'marginRight': '5px'}}/>
Configuration reset successfully.
</div>
: ''}
{ this.state.saved ?
<div className="alert alert-info">
<i className="glyphicon glyphicon-info-sign" style={{'marginRight': '5px'}}/>
<div className="alert alert-success">
<i className="glyphicon glyphicon-ok-sign" style={{'marginRight': '5px'}}/>
Configuration saved successfully.
</div>
: ''}
</div>
</Form>
: ''}
</Col>
);
}

View File

@ -1,11 +1,12 @@
import React from 'react';
import {Col} from 'react-bootstrap';
import Graph from 'react-graph-vis';
import PreviewPane from 'components/preview-pane/PreviewPane';
import {Link} from 'react-router-dom';
import {Icon} from 'react-fa';
import PreviewPane from 'components/preview-pane/PreviewPane';
import {ReactiveGraph} from '../reactive-graph/ReactiveGraph';
import {ModalContainer, ModalDialog} from 'react-modal-dialog';
let groupNames = ['clean_linux', 'clean_windows', 'exploited_linux', 'exploited_windows', 'island',
let groupNames = ['clean_unknown', 'clean_linux', 'clean_windows', 'exploited_linux', 'exploited_windows', 'island',
'island_monkey_linux', 'island_monkey_linux_running', 'island_monkey_windows', 'island_monkey_windows_running',
'manual_linux', 'manual_linux_running', 'manual_windows', 'manual_windows_running', 'monkey_linux',
'monkey_linux_running', 'monkey_windows', 'monkey_windows_running'];
@ -26,6 +27,7 @@ let getGroupsOptions = () => {
};
let options = {
autoResize: true,
layout: {
improvedLayout: false
},
@ -35,6 +37,13 @@ let options = {
type: 'curvedCW'
}
},
physics: {
barnesHut: {
gravitationalConstant: -120000,
avoidOverlap: 0.5
},
minVelocity: 0.75
},
groups: getGroupsOptions()
};
@ -45,7 +54,8 @@ class MapPageComponent extends React.Component {
graph: {nodes: [], edges: []},
selected: null,
selectedType: null,
killPressed: false
killPressed: false,
showKillDialog: false
};
}
@ -53,7 +63,7 @@ class MapPageComponent extends React.Component {
select: event => this.selectionChanged(event)
};
edgeGroupToColor(group) {
static edgeGroupToColor(group) {
switch (group) {
case 'exploited':
return '#c00';
@ -81,7 +91,7 @@ class MapPageComponent extends React.Component {
.then(res => res.json())
.then(res => {
res.edges.forEach(edge => {
edge.color = this.edgeGroupToColor(edge.group);
edge.color = MapPageComponent.edgeGroupToColor(edge.group);
});
this.setState({graph: res});
this.props.onStatusChange();
@ -91,19 +101,19 @@ class MapPageComponent extends React.Component {
selectionChanged(event) {
if (event.nodes.length === 1) {
console.log('selected node:', event.nodes[0]); // eslint-disable-line no-console
fetch('/api/netmap/node?id='+event.nodes[0])
fetch('/api/netmap/node?id=' + event.nodes[0])
.then(res => res.json())
.then(res => this.setState({selected: res, selectedType: 'node'}));
}
else if (event.edges.length === 1) {
let displayedEdge = this.state.graph.edges.find(
function(edge) {
function (edge) {
return edge['id'] === event.edges[0];
});
if (displayedEdge['group'] == 'island') {
if (displayedEdge['group'] === 'island') {
this.setState({selected: displayedEdge, selectedType: 'island_edge'});
} else {
fetch('/api/netmap/edge?id='+event.edges[0])
fetch('/api/netmap/edge?id=' + event.edges[0])
.then(res => res.json())
.then(res => this.setState({selected: res.edge, selectedType: 'edge'}));
}
@ -120,9 +130,38 @@ class MapPageComponent extends React.Component {
.then(res => this.setState({killPressed: (res.status === 'OK')}));
};
renderKillDialogModal = () => {
if (!this.state.showKillDialog) {
return <div />
}
return (
<ModalContainer onClose={() => this.setState({showKillDialog: false})}>
<ModalDialog onClose={() => this.setState({showKillDialog: false})}>
<h1>Kill all monkeys</h1>
<p style={{'fontSize': '1.2em', 'marginBottom': '2em'}}>
Are you sure you want to kill all monkeys?
</p>
<button type="button" className="btn btn-danger btn-lg" style={{margin: '5px'}}
onClick={() => {
this.killAllMonkeys();
this.setState({showKillDialog: false});
}}>
Kill all monkeys
</button>
<button type="button" className="btn btn-success btn-lg" style={{margin: '5px'}}
onClick={() => this.setState({showKillDialog: false})}>
Cancel
</button>
</ModalDialog>
</ModalContainer>
)
};
render() {
return (
<div>
{this.renderKillDialogModal()}
<Col xs={12}>
<h1 className="page-title">Infection Map</h1>
</Col>
@ -130,7 +169,9 @@ class MapPageComponent extends React.Component {
<img src={legend}/>
</Col>
<Col xs={8}>
<Graph graph={this.state.graph} options={options} events={this.events}/>
<div style={{height: '80vh'}}>
<ReactiveGraph graph={this.state.graph} options={options} events={this.events}/>
</div>
</Col>
<Col xs={4}>
<input className="form-control input-block"
@ -138,9 +179,10 @@ class MapPageComponent extends React.Component {
style={{'marginBottom': '1em'}}/>
<div style={{'overflow': 'auto', 'marginBottom': '1em'}}>
<Link to="/infection/telemetry" className="btn btn-default pull-left" style={{'width': '48%'}}>Monkey Telemetry</Link>
<button onClick={this.killAllMonkeys} className="btn btn-danger pull-right" style={{'width': '48%'}}>
<Icon name="stop-circle" style={{'marginRight': '0.5em'}} />
<Link to="/infection/telemetry" className="btn btn-default pull-left" style={{'width': '48%'}}>Monkey
Telemetry</Link>
<button onClick={() => this.setState({showKillDialog: true})} className="btn btn-danger pull-right" style={{'width': '48%'}}>
<Icon name="stop-circle" style={{'marginRight': '0.5em'}}/>
Kill All Monkeys
</button>
</div>
@ -151,7 +193,7 @@ class MapPageComponent extends React.Component {
</div>
: ''}
<PreviewPane item={this.state.selected} type={this.state.selectedType} />
<PreviewPane item={this.state.selected} type={this.state.selectedType}/>
</Col>
</div>
);

View File

@ -0,0 +1,24 @@
import React from 'react';
import {Col} from 'react-bootstrap';
var marked = require('marked');
var markdown = require('raw!../../README.md');
class ReadMePageComponent extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<Col xs={8}>
<h1 className="page-title">Read Me</h1>
<div dangerouslySetInnerHTML={{__html: marked(markdown)}} className="markdown-body">
</div>
</Col>
);
}
}
export default ReadMePageComponent;

View File

@ -112,7 +112,7 @@ class RunMonkeyPageComponent extends React.Component {
renderIconByState(state) {
if (state === 'running') {
return <Icon name="check" className="text-success" style={{'marginLeft': '5px'}}/>
} else if (state == 'installing') {
} else if (state === 'installing') {
return <Icon name="refresh" className="text-success" style={{'marginLeft': '5px'}}/>
} else {
return '';

View File

@ -1,19 +1,71 @@
import React from 'react';
import {Col} from 'react-bootstrap';
import {Link} from 'react-router-dom';
import {ModalContainer, ModalDialog} from 'react-modal-dialog';
class StartOverPageComponent extends React.Component {
constructor(props) {
super(props);
this.state = {
cleaned: false
cleaned: false,
showCleanDialog: false,
allMonkeysAreDead: false
};
}
updateMonkeysRunning = () => {
fetch('/api')
.then(res => res.json())
.then(res => {
// This check is used to prevent unnecessary re-rendering
this.setState({
allMonkeysAreDead: (!res['completed_steps']['run_monkey']) || (res['completed_steps']['infection_done'])
});
});
};
renderCleanDialogModal = () => {
if (!this.state.showCleanDialog) {
return <div />
}
return (
<ModalContainer onClose={() => this.setState({showCleanDialog: false})}>
<ModalDialog onClose={() => this.setState({showCleanDialog: false})}>
<h1>Reset environment</h1>
<p style={{'fontSize': '1.2em', 'marginBottom': '2em'}}>
Are you sure you want to reset the environment?
</p>
{
!this.state.allMonkeysAreDead ?
<div className="alert alert-warning">
<i className="glyphicon glyphicon-warning-sign" style={{'marginRight': '5px'}}/>
Some monkeys are still running. It's advised to kill all monkeys before resetting.
</div>
:
<div />
}
<button type="button" className="btn btn-danger btn-lg" style={{margin: '5px'}}
onClick={() => {
this.cleanup();
this.setState({showCleanDialog: false});
}}>
Reset environment
</button>
<button type="button" className="btn btn-success btn-lg" style={{margin: '5px'}}
onClick={() => this.setState({showCleanDialog: false})}>
Cancel
</button>
</ModalDialog>
</ModalContainer>
)
};
render() {
return (
<Col xs={8}>
{this.renderCleanDialogModal()}
<h1 className="page-title">Start Over</h1>
<div style={{'fontSize': '1.2em'}}>
<p>
@ -23,19 +75,26 @@ class StartOverPageComponent extends React.Component {
<p>
After that you could go back to the <Link to="/run-monkey">Run Monkey</Link> page to start new infections.
</p>
<p>
<a onClick={this.cleanup} className="btn btn-danger btn-lg">Reset Environment</a>
<p style={{margin: '20px'}}>
<button className="btn btn-danger btn-lg center-block"
onClick={() => {
this.setState({showCleanDialog: true});
this.updateMonkeysRunning();}
}>
Reset Environment
</button>
</p>
{ this.state.cleaned ?
<div className="alert alert-info">
<i className="glyphicon glyphicon-info-sign" style={{'marginRight': '5px'}}/>
You can continue and <Link to="/run-monkey">Run More Monkeys</Link> as you wish,
and see the results on the <Link to="/infection/map">Infection Map</Link> without deleting anything.
</div>
{ this.state.cleaned ?
<div className="alert alert-success">
<i className="glyphicon glyphicon-ok-sign" style={{'marginRight': '5px'}}/>
Environment was reset successfully
</div>
: ''}
<p>
* BTW you can just continue and <Link to="/run-monkey">run more monkeys</Link> as you wish,
and see the results on the <Link to="/infection/map">Infection Map</Link> without deleting anything.
</p>
</div>
</Col>
);

View File

@ -0,0 +1,15 @@
import React from 'react';
import Graph from 'react-graph-vis';
import Dimensions from 'react-dimensions'
class GraphWrapper extends React.Component {
render() {
let newOptions = this.props.options;
newOptions.height = this.props.containerHeight.toString() + 'px';
newOptions.width = this.props.containerWidth.toString() + 'px';
return (<Graph graph={this.props.graph} options={newOptions} events={this.props.events}/>)
}
}
let ReactiveGraph = Dimensions()(GraphWrapper);
export {ReactiveGraph};

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -317,3 +317,17 @@ body {
.data-table-container .pagination {
margin: 0 !important;
}
.markdown-body {
box-sizing: border-box;
min-width: 200px;
max-width: 980px;
margin: 0 auto;
padding: 45px;
}
@media (max-width: 767px) {
.markdown-body {
padding: 15px;
}
}