Skip to content

Commit 0dbf788

Browse files
authored
Merge pull request #84 from thc202/regen-2.9.0
Regenerate APIs
2 parents aa29ac3 + 929ac5c commit 0dbf788

File tree

16 files changed

+715
-14
lines changed

16 files changed

+715
-14
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [Unreleased]
88
### Added
99
- Core APIs from ZAP version 2.8.0.
10+
- APIs from add-ons:
11+
- Access Control Testing;
12+
- Export Report;
13+
- Revisit;
14+
- Wappalyzer - Technology Detection.
15+
16+
### Changed
17+
- Core APIs updated for ZAP version 2.9.0.
18+
- Update APIs from add-ons:
19+
- Alert Filters;
20+
- OpenAPI Support;
21+
- Replacer.
1022

1123
## [1.7.0] - 2019-06-13
1224
### Added

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import javax.xml.parsers.DocumentBuilderFactory;
4848
import javax.xml.parsers.ParserConfigurationException;
4949
import org.w3c.dom.Document;
50+
import org.zaproxy.clientapi.gen.AccessControl;
5051
import org.zaproxy.clientapi.gen.Acsrf;
5152
import org.zaproxy.clientapi.gen.AjaxSpider;
5253
import org.zaproxy.clientapi.gen.AlertFilter;
@@ -57,6 +58,7 @@
5758
import org.zaproxy.clientapi.gen.Break;
5859
import org.zaproxy.clientapi.gen.Context;
5960
import org.zaproxy.clientapi.gen.Core;
61+
import org.zaproxy.clientapi.gen.Exportreport;
6062
import org.zaproxy.clientapi.gen.ForcedUser;
6163
import org.zaproxy.clientapi.gen.HttpSessions;
6264
import org.zaproxy.clientapi.gen.ImportLogFiles;
@@ -68,6 +70,7 @@
6870
import org.zaproxy.clientapi.gen.Pscan;
6971
import org.zaproxy.clientapi.gen.Replacer;
7072
import org.zaproxy.clientapi.gen.Reveal;
73+
import org.zaproxy.clientapi.gen.Revisit;
7174
import org.zaproxy.clientapi.gen.RuleConfig;
7275
import org.zaproxy.clientapi.gen.Script;
7376
import org.zaproxy.clientapi.gen.Search;
@@ -77,6 +80,7 @@
7780
import org.zaproxy.clientapi.gen.Spider;
7881
import org.zaproxy.clientapi.gen.Stats;
7982
import org.zaproxy.clientapi.gen.Users;
83+
import org.zaproxy.clientapi.gen.Wappalyzer;
8084
import org.zaproxy.clientapi.gen.Websocket;
8185

