Agent: Remove max iters and timeout between iters options
This commit is contained in:
parent
03d3a22b42
commit
e774fc8a1e
|
@ -99,12 +99,6 @@ class Configuration(object):
|
||||||
# sets whether or not the monkey is alive. if false will stop scanning and exploiting
|
# sets whether or not the monkey is alive. if false will stop scanning and exploiting
|
||||||
alive = True
|
alive = True
|
||||||
|
|
||||||
# how long to wait between scan iterations
|
|
||||||
timeout_between_iterations = 100
|
|
||||||
|
|
||||||
# how many scan iterations to perform on each run
|
|
||||||
max_iterations = 1
|
|
||||||
|
|
||||||
finger_classes = []
|
finger_classes = []
|
||||||
exploiter_classes = []
|
exploiter_classes = []
|
||||||
system_info_collector_classes = []
|
system_info_collector_classes = []
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
"MSSQLFingerprint",
|
"MSSQLFingerprint",
|
||||||
"ElasticFinger"
|
"ElasticFinger"
|
||||||
],
|
],
|
||||||
"max_iterations": 3,
|
|
||||||
"monkey_log_path_windows": "%temp%\\~df1563.tmp",
|
"monkey_log_path_windows": "%temp%\\~df1563.tmp",
|
||||||
"monkey_log_path_linux": "/tmp/user-1563",
|
"monkey_log_path_linux": "/tmp/user-1563",
|
||||||
"ms08_067_exploit_attempts": 5,
|
"ms08_067_exploit_attempts": 5,
|
||||||
|
@ -77,7 +76,6 @@
|
||||||
7001,
|
7001,
|
||||||
8088
|
8088
|
||||||
],
|
],
|
||||||
"timeout_between_iterations": 10,
|
|
||||||
"victims_max_exploit": 100,
|
"victims_max_exploit": 100,
|
||||||
"victims_max_find": 100,
|
"victims_max_find": 100,
|
||||||
"post_breach_actions": []
|
"post_breach_actions": []
|
||||||
|
|
|
@ -208,7 +208,6 @@ class InfectionMonkey(object):
|
||||||
raise PlannedShutdownException("Marked 'not alive' from configuration.")
|
raise PlannedShutdownException("Marked 'not alive' from configuration.")
|
||||||
|
|
||||||
def propagate(self):
|
def propagate(self):
|
||||||
for iteration_index in range(WormConfiguration.max_iterations):
|
|
||||||
ControlClient.keepalive()
|
ControlClient.keepalive()
|
||||||
ControlClient.load_control_config()
|
ControlClient.load_control_config()
|
||||||
|
|
||||||
|
@ -218,19 +217,17 @@ class InfectionMonkey(object):
|
||||||
|
|
||||||
self._exploiters = HostExploiter.get_classes()
|
self._exploiters = HostExploiter.get_classes()
|
||||||
|
|
||||||
if not self._keep_running or not WormConfiguration.alive:
|
if not WormConfiguration.alive:
|
||||||
break
|
logger.info("Marked not alive from configuration")
|
||||||
|
|
||||||
machines = self._network.get_victim_machines(
|
machines = self._network.get_victim_machines(
|
||||||
max_find=WormConfiguration.victims_max_find,
|
max_find=WormConfiguration.victims_max_find,
|
||||||
stop_callback=ControlClient.check_for_stop,
|
stop_callback=ControlClient.check_for_stop,
|
||||||
)
|
)
|
||||||
is_empty = True
|
|
||||||
for machine in machines:
|
for machine in machines:
|
||||||
if ControlClient.check_for_stop():
|
if ControlClient.check_for_stop():
|
||||||
break
|
break
|
||||||
|
|
||||||
is_empty = False
|
|
||||||
for finger in self._fingerprint:
|
for finger in self._fingerprint:
|
||||||
logger.info(
|
logger.info(
|
||||||
"Trying to get OS fingerprint from %r with module %s",
|
"Trying to get OS fingerprint from %r with module %s",
|
||||||
|
@ -241,8 +238,7 @@ class InfectionMonkey(object):
|
||||||
finger.get_host_fingerprint(machine)
|
finger.get_host_fingerprint(machine)
|
||||||
except BaseException as exc:
|
except BaseException as exc:
|
||||||
logger.error(
|
logger.error(
|
||||||
"Failed to run fingerprinter %s, exception %s"
|
"Failed to run fingerprinter %s, exception %s" % finger.__class__.__name__,
|
||||||
% finger.__class__.__name__,
|
|
||||||
str(exc),
|
str(exc),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -270,8 +266,7 @@ class InfectionMonkey(object):
|
||||||
else:
|
else:
|
||||||
machine.set_default_server(self._default_server)
|
machine.set_default_server(self._default_server)
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Default server for machine: %r set to %s"
|
"Default server for machine: %r set to %s" % (machine, machine.default_server)
|
||||||
% (machine, machine.default_server)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Order exploits according to their type
|
# Order exploits according to their type
|
||||||
|
@ -292,14 +287,7 @@ class InfectionMonkey(object):
|
||||||
if not self._keep_running:
|
if not self._keep_running:
|
||||||
break
|
break
|
||||||
|
|
||||||
if (not is_empty) and (WormConfiguration.max_iterations > iteration_index + 1):
|
if not WormConfiguration.alive:
|
||||||
time_to_sleep = WormConfiguration.timeout_between_iterations
|
|
||||||
logger.info("Sleeping %d seconds before next life cycle iteration", time_to_sleep)
|
|
||||||
time.sleep(time_to_sleep)
|
|
||||||
|
|
||||||
if self._keep_running and WormConfiguration.alive:
|
|
||||||
logger.info("Reached max iterations (%d)", WormConfiguration.max_iterations)
|
|
||||||
elif not WormConfiguration.alive:
|
|
||||||
logger.info("Marked not alive from configuration")
|
logger.info("Marked not alive from configuration")
|
||||||
|
|
||||||
def upgrade_to_64_if_needed(self):
|
def upgrade_to_64_if_needed(self):
|
||||||
|
|
Loading…
Reference in New Issue