zaproxy 0.0.1 → 0.0.2

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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -0
  3. data/.rubocop.yml +213 -0
  4. data/README.md +3 -1
  5. data/Rakefile +21 -0
  6. data/SECURITY.md +21 -0
  7. data/lib/v2apis/_template.rb +13 -0
  8. data/lib/v2apis/access_control.rb +25 -0
  9. data/lib/v2apis/acsrf.rb +33 -0
  10. data/lib/v2apis/ajax_spider.rb +153 -0
  11. data/lib/v2apis/alert.rb +61 -0
  12. data/lib/v2apis/alert_filter.rb +57 -0
  13. data/lib/v2apis/ascan.rb +361 -0
  14. data/lib/v2apis/authentication.rb +41 -0
  15. data/lib/v2apis/authorization.rb +17 -0
  16. data/lib/v2apis/automation.rb +21 -0
  17. data/lib/v2apis/autoupdate.rb +133 -0
  18. data/lib/v2apis/break.rb +57 -0
  19. data/lib/v2apis/client.rb +25 -0
  20. data/lib/v2apis/context.rb +93 -0
  21. data/lib/v2apis/core.rb +389 -0
  22. data/lib/v2apis/exim.rb +37 -0
  23. data/lib/v2apis/forced_user.rb +25 -0
  24. data/lib/v2apis/graphql.rb +89 -0
  25. data/lib/v2apis/http_sessions.rb +73 -0
  26. data/lib/v2apis/hud.rb +157 -0
  27. data/lib/v2apis/import_urls.rb +13 -0
  28. data/lib/v2apis/keyboard.rb +17 -0
  29. data/lib/v2apis/local_proxies.rb +21 -0
  30. data/lib/v2apis/network.rb +201 -0
  31. data/lib/v2apis/openapi.rb +17 -0
  32. data/lib/v2apis/params.rb +13 -0
  33. data/lib/v2apis/pnh.rb +41 -0
  34. data/lib/v2apis/postman.rb +17 -0
  35. data/lib/v2apis/pscan.rb +77 -0
  36. data/lib/v2apis/quickstartlaunch.rb +13 -0
  37. data/lib/v2apis/replacer.rb +25 -0
  38. data/lib/v2apis/reports.rb +21 -0
  39. data/lib/v2apis/retest.rb +13 -0
  40. data/lib/v2apis/reveal.rb +17 -0
  41. data/lib/v2apis/revisit.rb +21 -0
  42. data/lib/v2apis/rule_config.rb +29 -0
  43. data/lib/v2apis/script.rb +105 -0
  44. data/lib/v2apis/search.rb +57 -0
  45. data/lib/v2apis/selenium.rb +93 -0
  46. data/lib/v2apis/session_management.rb +29 -0
  47. data/lib/v2apis/soap.rb +17 -0
  48. data/lib/v2apis/spider.rb +293 -0
  49. data/lib/v2apis/stats.rb +61 -0
  50. data/lib/v2apis/users.rb +69 -0
  51. data/lib/v2apis/wappalyzer.rb +21 -0
  52. data/lib/v2apis/websocket.rb +33 -0
  53. data/lib/zap.rb +51 -3
  54. data/lib/zapv2.rb +102 -0
  55. data/openapi.yaml +11314 -0
  56. data/zaproxy.gemspec +4 -3
  57. metadata +57 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57955bce7ccfe3d6bbf2d6466fbf2013bed147bed70c664059586623ce09274b
4
- data.tar.gz: 9ed1916b65f666700fe5326ebc92261346708318575d99bccc3d0024ba62c6b9
3
+ metadata.gz: 3095ddde4abca34f1e4e4f178fb336d6945becc2e9d88cc15230209e4670b302
4
+ data.tar.gz: 3ca82263c062f3d0aa00cf9c170d8d3243b0e15064dde7ac8e7e88ddb44e9d43
5
5
  SHA512:
