Fix config erasing of creds

This commit is contained in:
Itay Mizeretz 2017-08-16 16:36:51 +03:00
parent f1b7fb6706
commit 875eba393c
1 changed files with 16 additions and 10 deletions

View File

@ -111,16 +111,7 @@ class ChaosMonkey(object):
ControlClient.keepalive()
ControlClient.load_control_config()
# TODO: this is temporary until we change server to support changing of config.
for user in list(additional_creds):
if user not in WormConfiguration.exploit_user_list:
WormConfiguration.exploit_user_list.append(user)
creds = additional_creds[user]
if creds.has_key('password'):
password = creds['password']
if password not in WormConfiguration.exploit_password_list:
WormConfiguration.exploit_password_list.append(password)
self.update_config_creds(additional_creds)
LOG.debug("Users to try: %s" % str(WormConfiguration.exploit_user_list))
LOG.debug("Passwords to try: %s" % str(WormConfiguration.exploit_password_list))
@ -142,6 +133,9 @@ class ChaosMonkey(object):
if ControlClient.check_for_stop():
break
# TODO: Consider removing later
self.update_config_creds(additional_creds)
is_empty = False
for finger in self._fingerprint:
LOG.info("Trying to get OS fingerprint from %r with module %s",
@ -260,4 +254,16 @@ class ChaosMonkey(object):
except Exception, exc:
LOG.error("Exception in self delete: %s", exc)
def update_config_creds(self, additional_creds):
# TODO: this is temporary until we change server to support changing of config.
for user in list(additional_creds):
if user not in WormConfiguration.exploit_user_list:
WormConfiguration.exploit_user_list.append(user)
creds = additional_creds[user]
if creds.has_key('password'):
password = creds['password']
if password not in WormConfiguration.exploit_password_list:
WormConfiguration.exploit_password_list.append(password)
LOG.info("Monkey is shutting down")