depth commandline option is not overwritten when getting config from the island

This commit is contained in:
itsikkes 2016-08-01 16:52:27 +03:00
parent f55b8d429d
commit de958088b4
3 changed files with 10 additions and 4 deletions

View File

@ -51,6 +51,8 @@ class Configuration(object):
continue
if key in ["name", "id", "current_server"]:
continue
if self._depth_from_commandline and key=="depth":
continue
try:
default_value = getattr(Configuration, key)
except AttributeError:
@ -83,6 +85,8 @@ class Configuration(object):
return result
_depth_from_commandline = False
###########################
# logging config
###########################

View File

@ -22,7 +22,7 @@ class ControlClient(object):
proxies = {}
@staticmethod
def wakeup(parent=None, default_tunnel=None):
def wakeup(parent=None, default_tunnel=None, has_internet_access=None):
LOG.debug("Trying to wake up with C&C servers list: %r" % WormConfiguration.command_servers)
if parent or default_tunnel:
LOG.debug("parent: %s, default_tunnel: %s" % (parent, default_tunnel))
@ -30,7 +30,8 @@ class ControlClient(object):
if not parent:
parent = GUID
internet_access = check_internet_access(WormConfiguration.internet_services)
if has_internet_access is None:
has_internet_access = check_internet_access(WormConfiguration.internet_services)
for server in WormConfiguration.command_servers:
try:
@ -40,7 +41,7 @@ class ControlClient(object):
'hostname': hostname,
'ip_addresses': local_ips(),
'description': " ".join(platform.uname()),
'internet_access': internet_access,
'internet_access': has_internet_access,
'config': WormConfiguration.as_dict(),
'parent': parent}
@ -71,7 +72,7 @@ class ControlClient(object):
proxy_address, proxy_port = proxy_find
LOG.info("Found tunnel at %s:%s" % (proxy_address, proxy_port))
ControlClient.proxies['https'] = 'https://%s:%s' % (proxy_address, proxy_port)
ControlClient.wakeup(parent=parent)
ControlClient.wakeup(parent=parent, has_internet_access=has_internet_access)
else:
LOG.info("No tunnel found")

View File

@ -52,6 +52,7 @@ class ChaosMonkey(object):
self._default_server = opts.server
if opts.depth:
WormConfiguration.depth = int(opts.depth)
WormConfiguration._depth_from_commandline = True
self._keep_running = True
self._network = NetworkScanner()
self._dropper_path = sys.argv[0]