Merge pull request #2247 from guardicore/2217-fix-bb-tests

2217 fix bb tests
This commit is contained in:
Mike Salvatore 2022-09-06 10:14:37 -04:00 committed by GitHub
commit a74266464b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 10 deletions

View File

@ -1,3 +1,5 @@
from typing import Tuple
from common.agent_configuration import ( from common.agent_configuration import (
AgentConfiguration, AgentConfiguration,
CustomPBAConfiguration, CustomPBAConfiguration,
@ -9,6 +11,7 @@ from common.agent_configuration import (
ScanTargetConfiguration, ScanTargetConfiguration,
TCPScanConfiguration, TCPScanConfiguration,
) )
from common.credentials import Credentials
from . import TestConfiguration from . import TestConfiguration
@ -47,9 +50,9 @@ _agent_configuration = AgentConfiguration(
payloads=[], payloads=[],
propagation=_propagation_configuration, propagation=_propagation_configuration,
) )
_propagation_credentials = tuple() _propagation_credentials: Tuple[Credentials, ...] = tuple()
# This is an empty, NOOP configuration from which other configurations can be built # This is an empty, NOOP configuration from which other configurations can be built
noop_test_configuration = TestConfiguration( noop_test_configuration: TestConfiguration = TestConfiguration(
agent_configuration=_agent_configuration, propagation_credentials=_propagation_credentials agent_configuration=_agent_configuration, propagation_credentials=_propagation_credentials
) )

View File

@ -11,7 +11,7 @@ def add_exploiters(
vulnerability: Sequence[PluginConfiguration] = [], vulnerability: Sequence[PluginConfiguration] = [],
) -> AgentConfiguration: ) -> AgentConfiguration:
agent_configuration_copy = agent_configuration.copy() agent_configuration_copy = agent_configuration.copy(deep=True)
agent_configuration_copy.propagation.exploitation.brute_force = brute_force agent_configuration_copy.propagation.exploitation.brute_force = brute_force
agent_configuration_copy.propagation.exploitation.vulnerability = vulnerability agent_configuration_copy.propagation.exploitation.vulnerability = vulnerability
@ -22,7 +22,7 @@ def add_fingerprinters(
agent_configuration: AgentConfiguration, fingerprinters: Sequence[PluginConfiguration] agent_configuration: AgentConfiguration, fingerprinters: Sequence[PluginConfiguration]
) -> AgentConfiguration: ) -> AgentConfiguration:
agent_configuration_copy = agent_configuration.copy() agent_configuration_copy = agent_configuration.copy(deep=True)
agent_configuration_copy.propagation.network_scan.fingerprinters = fingerprinters agent_configuration_copy.propagation.network_scan.fingerprinters = fingerprinters
return agent_configuration_copy return agent_configuration_copy
@ -32,7 +32,7 @@ def add_tcp_ports(
agent_configuration: AgentConfiguration, tcp_ports: Sequence[int] agent_configuration: AgentConfiguration, tcp_ports: Sequence[int]
) -> AgentConfiguration: ) -> AgentConfiguration:
agent_configuration_copy = agent_configuration.copy() agent_configuration_copy = agent_configuration.copy(deep=True)
agent_configuration_copy.propagation.network_scan.tcp.ports = tuple(tcp_ports) agent_configuration_copy.propagation.network_scan.tcp.ports = tuple(tcp_ports)
return agent_configuration_copy return agent_configuration_copy
@ -42,7 +42,7 @@ def add_subnets(
agent_configuration: AgentConfiguration, subnets: Sequence[str] agent_configuration: AgentConfiguration, subnets: Sequence[str]
) -> AgentConfiguration: ) -> AgentConfiguration:
agent_configuration_copy = agent_configuration.copy() agent_configuration_copy = agent_configuration.copy(deep=True)
agent_configuration_copy.propagation.network_scan.targets.subnets = subnets agent_configuration_copy.propagation.network_scan.targets.subnets = subnets
return agent_configuration_copy return agent_configuration_copy
@ -52,7 +52,7 @@ def add_credential_collectors(
agent_configuration: AgentConfiguration, credential_collectors: Sequence[PluginConfiguration] agent_configuration: AgentConfiguration, credential_collectors: Sequence[PluginConfiguration]
) -> AgentConfiguration: ) -> AgentConfiguration:
agent_configuration_copy = agent_configuration.copy() agent_configuration_copy = agent_configuration.copy(deep=True)
agent_configuration_copy.credential_collectors = tuple(credential_collectors) agent_configuration_copy.credential_collectors = tuple(credential_collectors)
return agent_configuration_copy return agent_configuration_copy
@ -62,7 +62,7 @@ def add_http_ports(
agent_configuration: AgentConfiguration, http_ports: Sequence[int] agent_configuration: AgentConfiguration, http_ports: Sequence[int]
) -> AgentConfiguration: ) -> AgentConfiguration:
agent_configuration_copy = agent_configuration.copy() agent_configuration_copy = agent_configuration.copy(deep=True)
agent_configuration_copy.propagation.exploitation.options.http_ports = http_ports agent_configuration_copy.propagation.exploitation.options.http_ports = http_ports
return agent_configuration_copy return agent_configuration_copy
@ -72,7 +72,7 @@ def set_keep_tunnel_open_time(
agent_configuration: AgentConfiguration, keep_tunnel_open_time: int agent_configuration: AgentConfiguration, keep_tunnel_open_time: int
) -> AgentConfiguration: ) -> AgentConfiguration:
agent_configuration_copy = agent_configuration.copy() agent_configuration_copy = agent_configuration.copy(deep=True)
agent_configuration_copy.keep_tunnel_open_time = keep_tunnel_open_time agent_configuration_copy.keep_tunnel_open_time = keep_tunnel_open_time
return agent_configuration_copy return agent_configuration_copy
@ -82,7 +82,7 @@ def set_maximum_depth(
agent_configuration: AgentConfiguration, maximum_depth: int agent_configuration: AgentConfiguration, maximum_depth: int
) -> AgentConfiguration: ) -> AgentConfiguration:
agent_configuration_copy = agent_configuration.copy() agent_configuration_copy = agent_configuration.copy(deep=True)
agent_configuration_copy.propagation.maximum_depth = maximum_depth agent_configuration_copy.propagation.maximum_depth = maximum_depth
return agent_configuration_copy return agent_configuration_copy