From 6eb48c44459c1382b4609650b2f304e82379a273 Mon Sep 17 00:00:00 2001 From: Daniel Goldberg Date: Wed, 12 Sep 2018 20:02:48 +0300 Subject: [PATCH 1/2] See https://stackoverflow.com/questions/27287391/why-not-generate-the-secret-key-every-time-flask-starts --- monkey/monkey_island/cc/app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/monkey/monkey_island/cc/app.py b/monkey/monkey_island/cc/app.py index f5823ef88..c4554ccf2 100644 --- a/monkey/monkey_island/cc/app.py +++ b/monkey/monkey_island/cc/app.py @@ -1,4 +1,5 @@ import os +import uuid from datetime import datetime import bson @@ -83,7 +84,7 @@ def init_app(mongo_url): app.config['MONGO_URI'] = mongo_url - app.config['SECRET_KEY'] = os.urandom(32) + app.config['SECRET_KEY'] = uuid.getnode() app.config['JWT_AUTH_URL_RULE'] = '/api/auth' app.config['JWT_EXPIRATION_DELTA'] = env.get_auth_expiration_time() From aaba30b6b79b4c13d01bb0c4c66076467a3bb166 Mon Sep 17 00:00:00 2001 From: Daniel Goldberg Date: Sun, 16 Sep 2018 13:46:06 +0300 Subject: [PATCH 2/2] Fix typo --- monkey/infection_monkey/network/tools.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/monkey/infection_monkey/network/tools.py b/monkey/infection_monkey/network/tools.py index 43dd7286c..84d4a4ad4 100644 --- a/monkey/infection_monkey/network/tools.py +++ b/monkey/infection_monkey/network/tools.py @@ -128,10 +128,9 @@ def check_tcp_ports(ip, ports, timeout=DEFAULT_TIMEOUT, get_banner=False): if len(possible_ports) != 0: timeout = int(round(timeout)) # clamp to integer, to avoid checking input - time_left = timeout sockets_to_try = possible_ports[:] connected_ports_sockets = [] - while (time_left >= 0) and len(sockets_to_try): + while (timeout >= 0) and len(sockets_to_try): sock_objects = [s[1] for s in sockets_to_try] _, writeable_sockets, _ = select.select(sock_objects, sock_objects, sock_objects, 0)