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,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class HTTPSessions
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def active_session(site)
10
+ @client.get("/JSON/httpSessions/view/activeSession/?site=#{site}")
11
+ end
12
+
13
+ def default_session_tokens
14
+ @client.get('/JSON/httpSessions/view/defaultSessionTokens/')
15
+ end
16
+
17
+ def session_tokens(site)
18
+ @client.get("/JSON/httpSessions/view/sessionTokens/?site=#{site}")
19
+ end
20
+
21
+ def sessions(site, session = nil)
22
+ @client.get("/JSON/httpSessions/view/sessions/?site=#{site}&session=#{session}")
23
+ end
24
+
25
+ def sites
26
+ @client.get('/JSON/httpSessions/view/sites/')
27
+ end
28
+
29
+ def add_default_session_token(token, enabled)
30
+ @client.get("/JSON/httpSessions/action/addDefaultSessionToken/?token=#{token}&enabled=#{enabled}")
31
+ end
32
+
33
+ def add_session_token(site, session_token)
34
+ @client.get("/JSON/httpSessions/action/addSessionToken/?site=#{site}&sessionToken=#{session_token}")
35
+ end
36
+
37
+ def create_empty_session(site, session = nil)
38
+ @client.get("/JSON/httpSessions/action/createEmptySession/?site=#{site}&session=#{session}")
39
+ end
40
+
41
+ def remove_default_session_token(token)
42
+ @client.get("/JSON/httpSessions/action/removeDefaultSessionToken/?token=#{token}")
43
+ end
44
+
45
+ def remove_session(site, session)
46
+ @client.get("/JSON/httpSessions/action/removeSession/?site=#{site}&session=#{session}")
47
+ end
48
+
49
+ def remove_session_token(site, session_token)
50
+ @client.get("/JSON/httpSessions/action/removeSessionToken/?site=#{site}&sessionToken=#{session_token}")
51
+ end
52
+
53
+ def rename_session(site, old_session_name, new_session_name)
54
+ @client.get("/JSON/httpSessions/action/renameSession/?site=#{site}&oldSessionName=#{old_session_name}&newSessionName=#{new_session_name}")
55
+ end
56
+
57
+ def set_active_session(site, session)
58
+ @client.get("/JSON/httpSessions/action/setActiveSession/?site=#{site}&session=#{session}")
59
+ end
60
+
61
+ def set_default_session_token_enabled(token, enabled)
62
+ @client.get("/JSON/httpSessions/action/setDefaultSessionTokenEnabled/?token=#{token}&enabled=#{enabled}")
63
+ end
64
+
65
+ def set_session_token_value(site, session, session_token, token_value)
66
+ @client.get("/JSON/httpSessions/action/setSessionTokenValue/?site=#{site}&session=#{session}&sessionToken=#{session_token}&tokenValue=#{token_value}")
67
+ end
68
+
69
+ def unset_active_session(site)
70
+ @client.get("/JSON/httpSessions/action/unsetActiveSession/?site=#{site}")
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,157 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class HUD
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def get_ui_option(key)
10
+ @client.get("/JSON/hud/view/getUiOption/?key=#{key}")
11
+ end
12
+
13
+ def heartbeat
14
+ @client.get('/JSON/hud/view/heartbeat/')
15
+ end
16
+
17
+ def hud_alert_data(url)
18
+ @client.get("/JSON/hud/view/hudAlertData/?url=#{url}")
19
+ end
20
+
21
+ def option_allow_unsafe_eval
22
+ @client.get('/JSON/hud/view/optionAllowUnsafeEval/')
23
+ end
24
+
25
+ def option_base_directory
26
+ @client.get('/JSON/hud/view/optionBaseDirectory/')
27
+ end
28
+
29
+ def option_development_mode
30
+ @client.get('/JSON/hud/view/optionDevelopmentMode/')
31
+ end
32
+
33
+ def option_enable_on_domain_msgs
34
+ @client.get('/JSON/hud/view/optionEnableOnDomainMsgs/')
35
+ end
36
+
37
+ def option_enable_telemetry
38
+ @client.get('/JSON/hud/view/optionEnableTelemetry/')
39
+ end
40
+
41
+ def option_enabled_for_daemon
42
+ @client.get('/JSON/hud/view/optionEnabledForDaemon/')
43
+ end
44
+
45
+ def option_enabled_for_desktop
46
+ @client.get('/JSON/hud/view/optionEnabledForDesktop/')
47
+ end
48
+
49
+ def option_in_scope_only
50
+ @client.get('/JSON/hud/view/optionInScopeOnly/')
51
+ end
52
+
53
+ def option_remove_csp
54
+ @client.get('/JSON/hud/view/optionRemoveCSP/')
55
+ end
56
+
57
+ def option_show_welcome_screen
58
+ @client.get('/JSON/hud/view/optionShowWelcomeScreen/')
59
+ end
60
+
61
+ def option_skip_tutorial_tasks
62
+ @client.get('/JSON/hud/view/optionSkipTutorialTasks/')
63
+ end
64
+
65
+ def option_tutorial_host
66
+ @client.get('/JSON/hud/view/optionTutorialHost/')
67
+ end
68
+
69
+ def option_tutorial_port
70
+ @client.get('/JSON/hud/view/optionTutorialPort/')
71
+ end
72
+
73
+ def option_tutorial_tasks_done
74
+ @client.get('/JSON/hud/view/optionTzutorialTasksDone/')
75
+ end
76
+
77
+ def option_tutorial_test_mode
78
+ @client.get('/JSON/hud/view/optionTutorialTestMode/')
79
+ end
80
+
81
+ def option_tutorial_updates
82
+ @client.get('/JSON/hud/view/optionTutorialUpdates/')
83
+ end
84
+
85
+ def tutorial_updates
86
+ @client.get('/JSON/hud/view/tutorialUpdates/')
87
+ end
88
+
89
+ def upgraded_domains
90
+ @client.get('/JSON/hud/view/upgradedDomains/')
91
+ end
92
+
93
+ def log(record)
94
+ @client.get("/JSON/hud/action/log/?record=#{record}")
95
+ end
96
+
97
+ def record_request(header, body)
98
+ @client.get("/JSON/hud/action/recordRequest/?header=#{header}&body=#{body}")
99
+ end
100
+
101
+ def reset_tutorial_tasks
102
+ @client.get('/JSON/hud/action/resetTutorialTasks/')
103
+ end
104
+
105
+ def set_option_base_directory(string)
106
+ @client.get("/JSON/hud/action/setOptionBaseDirectory/?String=#{string}")
107
+ end
108
+
109
+ def set_option_development_mode(boolean)
110
+ @client.get("/JSON/hud/action/setOptionDevelopmentMode/?Boolean=#{boolean}")
111
+ end
112
+
113
+ def set_option_enable_on_domain_msgs(boolean)
114
+ @client.get("/JSON/hud/action/setOptionEnableOnDomainMsgs/?Boolean=#{boolean}")
115
+ end
116
+
117
+ def set_option_enabled_for_daemon(boolean)
118
+ @client.get("/JSON/hud/action/setOptionEnabledForDaemon/?Boolean=#{boolean}")
119
+ end
120
+
121
+ def set_option_enabled_for_desktop(boolean)
122
+ @client.get("/JSON/hud/action/setOptionEnabledForDesktop/?Boolean=#{boolean}")
123
+ end
124
+
125
+ def set_option_in_scope_only(boolean)
126
+ @client.get("/JSON/hud/action/setOptionInScopeOnly/?Boolean=#{boolean}")
127
+ end
128
+
129
+ def set_option_remove_csp(boolean)
130
+ @client.get("/JSON/hud/action/setOptionRemoveCSP/?Boolean=#{boolean}")
131
+ end
132
+
133
+ def set_option_show_welcome_screen(boolean)
134
+ @client.get("/JSON/hud/action/setOptionShowWelcomeScreen/?Boolean=#{boolean}")
135
+ end
136
+
137
+ def set_option_skip_tutorial_tasks(boolean)
138
+ @client.get("/JSON/hud/action/setOptionSkipTutorialTasks/?Boolean=#{boolean}")
139
+ end
140
+
141
+ def set_option_tutorial_task_done(string)
142
+ @client.get("/JSON/hud/action/setOptionTutorialTaskDone/?String=#{string}")
143
+ end
144
+
145
+ def set_option_tutorial_test_mode(boolean)
146
+ @client.get("/JSON/hud/action/setOptionTutorialTestMode/?Boolean=#{boolean}")
147
+ end
148
+
149
+ def set_ui_option(key, value)
150
+ @client.get("/JSON/hud/action/setUiOption/?key=#{key}&value=#{value}")
151
+ end
152
+
153
+ def changes_in_html
154
+ @client.get('/OTHER/hud/other/changesInHtml/')
155
+ end
156
+ end
157
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class ImportURLs
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def importurls(file_path)
10
+ @client.get("/JSON/importurls/action/importurls/?filePath=#{file_path}")
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class Keyboard
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def cheatsheet_action_order(inc_unset)
10
+ @client.get("/JSON/keyboard/view/cheatsheetActionOrder/?incUnset=#{inc_unset}")
11
+ end
12
+
13
+ def cheatsheet_key_order(inc_unset)
14
+ @client.get("/JSON/keyboard/view/cheatsheetKeyOrder/?incUnset=#{inc_unset}")
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class LocalProxies
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def additional_proxies
10
+ @client.get('/JSON/localProxies/view/additionalProxies/')
11
+ end
12
+
13
+ def add_additional_proxy(address, port, behind_nat, always_decode_zip, remove_unsupported_encodings)
14
+ @client.get("/JSON/localProxies/action/addAdditionalProxy/?address=#{address}&port=#{port}&behindNat=#{behind_nat}&alwaysDecodeZip=#{always_decode_zip}&removeUnsupportedEncodings=#{remove_unsupported_encodings}")
15
+ end
16
+
17
+ def remove_additional_proxy(address, port)
18
+ @client.get("/JSON/localProxies/action/removeAdditionalProxy/?address=#{address}&port=#{port}")
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,201 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class Network
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def get_aliases
10
+ @client.get('/JSON/network/view/getAliases/')
11
+ end
12
+
13
+ def get_connection_timeout
14
+ @client.get('/JSON/network/view/getConnectionTimeout/')
15
+ end
16
+
17
+ def get_default_user_agent
18
+ @client.get('/JSON/network/view/getDefaultUserAgent/')
19
+ end
20
+
21
+ def get_dns_ttl_successful_queries
22
+ @client.get('/JSON/network/view/getDnsTtlSuccessfulQueries/')
23
+ end
24
+
25
+ def get_http_proxy
26
+ @client.get('/JSON/network/view/getHttpProxy/')
27
+ end
28
+
29
+ def get_http_proxy_exclusions
30
+ @client.get('/JSON/network/view/getHttpProxyExclusions/')
31
+ end
32
+
33
+ def get_local_servers
34
+ @client.get('/JSON/network/view/getLocalServers/')
35
+ end
36
+
37
+ def get_pass_throughs
38
+ @client.get('/JSON/network/view/getPassThroughs/')
39
+ end
40
+
41
+ def get_rate_limit_rules
42
+ @client.get('/JSON/network/view/getRateLimitRules/')
43
+ end
44
+
45
+ def get_root_ca_cert_validity
46
+ @client.get('/JSON/network/view/getRootCaCertValidity/')
47
+ end
48
+
49
+ def get_server_cert_validity
50
+ @client.get('/JSON/network/view/getServerCertValidity/')
51
+ end
52
+
53
+ def get_socks_proxy
54
+ @client.get('/JSON/network/view/getSocksProxy/')
55
+ end
56
+
57
+ def is_http_proxy_auth_enabled
58
+ @client.get('/JSON/network/view/isHttpProxyAuthEnabled/')
59
+ end
60
+
61
+ def is_http_proxy_enabled
62
+ @client.get('/JSON/network/view/isHttpProxyEnabled/')
63
+ end
64
+
65
+ def is_socks_proxy_enabled
66
+ @client.get('/JSON/network/view/isSocksProxyEnabled/')
67
+ end
68
+
69
+ def is_use_global_http_state
70
+ @client.get('/JSON/network/view/isUseGlobalHttpState/')
71
+ end
72
+
73
+ def add_alias(name, enabled)
74
+ @client.get("/JSON/network/action/addAlias/?name=#{name}&enabled=#{enabled}")
75
+ end
76
+
77
+ def add_http_proxy_exclusion(host, enabled)
78
+ @client.get("/JSON/network/action/addHttpProxyExclusion/?host=#{host}&enabled=#{enabled}")
79
+ end
80
+
81
+ def add_local_server(address, port, api, proxy, behind_nat, decode_response, remove_accept_encoding)
82
+ @client.get("/JSON/network/action/addLocalServer/?address=#{address}&port=#{port}&api=#{api}&proxy=#{proxy}&behindNat=#{behind_nat}&decodeResponse=#{decode_response}&removeAcceptEncoding=#{remove_accept_encoding}")
83
+ end
84
+
85
+ def add_pass_through(authority, enabled)
86
+ @client.get("/JSON/network/action/addPassThrough/?authority=#{authority}&enabled=#{enabled}")
87
+ end
88
+
89
+ def add_pkcs12_client_certificate(file_path, password, index)
90
+ @client.get("/JSON/network/action/addPkcs12ClientCertificate/?filePath=#{file_path}&password=#{password}&index=#{index}")
91
+ end
92
+
93
+ def add_rate_limit_rule(description, enabled, match_regex, match_string, requests_per_second, group_by)
94
+ @client.get("/JSON/network/action/addRateLimitRule/?description=#{description}&enabled=#{enabled}&matchRegex=#{match_regex}&matchString=#{match_string}&requestsPerSecond=#{requests_per_second}&groupBy=#{group_by}")
95
+ end
96
+
97
+ def generate_root_ca_cert
98
+ @client.get('/JSON/network/action/generateRootCaCert/')
99
+ end
100
+
101
+ def import_root_ca_cert(file_path)
102
+ @client.get("/JSON/network/action/importRootCaCert/?filePath=#{file_path}")
103
+ end
104
+
105
+ def remove_alias(name)
106
+ @client.get("/JSON/network/action/removeAlias/?name=#{name}")
107
+ end
108
+
109
+ def remove_http_proxy_exclusion(host)
110
+ @client.get("/JSON/network/action/removeHttpProxyExclusion/?host=#{host}")
111
+ end
112
+
113
+ def remove_local_server(address, port)
114
+ @client.get("/JSON/network/action/removeLocalServer/?address=#{address}&port=#{port}")
115
+ end
116
+
117
+ def remove_pass_through(authority)
118
+ @client.get("/JSON/network/action/removePassThrough/?authority=#{authority}")
119
+ end
120
+
121
+ def remove_rate_limit_rule(description)
122
+ @client.get("/JSON/network/action/removeRateLimitRule/?description=#{description}")
123
+ end
124
+
125
+ def set_alias_enabled(name, enabled)
126
+ @client.get("/JSON/network/action/setAliasEnabled/?name=#{name}&enabled=#{enabled}")
127
+ end
128
+
129
+ def set_connection_timeout(timeout)
130
+ @client.get("/JSON/network/action/setConnectionTimeout/?timeout=#{timeout}")
131
+ end
132
+
133
+ def set_default_user_agent(user_agent)
134
+ @client.get("/JSON/network/action/setDefaultUserAgent/?userAgent=#{user_agent}")
135
+ end
136
+
137
+ def set_dns_ttl_successful_queries(ttl)
138
+ @client.get("/JSON/network/action/setDnsTtlSuccessfulQueries/?ttl=#{ttl}")
139
+ end
140
+
141
+ def set_http_proxy(host, port, realm, username, password)
142
+ @client.get("/JSON/network/action/setHttpProxy/?host=#{host}&port=#{port}&realm=#{realm}&username=#{username}&password=#{password}")
143
+ end
144
+
145
+ def set_http_proxy_auth_enabled(enabled)
146
+ @client.get("/JSON/network/action/setHttpProxyAuthEnabled/?enabled=#{enabled}")
147
+ end
148
+
149
+ def set_http_proxy_enabled(enabled)
150
+ @client.get("/JSON/network/action/setHttpProxyEnabled/?enabled=#{enabled}")
151
+ end
152
+
153
+ def set_http_proxy_exclusion_enabled(host, enabled)
154
+ @client.get("/JSON/network/action/setHttpProxyExclusionEnabled/?host=#{host}&enabled=#{enabled}")
155
+ end
156
+
157
+ def set_pass_through_enabled(authority, enabled)
158
+ @client.get("/JSON/network/action/setPassThroughEnabled/?authority=#{authority}&enabled=#{enabled}")
159
+ end
160
+
161
+ def set_rate_limit_rule_enabled(description, enabled)
162
+ @client.get("/JSON/network/action/setRateLimitRuleEnabled/?description=#{description}&enabled=#{enabled}")
163
+ end
164
+
165
+ def set_root_ca_cert_validity(validity)
166
+ @client.get("/JSON/network/action/setRootCaCertValidity/?validity=#{validity}")
167
+ end
168
+
169
+ def set_server_cert_validity(validity)
170
+ @client.get("/JSON/network/action/setServerCertValidity/?validity=#{validity}")
171
+ end
172
+
173
+ def set_socks_proxy(host, port, version, use_dns, username, password)
174
+ @client.get("/JSON/network/action/setSocksProxy/?host=#{host}&port=#{port}&version=#{version}&useDns=#{use_dns}&username=#{username}&password=#{password}")
175
+ end
176
+
177
+ def set_socks_proxy_enabled(enabled)
178
+ @client.get("/JSON/network/action/setSocksProxyEnabled/?enabled=#{enabled}")
179
+ end
180
+
181
+ def set_use_client_certificate(use)
182
+ @client.get("/JSON/network/action/setUseClientCertificate/?use=#{use}")
183
+ end
184
+
185
+ def set_use_global_http_state(use)
186
+ @client.get("/JSON/network/action/setUseGlobalHttpState/?use=#{use}")
187
+ end
188
+
189
+ def proxy_pac
190
+ @client.get('/OTHER/network/other/proxy.pac/')
191
+ end
192
+
193
+ def root_ca_cert
194
+ @client.get('/OTHER/network/other/rootCaCert/')
195
+ end
196
+
197
+ def set_proxy(proxy)
198
+ @client.get("/OTHER/network/other/setProxy/?proxy=#{proxy}")
199
+ end
200
+ end
201
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class OpenAPI
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def import_file(target, contextid)
10
+ @client.get("/JSON/openapi/action/importFile/?target=#{target}&contextId=#{contextid}")
11
+ end
12
+
13
+ def import_url(host_override, contextid)
14
+ @client.get("/JSON/openapi/action/importUrl/?hostOverride=#{host_override}&contextId=#{contextid}")
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class Params
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def params(site)
10
+ @client.get("/JSON/params/view/params/?site=#{site}")
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class PnH
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def monitor(message)
10
+ @client.get("/JSON/pnh/action/monitor/?message=#{message}")
11
+ end
12
+
13
+ def oracle
14
+ @client.get('/JSON/pnh/view/oracle/')
15
+ end
16
+
17
+ def start_monitoring(url)
18
+ @client.get("/JSON/pnh/action/startMonitoring/?url=#{url}")
19
+ end
20
+
21
+ def stop_monitoring(id)
22
+ @client.get("/JSON/pnh/action/stopMonitoring/?id=#{id}")
23
+ end
24
+
25
+ def fx_pnh_xpi
26
+ @client.get('/OTHER/core/other/fx_pnh.xpi/')
27
+ end
28
+
29
+ def manifest
30
+ @client.get('/OTHER/core/other/manifest/')
31
+ end
32
+
33
+ def pnh
34
+ @client.get('/OTHER/core/other/pnh/')
35
+ end
36
+
37
+ def service
38
+ @client.get('/OTHER/core/other/service/')
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class Postman
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def import_file(target, contextid)
10
+ @client.get("/JSON/postman/action/importFile/?target=#{target}&contextId=#{contextid}")
11
+ end
12
+
13
+ def import_url(host_override, contextid)
14
+ @client.get("/JSON/postman/action/importUrl/?hostOverride=#{host_override}&contextId=#{contextid}")
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class Pscan
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def current_rule
10
+ @client.get('/JSON/pscan/view/currentRule/')
11
+ end
12
+
13
+ def current_tasks
14
+ @client.get('/JSON/pscan/view/currentTasks/')
15
+ end
16
+
17
+ def max_alerts_per_rule
18
+ @client.get('/JSON/pscan/view/maxAlertsPerRule/')
19
+ end
20
+
21
+ def records_to_scan
22
+ @client.get('/JSON/pscan/view/recordsToScan/')
23
+ end
24
+
25
+ def scan_only_in_scope
26
+ @client.get('/JSON/pscan/view/scanOnlyInScope/')
27
+ end
28
+
29
+ def scanners
30
+ @client.get('/JSON/pscan/view/scanners/')
31
+ end
32
+
33
+ def clear_queue
34
+ @client.get('/JSON/pscan/action/clearQueue/')
35
+ end
36
+
37
+ def disable_all_scanners
38
+ @client.get('/JSON/pscan/action/disableAllScanners/')
39
+ end
40
+
41
+ def disable_all_tags
42
+ @client.get('/JSON/pscan/action/disableAllTags/')
43
+ end
44
+
45
+ def disable_scanners(ids)
46
+ @client.get("/JSON/pscan/action/disableScanners/?ids=#{ids}")
47
+ end
48
+
49
+ def enable_all_scanners
50
+ @client.get('/JSON/pscan/action/enableAllScanners/')
51
+ end
52
+
53
+ def enable_all_tags
54
+ @client.get('/JSON/pscan/action/enableAllTags/')
55
+ end
56
+
57
+ def enable_scanners(ids)
58
+ @client.get("/JSON/pscan/action/enableScanners/?ids=#{ids}")
59
+ end
60
+
61
+ def set_enabled(enabled)
62
+ @client.get("/JSON/pscan/action/setEnabled/?enabled=#{enabled}")
63
+ end
64
+
65
+ def set_max_alerts_per_rule(max_alerts)
66
+ @client.get("/JSON/pscan/action/setMaxAlertsPerRule/?maxAlerts=#{max_alerts}")
67
+ end
68
+
69
+ def set_scan_only_in_scope(only_in_scope)
70
+ @client.get("/JSON/pscan/action/setScanOnlyInScope/?onlyInScope=#{only_in_scope}")
71
+ end
72
+
73
+ def set_scanner_alert_threshold(id, alert_threshold)
74
+ @client.get("/JSON/pscan/action/setScannerAlertThreshold/?id=#{id}&alertThreshold=#{alert_threshold}")
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class QuickStartLaunch
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def start_page
10
+ @client.get('/JSON/quickstart/view/startPage/')
11
+ end
12
+ end
13
+ end