From 51cb4061235167f8423e53b1b3f5d99be118cc75 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Fri, 12 Nov 2021 13:50:32 +0100 Subject: [PATCH 1/4] Agent: Always self delete monkey on cleanup --- monkey/infection_monkey/config.py | 3 --- monkey/infection_monkey/example.conf | 1 - monkey/infection_monkey/monkey.py | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/monkey/infection_monkey/config.py b/monkey/infection_monkey/config.py index ac7084bd3..117875bb4 100644 --- a/monkey/infection_monkey/config.py +++ b/monkey/infection_monkey/config.py @@ -101,9 +101,6 @@ class Configuration(object): # sets whether or not the monkey is alive. if false will stop scanning and exploiting alive = True - # sets whether or not to self delete the monkey executable when stopped - self_delete_in_cleanup = False - # string of the mutex name for single instance singleton_mutex_name = "{2384ec59-0df8-4ab9-918c-843740924a28}" diff --git a/monkey/infection_monkey/example.conf b/monkey/infection_monkey/example.conf index aab1a2a5d..1d3e3235c 100644 --- a/monkey/infection_monkey/example.conf +++ b/monkey/infection_monkey/example.conf @@ -57,7 +57,6 @@ "smb_service_name": "InfectionMonkey", "retry_failed_explotation": true, "self_delete_in_cleanup": true, - "serialize_config": false, "singleton_mutex_name": "{2384ec59-0df8-4ab9-918c-843740924a28}", "skip_exploit_if_file_exist": false, "exploit_user_list": [], diff --git a/monkey/infection_monkey/monkey.py b/monkey/infection_monkey/monkey.py index fdb945978..cc9045408 100644 --- a/monkey/infection_monkey/monkey.py +++ b/monkey/infection_monkey/monkey.py @@ -343,7 +343,7 @@ class InfectionMonkey(object): status = ScanStatus.USED if remove_monkey_dir() else ScanStatus.SCANNED T1107Telem(status, get_monkey_dir_path()).send() - if WormConfiguration.self_delete_in_cleanup and -1 == sys.executable.find("python"): + if -1 == sys.executable.find("python"): try: status = None if "win32" == sys.platform: From 5030ea62662c228038acbeab55900a74b90a27ba Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Fri, 12 Nov 2021 13:51:17 +0100 Subject: [PATCH 2/4] Island: Remove checkbox for self deleting on cleanup --- monkey/monkey_island/cc/services/config_schema/internal.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/monkey/monkey_island/cc/services/config_schema/internal.py b/monkey/monkey_island/cc/services/config_schema/internal.py index 023944be2..46b2e7ca3 100644 --- a/monkey/monkey_island/cc/services/config_schema/internal.py +++ b/monkey/monkey_island/cc/services/config_schema/internal.py @@ -60,12 +60,6 @@ INTERNAL = { "monkey propagating to " "a high number of machines", }, - "self_delete_in_cleanup": { - "title": "Self delete on cleanup", - "type": "boolean", - "default": True, - "description": "Should the monkey delete its executable when going down", - }, "use_file_logging": { "title": "Use file logging", "type": "boolean", From 0f2a86d672eead88a9133bea52e3a8e6ecc5fd49 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Fri, 12 Nov 2021 13:53:00 +0100 Subject: [PATCH 3/4] Changelog: Remove checkbox for self deleting a monkey on cleanup --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48ffd9d30..1125ed0fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ Changelog](https://keepachangelog.com/en/1.0.0/). - "Kill file" option in the config. #1536 - Netstat collector, because network connection information wasn't used anywhere. #1535 - Checkbox to disable/enable sending log to server. #1537 +- Checkbox for self deleting a monkey agent on cleanup. #1537 ### Fixed - A bug in network map page that caused delay of telemetry log loading. #1545 From 43677d8edcc508250a55617703a3269b8adc6eca Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Fri, 12 Nov 2021 15:08:51 +0100 Subject: [PATCH 4/4] UT: Remove self delete on cleanup --- .../data_for_tests/monkey_configs/monkey_config_standard.json | 1 - 1 file changed, 1 deletion(-) diff --git a/monkey/tests/data_for_tests/monkey_configs/monkey_config_standard.json b/monkey/tests/data_for_tests/monkey_configs/monkey_config_standard.json index a43c54841..e5c350531 100644 --- a/monkey/tests/data_for_tests/monkey_configs/monkey_config_standard.json +++ b/monkey/tests/data_for_tests/monkey_configs/monkey_config_standard.json @@ -52,7 +52,6 @@ "monkey": { "victims_max_find": 100, "victims_max_exploit": 100, - "self_delete_in_cleanup": true, "use_file_logging": true, "serialize_config": false, "alive": true,