MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / execute

Method execute

actions/smb_connector.py:46–68  ·  view source on GitHub ↗

Execute the brute force attack and update status. Optimization: Skip bruteforce if valid credentials already exist for this host.

(self, ip, port, row, status_key)

Source from the content-addressed store, hash-verified

44 return self.smb_connector.run_bruteforce(ip, port)
45
46 def execute(self, ip, port, row, status_key):
47 """
48 Execute the brute force attack and update status.
49 Optimization: Skip bruteforce if valid credentials already exist for this host.
50 """
51 logger.info(f"Executing SMBBruteforce on {ip}:{port}...")
52
53 # Check if we already have valid credentials for this host
54 existing_creds = CredentialChecker.check_existing_credentials(
55 self.shared_data.smbfile, ip
56 )
57 if existing_creds:
58 logger.info(f"SMB credentials already exist for {ip} - verifying instead of bruteforcing...")
59 # Verify credentials still work
60 if self._verify_credentials(ip, existing_creds):
61 logger.success(f"Existing SMB credentials verified for {ip}: {len(existing_creds)} account(s)")
62 return 'success'
63 else:
64 logger.warning(f"Existing credentials for {ip} no longer valid, will re-bruteforce")
65
66 self.shared_data.ragnarorch_status = "SMBBruteforce"
67 success, results = self.bruteforce_smb(ip, port)
68 return 'success' if success else 'failed'
69
70 def _verify_credentials(self, ip, credentials):
71 """Verify that existing credentials still work (quick check)."""

Callers 1

smb_connector.pyFile · 0.45

Calls 6

_verify_credentialsMethod · 0.95
bruteforce_smbMethod · 0.95
infoMethod · 0.80
successMethod · 0.80
warningMethod · 0.80

Tested by

no test coverage detected