diff --git a/monkey/infection_monkey/config.py b/monkey/infection_monkey/config.py index ae466237f..910b0abd7 100644 --- a/monkey/infection_monkey/config.py +++ b/monkey/infection_monkey/config.py @@ -291,7 +291,7 @@ class Configuration(object): ########################### export_monkey_telems = False - def get_hop_count(self): + def get_hop_distance_to_island(self): return self.max_depth - self.depth diff --git a/monkey/infection_monkey/control.py b/monkey/infection_monkey/control.py index a9aa246cb..4eacc728b 100644 --- a/monkey/infection_monkey/control.py +++ b/monkey/infection_monkey/control.py @@ -327,7 +327,7 @@ class ControlClient(object): @staticmethod def should_monkey_run(vulnerable_port: str) -> bool: if vulnerable_port and \ - WormConfiguration.get_hop_count() > 1 and \ + WormConfiguration.get_hop_distance_to_island() > 1 and \ ControlClient.can_island_see_port(vulnerable_port) and \ WormConfiguration.started_on_island: raise PlannedShutdownException("Monkey shouldn't run on current machine " diff --git a/monkey/monkey_island/cc/resources/monkey.py b/monkey/monkey_island/cc/resources/monkey.py index e61765376..181ce94b2 100644 --- a/monkey/monkey_island/cc/resources/monkey.py +++ b/monkey/monkey_island/cc/resources/monkey.py @@ -58,6 +58,7 @@ class Monkey(flask_restful.Resource): return mongo.db.monkey.update({"_id": monkey["_id"]}, update, upsert=False) # Used by monkey. can't secure. + # Called on monkey wakeup to initialize local configuration @TestTelemStore.store_test_telem def post(self, **kw): monkey_json = json.loads(request.data)