Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9e81e4a

Browse filesBrowse files
authored
Merge pull request zaproxy#4 from thc202/ajaxspider-v16
Regenerate AJAX Spider API (v16)
2 parents ef79f48 + 56c1a25 commit 9e81e4a
Copy full SHA for 9e81e4a

File tree

Expand file treeCollapse file tree

2 files changed

+67
-54
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+67
-54
lines changed

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

Copy file name to clipboardExpand all lines: subprojects/zap-clientapi/src/main/java/org/zaproxy/clientapi/gen/AjaxSpider.java
+66-53Lines changed: 66 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
*/
3333
public class AjaxSpider {
3434

35-
private ClientApi api = null;
35+
private final ClientApi api;
3636

3737
public AjaxSpider(ClientApi api) {
3838
this.api = api;
@@ -42,16 +42,14 @@ public AjaxSpider(ClientApi api) {
4242
* This component is optional and therefore the API will only work if it is installed
4343
*/
4444
public ApiResponse status() throws ClientApiException {
45-
Map<String, String> map = null;
46-
return api.callApi("ajaxSpider", "view", "status", map);
45+
return api.callApi("ajaxSpider", "view", "status", null);
4746
}
4847

4948
/**
5049
* This component is optional and therefore the API will only work if it is installed
5150
*/
5251
public ApiResponse results(String start, String count) throws ClientApiException {
53-
Map<String, String> map = null;
54-
map = new HashMap<String, String>();
52+
Map<String, String> map = new HashMap<>();
5553
if (start != null) {
5654
map.put("start", start);
5755
}
@@ -65,112 +63,137 @@ public ApiResponse results(String start, String count) throws ClientApiException
6563
* This component is optional and therefore the API will only work if it is installed
6664
*/
6765
public ApiResponse numberOfResults() throws ClientApiException {
68-
Map<String, String> map = null;
69-
return api.callApi("ajaxSpider", "view", "numberOfResults", map);
66+
return api.callApi("ajaxSpider", "view", "numberOfResults", null);
7067
}
7168

7269
/**
7370
* This component is optional and therefore the API will only work if it is installed
7471
*/
7572
public ApiResponse optionBrowserId() throws ClientApiException {
76-
Map<String, String> map = null;
77-
return api.callApi("ajaxSpider", "view", "optionBrowserId", map);
73+
return api.callApi("ajaxSpider", "view", "optionBrowserId", null);
7874
}
7975

8076
/**
8177
* This component is optional and therefore the API will only work if it is installed
8278
*/
8379
public ApiResponse optionEventWait() throws ClientApiException {
84-
Map<String, String> map = null;
85-
return api.callApi("ajaxSpider", "view", "optionEventWait", map);
80+
return api.callApi("ajaxSpider", "view", "optionEventWait", null);
8681
}
8782

8883
/**
8984
* This component is optional and therefore the API will only work if it is installed
9085
*/
9186
public ApiResponse optionMaxCrawlDepth() throws ClientApiException {
92-
Map<String, String> map = null;
93-
return api.callApi("ajaxSpider", "view", "optionMaxCrawlDepth", map);
87+
return api.callApi("ajaxSpider", "view", "optionMaxCrawlDepth", null);
9488
}
9589

9690
/**
9791
* This component is optional and therefore the API will only work if it is installed
9892
*/
9993
public ApiResponse optionMaxCrawlStates() throws ClientApiException {
100-
Map<String, String> map = null;
101-
return api.callApi("ajaxSpider", "view", "optionMaxCrawlStates", map);
94+
return api.callApi("ajaxSpider", "view", "optionMaxCrawlStates", null);
10295
}
10396

10497
/**
10598
* This component is optional and therefore the API will only work if it is installed
10699
*/
107100
public ApiResponse optionMaxDuration() throws ClientApiException {
108-
Map<String, String> map = null;
109-
return api.callApi("ajaxSpider", "view", "optionMaxDuration", map);
101+
return api.callApi("ajaxSpider", "view", "optionMaxDuration", null);
110102
}
111103

112104
/**
113105
* This component is optional and therefore the API will only work if it is installed
114106
*/
115107
public ApiResponse optionNumberOfBrowsers() throws ClientApiException {
116-
Map<String, String> map = null;
117-
return api.callApi("ajaxSpider", "view", "optionNumberOfBrowsers", map);
108+
return api.callApi("ajaxSpider", "view", "optionNumberOfBrowsers", null);
118109
}
119110

120111
/**
121112
* This component is optional and therefore the API will only work if it is installed
122113
*/
123114
public ApiResponse optionReloadWait() throws ClientApiException {
124-
Map<String, String> map = null;
125-
return api.callApi("ajaxSpider", "view", "optionReloadWait", map);
115+
return api.callApi("ajaxSpider", "view", "optionReloadWait", null);
126116
}
127117

128118
/**
129119
* This component is optional and therefore the API will only work if it is installed
130120
*/
131121
public ApiResponse optionClickDefaultElems() throws ClientApiException {
132-
Map<String, String> map = null;
133-
return api.callApi("ajaxSpider", "view", "optionClickDefaultElems", map);
122+
return api.callApi("ajaxSpider", "view", "optionClickDefaultElems", null);
134123
}
135124

136125
/**
137126
* This component is optional and therefore the API will only work if it is installed
138127
*/
139128
public ApiResponse optionClickElemsOnce() throws ClientApiException {
140-
Map<String, String> map = null;
141-
return api.callApi("ajaxSpider", "view", "optionClickElemsOnce", map);
129+
return api.callApi("ajaxSpider", "view", "optionClickElemsOnce", null);
142130
}
143131

144132
/**
145133
* This component is optional and therefore the API will only work if it is installed
146134
*/
147135
public ApiResponse optionRandomInputs() throws ClientApiException {
148-
Map<String, String> map = null;
149-
return api.callApi("ajaxSpider", "view", "optionRandomInputs", map);
136+
return api.callApi("ajaxSpider", "view", "optionRandomInputs", null);
150137
}
151138

152139
/**
153-
* This component is optional and therefore the API will only work if it is installed
140+
* This component is optional and therefore the API will only work if it is installed.
154141
*/
155142
public ApiResponse scan(String apikey, String url, String inscope) throws ClientApiException {
156-
Map<String, String> map = null;
157-
map = new HashMap<String, String>();
143+
return scan(apikey, url, inscope, null, null);
144+
}
145+
146+
/**
147+
* Runs the spider against the given URL and/or context, optionally, spidering everything in scope. The parameter 'contextName' can be used to constrain the scan to a Context, the option 'in scope' is ignored if a context was also specified. The parameter 'subtreeOnly' allows to restrict the spider under a site's subtree (using the specified 'url').
148+
* <p>
149+
* This component is optional and therefore the API will only work if it is installed
150+
*/
151+
public ApiResponse scan(String apikey, String url, String inscope, String contextname, String subtreeonly) throws ClientApiException {
152+
Map<String, String> map = new HashMap<>();
158153
if (apikey != null) {
159154
map.put("apikey", apikey);
160155
}
161-
map.put("url", url);
156+
if (url != null) {
157+
map.put("url", url);
158+
}
162159
if (inscope != null) {
163160
map.put("inScope", inscope);
164161
}
162+
if (contextname != null) {
163+
map.put("contextName", contextname);
164+
}
165+
if (subtreeonly != null) {
166+
map.put("subtreeOnly", subtreeonly);
167+
}
165168
return api.callApi("ajaxSpider", "action", "scan", map);
166169
}
167170

171+
/**
172+
* Runs the spider from the perspective of a User, obtained using the given context name and user name. The parameter 'url' allows to specify the starting point for the spider, otherwise it's used an existing URL from the context (if any). The parameter 'subtreeOnly' allows to restrict the spider under a site's subtree (using the specified 'url').
173+
* <p>
174+
* This component is optional and therefore the API will only work if it is installed
175+
*/
176+
public ApiResponse scanAsUser(String apikey, String contextname, String username, String url, String subtreeonly) throws ClientApiException {
177+
Map<String, String> map = new HashMap<>();
178+
if (apikey != null) {
179+
map.put("apikey", apikey);
180+
}
181+
map.put("contextName", contextname);
182+
map.put("userName", username);
183+
if (url != null) {
184+
map.put("url", url);
185+
}
186+
if (subtreeonly != null) {
187+
map.put("subtreeOnly", subtreeonly);
188+
}
189+
return api.callApi("ajaxSpider", "action", "scanAsUser", map);
190+
}
191+
168192
/**
169193
* This component is optional and therefore the API will only work if it is installed
170194
*/
171195
public ApiResponse stop(String apikey) throws ClientApiException {
172-
Map<String, String> map = null;
173-
map = new HashMap<String, String>();
196+
Map<String, String> map = new HashMap<>();
174197
if (apikey != null) {
175198
map.put("apikey", apikey);
176199
}
@@ -181,8 +204,7 @@ public ApiResponse stop(String apikey) throws ClientApiException {
181204
* This component is optional and therefore the API will only work if it is installed
182205
*/
183206
public ApiResponse setOptionBrowserId(String apikey, String string) throws ClientApiException {
184-
Map<String, String> map = null;
185-
map = new HashMap<String, String>();
207+
Map<String, String> map = new HashMap<>();
186208
if (apikey != null) {
187209
map.put("apikey", apikey);
188210
}
@@ -194,8 +216,7 @@ public ApiResponse setOptionBrowserId(String apikey, String string) throws Clien
194216
* This component is optional and therefore the API will only work if it is installed
195217
*/
196218
public ApiResponse setOptionClickDefaultElems(String apikey, boolean bool) throws ClientApiException {
197-
Map<String, String> map = null;
198-
map = new HashMap<String, String>();
219+
Map<String, String> map = new HashMap<>();
199220
if (apikey != null) {
200221
map.put("apikey", apikey);
201222
}
@@ -207,8 +228,7 @@ public ApiResponse setOptionClickDefaultElems(String apikey, boolean bool) throw
207228
* This component is optional and therefore the API will only work if it is installed
208229
*/
209230
public ApiResponse setOptionClickElemsOnce(String apikey, boolean bool) throws ClientApiException {
210-
Map<String, String> map = null;
211-
map = new HashMap<String, String>();
231+
Map<String, String> map = new HashMap<>();
212232
if (apikey != null) {
213233
map.put("apikey", apikey);
214234
}
@@ -220,8 +240,7 @@ public ApiResponse setOptionClickElemsOnce(String apikey, boolean bool) throws C
220240
* This component is optional and therefore the API will only work if it is installed
221241
*/
222242
public ApiResponse setOptionEventWait(String apikey, int i) throws ClientApiException {
223-
Map<String, String> map = null;
224-
map = new HashMap<String, String>();
243+
Map<String, String> map = new HashMap<>();
225244
if (apikey != null) {
226245
map.put("apikey", apikey);
227246
}
@@ -233,8 +252,7 @@ public ApiResponse setOptionEventWait(String apikey, int i) throws ClientApiExce
233252
* This component is optional and therefore the API will only work if it is installed
234253
*/
235254
public ApiResponse setOptionMaxCrawlDepth(String apikey, int i) throws ClientApiException {
236-
Map<String, String> map = null;
237-
map = new HashMap<String, String>();
255+
Map<String, String> map = new HashMap<>();
238256
if (apikey != null) {
239257
map.put("apikey", apikey);
240258
}
@@ -246,8 +264,7 @@ public ApiResponse setOptionMaxCrawlDepth(String apikey, int i) throws ClientApi
246264
* This component is optional and therefore the API will only work if it is installed
247265
*/
248266
public ApiResponse setOptionMaxCrawlStates(String apikey, int i) throws ClientApiException {
249-
Map<String, String> map = null;
250-
map = new HashMap<String, String>();
267+
Map<String, String> map = new HashMap<>();
251268
if (apikey != null) {
252269
map.put("apikey", apikey);
253270
}
@@ -259,8 +276,7 @@ public ApiResponse setOptionMaxCrawlStates(String apikey, int i) throws ClientAp
259276
* This component is optional and therefore the API will only work if it is installed
260277
*/
261278
public ApiResponse setOptionMaxDuration(String apikey, int i) throws ClientApiException {
262-
Map<String, String> map = null;
263-
map = new HashMap<String, String>();
279+
Map<String, String> map = new HashMap<>();
264280
if (apikey != null) {
265281
map.put("apikey", apikey);
266282
}
@@ -272,8 +288,7 @@ public ApiResponse setOptionMaxDuration(String apikey, int i) throws ClientApiEx
272288
* This component is optional and therefore the API will only work if it is installed
273289
*/
274290
public ApiResponse setOptionNumberOfBrowsers(String apikey, int i) throws ClientApiException {
275-
Map<String, String> map = null;
276-
map = new HashMap<String, String>();
291+
Map<String, String> map = new HashMap<>();
277292
if (apikey != null) {
278293
map.put("apikey", apikey);
279294
}
@@ -285,8 +300,7 @@ public ApiResponse setOptionNumberOfBrowsers(String apikey, int i) throws Client
285300
* This component is optional and therefore the API will only work if it is installed
286301
*/
287302
public ApiResponse setOptionRandomInputs(String apikey, boolean bool) throws ClientApiException {
288-
Map<String, String> map = null;
289-
map = new HashMap<String, String>();
303+
Map<String, String> map = new HashMap<>();
290304
if (apikey != null) {
291305
map.put("apikey", apikey);
292306
}
@@ -298,8 +312,7 @@ public ApiResponse setOptionRandomInputs(String apikey, boolean bool) throws Cli
298312
* This component is optional and therefore the API will only work if it is installed
299313
*/
300314
public ApiResponse setOptionReloadWait(String apikey, int i) throws ClientApiException {
301-
Map<String, String> map = null;
302-
map = new HashMap<String, String>();
315+
Map<String, String> map = new HashMap<>();
303316
if (apikey != null) {
304317
map.put("apikey", apikey);
305318
}

‎subprojects/zap-clientapi/zap-clientapi.gradle

Copy file name to clipboardExpand all lines: subprojects/zap-clientapi/zap-clientapi.gradle
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
apply plugin: 'maven'
33
apply plugin: 'signing'
44

5-
version '1.0.1-SNAPSHOT'
5+
version '1.1.0-SNAPSHOT'
66

77
dependencies { compile 'org.jdom:jdom:1.1.3' }
88

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.