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

Method execute

actions/sql_connector.py:40–61  ·  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

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

Callers 2

sql_connectMethod · 0.45
sql_connector.pyFile · 0.45

Calls 6

_verify_credentialsMethod · 0.95
bruteforce_sqlMethod · 0.95
infoMethod · 0.80
successMethod · 0.80
warningMethod · 0.80

Tested by

no test coverage detected