6
- metadata.gz: c1f0f36146d9994c8d5e28076b6ca315521d36fea187c2681268689e31996a1e992089f7d3f71b4c18847ac5b12a70b1d19c25751a5a8717515a2ea03b9eae59
7
- data.tar.gz: 82cff2f12de003e5c1ca1a32897265595d0b5541e07ca1dd5ea8914cad3a42e7d7ca6cebe9fc94b5758b238ef825a0ffc99afebaaf6d01563d5527e08567b6cd
6
+ metadata.gz: c68be8db5eec6a43f6a12d8ad06d0a643f6aeebecbba728110d8d713b095821b1171430ebf3116961b98a245da5d2f71afd7977fea983d839edfe15ce964164f
7
+ data.tar.gz: fb31a558e8757deb5e0dd0c22548ac61d7c4dfe148cb481ac61b8b8e3fd548fb4f3b115965f39979fce8d918c9727d8e071130cf6310fc5466994d2e332b1258
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,213 @@
1
+ # https://docs.rubocop.org/rubocop/configuration
2
+
3
+ AllCops:
4
+ NewCops: enable
5
+
6
+ Gemspec/DeprecatedAttributeAssignment: # new in 1.30
7
+ Enabled: true
8
+ Gemspec/DevelopmentDependencies: # new in 1.44
9
+ Enabled: true
10
+ Gemspec/RequireMFA: # new in 1.23
11
+ Enabled: true
12
+ Layout/LineContinuationLeadingSpace: # new in 1.31
13
+ Enabled: true
14
+ Layout/LineContinuationSpacing: # new in 1.31
15
+ Enabled: true
16
+ Layout/LineEndStringConcatenationIndentation: # new in 1.18
17
+ Enabled: true
18
+ Layout/SpaceBeforeBrackets: # new in 1.7
19
+ Enabled: true
20
+ Layout/LineLength:
21
+ Enabled: false
22
+ Lint/AmbiguousAssignment: # new in 1.7
23
+ Enabled: true
24
+ Lint/AmbiguousOperatorPrecedence: # new in 1.21
25
+ Enabled: true
26
+ Lint/AmbiguousRange: # new in 1.19
27
+ Enabled: true
28
+ Lint/ConstantOverwrittenInRescue: # new in 1.31
29
+ Enabled: true
30
+ Lint/DeprecatedConstants: # new in 1.8
31
+ Enabled: true
32
+ Lint/DuplicateBranch: # new in 1.3
33
+ Enabled: true
34
+ Lint/DuplicateMagicComment: # new in 1.37
35
+ Enabled: true
36
+ Lint/DuplicateMatchPattern: # new in 1.50
37
+ Enabled: true
38
+ Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
39
+ Enabled: true
40
+ Lint/EmptyBlock: # new in 1.1
41
+ Enabled: true
42
+ Lint/EmptyClass: # new in 1.3
43
+ Enabled: true
44
+ Lint/EmptyInPattern: # new in 1.16
45
+ Enabled: true
46
+ Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
47
+ Enabled: true
48
+ Lint/LambdaWithoutLiteralBlock: # new in 1.8
49
+ Enabled: true
50
+ Lint/MixedCaseRange: # new in 1.53
51
+ Enabled: true
52
+ Lint/NoReturnInBeginEndBlocks: # new in 1.2
53
+ Enabled: true
54
+ Lint/NonAtomicFileOperation: # new in 1.31
55
+ Enabled: true
56
+ Lint/NumberedParameterAssignment: # new in 1.9
57
+ Enabled: true
58
+ Lint/OrAssignmentToConstant: # new in 1.9
59
+ Enabled: true
60
+ Lint/RedundantDirGlobSort: # new in 1.8
61
+ Enabled: true
62
+ Lint/RedundantRegexpQuantifiers: # new in 1.53
63
+ Enabled: true
64
+ Lint/RefinementImportMethods: # new in 1.27
65
+ Enabled: true
66
+ Lint/RequireRangeParentheses: # new in 1.32
67
+ Enabled: true
68
+ Lint/RequireRelativeSelfPath: # new in 1.22
69
+ Enabled: true
70
+ Lint/SymbolConversion: # new in 1.9
71
+ Enabled: true
72
+ Lint/ToEnumArguments: # new in 1.1
73
+ Enabled: true
74
+ Lint/TripleQuotes: # new in 1.9
75
+ Enabled: true
76
+ Lint/UnexpectedBlockArity: # new in 1.5
77
+ Enabled: true
78
+ Lint/UnmodifiedReduceAccumulator: # new in 1.1
79
+ Enabled: true
80
+ Lint/UselessRescue: # new in 1.43
81
+ Enabled: true
82
+ Lint/UselessRuby2Keywords: # new in 1.23
83
+ Enabled: true
84
+ Metrics/CollectionLiteralLength: # new in 1.47
85
+ Enabled: true
86
+ Metrics/ParameterLists:
87
+ Enabled: false
88
+ Metrics/ClassLength:
89
+ Max: 400
90
+ Metrics/MethodLength:
91
+ Max: 50
92
+ Metrics/AbcSize:
93
+ Max: 70
94
+ Naming/BlockForwarding: # new in 1.24
95
+ Enabled: true
96
+ Naming/AccessorMethodName:
97
+ Enabled: false
98
+ Naming/PredicateName:
99
+ Enabled: false
100
+ Security/CompoundHash: # new in 1.28
101
+ Enabled: true
102
+ Security/IoMethods: # new in 1.22
103
+ Enabled: true
104
+ Style/ArgumentsForwarding: # new in 1.1
105
+ Enabled: true
106
+ Style/ArrayIntersect: # new in 1.40
107
+ Enabled: true
108
+ Style/CollectionCompact: # new in 1.2
109
+ Enabled: true
110
+ Style/ComparableClamp: # new in 1.44
111
+ Enabled: true
112
+ Style/ConcatArrayLiterals: # new in 1.41
113
+ Enabled: true
114
+ Style/DataInheritance: # new in 1.49
115
+ Enabled: true
116
+ Style/DirEmpty: # new in 1.48
117
+ Enabled: true
118
+ Style/Documentation:
119
+ Enabled: false
120
+ Style/DocumentDynamicEvalDefinition: # new in 1.1
121
+ Enabled: true
122
+ Style/EmptyHeredoc: # new in 1.32
123
+ Enabled: true
124
+ Style/EndlessMethod: # new in 1.8
125
+ Enabled: true
126
+ Style/EnvHome: # new in 1.29
127
+ Enabled: true
128
+ Style/ExactRegexpMatch: # new in 1.51
129
+ Enabled: true
130
+ Style/FetchEnvVar: # new in 1.28
131
+ Enabled: true
132
+ Style/FileEmpty: # new in 1.48
133
+ Enabled: true
134
+ Style/FileRead: # new in 1.24
135
+ Enabled: true
136
+ Style/FileWrite: # new in 1.24
137
+ Enabled: true
138
+ Style/HashConversion: # new in 1.10
139
+ Enabled: true
140
+ Style/HashExcept: # new in 1.7
141
+ Enabled: true
142
+ Style/IfWithBooleanLiteralBranches: # new in 1.9
143
+ Enabled: true
144
+ Style/InPatternThen: # new in 1.16
145
+ Enabled: true
146
+ Style/MagicCommentFormat: # new in 1.35
147
+ Enabled: true
148
+ Style/MapCompactWithConditionalBlock: # new in 1.30
149
+ Enabled: true
150
+ Style/MapToHash: # new in 1.24
151
+ Enabled: true
152
+ Style/MapToSet: # new in 1.42
153
+ Enabled: true
154
+ Style/MinMaxComparison: # new in 1.42
155
+ Enabled: true
156
+ Style/MultilineInPatternThen: # new in 1.16
157
+ Enabled: true
158
+ Style/NegatedIfElseCondition: # new in 1.2
159
+ Enabled: true
160
+ Style/NestedFileDirname: # new in 1.26
161
+ Enabled: true
162
+ Style/NilLambda: # new in 1.3
163
+ Enabled: true
164
+ Style/NumberedParameters: # new in 1.22
165
+ Enabled: true
166
+ Style/NumberedParametersLimit: # new in 1.22
167
+ Enabled: true
168
+ Style/ObjectThen: # new in 1.28
169
+ Enabled: true
170
+ Style/OpenStructUse: # new in 1.23
171
+ Enabled: true
172
+ Style/OperatorMethodCall: # new in 1.37
173
+ Enabled: true
174
+ Style/QuotedSymbols: # new in 1.16
175
+ Enabled: true
176
+ Style/RedundantArgument: # new in 1.4
177
+ Enabled: true
178
+ Style/RedundantArrayConstructor: # new in 1.52
179
+ Enabled: true
180
+ Style/RedundantConstantBase: # new in 1.40
181
+ Enabled: true
182
+ Style/RedundantCurrentDirectoryInPath: # new in 1.53
183
+ Enabled: true
184
+ Style/RedundantDoubleSplatHashBraces: # new in 1.41
185
+ Enabled: true
186
+ Style/RedundantEach: # new in 1.38
187
+ Enabled: true
188
+ Style/RedundantFilterChain: # new in 1.52
189
+ Enabled: true
190
+ Style/RedundantHeredocDelimiterQuotes: # new in 1.45
191
+ Enabled: true
192
+ Style/RedundantInitialize: # new in 1.27
193
+ Enabled: true
194
+ Style/RedundantLineContinuation: # new in 1.49
195
+ Enabled: true
196
+ Style/RedundantRegexpArgument: # new in 1.53
197
+ Enabled: true
198
+ Style/RedundantRegexpConstructor: # new in 1.52
199
+ Enabled: true
200
+ Style/RedundantSelfAssignmentBranch: # new in 1.19
201
+ Enabled: true
202
+ Style/RedundantStringEscape: # new in 1.37
203
+ Enabled: true
204
+ Style/ReturnNilInPredicateMethodDefinition: # new in 1.53
205
+ Enabled: true
206
+ Style/SelectByRegexp: # new in 1.22
207
+ Enabled: true
208
+ Style/StringChars: # new in 1.12
209
+ Enabled: true
210
+ Style/SwapValues: # new in 1.1
211
+ Enabled: true
212
+ Style/YAMLFileRead: # new in 1.53
213
+ Enabled: true
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ <img src="https://github.com/hahwul/zaproxy-ruby/assets/13212227/83423722-0148-4a49-9347-54b145eda387" width="160px">
2
+
1
3
  # zaproxy-ruby
