UT: Move PROPAGATION_CREDENTIALS into data_for_tests

This commit is contained in:
Mike Salvatore 2022-07-11 14:10:42 -04:00
parent aaf1009504
commit 1af21b372c
5 changed files with 33 additions and 26 deletions

View File

@ -0,0 +1,18 @@
from common.credentials import Credentials, LMHash, NTHash, Password, Username
username = "m0nk3y_user"
special_username = "m0nk3y.user"
nt_hash = "C1C58F96CDF212B50837BC11A00BE47C"
lm_hash = "299BD128C1101FD6299BD128C1101FD6"
password_1 = "trytostealthis"
password_2 = "password"
password_3 = "12345678"
PROPAGATION_CREDENTIALS_1 = Credentials(
identities=(Username(username),),
secrets=(NTHash(nt_hash), LMHash(lm_hash), Password(password_1)),
)
PROPAGATION_CREDENTIALS_2 = Credentials(
identities=(Username(username), Username(special_username)),
secrets=(Password(password_1), Password(password_2), Password(password_3)),
)

View File

@ -4,7 +4,4 @@ from .open_error_file_repository import OpenErrorFileRepository
from .in_memory_agent_configuration_repository import InMemoryAgentConfigurationRepository
from .in_memory_simulation_configuration import InMemorySimulationRepository
from .stub_propagation_credentials_repository import StubPropagationCredentialsRepository
from .stub_propagation_credentials_repository import (
PROPAGATION_CREDENTIALS_1,
PROPAGATION_CREDENTIALS_2,
)
from .in_memory_credentials_repository import InMemoryCredentialsRepository

View File

@ -1,23 +1,12 @@
from typing import Sequence
from common.credentials import Credentials, LMHash, NTHash, Password, Username
from monkey_island.cc.repository import ICredentialsRepository
from tests.data_for_tests.propagation_credentials import (
PROPAGATION_CREDENTIALS_1,
PROPAGATION_CREDENTIALS_2,
)
fake_username = "m0nk3y_user"
fake_special_username = "m0nk3y.user"
fake_nt_hash = "C1C58F96CDF212B50837BC11A00BE47C"
fake_lm_hash = "299BD128C1101FD6299BD128C1101FD6"
fake_password_1 = "trytostealthis"
fake_password_2 = "password"
fake_password_3 = "12345678"
PROPAGATION_CREDENTIALS_1 = Credentials(
identities=(Username(fake_username),),
secrets=(NTHash(fake_nt_hash), LMHash(fake_lm_hash), Password(fake_password_1)),
)
PROPAGATION_CREDENTIALS_2 = Credentials(
identities=(Username(fake_username), Username(fake_special_username)),
secrets=(Password(fake_password_1), Password(fake_password_2), Password(fake_password_3)),
)
from common.credentials import Credentials
from monkey_island.cc.repository import ICredentialsRepository
class StubPropagationCredentialsRepository(ICredentialsRepository):

View File

@ -1,14 +1,14 @@
import json
from tests.monkey_island import PROPAGATION_CREDENTIALS_1, PROPAGATION_CREDENTIALS_2
from tests.data_for_tests.propagation_credentials import (
PROPAGATION_CREDENTIALS_1,
PROPAGATION_CREDENTIALS_2,
)
from tests.unit_tests.monkey_island.conftest import get_url_for_resource
from monkey_island.cc.resources.credentials.configured_propagation_credentials import (
ConfiguredPropagationCredentials,
)
from monkey_island.cc.resources.credentials.stolen_propagation_credentials import (
StolenPropagationCredentials,
)
def test_configured_propagation_credentials_endpoint_get(flask_client):

View File

@ -1,6 +1,9 @@
import json
from tests.monkey_island import PROPAGATION_CREDENTIALS_1, PROPAGATION_CREDENTIALS_2
from tests.data_for_tests.propagation_credentials import (
PROPAGATION_CREDENTIALS_1,
PROPAGATION_CREDENTIALS_2,
)
from tests.unit_tests.monkey_island.conftest import get_url_for_resource
from monkey_island.cc.resources.credentials.stolen_propagation_credentials import (