public class ClientApi
extends java.lang.Object
Constructor and Description |
---|
ClientApi(java.lang.String zapAddress,
int zapPort) |
ClientApi(java.lang.String zapAddress,
int zapPort,
boolean debug) |
ClientApi(java.lang.String zapAddress,
int zapPort,
java.lang.String apiKey)
Constructs a
ClientApi with the given ZAP address/port and with the given API key, to be sent with all API
requests. |
ClientApi(java.lang.String zapAddress,
int zapPort,
java.lang.String apiKey,
boolean debug)
Constructs a
ClientApi with the given ZAP address/port and with the given API key, to be sent with all API
requests. |
Modifier and Type | Method and Description |
---|---|
void |
accessUrl(java.lang.String url) |
void |
activeScanSiteInScope(java.lang.String url)
Active scans the given site, that's in scope.
|
void |
activeScanSiteInScope(java.lang.String apikey,
java.lang.String url)
Deprecated.
(1.1.0) Use
activeScanSiteInScope(String) instead, the API key should be set using one of
the ClientApi constructors. |
void |
addExcludeFromContext(java.lang.String apikey,
java.lang.String contextName,
java.lang.String regex)
Deprecated.
(1.1.0) Use
Context.excludeFromContext(String, String) instead. |
void |
addIncludeInContext(java.lang.String apikey,
java.lang.String contextName,
java.lang.String regex)
Deprecated.
(1.1.0) Use
Context.includeInContext(String, String) instead. |
ApiResponse |
callApi(java.lang.String component,
java.lang.String type,
java.lang.String method,
java.util.Map<java.lang.String,java.lang.String> params) |
byte[] |
callApiOther(java.lang.String component,
java.lang.String type,
java.lang.String method,
java.util.Map<java.lang.String,java.lang.String> params) |
void |
checkAlerts(java.util.List<Alert> ignoreAlerts,
java.util.List<Alert> requireAlerts) |
void |
checkAlerts(java.util.List<Alert> ignoreAlerts,
java.util.List<Alert> requireAlerts,
java.io.File outputFile) |
java.util.List<Alert> |
getAlerts(java.lang.String baseUrl,
int start,
int count) |
void |
includeOneMatchingNodeInContext(java.lang.String contextName,
java.lang.String regex)
Includes just one of the nodes that match the given regular expression in the context with the given name.
|
void |
includeOneMatchingNodeInContext(java.lang.String apikey,
java.lang.String contextName,
java.lang.String regex)
Deprecated.
(1.1.0) Use
includeOneMatchingNodeInContext(String, String) instead. |
void |
setDebugStream(java.io.PrintStream debugStream) |
void |
waitForSuccessfulConnectionToZap(int timeoutInSeconds)
Convenience method to wait for ZAP to be ready to receive API calls, when started programmatically.
|
void |
waitForSuccessfulConnectionToZap(int timeoutInSeconds,
int pollingIntervalInMs)
Convenience method to wait for ZAP to be ready to receive API calls, when started programmatically.
|
public Acsrf acsrf
public AjaxSpider ajaxSpider
public AlertFilter alertFilter
public Ascan ascan
public Authentication authentication
public Authorization authorization
public Autoupdate autoupdate
public Break brk
public Context context
public Core core
public ForcedUser forcedUser
public HttpSessions httpSessions
public ImportLogFiles logImportFiles
public Importurls importurls
public Openapi openapi
public Params params
public Pnh pnh
public Pscan pscan
public Replacer replacer
public Reveal reveal
public Search search
public Script script
public Selenium selenium
public SessionManagement sessionManagement
public Spider spider
public Stats stats
public Users users
public ClientApi(java.lang.String zapAddress, int zapPort)
public ClientApi(java.lang.String zapAddress, int zapPort, java.lang.String apiKey)
ClientApi
with the given ZAP address/port and with the given API key, to be sent with all API
requests.zapAddress
- ZAP's addresszapPort
- ZAP's listening portapiKey
- the ZAP API key, might be null
or empty in which case is not used/sent.public ClientApi(java.lang.String zapAddress, int zapPort, boolean debug)
public ClientApi(java.lang.String zapAddress, int zapPort, java.lang.String apiKey, boolean debug)
ClientApi
with the given ZAP address/port and with the given API key, to be sent with all API
requests. Also, sets whether or not client API debug information should be written to the
debug stream
(by default the standard output stream).zapAddress
- ZAP's addresszapPort
- ZAP's listening portapiKey
- the ZAP API key, might be null
or empty in which case is not used/sent.debug
- true
if debug information should be written to debug stream, false
otherwise.public void setDebugStream(java.io.PrintStream debugStream)
public void accessUrl(java.lang.String url) throws ClientApiException
ClientApiException
public void checkAlerts(java.util.List<Alert> ignoreAlerts, java.util.List<Alert> requireAlerts) throws ClientApiException
ClientApiException
public void checkAlerts(java.util.List<Alert> ignoreAlerts, java.util.List<Alert> requireAlerts, java.io.File outputFile) throws ClientApiException
ClientApiException
public java.util.List<Alert> getAlerts(java.lang.String baseUrl, int start, int count) throws ClientApiException
ClientApiException
public ApiResponse callApi(java.lang.String component, java.lang.String type, java.lang.String method, java.util.Map<java.lang.String,java.lang.String> params) throws ClientApiException
ClientApiException
public byte[] callApiOther(java.lang.String component, java.lang.String type, java.lang.String method, java.util.Map<java.lang.String,java.lang.String> params) throws ClientApiException
ClientApiException
@Deprecated public void addExcludeFromContext(java.lang.String apikey, java.lang.String contextName, java.lang.String regex) throws java.lang.Exception
Context.excludeFromContext(String, String)
instead.apikey
- the API key, might be null
.contextName
- the name of the context.regex
- the regular expression to add.java.lang.Exception
- if an error occurred while calling the API.context
@Deprecated public void addIncludeInContext(java.lang.String apikey, java.lang.String contextName, java.lang.String regex) throws java.lang.Exception
Context.includeInContext(String, String)
instead.apikey
- the API key, might be null
.contextName
- the name of the context.regex
- the regular expression to add.java.lang.Exception
- if an error occurred while calling the API.context
@Deprecated public void includeOneMatchingNodeInContext(java.lang.String apikey, java.lang.String contextName, java.lang.String regex) throws java.lang.Exception
includeOneMatchingNodeInContext(String, String)
instead.Nodes that do not match the regular expression are excluded.
apikey
- the API key, might be null
.contextName
- the name of the context.regex
- the regular expression to match the node/URL.java.lang.Exception
- if an error occurred while calling the API.public void includeOneMatchingNodeInContext(java.lang.String contextName, java.lang.String regex) throws java.lang.Exception
Nodes that do not match the regular expression are excluded.
contextName
- the name of the context.regex
- the regular expression to match the node/URL.java.lang.Exception
- if an error occurred while calling the API.@Deprecated public void activeScanSiteInScope(java.lang.String apikey, java.lang.String url) throws java.lang.Exception
activeScanSiteInScope(String)
instead, the API key should be set using one of
the ClientApi
constructors.The method returns only after the scan has finished.
apikey
- the API key, might be null
.url
- the site to scanjava.lang.Exception
- if an error occurred while calling the API.public void activeScanSiteInScope(java.lang.String url) throws java.lang.Exception
The method returns only after the scan has finished.
url
- the site to scanjava.lang.Exception
- if an error occurred while calling the API.public void waitForSuccessfulConnectionToZap(int timeoutInSeconds) throws ClientApiException
It attempts to establish a connection to ZAP's proxy, in the given time, throwing an exception if the connection is not successful. The connection attempts might be polled in one second interval.
timeoutInSeconds
- the (maximum) number of seconds to wait for ZAP to startClientApiException
- if the timeout was reached or if the thread was interrupted while waitingwaitForSuccessfulConnectionToZap(int, int)
public void waitForSuccessfulConnectionToZap(int timeoutInSeconds, int pollingIntervalInMs) throws ClientApiException
It attempts to establish a connection to ZAP's proxy, in the given time, throwing an exception if the connection is not successful. The connection attempts are done with the given polling interval.
timeoutInSeconds
- the (maximum) number of seconds to wait for ZAP to startpollingIntervalInMs
- the interval, in milliseconds, for connection pollingClientApiException
- if the timeout was reached or if the thread was interrupted while waiting.java.lang.IllegalArgumentException
- if the interval for connection polling is negative.waitForSuccessfulConnectionToZap(int)