wazuh-ruby-client 0.1.0

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 (86) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +20 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +7 -0
  5. data/CHANGELOG.md +0 -0
  6. data/Gemfile +5 -0
  7. data/LICENSE +21 -0
  8. data/README.md +74 -0
  9. data/Rakefile +6 -0
  10. data/docs/.nojekyll +0 -0
  11. data/docs/Wazuh/Api/Endpoints/ActiveResponse.html +278 -0
  12. data/docs/Wazuh/Api/Endpoints/Agents.html +1877 -0
  13. data/docs/Wazuh/Api/Endpoints/Cache.html +415 -0
  14. data/docs/Wazuh/Api/Endpoints/Ciscat.html +418 -0
  15. data/docs/Wazuh/Api/Endpoints/Cluster.html +2270 -0
  16. data/docs/Wazuh/Api/Endpoints/Decoders.html +860 -0
  17. data/docs/Wazuh/Api/Endpoints/Experimental.html +2610 -0
  18. data/docs/Wazuh/Api/Endpoints/Lists.html +452 -0
  19. data/docs/Wazuh/Api/Endpoints/Manager.html +1596 -0
  20. data/docs/Wazuh/Api/Endpoints/Rootcheck.html +1025 -0
  21. data/docs/Wazuh/Api/Endpoints/Rules.html +872 -0
  22. data/docs/Wazuh/Api/Endpoints/SecurityConfigurationAssessment.html +680 -0
  23. data/docs/Wazuh/Api/Endpoints/Summary.html +199 -0
  24. data/docs/Wazuh/Api/Endpoints/Syscheck.html +755 -0
  25. data/docs/Wazuh/Api/Endpoints/Syscollector.html +2069 -0
  26. data/docs/Wazuh/Api/Endpoints.html +292 -0
  27. data/docs/Wazuh/Api/Errors/TooManyRequestsError.html +398 -0
  28. data/docs/Wazuh/Api/Errors/WazuhError.html +290 -0
  29. data/docs/Wazuh/Api/Errors.html +117 -0
  30. data/docs/Wazuh/Api.html +133 -0
  31. data/docs/Wazuh/Client.html +521 -0
  32. data/docs/Wazuh/Config.html +223 -0
  33. data/docs/Wazuh/Faraday/Connection.html +110 -0
  34. data/docs/Wazuh/Faraday/Request.html +335 -0
  35. data/docs/Wazuh/Faraday/Response/RaiseError.html +191 -0
  36. data/docs/Wazuh/Faraday/Response.html +115 -0
  37. data/docs/Wazuh/Faraday.html +117 -0
  38. data/docs/Wazuh/Logger.html +201 -0
  39. data/docs/Wazuh.html +256 -0
  40. data/docs/WazuhRubyClient.html +121 -0
  41. data/docs/_index.html +391 -0
  42. data/docs/class_list.html +51 -0
  43. data/docs/css/common.css +1 -0
  44. data/docs/css/full_list.css +58 -0
  45. data/docs/css/style.css +496 -0
  46. data/docs/file.README.html +142 -0
  47. data/docs/file_list.html +56 -0
  48. data/docs/frames.html +17 -0
  49. data/docs/index.html +142 -0
  50. data/docs/js/app.js +292 -0
  51. data/docs/js/full_list.js +216 -0
  52. data/docs/js/jquery.js +4 -0
  53. data/docs/method_list.html +1059 -0
  54. data/docs/top-level-namespace.html +110 -0
  55. data/lib/tasks/api.rake +78 -0
  56. data/lib/wazuh/api/endpoints/active_response.rb +22 -0
  57. data/lib/wazuh/api/endpoints/agents.rb +175 -0
  58. data/lib/wazuh/api/endpoints/cache.rb +38 -0
  59. data/lib/wazuh/api/endpoints/ciscat.rb +43 -0
  60. data/lib/wazuh/api/endpoints/cluster.rb +199 -0
  61. data/lib/wazuh/api/endpoints/decoders.rb +91 -0
  62. data/lib/wazuh/api/endpoints/experimental.rb +309 -0
  63. data/lib/wazuh/api/endpoints/lists.rb +42 -0
  64. data/lib/wazuh/api/endpoints/manager.rb +156 -0
  65. data/lib/wazuh/api/endpoints/rootcheck.rb +93 -0
  66. data/lib/wazuh/api/endpoints/rules.rb +80 -0
  67. data/lib/wazuh/api/endpoints/security_configuration_assessment.rb +73 -0
  68. data/lib/wazuh/api/endpoints/summary.rb +15 -0
  69. data/lib/wazuh/api/endpoints/syscheck.rb +75 -0
  70. data/lib/wazuh/api/endpoints/syscollector.rb +227 -0
  71. data/lib/wazuh/api/endpoints.rb +37 -0
  72. data/lib/wazuh/api/error.rb +6 -0
  73. data/lib/wazuh/api/errors/too_many_requests_error.rb +22 -0
  74. data/lib/wazuh/api/errors/wazuh_error.rb +14 -0
  75. data/lib/wazuh/client.rb +27 -0
  76. data/lib/wazuh/config.rb +42 -0
  77. data/lib/wazuh/faraday/connection.rb +38 -0
  78. data/lib/wazuh/faraday/request.rb +38 -0
  79. data/lib/wazuh/faraday/response/raise_error.rb +11 -0
  80. data/lib/wazuh/logger.rb +13 -0
  81. data/lib/wazuh/version.rb +4 -0
  82. data/lib/wazuh-ruby-client/version.rb +3 -0
  83. data/lib/wazuh-ruby-client.rb +17 -0
  84. data/lib/wazuh_ruby_client.rb +2 -0
  85. data/wazuh-ruby-client.gemspec +43 -0
  86. metadata +200 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bad57d1cdd24740b64102eec072ad28e55c7c84fd65eceac21392c5639290b6b
