forked from p34709852/monkey
Small fixes - reversed condition accidentaly and missed one reference to get_windows_commands_to_add_user
This commit is contained in:
parent
db328a3432
commit
0667aad87f
|
@ -45,7 +45,7 @@ class CommunicateAsNewUser(PBA):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_random_new_user_name():
|
def get_random_new_user_name():
|
||||||
return USERNAME + "_" + ''.join(random.choice(string.ascii_lowercase) for _ in range(5))
|
return USERNAME + ''.join(random.choice(string.ascii_lowercase) for _ in range(5))
|
||||||
|
|
||||||
def communicate_as_new_user_linux(self, username):
|
def communicate_as_new_user_linux(self, username):
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -2,7 +2,7 @@ import logging
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from infection_monkey.post_breach.actions.add_user import BackdoorUser
|
from infection_monkey.post_breach.actions.add_user import BackdoorUser
|
||||||
from infection_monkey.utils.windows.users import get_windows_commands_to_delete_user
|
from infection_monkey.utils.windows.users import get_windows_commands_to_delete_user, get_windows_commands_to_add_user
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class AutoNewUser(object):
|
||||||
self.username = username
|
self.username = username
|
||||||
self.password = password
|
self.password = password
|
||||||
|
|
||||||
windows_cmds = BackdoorUser.get_windows_commands_to_add_user(self.username, self.password, True)
|
windows_cmds = get_windows_commands_to_add_user(self.username, self.password, True)
|
||||||
_ = subprocess.check_output(windows_cmds, stderr=subprocess.STDOUT, shell=True)
|
_ = subprocess.check_output(windows_cmds, stderr=subprocess.STDOUT, shell=True)
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
|
|
|
@ -11,7 +11,8 @@ COMM_AS_NEW_USER_SUCCEEDED_FORMAT = \
|
||||||
def test_new_user_communication(current_monkey, success, message):
|
def test_new_user_communication(current_monkey, success, message):
|
||||||
AggregateFinding.create_or_add_to_existing(
|
AggregateFinding.create_or_add_to_existing(
|
||||||
test=TEST_COMMUNICATE_AS_NEW_USER,
|
test=TEST_COMMUNICATE_AS_NEW_USER,
|
||||||
status=STATUS_PASSED if success else STATUS_FAILED,
|
# If the monkey succeeded to create a user, then the test failed.
|
||||||
|
status=STATUS_FAILED if success else STATUS_PASSED,
|
||||||
events=[
|
events=[
|
||||||
get_attempt_event(current_monkey),
|
get_attempt_event(current_monkey),
|
||||||
get_result_event(current_monkey, message, success)
|
get_result_event(current_monkey, message, success)
|
||||||
|
|
Loading…
Reference in New Issue