-2

When I executed the Spider scan using the Java API of ZAP I got expected results as follows:

  • Code:

    System.out.println("Spider completed");
    List<ApiResponse> spiderResults = ((ApiResponseList)api.spider.results(scanID)).getItems(); 
    // printing Spider results  
    for (ApiResponse spiderResult:spiderResults) 
        System.out.println(spiderResult);
    
  • Console Output:

    Spider completed
    https://public-firing-range.appspot.com/sitemap.xml
    https://public-firing-range.appspot.com/robots.txt
    https://public-firing-range.appspot.com
    

But when I execute the AjaxSpider scan using the Java API of ZAP I don't get the results as expected as obtained from Spider scan output.

  • Code:

    System.out.println("Ajax Spider completed");
    List<ApiResponse> ajaxSpiderResponse = ((ApiResponseList) api.ajaxSpider.results("0", "10")).getItems();
    // printing Spider results  
    for (ApiResponse ajaxSpiderResp:ajaxSpiderResponse) 
        System.out.println(ajaxSpiderResp);
    
  • Console Output:

    Ajax Spider completed
    org.zaproxy.clientapi.core.ApiResponseSet@5ce65a89
    org.zaproxy.clientapi.core.ApiResponseSet@25f38edc
    org.zaproxy.clientapi.core.ApiResponseSet@1a86f2f1
    org.zaproxy.clientapi.core.ApiResponseSet@3eb07fd3
    org.zaproxy.clientapi.core.ApiResponseSet@506c589e
    org.zaproxy.clientapi.core.ApiResponseSet@69d0a921
    org.zaproxy.clientapi.core.ApiResponseSet@446cdf90
    org.zaproxy.clientapi.core.ApiResponseSet@799f7e29
    org.zaproxy.clientapi.core.ApiResponseSet@4b85612c
    org.zaproxy.clientapi.core.ApiResponseSet@277050dc
    

How can I retrieve the results of AjaxSpider scan using the Java API of ZAP in human readable format. I am not sure what I am missing here. Can anyone help me out?

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352

1 Answers1

1

ApiResponseSet is a Java class: https://github.com/zaproxy/zap-api-java/blob/develop/subprojects/zap-clientapi/src/main/java/org/zaproxy/clientapi/core/ApiResponseSet.java

You can use the toString(0) method to get a human readable format and the other methods to extract any of the contents.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Simon Bennetts
  • 5,479
  • 1
  • 14
  • 26