4
+ data.tar.gz: 57372d8a3539e4325ed0fa575e3d37226dfef3183e696ecbe60767f0db8a6ae6
5
+ SHA512:
6
+ metadata.gz: 959166d9994319d4ea7c48d00e41c1b4f7c3a3cafefb3a8e7469d4ebf22edb0686faa2f588095eb1ca1068257ca7be4c23553e9405a067ca27e4e2dc0c0f0d95
7
+ data.tar.gz: 51fef2a90b29bcea95d6cb3e2dd75615a3b0ec0a432b1db13e2c401c1df644cebc8f674d78069aedfacc868bcba614ae4572e69ab73d96e95561712a64184f78
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /pkg/
6
+ /spec/reports/
7
+ /tmp/
8
+ /bin/console
9
+ /bin/setup
10
+
11
+ Gemfile.lock
12
+
13
+ # rspec failure tracking
14
+ .rspec_status
15
+ *.crt
16
+ *.key
17
+ *.ca
18
+ .env
19
+ .bundle
20
+ .DS_Store
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.1
7
+ before_install: gem install bundler -v 1.17.3
data/CHANGELOG.md ADDED
File without changes
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 mrtc0
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # Wazuh Ruby Client
2
+
3
+ A Ruby client for the wazuh APIs.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'wazuh-ruby-client'
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```ruby
16
+ Wazuh.configure do |config|
17
+ config.endpoint = "https://wazuh.local:55000"
18
+ config.basic_user = "foo"
19
+ config.basic_password = "bar"
20
+ config.verify_ssl = false
21
+ end
22
+
23
+ client = Wazuh::Client.new
24
+ client.all_agents
25
+ # => {"error"=>0, "data"=>{"items"=>[{"os"=>{"arch"=>"x86_64", "codename"=>"Xenial Xerus", "major"=>"16", "minor"=>"04", "name"=>"Ubuntu", "platform"=>"ubuntu", "uname"=>"Linux |wazuh-manager-master-0 |4.14.138+ |#1 SMP Tue Sep 3 02:58:08 PDT 2019 |x86_64", "version"=>"16.04.6 LTS"}, "status"=>"Active", "name"=>"wazuh-manager-master-0", "registerIP"=>"127.0.0.1", "manager"=>"wazuh-manager-master-0", "dateAdd"=>"2020-01-07 16:13:05", "ip"=>"127.0.0.1", "node_name"=>"wazuh-manager-master", "version"=>"Wazuh v3.11.1", "lastKeepAlive"=>"9999-12-31 23:59:59", "id"=>"000"}], "totalItems"=>1}}
26
+ ```
27
+
28
+ ### Authorization
29
+
30
+ Set `basic_user` and `basic_password` for basic authentication.
31
+ If you using self-signed certificate, `verify_ssl` must be set to `false` .
32
+
33
+ ```ruby
34
+ Wazuh.configure do |config|
35
+ config.endpoint = "https://wazuh.local:55000"
36
+ config.basic_user = "foo"
37
+ config.basic_password = "bar"
38
+ config.verify_ssl = false
39
+ end
40
+ ```
41
+
42
+ If you are using client certificate authentication, set `client_key` and `client_cert` .
43
+
44
+ ```ruby
45
+ require 'openssl'
46
+
47
+ Wazuh.configure do |config|
48
+ config.endpoint = "https://wazuh.local:55000"
49
+ config.client_key = OpenSSL::PKey::RSA.new(File.read("./wazuh.key"))
50
+ config.client_cert = OpenSSL::X509::Certificate.new(File.read("./wazuh.crt"))
51
+ end
52
+ ```
53
+
54
+ ## Support API
55
+
56
+ - [x] Active Response
57
+ - [x] Agents
58
+ - [x] Cache
59
+ - [x] Ciscat
60
+ - [x] Cluster
61
+ - [x] Decoders
62
+ - [x] Experimental
63
+ - [x] Lists
64
+ - [x] Manager
65
+ - [x] Rootcheck
66
+ - [x] Rules
67
+ - [x] Security Configuration Assessment
68
+ - [x] Summary
69
+ - [x] Syscheck
70
+ - [x] Syscollector
71
+
72
+ ## Contributing
73
+
74
+ Bug reports and pull requests are welcome on GitHub at https://github.com/mrtc0/wazuh-ruby-client.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/docs/.nojekyll ADDED
File without changes
@@ -0,0 +1,278 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: Wazuh::Api::Endpoints::ActiveResponse
8
+
9
+ &mdash; Documentation by YARD 0.9.16
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../../../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../../../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "Wazuh::Api::Endpoints::ActiveResponse";
19
+ relpath = '../../../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../../../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../../../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../../../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../../../_index.html">Index (A)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../../Wazuh.html" title="Wazuh (module)">Wazuh</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../../Api.html" title="Wazuh::Api (module)">Api</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Endpoints.html" title="Wazuh::Api::Endpoints (module)">Endpoints</a></span></span>
41
+ &raquo;
42
+ <span class="title">ActiveResponse</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../../../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: Wazuh::Api::Endpoints::ActiveResponse
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+ <dl>
78
+ <dt>Included in:</dt>
79
+ <dd><span class='object_link'><a href="../Endpoints.html" title="Wazuh::Api::Endpoints (module)">Wazuh::Api::Endpoints</a></span></dd>
80
+ </dl>
81
+
82
+
83
+
84
+ <dl>
85
+ <dt>Defined in:</dt>
86
+ <dd>lib/wazuh/api/endpoints/active_response.rb</dd>
87
+ </dl>
88
+
89
+ </div>
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+ <h2>
100
+ Instance Method Summary
101
+ <small><a href="#" class="summary_toggle">collapse</a></small>
102
+ </h2>
103
+
104
+ <ul class="summary">
105
+
106
+ <li class="public ">
107
+ <span class="summary_signature">
108
+
109
+ <a href="#run_active_response_command-instance_method" title="#run_active_response_command (instance method)">#<strong>run_active_response_command</strong>(agent_id, options = {}) &#x21d2; Object </a>
110
+
111
+
112
+
113
+ </span>
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+ <span class="summary_desc"><div class='inline'>
124
+ <p>Run an AR command in the agent Runs an Active Response command on a
125
+ specified agent.</p>
126
+ </div></span>
127
+
128
+ </li>
129
+
130
+
131
+ </ul>
132
+
133
+
134
+
135
+
136
+ <div id="instance_method_details" class="method_details_list">
137
+ <h2>Instance Method Details</h2>
138
+
139
+
140
+ <div class="method_details first">
141
+ <h3 class="signature first" id="run_active_response_command-instance_method">
142
+
143
+ #<strong>run_active_response_command</strong>(agent_id, options = {}) &#x21d2; <tt>Object</tt>
144
+
145
+
146
+
147
+
148
+
149
+ </h3><div class="docstring">
150
+ <div class="discussion">
151
+
152
+ <p>Run an AR command in the agent Runs an Active Response command on a
153
+ specified agent.</p>
154
+
155
+
156
+ </div>
157
+ </div>
158
+ <div class="tags">
159
+ <p class="tag_title">Parameters:</p>
160
+ <ul class="param">
161
+
162
+ <li>
163
+
164
+ <span class='name'>agent_id</span>
165
+
166
+
167
+ <span class='type'>(<tt>String</tt>)</span>
168
+
169
+
170
+
171
+ </li>
172
+
173
+ <li>
174
+
175
+ <span class='name'>options</span>
176
+
177
+
178
+ <span class='type'>(<tt>Hash</tt>)</span>
179
+
180
+
181
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
182
+
183
+
184
+ &mdash;
185
+ <div class='inline'>
186
+ <p>a customizable set of options</p>
187
+ </div>
188
+
189
+ </li>
190
+
191
+ </ul>
192
+
193
+
194
+
195
+
196
+
197
+
198
+ <p class="tag_title">Options Hash (<tt>options</tt>):</p>
199
+ <ul class="option">
200
+
201
+ <li>
202
+ <span class="name">:command</span>
203
+ <span class="type">(<tt>command</tt>)</span>
204
+ <span class="default">
205
+
206
+ </span>
207
+
208
+ &mdash; <div class='inline'>
209
+ <p>Command running in the agent. If this value starts by !, then it refers to
210
+ a script name instead of a command name.</p>
211
+ </div>
212
+
213
+ </li>
214
+
215
+ <li>
216
+ <span class="name">:custom</span>
217
+ <span class="type">(<tt>custom</tt>)</span>
218
+ <span class="default">
219
+
220
+ </span>
221
+
222
+ &mdash; <div class='inline'>
223
+ <p>Whether the specified command is a custom command or not.</p>
224
+ </div>
225
+
226
+ </li>
227
+
228
+ <li>
229
+ <span class="name">:arguments</span>
230
+ <span class="type">(<tt>arguments</tt>)</span>
231
+ <span class="default">
232
+
233
+ </span>
234
+
235
+ &mdash; <div class='inline'>
236
+ <p>Array with command arguments.</p>
237
+ </div>
238
+
239
+ </li>
240
+
241
+ </ul>
242
+
243
+
244
+
245
+ </div><table class="source_code">
246
+ <tr>
247
+ <td>
248
+ <pre class="lines">
249
+
250
+
251
+ 16
252
+ 17
253
+ 18</pre>
254
+ </td>
255
+ <td>
256
+ <pre class="code"><span class="info file"># File 'lib/wazuh/api/endpoints/active_response.rb', line 16</span>
257
+
258
+ <span class='kw'>def</span> <span class='id identifier rubyid_run_active_response_command'>run_active_response_command</span><span class='lparen'>(</span><span class='id identifier rubyid_agent_id'>agent_id</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
259
+ <span class='id identifier rubyid_put'>put</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/active-response/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_agent_id'>agent_id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span>
260
+ <span class='kw'>end</span></pre>
261
+ </td>
262
+ </tr>
263
+ </table>
264
+ </div>
265
+
266
+ </div>
267
+
268
+ </div>
269
+
270
+ <div id="footer">
271
+ Generated on Sat Jan 25 00:19:41 2020 by
272
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
273
+ 0.9.16 (ruby-2.5.1).
274
+ </div>
275
+
276
+ </div>
277
+ </body>
278
+ </html>