Report Generation via the ZAP client api

71 views
Skip to first unread message

Emhammed Zouaghi

unread,
Jul 26, 2023, 4:49:50 AM7/26/23
to OWASP ZAP User Group
Hello,

I use ZAP as a proxy when I run my cucumber tests. Then I use the client api method 
"public ApiResponse generate​(java.lang.String title, java.lang.String template, java.lang.String theme, java.lang.String description, java.lang.String contexts, java.lang.String sites, java.lang.String sections, java.lang.String includedconfidences, java.lang.String includedrisks, java.lang.String reportfilename, java.lang.String reportfilenamepattern, java.lang.String reportdir, java.lang.String display) throws ClientApiException" to generate the report.
The problem is that the report is not available immediately, I mean it needs some time to gather all the information in the report. That's why I have to wait some seconds after the cucumber tests before the execution of the method generate(). 

My question is: is there any way to know how much time I have to wait before generation the report ? or is there any way to get notified when the report is ready to be generated ? 

Thank you in advance



thc...@gmail.com

unread,
Jul 26, 2023, 6:11:34 AM7/26/23
to zaprox...@googlegroups.com
Hi.

I assume you referring to the passive scanner? If so you should use the
method/endpoint `pscan.recordsToScan()`, e.g.:
https://github.com/zaproxy/zap-api-java/blob/d9e721f3fd330f2d24b0bbd004ca5bc2cdc5a710/subprojects/zap-clientapi/src/examples/java/org/zaproxy/clientapi/examples/SimpleExample.java#L72-L81


Best regards.

On 26/07/2023 09:49, Emhammed Zouaghi wrote:
> Hello,
>
> I use ZAP as a proxy when I run my cucumber tests. Then I use the client
> api method
> "public ApiResponse
> <https://www.javadoc.io/static/org.zaproxy/zap-clientapi/1.12.0/org/zaproxy/clientapi/core/ApiResponse.html> generate​(java.lang.String title,
> java.lang.String template, java.lang.String theme,
> java.lang.String description, java.lang.String contexts,
> java.lang.String sites, java.lang.String sections,
> java.lang.String includedconfidences, java.lang.String includedrisks,
> java.lang.String reportfilename, java.lang.String reportfilenamepattern,
> java.lang.String reportdir, java.lang.String display) throws
> ClientApiException
> <https://www.javadoc.io/static/org.zaproxy/zap-clientapi/1.12.0/org/zaproxy/clientapi/core/ClientApiException.html>"

Emhammed Zouaghi

unread,
Jul 26, 2023, 8:19:05 AM7/26/23
to OWASP ZAP User Group
This works and it resolved my problem, thank you so much !
Reply all
Reply to author
Forward
0 new messages