You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PurpleDome/plugins/default/kali/hydra/hydra_plugin.py

41 lines
1.1 KiB
Python

4 years ago
#!/usr/bin/env python3
# A plugin for hydra bruteforce attacks
from plugins.base.attack import AttackPlugin
4 years ago
class HydraPlugin(AttackPlugin):
4 years ago
# Boilerplate
name = "hydra"
description = "A plugin controlling the hydra brute forcing tool"
ttp = "T1110"
references = ["https://attack.mitre.org/techniques/T1110/"]
required_files_attacker = ["passwords.txt", "users.txt"] # Files shipped with the plugin which are needed by the kali tool. Will be copied to the kali share
4 years ago
def __init__(self):
super().__init__()
self.plugin_path = __file__
def run(self, targets):
""" Run the command
4 years ago
@param targets: A list of targets
4 years ago
"""
# Set defaults if not present in config
playground = self.attacker_machine_plugin.get_playground()
4 years ago
# Generate command
cmd = f"cd {playground};"
cmd += "sudo apt -y install hydra;"
for t in targets:
for p in self.conf['protocols']:
cmd += f"hydra -L {self.conf['userfile']} -P {self.conf['pwdfile']} {p}://{t.getip()};"
4 years ago
res = self.attacker_run_cmd(cmd) or ""
4 years ago
return res