From efb0039e3405917523ddef3082d08706dfb6e944 Mon Sep 17 00:00:00 2001 From: vakaris_zilius Date: Wed, 23 Mar 2022 13:33:26 +0000 Subject: [PATCH] Agent: Make _add_random_suffix method code more concise --- monkey/infection_monkey/exploit/tools/helpers.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/monkey/infection_monkey/exploit/tools/helpers.py b/monkey/infection_monkey/exploit/tools/helpers.py index 5e9406160..87f5636eb 100644 --- a/monkey/infection_monkey/exploit/tools/helpers.py +++ b/monkey/infection_monkey/exploit/tools/helpers.py @@ -31,8 +31,6 @@ def get_agent_dest_path(host: VictimHost, options: Mapping[str, Any]) -> Path: # Useful to avoid duplicate file paths def _add_random_suffix(path: Path) -> Path: stem = path.name.split(".")[0] - suffixes = path.suffixes stem = f"{stem}-{get_random_file_suffix()}" - rand_filename = "".join([stem, *suffixes]) - path = path.with_name(rand_filename) - return path + rand_filename = "".join([stem, *path.suffixes]) + return path.with_name(rand_filename)