forked from p15670423/monkey
depth commandline option is not overwritten when getting config from the island
This commit is contained in:
parent
f55b8d429d
commit
de958088b4
|
@ -51,6 +51,8 @@ class Configuration(object):
|
||||||
continue
|
continue
|
||||||
if key in ["name", "id", "current_server"]:
|
if key in ["name", "id", "current_server"]:
|
||||||
continue
|
continue
|
||||||
|
if self._depth_from_commandline and key=="depth":
|
||||||
|
continue
|
||||||
try:
|
try:
|
||||||
default_value = getattr(Configuration, key)
|
default_value = getattr(Configuration, key)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
@ -83,6 +85,8 @@ class Configuration(object):
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
_depth_from_commandline = False
|
||||||
|
|
||||||
###########################
|
###########################
|
||||||
# logging config
|
# logging config
|
||||||
###########################
|
###########################
|
||||||
|
|
|
@ -22,7 +22,7 @@ class ControlClient(object):
|
||||||
proxies = {}
|
proxies = {}
|
||||||
|
|
||||||
@staticmethod
|
@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)
|
LOG.debug("Trying to wake up with C&C servers list: %r" % WormConfiguration.command_servers)
|
||||||
if parent or default_tunnel:
|
if parent or default_tunnel:
|
||||||
LOG.debug("parent: %s, default_tunnel: %s" % (parent, default_tunnel))
|
LOG.debug("parent: %s, default_tunnel: %s" % (parent, default_tunnel))
|
||||||
|
@ -30,7 +30,8 @@ class ControlClient(object):
|
||||||
if not parent:
|
if not parent:
|
||||||
parent = GUID
|
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:
|
for server in WormConfiguration.command_servers:
|
||||||
try:
|
try:
|
||||||
|
@ -40,7 +41,7 @@ class ControlClient(object):
|
||||||
'hostname': hostname,
|
'hostname': hostname,
|
||||||
'ip_addresses': local_ips(),
|
'ip_addresses': local_ips(),
|
||||||
'description': " ".join(platform.uname()),
|
'description': " ".join(platform.uname()),
|
||||||
'internet_access': internet_access,
|
'internet_access': has_internet_access,
|
||||||
'config': WormConfiguration.as_dict(),
|
'config': WormConfiguration.as_dict(),
|
||||||
'parent': parent}
|
'parent': parent}
|
||||||
|
|
||||||
|
@ -71,7 +72,7 @@ class ControlClient(object):
|
||||||
proxy_address, proxy_port = proxy_find
|
proxy_address, proxy_port = proxy_find
|
||||||
LOG.info("Found tunnel at %s:%s" % (proxy_address, proxy_port))
|
LOG.info("Found tunnel at %s:%s" % (proxy_address, proxy_port))
|
||||||
ControlClient.proxies['https'] = 'https://%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:
|
else:
|
||||||
LOG.info("No tunnel found")
|
LOG.info("No tunnel found")
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ class ChaosMonkey(object):
|
||||||
self._default_server = opts.server
|
self._default_server = opts.server
|
||||||
if opts.depth:
|
if opts.depth:
|
||||||
WormConfiguration.depth = int(opts.depth)
|
WormConfiguration.depth = int(opts.depth)
|
||||||
|
WormConfiguration._depth_from_commandline = True
|
||||||
self._keep_running = True
|
self._keep_running = True
|
||||||
self._network = NetworkScanner()
|
self._network = NetworkScanner()
|
||||||
self._dropper_path = sys.argv[0]
|
self._dropper_path = sys.argv[0]
|
||||||
|
|
Loading…
Reference in New Issue