zaproxy 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -0
  3. data/.rubocop.yml +213 -0
  4. data/README.md +36 -1
  5. data/Rakefile +21 -0
  6. data/SECURITY.md +21 -0
  7. data/lib/zap/result.rb +13 -0
  8. data/lib/zap/v2apis/_template.rb +13 -0
  9. data/lib/zap/v2apis/access_control.rb +25 -0
  10. data/lib/zap/v2apis/acsrf.rb +33 -0
  11. data/lib/zap/v2apis/ajax_spider.rb +153 -0
  12. data/lib/zap/v2apis/alert.rb +61 -0
  13. data/lib/zap/v2apis/alert_filter.rb +57 -0
  14. data/lib/zap/v2apis/ascan.rb +361 -0
  15. data/lib/zap/v2apis/authentication.rb +41 -0
  16. data/lib/zap/v2apis/authorization.rb +17 -0
  17. data/lib/zap/v2apis/automation.rb +21 -0
  18. data/lib/zap/v2apis/autoupdate.rb +133 -0
  19. data/lib/zap/v2apis/break.rb +57 -0
  20. data/lib/zap/v2apis/client.rb +25 -0
  21. data/lib/zap/v2apis/context.rb +93 -0
  22. data/lib/zap/v2apis/core.rb +389 -0
  23. data/lib/zap/v2apis/exim.rb +37 -0
  24. data/lib/zap/v2apis/forced_user.rb +25 -0
  25. data/lib/zap/v2apis/graphql.rb +89 -0
  26. data/lib/zap/v2apis/http_sessions.rb +73 -0
  27. data/lib/zap/v2apis/hud.rb +157 -0
  28. data/lib/zap/v2apis/import_urls.rb +13 -0
  29. data/lib/zap/v2apis/keyboard.rb +17 -0
  30. data/lib/zap/v2apis/local_proxies.rb +21 -0
  31. data/lib/zap/v2apis/network.rb +201 -0
  32. data/lib/zap/v2apis/openapi.rb +17 -0
  33. data/lib/zap/v2apis/params.rb +13 -0
  34. data/lib/zap/v2apis/pnh.rb +41 -0
  35. data/lib/zap/v2apis/postman.rb +17 -0
  36. data/lib/zap/v2apis/pscan.rb +77 -0
  37. data/lib/zap/v2apis/quickstartlaunch.rb +13 -0
  38. data/lib/zap/v2apis/replacer.rb +25 -0
  39. data/lib/zap/v2apis/reports.rb +21 -0
  40. data/lib/zap/v2apis/retest.rb +13 -0
  41. data/lib/zap/v2apis/reveal.rb +17 -0
  42. data/lib/zap/v2apis/revisit.rb +21 -0
  43. data/lib/zap/v2apis/rule_config.rb +29 -0
  44. data/lib/zap/v2apis/script.rb +105 -0
  45. data/lib/zap/v2apis/search.rb +57 -0
  46. data/lib/zap/v2apis/selenium.rb +93 -0
  47. data/lib/zap/v2apis/session_management.rb +29 -0
  48. data/lib/zap/v2apis/soap.rb +17 -0
  49. data/lib/zap/v2apis/spider.rb +293 -0
  50. data/lib/zap/v2apis/stats.rb +61 -0
  51. data/lib/zap/v2apis/users.rb +69 -0
  52. data/lib/zap/v2apis/wappalyzer.rb +21 -0
  53. data/lib/zap/v2apis/websocket.rb +33 -0
  54. data/lib/zap/zap.rb +77 -0
  55. data/lib/zap/zapv2.rb +102 -0
  56. data/lib/zaproxy.rb +3 -0
  57. data/openapi.yaml +11314 -0
  58. data/zaproxy.gemspec +4 -3
  59. metadata +60 -5
  60. data/lib/zap.rb +0 -8
