ZAP API Java Client

388 views
Skip to first unread message

rb

unread,
Jul 7, 2014, 8:03:04 PM7/7/14
to zaprox...@googlegroups.com
Hi,
I am using the latest ZAP API Java Client (Zap-api-V2-8.jar). I would like to scan using this client so I do this. clientApi.ascan.scan(String arg0, String arg1, String arg2, String arg3). I do not know what the 4th argument is. This method signature does not match the java docs. (http://zaproxy.googlecode.com/svn/trunk/javadocs/org/zaproxy/clientapi/gen/Ascan.html)
public ApiResponse scan(String url,
               String recurse,
               String inscopeonly)
                 throws ClientApiException


I get this error:
org.zaproxy.clientapi.core.ClientApiException: org.zaproxy.clientapi.core.ClientApiException: java.net.SocketException: Unexpected end of file from server
	at org.zaproxy.clientapi.core.ClientApi.callApi(Unknown Source)
	at org.zaproxy.clientapi.gen.Ascan.scan(Unknown Source)
	at listeners.ScanTest.startScan(ScanTest.java:46)
	at listeners.ScanTest.main(ScanTest.java:28)

What should be the correct method used to scan?

Thanks

Simon Bennetts

unread,
Jul 8, 2014, 4:29:56 AM7/8/14
to zaprox...@googlegroups.com
Ah, those java docs have not been updated for a while :/
I'll do that now, but uploading them may take a while.
You are probably using 2.3.1?
If so strictly speaking you should use the java docs from the 2.3 branch, which are up to date :)
http://zaproxy.googlecode.com/svn/branches/2.3/javadocs/org/zaproxy/clientapi/gen/Ascan.html

public ApiResponse scan(String apikey,
               
String url,
               String recurse,
               String inscopeonly)
                 throws ClientApiException

Throws:
ClientApiException

The parameters are:
  • apikey - an empty string unless you have configured an apikey via the options/API
  • url - the url you want to scan, eg http://www.example.com
  • recurse - the strings "True" or "False" depending on whether you want to recurse down the (internal) sites tree or just scan one page
  • inscopeonly - the strings "True" or "False" depending on whether you want toonly scan pages that are in scope or not. If you havnt specified any Contexts then supply "False"

Cheers,

Simon

Simon Bennetts

unread,
Jul 8, 2014, 4:55:36 AM7/8/14
to zaprox...@googlegroups.com
Trunk javadocs now updated :)
Reply all
Reply to author
Forward
0 new messages