Hi All,
I need help with an issue I’m encountering while using ZAP with Docker Webswing. Here’s the detailed context of my setup and the problem I’m facing:
When I attempt to run my Python script to interact with the ZAP API, I keep encountering errors related to API key validation and endpoint access. Below is a brief overview of the problem:
Python Script: Here’s a snippet of my Python script:
from zapv2 import ZAPv2
import time
# Set the target URL
target_url = 'http://example.com'
# Initialize the ZAP API key and ZAP instance
zap_api_key = 'myapikey' # Retrieved from ZAP UI
zap_base_url = 'http://localhost:8080'
zap = ZAPv2(apikey=zap_api_key, proxies={'http': zap_base_url, 'https': zap_base_url})
# Start a new session
zap.core.new_session(name='new_session', overwrite=True)
# Start the spidering process
scan_response = zap.spider.scan(target_url)
API Endpoint Test: When I try to manually test the API endpoint using curl, I get a 404 response:
curl "http://localhost:8080/JSON/core/action/viewBaseUrls/?apikey=myapikey"
This results in:
HTTP ERROR 404 Not Found
URI: /JSON/core/action/viewBaseUrls/
STATUS: 404
MESSAGE: Not Found
I have already verified the following: