Get ZAP credentials for a URL (extracts host and looks up). Args: url: Full URL (e.g., "http://192.168.1.1:8080/app") Returns: Dict with credentials or None if not found
(self, url: str)
| 2574 | result['cookie_value'] = None |
| 2575 | if 'cookie_value_encrypted' in result: |
| 2576 | del result['cookie_value_encrypted'] |
| 2577 | |
| 2578 | return result |
| 2579 | |
| 2580 | return None |
| 2581 | |
| 2582 | except Exception as e: |
| 2583 | logger.error(f"Failed to get ZAP credentials for {target_host}: {e}") |
| 2584 | return None |
| 2585 | |
| 2586 | def get_zap_credentials_for_url(self, url: str) -> Optional[Dict[str, Any]]: |
| 2587 | """ |
| 2588 | Get ZAP credentials for a URL (extracts host and looks up). |
| 2589 | |
| 2590 | Args: |
| 2591 | url: Full URL (e.g., "http://192.168.1.1:8080/app") |
| 2592 | |
| 2593 | Returns: |
| 2594 | Dict with credentials or None if not found |
| 2595 | """ |
| 2596 | import urllib.parse |
| 2597 | |
| 2598 | try: |
| 2599 | parsed = urllib.parse.urlparse(url) |
| 2600 | host = parsed.netloc or url |
| 2601 | |
| 2602 | # Try with port first, then without |
| 2603 | result = self.get_zap_credentials(host) |
| 2604 | if result: |
| 2605 | return result |
| 2606 | |
| 2607 | # Try without port |
| 2608 | host_no_port = host.split(':')[0] |
| 2609 | if host_no_port != host: |
no test coverage detected