Simpler access to machine data 2

pull/3/head
Thorsten Sick 4 years ago
parent 96a5770a63
commit 1564f3a42b

@ -37,9 +37,9 @@ class Experiment():
self.attack_logger = AttackLog(verbosity) self.attack_logger = AttackLog(verbosity)
self.plugin_manager = PluginManager(self.attack_logger) self.plugin_manager = PluginManager(self.attack_logger)
self.__start_attacker() self.__start_attacker()
caldera_url = "http://" + self.attacker_1.getip() + ":8888" caldera_url = "http://" + self.attacker_1.get_ip() + ":8888"
self.caldera_control = CalderaControl(caldera_url, attack_logger=self.attack_logger, config=self.experiment_config) self.caldera_control = CalderaControl(caldera_url, attack_logger=self.attack_logger, config=self.experiment_config)
# self.caldera_control = CalderaControl("http://" + self.attacker_1.getip() + ":8888", self.attack_logger, # self.caldera_control = CalderaControl("http://" + self.attacker_1.get_ip() + ":8888", self.attack_logger,
# config=self.experiment_config) # config=self.experiment_config)
# Deleting all currently registered Caldera gents # Deleting all currently registered Caldera gents
self.attack_logger.vprint(self.caldera_control.kill_all_agents(), 3) self.attack_logger.vprint(self.caldera_control.kill_all_agents(), 3)
@ -59,7 +59,7 @@ class Experiment():
self.attack_logger.vprint(f"{CommandlineColors.OKBLUE}preparing target {tname} ....{CommandlineColors.ENDC}", 1) self.attack_logger.vprint(f"{CommandlineColors.OKBLUE}preparing target {tname} ....{CommandlineColors.ENDC}", 1)
target_1 = Machine(target_conf, attack_logger=self.attack_logger) target_1 = Machine(target_conf, attack_logger=self.attack_logger)
target_1.set_caldera_server(self.attacker_1.getip()) target_1.set_caldera_server(self.attacker_1.get_ip())
try: try:
if not target_conf.use_existing_machine(): if not target_conf.use_existing_machine():
target_1.destroy() target_1.destroy()
@ -159,7 +159,7 @@ class Experiment():
for attack in kali_attacks: for attack in kali_attacks:
# TODO: Work with snapshots # TODO: Work with snapshots
self.attack_logger.vprint(f"Attacking machine with PAW: {target_1.get_paw()} with attack: {attack}", 1) self.attack_logger.vprint(f"Attacking machine with PAW: {target_1.get_paw()} with attack: {attack}", 1)
# self.attacker_1.kali_attack(attack, target_1.getip(), self.experiment_config) # self.attacker_1.kali_attack(attack, target_1.get_ip(), self.experiment_config)
self.attack(target_1, attack) self.attack(target_1, attack)
self.attack_logger.vprint(f"Pausing before next attack (config: nap_time): {self.experiment_config.get_nap_time()}", 3) self.attack_logger.vprint(f"Pausing before next attack (config: nap_time): {self.experiment_config.get_nap_time()}", 3)
time.sleep(self.experiment_config.get_nap_time()) time.sleep(self.experiment_config.get_nap_time())

@ -38,7 +38,7 @@ def create_machines(arguments):
print("Attacker done") print("Attacker done")
target_.destroy() target_.destroy()
target_.set_caldera_server(attacker_1.getip()) target_.set_caldera_server(attacker_1.get_ip())
target_.install_caldera_service() target_.install_caldera_service()
target_.create() target_.create()
print("Target up") print("Target up")
@ -46,7 +46,7 @@ def create_machines(arguments):
target_.start_caldera_client() target_.start_caldera_client()
print("Target done") print("Target done")
print("Caldera server running at: http://{}:8888/".format(attacker_1.getip())) print("Caldera server running at: http://{}:8888/".format(attacker_1.get_ip()))
# target_.install_caldera_client(attacker_1.getip(), "target1elf") # target_.install_caldera_client(attacker_1.getip(), "target1elf")

@ -33,7 +33,7 @@ class HydraPlugin(AttackPlugin):
cmd += "sudo apt -y install hydra;" cmd += "sudo apt -y install hydra;"
for t in targets: for t in targets:
for p in self.conf['protocols']: for p in self.conf['protocols']:
cmd += f"hydra -L {self.conf['userfile']} -P {self.conf['pwdfile']} {p}://{t.getip()};" cmd += f"hydra -L {self.conf['userfile']} -P {self.conf['pwdfile']} {p}://{t.get_ip()};"
res = self.attacker_run_cmd(cmd) or "" res = self.attacker_run_cmd(cmd) or ""

Loading…
Cancel
Save