From 7aa230e9d0639591a8f83bd16eac772ed7717976 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Mon, 30 Aug 2021 14:18:03 +0200 Subject: [PATCH] UT: Renamed Communicate as new user --- .../test_communicate_as_backdoor_user.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/monkey/tests/unit_tests/infection_monkey/post_breach/actions/test_communicate_as_backdoor_user.py b/monkey/tests/unit_tests/infection_monkey/post_breach/actions/test_communicate_as_backdoor_user.py index 2a1bf8f49..6213506bb 100644 --- a/monkey/tests/unit_tests/infection_monkey/post_breach/actions/test_communicate_as_backdoor_user.py +++ b/monkey/tests/unit_tests/infection_monkey/post_breach/actions/test_communicate_as_backdoor_user.py @@ -1,38 +1,39 @@ -from infection_monkey.post_breach.actions.communicate_as_new_user import ( +from infection_monkey.post_breach.actions.communicate_as_backdoor_user import ( USERNAME_PREFIX, - CommunicateAsNewUser, + CommunicateAsBackdoorUser, ) URL = "this-is-where-i-wanna-go" def test_get_random_new_user_name(): - username = CommunicateAsNewUser.get_random_new_user_name() + username = CommunicateAsBackdoorUser.get_random_new_user_name() assert len(username) == len(USERNAME_PREFIX) + 5 assert username.islower() assert username.startswith(USERNAME_PREFIX) def test_get_commandline_for_http_request_windows(): - cmd_line = CommunicateAsNewUser.get_commandline_for_http_request(URL, is_windows=True) + cmd_line = CommunicateAsBackdoorUser.get_commandline_for_http_request(URL, is_windows=True) assert "powershell.exe" in cmd_line assert URL in cmd_line def test_get_commandline_for_http_request_linux_curl(monkeypatch): monkeypatch.setattr( - "infection_monkey.post_breach.actions.communicate_as_new_user.shutil.which", + "infection_monkey.post_breach.actions.communicate_as_backdoor_user.shutil.which", lambda _: "not None", ) - cmd_line = CommunicateAsNewUser.get_commandline_for_http_request(URL, is_windows=False) + cmd_line = CommunicateAsBackdoorUser.get_commandline_for_http_request(URL, is_windows=False) assert "curl" in cmd_line assert URL in cmd_line def test_get_commandline_for_http_request_linux_wget(monkeypatch): monkeypatch.setattr( - "infection_monkey.post_breach.actions.communicate_as_new_user.shutil.which", lambda _: None + "infection_monkey.post_breach.actions.communicate_as_backdoor_user.shutil.which", + lambda _: None, ) - cmd_line = CommunicateAsNewUser.get_commandline_for_http_request(URL, is_windows=False) + cmd_line = CommunicateAsBackdoorUser.get_commandline_for_http_request(URL, is_windows=False) assert "wget" in cmd_line assert URL in cmd_line