From ef134be044b45ccd4602053869eb0be10050c3ad Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Thu, 24 Mar 2022 11:10:22 -0400 Subject: [PATCH] Agent: Remove default servers from WormConfiguration.command_servers In my 16 months working on this project, the default server included in WormConfiguration.command_servers has never had a Monkey Island running on it. This adds a 30 second delay to each hop in the tunneling test as the agent attempts to contact this bogus IP. Removing it speeds up propagation and also avoids unintended consequences if a user has a different service running on 192.0.2.0:5000. --- monkey/infection_monkey/config.py | 2 +- monkey/infection_monkey/monkey.py | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/monkey/infection_monkey/config.py b/monkey/infection_monkey/config.py index 0abf6b19c..8e9ffce8f 100644 --- a/monkey/infection_monkey/config.py +++ b/monkey/infection_monkey/config.py @@ -85,7 +85,7 @@ class Configuration(object): current_server = "" # Configuration servers to try to connect to, in this order. - command_servers = ["192.0.2.0:5000"] + command_servers = [] keep_tunnel_open_time = 60 diff --git a/monkey/infection_monkey/monkey.py b/monkey/infection_monkey/monkey.py index 0abd47149..1fb2d4165 100644 --- a/monkey/infection_monkey/monkey.py +++ b/monkey/infection_monkey/monkey.py @@ -120,13 +120,8 @@ class InfectionMonkey: @staticmethod def _add_default_server_to_config(default_server: str): if default_server: - if default_server not in WormConfiguration.command_servers: - logger.debug("Added default server: %s" % default_server) - WormConfiguration.command_servers.insert(0, default_server) - else: - logger.debug( - "Default server: %s is already in command servers list" % default_server - ) + logger.debug("Added default server: %s" % default_server) + WormConfiguration.command_servers.insert(0, default_server) def _connect_to_island(self): # Sets island's IP and port for monkey to communicate to