From 10d1e7dc0bffef1f9772c2ae9cfa10034e443ca2 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Fri, 8 May 2020 17:14:17 +0300 Subject: [PATCH 1/3] Fixed monkey ignoring depth restrictions --- monkey/infection_monkey/monkey.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/monkey/infection_monkey/monkey.py b/monkey/infection_monkey/monkey.py index 6b8803a9f..fa736cfc7 100644 --- a/monkey/infection_monkey/monkey.py +++ b/monkey/infection_monkey/monkey.py @@ -80,8 +80,10 @@ class InfectionMonkey(object): self._default_tunnel = self._opts.tunnel self._default_server = self._opts.server - if self._opts.depth: + if self._opts.depth is not None: WormConfiguration._depth_from_commandline = True + WormConfiguration.depth = self._opts.depth + self._keep_running = True self._network = NetworkScanner() self._dropper_path = sys.argv[0] From bd18893089ef45f2a53b985f2e769da7e2e50408 Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Sun, 10 May 2020 15:09:43 +0300 Subject: [PATCH 2/3] Added depth logging for easier debugging down the line --- monkey/infection_monkey/monkey.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/monkey/infection_monkey/monkey.py b/monkey/infection_monkey/monkey.py index fa736cfc7..c96599844 100644 --- a/monkey/infection_monkey/monkey.py +++ b/monkey/infection_monkey/monkey.py @@ -83,6 +83,8 @@ class InfectionMonkey(object): if self._opts.depth is not None: WormConfiguration._depth_from_commandline = True WormConfiguration.depth = self._opts.depth + LOG.debug(f"Setting propagation depth from command line") + LOG.debug(f"Set propagation depth to {WormConfiguration.depth}") self._keep_running = True self._network = NetworkScanner() From 07330ff2f5b3cea7f6b42c9441c1db0543e09f46 Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Sun, 10 May 2020 15:42:42 +0300 Subject: [PATCH 3/3] Fix build problem eslint and node incompatebility --- .travis.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index f291b2876..e2b4f6737 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,17 @@ install: - pip install coverage # for code coverage - pip install -r monkey/infection_monkey/requirements.txt # for unit tests +# node + npm + eslint +- node --version +- npm --version +# Install NVM, see https://github.com/nvm-sh/nvm#installing-and-updating +- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash +- nvm install node +- nvm use node +- npm i -g eslint +- node --version +- npm --version + before_script: # Set the server config to `testing`. This is required for for the UTs to pass. - python monkey/monkey_island/cc/set_server_config.py testing @@ -49,12 +60,9 @@ script: # Check JS code. The npm install must happen AFTER the flake8 because the node_modules folder will cause a lot of errors. - cd monkey_island/cc/ui - npm i -- npm i -g eslint -- cd - -- cd monkey_island/cc/ui -- eslint ./src --quiet +- eslint ./src --quiet # Test for errors - JS_WARNINGS_AMOUNT_UPPER_LIMIT=490 -- eslint ./src --max-warnings $JS_WARNINGS_AMOUNT_UPPER_LIMIT +- eslint ./src --max-warnings $JS_WARNINGS_AMOUNT_UPPER_LIMIT # Test for max warnings after_success: # Upload code coverage results to codecov.io, see https://github.com/codecov/codecov-bash for more information