zap_api/
ajax_spider.rs

1/* Zed Attack Proxy (ZAP) and its related class files.
2 *
3 * ZAP is an HTTP/HTTPS proxy for assessing web application security.
4 *
5 * Copyright 2019 the ZAP development team
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20use super::ZapApiError;
21use super::ZapService;
22use serde_json::Value;
23use std::collections::HashMap;
24
25/**
26 * This file was automatically generated.
27 */
28/**
29 * This component is optional and therefore the API will only work if it is installed
30 */
31pub fn status(service: &ZapService) -> Result<Value, ZapApiError> {
32    let params = HashMap::new();
33    super::call(service, "ajaxSpider", "view", "status", params)
34}
35
36/**
37 * This component is optional and therefore the API will only work if it is installed
38 */
39pub fn results(service: &ZapService, start: String, count: String) -> Result<Value, ZapApiError> {
40    let mut params = HashMap::new();
41    params.insert("start".to_string(), start);
42    params.insert("count".to_string(), count);
43    super::call(service, "ajaxSpider", "view", "results", params)
44}
45
46/**
47 * This component is optional and therefore the API will only work if it is installed
48 */
49pub fn number_of_results(service: &ZapService) -> Result<Value, ZapApiError> {
50    let params = HashMap::new();
51    super::call(service, "ajaxSpider", "view", "numberOfResults", params)
52}
53
54/**
55 * This component is optional and therefore the API will only work if it is installed
56 */
57pub fn full_results(service: &ZapService) -> Result<Value, ZapApiError> {
58    let params = HashMap::new();
59    super::call(service, "ajaxSpider", "view", "fullResults", params)
60}
61
62/**
63 * This component is optional and therefore the API will only work if it is installed
64 */
65pub fn option_browser_id(service: &ZapService) -> Result<Value, ZapApiError> {
66    let params = HashMap::new();
67    super::call(service, "ajaxSpider", "view", "optionBrowserId", params)
68}
69
70/**
71 * This component is optional and therefore the API will only work if it is installed
72 */
73pub fn option_event_wait(service: &ZapService) -> Result<Value, ZapApiError> {
74    let params = HashMap::new();
75    super::call(service, "ajaxSpider", "view", "optionEventWait", params)
76}
77
78/**
79 * This component is optional and therefore the API will only work if it is installed
80 */
81pub fn option_max_crawl_depth(service: &ZapService) -> Result<Value, ZapApiError> {
82    let params = HashMap::new();
83    super::call(service, "ajaxSpider", "view", "optionMaxCrawlDepth", params)
84}
85
86/**
87 * This component is optional and therefore the API will only work if it is installed
88 */
89pub fn option_max_crawl_states(service: &ZapService) -> Result<Value, ZapApiError> {
90    let params = HashMap::new();
91    super::call(
92        service,
93        "ajaxSpider",
94        "view",
95        "optionMaxCrawlStates",
96        params,
97    )
98}
99
100/**
101 * This component is optional and therefore the API will only work if it is installed
102 */
103pub fn option_max_duration(service: &ZapService) -> Result<Value, ZapApiError> {
104    let params = HashMap::new();
105    super::call(service, "ajaxSpider", "view", "optionMaxDuration", params)
106}
107
108/**
109 * This component is optional and therefore the API will only work if it is installed
110 */
111pub fn option_number_of_browsers(service: &ZapService) -> Result<Value, ZapApiError> {
112    let params = HashMap::new();
113    super::call(
114        service,
115        "ajaxSpider",
116        "view",
117        "optionNumberOfBrowsers",
118        params,
119    )
120}
121
122/**
123 * This component is optional and therefore the API will only work if it is installed
124 */
125pub fn option_reload_wait(service: &ZapService) -> Result<Value, ZapApiError> {
126    let params = HashMap::new();
127    super::call(service, "ajaxSpider", "view", "optionReloadWait", params)
128}
129
130/**
131 * This component is optional and therefore the API will only work if it is installed
132 */
133pub fn option_click_default_elems(service: &ZapService) -> Result<Value, ZapApiError> {
134    let params = HashMap::new();
135    super::call(
136        service,
137        "ajaxSpider",
138        "view",
139        "optionClickDefaultElems",
140        params,
141    )
142}
143
144/**
145 * This component is optional and therefore the API will only work if it is installed
146 */
147pub fn option_click_elems_once(service: &ZapService) -> Result<Value, ZapApiError> {
148    let params = HashMap::new();
149    super::call(
150        service,
151        "ajaxSpider",
152        "view",
153        "optionClickElemsOnce",
154        params,
155    )
156}
157
158/**
159 * This component is optional and therefore the API will only work if it is installed
160 */
161pub fn option_random_inputs(service: &ZapService) -> Result<Value, ZapApiError> {
162    let params = HashMap::new();
163    super::call(service, "ajaxSpider", "view", "optionRandomInputs", params)
164}
165
166/**
167 * 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').
168 * <p>
169 * This component is optional and therefore the API will only work if it is installed
170*/
171pub fn scan(
172    service: &ZapService,
173    url: String,
174    inscope: String,
175    contextname: String,
176    subtreeonly: String,
177) -> Result<Value, ZapApiError> {
178    let mut params = HashMap::new();
179    params.insert("url".to_string(), url);
180    params.insert("inScope".to_string(), inscope);
181    params.insert("contextName".to_string(), contextname);
182    params.insert("subtreeOnly".to_string(), subtreeonly);
183    super::call(service, "ajaxSpider", "action", "scan", params)
184}
185
186/**
187 * 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').
188 * <p>
189 * This component is optional and therefore the API will only work if it is installed
190*/
191pub fn scan_as_user(
192    service: &ZapService,
193    contextname: String,
194    username: String,
195    url: String,
196    subtreeonly: String,
197) -> Result<Value, ZapApiError> {
198    let mut params = HashMap::new();
199    params.insert("contextName".to_string(), contextname);
200    params.insert("userName".to_string(), username);
201    params.insert("url".to_string(), url);
202    params.insert("subtreeOnly".to_string(), subtreeonly);
203    super::call(service, "ajaxSpider", "action", "scanAsUser", params)
204}
205
206/**
207 * This component is optional and therefore the API will only work if it is installed
208 */
209pub fn stop(service: &ZapService) -> Result<Value, ZapApiError> {
210    let params = HashMap::new();
211    super::call(service, "ajaxSpider", "action", "stop", params)
212}
213
214/**
215 * This component is optional and therefore the API will only work if it is installed
216 */
217pub fn set_option_browser_id(service: &ZapService, string: String) -> Result<Value, ZapApiError> {
218    let mut params = HashMap::new();
219    params.insert("String".to_string(), string);
220    super::call(
221        service,
222        "ajaxSpider",
223        "action",
224        "setOptionBrowserId",
225        params,
226    )
227}
228
229/**
230 * This component is optional and therefore the API will only work if it is installed
231 */
232pub fn set_option_click_default_elems(
233    service: &ZapService,
234    boolean: String,
235) -> Result<Value, ZapApiError> {
236    let mut params = HashMap::new();
237    params.insert("Boolean".to_string(), boolean);
238    super::call(
239        service,
240        "ajaxSpider",
241        "action",
242        "setOptionClickDefaultElems",
243        params,
244    )
245}
246
247/**
248 * This component is optional and therefore the API will only work if it is installed
249 */
250pub fn set_option_click_elems_once(
251    service: &ZapService,
252    boolean: String,
253) -> Result<Value, ZapApiError> {
254    let mut params = HashMap::new();
255    params.insert("Boolean".to_string(), boolean);
256    super::call(
257        service,
258        "ajaxSpider",
259        "action",
260        "setOptionClickElemsOnce",
261        params,
262    )
263}
264
265/**
266 * This component is optional and therefore the API will only work if it is installed
267 */
268pub fn set_option_event_wait(service: &ZapService, integer: String) -> Result<Value, ZapApiError> {
269    let mut params = HashMap::new();
270    params.insert("Integer".to_string(), integer);
271    super::call(
272        service,
273        "ajaxSpider",
274        "action",
275        "setOptionEventWait",
276        params,
277    )
278}
279
280/**
281 * This component is optional and therefore the API will only work if it is installed
282 */
283pub fn set_option_max_crawl_depth(
284    service: &ZapService,
285    integer: String,
286) -> Result<Value, ZapApiError> {
287    let mut params = HashMap::new();
288    params.insert("Integer".to_string(), integer);
289    super::call(
290        service,
291        "ajaxSpider",
292        "action",
293        "setOptionMaxCrawlDepth",
294        params,
295    )
296}
297
298/**
299 * This component is optional and therefore the API will only work if it is installed
300 */
301pub fn set_option_max_crawl_states(
302    service: &ZapService,
303    integer: String,
304) -> Result<Value, ZapApiError> {
305    let mut params = HashMap::new();
306    params.insert("Integer".to_string(), integer);
307    super::call(
308        service,
309        "ajaxSpider",
310        "action",
311        "setOptionMaxCrawlStates",
312        params,
313    )
314}
315
316/**
317 * This component is optional and therefore the API will only work if it is installed
318 */
319pub fn set_option_max_duration(
320    service: &ZapService,
321    integer: String,
322) -> Result<Value, ZapApiError> {
323    let mut params = HashMap::new();
324    params.insert("Integer".to_string(), integer);
325    super::call(
326        service,
327        "ajaxSpider",
328        "action",
329        "setOptionMaxDuration",
330        params,
331    )
332}
333
334/**
335 * This component is optional and therefore the API will only work if it is installed
336 */
337pub fn set_option_number_of_browsers(
338    service: &ZapService,
339    integer: String,
340) -> Result<Value, ZapApiError> {
341    let mut params = HashMap::new();
342    params.insert("Integer".to_string(), integer);
343    super::call(
344        service,
345        "ajaxSpider",
346        "action",
347        "setOptionNumberOfBrowsers",
348        params,
349    )
350}
351
352/**
353 * This component is optional and therefore the API will only work if it is installed
354 */
355pub fn set_option_random_inputs(
356    service: &ZapService,
357    boolean: String,
358) -> Result<Value, ZapApiError> {
359    let mut params = HashMap::new();
360    params.insert("Boolean".to_string(), boolean);
361    super::call(
362        service,
363        "ajaxSpider",
364        "action",
365        "setOptionRandomInputs",
366        params,
367    )
368}
369
370/**
371 * This component is optional and therefore the API will only work if it is installed
372 */
373pub fn set_option_reload_wait(service: &ZapService, integer: String) -> Result<Value, ZapApiError> {
374    let mut params = HashMap::new();
375    params.insert("Integer".to_string(), integer);
376    super::call(
377        service,
378        "ajaxSpider",
379        "action",
380        "setOptionReloadWait",
381        params,
382    )
383}