|
|
|
@ -3,6 +3,7 @@
|
|
|
|
|
|
|
|
|
|
from plugins.base.plugin_base import BasePlugin
|
|
|
|
|
from app.exceptions import PluginError
|
|
|
|
|
from app.calderacontrol import CalderaControl
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -27,6 +28,8 @@ class AttackPlugin(BasePlugin):
|
|
|
|
|
self.sysconf = {} # System configuration. common for all plugins
|
|
|
|
|
self.attacker_machine_plugin = None # The machine plugin referencing the attacker. The Kali machine should be the perfect candidate
|
|
|
|
|
self.target_machine_plugin = None # The machine plugin referencing the target
|
|
|
|
|
self.caldera = None # The Caldera connection object
|
|
|
|
|
self.targets = None
|
|
|
|
|
|
|
|
|
|
def copy_to_attacker_and_defender(self):
|
|
|
|
|
""" Copy attacker/defender specific files to the machines. Called by setup, do not call it yourself. template processing happens before """
|
|
|
|
@ -88,6 +91,25 @@ class AttackPlugin(BasePlugin):
|
|
|
|
|
|
|
|
|
|
self.attacker_machine_plugin = machine.vm_manager
|
|
|
|
|
|
|
|
|
|
def set_caldera(self, caldera: CalderaControl):
|
|
|
|
|
""" Set the caldera control to be used for caldera attacks
|
|
|
|
|
|
|
|
|
|
@param caldera: The caldera object to connect through
|
|
|
|
|
"""
|
|
|
|
|
self.caldera = caldera
|
|
|
|
|
|
|
|
|
|
def caldera_attack(self, target, ability_id):
|
|
|
|
|
""" Attack a single target using caldera
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
self.caldera.attack(self.attack_logger,
|
|
|
|
|
paw=target.get_paw(),
|
|
|
|
|
ability_id=ability_id,
|
|
|
|
|
group=target.get_group(),
|
|
|
|
|
target_platform=target.get_os()
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
def get_attacker_playground(self):
|
|
|
|
|
""" Returns the attacker machine specific playground
|
|
|
|
|
|
|
|
|
@ -112,11 +134,13 @@ class AttackPlugin(BasePlugin):
|
|
|
|
|
@param targets: A list of targets, ip addresses will do
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
self.targets = targets
|
|
|
|
|
ips = [tgt.getip() for tgt in targets]
|
|
|
|
|
self.setup()
|
|
|
|
|
self.attack_logger.start_kali_attack(self.attacker_machine_plugin.config.vmname(), targets, self.name, ttp=self.get_ttp())
|
|
|
|
|
self.attack_logger.start_kali_attack(self.attacker_machine_plugin.config.vmname(), ips, self.name, ttp=self.get_ttp())
|
|
|
|
|
res = self.run(targets)
|
|
|
|
|
self.teardown()
|
|
|
|
|
self.attack_logger.stop_kali_attack(self.attacker_machine_plugin.config.vmname(), targets, self.name, ttp=self.get_ttp())
|
|
|
|
|
self.attack_logger.stop_kali_attack(self.attacker_machine_plugin.config.vmname(), ips, self.name, ttp=self.get_ttp())
|
|
|
|
|
return res
|
|
|
|
|
|
|
|
|
|
def get_ttp(self):
|
|
|
|
|