forked from p15670423/monkey
Simplified generic attack logic
This commit is contained in:
parent
2d47e9c228
commit
ee4d206745
|
@ -160,20 +160,20 @@ class ChaosMonkey(object):
|
||||||
|
|
||||||
LOG.info("Trying to exploit %r with exploiter %s...", machine, exploiter.__class__.__name__)
|
LOG.info("Trying to exploit %r with exploiter %s...", machine, exploiter.__class__.__name__)
|
||||||
|
|
||||||
|
result = False
|
||||||
try:
|
try:
|
||||||
if exploiter.exploit_host():
|
result = exploiter.exploit_host()
|
||||||
|
if result:
|
||||||
successful_exploiter = exploiter
|
successful_exploiter = exploiter
|
||||||
exploiter.send_exploit_telemetry(True)
|
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
LOG.info("Failed exploiting %r with exploiter %s", machine, exploiter.__class__.__name__)
|
LOG.info("Failed exploiting %r with exploiter %s", machine, exploiter.__class__.__name__)
|
||||||
exploiter.send_exploit_telemetry(False)
|
|
||||||
|
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
LOG.exception("Exception while attacking %s using %s: %s",
|
LOG.exception("Exception while attacking %s using %s: %s",
|
||||||
machine, exploiter.__class__.__name__, exc)
|
machine, exploiter.__class__.__name__, exc)
|
||||||
exploiter.send_exploit_telemetry(False)
|
finally:
|
||||||
continue
|
exploiter.send_exploit_telemetry(result)
|
||||||
|
|
||||||
if successful_exploiter:
|
if successful_exploiter:
|
||||||
self._exploited_machines.add(machine)
|
self._exploited_machines.add(machine)
|
||||||
|
|
Loading…
Reference in New Issue