From a6aa0eb864b562f16f18a4baad60226a09859c62 Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Thu, 7 Nov 2019 14:58:52 +0200 Subject: [PATCH 01/13] Trying to multi-language travis build --- .travis.yml | 92 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 55 insertions(+), 37 deletions(-) diff --git a/.travis.yml b/.travis.yml index d6b9ca212..7152ab24b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,48 +1,66 @@ # Infection Monkey travis.yml. See Travis documentation for information about this file structure. - group: travis_latest -language: python +jobs: + include: + # The python job + - language: python -cache: pip + cache: pip -python: -- 3.7 + python: + - 3.7 -install: -- pip install -r monkey/monkey_island/requirements.txt # for unit tests -- pip install flake8 pytest dlint # for next stages -- pip install -r monkey/infection_monkey/requirements_linux.txt # for unit tests + os: linux -before_script: -# Check syntax errors and fail the build if any are found. -- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics + install: + - pip install -r monkey/monkey_island/requirements.txt # for unit tests + - pip install flake8 pytest dlint # for next stages + - pip install -r monkey/infection_monkey/requirements_linux.txt # for unit tests -# Warn about linter issues. -# --exit-zero forces Flake8 to use the exit status code 0 even if there are errors, which means this will NOT fail the build. -# --count will print the total number of errors. -# --statistics Count the number of occurrences of each error/warning code and print a report. -# The output is redirected to a file. -- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics > flake8_warnings.txt -# Display the linter issues -- cat flake8_warnings.txt -# Make sure that we haven't increased the amount of warnings. -- WARNINGS_AMOUNT_UPPER_LIMIT=190 -- if [ $(tail -n 1 flake8_warnings.txt) -gt $WARNINGS_AMOUNT_UPPER_LIMIT ]; then echo "Too many warnings! Failing this build. Lower the amount of linter errors in this and try again. " && exit 1; fi + before_script: + # Check syntax errors and fail the build if any are found. + - flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics -# Set the server config to `testing`, for the UTs to use mongomaock and pass. -- python monkey/monkey_island/cc/set_server_config.py testing + # Warn about linter issues. + # --exit-zero forces Flake8 to use the exit status code 0 even if there are errors, which means this will NOT fail the build. + # --count will print the total number of errors. + # --statistics Count the number of occurrences of each error/warning code and print a report. + # The output is redirected to a file. + - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics > flake8_warnings.txt + # Display the linter issues + - cat flake8_warnings.txt + # Make sure that we haven't increased the amount of warnings. + - WARNINGS_AMOUNT_UPPER_LIMIT=190 + - if [ $(tail -n 1 flake8_warnings.txt) -gt $WARNINGS_AMOUNT_UPPER_LIMIT ]; then echo "Too many warnings! Failing this build. Lower the amount of linter errors in this and try again. " && exit 1; fi -script: -- cd monkey # This is our source dir -- python -m pytest # Have to use `python -m pytest` instead of `pytest` to add "{$builddir}/monkey/monkey" to sys.path. + # Set the server config to `testing`, for the UTs to use mongomaock and pass. + - python monkey/monkey_island/cc/set_server_config.py testing -notifications: - slack: # Notify to slack - rooms: - - infectionmonkey:QaXbsx4g7tHFJW0lhtiBmoAg#ci # room: #ci - on_success: change - on_failure: always - email: - on_success: change - on_failure: always + script: + - cd monkey # This is our source dir + - python -m pytest # Have to use `python -m pytest` instead of `pytest` to add "{$builddir}/monkey/monkey" to sys.path. + + notifications: + slack: # Notify to slack + rooms: + - infectionmonkey:QaXbsx4g7tHFJW0lhtiBmoAg#ci # room: #ci + on_success: change + on_failure: always + email: + on_success: change + on_failure: always + + # The JS job + - language: node_js + cache: + directories: + - "node_modules" + sudo: false + script: + - pwd + - cd monkey_island/cc/ui + - pwd + - npm i -g eslint + - eslint ./src --quiet + - eslint ./src --max-warnings 100 \ No newline at end of file From 54fd1d77442ff12760698cb3f5cb20c4ab6ee4de Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Thu, 7 Nov 2019 15:02:49 +0200 Subject: [PATCH 02/13] Trying to make the travis script work --- .travis.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7152ab24b..d84aaae7e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,11 @@ # Infection Monkey travis.yml. See Travis documentation for information about this file structure. -group: travis_latest - jobs: include: # The python job - - language: python + - + group: travis_latest + + language: python cache: pip @@ -52,7 +53,9 @@ jobs: on_failure: always # The JS job - - language: node_js + - + group: travis_latest + language: node_js cache: directories: - "node_modules" From c2ba6ce46cbe8035d7ea7397089649c16bfa7184 Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Thu, 7 Nov 2019 16:24:36 +0200 Subject: [PATCH 03/13] Changed structure - everything is the same job --- .travis.yml | 101 +++++++++++++++++++++++----------------------------- 1 file changed, 44 insertions(+), 57 deletions(-) diff --git a/.travis.yml b/.travis.yml index d84aaae7e..d275b8e80 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,69 +1,56 @@ # Infection Monkey travis.yml. See Travis documentation for information about this file structure. -jobs: - include: - # The python job - - - group: travis_latest - language: python +group: travis_latest - cache: pip +language: python - python: - - 3.7 +cache: pip - os: linux +python: +- 3.7 - install: - - pip install -r monkey/monkey_island/requirements.txt # for unit tests - - pip install flake8 pytest dlint # for next stages - - pip install -r monkey/infection_monkey/requirements_linux.txt # for unit tests +os: linux - before_script: - # Check syntax errors and fail the build if any are found. - - flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics +install: +- pip install -r monkey/monkey_island/requirements.txt # for unit tests +- pip install flake8 pytest dlint # for next stages +- pip install -r monkey/infection_monkey/requirements_linux.txt # for unit tests - # Warn about linter issues. - # --exit-zero forces Flake8 to use the exit status code 0 even if there are errors, which means this will NOT fail the build. - # --count will print the total number of errors. - # --statistics Count the number of occurrences of each error/warning code and print a report. - # The output is redirected to a file. - - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics > flake8_warnings.txt - # Display the linter issues - - cat flake8_warnings.txt - # Make sure that we haven't increased the amount of warnings. - - WARNINGS_AMOUNT_UPPER_LIMIT=190 - - if [ $(tail -n 1 flake8_warnings.txt) -gt $WARNINGS_AMOUNT_UPPER_LIMIT ]; then echo "Too many warnings! Failing this build. Lower the amount of linter errors in this and try again. " && exit 1; fi +before_script: +# Set the server config to `testing`, for the UTs to use mongomaock and pass. +- python monkey/monkey_island/cc/set_server_config.py testing - # Set the server config to `testing`, for the UTs to use mongomaock and pass. - - python monkey/monkey_island/cc/set_server_config.py testing +script: +# Check Python code +# Check syntax errors and fail the build if any are found. +- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics - script: - - cd monkey # This is our source dir - - python -m pytest # Have to use `python -m pytest` instead of `pytest` to add "{$builddir}/monkey/monkey" to sys.path. +# Warn about linter issues. +# --exit-zero forces Flake8 to use the exit status code 0 even if there are errors, which means this will NOT fail the build. +# --count will print the total number of errors. +# --statistics Count the number of occurrences of each error/warning code and print a report. +# The output is redirected to a file. +- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics > flake8_warnings.txt +# Display the linter issues +- cat flake8_warnings.txt +# Make sure that we haven't increased the amount of warnings. +- WARNINGS_AMOUNT_UPPER_LIMIT=190 +- if [ $(tail -n 1 flake8_warnings.txt) -gt $WARNINGS_AMOUNT_UPPER_LIMIT ]; then echo "Too many warnings! Failing this build. Lower the amount of linter errors in this and try again. " && exit 1; fi - notifications: - slack: # Notify to slack - rooms: - - infectionmonkey:QaXbsx4g7tHFJW0lhtiBmoAg#ci # room: #ci - on_success: change - on_failure: always - email: - on_success: change - on_failure: always +- cd monkey # This is our source dir +- python -m pytest # Have to use `python -m pytest` instead of `pytest` to add "{$builddir}/monkey/monkey" to sys.path. - # The JS job - - - group: travis_latest - language: node_js - cache: - directories: - - "node_modules" - sudo: false - script: - - pwd - - cd monkey_island/cc/ui - - pwd - - npm i -g eslint - - eslint ./src --quiet - - eslint ./src --max-warnings 100 \ No newline at end of file +# Check JS code +- cd monkey_island/cc/ui +- eslint ./src --quiet +- eslint ./src --max-warnings 100 + +notifications: + slack: # Notify to slack + rooms: + - infectionmonkey:QaXbsx4g7tHFJW0lhtiBmoAg#ci # room: #ci + on_success: change + on_failure: always + email: + on_success: change + on_failure: always From f313a34cbb28f6f8665f19479caecf0068a8eef8 Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Thu, 7 Nov 2019 16:29:10 +0200 Subject: [PATCH 04/13] installing eslint --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index d275b8e80..ba2e7e3c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,10 +12,14 @@ python: os: linux install: +# Python - pip install -r monkey/monkey_island/requirements.txt # for unit tests - pip install flake8 pytest dlint # for next stages - pip install -r monkey/infection_monkey/requirements_linux.txt # for unit tests +# JS +- npm i -g eslint + before_script: # Set the server config to `testing`, for the UTs to use mongomaock and pass. - python monkey/monkey_island/cc/set_server_config.py testing From 1194bc0d065a2c8e0db6d528046c5eefa991d1bc Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Thu, 7 Nov 2019 16:35:42 +0200 Subject: [PATCH 05/13] Added npm install to make sure eslint will work (it needs babel) --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index ba2e7e3c1..43f7b9012 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,10 @@ install: - pip install -r monkey/infection_monkey/requirements_linux.txt # for unit tests # JS +- cd monkey/monkey_island/cc/ui +- npm i - npm i -g eslint +- cd - before_script: # Set the server config to `testing`, for the UTs to use mongomaock and pass. From fde8ac53e32b6e1e9db1894764f19482532e3872 Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Thu, 7 Nov 2019 16:44:00 +0200 Subject: [PATCH 06/13] Moved npm i to after python checks --- .travis.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 43f7b9012..da11ed1d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,12 +17,6 @@ install: - pip install flake8 pytest dlint # for next stages - pip install -r monkey/infection_monkey/requirements_linux.txt # for unit tests -# JS -- cd monkey/monkey_island/cc/ui -- npm i -- npm i -g eslint -- cd - - before_script: # Set the server config to `testing`, for the UTs to use mongomaock and pass. - python monkey/monkey_island/cc/set_server_config.py testing @@ -47,7 +41,11 @@ script: - cd monkey # This is our source dir - python -m pytest # Have to use `python -m pytest` instead of `pytest` to add "{$builddir}/monkey/monkey" to sys.path. -# Check JS code +# 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 --max-warnings 100 From 0acec95c8688e97eacdeb0e09f746d0ced3d96a3 Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Thu, 7 Nov 2019 17:00:14 +0200 Subject: [PATCH 07/13] Updated JS lint upper limit (currently 497) --- .travis.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index da11ed1d4..d637c54ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,20 +35,21 @@ script: # Display the linter issues - cat flake8_warnings.txt # Make sure that we haven't increased the amount of warnings. -- WARNINGS_AMOUNT_UPPER_LIMIT=190 -- if [ $(tail -n 1 flake8_warnings.txt) -gt $WARNINGS_AMOUNT_UPPER_LIMIT ]; then echo "Too many warnings! Failing this build. Lower the amount of linter errors in this and try again. " && exit 1; fi +- PYTHON_WARNINGS_AMOUNT_UPPER_LIMIT=190 +- if [ $(tail -n 1 flake8_warnings.txt) -gt $PYTHON_WARNINGS_AMOUNT_UPPER_LIMIT ]; then echo "Too many warnings! Failing this build. Lower the amount of linter errors in this and try again. " && exit 1; fi - cd monkey # This is our source dir - python -m pytest # Have to use `python -m pytest` instead of `pytest` to add "{$builddir}/monkey/monkey" to sys.path. -# Check JS code. The npm install must happen AFTER the flake8 because the node_modules folder will cause a lot of errors. +# 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 --max-warnings 100 +- JS_WARNINGS_AMOUNT_UPPER_LIMIT=497 +- eslint ./src --max-warnings $JS_WARNINGS_AMOUNT_UPPER_LIMIT notifications: slack: # Notify to slack From ad1e85f86786c01a6faffa1883301dc16db80d3c Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Fri, 8 Nov 2019 16:30:43 +0200 Subject: [PATCH 08/13] Fixed typo and added some documentation. --- .travis.yml | 2 +- monkey/monkey_island/cc/environment/testing.py | 4 ++++ monkey/monkey_island/cc/models/__init__.py | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index d637c54ee..d6148ec39 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ install: - pip install -r monkey/infection_monkey/requirements_linux.txt # for unit tests before_script: -# Set the server config to `testing`, for the UTs to use mongomaock and pass. +# 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 script: diff --git a/monkey/monkey_island/cc/environment/testing.py b/monkey/monkey_island/cc/environment/testing.py index 087c3a2e3..4f65d1710 100644 --- a/monkey/monkey_island/cc/environment/testing.py +++ b/monkey/monkey_island/cc/environment/testing.py @@ -2,6 +2,10 @@ from monkey_island.cc.environment import Environment class TestingEnvironment(Environment): + """ + Use this environment for running Unit Tests. + This will cause all mongo connections to happen via `mongomock` instead of using an actual mongodb instance. + """ def __init__(self): super(TestingEnvironment, self).__init__() self.testing = True diff --git a/monkey/monkey_island/cc/models/__init__.py b/monkey/monkey_island/cc/models/__init__.py index d8c1b05c8..94d56d6a8 100644 --- a/monkey/monkey_island/cc/models/__init__.py +++ b/monkey/monkey_island/cc/models/__init__.py @@ -6,7 +6,7 @@ from monkey_island.cc.environment.environment import env # If testing, use mongomock which only emulates mongo. for more information, see # http://docs.mongoengine.org/guide/mongomock.html . # Otherwise, use an actual mongod instance with connection parameters supplied by env. -if env.testing: +if env.testing: # See monkey_island.cc.environment.testing connect('mongoenginetest', host='mongomock://localhost') else: connect(db=env.mongo_db_name, host=env.mongo_db_host, port=env.mongo_db_port) From 3607547aea6b887bcb507579a035dbed97c69a4f Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Fri, 8 Nov 2019 17:42:42 +0200 Subject: [PATCH 09/13] Fix some formatting issues --- monkey/monkey_island/cc/environment/testing.py | 3 ++- .../cc/services/reporting/zero_trust_service.py | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/monkey/monkey_island/cc/environment/testing.py b/monkey/monkey_island/cc/environment/testing.py index 4f65d1710..e504a8357 100644 --- a/monkey/monkey_island/cc/environment/testing.py +++ b/monkey/monkey_island/cc/environment/testing.py @@ -4,8 +4,9 @@ from monkey_island.cc.environment import Environment class TestingEnvironment(Environment): """ Use this environment for running Unit Tests. - This will cause all mongo connections to happen via `mongomock` instead of using an actual mongodb instance. + This will cause all mongo connections to happen via `mongomock` instead of using an actual mongodb instance. """ + def __init__(self): super(TestingEnvironment, self).__init__() self.testing = True diff --git a/monkey/monkey_island/cc/services/reporting/zero_trust_service.py b/monkey/monkey_island/cc/services/reporting/zero_trust_service.py index 9937c0b6d..dd6fad1bc 100644 --- a/monkey/monkey_island/cc/services/reporting/zero_trust_service.py +++ b/monkey/monkey_island/cc/services/reporting/zero_trust_service.py @@ -68,7 +68,8 @@ class ZeroTrustService(object): all_statuses |= set(Finding.objects(test=test).distinct("status")) for status in all_statuses: - if zero_trust_consts.ORDERED_TEST_STATUSES.index(status) < zero_trust_consts.ORDERED_TEST_STATUSES.index(worst_status): + if zero_trust_consts.ORDERED_TEST_STATUSES.index(status) \ + < zero_trust_consts.ORDERED_TEST_STATUSES.index(worst_status): worst_status = status return worst_status @@ -95,7 +96,8 @@ class ZeroTrustService(object): """ current_worst_status = zero_trust_consts.STATUS_UNEXECUTED for finding in all_findings_for_test: - if zero_trust_consts.ORDERED_TEST_STATUSES.index(finding.status) < zero_trust_consts.ORDERED_TEST_STATUSES.index(current_worst_status): + if zero_trust_consts.ORDERED_TEST_STATUSES.index(finding.status) \ + < zero_trust_consts.ORDERED_TEST_STATUSES.index(current_worst_status): current_worst_status = finding.status return current_worst_status From d36ec06e911b65f8adc63bf9b0fff3e338a7d666 Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Sun, 10 Nov 2019 15:51:54 +0200 Subject: [PATCH 10/13] Fixing code style issues to lower linter warnings number --- .../cc/ui/src/components/Main.js | 16 +++--- .../src/components/attack/MatrixComponent.js | 14 ++--- .../components/attack/techniques/Helpers.js | 14 ++--- .../src/components/attack/techniques/T1003.js | 6 +-- .../src/components/attack/techniques/T1005.js | 12 ++--- .../src/components/attack/techniques/T1016.js | 12 ++--- .../src/components/attack/techniques/T1018.js | 10 ++-- .../src/components/attack/techniques/T1021.js | 12 ++--- .../src/components/attack/techniques/T1035.js | 6 +-- .../src/components/attack/techniques/T1041.js | 10 ++-- .../src/components/attack/techniques/T1059.js | 10 ++-- .../src/components/attack/techniques/T1064.js | 6 +-- .../src/components/attack/techniques/T1075.js | 14 ++--- .../src/components/attack/techniques/T1082.js | 10 ++-- .../src/components/attack/techniques/T1086.js | 10 ++-- .../src/components/attack/techniques/T1090.js | 8 +-- .../src/components/attack/techniques/T1105.js | 10 ++-- .../src/components/attack/techniques/T1106.js | 6 +-- .../src/components/attack/techniques/T1107.js | 8 +-- .../src/components/attack/techniques/T1110.js | 12 ++--- .../src/components/attack/techniques/T1129.js | 6 +-- .../src/components/attack/techniques/T1145.js | 10 ++-- .../src/components/attack/techniques/T1188.js | 12 ++--- .../src/components/attack/techniques/T1197.js | 4 +- .../src/components/attack/techniques/T1210.js | 14 ++--- .../src/components/attack/techniques/T1222.js | 12 ++--- .../map/preview-pane/InfMapPreviewPane.js | 14 ++--- .../map/preview-pane/PreviewPane.js | 14 ++--- .../ui/src/components/pages/ConfigurePage.js | 39 +++++++------- .../cc/ui/src/components/pages/MapPage.js | 2 +- .../components/pages/PassTheHashMapPage.js | 8 +-- .../cc/ui/src/components/pages/ReportPage.js | 24 ++++----- .../ui/src/components/pages/RunMonkeyPage.js | 4 +- .../ui/src/components/pages/TelemetryPage.js | 2 +- .../components/pages/ZeroTrustReportPage.js | 23 ++++---- .../common/MonkeysStillAliveWarning.js | 4 +- .../common/MustRunMonkeyWarning.js | 4 +- .../common/PaginatedTable.js | 8 +-- .../common/PrintReportButton.js | 6 +-- .../report-components/common/ReportHeader.js | 14 ++--- .../report-components/common/ReportLoader.js | 10 ++-- .../common/SecurityIssuesGlance.js | 4 +- .../security/AttackReport.js | 52 +++++++++---------- .../security/BreachedServers.js | 2 +- .../report-components/security/PostBreach.js | 18 +++---- .../security/ScannedServers.js | 2 +- .../zerotrust/EventsButton.js | 14 ++--- .../zerotrust/EventsModal.js | 18 +++---- .../zerotrust/EventsModalButtons.js | 6 +-- .../zerotrust/EventsTimeline.js | 10 ++-- .../zerotrust/ExportEventsButton.js | 6 +-- .../zerotrust/FindingsSection.js | 10 ++-- .../zerotrust/FindingsTable.js | 26 +++++----- .../zerotrust/PillarLabel.js | 24 ++++----- .../zerotrust/PillarOverview.js | 8 +-- .../zerotrust/PrinciplesSection.js | 6 +-- .../zerotrust/PrinciplesStatusTable.js | 12 ++--- .../zerotrust/ReportLegend.js | 28 +++++----- .../zerotrust/SinglePillarPrinciplesStatus.js | 16 +++--- .../zerotrust/StatusLabel.js | 28 +++++----- .../zerotrust/StatusesToPillarsSummary.js | 10 ++-- .../zerotrust/SummarySection.js | 12 ++--- .../zerotrust/ZeroTrustPillars.js | 22 ++++---- .../zerotrust/venn-components/ArcNode.js | 6 +-- .../zerotrust/venn-components/CircularNode.js | 8 +-- .../zerotrust/venn-components/VennDiagram.js | 13 ++--- .../src/components/run-monkey/AwsRunTable.js | 10 ++-- .../components/side-menu/VersionComponent.js | 2 +- .../src/components/ui-components/Checkbox.js | 2 +- .../ui/src/components/utils/SaveJsonToFile.js | 6 +-- .../cc/ui/src/server_config/ServerConfig.js | 2 +- .../cc/ui/src/services/AuthService.js | 4 +- 72 files changed, 409 insertions(+), 418 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/Main.js b/monkey/monkey_island/cc/ui/src/components/Main.js index 09038292e..9f4b18bc8 100644 --- a/monkey/monkey_island/cc/ui/src/components/Main.js +++ b/monkey/monkey_island/cc/ui/src/components/Main.js @@ -14,7 +14,7 @@ import ZeroTrustReportPage from 'components/pages/ZeroTrustReportPage'; import LicensePage from 'components/pages/LicensePage'; import AuthComponent from 'components/AuthComponent'; import LoginPageComponent from 'components/pages/LoginPage'; -import Notifier from "react-desktop-notification" +import Notifier from 'react-desktop-notification' import 'normalize.css/normalize.css'; @@ -22,7 +22,7 @@ import 'react-data-components/css/table-twbs.css'; import 'styles/App.css'; import 'react-toggle/style.css'; import 'react-table/react-table.css'; -import VersionComponent from "./side-menu/VersionComponent"; +import VersionComponent from './side-menu/VersionComponent'; let logoImage = require('../images/monkey-icon.svg'); let infectionMonkeyImage = require('../images/infection-monkey.svg'); @@ -63,7 +63,7 @@ class AppComponent extends AuthComponent { }; renderRoute = (route_path, page_component, is_exact_path = false) => { - let render_func = (props) => { + let render_func = () => { switch (this.state.isLoggedIn) { case true: return page_component; @@ -92,7 +92,7 @@ class AppComponent extends AuthComponent { infection_done: false, report_done: false, isLoggedIn: undefined - }, + } }; } @@ -194,7 +194,7 @@ class AppComponent extends AuthComponent { - ()}/> + ()}/> {this.renderRoute('/', , true)} {this.renderRoute('/configure', )} {this.renderRoute('/run-monkey', )} @@ -219,8 +219,8 @@ class AppComponent extends AuthComponent { const url = `${protocol}//${hostname}:${port}${reportZeroTrustRoute}`; Notifier.start( - "Monkey Island", - "Infection is done! Click here to go to the report page.", + 'Monkey Island', + 'Infection is done! Click here to go to the report page.', url, notificationIcon); } @@ -228,7 +228,7 @@ class AppComponent extends AuthComponent { shouldShowNotification() { // No need to show the notification to redirect to the report if we're already in the report page - return (this.state.completedSteps.infection_done && !window.location.pathname.startsWith("/report")); + return (this.state.completedSteps.infection_done && !window.location.pathname.startsWith('/report')); } } diff --git a/monkey/monkey_island/cc/ui/src/components/attack/MatrixComponent.js b/monkey/monkey_island/cc/ui/src/components/attack/MatrixComponent.js index 640032767..29ab3497a 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/MatrixComponent.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/MatrixComponent.js @@ -2,16 +2,16 @@ import React from 'react'; import Checkbox from '../ui-components/Checkbox' import Tooltip from 'react-tooltip-lite' import AuthComponent from '../AuthComponent'; -import ReactTable from "react-table"; +import ReactTable from 'react-table'; import 'filepond/dist/filepond.min.css'; import '../../styles/Tooltip.scss'; -import {Col} from "react-bootstrap"; +import {Col} from 'react-bootstrap'; class MatrixComponent extends AuthComponent { constructor(props) { super(props); this.state = {lastAction: 'none'} - }; + } // Finds which attack type has most techniques and returns that number static findMaxTechniques(data) { @@ -22,7 +22,7 @@ class MatrixComponent extends AuthComponent { } }); return maxLen - }; + } // Parses ATT&CK config schema into data suitable for react-table (ATT&CK matrix) static parseTechniques(data, maxLen) { @@ -47,7 +47,7 @@ class MatrixComponent extends AuthComponent { techniques.push(row) } return techniques; - }; + } getColumns(matrixData) { return Object.keys(matrixData[0]).map((key) => { @@ -73,7 +73,7 @@ class MatrixComponent extends AuthComponent { ) } - }; + } getTableData = (config) => { let configCopy = JSON.parse(JSON.stringify(config)); @@ -106,7 +106,7 @@ class MatrixComponent extends AuthComponent { return (
{this.renderLegend()} -
+
{val.ip_addr} {(val.domain_name ? " (".concat(val.domain_name, ")") : "")} + {val.ip_addr} {(val.domain_name ? ' ('.concat(val.domain_name, ')') : '')} ) } /* Function takes data gathered from system info collector and creates a string representation of machine from that data. */ export function renderMachineFromSystemData(data) { - let machineStr = data['hostname'] + " ( "; + let machineStr = data['hostname'] + ' ( '; data['ips'].forEach(function (ipInfo) { - if (typeof ipInfo === "object") { - machineStr += ipInfo['addr'] + ", "; + if (typeof ipInfo === 'object') { + machineStr += ipInfo['addr'] + ', '; } else { - machineStr += ipInfo + ", "; + machineStr += ipInfo + ', '; } }); // Replaces " ," with " )" to finish a list of IP's - return machineStr.slice(0, -2) + " )" + return machineStr.slice(0, -2) + ' )' } /* Formats telemetry data that contains _id.machine and _id.usage fields into columns diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1003.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1003.js index ccebd3e7c..4a7a69b6f 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1003.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1003.js @@ -1,8 +1,8 @@ import React from 'react'; import '../../../styles/Collapse.scss' import '../../report-components/security/StolenPasswords' -import StolenPasswordsComponent from "../../report-components/security/StolenPasswords"; -import {ScanStatus} from "./Helpers" +import StolenPasswordsComponent from '../../report-components/security/StolenPasswords'; +import {ScanStatus} from './Helpers' class T1003 extends React.Component { @@ -19,7 +19,7 @@ class T1003 extends React.Component { {this.props.data.status === ScanStatus.USED ? - : ""} + : ''}
); } diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1005.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1005.js index 799b91d08..6493a93ae 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1005.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1005.js @@ -1,7 +1,7 @@ import React from 'react'; import '../../../styles/Collapse.scss' -import ReactTable from "react-table"; -import {renderMachineFromSystemData, ScanStatus} from "./Helpers"; +import ReactTable from 'react-table'; +import {renderMachineFromSystemData, ScanStatus} from './Helpers'; class T1005 extends React.Component { @@ -11,7 +11,7 @@ class T1005 extends React.Component { static getDataColumns() { return ([{ - Header: "Sensitive data", + Header: 'Sensitive data', columns: [ { Header: 'Machine', @@ -20,10 +20,10 @@ class T1005 extends React.Component { style: {'whiteSpace': 'unset'} }, {Header: 'Type', id: 'type', accessor: x => x.gathered_data_type, style: {'whiteSpace': 'unset'}}, - {Header: 'Info', id: 'info', accessor: x => x.info, style: {'whiteSpace': 'unset'}}, + {Header: 'Info', id: 'info', accessor: x => x.info, style: {'whiteSpace': 'unset'}} ] }]) - }; + } render() { return ( @@ -36,7 +36,7 @@ class T1005 extends React.Component { data={this.props.data.collected_data} showPagination={false} defaultPageSize={this.props.data.collected_data.length} - /> : ""} + /> : ''}
); } diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1016.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1016.js index c5a02a8f7..fda21f0ee 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1016.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1016.js @@ -1,7 +1,7 @@ import React from 'react'; import '../../../styles/Collapse.scss' -import ReactTable from "react-table"; -import {renderMachineFromSystemData, renderUsageFields, ScanStatus} from "./Helpers" +import ReactTable from 'react-table'; +import {renderMachineFromSystemData, renderUsageFields, ScanStatus} from './Helpers' class T1016 extends React.Component { @@ -12,7 +12,7 @@ class T1016 extends React.Component { static getNetworkInfoColumns() { return ([{ - Header: "Network configuration info gathered", + Header: 'Network configuration info gathered', columns: [ { Header: 'Machine', @@ -20,10 +20,10 @@ class T1016 extends React.Component { accessor: x => renderMachineFromSystemData(x.machine), style: {'whiteSpace': 'unset'} }, - {Header: 'Network info', id: 'info', accessor: x => renderUsageFields(x.info), style: {'whiteSpace': 'unset'}}, + {Header: 'Network info', id: 'info', accessor: x => renderUsageFields(x.info), style: {'whiteSpace': 'unset'}} ] }]) - }; + } render() { return ( @@ -36,7 +36,7 @@ class T1016 extends React.Component { data={this.props.data.network_info} showPagination={false} defaultPageSize={this.props.data.network_info.length} - /> : ""} + /> : ''}
); } diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1018.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1018.js index e54f4c89c..491cd42fd 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1018.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1018.js @@ -1,7 +1,7 @@ import React from 'react'; import '../../../styles/Collapse.scss' -import ReactTable from "react-table"; -import {renderMachineFromSystemData, renderMachine, ScanStatus} from "./Helpers" +import ReactTable from 'react-table'; +import {renderMachineFromSystemData, renderMachine, ScanStatus} from './Helpers' class T1018 extends React.Component { @@ -34,10 +34,10 @@ class T1018 extends React.Component { id: 'systems', accessor: x => T1018.renderMachines(x.machines), style: {'whiteSpace': 'unset'} - }, + } ] }]) - }; + } render() { return ( @@ -50,7 +50,7 @@ class T1018 extends React.Component { data={this.props.data.scan_info} showPagination={false} defaultPageSize={this.props.data.scan_info.length} - /> : ""} + /> : ''} ); } diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1021.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1021.js index e9b21d7f4..7e057f924 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1021.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1021.js @@ -1,7 +1,7 @@ import React from 'react'; import '../../../styles/Collapse.scss' -import ReactTable from "react-table"; -import {renderMachine, ScanStatus} from "./Helpers" +import ReactTable from 'react-table'; +import {renderMachine, ScanStatus} from './Helpers' class T1021 extends React.Component { @@ -23,14 +23,14 @@ class T1021 extends React.Component { id: 'credentials', accessor: x => this.renderCreds(x.successful_creds), style: {'whiteSpace': 'unset'} - }, + } ] }]) - }; + } static renderCreds(creds) { return {creds.map(cred =>
{cred}
)}
- }; + } render() { return ( @@ -43,7 +43,7 @@ class T1021 extends React.Component { data={this.props.data.services} showPagination={false} defaultPageSize={this.props.data.services.length} - /> : ""} + /> : ''} ); } diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1035.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1035.js index b95b6bb45..e063338f4 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1035.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1035.js @@ -1,7 +1,7 @@ import React from 'react'; import '../../../styles/Collapse.scss' -import ReactTable from "react-table"; -import {getUsageColumns} from "./Helpers" +import ReactTable from 'react-table'; +import {getUsageColumns} from './Helpers' class T1035 extends React.Component { @@ -21,7 +21,7 @@ class T1035 extends React.Component { data={this.props.data.services} showPagination={false} defaultPageSize={this.props.data.services.length} - /> : ""} + /> : ''} ); } diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1041.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1041.js index 9749186fe..5e2509d3b 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1041.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1041.js @@ -1,7 +1,7 @@ import React from 'react'; import '../../../styles/Collapse.scss' -import ReactTable from "react-table"; -import {ScanStatus} from "./Helpers"; +import ReactTable from 'react-table'; +import {ScanStatus} from './Helpers'; class T1041 extends React.Component { @@ -11,13 +11,13 @@ class T1041 extends React.Component { static getC2Columns() { return ([{ - Header: "Data exfiltration channels", + Header: 'Data exfiltration channels', columns: [ {Header: 'Source', id: 'src', accessor: x => x.src, style: {'whiteSpace': 'unset'}}, {Header: 'Destination', id: 'dst', accessor: x => x.dst, style: {'whiteSpace': 'unset'}} ] }]) - }; + } render() { return ( @@ -30,7 +30,7 @@ class T1041 extends React.Component { data={this.props.data.command_control_channel} showPagination={false} defaultPageSize={this.props.data.command_control_channel.length} - /> : ""} + /> : ''} ); } diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1059.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1059.js index ba886b6c7..50c915bc3 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1059.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1059.js @@ -1,7 +1,7 @@ import React from 'react'; import '../../../styles/Collapse.scss' -import ReactTable from "react-table"; -import {renderMachine, ScanStatus} from "./Helpers" +import ReactTable from 'react-table'; +import {renderMachine, ScanStatus} from './Helpers' class T1059 extends React.Component { @@ -22,10 +22,10 @@ class T1059 extends React.Component { width: 160 }, {Header: 'Approx. Time', id: 'time', accessor: x => x.data.info.finished, style: {'whiteSpace': 'unset'}}, - {Header: 'Command', id: 'command', accessor: x => x.data.info.executed_cmds.cmd, style: {'whiteSpace': 'unset'}}, + {Header: 'Command', id: 'command', accessor: x => x.data.info.executed_cmds.cmd, style: {'whiteSpace': 'unset'}} ] }]) - }; + } render() { return ( @@ -38,7 +38,7 @@ class T1059 extends React.Component { data={this.props.data.cmds} showPagination={false} defaultPageSize={this.props.data.cmds.length} - /> : ""} + /> : ''} ); } diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1064.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1064.js index 27b099f82..af54bf8f9 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1064.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1064.js @@ -1,7 +1,7 @@ import React from 'react'; import '../../../styles/Collapse.scss' -import ReactTable from "react-table"; -import {getUsageColumns} from "./Helpers" +import ReactTable from 'react-table'; +import {getUsageColumns} from './Helpers' class T1064 extends React.Component { @@ -21,7 +21,7 @@ class T1064 extends React.Component { data={this.props.data.scripts} showPagination={false} defaultPageSize={this.props.data.scripts.length} - /> : ""} + /> : ''} ); } diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1075.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1075.js index db2bb943a..05f1cadb8 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1075.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1075.js @@ -1,7 +1,7 @@ import React from 'react'; import '../../../styles/Collapse.scss' -import ReactTable from "react-table"; -import {renderMachine, ScanStatus} from "./Helpers" +import ReactTable from 'react-table'; +import {renderMachine, ScanStatus} from './Helpers' class T1075 extends React.Component { @@ -12,9 +12,9 @@ class T1075 extends React.Component { } setLoginHashType(login) { - if (login.attempts[0].ntlm_hash !== "") { + if (login.attempts[0].ntlm_hash !== '') { login.attempts[0].hashType = 'NTLM'; - } else if (login.attempts[0].lm_hash !== "") { + } else if (login.attempts[0].lm_hash !== '') { login.attempts[0].hashType = 'LM'; } } @@ -25,10 +25,10 @@ class T1075 extends React.Component { {Header: 'Machine', id: 'machine', accessor: x => renderMachine(x.machine), style: {'whiteSpace': 'unset'}}, {Header: 'Service', id: 'service', accessor: x => x.info.display_name, style: {'whiteSpace': 'unset'}}, {Header: 'Username', id: 'username', accessor: x => x.attempts[0].user, style: {'whiteSpace': 'unset'}}, - {Header: 'Hash type', id: 'hash', accessor: x => x.attempts[0].hashType, style: {'whiteSpace': 'unset'}}, + {Header: 'Hash type', id: 'hash', accessor: x => x.attempts[0].hashType, style: {'whiteSpace': 'unset'}} ] }]) - }; + } render() { return ( @@ -41,7 +41,7 @@ class T1075 extends React.Component { data={this.props.data.successful_logins} showPagination={false} defaultPageSize={this.props.data.successful_logins.length} - /> : ""} + /> : ''} ); } diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1082.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1082.js index 1e04f9da8..d9a040cb8 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1082.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1082.js @@ -1,7 +1,7 @@ import React from 'react'; import '../../../styles/Collapse.scss' -import ReactTable from "react-table"; -import {renderMachineFromSystemData, renderUsageFields, ScanStatus} from "./Helpers" +import ReactTable from 'react-table'; +import {renderMachineFromSystemData, renderUsageFields, ScanStatus} from './Helpers' class T1082 extends React.Component { @@ -19,10 +19,10 @@ class T1082 extends React.Component { accessor: x => renderMachineFromSystemData(x.machine), style: {'whiteSpace': 'unset'} }, - {Header: 'Gathered info', id: 'info', accessor: x => renderUsageFields(x.collections), style: {'whiteSpace': 'unset'}}, + {Header: 'Gathered info', id: 'info', accessor: x => renderUsageFields(x.collections), style: {'whiteSpace': 'unset'}} ] }]) - }; + } render() { return ( @@ -35,7 +35,7 @@ class T1082 extends React.Component { data={this.props.data.system_info} showPagination={false} defaultPageSize={this.props.data.system_info.length} - /> : ""} + /> : ''} ); } diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1086.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1086.js index faeff7862..a0ee61063 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1086.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1086.js @@ -1,7 +1,7 @@ import React from 'react'; import '../../../styles/Collapse.scss' -import ReactTable from "react-table"; -import {renderMachine, ScanStatus} from "./Helpers" +import ReactTable from 'react-table'; +import {renderMachine, ScanStatus} from './Helpers' class T1086 extends React.Component { @@ -22,10 +22,10 @@ class T1086 extends React.Component { width: 160 }, {Header: 'Approx. Time', id: 'time', accessor: x => x.data[0].info.finished, style: {'whiteSpace': 'unset'}}, - {Header: 'Command', id: 'command', accessor: x => x.data[0].info.executed_cmds[0].cmd, style: {'whiteSpace': 'unset'}}, + {Header: 'Command', id: 'command', accessor: x => x.data[0].info.executed_cmds[0].cmd, style: {'whiteSpace': 'unset'}} ] }]) - }; + } render() { return ( @@ -38,7 +38,7 @@ class T1086 extends React.Component { data={this.props.data.cmds} showPagination={false} defaultPageSize={this.props.data.cmds.length} - /> : ""} + /> : ''} ); } diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1090.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1090.js index 8aa0de2c2..28cd3f950 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1090.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1090.js @@ -1,7 +1,7 @@ import React from 'react'; import '../../../styles/Collapse.scss' -import ReactTable from "react-table"; -import {renderMachineFromSystemData, ScanStatus} from "./Helpers" +import ReactTable from 'react-table'; +import {renderMachineFromSystemData, ScanStatus} from './Helpers' class T1090 extends React.Component { @@ -20,7 +20,7 @@ class T1090 extends React.Component { style: {'whiteSpace': 'unset', textAlign: 'center'} }] }]) - }; + } render() { return ( @@ -33,7 +33,7 @@ class T1090 extends React.Component { data={this.props.data.proxies} showPagination={false} defaultPageSize={this.props.data.proxies.length} - /> : ""} + /> : ''} ); } diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1105.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1105.js index d1df0e9e6..6619d38ee 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1105.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1105.js @@ -1,7 +1,7 @@ import React from 'react'; import '../../../styles/Collapse.scss' -import ReactTable from "react-table"; -import {ScanStatus} from "./Helpers" +import ReactTable from 'react-table'; +import {ScanStatus} from './Helpers' class T1105 extends React.Component { @@ -16,10 +16,10 @@ class T1105 extends React.Component { columns: [ {Header: 'Src. Machine', id: 'srcMachine', accessor: x => x.src, style: {'whiteSpace': 'unset'}, width: 170}, {Header: 'Dst. Machine', id: 'dstMachine', accessor: x => x.dst, style: {'whiteSpace': 'unset'}, width: 170}, - {Header: 'Filename', id: 'filename', accessor: x => x.filename, style: {'whiteSpace': 'unset'}}, + {Header: 'Filename', id: 'filename', accessor: x => x.filename, style: {'whiteSpace': 'unset'}} ] }]) - }; + } render() { return ( @@ -32,7 +32,7 @@ class T1105 extends React.Component { data={this.props.data.files} showPagination={false} defaultPageSize={this.props.data.files.length} - /> : ""} + /> : ''} ); } diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1106.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1106.js index febebb30d..a242ce119 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1106.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1106.js @@ -1,7 +1,7 @@ import React from 'react'; import '../../../styles/Collapse.scss' -import ReactTable from "react-table"; -import {getUsageColumns} from "./Helpers" +import ReactTable from 'react-table'; +import {getUsageColumns} from './Helpers' class T1106 extends React.Component { @@ -21,7 +21,7 @@ class T1106 extends React.Component { data={this.props.data.api_uses} showPagination={false} defaultPageSize={this.props.data.api_uses.length} - /> : ""} + /> : ''} ); } diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1107.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1107.js index faabf95a2..44994faae 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1107.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1107.js @@ -1,7 +1,7 @@ import React from 'react'; import '../../../styles/Collapse.scss' -import ReactTable from "react-table"; -import {renderMachineFromSystemData, ScanStatus} from "./Helpers" +import ReactTable from 'react-table'; +import {renderMachineFromSystemData, ScanStatus} from './Helpers' class T1107 extends React.Component { @@ -33,7 +33,7 @@ class T1107 extends React.Component { style: {'whiteSpace': 'unset'}, width: 160 }] }]) - }; + } render() { return ( @@ -46,7 +46,7 @@ class T1107 extends React.Component { data={this.props.data.deleted_files} showPagination={false} defaultPageSize={this.props.data.deleted_files.length} - /> : ""} + /> : ''} ); } diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1110.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1110.js index 475e79fed..8cee9f584 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1110.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1110.js @@ -1,7 +1,7 @@ import React from 'react'; import '../../../styles/Collapse.scss' -import ReactTable from "react-table"; -import {renderMachine, ScanStatus} from "./Helpers" +import ReactTable from 'react-table'; +import {renderMachine, ScanStatus} from './Helpers' class T1110 extends React.Component { @@ -26,14 +26,14 @@ class T1110 extends React.Component { id: 'credentials', accessor: x => this.renderCreds(x.successful_creds), style: {'whiteSpace': 'unset'} - }, + } ] }]) - }; + } static renderCreds(creds) { return {creds.map(cred =>
{cred}
)}
- }; + } render() { return ( @@ -46,7 +46,7 @@ class T1110 extends React.Component { data={this.props.data.services} showPagination={false} defaultPageSize={this.props.data.services.length} - /> : ""} + /> : ''} ); } diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1129.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1129.js index cd19be877..8aafc7144 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1129.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1129.js @@ -1,7 +1,7 @@ import React from 'react'; import '../../../styles/Collapse.scss' -import ReactTable from "react-table"; -import {getUsageColumns} from "./Helpers"; +import ReactTable from 'react-table'; +import {getUsageColumns} from './Helpers'; class T1129 extends React.Component { @@ -20,7 +20,7 @@ class T1129 extends React.Component { data={this.props.data.dlls} showPagination={false} defaultPageSize={this.props.data.dlls.length} - /> : ""} + /> : ''} ); } diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1145.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1145.js index 2383a0bcc..c858a0f34 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1145.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1145.js @@ -1,7 +1,7 @@ import React from 'react'; import '../../../styles/Collapse.scss' -import ReactTable from "react-table"; -import {renderMachineFromSystemData, ScanStatus} from "./Helpers" +import ReactTable from 'react-table'; +import {renderMachineFromSystemData, ScanStatus} from './Helpers' class T1145 extends React.Component { @@ -33,10 +33,10 @@ class T1145 extends React.Component { id: 'keys', accessor: x => T1145.renderSSHKeys(x.ssh_info), style: {'whiteSpace': 'unset'} - }, + } ] }]) - }; + } render() { return ( @@ -49,7 +49,7 @@ class T1145 extends React.Component { data={this.props.data.ssh_info} showPagination={false} defaultPageSize={this.props.data.ssh_info.length} - /> : ""} + /> : ''} ); } diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1188.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1188.js index acddac84a..7181e3402 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1188.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1188.js @@ -1,7 +1,7 @@ import React from 'react'; import '../../../styles/Collapse.scss' -import ReactTable from "react-table"; -import {renderMachineFromSystemData, ScanStatus} from "./Helpers" +import ReactTable from 'react-table'; +import {renderMachineFromSystemData, ScanStatus} from './Helpers' class T1188 extends React.Component { @@ -12,7 +12,7 @@ class T1188 extends React.Component { static getHopColumns() { return ([{ - Header: "Communications through multi-hop proxies", + Header: 'Communications through multi-hop proxies', columns: [ { Header: 'From', @@ -31,10 +31,10 @@ class T1188 extends React.Component { id: 'hops', accessor: x => x.count, style: {'whiteSpace': 'unset'} - }, + } ] }]) - }; + } render() { return ( @@ -47,7 +47,7 @@ class T1188 extends React.Component { data={this.props.data.hops} showPagination={false} defaultPageSize={this.props.data.hops.length} - /> : ""} + /> : ''} ); } diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1197.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1197.js index d82f51e3a..e8a998409 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1197.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1197.js @@ -1,7 +1,7 @@ import React from 'react'; import '../../../styles/Collapse.scss' -import ReactTable from "react-table"; -import {renderMachine} from "./Helpers" +import ReactTable from 'react-table'; +import {renderMachine} from './Helpers' class T1210 extends React.Component { diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1210.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1210.js index 2a66d97bb..e5c19cef5 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1210.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1210.js @@ -1,7 +1,7 @@ import React from 'react'; import '../../../styles/Collapse.scss' -import ReactTable from "react-table"; -import {renderMachine} from "./Helpers" +import ReactTable from 'react-table'; +import {renderMachine} from './Helpers' class T1210 extends React.Component { @@ -12,7 +12,7 @@ class T1210 extends React.Component { static getScanColumns() { return ([{ - Header: "Found services", + Header: 'Found services', columns: [ { Header: 'Machine', id: 'machine', accessor: x => renderMachine(x.machine), @@ -27,7 +27,7 @@ class T1210 extends React.Component { static getExploitColumns() { return ([{ - Header: "Exploited services", + Header: 'Exploited services', columns: [ { Header: 'Machine', id: 'machine', accessor: x => renderMachine(x.machine), @@ -41,13 +41,13 @@ class T1210 extends React.Component { {Header: 'Service', id: 'service', accessor: x => x.service.display_name, style: {'whiteSpace': 'unset'}} ] }]) - }; + } static renderEndpoint(val) { return ( {(val.vulnerable_urls.length !== 0 ? val.vulnerable_urls[0] : val.vulnerable_ports[0])} ) - }; + } static formatScanned(data) { let result = []; @@ -63,7 +63,7 @@ class T1210 extends React.Component { result.push(scanned_service) } return result - }; + } renderScannedServices(data) { return ( diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1222.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1222.js index 4162196a5..b490b173e 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1222.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/T1222.js @@ -1,7 +1,7 @@ import React from 'react'; import '../../../styles/Collapse.scss' -import ReactTable from "react-table"; -import {renderMachine, ScanStatus} from "./Helpers" +import ReactTable from 'react-table'; +import {renderMachine, ScanStatus} from './Helpers' class T1222 extends React.Component { @@ -12,13 +12,13 @@ class T1222 extends React.Component { static getCommandColumns() { return ([{ - Header: "Permission modification commands", + Header: 'Permission modification commands', columns: [ {Header: 'Machine', id: 'machine', accessor: x => renderMachine(x.machine), style: {'whiteSpace': 'unset'}}, - {Header: 'Command', id: 'command', accessor: x => x.command, style: {'whiteSpace': 'unset'}}, + {Header: 'Command', id: 'command', accessor: x => x.command, style: {'whiteSpace': 'unset'}} ] }]) - }; + } render() { return ( @@ -31,7 +31,7 @@ class T1222 extends React.Component { data={this.props.data.commands} showPagination={false} defaultPageSize={this.props.data.commands.length} - /> : ""} + /> : ''} ); } diff --git a/monkey/monkey_island/cc/ui/src/components/map/preview-pane/InfMapPreviewPane.js b/monkey/monkey_island/cc/ui/src/components/map/preview-pane/InfMapPreviewPane.js index 06223bba1..1bc0ce90d 100644 --- a/monkey/monkey_island/cc/ui/src/components/map/preview-pane/InfMapPreviewPane.js +++ b/monkey/monkey_island/cc/ui/src/components/map/preview-pane/InfMapPreviewPane.js @@ -84,14 +84,14 @@ class InfMapPreviewPaneComponent extends PreviewPaneComponent { unescapeLog(st) { return st.substr(1, st.length - 2) // remove quotation marks on beginning and end of string. - .replace(/\\n/g, "\n") - .replace(/\\r/g, "\r") - .replace(/\\t/g, "\t") - .replace(/\\b/g, "\b") - .replace(/\\f/g, "\f") + .replace(/\\n/g, '\n') + .replace(/\\r/g, '\r') + .replace(/\\t/g, '\t') + .replace(/\\b/g, '\b') + .replace(/\\f/g, '\f') .replace(/\\"/g, '\"') - .replace(/\\'/g, "\'") - .replace(/\\&/g, "\&"); + .replace(/\\'/g, '\'') + .replace(/\\&/g, '\&'); } downloadLog(asset) { diff --git a/monkey/monkey_island/cc/ui/src/components/map/preview-pane/PreviewPane.js b/monkey/monkey_island/cc/ui/src/components/map/preview-pane/PreviewPane.js index 3ef3ab76d..41c48f31f 100644 --- a/monkey/monkey_island/cc/ui/src/components/map/preview-pane/PreviewPane.js +++ b/monkey/monkey_island/cc/ui/src/components/map/preview-pane/PreviewPane.js @@ -92,14 +92,14 @@ class PreviewPaneComponent extends AuthComponent { unescapeLog(st) { return st.substr(1, st.length - 2) // remove quotation marks on beginning and end of string. - .replace(/\\n/g, "\n") - .replace(/\\r/g, "\r") - .replace(/\\t/g, "\t") - .replace(/\\b/g, "\b") - .replace(/\\f/g, "\f") + .replace(/\\n/g, '\n') + .replace(/\\r/g, '\r') + .replace(/\\t/g, '\t') + .replace(/\\b/g, '\b') + .replace(/\\f/g, '\f') .replace(/\\"/g, '\"') - .replace(/\\'/g, "\'") - .replace(/\\&/g, "\&"); + .replace(/\\'/g, '\'') + .replace(/\\&/g, '\&'); } downloadLog(asset) { diff --git a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js index c962cacbc..eff8f5d2f 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js @@ -5,7 +5,7 @@ import FileSaver from 'file-saver'; import AuthComponent from '../AuthComponent'; import {FilePond} from 'react-filepond'; import 'filepond/dist/filepond.min.css'; -import MatrixComponent from "../attack/MatrixComponent"; +import MatrixComponent from '../attack/MatrixComponent'; const ATTACK_URL = '/api/attack'; const CONFIG_URL = '/api/configuration/island'; @@ -39,31 +39,31 @@ class ConfigurePageComponent extends AuthComponent { getUiSchemas() { return ({ - basic: {"ui:order": ["general", "credentials"]}, + basic: {'ui:order': ['general', 'credentials']}, basic_network: {}, monkey: { behaviour: { custom_PBA_linux_cmd: { - "ui:widget": "textarea", - "ui:emptyValue": "" + 'ui:widget': 'textarea', + 'ui:emptyValue': '' }, PBA_linux_file: { - "ui:widget": this.PBAlinux + 'ui:widget': this.PBAlinux }, custom_PBA_windows_cmd: { - "ui:widget": "textarea", - "ui:emptyValue": "" + 'ui:widget': 'textarea', + 'ui:emptyValue': '' }, PBA_windows_file: { - "ui:widget": this.PBAwindows + 'ui:widget': this.PBAwindows }, PBA_linux_filename: { - classNames: "linux-pba-file-info", - "ui:emptyValue": "" + classNames: 'linux-pba-file-info', + 'ui:emptyValue': '' }, PBA_windows_filename: { - classNames: "windows-pba-file-info", - "ui:emptyValue": "" + classNames: 'windows-pba-file-info', + 'ui:emptyValue': '' } } }, @@ -95,7 +95,7 @@ class ConfigurePageComponent extends AuthComponent { this.setInitialAttackConfig(attackConfig.configuration); for (let sectionKey of this.sectionsOrder) { if (sectionKey === 'attack') { - sections.push({key: sectionKey, title: "ATT&CK"}) + sections.push({key: sectionKey, title: 'ATT&CK'}) } else { sections.push({key: sectionKey, title: monkeyConfig.schema.properties[sectionKey].title}); } @@ -148,6 +148,7 @@ class ConfigurePageComponent extends AuthComponent { .then(this.updateConfig()) .then(this.setState({lastAction: 'saved'})) .catch(error => { + console.log('Bad configuration: ' + error.toString()); this.setState({lastAction: 'invalid_configuration'}); }); }; @@ -166,8 +167,8 @@ class ConfigurePageComponent extends AuthComponent { this.setInitialConfig(res.configuration); this.props.onStatusChange(); }).catch(error => { - console.log('bad configuration'); - this.setState({lastAction: 'invalid_configuration'}); + console.log('Bad configuration: ' + error.toString()); + this.setState({lastAction: 'invalid_configuration'}); }); }; @@ -327,8 +328,8 @@ class ConfigurePageComponent extends AuthComponent { exportConfig = () => { this.updateConfigSection(); const configAsJson = JSON.stringify(this.state.configuration, null, 2); - const configAsBinary = new Blob([configAsJson], {type: "text/plain;charset=utf-8"}); - + const configAsBinary = new Blob([configAsJson], {type: 'text/plain;charset=utf-8'}); + FileSaver.saveAs(configAsBinary, 'monkey.conf'); }; @@ -349,7 +350,7 @@ class ConfigurePageComponent extends AuthComponent { console.log('bad configuration'); this.setState({lastAction: 'invalid_configuration'}); })); - }; + } importConfig = (event) => { let reader = new FileReader(); @@ -464,7 +465,7 @@ class ConfigurePageComponent extends AuthComponent { formData={this.state.configuration[this.state.selectedSection]} onChange={this.onChange} noValidate={true}> - + ) }; diff --git a/monkey/monkey_island/cc/ui/src/components/pages/MapPage.js b/monkey/monkey_island/cc/ui/src/components/pages/MapPage.js index adb91b908..d8a79cdca 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/MapPage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/MapPage.js @@ -43,7 +43,7 @@ class MapPageComponent extends AuthComponent { this.authFetch('/api/netmap') .then(res => res.json()) .then(res => { - if (res.hasOwnProperty("edges")) { + if (res.hasOwnProperty('edges')) { res.edges.forEach(edge => { edge.color = {'color': edgeGroupToColor(edge.group)}; }); diff --git a/monkey/monkey_island/cc/ui/src/components/pages/PassTheHashMapPage.js b/monkey/monkey_island/cc/ui/src/components/pages/PassTheHashMapPage.js index 66dc7e089..af102c57e 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/PassTheHashMapPage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/PassTheHashMapPage.js @@ -1,12 +1,8 @@ import React from 'react'; import {ReactiveGraph} from 'components/reactive-graph/ReactiveGraph'; import AuthComponent from '../AuthComponent'; -import {optionsPth, edgeGroupToColorPth, options} from '../map/MapOptions'; -import PreviewPane from "../map/preview-pane/PreviewPane"; -import {Col} from "react-bootstrap"; -import {Link} from 'react-router-dom'; -import {Icon} from 'react-fa'; -import PthPreviewPaneComponent from "../map/preview-pane/PthPreviewPane"; +import {optionsPth} from '../map/MapOptions'; +import {Col} from 'react-bootstrap'; class PassTheHashMapPageComponent extends AuthComponent { constructor(props) { diff --git a/monkey/monkey_island/cc/ui/src/components/pages/ReportPage.js b/monkey/monkey_island/cc/ui/src/components/pages/ReportPage.js index c3b538c70..0cc17eb9f 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/ReportPage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ReportPage.js @@ -9,16 +9,16 @@ import StolenPasswords from 'components/report-components/security/StolenPasswor import CollapsibleWellComponent from 'components/report-components/security/CollapsibleWell'; import {Line} from 'rc-progress'; import AuthComponent from '../AuthComponent'; -import PassTheHashMapPageComponent from "./PassTheHashMapPage"; -import StrongUsers from "components/report-components/security/StrongUsers"; -import AttackReport from "components/report-components/security/AttackReport"; -import ReportHeader, {ReportTypes} from "../report-components/common/ReportHeader"; -import MonkeysStillAliveWarning from "../report-components/common/MonkeysStillAliveWarning"; -import ReportLoader from "../report-components/common/ReportLoader"; -import MustRunMonkeyWarning from "../report-components/common/MustRunMonkeyWarning"; -import SecurityIssuesGlance from "../report-components/common/SecurityIssuesGlance"; -import PrintReportButton from "../report-components/common/PrintReportButton"; -import {extractExecutionStatusFromServerResponse} from "../report-components/common/ExecutionStatus"; +import PassTheHashMapPageComponent from './PassTheHashMapPage'; +import StrongUsers from 'components/report-components/security/StrongUsers'; +import AttackReport from 'components/report-components/security/AttackReport'; +import ReportHeader, {ReportTypes} from '../report-components/common/ReportHeader'; +import MonkeysStillAliveWarning from '../report-components/common/MonkeysStillAliveWarning'; +import ReportLoader from '../report-components/common/ReportLoader'; +import MustRunMonkeyWarning from '../report-components/common/MustRunMonkeyWarning'; +import SecurityIssuesGlance from '../report-components/common/SecurityIssuesGlance'; +import PrintReportButton from '../report-components/common/PrintReportButton'; +import {extractExecutionStatusFromServerResponse} from '../report-components/common/ExecutionStatus'; let guardicoreLogoImage = require('../../images/guardicore-logo.png'); @@ -858,8 +858,8 @@ class ReportPageComponent extends AuthComponent { className="label label-danger">remote code execution attacks.
The attack was made possible due to one of the following vulnerabilities: - CVE-2017-10271 or - CVE-2019-2725 + CVE-2017-10271 or + CVE-2019-2725 ); diff --git a/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage.js b/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage.js index 57373b2f7..1569ee889 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage.js @@ -7,7 +7,7 @@ import GridLoader from 'react-spinners/GridLoader'; import {Icon} from 'react-fa'; import {Link} from 'react-router-dom'; import AuthComponent from '../AuthComponent'; -import AwsRunTable from "../run-monkey/AwsRunTable"; +import AwsRunTable from '../run-monkey/AwsRunTable'; const loading_css_override = css` display: block; @@ -348,7 +348,7 @@ class RunMonkeyPageComponent extends AuthComponent {
res.json()) .then(res => { - let filename = 'Island_log' + let filename = 'Island_log'; let logContent = (res['log_file']); download(logContent, filename, 'text/plain'); }); diff --git a/monkey/monkey_island/cc/ui/src/components/pages/ZeroTrustReportPage.js b/monkey/monkey_island/cc/ui/src/components/pages/ZeroTrustReportPage.js index a0b92d9bd..02502ee39 100755 --- a/monkey/monkey_island/cc/ui/src/components/pages/ZeroTrustReportPage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ZeroTrustReportPage.js @@ -1,14 +1,14 @@ import React, {Fragment} from 'react'; import {Col} from 'react-bootstrap'; import AuthComponent from '../AuthComponent'; -import ReportHeader, {ReportTypes} from "../report-components/common/ReportHeader"; -import ReportLoader from "../report-components/common/ReportLoader"; -import MustRunMonkeyWarning from "../report-components/common/MustRunMonkeyWarning"; -import PrintReportButton from "../report-components/common/PrintReportButton"; -import {extractExecutionStatusFromServerResponse} from "../report-components/common/ExecutionStatus"; -import SummarySection from "../report-components/zerotrust/SummarySection"; -import FindingsSection from "../report-components/zerotrust/FindingsSection"; -import PrinciplesSection from "../report-components/zerotrust/PrinciplesSection"; +import ReportHeader, {ReportTypes} from '../report-components/common/ReportHeader'; +import ReportLoader from '../report-components/common/ReportLoader'; +import MustRunMonkeyWarning from '../report-components/common/MustRunMonkeyWarning'; +import PrintReportButton from '../report-components/common/PrintReportButton'; +import {extractExecutionStatusFromServerResponse} from '../report-components/common/ExecutionStatus'; +import SummarySection from '../report-components/zerotrust/SummarySection'; +import FindingsSection from '../report-components/zerotrust/FindingsSection'; +import PrinciplesSection from '../report-components/zerotrust/PrinciplesSection'; class ZeroTrustReportPageComponent extends AuthComponent { @@ -100,13 +100,12 @@ class ZeroTrustReportPageComponent extends AuthComponent { } stillLoadingDataFromServer() { - return typeof this.state.findings === "undefined" - || typeof this.state.pillars === "undefined" - || typeof this.state.principles === "undefined"; + return typeof this.state.findings === 'undefined' + || typeof this.state.pillars === 'undefined' + || typeof this.state.principles === 'undefined'; } getZeroTrustReportFromServer() { - let res; this.authFetch('/api/report/zero_trust/findings') .then(res => res.json()) .then(res => { diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/common/MonkeysStillAliveWarning.js b/monkey/monkey_island/cc/ui/src/components/report-components/common/MonkeysStillAliveWarning.js index 7b72570fa..eae09a0fc 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/common/MonkeysStillAliveWarning.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/common/MonkeysStillAliveWarning.js @@ -1,5 +1,5 @@ -import React, {Component} from "react"; -import * as PropTypes from "prop-types"; +import React, {Component} from 'react'; +import * as PropTypes from 'prop-types'; export default class MonkeysStillAliveWarning extends Component { render() { diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/common/MustRunMonkeyWarning.js b/monkey/monkey_island/cc/ui/src/components/report-components/common/MustRunMonkeyWarning.js index f1d23e302..bb3f49e2c 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/common/MustRunMonkeyWarning.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/common/MustRunMonkeyWarning.js @@ -1,5 +1,5 @@ -import React, {Component} from "react"; -import {NavLink} from "react-router-dom"; +import React, {Component} from 'react'; +import {NavLink} from 'react-router-dom'; export default class MustRunMonkeyWarning extends Component { render() { diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/common/PaginatedTable.js b/monkey/monkey_island/cc/ui/src/components/report-components/common/PaginatedTable.js index c5300f657..152faa624 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/common/PaginatedTable.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/common/PaginatedTable.js @@ -1,6 +1,6 @@ -import React, {Component} from "react"; -import ReactTable from "react-table"; -import * as PropTypes from "prop-types"; +import React, {Component} from 'react'; +import ReactTable from 'react-table'; +import * as PropTypes from 'prop-types'; class PaginatedTable extends Component { render() { @@ -31,5 +31,5 @@ export default PaginatedTable; PaginatedTable.propTypes = { data: PropTypes.array, columns: PropTypes.array, - pageSize: PropTypes.number, + pageSize: PropTypes.number }; diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/common/PrintReportButton.js b/monkey/monkey_island/cc/ui/src/components/report-components/common/PrintReportButton.js index 1a692bd68..6f6d2336a 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/common/PrintReportButton.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/common/PrintReportButton.js @@ -1,6 +1,6 @@ -import React, {Component} from "react"; -import {Button} from "react-bootstrap"; -import * as PropTypes from "prop-types"; +import React, {Component} from 'react'; +import {Button} from 'react-bootstrap'; +import * as PropTypes from 'prop-types'; export default class PrintReportButton extends Component { render() { diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/common/ReportHeader.js b/monkey/monkey_island/cc/ui/src/components/report-components/common/ReportHeader.js index 44d470f7e..264109bfd 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/common/ReportHeader.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/common/ReportHeader.js @@ -1,13 +1,13 @@ -import React, {Component} from "react"; -import {Col} from "react-bootstrap"; -import * as PropTypes from "prop-types"; +import React, {Component} from 'react'; +import {Col} from 'react-bootstrap'; +import * as PropTypes from 'prop-types'; let monkeyLogoImage = require('../../../images/monkey-icon.svg'); export const ReportTypes = { - zeroTrust: "Zero Trust", - security: "Security", - null: "" + zeroTrust: 'Zero Trust', + security: 'Security', + null: '' }; export class ReportHeader extends Component { @@ -41,5 +41,5 @@ export class ReportHeader extends Component { export default ReportHeader; ReportHeader.propTypes = { - report_type: PropTypes.string, + report_type: PropTypes.string }; diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/common/ReportLoader.js b/monkey/monkey_island/cc/ui/src/components/report-components/common/ReportLoader.js index e389f7532..6df87febc 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/common/ReportLoader.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/common/ReportLoader.js @@ -1,7 +1,7 @@ -import {css} from "@emotion/core"; -import React, {Component} from "react"; -import {GridLoader} from "react-spinners"; -import * as PropTypes from "prop-types"; +import {css} from '@emotion/core'; +import React, {Component} from 'react'; +import {GridLoader} from 'react-spinners'; +import * as PropTypes from 'prop-types'; const loading_css_override = css` display: block; @@ -16,7 +16,7 @@ export default class ReportLoader extends Component {

Generating Report...

- {renderArray(val.ip_addresses)} {(val.domain_name ? " (".concat(val.domain_name, ")") : "")}
; + return
{renderArray(val.ip_addresses)} {(val.domain_name ? ' ('.concat(val.domain_name, ')') : '')}
; }; const columns = [ diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/security/PostBreach.js b/monkey/monkey_island/cc/ui/src/components/report-components/security/PostBreach.js index ebbc473f8..b0fe5fa9e 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/security/PostBreach.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/security/PostBreach.js @@ -6,7 +6,7 @@ let renderArray = function (val) { }; let renderIpAddresses = function (val) { - return {renderArray(val.ip_addresses)} {(val.domain_name ? " (".concat(val.domain_name, ")") : "")} ; + return {renderArray(val.ip_addresses)} {(val.domain_name ? ' ('.concat(val.domain_name, ')') : '')} ; }; let renderMachine = function (data) { @@ -14,18 +14,18 @@ let renderMachine = function (data) { }; let renderPbaResults = function (results) { - let pbaClass = ""; + let pbaClass = ''; if (results[1]) { - pbaClass = "pba-success" + pbaClass = 'pba-success' } else { - pbaClass = "pba-danger" + pbaClass = 'pba-danger' } return
{results[0]}
}; const subColumns = [ - {id: 'pba_name', Header: "Name", accessor: x => x.name, style: {'whiteSpace': 'unset'}, width: 160}, - {id: 'pba_output', Header: "Output", accessor: x => renderPbaResults(x.result), style: {'whiteSpace': 'unset'}} + {id: 'pba_name', Header: 'Name', accessor: x => x.name, style: {'whiteSpace': 'unset'}, width: 160}, + {id: 'pba_output', Header: 'Output', accessor: x => renderPbaResults(x.result), style: {'whiteSpace': 'unset'}} ]; let renderDetails = function (data) { @@ -36,7 +36,7 @@ let renderDetails = function (data) { columns={subColumns} defaultPageSize={defaultPageSize} showPagination={showPagination} - style={{"backgroundColor": "#ededed"}} + style={{'backgroundColor': '#ededed'}} /> }; @@ -57,8 +57,8 @@ class PostBreachComponent extends React.Component { } render() { - let pbaMachines = this.props.data.filter(function (value, index, arr) { - return (value.pba_results !== "None" && value.pba_results.length > 0); + let pbaMachines = this.props.data.filter(function (value) { + return (value.pba_results !== 'None' && value.pba_results.length > 0); }); let defaultPageSize = pbaMachines.length > pageSize ? pageSize : pbaMachines.length; let showPagination = pbaMachines > pageSize; diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/security/ScannedServers.js b/monkey/monkey_island/cc/ui/src/components/report-components/security/ScannedServers.js index 585e6af37..7a4495da3 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/security/ScannedServers.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/security/ScannedServers.js @@ -6,7 +6,7 @@ let renderArray = function (val) { }; let renderIpAddresses = function (val) { - return
{renderArray(val.ip_addresses)} {(val.domain_name ? " (".concat(val.domain_name, ")") : "")}
; + return
{renderArray(val.ip_addresses)} {(val.domain_name ? ' ('.concat(val.domain_name, ')') : '')}
; }; const columns = [ diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsButton.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsButton.js index 49905531c..c8f68b12f 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsButton.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsButton.js @@ -1,7 +1,7 @@ -import React, {Component, Fragment} from "react"; -import EventsModal from "./EventsModal"; -import {Badge, Button} from "react-bootstrap"; -import * as PropTypes from "prop-types"; +import React, {Component, Fragment} from 'react'; +import EventsModal from './EventsModal'; +import {Badge, Button} from 'react-bootstrap'; +import * as PropTypes from 'prop-types'; export default class EventsButton extends Component { constructor(props) { @@ -23,7 +23,7 @@ export default class EventsButton extends Component { return -
+
@@ -32,12 +32,12 @@ export default class EventsButton extends Component { } createEventsAmountBadge() { - const eventsAmountBadgeContent = this.props.events.length > 9 ? "9+" : this.props.events.length; + const eventsAmountBadgeContent = this.props.events.length > 9 ? '9+' : this.props.events.length; return {eventsAmountBadgeContent}; } } EventsButton.propTypes = { events: PropTypes.array, - exportFilename: PropTypes.string, + exportFilename: PropTypes.string }; diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsModal.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsModal.js index 2f56c7a76..6ee69c717 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsModal.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsModal.js @@ -1,11 +1,11 @@ -import React, {Component} from "react"; -import {Badge, Modal} from "react-bootstrap"; -import EventsTimeline from "./EventsTimeline"; -import * as PropTypes from "prop-types"; -import saveJsonToFile from "../../utils/SaveJsonToFile"; -import EventsModalButtons from "./EventsModalButtons"; +import React, {Component} from 'react'; +import {Badge, Modal} from 'react-bootstrap'; +import EventsTimeline from './EventsTimeline'; +import * as PropTypes from 'prop-types'; +import saveJsonToFile from '../../utils/SaveJsonToFile'; +import EventsModalButtons from './EventsModalButtons'; import Pluralize from 'pluralize' -import {statusToLabelType} from "./StatusLabel"; +import {statusToLabelType} from './StatusLabel'; export default class EventsModal extends Component { constructor(props) { @@ -23,7 +23,7 @@ export default class EventsModal extends Component {

There {Pluralize('is', this.props.events.length)} {

{this.props.events.length}
} {Pluralize('event', this.props.events.length)} associated + className={'label label-primary'}>{this.props.events.length}
} {Pluralize('event', this.props.events.length)} associated with this finding.

{this.props.events.length > 5 ? this.renderButtons() : null} @@ -49,5 +49,5 @@ export default class EventsModal extends Component { EventsModal.propTypes = { showEvents: PropTypes.bool, events: PropTypes.array, - hideCallback: PropTypes.func, + hideCallback: PropTypes.func }; diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsModalButtons.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsModalButtons.js index 962c54893..1e6169ebb 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsModalButtons.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsModalButtons.js @@ -1,6 +1,6 @@ -import React, {Component} from "react"; -import ExportEventsButton from "./ExportEventsButton"; -import * as PropTypes from "prop-types"; +import React, {Component} from 'react'; +import ExportEventsButton from './ExportEventsButton'; +import * as PropTypes from 'prop-types'; export default class EventsModalButtons extends Component { render() { diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsTimeline.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsTimeline.js index e124b6659..04b10f333 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsTimeline.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsTimeline.js @@ -1,13 +1,13 @@ -import React, {Component} from "react"; -import {Timeline, TimelineEvent} from "react-event-timeline"; -import * as PropTypes from "prop-types"; +import React, {Component} from 'react'; +import {Timeline, TimelineEvent} from 'react-event-timeline'; +import * as PropTypes from 'prop-types'; let monkeyLocalIcon = require('../../../images/zerotrust/im-alert-machine-icon.svg'); let monkeyNetworkIcon = require('../../../images/zerotrust/im-alert-network-icon.svg'); const eventTypeToIcon = { - "monkey_local": monkeyLocalIcon, - "monkey_network": monkeyNetworkIcon, + 'monkey_local': monkeyLocalIcon, + 'monkey_network': monkeyNetworkIcon }; export default class EventsTimeline extends Component { diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/ExportEventsButton.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/ExportEventsButton.js index bb6fc6c45..4e49606e8 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/ExportEventsButton.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/ExportEventsButton.js @@ -1,6 +1,6 @@ -import React, {Component} from "react"; -import {Button} from "react-bootstrap"; -import * as PropTypes from "prop-types"; +import React, {Component} from 'react'; +import {Button} from 'react-bootstrap'; +import * as PropTypes from 'prop-types'; export default class ExportEventsButton extends Component { render() { diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/FindingsSection.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/FindingsSection.js index 95b9d0389..5ae25eb2b 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/FindingsSection.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/FindingsSection.js @@ -1,8 +1,8 @@ -import React, {Component, Fragment} from "react"; -import PillarLabel from "./PillarLabel"; -import EventsButton from "./EventsButton"; -import ZeroTrustPillars, {ZeroTrustStatuses} from "./ZeroTrustPillars"; -import {FindingsTable} from "./FindingsTable"; +import React, {Component, Fragment} from 'react'; +import PillarLabel from './PillarLabel'; +import EventsButton from './EventsButton'; +import ZeroTrustPillars, {ZeroTrustStatuses} from './ZeroTrustPillars'; +import {FindingsTable} from './FindingsTable'; class FindingsSection extends Component { diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/FindingsTable.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/FindingsTable.js index acff1df89..50a5c2914 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/FindingsTable.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/FindingsTable.js @@ -1,9 +1,9 @@ -import React, {Component, Fragment} from "react"; -import StatusLabel from "./StatusLabel"; -import PaginatedTable from "../common/PaginatedTable"; -import * as PropTypes from "prop-types"; -import PillarLabel from "./PillarLabel"; -import EventsButton from "./EventsButton"; +import React, {Component, Fragment} from 'react'; +import StatusLabel from './StatusLabel'; +import PaginatedTable from '../common/PaginatedTable'; +import * as PropTypes from 'prop-types'; +import PillarLabel from './PillarLabel'; +import EventsButton from './EventsButton'; const EVENTS_COLUMN_MAX_WIDTH = 160; const PILLARS_COLUMN_MAX_WIDTH = 200; @@ -16,25 +16,25 @@ const columns = [ }, { - Header: 'Events', id: "events", + Header: 'Events', id: 'events', accessor: x => { - return ; + return ; }, - maxWidth: EVENTS_COLUMN_MAX_WIDTH, + maxWidth: EVENTS_COLUMN_MAX_WIDTH }, { - Header: 'Pillars', id: "pillars", + Header: 'Pillars', id: 'pillars', accessor: x => { const pillars = x.pillars; const pillarLabels = pillars.map((pillar) => ); - return
{pillarLabels}
; + return
{pillarLabels}
; }, maxWidth: PILLARS_COLUMN_MAX_WIDTH, style: {'whiteSpace': 'unset'} - }, + } ] } ]; @@ -43,7 +43,7 @@ const columns = [ export class FindingsTable extends Component { render() { return -

{ +

{ } tests' findings

diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/PillarLabel.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/PillarLabel.js index 2eb839504..639933012 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/PillarLabel.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/PillarLabel.js @@ -1,20 +1,20 @@ -import React, {Component} from "react"; -import {statusToLabelType} from "./StatusLabel"; -import * as PropTypes from "prop-types"; +import React, {Component} from 'react'; +import {statusToLabelType} from './StatusLabel'; +import * as PropTypes from 'prop-types'; const pillarToIcon = { - "Data": "fa fa-database", - "People": "fa fa-user", - "Networks": "fa fa-wifi", - "Workloads": "fa fa-cloud", - "Devices": "fa fa-laptop", - "Visibility & Analytics": "fa fa-eye-slash", - "Automation & Orchestration": "fa fa-cogs", + 'Data': 'fa fa-database', + 'People': 'fa fa-user', + 'Networks': 'fa fa-wifi', + 'Workloads': 'fa fa-cloud', + 'Devices': 'fa fa-laptop', + 'Visibility & Analytics': 'fa fa-eye-slash', + 'Automation & Orchestration': 'fa fa-cogs' }; export default class PillarLabel extends Component { render() { - const className = "label " + statusToLabelType[this.props.status]; + const className = 'label ' + statusToLabelType[this.props.status]; return
{this.props.pillar}
} @@ -22,5 +22,5 @@ export default class PillarLabel extends Component { PillarLabel.propTypes = { status: PropTypes.string, - pillar: PropTypes.string, + pillar: PropTypes.string }; diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/PillarOverview.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/PillarOverview.js index 7cefcab61..0b33702f4 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/PillarOverview.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/PillarOverview.js @@ -1,6 +1,6 @@ -import React, {Component} from "react"; -import * as PropTypes from "prop-types"; -import ResponsiveVennDiagram from "./venn-components/ResponsiveVennDiagram"; +import React, {Component} from 'react'; +import * as PropTypes from 'prop-types'; +import ResponsiveVennDiagram from './venn-components/ResponsiveVennDiagram'; class PillarOverview extends Component { render() { @@ -13,5 +13,5 @@ class PillarOverview extends Component { export default PillarOverview; PillarOverview.propTypes = { - grades: PropTypes.array, + grades: PropTypes.array }; diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/PrinciplesSection.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/PrinciplesSection.js index bb957d42d..4632bd500 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/PrinciplesSection.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/PrinciplesSection.js @@ -1,6 +1,6 @@ -import React, {Component} from "react"; -import SinglePillarPrinciplesStatus from "./SinglePillarPrinciplesStatus"; -import * as PropTypes from "prop-types"; +import React, {Component} from 'react'; +import SinglePillarPrinciplesStatus from './SinglePillarPrinciplesStatus'; +import * as PropTypes from 'prop-types'; export default class PrinciplesSection extends Component { render() { diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/PrinciplesStatusTable.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/PrinciplesStatusTable.js index 6db2dfad3..a23b7e2be 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/PrinciplesStatusTable.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/PrinciplesStatusTable.js @@ -1,9 +1,9 @@ -import React, {Fragment} from "react"; -import PaginatedTable from "../common/PaginatedTable"; -import AuthComponent from "../../AuthComponent"; -import StatusLabel from "./StatusLabel"; -import * as PropTypes from "prop-types"; -import {ZeroTrustStatuses} from "./ZeroTrustPillars"; +import React, {Fragment} from 'react'; +import PaginatedTable from '../common/PaginatedTable'; +import AuthComponent from '../../AuthComponent'; +import StatusLabel from './StatusLabel'; +import * as PropTypes from 'prop-types'; +import {ZeroTrustStatuses} from './ZeroTrustPillars'; const MAX_WIDTH_STATUS_COLUMN = 80; diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/ReportLegend.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/ReportLegend.js index 0820fe3a6..f7eb8b9c8 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/ReportLegend.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/ReportLegend.js @@ -1,8 +1,8 @@ -import React, {Component} from "react"; -import StatusLabel from "./StatusLabel"; -import {ZeroTrustStatuses} from "./ZeroTrustPillars"; -import {NavLink} from "react-router-dom"; -import {Panel} from "react-bootstrap"; +import React, {Component} from 'react'; +import StatusLabel from './StatusLabel'; +import {ZeroTrustStatuses} from './ZeroTrustPillars'; +import {NavLink} from 'react-router-dom'; +import {Panel} from 'react-bootstrap'; class ZeroTrustReportLegend extends Component { @@ -27,31 +27,31 @@ class ZeroTrustReportLegend extends Component { getLegendContent() { return
-
    +
    • -
      +
      - {"\t"}At least one of the tests related to this component failed. This means that the Infection Monkey detected an + {'\t'}At least one of the tests related to this component failed. This means that the Infection Monkey detected an unmet Zero Trust requirement.
    • -
      +
      - {"\t"}At least one of the tests’ results related to this component requires further manual verification. + {'\t'}At least one of the tests’ results related to this component requires further manual verification.
    • -
      +
      - {"\t"}All Tests related to this pillar passed. No violation of a Zero Trust guiding principle was detected. + {'\t'}All Tests related to this pillar passed. No violation of a Zero Trust guiding principle was detected.
    • -
      +
      - {"\t"}This status means the test wasn't executed.To activate more tests, refer to the Monkey configuration page.
    diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/SinglePillarPrinciplesStatus.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/SinglePillarPrinciplesStatus.js index 8de7a4d21..fc1cc3f58 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/SinglePillarPrinciplesStatus.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/SinglePillarPrinciplesStatus.js @@ -1,9 +1,9 @@ -import AuthComponent from "../../AuthComponent"; -import PillarLabel from "./PillarLabel"; -import PrinciplesStatusTable from "./PrinciplesStatusTable"; -import React from "react"; -import * as PropTypes from "prop-types"; -import {Panel} from "react-bootstrap"; +import AuthComponent from '../../AuthComponent'; +import PillarLabel from './PillarLabel'; +import PrinciplesStatusTable from './PrinciplesStatusTable'; +import React from 'react'; +import * as PropTypes from 'prop-types'; +import {Panel} from 'react-bootstrap'; export default class SinglePillarPrinciplesStatus extends AuthComponent { render() { @@ -14,7 +14,7 @@ export default class SinglePillarPrinciplesStatus extends AuthComponent { -

    +

    @@ -33,5 +33,5 @@ export default class SinglePillarPrinciplesStatus extends AuthComponent { SinglePillarPrinciplesStatus.propTypes = { principlesStatus: PropTypes.array, - pillar: PropTypes.string, + pillar: PropTypes.string }; diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/StatusLabel.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/StatusLabel.js index 028ca7d89..f94c4e41a 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/StatusLabel.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/StatusLabel.js @@ -1,30 +1,30 @@ -import React, {Component} from "react"; -import * as PropTypes from "prop-types"; +import React, {Component} from 'react'; +import * as PropTypes from 'prop-types'; const statusToIcon = { - "Passed": "fa-check", - "Verify": "fa-exclamation-triangle", - "Failed": "fa-bomb", - "Unexecuted": "fa-question", + 'Passed': 'fa-check', + 'Verify': 'fa-exclamation-triangle', + 'Failed': 'fa-bomb', + 'Unexecuted': 'fa-question' }; export const statusToLabelType = { - "Passed": "label-success", - "Verify": "label-warning", - "Failed": "label-danger", - "Unexecuted": "label-default", + 'Passed': 'label-success', + 'Verify': 'label-warning', + 'Failed': 'label-danger', + 'Unexecuted': 'label-default' }; export default class StatusLabel extends Component { render() { - let text = ""; + let text = ''; if (this.props.showText) { - text = " " + this.props.status; + text = ' ' + this.props.status; } return ( -
    - {text} +
    + {text}
    ); } diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/StatusesToPillarsSummary.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/StatusesToPillarsSummary.js index 0002ba9e0..b33481b99 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/StatusesToPillarsSummary.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/StatusesToPillarsSummary.js @@ -1,8 +1,8 @@ -import React, {Component, Fragment} from "react"; -import PillarLabel from "./PillarLabel"; -import StatusLabel from "./StatusLabel"; -import * as PropTypes from "prop-types"; -import {ZeroTrustStatuses} from "./ZeroTrustPillars"; +import React, {Component, Fragment} from 'react'; +import PillarLabel from './PillarLabel'; +import StatusLabel from './StatusLabel'; +import * as PropTypes from 'prop-types'; +import {ZeroTrustStatuses} from './ZeroTrustPillars'; export default class StatusesToPillarsSummary extends Component { render() { diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/SummarySection.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/SummarySection.js index 0f937f341..b6693ab59 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/SummarySection.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/SummarySection.js @@ -1,9 +1,9 @@ -import React, {Component} from "react"; -import {Col, Grid, Row} from "react-bootstrap"; -import MonkeysStillAliveWarning from "../common/MonkeysStillAliveWarning"; -import PillarsOverview from "./PillarOverview"; -import ZeroTrustReportLegend from "./ReportLegend"; -import * as PropTypes from "prop-types"; +import React, {Component} from 'react'; +import {Col, Grid, Row} from 'react-bootstrap'; +import MonkeysStillAliveWarning from '../common/MonkeysStillAliveWarning'; +import PillarsOverview from './PillarOverview'; +import ZeroTrustReportLegend from './ReportLegend'; +import * as PropTypes from 'prop-types'; export default class SummarySection extends Component { render() { diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/ZeroTrustPillars.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/ZeroTrustPillars.js index dd2a55865..c0bb0c87e 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/ZeroTrustPillars.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/ZeroTrustPillars.js @@ -1,18 +1,18 @@ export const ZeroTrustPillars = { - data: "Data", - people: "People", - network: "Networks", - workload: "Workload", - devices: "Devices", - visibility: "Visibility & Analytics", - automation: "Automation & Orchestration" + data: 'Data', + people: 'People', + network: 'Networks', + workload: 'Workload', + devices: 'Devices', + visibility: 'Visibility & Analytics', + automation: 'Automation & Orchestration' }; export const ZeroTrustStatuses = { - failed: "Failed", - verify: "Verify", - passed: "Passed", - unexecuted: "Unexecuted" + failed: 'Failed', + verify: 'Verify', + passed: 'Passed', + unexecuted: 'Unexecuted' }; export default ZeroTrustPillars; diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/ArcNode.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/ArcNode.js index aee1fb7f2..938e23e88 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/ArcNode.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/ArcNode.js @@ -41,17 +41,17 @@ class ArcNode extends React.Component { } - handleClick(e_) { + handleClick() { this.props.disableHover(this.refs.overlay); } - handleOver(e_) { + handleOver() { if (this.props.hover) { this.refs.overlay.show(); } } - handleOut(e_) { + handleOut() { if (this.props.hover) { this.refs.overlay.hide(); } diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/CircularNode.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/CircularNode.js index 5c84d95a5..5c6ec3d7c 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/CircularNode.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/CircularNode.js @@ -1,5 +1,5 @@ import React from 'react' -import PillarLabel from "../PillarLabel"; +import PillarLabel from '../PillarLabel'; import {Popover, OverlayTrigger} from 'react-bootstrap'; import PropTypes from 'prop-types'; @@ -38,17 +38,17 @@ class CircularNode extends React.Component { } - handleClick(e_) { + handleClick() { this.props.disableHover(this.refs.overlay); } - handleOver(e_) { + handleOver() { if (this.props.hover) { this.refs.overlay.show(); } } - handleOut(e_) { + handleOut() { if (this.props.hover) { this.refs.overlay.hide(); } diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/VennDiagram.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/VennDiagram.js index 70304daad..a7fc698a0 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/VennDiagram.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/VennDiagram.js @@ -4,7 +4,7 @@ import CircularNode from './CircularNode' import ArcNode from './ArcNode' import {TypographicUtilities} from './Utility.js' import './VennDiagram.css' -import {ZeroTrustStatuses} from "../ZeroTrustPillars"; +import {ZeroTrustStatuses} from '../ZeroTrustPillars'; class VennDiagram extends React.Component { constructor(props_) { @@ -131,16 +131,12 @@ class VennDiagram extends React.Component { let self = this; - let hidden = 'none'; - let html = ''; - let bcolor = '#DEDEDE'; - if (this.state.currentPopover !== undefined) { this.state.currentPopover.show(); } - document.querySelectorAll('circle, path').forEach((d_, i_) => { - d_.setAttribute('opacity', "0.8"); + document.querySelectorAll('circle, path').forEach((d_) => { + d_.setAttribute('opacity', '0.8'); }); if (e.target.id.includes('Node')) { @@ -175,10 +171,9 @@ class VennDiagram extends React.Component { let data = []; const omit = (prop, {[prop]: _, ...rest}) => rest; - this.props.pillarsGrades.forEach((d_, i_) => { + this.props.pillarsGrades.forEach((d_) => { let params = omit('pillar', d_); - let sum = Object.keys(params).reduce((sum_, key_) => sum_ + parseFloat(params[key_] || 0), 0); let key = TypographicUtilities.removeAmpersand(d_.pillar); let html = self.buildTooltipHtmlContent(params); let rule = null; diff --git a/monkey/monkey_island/cc/ui/src/components/run-monkey/AwsRunTable.js b/monkey/monkey_island/cc/ui/src/components/run-monkey/AwsRunTable.js index f2815a142..ac9231d82 100644 --- a/monkey/monkey_island/cc/ui/src/components/run-monkey/AwsRunTable.js +++ b/monkey/monkey_island/cc/ui/src/components/run-monkey/AwsRunTable.js @@ -1,6 +1,6 @@ import React from 'react'; import ReactTable from 'react-table' -import checkboxHOC from "react-table/lib/hoc/selectTable"; +import checkboxHOC from 'react-table/lib/hoc/selectTable'; const CheckboxTable = checkboxHOC(ReactTable); @@ -28,7 +28,7 @@ class AwsRunTableComponent extends React.Component { } } - toggleSelection = (key, shift, row) => { + toggleSelection = (key) => { // start off with the existing state let selection = [...this.state.selection]; const keyIndex = selection.indexOf(key); @@ -68,13 +68,13 @@ class AwsRunTableComponent extends React.Component { }; getTrProps = (s, r) => { - let color = "inherit"; + let color = 'inherit'; if (r) { let instId = r.original.instance_id; if (this.isSelected(instId)) { - color = "#ffed9f"; + color = '#ffed9f'; } else if (this.state.result.hasOwnProperty(instId)) { - color = this.state.result[instId] ? "#00f01b" : '#f00000' + color = this.state.result[instId] ? '#00f01b' : '#f00000' } } diff --git a/monkey/monkey_island/cc/ui/src/components/side-menu/VersionComponent.js b/monkey/monkey_island/cc/ui/src/components/side-menu/VersionComponent.js index 1246b5b94..18d711a0f 100644 --- a/monkey/monkey_island/cc/ui/src/components/side-menu/VersionComponent.js +++ b/monkey/monkey_island/cc/ui/src/components/side-menu/VersionComponent.js @@ -18,7 +18,7 @@ class VersionComponent extends React.Component { this.setState({ currentVersion: res['current_version'], newerVersion: res['newer_version'], - downloadLink: res['download_link'], + downloadLink: res['download_link'] }); }); } diff --git a/monkey/monkey_island/cc/ui/src/components/ui-components/Checkbox.js b/monkey/monkey_island/cc/ui/src/components/ui-components/Checkbox.js index f200a6fdb..e143e0aba 100644 --- a/monkey/monkey_island/cc/ui/src/components/ui-components/Checkbox.js +++ b/monkey/monkey_island/cc/ui/src/components/ui-components/Checkbox.js @@ -34,7 +34,7 @@ class CheckboxComponent extends React.PureComponent { } this.setState({ checked: !this.state.checked, - isAnimating: true, + isAnimating: true }, () => { this.props.changeHandler ? this.props.changeHandler(this.props.name, this.state.checked) : null }); diff --git a/monkey/monkey_island/cc/ui/src/components/utils/SaveJsonToFile.js b/monkey/monkey_island/cc/ui/src/components/utils/SaveJsonToFile.js index 6ad124457..29940c63c 100644 --- a/monkey/monkey_island/cc/ui/src/components/utils/SaveJsonToFile.js +++ b/monkey/monkey_island/cc/ui/src/components/utils/SaveJsonToFile.js @@ -1,7 +1,7 @@ -import FileSaver from "file-saver"; +import FileSaver from 'file-saver'; export default function saveJsonToFile(dataToSave, filename) { const content = JSON.stringify(dataToSave, null, 2); - const blob = new Blob([content], {type: "text/plain;charset=utf-8"}); - FileSaver.saveAs(blob, filename + ".json"); + const blob = new Blob([content], {type: 'text/plain;charset=utf-8'}); + FileSaver.saveAs(blob, filename + '.json'); } diff --git a/monkey/monkey_island/cc/ui/src/server_config/ServerConfig.js b/monkey/monkey_island/cc/ui/src/server_config/ServerConfig.js index c71cc4d94..bd71817e1 100644 --- a/monkey/monkey_island/cc/ui/src/server_config/ServerConfig.js +++ b/monkey/monkey_island/cc/ui/src/server_config/ServerConfig.js @@ -1,6 +1,6 @@ import StandardConfig from './StandardConfig'; import AwsConfig from './AwsConfig'; -import PasswordConfig from "./PasswordConfig"; +import PasswordConfig from './PasswordConfig'; const SERVER_CONFIG_JSON = require('../../../server_config.json'); diff --git a/monkey/monkey_island/cc/ui/src/services/AuthService.js b/monkey/monkey_island/cc/ui/src/services/AuthService.js index c26979afe..6163e95cd 100644 --- a/monkey/monkey_island/cc/ui/src/services/AuthService.js +++ b/monkey/monkey_island/cc/ui/src/services/AuthService.js @@ -4,8 +4,8 @@ import decode from 'jwt-decode'; export default class AuthService { // SHA3-512 of '1234567890!@#$%^&*()_nothing_up_my_sleeve_1234567890!@#$%^&*()' NO_AUTH_CREDS = - "55e97c9dcfd22b8079189ddaeea9bce8125887e3237b800c6176c9afa80d2062" + - "8d2c8d0b1538d2208c1444ac66535b764a3d902b35e751df3faec1e477ed3557"; + '55e97c9dcfd22b8079189ddaeea9bce8125887e3237b800c6176c9afa80d2062' + + '8d2c8d0b1538d2208c1444ac66535b764a3d902b35e751df3faec1e477ed3557'; SECONDS_BEFORE_JWT_EXPIRES = 20; From 0a019daf9ae28d12648d7f27b8fc5422790394ba Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Sun, 10 Nov 2019 15:52:03 +0200 Subject: [PATCH 11/13] Make favicon work --- monkey/monkey_island/cc/ui/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/monkey/monkey_island/cc/ui/package.json b/monkey/monkey_island/cc/ui/package.json index 442e6a0d3..b29fe2713 100644 --- a/monkey/monkey_island/cc/ui/package.json +++ b/monkey/monkey_island/cc/ui/package.json @@ -5,8 +5,8 @@ "scripts": { "clean": "rimraf dist/*", "copy": "copyfiles -f ./src/index.html ./src/favicon.ico ./dist", - "dist": "webpack --mode production", - "dev": "webpack --mode development", + "dist": "webpack --mode production && copyfiles -f ./src/favicon.ico ./dist", + "dev": "webpack --mode development && copyfiles -f ./src/favicon.ico ./dist", "lint": "eslint ./src", "posttest": "npm run lint", "release:major": "npm version major && npm publish && git push --follow-tags", @@ -14,7 +14,7 @@ "release:patch": "npm version patch && npm publish && git push --follow-tags", "serve": "node server.js --env=dev", "serve:dist": "node server.js --env=dist", - "start": "webpack-dev-server --mode development --open --history-api-fallback --port 8000", + "start": "webpack-dev-server --verbose --mode development --open --history-api-fallback --port 8000", "test": "karma start", "test:watch": "karma start --autoWatch=true --singleRun=false" }, From 93a270f5c784acf7ccb7e7cd38b4876241155dc9 Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Sun, 10 Nov 2019 15:57:57 +0200 Subject: [PATCH 12/13] Removed unused imports --- .../cc/ui/src/components/map/preview-pane/PthPreviewPane.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/map/preview-pane/PthPreviewPane.js b/monkey/monkey_island/cc/ui/src/components/map/preview-pane/PthPreviewPane.js index f9a5ae1bb..a5ffa3020 100644 --- a/monkey/monkey_island/cc/ui/src/components/map/preview-pane/PthPreviewPane.js +++ b/monkey/monkey_island/cc/ui/src/components/map/preview-pane/PthPreviewPane.js @@ -1,8 +1,4 @@ import React from 'react'; -import {Icon} from 'react-fa'; -import Toggle from 'react-toggle'; -import {OverlayTrigger, Tooltip} from 'react-bootstrap'; -import download from 'downloadjs' import PreviewPaneComponent from 'components/map/preview-pane/PreviewPane'; class PthPreviewPaneComponent extends PreviewPaneComponent { From ad8be355a12e6168b8a0f629ab931906b2226e49 Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Sun, 10 Nov 2019 15:58:30 +0200 Subject: [PATCH 13/13] Update travis upper limit for JS from 500 to 30 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d6148ec39..34f49efe0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,7 +48,7 @@ script: - cd - - cd monkey_island/cc/ui - eslint ./src --quiet -- JS_WARNINGS_AMOUNT_UPPER_LIMIT=497 +- JS_WARNINGS_AMOUNT_UPPER_LIMIT=29 - eslint ./src --max-warnings $JS_WARNINGS_AMOUNT_UPPER_LIMIT notifications: