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

Method check_zap_credentials_exist

db_manager.py:2667–2701  ·  view source on GitHub ↗

Check if credentials exist for a target (without returning password). Args: target_host: Target host/IP to check Returns: Dict with exists: bool, auth_type: str, username: str (if exists)

(self, target_host: str)

Source from the content-addressed store, hash-verified

2665 for row in cursor.fetchall():
2666 result = dict(row)
2667 # Indicate if password is set without revealing it
2668 result['has_password'] = True # If row exists, password was provided
2669 results.append(result)
2670
2671 return results
2672
2673 except Exception as e:
2674 logger.error(f"Failed to list ZAP credentials: {e}")
2675 return []
2676
2677 def check_zap_credentials_exist(self, target_host: str) -> Dict[str, Any]:
2678 """
2679 Check if credentials exist for a target (without returning password).
2680
2681 Args:
2682 target_host: Target host/IP to check
2683
2684 Returns:
2685 Dict with exists: bool, auth_type: str, username: str (if exists)
2686 """
2687 try:
2688 target_host = self._normalize_target_host(target_host)
2689
2690 with self.get_connection() as conn:
2691 cursor = conn.cursor()
2692 cursor.execute("""
2693 SELECT auth_type, username, login_url, notes
2694 FROM zap_target_credentials WHERE target_host = ?
2695 """, (target_host,))
2696
2697 row = cursor.fetchone()
2698 if row:
2699 return {
2700 'exists': True,
2701 'auth_type': row['auth_type'],
2702 'username': row['username'],
2703 'login_url': row['login_url'],
2704 'notes': row['notes']

Callers 1

check_zap_credentialsFunction · 0.80

Calls 6

get_connectionMethod · 0.95
cursorMethod · 0.80
errorMethod · 0.80
executeMethod · 0.45
fetchoneMethod · 0.45

Tested by

no test coverage detected