Skip to content

Commit bec9886

Browse files
authored
Merge pull request #125 from thc202/release/1.15.0
Update APIs and release 1.15.0
2 parents bc0581d + 5bf7b71 commit bec9886

File tree

13 files changed

+494
-36
lines changed

13 files changed

+494
-36
lines changed

CHANGELOG.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,22 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## [Unreleased]
7+
## [1.15.0] - 2025-01-20
8+
### Added
9+
- Add the API of the following add-on:
10+
- OAST Support
11+
12+
### Changed
13+
- Update core APIs for 2.16.
14+
- Update the APIs of the following add-ons:
15+
- AJAX Spider
16+
- Import/Export
17+
- OpenAPI Support
18+
- Passive Scanner
19+
- Replacer
20+
- Script Console
21+
- Selenium
22+
- Spider
823

924
## [1.14.0] - 2024-05-13
1025
### Changed
@@ -199,7 +214,7 @@ of the alert (zaproxy/zaproxy#1341), older methods were deprecated.
199214
- First version as "stand alone library", it was migrated from the [zaproxy repository](https://github.com/zaproxy/zaproxy)
200215
and released to Maven Central.
201216

202-
[Unreleased]: https://github.com/zaproxy/zap-api-java/compare/v1.14.0...HEAD
217+
[1.15.0]: https://github.com/zaproxy/zap-api-java/compare/v1.14.0...v1.15.0
203218
[1.14.0]: https://github.com/zaproxy/zap-api-java/compare/v1.13.0...v1.14.0
204219
[1.13.0]: https://github.com/zaproxy/zap-api-java/compare/v1.12.0...v1.13.0
205220
[1.12.0]: https://github.com/zaproxy/zap-api-java/compare/v1.11.0...v1.12.0

subprojects/zap-clientapi/src/main/java/org/zaproxy/clientapi/core/ClientApi.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
import org.zaproxy.clientapi.gen.Graphql;
6868
import org.zaproxy.clientapi.gen.HttpSessions;
6969
import org.zaproxy.clientapi.gen.Network;
70+
import org.zaproxy.clientapi.gen.Oast;
7071
import org.zaproxy.clientapi.gen.Openapi;
7172
import org.zaproxy.clientapi.gen.Params;
7273
import org.zaproxy.clientapi.gen.Pnh;
@@ -143,6 +144,7 @@ public class ClientApi {
143144
new org.zaproxy.clientapi.gen.LocalProxies(this);
144145

145146
public Network network = new Network(this);
147+
public Oast oast = new Oast(this);
146148
public Openapi openapi = new Openapi(this);
147149
public Params params = new Params(this);
148150
public Pnh pnh = new Pnh(this);

subprojects/zap-clientapi/src/main/java/org/zaproxy/clientapi/gen/AjaxSpider.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ public ApiResponse optionClickElemsOnce() throws ClientApiException {
187187
return api.callApi("ajaxSpider", "view", "optionClickElemsOnce", null);
188188
}
189189

190+
/** This component is optional and therefore the API will only work if it is installed */
191+
public ApiResponse optionEnableExtensions() throws ClientApiException {
192+
return api.callApi("ajaxSpider", "view", "optionEnableExtensions", null);
193+
}
194+
190195
/**
191196
* Gets if the AJAX Spider will use random values in form fields when crawling, if set to true.
192197
*
@@ -411,6 +416,13 @@ public ApiResponse setOptionClickElemsOnce(boolean bool) throws ClientApiExcepti
411416
return api.callApi("ajaxSpider", "action", "setOptionClickElemsOnce", map);
412417
}
413418

419+
/** This component is optional and therefore the API will only work if it is installed */
420+
public ApiResponse setOptionEnableExtensions(boolean bool) throws ClientApiException {
421+
Map<String, String> map = new HashMap<>();
422+
map.put("Boolean", Boolean.toString(bool));
423+
return api.callApi("ajaxSpider", "action", "setOptionEnableExtensions", map);
424+
}
425+
414426
/**
415427
* Sets the time to wait after an event (in milliseconds). For example: the wait delay after the
416428
* cursor hovers over an element, in order for a menu to display, etc.

subprojects/zap-clientapi/src/main/java/org/zaproxy/clientapi/gen/Exim.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,28 @@ public ApiResponse importModsec2Logs(String filepath) throws ClientApiException
7979
return api.callApi("exim", "action", "importModsec2Logs", map);
8080
}
8181

82+
/**
83+
* Exports the Sites Tree in the Sites Tree YAML format.
84+
*
85+
* <p>This component is optional and therefore the API will only work if it is installed
86+
*/
87+
public ApiResponse exportSitesTree(String filepath) throws ClientApiException {
88+
Map<String, String> map = new HashMap<>();
89+
map.put("filePath", filepath);
90+
return api.callApi("exim", "action", "exportSitesTree", map);
91+
}
92+
93+
/**
94+
* Prunes the Sites Tree based on a file in the Sites Tree YAML format.
95+
*
96+
* <p>This component is optional and therefore the API will only work if it is installed
97+
*/
98+
public ApiResponse pruneSitesTree(String filepath) throws ClientApiException {
99+
Map<String, String> map = new HashMap<>();
100+
map.put("filePath", filepath);
101+
return api.callApi("exim", "action", "pruneSitesTree", map);
102+
}
103+
82104
/**
83105
* Gets the HTTP messages sent through/by ZAP, in HAR format, optionally filtered by URL and
84106
* paginated with 'start' position and 'count' of messages
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
/*
2+
* Zed Attack Proxy (ZAP) and its related class files.
3+
*
4+
* ZAP is an HTTP/HTTPS proxy for assessing web application security.
5+
*
6+
* Copyright 2025 The ZAP Development Team
7+
*
8+
* Licensed under the Apache License, Version 2.0 (the "License");
9+
* you may not use this file except in compliance with the License.
10+
* You may obtain a copy of the License at
11+
*
12+
* http://www.apache.org/licenses/LICENSE-2.0
13+
*
14+
* Unless required by applicable law or agreed to in writing, software
15+
* distributed under the License is distributed on an "AS IS" BASIS,
16+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
* See the License for the specific language governing permissions and
18+
* limitations under the License.
19+
*/
20+
package org.zaproxy.clientapi.gen;
21+
22+
import java.util.HashMap;
23+
import java.util.Map;
24+
import org.zaproxy.clientapi.core.ApiResponse;
25+
import org.zaproxy.clientapi.core.ClientApi;
26+
import org.zaproxy.clientapi.core.ClientApiException;
27+
28+
/** This file was automatically generated. */
29+
@SuppressWarnings("javadoc")
30+
public class Oast {
31+
32+
private final ClientApi api;
33+
34+
public Oast(ClientApi api) {
35+
this.api = api;
36+
}
37+
38+
/**
39+
* Gets the service used with the active scanner, if any.
40+
*
41+
* <p>This component is optional and therefore the API will only work if it is installed
42+
*/
43+
public ApiResponse getActiveScanService() throws ClientApiException {
44+
return api.callApi("oast", "view", "getActiveScanService", null);
45+
}
46+
47+
/**
48+
* Gets all of the services.
49+
*
50+
* <p>This component is optional and therefore the API will only work if it is installed
51+
*/
52+
public ApiResponse getServices() throws ClientApiException {
53+
return api.callApi("oast", "view", "getServices", null);
54+
}
55+
56+
/**
57+
* Gets the BOAST options.
58+
*
59+
* <p>This component is optional and therefore the API will only work if it is installed
60+
*/
61+
public ApiResponse getBoastOptions() throws ClientApiException {
62+
return api.callApi("oast", "view", "getBoastOptions", null);
63+
}
64+
65+
/**
66+
* Gets the Callback options.
67+
*
68+
* <p>This component is optional and therefore the API will only work if it is installed
69+
*/
70+
public ApiResponse getCallbackOptions() throws ClientApiException {
71+
return api.callApi("oast", "view", "getCallbackOptions", null);
72+
}
73+
74+
/**
75+
* Gets the Interactsh options.
76+
*
77+
* <p>This component is optional and therefore the API will only work if it is installed
78+
*/
79+
public ApiResponse getInteractshOptions() throws ClientApiException {
80+
return api.callApi("oast", "view", "getInteractshOptions", null);
81+
}
82+
83+
/**
84+
* Gets the number of days the OAST records will be kept for.
85+
*
86+
* <p>This component is optional and therefore the API will only work if it is installed
87+
*/
88+
public ApiResponse getDaysToKeepRecords() throws ClientApiException {
89+
return api.callApi("oast", "view", "getDaysToKeepRecords", null);
90+
}
91+
92+
/**
93+
* Sets the service used with the active scanner.
94+
*
95+
* <p>This component is optional and therefore the API will only work if it is installed
96+
*/
97+
public ApiResponse setActiveScanService(String name) throws ClientApiException {
98+
Map<String, String> map = new HashMap<>();
99+
map.put("name", name);
100+
return api.callApi("oast", "action", "setActiveScanService", map);
101+
}
102+
103+
/**
104+
* Sets the BOAST options.
105+
*
106+
* <p>This component is optional and therefore the API will only work if it is installed
107+
*/
108+
public ApiResponse setBoastOptions(String server, String pollinsecs) throws ClientApiException {
109+
Map<String, String> map = new HashMap<>();
110+
map.put("server", server);
111+
map.put("pollInSecs", pollinsecs);
112+
return api.callApi("oast", "action", "setBoastOptions", map);
113+
}
114+
115+
/**
116+
* Sets the Callback options.
117+
*
118+
* <p>This component is optional and therefore the API will only work if it is installed
119+
*/
120+
public ApiResponse setCallbackOptions(String localaddress, String remoteaddress, String port)
121+
throws ClientApiException {
122+
Map<String, String> map = new HashMap<>();
123+
map.put("localAddress", localaddress);
124+
map.put("remoteAddress", remoteaddress);
125+
map.put("port", port);
126+
return api.callApi("oast", "action", "setCallbackOptions", map);
127+
}
128+
129+
/**
130+
* Sets the Interactsh options.
131+
*
132+
* <p>This component is optional and therefore the API will only work if it is installed
133+
*/
134+
public ApiResponse setInteractshOptions(String server, String pollinsecs, String authtoken)
135+
throws ClientApiException {
136+
Map<String, String> map = new HashMap<>();
137+
map.put("server", server);
138+
map.put("pollInSecs", pollinsecs);
139+
map.put("authToken", authtoken);
140+
return api.callApi("oast", "action", "setInteractshOptions", map);
141+
}
142+
143+
/**
144+
* Sets the number of days the OAST records will be kept for.
145+
*
146+
* <p>This component is optional and therefore the API will only work if it is installed
147+
*/
148+
public ApiResponse setDaysToKeepRecords(String days) throws ClientApiException {
149+
Map<String, String> map = new HashMap<>();
150+
map.put("days", days);
151+
return api.callApi("oast", "action", "setDaysToKeepRecords", map);
152+
}
153+
}

subprojects/zap-clientapi/src/main/java/org/zaproxy/clientapi/gen/Openapi.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public Openapi(ClientApi api) {
4141
*
4242
* <p>This component is optional and therefore the API will only work if it is installed
4343
*/
44-
public ApiResponse importFile(String file, String target, String contextid)
44+
public ApiResponse importFile(String file, String target, String contextid, String userid)
4545
throws ClientApiException {
4646
Map<String, String> map = new HashMap<>();
4747
map.put("file", file);
@@ -51,6 +51,9 @@ public ApiResponse importFile(String file, String target, String contextid)
5151
if (contextid != null) {
5252
map.put("contextId", contextid);
5353
}
54+
if (userid != null) {
55+
map.put("userId", userid);
56+
}
5457
return api.callApi("openapi", "action", "importFile", map);
5558
}
5659

@@ -59,7 +62,7 @@ public ApiResponse importFile(String file, String target, String contextid)
5962
*
6063
* <p>This component is optional and therefore the API will only work if it is installed
6164
*/
62-
public ApiResponse importUrl(String url, String hostoverride, String contextid)
65+
public ApiResponse importUrl(String url, String hostoverride, String contextid, String userid)
6366
throws ClientApiException {
6467
Map<String, String> map = new HashMap<>();
6568
map.put("url", url);
@@ -69,6 +72,9 @@ public ApiResponse importUrl(String url, String hostoverride, String contextid)
6972
if (contextid != null) {
7073
map.put("contextId", contextid);
7174
}
75+
if (userid != null) {
76+
map.put("userId", userid);
77+
}
7278
return api.callApi("openapi", "action", "importUrl", map);
7379
}
7480
}

0 commit comments

Comments
 (0)