@@ -0,0 +1,93 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class Context
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def context(contextname)
10
+ @client.get("/JSON/context/view/context/?contextName=#{contextname}")
11
+ end
12
+
13
+ def context_list
14
+ @client.get('/JSON/context/view/contextList/')
15
+ end
16
+
17
+ def exclude_regexs(contextname)
18
+ @client.get("/JSON/context/view/excludeRegexs/?contextName=#{contextname}")
19
+ end
20
+
21
+ def excluded_technology_list(contextname)
22
+ @client.get("/JSON/context/view/excludedTechnologyList/?contextName=#{contextname}")
23
+ end
24
+
25
+ def include_regexs(contextname)
26
+ @client.get("/JSON/context/view/includeRegexs/?contextName=#{contextname}")
27
+ end
28
+
29
+ def included_technology_list(contextname)
30
+ @client.get("/JSON/context/view/includedTechnologyList/?contextName=#{contextname}")
31
+ end
32
+
33
+ def technology_list
34
+ @client.get('/JSON/context/view/technologyList/')
35
+ end
36
+
37
+ def urls(contextname)
38
+ @client.get("/JSON/context/view/urls/?contextName=#{contextname}")
39
+ end
40
+
41
+ def exclude_all_context_technologies(contextname)
42
+ @client.get("/JSON/context/action/excludeAllContextTechnologies/?contextName=#{contextname}")
43
+ end
44
+
45
+ def exclude_context_technologies(contextname, technologynames)
46
+ @client.get("/JSON/context/action/excludeContextTechnologies/?contextName=#{contextname}&technologyNames=#{technologynames}")
47
+ end
48
+
49
+ def exclude_from_context(contextname, regex)
50
+ @client.get("/JSON/context/action/excludeFromContext/?contextName=#{contextname}&regex=#{regex}")
51
+ end
52
+
53
+ def export_context(contextname, contextfile)
54
+ @client.get("/JSON/context/action/exportContext/?contextName=#{contextname}&contextFile=#{contextfile}")
55
+ end
56
+
57
+ def import_context(contextfile)
58
+ @client.get("/JSON/context/action/importContext/?contextFile=#{contextfile}")
59
+ end
60
+
61
+ def include_all_context_technologies(contextname)
62
+ @client.get("/JSON/context/action/includeAllContextTechnologies/?contextName=#{contextname}")
63
+ end
64
+
65
+ def include_context_technologies(contextname, technologynames)
66
+ @client.get("/JSON/context/action/includeContextTechnologies/?contextName=#{contextname}&technologyNames=#{technologynames}")
67
+ end
68
+
69
+ def include_in_context(contextname, regex)
70
+ @client.get("/JSON/context/action/includeInContext/?contextName=#{contextname}&regex=#{regex}")
71
+ end
72
+
73
+ def new_context(contextname)
74
+ @client.get("/JSON/context/action/newContext/?contextName=#{contextname}")
75
+ end
76
+
77
+ def remove_context(contextname)
78
+ @client.get("/JSON/context/action/removeContext/?contextName=#{contextname}")
79
+ end
80
+
81
+ def set_context_checking_strategy(contextname, checkingstrategy, pollurl, polldata, pollheaders, pollfrequency, pollfrequencyunits)
82
+ @client.get("/JSON/context/action/setContextCheckingStrategy/?contextName=#{contextname}&checkingStrategy=#{checkingstrategy}&pollUrl=#{pollurl}&pollData=#{polldata}&pollHeaders=#{pollheaders}&pollFrequency=#{pollfrequency}&pollFrequencyUnits=#{pollfrequencyunits}")
83
+ end
84
+
85
+ def set_context_in_scope(contextname, booleaninscope)
86
+ @client.get("/JSON/context/action/setContextInScope/?contextName=#{contextname}&booleanInScope=#{booleaninscope}")
87
+ end
88
+
89
+ def set_context_regexs(contextname, incregexs, excregexs)
90
+ @client.get("/JSON/context/action/setContextRegexs/?contextName=#{contextname}&incRegexs=#{incregexs}&excRegexs=#{excregexs}")
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,389 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class Core
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def alert(id)
10
+ @client.get("/JSON/core/view/alert/?id=#{id}")
11
+ end
12
+
13
+ def alerts(baseurl, start, count, riskid)
14
+ @client.get("/JSON/core/view/alerts/?baseurl=#{baseurl}&start=#{start}&count=#{count}&riskid=#{riskid}")
15
+ end
16
+
17
+ def alerts_summary(baseurl)
18
+ @client.get("/JSON/core/view/alertsSummary/?baseurl=#{baseurl}")
19
+ end
20
+
21
+ def child_nodes(url)
22
+ @client.get("/JSON/core/view/childNodes/?url=#{url}")
23
+ end
24
+
25
+ def excluded_from_proxy
26
+ @client.get('/JSON/core/view/excludedFromProxy/')
27
+ end
28
+
29
+ def home_directory
30
+ @client.get('/JSON/core/view/homeDirectory/')
31
+ end
32
+
33
+ def hosts
34
+ @client.get('/JSON/core/view/hosts/')
35
+ end
36
+
37
+ def message(id)
38
+ @client.get("/JSON/core/view/message/?id=#{id}")
39
+ end
40
+
41
+ def messages(baseurl, start, count)
42
+ @client.get("/JSON/core/view/messages/?baseurl=#{baseurl}&start=#{start}&count=#{count}")
43
+ end
44
+
45
+ def messages_by_id(ids)
46
+ @client.get("/JSON/core/view/messagesById/?ids=#{ids}")
47
+ end
48
+
49
+ def mode
50
+ @client.get('/JSON/core/view/mode/')
51
+ end
52
+
53
+ def number_of_alerts(baseurl, riskid)
54
+ @client.get("/JSON/core/view/numberOfAlerts/?baseurl=#{baseurl}&riskid=#{riskid}")
55
+ end
56
+
57
+ def number_of_messages(baseurl)
58
+ @client.get("/JSON/core/view/numberOfMessages/?baseurl=#{baseurl}")
59
+ end
60
+
61
+ def option_alert_overrides_file_path
62
+ @client.get('/JSON/core/view/optionAlertOverridesFilePath/')
63
+ end
64
+
65
+ def option_default_user_agent
66
+ @client.get('/JSON/core/view/optionDefaultUserAgent/')
67
+ end
68
+
69
+ def option_dns_ttl_successful_queries
70
+ @client.get('/JSON/core/view/optionDnsTtlSuccessfulQueries/')
71
+ end
72
+
73
+ def option_http_state
74
+ @client.get('/JSON/core/view/optionHttpState/')
75
+ end
76
+
77
+ def option_http_state_enabled
78
+ @client.get('/JSON/core/view/optionHttpStateEnabled/')
79
+ end
80
+
81
+ def option_maximum_alert_instances
82
+ @client.get('/JSON/core/view/optionMaximumAlertInstances/')
83
+ end
84
+
85
+ def option_merge_related_alerts
86
+ @client.get('/JSON/core/view/optionMergeRelatedAlerts/')
87
+ end
88
+
89
+ def option_proxy_chain_name
90
+ @client.get('/JSON/core/view/optionProxyChainName/')
91
+ end
92
+
93
+ def option_proxy_chain_password
94
+ @client.get('/JSON/core/view/optionProxyChainPassword/')
95
+ end
96
+
97
+ def option_proxy_chain_port
98
+ @client.get('/JSON/core/view/optionProxyChainPort/')
99
+ end
100
+
101
+ def option_proxy_chain_prompt
102
+ @client.get('/JSON/core/view/optionProxyChainPrompt/')
103
+ end
104
+
105
+ def option_proxy_chain_realm
106
+ @client.get('/JSON/core/view/optionProxyChainRealm/')
107
+ end
108
+
109
+ def option_proxy_chain_skip_name
110
+ @client.get('/JSON/core/view/optionProxyChainSkipName/')
111
+ end
112
+
113
+ def option_proxy_chain_user_name
114
+ @client.get('/JSON/core/view/optionProxyChainUserName/')
115
+ end
116
+
117
+ def option_proxy_excluded_domains
118
+ @client.get('/JSON/core/view/optionProxyExcludedDomains/')
119
+ end
120
+
121
+ def option_proxy_excluded_domains_enabled
122
+ @client.get('/JSON/core/view/optionProxyExcludedDomainsEnabled/')
123
+ end
124
+
125
+ def option_single_cookie_request_header
126
+ @client.get('/JSON/core/view/optionSingleCookieRequestHeader/')
127
+ end
128
+
129
+ def option_timeout_in_secs
130
+ @client.get('/JSON/core/view/optionTimeoutInSecs/')
131
+ end
132
+
133
+ def option_use_proxy_chain
134
+ @client.get('/JSON/core/view/optionUseProxyChain/')
135
+ end
136
+
137
+ def option_use_proxy_chain_auth
138
+ @client.get('/JSON/core/view/optionUseProxyChainAuth/')
139
+ end
140
+
141
+ def option_use_socks_proxy
142
+ @client.get('/JSON/core/view/optionUseSocksProxy/')
143
+ end
144
+
145
+ def proxy_chain_excluded_domains
146
+ @client.get('/JSON/core/view/proxyChainExcludedDomains/')
147
+ end
148
+
149
+ def session_location
150
+ @client.get('/JSON/core/view/sessionLocation/')
151
+ end
152
+
153
+ def sites
154
+ @client.get('/JSON/core/view/sites/')
155
+ end
156
+
157
+ def urls(baseurl)
158
+ @client.get("/JSON/core/view/urls/?baseurl=#{baseurl}")
159
+ end
160
+
161
+ def version
162
+ @client.get('/JSON/core/view/version/')
163
+ end
164
+
165
+ def zap_home_path
166
+ @client.get('/JSON/core/view/zapHomePath/')
167
+ end
168
+
169
+ def access_url(url, followredirects)
170
+ @client.get("/JSON/core/action/accessUrl/?url=#{url}&followRedirects=#{followredirects}")
171
+ end
172
+
173
+ def add_proxy_chain_excluded_domain(value, isregex, isenabled)
174
+ @client.get("/JSON/core/action/addProxyChainExcludedDomain/?value=#{value}&isRegex=#{isregex}&isEnabled=#{isenabled}")
175
+ end
176
+
177
+ def clear_excluded_from_proxy
178
+ @client.get('/JSON/core/action/clearExcludedFromProxy/')
179
+ end
180
+
181
+ def create_sbom_zip(filepath)
182
+ @client.get("/JSON/core/action/createSbomZip/?filePath=#{filepath}")
183
+ end
184
+
185
+ def delete_alert(id)
186
+ @client.get("/JSON/core/action/deleteAlert/?id=#{id}")
187
+ end
188
+
189
+ def delete_all_alerts
190
+ @client.get('/JSON/core/action/deleteAllAlerts/')
191
+ end
192
+
193
+ def delete_site_node(url, method, postdata)
194
+ @client.get("/JSON/core/action/deleteSiteNode/?url=#{url}&method=#{method}&postData=#{postdata}")
195
+ end
196
+
197
+ def disable_all_proxy_chain_excluded_domains
198
+ @client.get('/JSON/core/action/disableAllProxyChainExcludedDomains/')
199
+ end
200
+
201
+ def disable_client_certificate
202
+ @client.get('/JSON/core/action/disableClientCertificate/')
203
+ end
204
+
205
+ def enable_all_proxy_chain_excluded_domains
206
+ @client.get('/JSON/core/action/enableAllProxyChainExcludedDomains/')
207
+ end
208
+
209
+ def enable_pkcs12_client_certificate(filepath, password, index)
210
+ @client.get("/JSON/core/action/enablePKCS12ClientCertificate/?filePath=#{filepath}&password=#{password}&index=#{index}")
211
+ end
212
+
213
+ def exclude_from_proxy(regex)
214
+ @client.get("/JSON/core/action/excludeFromProxy/?regex=#{regex}")
215
+ end
216
+
217
+ def generate_root_ca
218
+ @client.get('/JSON/core/action/generateRootCA/')
219
+ end
220
+
221
+ def load_session(name)
222
+ @client.get("/JSON/core/action/loadSession/?name=#{name}")
223
+ end
224
+
225
+ def modify_proxy_chain_excluded_domain(idx, value, isregex, isenabled)
226
+ @client.get("/JSON/core/action/modifyProxyChainExcludedDomain/?idx=#{idx}&value=#{value}&isRegex=#{isregex}&isEnabled=#{isenabled}")
227
+ end
228
+
229
+ def new_session(name, overwrite)
230
+ @client.get("/JSON/core/action/newSession/?name=#{name}&overwrite=#{overwrite}")
231
+ end
232
+
233
+ def remove_proxy_chain_excluded_domain(idx)
234
+ @client.get("/JSON/core/action/removeProxyChainExcludedDomain/?idx=#{idx}")
235
+ end
236
+
237
+ def run_garbage_collection
238
+ @client.get('/JSON/core/action/runGarbageCollection/')
239
+ end
240
+
241
+ def save_session(name, overwrite)
242
+ @client.get("/JSON/core/action/saveSession/?name=#{name}&overwrite=#{overwrite}")
243
+ end
244
+
245
+ def send_request(request, followredirects)
246
+ @client.get("/JSON/core/action/sendRequest/?request=#{request}&followRedirects=#{followredirects}")
247
+ end
248
+
249
+ def set_home_directory(dir)
250
+ @client.get("/JSON/core/action/setHomeDirectory/?dir=#{dir}")
251
+ end
252
+
253
+ def set_mode(mode)
254
+ @client.get("/JSON/core/action/setMode/?mode=#{mode}")
255
+ end
256
+
257
+ def set_option_alert_overrides_file_path(filepath)
258
+ @client.get("/JSON/core/action/setOptionAlertOverridesFilePath/?filePath=#{filepath}")
259
+ end
260
+
261
+ def set_option_default_user_agent(string)
262
+ @client.get("/JSON/core/action/setOptionDefaultUserAgent/?String=#{string}")
263
+ end
264
+
265
+ def set_option_dns_ttl_successful_queries(integer)
266
+ @client.get("/JSON/core/action/setOptionDnsTtlSuccessfulQueries/?Integer=#{integer}")
267
+ end
268
+
269
+ def set_option_http_state_enabled(boolean)
270
+ @client.get("/JSON/core/action/setOptionHttpStateEnabled/?Boolean=#{boolean}")
271
+ end
272
+
273
+ def set_option_maximum_alert_instances(numberofinstances)
274
+ @client.get("/JSON/core/action/setOptionMaximumAlertInstances/?numberOfInstances=#{numberofinstances}")
275
+ end
276
+
277
+ def set_option_merge_related_alerts(enabled)
278
+ @client.get("/JSON/core/action/setOptionMergeRelatedAlerts/?enabled=#{enabled}")
279
+ end
280
+
281
+ def set_option_proxy_chain_name(string)
282
+ @client.get("/JSON/core/action/setOptionProxyChainName/?String=#{string}")
283
+ end
284
+
285
+ def set_option_proxy_chain_password(string)
286
+ @client.get("/JSON/core/action/setOptionProxyChainPassword/?String=#{string}")
287
+ end
288
+
289
+ def set_option_proxy_chain_port(integer)
290
+ @client.get("/JSON/core/action/setOptionProxyChainPort/?Integer=#{integer}")
291
+ end
292
+
293
+ def set_option_proxy_chain_prompt(boolean)
294
+ @client.get("/JSON/core/action/setOptionProxyChainPrompt/?Boolean=#{boolean}")
295
+ end
296
+
297
+ def set_option_proxy_chain_realm(string)
298
+ @client.get("/JSON/core/action/setOptionProxyChainRealm/?String=#{string}")
299
+ end
300
+
301
+ def set_option_proxy_chain_skip_name(string)
302
+ @client.get("/JSON/core/action/setOptionProxyChainSkipName/?String=#{string}")
303
+ end
304
+
305
+ def set_option_proxy_chain_user_name(string)
306
+ @client.get("/JSON/core/action/setOptionProxyChainUserName/?String=#{string}")
307
+ end
308
+
309
+ def set_option_single_cookie_request_header(boolean)
310
+ @client.get("/JSON/core/action/setOptionSingleCookieRequestHeader/?Boolean=#{boolean}")
311
+ end
312
+
313
+ def set_option_timeout_in_secs(integer)
314
+ @client.get("/JSON/core/action/setOptionTimeoutInSecs/?Integer=#{integer}")
315
+ end
316
+
317
+ def set_option_use_proxy_chain(boolean)
318
+ @client.get("/JSON/core/action/setOptionUseProxyChain/?Boolean=#{boolean}")
319
+ end
320
+
321
+ def set_option_use_proxy_chain_auth(boolean)
322
+ @client.get("/JSON/core/action/setOptionUseProxyChainAuth/?Boolean=#{boolean}")
323
+ end
324
+
325
+ def set_option_use_socks_proxy(boolean)
326
+ @client.get("/JSON/core/action/setOptionUseSocksProxy/?Boolean=#{boolean}")
327
+ end
328
+
329
+ def shutdown
330
+ @client.get('/JSON/core/action/shutdown/')
331
+ end
332
+
333
+ def snapshot_session(name, overwrite)
334
+ @client.get("/JSON/core/action/snapshotSession/?name=#{name}&overwrite=#{overwrite}")
335
+ end
336
+
337
+ def file_download(filename)
338
+ @client.get("/OTHER/core/other/fileDownload/?fileName=#{filename}")
339
+ end
340
+
341
+ def file_upload(filename, filecontents)
342
+ @client.get("/OTHER/core/other/fileUpload/?fileName=#{filename}&fileContents=#{filecontents}")
343
+ end
344
+
345
+ def htmlreport
346
+ @client.get('/OTHER/core/other/htmlreport/')
347
+ end
348
+
349
+ def jsonreport
350
+ @client.get('/OTHER/core/other/jsonreport/')
351
+ end
352
+
353
+ def mdreport
354
+ @client.get('/OTHER/core/other/mdreport/')
355
+ end
356
+
357
+ def message_har(id)
358
+ @client.get("/OTHER/core/other/messageHar/?id=#{id}")
359
+ end
360
+
361
+ def messages_har(baseurl, start, count)
362
+ @client.get("/OTHER/core/other/messagesHar/?baseurl=#{baseurl}&start=#{start}&count=#{count}")
363
+ end
364
+
365
+ def messages_har_by_id(ids)
366
+ @client.get("/OTHER/core/other/messagesHarById/?ids=#{ids}")
367
+ end
368
+
369
+ def proxy_pac
370
+ @client.get('/OTHER/core/other/proxy.pac/')
371
+ end
372
+
373
+ def rootcert
374
+ @client.get('/OTHER/core/other/rootcert/')
375
+ end
376
+
377
+ def send_har_request(request, followredirects)
378
+ @client.get("/OTHER/core/other/sendHarRequest/?request=#{request}&followRedirects=#{followredirects}")
379
+ end
380
+
381
+ def setproxy(proxy)
382
+ @client.get("/OTHER/core/other/setproxy/?proxy=#{proxy}")
383
+ end
384
+
385
+ def xmlreport
386
+ @client.get('/OTHER/core/other/xmlreport/')
387
+ end
388
+ end
389
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class Exim
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def import_har(file_path)
10
+ @client.get("/JSON/exim/action/importHar/?filePath=#{file_path}")
11
+ end
12
+
13
+ def import_modsec2_logs(file_path)
14
+ @client.get("/JSON/exim/action/importModsec2Logs/?filePath=#{file_path}")
15
+ end
16
+
17
+ def import_urls(file_path)
18
+ @client.get("/JSON/exim/action/importUrls/?filePath=#{file_path}")
19
+ end
20
+
21
+ def import_zap_logs(file_path)
22
+ @client.get("/JSON/exim/action/importZapLogs/?filePath=#{file_path}")
23
+ end
24
+
25
+ def export_har(baseurl, start, count)
26
+ @client.get("/OTHER/exim/other/exportHar/?baseurl=#{baseurl}&start=#{start}&count=#{count}")
27
+ end
28
+
29
+ def export_har_by_id(ids)
30
+ @client.get("/OTHER/exim/other/exportHarById/?ids=#{ids}")
31
+ end
32
+
33
+ def send_har_request(request, follow_redirects)
34
+ @client.get("/JSON/exim/action/sendHarRequest/?request=#{request}&followRedirects=#{follow_redirects}")
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class ForcedUser
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def get_forced_user(contextid)
10
+ @client.get("/JSON/forcedUser/view/getForcedUser/?contextId=#{contextid}")
11
+ end
12
+
13
+ def is_forced_user_mode_enabled
14
+ @client.get('/JSON/forcedUser/view/isForcedUserModeEnabled/')
15
+ end
16
+
17
+ def set_forced_user(contextid, userid)
18
+ @client.get("/JSON/forcedUser/action/setForcedUser/?contextId=#{contextid}&userId=#{userid}")
19
+ end
20
+
21
+ def set_forced_user_mode_enabled(boolean)
22
+ @client.get("/JSON/forcedUser/action/setForcedUserModeEnabled/?boolean=#{boolean}")
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,89 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class GraphQL
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def option_args_type
10
+ @client.get('/JSON/graphql/view/optionArgsType/')
11
+ end
12
+
13
+ def option_lenient_max_query_depth_enabled
14
+ @client.get('/JSON/graphql/view/optionLenientMaxQueryDepthEnabled/')
15
+ end
16
+
17
+ def option_max_additional_query_depth
18
+ @client.get('/JSON/graphql/view/optionMaxAdditionalQueryDepth/')
19
+ end
20
+
21
+ def option_max_args_depth
22
+ @client.get('/JSON/graphql/view/optionMaxArgsDepth/')
23
+ end
24
+
25
+ def option_max_query_depth
26
+ @client.get('/JSON/graphql/view/optionMaxQueryDepth/')
27
+ end
28
+
29
+ def option_optional_args_enabled
30
+ @client.get('/JSON/graphql/view/optionOptionalArgsEnabled/')
31
+ end
32
+
33
+ def option_query_gen_enabled
34
+ @client.get('/JSON/graphql/view/optionQueryGenEnabled/')
35
+ end
36
+
37
+ def option_query_split_type
38
+ @client.get('/JSON/graphql/view/optionQuerySplitType/')
39
+ end
40
+
41
+ def option_request_method
42
+ @client.get('/JSON/graphql/view/optionRequestMethod/')
43
+ end
44
+
45
+ def import_file(endurl, file)
46
+ @client.get("/JSON/graphql/action/importFile/?endurl=#{endurl}&file=#{file}")
47
+ end
48
+
49
+ def import_url(endurl, url)
50
+ @client.get("/JSON/graphql/action/importUrl/?endurl=#{endurl}&url=#{url}")
51
+ end
52
+
53
+ def set_option_args_type(string)
54
+ @client.get("/JSON/graphql/action/setOptionArgsType/?String=#{string}")
55
+ end
56
+
57
+ def set_option_lenient_max_query_depth_enabled(boolean)
58
+ @client.get("/JSON/graphql/action/setOptionLenientMaxQueryDepthEnabled/?Boolean=#{boolean}")
59
+ end
60
+
61
+ def set_option_max_additional_query_depth(integer)
62
+ @client.get("/JSON/graphql/action/setOptionMaxAdditionalQueryDepth/?Integer=#{integer}")
63
+ end
64
+
65
+ def set_option_max_args_depth(integer)
66
+ @client.get("/JSON/graphql/action/setOptionMaxArgsDepth/?Integer=#{integer}")
67
+ end
68
+
69
+ def set_option_max_query_depth(integer)
70
+ @client.get("/JSON/graphql/action/setOptionMaxQueryDepth/?Integer=#{integer}")
71
+ end
72
+
73
+ def set_option_optional_args_enabled(boolean)
74
+ @client.get("/JSON/graphql/action/setOptionOptionalArgsEnabled/?Boolean=#{boolean}")
75
+ end
76
+
77
+ def set_option_query_gen_enabled(boolean)
78
+ @client.get("/JSON/graphql/action/setOptionQueryGenEnabled/?Boolean=#{boolean}")
79
+ end
80
+
81
+ def set_option_query_split_type(string)
82
+ @client.get("/JSON/graphql/action/setOptionQuerySplitType/?String=#{string}")
83
+ end
84
+
85
+ def set_option_request_method(string)
86
+ @client.get("/JSON/graphql/action/setOptionRequestMethod/?String=#{string}")
87
+ end
88
+ end
89
+ end