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

Method _normalize_target_host

db_manager.py:2703–2724  ·  view source on GitHub ↗

Normalize a target URL/host for consistent storage. Extracts just the host:port portion.

(self, target: str)

Source from the content-addressed store, hash-verified

2701 'auth_type': row['auth_type'],
2702 'username': row['username'],
2703 'login_url': row['login_url'],
2704 'notes': row['notes']
2705 }
2706
2707 return {'exists': False}
2708
2709 except Exception as e:
2710 logger.error(f"Failed to check ZAP credentials for {target_host}: {e}")
2711 return {'exists': False, 'error': str(e)}
2712
2713 def _normalize_target_host(self, target: str) -> str:
2714 """
2715 Normalize a target URL/host for consistent storage.
2716 Extracts just the host:port portion.
2717 """
2718 import urllib.parse
2719
2720 if not target:
2721 return ''
2722
2723 # If it looks like a URL, parse it
2724 if '://' in target:
2725 parsed = urllib.parse.urlparse(target)
2726 host = parsed.netloc or parsed.path
2727 else:

Callers 4

save_zap_credentialsMethod · 0.95
get_zap_credentialsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected