Commit Graph

5504 Commits

Author SHA1 Message Date
Mike Salvatore a8570987a6 island: Find MONKEY_ISLAND_ABS_PATH by __file__ instead of os.getcwd()
We can't be sure what $PWD is when Monkey Island is started.
2021-06-03 10:57:23 -04:00
Mike Salvatore 184594f509 island: Refactor setup/start logic separate concerns
Most configuration/setup logic is removed from monkey_island.py. The
only responsibility of startup.py is now to setup a default
failsafe logger and call run_monkey_island().

setup_island() has been renamed to run_monkey_island(), since that's
what it does. Some of the logic used to setup/configure/initialize
monkey island has been wrapped in different functions with specific
responsibilities.

setup_mongodb() has been renamed to start_mongodb(), since that's what
it does.
2021-06-03 10:57:23 -04:00
Mike Salvatore 5e78666f91 island: Add function to setup default failsafe logger 2021-06-03 10:57:23 -04:00
Mike Salvatore 583115c419 island: Reset logger handlers after each test
The root logger does not get reset for each test that is run. Add an
autouse fixture that resets the logger handlers after each test run so
that handlers do not accumulate in the root logger.
2021-06-03 10:57:23 -04:00
Mike Salvatore 14b68580f8 island: Configure loggin in python code instead of JSON 2021-06-03 10:57:23 -04:00
VakarisZ cc00b85edc Refactored monkey island startup files to the old structure which was compatible with our build scripts. 2021-06-03 10:56:46 -04:00
VakarisZ 53bb6f7879 Added changes of configuration encryption/decryption to CHANGELOG.md 2021-06-03 17:07:10 +03:00
VakarisZ 2f9c6bf035 Improved readability in configuration_import.py by removing unused variables and extracting methods. 2021-06-03 17:02:14 +03:00
VakarisZ c25ea0edf8 Fixed bugs in config import backend (related to json parsing and stringifying) and front end (unsafe import warning overlay) 2021-06-03 17:02:14 +03:00
VakarisZ b407094a2f Reworded the text of UnsafeOptionsConfirmationModal to specify that it's about configuration and renamed it to UnsafeConfigOptionsConfirmationModal 2021-06-03 17:02:14 +03:00
VakarisZ fc1f12c24d Implemented safety check on import. 2021-06-03 17:02:12 +03:00
VakarisZ 500f270aa9 Fixed, improved and tested configuration import and export. 2021-06-03 17:01:59 +03:00
VakarisZ 8b86e40259 Improved configuration export and fixed the bug of modal not closing on export. 2021-06-03 17:01:59 +03:00
VakarisZ 624fda10cb Renamed configuration import resource endpoint(url) and resource itself. 2021-06-03 17:01:59 +03:00
VakarisZ 51273c4a9d Removed unused exception 2021-06-03 17:01:58 +03:00
VakarisZ 9fcfaac781 Improved exceptions thrown in configuration decryption and unit tests. 2021-06-03 17:01:56 +03:00
VakarisZ 321dd2c55e Improved configuration export related code by making it cleaner/more trivial 2021-06-03 17:01:27 +03:00
Shreya 295cacaffc Add unit tests for config_encryption.py 2021-06-03 17:01:27 +03:00
VakarisZ a94047d778 Fixed configuration encryption/decryption to use b64 encoding 2021-06-03 17:01:27 +03:00
Shreya 7153b91c10 Use buffer size directly from pyAesCrypt 2021-06-03 17:01:27 +03:00
Shreya b9fb4c6902 Add exception handling for config decryption 2021-06-03 17:01:27 +03:00
Shreya d67e84a6a7 Make sure (1) config is updated before exporting; (2) plaintext config is exported correctly 2021-06-03 17:01:27 +03:00
Shreya f4b5d341cf Finish up hooking frontend and backend for export config 2021-06-03 17:01:27 +03:00
VakarisZ 46408e6d32 Implemented export byte saving to file 2021-06-03 17:01:27 +03:00
Shreya 308ae3e169 Link config encryption backend logic with frontend (partially) 2021-06-03 17:01:27 +03:00
Shreya 495eb4c6a3 Modify config encryption logic: don't save the file in the backend, just encrypt it and send it back to the frontend 2021-06-03 17:01:26 +03:00
Shreya 338404799e Add initial implementation of encrypting config and saving it on export 2021-06-03 17:01:26 +03:00
VakarisZ 7954dbe1e7 Fixed and improved the wording in configuration export and import modals. 2021-06-03 17:01:26 +03:00
VakarisZ 5ab0137f27 Improved a mock endpoint for testing import configuration modal 2021-06-03 17:01:26 +03:00
VakarisZ ff7760f202 Altered ConfigurePage.js to use import modal 2021-06-03 17:01:26 +03:00
VakarisZ 556d0828ef Added import config modal. 2021-06-03 17:01:26 +03:00
VakarisZ 691dfee4f8 Added an upload status icon (checkmark if successful, red x if error) 2021-06-03 17:01:26 +03:00
VakarisZ 34024794c8 Implemented the skeleton of import config modal 2021-06-03 17:01:26 +03:00
VakarisZ 6e2da3c4a5 Sketched out the infrastructure of configuration import modal window 2021-06-03 17:01:26 +03:00
VakarisZ e6bb48100e
Merge pull request #1190 from guardicore/vulture-skip-unit-tests
Configure Vulture to skip tests/unit_tests/
2021-06-03 09:35:22 +03:00
Shreya 52b57a7166 Have Vulture skip tests/ instead of tests/unit_tests/ 2021-06-03 11:57:44 +05:30
Shreya b69c1c531a Rename vulture_whitelist.py -> vultue_allowlist.py 2021-06-02 13:08:37 +05:30
Shreya 55ed8d28d0 Rearranged unused code in Vulture whitelist according to categories 2021-06-02 13:05:21 +05:30
Mike Salvatore 4e6bb21942
Merge pull request #1191 from guardicore/test-data-dir-expand-user-env
Test data dir expand user env
2021-06-01 04:22:43 -04:00
Mike Salvatore 09e7deb936 island: Use os.path.join when creating test config contents dict 2021-06-01 03:59:07 -04:00
Mike Salvatore 2cd665ff11 island: Refactor duplicate code in IslandConfigOptions data_dir tests 2021-06-01 03:46:28 -04:00
Mike Salvatore c761dba030 island: Expand environment variables in data_dir 2021-06-01 03:35:33 -04:00
Mike Salvatore 0ab20d558b island: Add unit test to verify '~' expanded in data_dir 2021-06-01 03:33:34 -04:00
Shreya 995eaa0f3f Add more detailed comment in vulture_whitelist.py 2021-05-28 19:42:23 +05:30
Shreya 954ad64255 Rename whitelist.py to vulture_whitelist.py 2021-05-28 19:39:24 +05:30
Shreya c165b0e4ea Since tests/unit_tests/ is now skipped by Vulture, add code used only by tests to whitelist
Add the code which exists in common/, monkey_island/, or infection_monkey/,
but is used in tests/unit_tests/, to the whitelist file.
2021-05-28 19:35:33 +05:30
Shreya 0c323929a2 Configure Vulture to ignore directory: tests/unit_tests/ 2021-05-28 19:31:32 +05:30
Shreya Malviya f3fccb3e06
Merge pull request #1188 from guardicore/mongodb_connection_setup_refactoring
Mongodb connection setup refactoring
2021-05-28 16:07:28 +05:30
VakarisZ eae63bd3c6 Deleted empty test file, removed irrelevant comments and moved import to the top in monkey_island.py 2021-05-28 13:26:13 +03:00
VakarisZ badcd0e87c
Merge pull request #1189 from guardicore/config_export_popup
Config export modal
2021-05-28 13:13:42 +03:00