2
4
 
3
- The unofficial Ruby implementation to access the [ZAP API](https://www.zaproxy.org/docs/api/#introduction).
5
+ A Ruby Implementation and Library for Easy Utilization of [ZAP API](https://www.zaproxy.org/docs/api/#introduction).
data/Rakefile ADDED
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rake'
4
+ require 'yaml'
5
+ require_relative 'lib/zapv2'
6
+
7
+ desc 'Verify endpoints'
8
+ task :verify_endpoints do
9
+ # Load the OpenAPI specification
10
+ spec = YAML.load_file('./openapi.yaml')
11
+
12
+ # Extract the endpoints from the specification
13
+ spec['paths'].keys
14
+
15
+ ZAPv2.new(endpoint: 'http://localhost:8090')
16
+
17
+ # enum instances's sub classes
18
+ ZAPv2.constants.each do |c|
19
+ puts c unless %w[API API_KEY_DEFAULT].include? c.to_s
20
+ end
21
+ end
data/SECURITY.md ADDED
@@ -0,0 +1,21 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ Use this section to tell people about which versions of your project are
6
+ currently being supported with security updates.
7
+
8
+ | Version | Supported |
9
+ | ------- | ------------------ |
10
+ | 5.1.x | :white_check_mark: |
11
+ | 5.0.x | :x: |
12
+ | 4.0.x | :white_check_mark: |
13
+ | < 4.0 | :x: |
14
+
15
+ ## Reporting a Vulnerability
16
+
17
+ Use this section to tell people how to report a vulnerability.
18
+
19
+ Tell them where to go, how often they can expect to get an update on a
20
+ reported vulnerability, what to expect if the vulnerability is accepted or
21
+ declined, etc.
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class Template
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def sample(_arg)
10
+ @client.get('/JSON/template/view/sample/')
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class AccessControl
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def get_scan_progress(contextid)
10
+ @client.get("/JSON/accessControl/view/getScanProgress/?contextId=#{contextid}")
11
+ end
12
+
13
+ def get_scan_status(contextid)
14
+ @client.get("/JSON/accessControl/view/getScanStatus/?contextId=#{contextid}")
15
+ end
16
+
17
+ def scan(contextid, userid, scanasunauthuser = '', riasealert = '', alsertrisklevel = '')
18
+ @client.get("/JSON/accessControl/action/scan/?contextId=#{contextid}&userId=#{userid}&scanAsUnAuthUser=#{scanasunauthuser}&raiseAlert=#{riasealert}&alertRiskLevel=#{alsertrisklevel}")
19
+ end
20
+
21
+ def write_html_report(contextid, filename)
22
+ @client.get("/JSON/accessControl/action/writeHTMLreport/?contextId=#{contextid}&fileName=#{filename}")
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class Acsrf
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def option_partial_matching_enabled
10
+ @client.get('/JSON/acsrf/view/optionPartialMatchingEnabled/')
11
+ end
12
+
13
+ def option_tokens_names
14
+ @client.get('/JSON/acsrf/view/optionTokensNames/')
15
+ end
16
+
17
+ def add_option_token(string)
18
+ @client.get("/JSON/acsrf/action/addOptionToken/?String=#{string}")
19
+ end
20
+
21
+ def remove_option_token(string)
22
+ @client.get("/JSON/acsrf/action/removeOptionToken/?String=#{string}")
23
+ end
24
+
25
+ def set_option_partial_matching_enabled(boolean)
26
+ @client.get("/JSON/acsrf/action/setOptionPartialMatchingEnabled/?Boolean=#{boolean}")
27
+ end
28
+
29
+ def gen_form(href_id, action_url)
30
+ @client.get("/JSON/acsrf/other/genForm/?hrefId=#{href_id}&actionUrl=#{action_url}")
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,153 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class AjaxSpider
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ # view
10
+ def allowed_resources
11
+ @client.get('/JSON/ajaxSpider/view/allowedResources/')
12
+ end
13
+
14
+ def excluded_elements(contextname = '')
15
+ @client.get("/JSON/ajaxSpider/view/excludedElements/?contextName=#{contextname}")
16
+ end
17
+
18
+ def full_results
19
+ @client.get('/JSON/ajaxSpider/view/fullResults/')
20
+ end
21
+
22
+ def number_of_results
23
+ @client.get('/JSON/ajaxSpider/view/numberOfResults/')
24
+ end
25
+
26
+ def option_browser_id
27
+ @client.get('/JSON/ajaxSpider/view/optionBrowserId/')
28
+ end
29
+
30
+ def option_click_default_elems
31
+ @client.get('/JSON/ajaxSpider/view/optionClickDefaultElems/')
32
+ end
33
+
34
+ def option_click_elems_once
35
+ @client.get('/JSON/ajaxSpider/view/optionClickElemsOnce/')
36
+ end
37
+
38
+ def option_event_wait
39
+ @client.get('/JSON/ajaxSpider/view/optionEventWait/')
40
+ end
41
+
42
+ def option_max_crawl_depth
43
+ @client.get('/JSON/ajaxSpider/view/optionMaxCrawlDepth/')
44
+ end
45
+
46
+ def option_max_crawl_states
47
+ @client.get('/JSON/ajaxSpider/view/optionMaxCrawlStates/')
48
+ end
49
+
50
+ def option_max_duration
51
+ @client.get('/JSON/ajaxSpider/view/optionMaxDuration/')
52
+ end
53
+
54
+ def option_number_of_browsers
55
+ @client.get('/JSON/ajaxSpider/view/optionNumberOfBrowsers/')
56
+ end
57
+
58
+ def option_random_inputs
59
+ @client.get('/JSON/ajaxSpider/view/optionRandomInputs/')
60
+ end
61
+
62
+ def option_reload_wait
63
+ @client.get('/JSON/ajaxSpider/view/optionReloadWait/')
64
+ end
65
+
66
+ def results(start, count)
67
+ @client.get("/JSON/ajaxSpider/view/results/?start=#{start}&count=#{count}")
68
+ end
69
+
70
+ def status
71
+ @client.get('/JSON/ajaxSpider/view/status/')
72
+ end
73
+
74
+ # action
75
+ def add_allowed_resource(regex, enabled = '')
76
+ @client.get("/JSON/ajaxSpider/action/addAllowedResource/?regex=#{regex}&enabled=#{enabled}")
77
+ end
78
+
79
+ def add_excluded_element(contextname, description, element, xpath, text, attributename, attributevalue,
80
+ enabled = '')
81
+ @client.get("/JSON/ajaxSpider/action/addExcludedElement/?contextName=#{contextname}&description=#{description}&element=#{element}&xpath=#{xpath}&text=#{text}&attributeName=#{attributename}&attributeValue=#{attributevalue}&enabled=#{enabled}")
82
+ end
83
+
84
+ def modify_excluded_element(contextname, description, element, descriptionnew, xpath, text, attributename,
85
+ attributevalue, enabled = '')
86
+ @client.get("/JSON/ajaxSpider/action/modifyExcludedElement/?contextName=#{contextname}&description=#{description}&element=#{element}&descriptionNew=#{descriptionnew}&xpath=#{xpath}&text=#{text}&attributeName=#{attributename}&attributeValue=#{attributevalue}&enabled=#{enabled}")
87
+ end
88
+
89
+ def remove_allowed_resource(regex)
90
+ @client.get("/JSON/ajaxSpider/action/removeAllowedResource/?regex=#{regex}")
91
+ end
92
+
93
+ def remove_excluded_element(contextname, description)
94
+ @client.get("/JSON/ajaxSpider/action/removeExcludedElement/?contextName=#{contextname}&description=#{description}")
95
+ end
96
+
97
+ def scan(url, inscope = '', contextname = '', subtreeonly = '')
98
+ @client.get("/JSON/ajaxSpider/action/scan/?url=#{url}&inScope=#{inscope}&contextName=#{contextname}&subtreeOnly=#{subtreeonly}")
99
+ end
100
+
101
+ def scan_as_user(contextname, username, url, subtreeonly = '')
102
+ @client.get("/JSON/ajaxSpider/action/scanAsUser/?contextName=#{contextname}&userName=#{username}&url=#{url}&subtreeOnly=#{subtreeonly}")
103
+ end
104
+
105
+ def set_enabled_allowed_resource(regex, enabled = '')
106
+ @client.get("/JSON/ajaxSpider/action/setEnabledAllowedResource/?regex=#{regex}&enabled=#{enabled}")
107
+ end
108
+
109
+ def set_option_browser_id(string)
110
+ @client.get("/JSON/ajaxSpider/action/setOptionBrowserId/?String=#{string}")
111
+ end
112
+
113
+ def set_option_click_default_elems(boolean)
114
+ @client.get("/JSON/ajaxSpider/action/setOptionClickDefaultElems/?Boolean=#{boolean}")
115
+ end
116
+
117
+ def set_option_click_elems_once(boolean)
118
+ @client.get("/JSON/ajaxSpider/action/setOptionClickElemsOnce/?Boolean=#{boolean}")
119
+ end
120
+
121
+ def set_option_event_wait(integer)
122
+ @client.get("/JSON/ajaxSpider/action/setOptionEventWait/?Integer=#{integer}")
123
+ end
124
+
125
+ def set_option_max_crawl_depth(integer)
126
+ @client.get("/JSON/ajaxSpider/action/setOptionMaxCrawlDepth/?Integer=#{integer}")
127
+ end
128
+
129
+ def set_option_max_crawl_states(integer)
130
+ @client.get("/JSON/ajaxSpider/action/setOptionMaxCrawlStates/?Integer=#{integer}")
131
+ end
132
+
133
+ def set_option_max_duration(integer)
134
+ @client.get("/JSON/ajaxSpider/action/setOptionMaxDuration/?Integer=#{integer}")
135
+ end
136
+
137
+ def set_option_number_of_browsers(integer)
138
+ @client.get("/JSON/ajaxSpider/action/setOptionNumberOfBrowsers/?Integer=#{integer}")
139
+ end
140
+
141
+ def set_option_random_inputs(boolean)
142
+ @client.get("/JSON/ajaxSpider/action/setOptionRandomInputs/?Boolean=#{boolean}")
143
+ end
144
+
145
+ def set_option_reload_wait(integer)
146
+ @client.get("/JSON/ajaxSpider/action/setOptionReloadWait/?Integer=#{integer}")
147
+ end
148
+
149
+ def stop
150
+ @client.get('/JSON/ajaxSpider/action/stop/')
151
+ end
152
+ end
153
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class Alert
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def alert(_id)
10
+ @client.get('/JSON/alert/view/alert/')
11
+ end
12
+
13
+ def alert_counts_by_risk(url = '', recurse = '')
14
+ @client.get("/JSON/alert/view/alertCountsByRisk/?url=#{url}&recurse=#{recurse}")
15
+ end
16
+
17
+ def alerts(baseurl = '', start = '', count = '', riskid = '', contextname = '')
18
+ @client.get("/JSON/alert/view/alerts/?baseurl=#{baseurl}&start=#{start}&count=#{count}&riskId=#{riskid}&contextName=#{contextname}")
19
+ end
20
+
21
+ def alerts_by_risk(url = '', recurse = '')
22
+ @client.get("/JSON/alert/view/alertsByRisk/?url=#{url}&recurse=#{recurse}")
23
+ end
24
+
25
+ def alerts_summary(baseurl = '')
26
+ @client.get("/JSON/alert/view/alertsSummary/?baseurl=#{baseurl}")
27
+ end
28
+
29
+ def number_of_alerts(baseurl = '', riskid = '')
30
+ @client.get("/JSON/alert/view/numberOfAlerts/?baseurl=#{baseurl}&riskId=#{riskid}")
31
+ end
32
+
33
+ def add_alert(messageid, name, riskid, confidenceid, description, param, attack, otherinfo, solution, references, evidence, cweid, wascid)
34
+ @client.get("/JSON/alert/action/addAlert/?messageId=#{messageid}&name=#{name}&riskId=#{riskid}&confidenceId=#{confidenceid}&description=#{description}&param=#{param}&attack=#{attack}&otherInfo=#{otherinfo}&solution=#{solution}&references=#{references}&evidence=#{evidence}&cweId=#{cweid}&wascId=#{wascid}")
35
+ end
36
+
37
+ def delete_alert(id)
38
+ @client.get("/JSON/alert/action/deleteAlert/?id=#{id}")
39
+ end
40
+
41
+ def delete_alerts(contextname, baseurl, riskid)
42
+ @client.get("/JSON/alert/action/deleteAlerts/?contextName=#{contextname}&baseurl=#{baseurl}&riskId=#{riskid}")
43
+ end
44
+
45
+ def delete_all_alerts
46
+ @client.get('/JSON/alert/action/deleteAllAlerts/')
47
+ end
48
+
49
+ def update_alert(id, name, riskid, confidenceid, description, param, attack, otherinfo, solution, references, evidence, cweid, wascid)
50
+ @client.get("/JSON/alert/action/updateAlert/?id=#{id}&name=#{name}&riskId=#{riskid}&confidenceId=#{confidenceid}&description=#{description}&param=#{param}&attack=#{attack}&otherInfo=#{otherinfo}&solution=#{solution}&references=#{references}&evidence=#{evidence}&cweId=#{cweid}&wascId=#{wascid}")
51
+ end
52
+
53
+ def update_alerts_confidence(ids, confidenceid)
54
+ @client.get("/JSON/alert/action/updateAlertsConfidence/?ids=#{ids}&confidenceId=#{confidenceid}")
55
+ end
56
+
57
+ def update_alerts_risk(ids, riskid)
58
+ @client.get("/JSON/alert/action/updateAlertsRisk/?ids=#{ids}&riskId=#{riskid}")
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class AlertFilter
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def alert_filter_list(context_id = nil)
10
+ @client.get("/JSON/alertFilter/view/alertFilterList/?contextId=#{context_id}")
11
+ end
12
+
13
+ def global_alert_filter_list
14
+ @client.get('/JSON/alertFilter/view/globalAlertFilterList/')
15
+ end
16
+
17
+ def add_alert_filter(context_id = nil, rule_id = nil, new_level = nil, url = nil, url_is_regex = nil, parameter = nil, enabled = nil, parameter_is_regex = nil, attack = nil, attack_is_regex = nil, evidence = nil, evidence_is_regex = nil, methods = nil)
18
+ @client.get("/JSON/alertFilter/action/addAlertFilter/?contextId=#{context_id}&ruleId=#{rule_id}&newLevel=#{new_level}&url=#{url}&urlIsRegex=#{url_is_regex}&parameter=#{parameter}&enabled=#{enabled}&parameterIsRegex=#{parameter_is_regex}&attack=#{attack}&attackIsRegex=#{attack_is_regex}&evidence=#{evidence}&evidenceIsRegex=#{evidence_is_regex}&methods=#{methods}")
19
+ end
20
+
21
+ def add_global_alert_filter(rule_id = nil, new_level = nil, url = nil, url_is_regex = nil, parameter = nil, enabled = nil, parameter_is_regex = nil, attack = nil, attack_is_regex = nil, evidence = nil, evidence_is_regex = nil, methods = nil)
22
+ @client.get("/JSON/alertFilter/action/addGlobalAlertFilter/?ruleId=#{rule_id}&newLevel=#{new_level}&url=#{url}&urlIsRegex=#{url_is_regex}&parameter=#{parameter}&enabled=#{enabled}&parameterIsRegex=#{parameter_is_regex}&attack=#{attack}&attackIsRegex=#{attack_is_regex}&evidence=#{evidence}&evidenceIsRegex=#{evidence_is_regex}&methods=#{methods}")
23
+ end
24
+
25
+ def apply_all
26
+ @client.get('/JSON/alertFilter/action/applyAll/')
27
+ end
28
+
29
+ def apply_context
30
+ @client.get('/JSON/alertFilter/action/applyContext/')
31
+ end
32
+
33
+ def apply_global
34
+ @client.get('/JSON/alertFilter/action/applyGlobal/')
35
+ end
36
+
37
+ def remove_alert_filter(context_id = nil, rule_id = nil, new_level = nil, url = nil, url_is_regex = nil, parameter = nil, enabled = nil, parameter_is_regex = nil, attack = nil, attack_is_regex = nil, evidence = nil, evidence_is_regex = nil, methods = nil)
38
+ @client.get("/JSON/alertFilter/action/removeAlertFilter/?contextId=#{context_id}&ruleId=#{rule_id}&newLevel=#{new_level}&url=#{url}&urlIsRegex=#{url_is_regex}&parameter=#{parameter}&enabled=#{enabled}&parameterIsRegex=#{parameter_is_regex}&attack=#{attack}&attackIsRegex=#{attack_is_regex}&evidence=#{evidence}&evidenceIsRegex=#{evidence_is_regex}&methods=#{methods}")
39
+ end
40
+
41
+ def remove_global_alert_filter(rule_id = nil, new_level = nil, url = nil, url_is_regex = nil, parameter = nil, enabled = nil, parameter_is_regex = nil, attack = nil, attack_is_regex = nil, evidence = nil, evidence_is_regex = nil, methods = nil)
42
+ @client.get("/JSON/alertFilter/action/removeGlobalAlertFilter/?ruleId=#{rule_id}&newLevel=#{new_level}&url=#{url}&urlIsRegex=#{url_is_regex}&parameter=#{parameter}&enabled=#{enabled}&parameterIsRegex=#{parameter_is_regex}&attack=#{attack}&attackIsRegex=#{attack_is_regex}&evidence=#{evidence}&evidenceIsRegex=#{evidence_is_regex}&methods=#{methods}")
43
+ end
44
+
45
+ def test_all
46
+ @client.get('/JSON/alertFilter/action/testAll/')
47
+ end
48
+
49
+ def test_context
50
+ @client.get('/JSON/alertFilter/action/testContext/')
51
+ end
52
+
53
+ def test_global
54
+ @client.get('/JSON/alertFilter/action/testGlobal/')
55
+ end
56
+ end
57
+ end