forked from p34709852/monkey
Added small readability changes
This commit is contained in:
parent
1e812b987a
commit
3405f29f15
|
@ -291,7 +291,7 @@ class Configuration(object):
|
||||||
###########################
|
###########################
|
||||||
export_monkey_telems = False
|
export_monkey_telems = False
|
||||||
|
|
||||||
def get_hop_count(self):
|
def get_hop_distance_to_island(self):
|
||||||
return self.max_depth - self.depth
|
return self.max_depth - self.depth
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -327,7 +327,7 @@ class ControlClient(object):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def should_monkey_run(vulnerable_port: str) -> bool:
|
def should_monkey_run(vulnerable_port: str) -> bool:
|
||||||
if vulnerable_port and \
|
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 \
|
ControlClient.can_island_see_port(vulnerable_port) and \
|
||||||
WormConfiguration.started_on_island:
|
WormConfiguration.started_on_island:
|
||||||
raise PlannedShutdownException("Monkey shouldn't run on current machine "
|
raise PlannedShutdownException("Monkey shouldn't run on current machine "
|
||||||
|
|
|
@ -58,6 +58,7 @@ class Monkey(flask_restful.Resource):
|
||||||
return mongo.db.monkey.update({"_id": monkey["_id"]}, update, upsert=False)
|
return mongo.db.monkey.update({"_id": monkey["_id"]}, update, upsert=False)
|
||||||
|
|
||||||
# Used by monkey. can't secure.
|
# Used by monkey. can't secure.
|
||||||
|
# Called on monkey wakeup to initialize local configuration
|
||||||
@TestTelemStore.store_test_telem
|
@TestTelemStore.store_test_telem
|
||||||
def post(self, **kw):
|
def post(self, **kw):
|
||||||
monkey_json = json.loads(request.data)
|
monkey_json = json.loads(request.data)
|
||||||
|
|
Loading…
Reference in New Issue