forked from p15670423/monkey
Agent: Remove should_monkey_run() performance check
This commit is contained in:
parent
db58b0b27d
commit
32c2d744b5
|
@ -407,18 +407,6 @@ class ControlClient(object):
|
|||
except requests.exceptions.RequestException:
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def should_monkey_run(vulnerable_port: str) -> bool:
|
||||
if (
|
||||
vulnerable_port
|
||||
and WormConfiguration.get_hop_distance_to_island() > 1
|
||||
and ControlClient.can_island_see_port(vulnerable_port)
|
||||
and WormConfiguration.started_on_island
|
||||
):
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
def can_island_see_port(port):
|
||||
try:
|
||||
|
|
|
@ -13,7 +13,6 @@ from infection_monkey.control import ControlClient
|
|||
from infection_monkey.master.mock_master import MockMaster
|
||||
from infection_monkey.model import DELAY_DELETE_CMD
|
||||
from infection_monkey.network.firewall import app as firewall
|
||||
from infection_monkey.network.tools import is_running_on_island
|
||||
from infection_monkey.puppet.mock_puppet import MockPuppet
|
||||
from infection_monkey.system_singleton import SystemSingleton
|
||||
from infection_monkey.telemetry.attack.t1106_telem import T1106Telem
|
||||
|
@ -144,13 +143,6 @@ class InfectionMonkey:
|
|||
def _setup(self):
|
||||
logger.debug("Starting the setup phase.")
|
||||
|
||||
if self._should_exit_for_performance():
|
||||
logger.info(
|
||||
"Monkey shouldn't run on current machine to improve perfomance"
|
||||
"(it will be exploited later with more depth)."
|
||||
)
|
||||
return
|
||||
|
||||
if firewall.is_enabled():
|
||||
firewall.add_firewall_rule()
|
||||
|
||||
|
@ -163,18 +155,6 @@ class InfectionMonkey:
|
|||
|
||||
register_signal_handlers(self._master)
|
||||
|
||||
def _should_exit_for_performance(self):
|
||||
"""
|
||||
This method implements propagation performance enhancing algorithm that
|
||||
kicks in if the run was started from the Island.
|
||||
Should get replaced by other, better performance enhancement solutions
|
||||
"""
|
||||
if is_running_on_island():
|
||||
WormConfiguration.started_on_island = True
|
||||
ControlClient.report_start_on_island()
|
||||
|
||||
return not ControlClient.should_monkey_run(self._opts.vulnerable_port)
|
||||
|
||||
def _is_another_monkey_running(self):
|
||||
return not self._singleton.try_lock()
|
||||
|
||||
|
|
Loading…
Reference in New Issue