Agent: Make _add_random_suffix method code more concise

This commit is contained in:
vakaris_zilius 2022-03-23 13:33:26 +00:00
parent 2e6b361a9d
commit efb0039e34
1 changed files with 2 additions and 4 deletions

View File

@ -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)