Added small readability changes

This commit is contained in:
VakarisZ 2020-05-25 18:25:15 +03:00
parent 1e812b987a
commit 3405f29f15
3 changed files with 3 additions and 2 deletions

View File

@ -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

View File

@ -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 "

View File

@ -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)