From 8abb7fa5b95224da946301439b95d478c918a751 Mon Sep 17 00:00:00 2001 From: ravitgreitser Date: Thu, 28 Jul 2016 16:01:12 +0300 Subject: [PATCH 01/10] Update README.md --- README.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 56fdfdfca..7c98508bc 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ Infection Monkey ==================== -Datacenter Security Tool +Data center Security Tool ------------------------ ### http://www.guardicore.com/the-infected-chaos-monkey/ -The Infection Monkey is a security tool which tests your Data Center's ability to withstand perimeter breaches and internal server infection. It uses various methods to propagate through a data center, and reports its success to a centralized C&C server. +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. Features include: @@ -32,52 +32,52 @@ The Monkey itself has been tested on Windows XP, 7, 8.1 and 10. The Linux build ### Installation -For off the shelf use, download our pre-compiled binaries from our website, to setup the C&C server follow the instructions in [Monkey Island readme](monkey_island/readme.txt). If you with to compile the binaries yourself, follow the build instructions later on in this readme. +For off-the-shelf use, download our pre-compiled binaries from our website. To set up 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 by downloading or building from source, the Infection Monkey is basically 4 executable files for different platforms and a default configuration file. +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. +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 at your local instance of the Monkey Island (note 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. +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 -Running the C&C Server is as simple as installing our infected monkey debian package on a specific server. The initial infected machine doesn not require a direct link to this 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 at once. +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 monkey’s 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 monkeys current operation depth. +* `-t`, `--tunnel`: ip:port, set default tunnel for Monkey when connecting to c&c. +* `-d`, `--depth` : sets the Monkey's current operation depth. -Monkey Modus Operandi +How to activate the Monley --------------------- -1. Wakeup connection to c&c, sends basic info of the current machine and the configuration the monkey uses to the c&c. +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. +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 answer, using the classes defined in the configuration (SMBFinger, SSHFinger, etc) + 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. + 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 monkey’s executable is suitable, we use it. 2. If a suitable executable isn’t found, exploitation will fail. 3. Executables are cached in memory. @@ -129,7 +129,7 @@ ssh_passwords | list of strings | list of passwords to use when trying to exploi Building the Monkey from source ------------------------------- -If you want to build the monkey from source and not use our provided packages, look at the readme files under [chaos_monkey](chaos_monkey) and [monkey_island](monkey_island). +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 From fdf49b51958801eb05a8db892919009d40e56a8b Mon Sep 17 00:00:00 2001 From: Daniel Goldberg Date: Thu, 28 Jul 2016 16:41:37 +0300 Subject: [PATCH 02/10] Fix title --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c98508bc..95aa2e0f6 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ Command line options include: * `-d`, `--depth` : sets the Monkey's current operation depth. -How to activate the Monley +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. From 73d9914923cdb8430886a6f95273b843f956a26c Mon Sep 17 00:00:00 2001 From: itsikkes Date: Thu, 28 Jul 2016 17:42:20 +0300 Subject: [PATCH 03/10] Improved .deb creation and installation process for Ubuntu Added support for Systemd Units for MongoDB and Island; Some more installation fixes --- monkey_island/deb-package/DEBIAN/control | 5 +++-- monkey_island/deb-package/DEBIAN/postinst | 9 ++++++++- monkey_island/deb-package/DEBIAN/prerm | 2 ++ .../deb-package/monkey_island_pip_requirements.txt | 10 ++++++---- monkey_island/linux/install.sh | 14 ++++++++++++++ .../linux/ubuntu/systemd/monkey-island.service | 10 ++++++++++ .../linux/ubuntu/systemd/monkey-mongo.service | 12 ++++++++++++ monkey_island/linux/ubuntu/systemd/start_server.sh | 4 ++++ monkey_island/requirements.txt | 4 +++- 9 files changed, 62 insertions(+), 8 deletions(-) create mode 100644 monkey_island/linux/install.sh create mode 100644 monkey_island/linux/ubuntu/systemd/monkey-island.service create mode 100644 monkey_island/linux/ubuntu/systemd/monkey-mongo.service create mode 100644 monkey_island/linux/ubuntu/systemd/start_server.sh diff --git a/monkey_island/deb-package/DEBIAN/control b/monkey_island/deb-package/DEBIAN/control index 8cdac69df..e56705e37 100644 --- a/monkey_island/deb-package/DEBIAN/control +++ b/monkey_island/deb-package/DEBIAN/control @@ -1,7 +1,8 @@ Package: gc-monkey-island Architecture: amd64 -Maintainer: Uri Hershcovits +Maintainer: Guardicore Homepage: http://www.guardicore.com Priority: optional Version: VERSION -Description: Guardicore Chaos Monkey C&C installation package +Description: Guardicore Infection Monkey Island (C&C) installation package +Depends: openssl, python-pip diff --git a/monkey_island/deb-package/DEBIAN/postinst b/monkey_island/deb-package/DEBIAN/postinst index 0890adad4..22f24e715 100644 --- a/monkey_island/deb-package/DEBIAN/postinst +++ b/monkey_island/deb-package/DEBIAN/postinst @@ -13,9 +13,16 @@ pip install -r $MONKEY_FOLDER/pip_requirements.txt --no-index --find-links file: rm -rf ${INSTALLATION_FOLDER} rm -f ${MONKEY_FOLDER}/pip_requirements.txt -mv ${MONKEY_FOLDER}/ubuntu/* /etc/init/ +cp ${MONKEY_FOLDER}/ubuntu/* /etc/init/ +if [ -d "/etc/systemd/network" ]; then + cp ${MONKEY_FOLDER}/ubuntu/systemd/*.service /lib/systemd/system/ + chmod +x ${MONKEY_FOLDER}/ubuntu/systemd/start_server.sh + systemctl daemon-reload +fi ${MONKEY_FOLDER}/create_certificate.sh service monkey-island start service monkey-mongo start + +echo Monkey Island installation ended \ No newline at end of file diff --git a/monkey_island/deb-package/DEBIAN/prerm b/monkey_island/deb-package/DEBIAN/prerm index 1fcb4754e..9c49e0cd7 100644 --- a/monkey_island/deb-package/DEBIAN/prerm +++ b/monkey_island/deb-package/DEBIAN/prerm @@ -5,3 +5,5 @@ service monkey-mongo stop || true rm -f /etc/init/monkey-island.conf rm -f /etc/init/monkey-mongo.conf +rm /lib/systemd/system/monkey-island.service +rm /lib/systemd/system/monkey-mongo.service \ No newline at end of file diff --git a/monkey_island/deb-package/monkey_island_pip_requirements.txt b/monkey_island/deb-package/monkey_island_pip_requirements.txt index 1ea580e18..288aea101 100644 --- a/monkey_island/deb-package/monkey_island_pip_requirements.txt +++ b/monkey_island/deb-package/monkey_island_pip_requirements.txt @@ -1,4 +1,6 @@ -flask -Flask-Pymongo -Flask-Restful -python-dateutil \ No newline at end of file +flask +Flask-Pymongo +Flask-Restful +python-dateutil +impacket +pycrypto \ No newline at end of file diff --git a/monkey_island/linux/install.sh b/monkey_island/linux/install.sh new file mode 100644 index 000000000..f230b58d2 --- /dev/null +++ b/monkey_island/linux/install.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +MACHINE_TYPE=`uname -m` +if [ ${MACHINE_TYPE} == 'x86_64' ]; then + # 64-bit stuff here + ARCH=64 +else + # 32-bit stuff here + ARCH=32 +fi + +MONKEY_FILE=monkey-linux-$ARCH +cp -f /var/monkey_island/cc/binaries/$MONKEY_FILE /tmp +/tmp/$MONKEY_FILE m0nk3y $@ diff --git a/monkey_island/linux/ubuntu/systemd/monkey-island.service b/monkey_island/linux/ubuntu/systemd/monkey-island.service new file mode 100644 index 000000000..fe43875ac --- /dev/null +++ b/monkey_island/linux/ubuntu/systemd/monkey-island.service @@ -0,0 +1,10 @@ +[Unit] +Description=Monkey Island Service +After=network.target + +[Service] +Type=simple +ExecStart=/var/monkey_island/ubuntu/systemd/start_server.sh + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/monkey_island/linux/ubuntu/systemd/monkey-mongo.service b/monkey_island/linux/ubuntu/systemd/monkey-mongo.service new file mode 100644 index 000000000..6c1fee8f8 --- /dev/null +++ b/monkey_island/linux/ubuntu/systemd/monkey-mongo.service @@ -0,0 +1,12 @@ +[Unit] +Description=Monkey Island Mongo Service +After=network.target + +[Service] +ExecStart=/var/monkey_island/bin/mongodb/bin/mongod --quiet --dbpath /var/monkey_island/db +KillMode=process +Restart=always +ExecStop=/var/monkey_island/bin/mongodb/bin/mongod --shutdown + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/monkey_island/linux/ubuntu/systemd/start_server.sh b/monkey_island/linux/ubuntu/systemd/start_server.sh new file mode 100644 index 000000000..817da7a55 --- /dev/null +++ b/monkey_island/linux/ubuntu/systemd/start_server.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +cd /var/monkey_island/cc +python main.py \ No newline at end of file diff --git a/monkey_island/requirements.txt b/monkey_island/requirements.txt index 9d203c6c7..288aea101 100644 --- a/monkey_island/requirements.txt +++ b/monkey_island/requirements.txt @@ -1,4 +1,6 @@ flask Flask-Pymongo Flask-Restful -python-dateutil \ No newline at end of file +python-dateutil +impacket +pycrypto \ No newline at end of file From f5d0f267628993cdf98e6d0a74df21faa22f70c1 Mon Sep 17 00:00:00 2001 From: ravitgreitser Date: Thu, 28 Jul 2016 21:24:03 +0300 Subject: [PATCH 04/10] Update README.md --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 95aa2e0f6..e72d59946 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,14 @@ Infection Monkey ==================== -Data center Security Tool +### Data center Security Testing Tool ------------------------ -### http://www.guardicore.com/the-infected-chaos-monkey/ +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. +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: From cccd7793d6d5cdf86b0ea5c20900d51130751d89 Mon Sep 17 00:00:00 2001 From: itsikkes Date: Thu, 28 Jul 2016 22:52:18 +0300 Subject: [PATCH 05/10] minor .deb fix --- monkey_island/deb-package/DEBIAN/control | 2 +- monkey_island/deb-package/DEBIAN/postinst | 4 +++- monkey_island/deb-package/DEBIAN/prerm | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/monkey_island/deb-package/DEBIAN/control b/monkey_island/deb-package/DEBIAN/control index e56705e37..ecbd75cc6 100644 --- a/monkey_island/deb-package/DEBIAN/control +++ b/monkey_island/deb-package/DEBIAN/control @@ -3,6 +3,6 @@ Architecture: amd64 Maintainer: Guardicore Homepage: http://www.guardicore.com Priority: optional -Version: VERSION +Version: 1.0 Description: Guardicore Infection Monkey Island (C&C) installation package Depends: openssl, python-pip diff --git a/monkey_island/deb-package/DEBIAN/postinst b/monkey_island/deb-package/DEBIAN/postinst index 22f24e715..f30767760 100644 --- a/monkey_island/deb-package/DEBIAN/postinst +++ b/monkey_island/deb-package/DEBIAN/postinst @@ -25,4 +25,6 @@ ${MONKEY_FOLDER}/create_certificate.sh service monkey-island start service monkey-mongo start -echo Monkey Island installation ended \ No newline at end of file +echo Monkey Island installation ended + +exit 0 \ No newline at end of file diff --git a/monkey_island/deb-package/DEBIAN/prerm b/monkey_island/deb-package/DEBIAN/prerm index 9c49e0cd7..e7924c738 100644 --- a/monkey_island/deb-package/DEBIAN/prerm +++ b/monkey_island/deb-package/DEBIAN/prerm @@ -5,5 +5,7 @@ service monkey-mongo stop || true rm -f /etc/init/monkey-island.conf rm -f /etc/init/monkey-mongo.conf -rm /lib/systemd/system/monkey-island.service -rm /lib/systemd/system/monkey-mongo.service \ No newline at end of file +[ -f "/lib/systemd/system/monkey-island.service" ] && rm -f /lib/systemd/system/monkey-island.service +[ -f "/lib/systemd/system/monkey-mongo.service" ] && rm -f /lib/systemd/system/monkey-mongo.service + +exit 0 \ No newline at end of file From 9da2db2c1a2cb96fb1944a0f42b3e6bc66a12f4a Mon Sep 17 00:00:00 2001 From: itsikkes Date: Sun, 31 Jul 2016 20:40:05 +0300 Subject: [PATCH 06/10] Switched to tornado as the webserver --- monkey_island/cc/main.py | 9 ++++++++- .../deb-package/monkey_island_pip_requirements.txt | 3 ++- monkey_island/requirements.txt | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/monkey_island/cc/main.py b/monkey_island/cc/main.py index 1a3757b6f..999389053 100644 --- a/monkey_island/cc/main.py +++ b/monkey_island/cc/main.py @@ -296,4 +296,11 @@ api.add_resource(NewConfig, '/api/config/new') api.add_resource(MonkeyDownload, '/api/monkey/download', '/api/monkey/download/', '/api/monkey/download/') if __name__ == '__main__': - app.run(host='0.0.0.0', debug=True, ssl_context=('server.crt', 'server.key')) + from tornado.wsgi import WSGIContainer + from tornado.httpserver import HTTPServer + from tornado.ioloop import IOLoop + + http_server = HTTPServer(WSGIContainer(app), ssl_options={'certfile': 'server.crt', 'keyfile': 'server.key'}) + http_server.listen(5000) + IOLoop.instance().start() + #app.run(host='0.0.0.0', debug=False, ssl_context=('server.crt', 'server.key')) diff --git a/monkey_island/deb-package/monkey_island_pip_requirements.txt b/monkey_island/deb-package/monkey_island_pip_requirements.txt index 288aea101..bcff42515 100644 --- a/monkey_island/deb-package/monkey_island_pip_requirements.txt +++ b/monkey_island/deb-package/monkey_island_pip_requirements.txt @@ -3,4 +3,5 @@ Flask-Pymongo Flask-Restful python-dateutil impacket -pycrypto \ No newline at end of file +pycrypto +tornado \ No newline at end of file diff --git a/monkey_island/requirements.txt b/monkey_island/requirements.txt index 288aea101..bcff42515 100644 --- a/monkey_island/requirements.txt +++ b/monkey_island/requirements.txt @@ -3,4 +3,5 @@ Flask-Pymongo Flask-Restful python-dateutil impacket -pycrypto \ No newline at end of file +pycrypto +tornado \ No newline at end of file From 2afcae489ebc61283bdbfb173a13e1c068051a8e Mon Sep 17 00:00:00 2001 From: itsikkes Date: Sun, 31 Jul 2016 20:40:45 +0300 Subject: [PATCH 07/10] updated missing fields --- chaos_monkey/example.conf | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/chaos_monkey/example.conf b/chaos_monkey/example.conf index 3fcb6adf7..4d6e29699 100644 --- a/chaos_monkey/example.conf +++ b/chaos_monkey/example.conf @@ -1,9 +1,8 @@ { "command_servers": [ - "russian-mail-brides.com:5000", - "41.50.73.31:5000" + "russian-mail-brides.com:5000" ], - "internet_services": = [ + "internet_services": [ "monkey.guardicore.com", "www.google.com" ], @@ -29,6 +28,8 @@ ], "alive": true, "collect_system_info": true, + "depth": 2, + "dropper_date_reference_path": "/bin/sh", "dropper_log_path_windows": "%temp%\\~df1562.tmp", "dropper_log_path_linux": "/tmp/user-1562", @@ -36,8 +37,8 @@ "dropper_target_path": "C:\\Windows\\monkey.exe", "dropper_target_path_linux": "/bin/monkey", - "kill_path_linux": "/tmp/user-4150", - "kill_path_windows": "%temp%\\~df4150.tmp", + "kill_file_path_linux": "/tmp/user-4150", + "kill_file_path_windows": "%temp%\\~df4150.tmp", "dropper_try_move_first": false, "exploiter_classes": [ "SSHExploiter", @@ -63,7 +64,7 @@ "rdp_use_vbs_download": true, "retry_failed_explotation": true, "scanner_class": "TcpScanner", - "self_delete_in_cleanup": false, + "self_delete_in_cleanup": true, "serialize_config": false, "singleton_mutex_name": "{2384ec59-0df8-4ab9-918c-843740924a28}", "skip_exploit_if_file_exist": true, From f55b8d429d535cc87a1ed0069fc78b22c04536e4 Mon Sep 17 00:00:00 2001 From: itsikkes Date: Mon, 1 Aug 2016 14:46:21 +0300 Subject: [PATCH 08/10] moved connectivity checking outside of loop --- chaos_monkey/control.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/chaos_monkey/control.py b/chaos_monkey/control.py index d262a78ee..d23164239 100644 --- a/chaos_monkey/control.py +++ b/chaos_monkey/control.py @@ -30,6 +30,8 @@ class ControlClient(object): if not parent: parent = GUID + internet_access = check_internet_access(WormConfiguration.internet_services) + for server in WormConfiguration.command_servers: try: WormConfiguration.current_server = server @@ -38,7 +40,7 @@ class ControlClient(object): 'hostname': hostname, 'ip_addresses': local_ips(), 'description': " ".join(platform.uname()), - 'internet_access': check_internet_access(WormConfiguration.internet_services), + 'internet_access': internet_access, 'config': WormConfiguration.as_dict(), 'parent': parent} From de958088b4c179f7d200f19000647766079de6e9 Mon Sep 17 00:00:00 2001 From: itsikkes Date: Mon, 1 Aug 2016 16:52:27 +0300 Subject: [PATCH 09/10] depth commandline option is not overwritten when getting config from the island --- chaos_monkey/config.py | 4 ++++ chaos_monkey/control.py | 9 +++++---- chaos_monkey/monkey.py | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/chaos_monkey/config.py b/chaos_monkey/config.py index 721b3d9a2..9c58c42f2 100644 --- a/chaos_monkey/config.py +++ b/chaos_monkey/config.py @@ -51,6 +51,8 @@ class Configuration(object): continue if key in ["name", "id", "current_server"]: continue + if self._depth_from_commandline and key=="depth": + continue try: default_value = getattr(Configuration, key) except AttributeError: @@ -83,6 +85,8 @@ class Configuration(object): return result + _depth_from_commandline = False + ########################### # logging config ########################### diff --git a/chaos_monkey/control.py b/chaos_monkey/control.py index d23164239..f8f3e3ee0 100644 --- a/chaos_monkey/control.py +++ b/chaos_monkey/control.py @@ -22,7 +22,7 @@ class ControlClient(object): proxies = {} @staticmethod - def wakeup(parent=None, default_tunnel=None): + def wakeup(parent=None, default_tunnel=None, has_internet_access=None): LOG.debug("Trying to wake up with C&C servers list: %r" % WormConfiguration.command_servers) if parent or default_tunnel: LOG.debug("parent: %s, default_tunnel: %s" % (parent, default_tunnel)) @@ -30,7 +30,8 @@ class ControlClient(object): if not parent: parent = GUID - internet_access = check_internet_access(WormConfiguration.internet_services) + if has_internet_access is None: + has_internet_access = check_internet_access(WormConfiguration.internet_services) for server in WormConfiguration.command_servers: try: @@ -40,7 +41,7 @@ class ControlClient(object): 'hostname': hostname, 'ip_addresses': local_ips(), 'description': " ".join(platform.uname()), - 'internet_access': internet_access, + 'internet_access': has_internet_access, 'config': WormConfiguration.as_dict(), 'parent': parent} @@ -71,7 +72,7 @@ class ControlClient(object): proxy_address, proxy_port = proxy_find LOG.info("Found tunnel at %s:%s" % (proxy_address, proxy_port)) ControlClient.proxies['https'] = 'https://%s:%s' % (proxy_address, proxy_port) - ControlClient.wakeup(parent=parent) + ControlClient.wakeup(parent=parent, has_internet_access=has_internet_access) else: LOG.info("No tunnel found") diff --git a/chaos_monkey/monkey.py b/chaos_monkey/monkey.py index 482211b81..c7c3824a4 100644 --- a/chaos_monkey/monkey.py +++ b/chaos_monkey/monkey.py @@ -52,6 +52,7 @@ class ChaosMonkey(object): self._default_server = opts.server if opts.depth: WormConfiguration.depth = int(opts.depth) + WormConfiguration._depth_from_commandline = True self._keep_running = True self._network = NetworkScanner() self._dropper_path = sys.argv[0] From a11ff2b3cb9ea7705f88c299c6231a77a0ba8ef2 Mon Sep 17 00:00:00 2001 From: itsikkes Date: Mon, 1 Aug 2016 23:54:41 +0300 Subject: [PATCH 10/10] add option to run monkey directly from Island UI --- monkey_island/cc/admin/ui/index.html | 8 +- monkey_island/cc/admin/ui/js/monkeys-admin.js | 70 +++++++++++ monkey_island/cc/main.py | 114 ++++++++++++++++-- 3 files changed, 182 insertions(+), 10 deletions(-) diff --git a/monkey_island/cc/admin/ui/index.html b/monkey_island/cc/admin/ui/index.html index 2392e988b..c39a1072b 100644 --- a/monkey_island/cc/admin/ui/index.html +++ b/monkey_island/cc/admin/ui/index.html @@ -59,7 +59,7 @@
@@ -193,10 +193,14 @@
+