Hi Soumya,
Regarding your issue with ZAP CLI authentication in daemon mode, it seems the problem was likely due to incorrectly configured form-based authentication and a login request lacking proper placeholders for credentials (and potentially CSRF tokens).
Here's a step-by-step solution to configure ZAP CLI for authentication in daemon mode:
1. **Start ZAP in daemon mode:**
`zap-cli start --daemon`
2. **Include the target URL in the context:**
`zap-cli context include-url DefaultContext [
http://example.com](
http://example.com)`
3. **Set credentials with placeholders:**
`zap-cli set-credentials --context-name DefaultContext --username <username> --password <password> --login-url [
http://example.com/login](http://example.com/login) --login-request-body "username={%username%}&password={%password%}"`
4. **Open login page:**
`zap-cli open-url [
http://example.com/login](http://example.com/login)`5. **Run spider and active scan:**
`zap-cli spider [
http://example.com](
http://example.com)`
`zap-cli active-scan [
http://example.com](
http://example.com)`
Remember to include any extra form fields or CSRF tokens if your application's authentication requires them for a successful login. This approach ensures that ZAP correctly handles the authentication process within your automated scans.
Best regards,
Md Zia