wazuh-ruby-client 0.3.0 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/codeql-analysis.yml +70 -0
- data/CHANGELOG.md +25 -0
- data/README.md +18 -1
- data/Rakefile +4 -0
- data/docs/Wazuh/Api/Endpoints/ActiveResponse.html +10 -13
- data/docs/Wazuh/Api/Endpoints/Agents.html +483 -204
- data/docs/Wazuh/Api/Endpoints/Cache.html +7 -7
- data/docs/Wazuh/Api/Endpoints/Ciscat.html +10 -13
- data/docs/Wazuh/Api/Endpoints/Cluster.html +52 -58
- data/docs/Wazuh/Api/Endpoints/Decoders.html +27 -39
- data/docs/Wazuh/Api/Endpoints/Experimental.html +63 -96
- data/docs/Wazuh/Api/Endpoints/Lists.html +15 -21
- data/docs/Wazuh/Api/Endpoints/Manager.html +44 -62
- data/docs/Wazuh/Api/Endpoints/Rootcheck.html +36 -52
- data/docs/Wazuh/Api/Endpoints/Rules.html +49 -68
- data/docs/Wazuh/Api/Endpoints/SecurityConfigurationAssessment.html +20 -31
- data/docs/Wazuh/Api/Endpoints/Summary.html +7 -7
- data/docs/Wazuh/Api/Endpoints/Syscheck.html +26 -33
- data/docs/Wazuh/Api/Endpoints/Syscollector.html +43 -61
- data/docs/Wazuh/Api/Endpoints/V4/ActiveResponse.html +198 -0
- data/docs/Wazuh/Api/Endpoints/V4/Agents.html +1079 -0
- data/docs/Wazuh/Api/Endpoints/V4/Cache.html +195 -0
- data/docs/Wazuh/Api/Endpoints/V4/Ciscat.html +126 -0
- data/docs/Wazuh/Api/Endpoints/V4/Cluster.html +126 -0
- data/docs/Wazuh/Api/Endpoints/V4/Decoders.html +126 -0
- data/docs/Wazuh/Api/Endpoints/V4/Experimental.html +126 -0
- data/docs/Wazuh/Api/Endpoints/V4/Lists.html +126 -0
- data/docs/Wazuh/Api/Endpoints/V4/Manager.html +126 -0
- data/docs/Wazuh/Api/Endpoints/V4/Rootcheck.html +126 -0
- data/docs/Wazuh/Api/Endpoints/V4/Rules.html +126 -0
- data/docs/Wazuh/Api/Endpoints/V4/SecurityConfigurationAssessment.html +126 -0
- data/docs/Wazuh/Api/Endpoints/V4/Summary.html +126 -0
- data/docs/Wazuh/Api/Endpoints/V4/Syscheck.html +126 -0
- data/docs/Wazuh/Api/Endpoints/V4/Syscollector.html +126 -0
- data/docs/Wazuh/Api/Endpoints/V4/Vulnerabilities.html +399 -0
- data/docs/Wazuh/Api/Endpoints/V4.html +403 -0
- data/docs/Wazuh/Api/Endpoints.html +9 -14
- data/docs/Wazuh/Api/Errors/WazuhError.html +9 -9
- data/docs/Wazuh/Api/Errors.html +6 -6
- data/docs/Wazuh/Api.html +7 -7
- data/docs/Wazuh/Client.html +35 -190
- data/docs/Wazuh/Config.html +20 -11
- data/docs/Wazuh/Logger.html +6 -6
- data/docs/Wazuh/Sawyer/Connection/Token.html +208 -0
- data/docs/Wazuh/Sawyer/Connection.html +19 -7
- data/docs/Wazuh/Sawyer/Request.html +78 -6
- data/docs/Wazuh/Sawyer.html +8 -8
- data/docs/Wazuh.html +16 -16
- data/docs/WazuhRubyClient.html +7 -7
- data/docs/_index.html +149 -7
- data/docs/class_list.html +3 -3
- data/docs/css/style.css +2 -2
- data/docs/file.README.html +39 -18
- data/docs/file_list.html +2 -2
- data/docs/frames.html +2 -2
- data/docs/index.html +39 -18
- data/docs/js/app.js +25 -3
- data/docs/method_list.html +269 -69
- data/docs/top-level-namespace.html +6 -6
- data/lib/wazuh/api/endpoints/v4/vulnerabilities.rb +47 -0
- data/lib/wazuh/api/endpoints/v4.rb +2 -1
- data/lib/wazuh/sawyer/connection.rb +2 -2
- data/lib/wazuh/sawyer/request.rb +5 -2
- data/lib/wazuh/sawyer/token.rb +1 -1
- data/lib/wazuh/version.rb +1 -1
- data/lib/wazuh-ruby-client/version.rb +1 -1
- metadata +25 -5
@@ -6,15 +6,15 @@
|
|
6
6
|
<title>
|
7
7
|
Top Level Namespace
|
8
8
|
|
9
|
-
— Documentation by YARD 0.9.
|
9
|
+
— Documentation by YARD 0.9.25
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
13
|
-
<link rel="stylesheet" href="css/style.css" type="text/css"
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
14
14
|
|
15
|
-
<link rel="stylesheet" href="css/common.css" type="text/css"
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
16
16
|
|
17
|
-
<script type="text/javascript"
|
17
|
+
<script type="text/javascript">
|
18
18
|
pathId = "";
|
19
19
|
relpath = '';
|
20
20
|
</script>
|
@@ -100,9 +100,9 @@
|
|
100
100
|
</div>
|
101
101
|
|
102
102
|
<div id="footer">
|
103
|
-
Generated on
|
103
|
+
Generated on Thu Feb 3 21:40:17 2022 by
|
104
104
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
105
|
-
0.9.
|
105
|
+
0.9.25 (ruby-2.6.3).
|
106
106
|
</div>
|
107
107
|
|
108
108
|
</div>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Wazuh
|
2
|
+
module Api
|
3
|
+
module Endpoints
|
4
|
+
module V4
|
5
|
+
module Vulnerabilities
|
6
|
+
# Get vulnerabilities
|
7
|
+
# Returns the vulnerabilities of an agent
|
8
|
+
#
|
9
|
+
# @param [String] agent_id
|
10
|
+
# @option options [wait_for_complete] :wait_for_complete
|
11
|
+
# Disable timeout response
|
12
|
+
# @option options [offset] :offset
|
13
|
+
# First element to return in the collection
|
14
|
+
# @option options [limit] :limit
|
15
|
+
# Maximum number of elements to return. Although up to 100.000 can be specified,
|
16
|
+
# it is recommended not to exceed 500 elements. Responses may be slower the more this number is exceeded.
|
17
|
+
# @option options [sort] :sort
|
18
|
+
# Sort the collection by a field or fields (separated by comma).
|
19
|
+
# Use +/- at the beggining to list in ascending or descending order. Use '.' for nested fields.
|
20
|
+
# For example, '{field1: field2}' may be selected with 'field1.field2'
|
21
|
+
# @option options [search] :search
|
22
|
+
# Look for elements containing the specified string.
|
23
|
+
# To obtain a complementary search, use '-' at the beggining
|
24
|
+
# @option options [select] :select
|
25
|
+
# Select which fields to return (separated by comma).
|
26
|
+
# Use '.' for nested fields. For example, '{field1: field2}' may be selected with 'field1.field2'
|
27
|
+
# @option options [q] :q
|
28
|
+
# Query to filter results by. For example q="status=active"
|
29
|
+
# @option options [distinct] :distinct
|
30
|
+
# Look for distinct values.
|
31
|
+
# @option options [architecture] :architecture
|
32
|
+
# Filter by architecture
|
33
|
+
# @option options [cve] :cve
|
34
|
+
# Filter by CVE
|
35
|
+
# @option options [name] :name
|
36
|
+
# Filter by name
|
37
|
+
# @option options [version] :version
|
38
|
+
# Filter by CVE version
|
39
|
+
# @see https://documentation.wazuh.com/current/user-manual/api/reference.html#operation/api.controllers.vulnerability_controller.get_vulnerability_agent
|
40
|
+
def vulnerabilities(agent_id, options = {})
|
41
|
+
offset_request('get', "/vulnerability/#{agent_id}", options)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -13,7 +13,7 @@ require_relative 'v4/security_configuration_assessment'
|
|
13
13
|
require_relative 'v4/summary'
|
14
14
|
require_relative 'v4/syscheck'
|
15
15
|
require_relative 'v4/syscollector'
|
16
|
-
|
16
|
+
require_relative 'v4/vulnerabilities'
|
17
17
|
|
18
18
|
module Wazuh
|
19
19
|
module Api
|
@@ -34,6 +34,7 @@ module Wazuh
|
|
34
34
|
include Syscheck
|
35
35
|
include Syscollector
|
36
36
|
include SecurityConfigurationAssessment
|
37
|
+
include Vulnerabilities
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
@@ -24,12 +24,12 @@ module Wazuh
|
|
24
24
|
case api_version
|
25
25
|
when 3
|
26
26
|
if basic_user || basic_password
|
27
|
-
options[:headers].merge!({'Authorization' => "Basic " + Base64.
|
27
|
+
options[:headers].merge!({'Authorization' => "Basic " + Base64.strict_encode64(basic_user + ':' + basic_password).strip})
|
28
28
|
end
|
29
29
|
when 4
|
30
30
|
raise "user and password is required on v4 api" if !basic_user || !basic_password
|
31
31
|
opts[:faraday] = ::Faraday.new(options) do |conn|
|
32
|
-
conn.request :authorization, 'Bearer',
|
32
|
+
conn.request :authorization, 'Bearer', Token.jwt(endpoint, options, basic_user, basic_password)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
data/lib/wazuh/sawyer/request.rb
CHANGED
@@ -21,15 +21,18 @@ module Wazuh
|
|
21
21
|
def offset_request(method, path, options = {})
|
22
22
|
items = []
|
23
23
|
data = send(method, path, options)
|
24
|
-
|
24
|
+
total_items = api_version == 3 ? data.totalItems : data.total_affected_items
|
25
|
+
0.step(total_items, 500) { |offset|
|
25
26
|
options[:offset] = offset
|
26
27
|
d = send(method, path, options)
|
27
|
-
items
|
28
|
+
_items = api_version == 3 ? data.items : d.affected_items
|
29
|
+
items.concat(_items)
|
28
30
|
}
|
29
31
|
|
30
32
|
items
|
31
33
|
end
|
32
34
|
|
35
|
+
|
33
36
|
private
|
34
37
|
|
35
38
|
def request(method, path, options, query_options={})
|
data/lib/wazuh/sawyer/token.rb
CHANGED
@@ -5,7 +5,7 @@ module Wazuh
|
|
5
5
|
def self.jwt(endpoint, options, basic_user, basic_password)
|
6
6
|
if !@_token || (@_exp && @_exp -3 <= Time.now.to_i)
|
7
7
|
options[:url] = endpoint
|
8
|
-
options[:headers].merge!({'Authorization' => "Basic " + Base64.
|
8
|
+
options[:headers].merge!({'Authorization' => "Basic " + Base64.strict_encode64(basic_user + ':' + basic_password).strip})
|
9
9
|
|
10
10
|
token = ::Faraday.new(options) {|f| f.response :json }.get('/security/user/authenticate').body['data']['token']
|
11
11
|
@_exp = ::JWT.decode(token, nil, false).first['exp'].to_i
|
data/lib/wazuh/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wazuh-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mrtc0
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -185,6 +185,7 @@ executables: []
|
|
185
185
|
extensions: []
|
186
186
|
extra_rdoc_files: []
|
187
187
|
files:
|
188
|
+
- ".github/workflows/codeql-analysis.yml"
|
188
189
|
- ".github/workflows/rspec-ci.yml"
|
189
190
|
- ".gitignore"
|
190
191
|
- ".rspec"
|
@@ -212,6 +213,23 @@ files:
|
|
212
213
|
- docs/Wazuh/Api/Endpoints/Summary.html
|
213
214
|
- docs/Wazuh/Api/Endpoints/Syscheck.html
|
214
215
|
- docs/Wazuh/Api/Endpoints/Syscollector.html
|
216
|
+
- docs/Wazuh/Api/Endpoints/V4.html
|
217
|
+
- docs/Wazuh/Api/Endpoints/V4/ActiveResponse.html
|
218
|
+
- docs/Wazuh/Api/Endpoints/V4/Agents.html
|
219
|
+
- docs/Wazuh/Api/Endpoints/V4/Cache.html
|
220
|
+
- docs/Wazuh/Api/Endpoints/V4/Ciscat.html
|
221
|
+
- docs/Wazuh/Api/Endpoints/V4/Cluster.html
|
222
|
+
- docs/Wazuh/Api/Endpoints/V4/Decoders.html
|
223
|
+
- docs/Wazuh/Api/Endpoints/V4/Experimental.html
|
224
|
+
- docs/Wazuh/Api/Endpoints/V4/Lists.html
|
225
|
+
- docs/Wazuh/Api/Endpoints/V4/Manager.html
|
226
|
+
- docs/Wazuh/Api/Endpoints/V4/Rootcheck.html
|
227
|
+
- docs/Wazuh/Api/Endpoints/V4/Rules.html
|
228
|
+
- docs/Wazuh/Api/Endpoints/V4/SecurityConfigurationAssessment.html
|
229
|
+
- docs/Wazuh/Api/Endpoints/V4/Summary.html
|
230
|
+
- docs/Wazuh/Api/Endpoints/V4/Syscheck.html
|
231
|
+
- docs/Wazuh/Api/Endpoints/V4/Syscollector.html
|
232
|
+
- docs/Wazuh/Api/Endpoints/V4/Vulnerabilities.html
|
215
233
|
- docs/Wazuh/Api/Errors.html
|
216
234
|
- docs/Wazuh/Api/Errors/WazuhError.html
|
217
235
|
- docs/Wazuh/Client.html
|
@@ -219,6 +237,7 @@ files:
|
|
219
237
|
- docs/Wazuh/Logger.html
|
220
238
|
- docs/Wazuh/Sawyer.html
|
221
239
|
- docs/Wazuh/Sawyer/Connection.html
|
240
|
+
- docs/Wazuh/Sawyer/Connection/Token.html
|
222
241
|
- docs/Wazuh/Sawyer/Request.html
|
223
242
|
- docs/WazuhRubyClient.html
|
224
243
|
- docs/_index.html
|
@@ -269,6 +288,7 @@ files:
|
|
269
288
|
- lib/wazuh/api/endpoints/v4/summary.rb
|
270
289
|
- lib/wazuh/api/endpoints/v4/syscheck.rb
|
271
290
|
- lib/wazuh/api/endpoints/v4/syscollector.rb
|
291
|
+
- lib/wazuh/api/endpoints/v4/vulnerabilities.rb
|
272
292
|
- lib/wazuh/api/error.rb
|
273
293
|
- lib/wazuh/api/errors/wazuh_error.rb
|
274
294
|
- lib/wazuh/client.rb
|
@@ -286,7 +306,7 @@ metadata:
|
|
286
306
|
homepage_uri: https://github.com/mrtc0/wazuh-ruby-client
|
287
307
|
source_code_uri: https://github.com/mrtc0/wazuh-ruby-client
|
288
308
|
changelog_uri: https://github.com/mrtc0/wazuh-ruby-client/blob/master/CHANGELOG.md
|
289
|
-
post_install_message:
|
309
|
+
post_install_message:
|
290
310
|
rdoc_options: []
|
291
311
|
require_paths:
|
292
312
|
- lib
|
@@ -302,7 +322,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
302
322
|
version: '0'
|
303
323
|
requirements: []
|
304
324
|
rubygems_version: 3.1.4
|
305
|
-
signing_key:
|
325
|
+
signing_key:
|
306
326
|
specification_version: 4
|
307
327
|
summary: Wazuh API client for Ruby
|
308
328
|
test_files: []
|