forked from p15670423/monkey
Agent: Rename should_propagate -> maximum_depth_reached
This commit is contained in:
parent
ad0f6946bd
commit
05f640d487
|
@ -14,7 +14,7 @@ from infection_monkey.network import NetworkInterface
|
|||
from infection_monkey.telemetry.credentials_telem import CredentialsTelem
|
||||
from infection_monkey.telemetry.messengers.i_telemetry_messenger import ITelemetryMessenger
|
||||
from infection_monkey.telemetry.post_breach_telem import PostBreachTelem
|
||||
from infection_monkey.utils.propagation import should_propagate
|
||||
from infection_monkey.utils.propagation import maximum_depth_reached
|
||||
from infection_monkey.utils.threading import create_daemon_thread, interruptible_iter
|
||||
|
||||
from . import Exploiter, IPScanner, Propagator
|
||||
|
@ -174,7 +174,7 @@ class AutomatedMaster(IMaster):
|
|||
current_depth = self._current_depth if self._current_depth is not None else 0
|
||||
logger.info(f"Current depth is {current_depth}")
|
||||
|
||||
if should_propagate(config.propagation.maximum_depth, self._current_depth):
|
||||
if maximum_depth_reached(config.propagation.maximum_depth, self._current_depth):
|
||||
self._propagator.propagate(config.propagation, current_depth, self._stop)
|
||||
else:
|
||||
logger.info("Skipping propagation: maximum depth reached")
|
||||
|
|
|
@ -78,7 +78,7 @@ from infection_monkey.utils.monkey_dir import (
|
|||
remove_monkey_dir,
|
||||
)
|
||||
from infection_monkey.utils.monkey_log_path import get_agent_log_path
|
||||
from infection_monkey.utils.propagation import should_propagate
|
||||
from infection_monkey.utils.propagation import maximum_depth_reached
|
||||
from infection_monkey.utils.signal_handler import register_signal_handlers, reset_signal_handlers
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -175,7 +175,7 @@ class InfectionMonkey:
|
|||
self._monkey_inbound_tunnel = self._control_client.create_control_tunnel(
|
||||
config.keep_tunnel_open_time
|
||||
)
|
||||
if self._monkey_inbound_tunnel and should_propagate(
|
||||
if self._monkey_inbound_tunnel and maximum_depth_reached(
|
||||
config.propagation.maximum_depth, self._current_depth
|
||||
):
|
||||
self._inbound_tunnel_opened = True
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
def should_propagate(maximum_depth: int, current_depth: int) -> bool:
|
||||
def maximum_depth_reached(maximum_depth: int, current_depth: int) -> bool:
|
||||
return maximum_depth > current_depth
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
from infection_monkey.utils.propagation import should_propagate
|
||||
from infection_monkey.utils.propagation import maximum_depth_reached
|
||||
|
||||
|
||||
def test_should_propagate_current_less_than_max():
|
||||
def test_maximum_depth_reached__current_less_than_max():
|
||||
maximum_depth = 2
|
||||
current_depth = 1
|
||||
|
||||
assert should_propagate(maximum_depth, current_depth) is True
|
||||
assert maximum_depth_reached(maximum_depth, current_depth) is True
|
||||
|
||||
|
||||
def test_should_propagate_current_greater_than_max():
|
||||
def test_maximum_depth_reached__current_greater_than_max():
|
||||
maximum_depth = 2
|
||||
current_depth = 3
|
||||
|
||||
assert should_propagate(maximum_depth, current_depth) is False
|
||||
assert maximum_depth_reached(maximum_depth, current_depth) is False
|
||||
|
||||
|
||||
def test_should_propagate_current_equal_to_max():
|
||||
def test_maximum_depth_reached__current_equal_to_max():
|
||||
maximum_depth = 2
|
||||
current_depth = maximum_depth
|
||||
|
||||
assert should_propagate(maximum_depth, current_depth) is False
|
||||
assert maximum_depth_reached(maximum_depth, current_depth) is False
|
||||
|
|
Loading…
Reference in New Issue