8286
public class ClientApi {
@@ -98,6 +102,7 @@ public class ClientApi {
98102
private DocumentBuilderFactory docBuilderFactory;
99103

100104
// Note that any new API implementations added have to be added here manually
105+
public AccessControl accessControl = new AccessControl(this);
101106
public Acsrf acsrf = new Acsrf(this);
102107
public AjaxSpider ajaxSpider = new AjaxSpider(this);
103108
public AlertFilter alertFilter = new AlertFilter(this);
@@ -109,6 +114,7 @@ public class ClientApi {
109114
public Break brk = new Break(this);
110115
public Context context = new Context(this);
111116
public Core core = new Core(this);
117+
public Exportreport exportreport = new Exportreport(this);
112118
public ForcedUser forcedUser = new ForcedUser(this);
113119
public HttpSessions httpSessions = new HttpSessions(this);
114120
public ImportLogFiles logImportFiles = new ImportLogFiles(this);
@@ -120,6 +126,7 @@ public class ClientApi {
120126
public Pscan pscan = new Pscan(this);
121127
public Replacer replacer = new Replacer(this);
122128
public Reveal reveal = new Reveal(this);
129+
public Revisit revisit = new Revisit(this);
123130
public RuleConfig ruleConfig = new RuleConfig(this);
124131
public Search search = new Search(this);
125132
public Script script = new Script(this);
@@ -129,6 +136,7 @@ public class ClientApi {
129136
public Spider spider = new Spider(this);
130137
public Stats stats = new Stats(this);
131138
public Users users = new Users(this);
139+
public Wappalyzer wappalyzer = new Wappalyzer(this);
132140
public Websocket websocket = new Websocket(this);
133141

134142
public ClientApi(String zapAddress, int zapPort) {
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
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 2020 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 AccessControl {
31+
32+
private final ClientApi api;
33+
34+
public AccessControl(ClientApi api) {
35+
this.api = api;
36+
}
37+
38+
/**
39+
* Gets the Access Control scan progress (percentage integer) for the given context ID.
40+
*
41+
* <p>This component is optional and therefore the API will only work if it is installed
42+
*/
43+
public ApiResponse getScanProgress(String contextid) throws ClientApiException {
44+
Map<String, String> map = new HashMap<>();
45+
map.put("contextId", contextid);
46+
return api.callApi("accessControl", "view", "getScanProgress", map);
47+
}
48+
49+
/**
50+
* Gets the Access Control scan status (description string) for the given context ID.
51+
*
52+
* <p>This component is optional and therefore the API will only work if it is installed
53+
*/
54+
public ApiResponse getScanStatus(String contextid) throws ClientApiException {
55+
Map<String, String> map = new HashMap<>();
56+
map.put("contextId", contextid);
57+
return api.callApi("accessControl", "view", "getScanStatus", map);
58+
}
59+
60+
/**
61+
* Starts an Access Control scan with the given context ID and user ID. (Optional parameters:
62+
* user ID for Unauthenticated user, boolean identifying whether or not Alerts are raised, and
63+
* the Risk level for the Alerts.) [This assumes the Access Control rules were previously
64+
* established via ZAP gui and the necessary Context exported/imported.]
65+
*
66+
* <p>This component is optional and therefore the API will only work if it is installed
67+
*/
68+
public ApiResponse scan(
69+
String contextid,
70+
String userid,
71+
String scanasunauthuser,
72+
String raisealert,
73+
String alertrisklevel)
74+
throws ClientApiException {
75+
Map<String, String> map = new HashMap<>();
76+
map.put("contextId", contextid);
77+
map.put("userId", userid);
78+
if (scanasunauthuser != null) {
79+
map.put("scanAsUnAuthUser", scanasunauthuser);
80+
}
81+
if (raisealert != null) {
82+
map.put("raiseAlert", raisealert);
83+
}
84+
if (alertrisklevel != null) {
85+
map.put("alertRiskLevel", alertrisklevel);
86+
}
87+
return api.callApi("accessControl", "action", "scan", map);
88+
}
89+
90+
/**
91+
* Generates an Access Control report for the given context ID and saves it based on the
92+
* provided filename (path).
93+
*
94+
* <p>This component is optional and therefore the API will only work if it is installed
95+
*/
96+
public ApiResponse writeHTMLreport(String contextid, String filename)
97+
throws ClientApiException {
98+
Map<String, String> map = new HashMap<>();
99+
map.put("contextId", contextid);
100+
map.put("fileName", filename);
101+
return api.callApi("accessControl", "action", "writeHTMLreport", map);
102+
}
103+
}

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

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,105 @@ public ApiResponse deleteAlert(String id) throws ClientApiException {
127127
map.put("id", id);
128128
return api.callApi("alert", "action", "deleteAlert", map);
129129
}
130+
131+
/** Update the alert with the given ID, with the provided details. */
132+
public ApiResponse updateAlert(
133+
String id,
134+
String name,
135+
String riskid,
136+
String confidenceid,
137+
String description,
138+
String param,
139+
String attack,
140+
String otherinfo,
141+
String solution,
142+
String references,
143+
String evidence,
144+
String cweid,
145+
String wascid)
146+
throws ClientApiException {
147+
Map<String, String> map = new HashMap<>();
148+
map.put("id", id);
149+
map.put("name", name);
150+
map.put("riskId", riskid);
151+
map.put("confidenceId", confidenceid);
152+
map.put("description", description);
153+
if (param != null) {
154+
map.put("param", param);
155+
}
156+
if (attack != null) {
157+
map.put("attack", attack);
158+
}
159+
if (otherinfo != null) {
160+
map.put("otherInfo", otherinfo);
161+
}
162+
if (solution != null) {
163+
map.put("solution", solution);
164+
}
165+
if (references != null) {
166+
map.put("references", references);
167+
}
168+
if (evidence != null) {
169+
map.put("evidence", evidence);
170+
}
171+
if (cweid != null) {
172+
map.put("cweId", cweid);
173+
}
174+
if (wascid != null) {
175+
map.put("wascId", wascid);
176+
}
177+
return api.callApi("alert", "action", "updateAlert", map);
178+
}
179+
180+
/**
181+
* Add an alert associated with the given message ID, with the provided details. (The ID of the
182+
* created alert is returned.)
183+
*/
184+
public ApiResponse addAlert(
185+
String messageid,
186+
String name,
187+
String riskid,
188+
String confidenceid,
189+
String description,
190+
String param,
191+
String attack,
192+
String otherinfo,
193+
String solution,
194+
String references,
195+
String evidence,
196+
String cweid,
197+
String wascid)
198+
throws ClientApiException {
199+
Map<String, String> map = new HashMap<>();
200+
map.put("messageId", messageid);
201+
map.put("name", name);
202+
map.put("riskId", riskid);
203+
map.put("confidenceId", confidenceid);
204+
map.put("description", description);
205+
if (param != null) {
206+
map.put("param", param);
207+
}
208+
if (attack != null) {
209+
map.put("attack", attack);
210+
}
211+
if (otherinfo != null) {
212+
map.put("otherInfo", otherinfo);
213+
}
214+
if (solution != null) {
215+
map.put("solution", solution);
216+
}
217+
if (references != null) {
218+
map.put("references", references);
219+
}
220+
if (evidence != null) {
221+
map.put("evidence", evidence);
222+
}
223+
if (cweid != null) {
224+
map.put("cweId", cweid);
225+
}
226+
if (wascid != null) {
227+
map.put("wascId", wascid);
228+
}
229+
return api.callApi("alert", "action", "addAlert", map);
230+
}
130231
}

0 commit comments

Comments
 (0)