nessus_client 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f66280ff351ca3d9c29874252f4a88d9a3758f2ba16d6db75812edce9e40d1b9
4
- data.tar.gz: 41d3b43e5a05682680ba05f6b7d33fec52ed81ddbd8a996eb27f7af499310b3a
3
+ metadata.gz: 97155cc8a1019ff1a15883a8b3749b6702a4baf9aed454655a3f92ea49d06c22
4
+ data.tar.gz: 35b2dc0e7b0bc0ca9f32e92ffcadc8e01fed7de5140f8a9637081c716201438d
5
5
  SHA512:
6
- metadata.gz: 9a3ca44fbc46b2ff5a230e81457618976a9648a5c5154c39bfd82e29453f6530658b1aa884712f4d343b574e48389d3547a4ad60313652b488382faa0c528e28
7
- data.tar.gz: 3251fca055bccd4aae51eba580ada175ad670f1ae5d9b2b982a4a1f218816b865cbe5246e32368d39e8545f93eeeea7f374f244f94ac33aa9ba720ca11f68680
6
+ metadata.gz: 3f4be80be45b124d81426674079fef9315366e91114854e7e20caa0090df53ea9aeb2f60e8f18ebd57ecb3e811846ba5e17cd4b02ffdd8f258d65f2bc27be75b
7
+ data.tar.gz: 6de44d65aae4427ca4ae24a098012fb2131cc7cd506de51d601a7d5cfe7f058144f0391bfc6234d6fae1d3da3701fe63f761a579980b1c07713618398415e7fb
File without changes
File without changes
data/README.md CHANGED
File without changes
File without changes
File without changes
@@ -3,8 +3,41 @@
3
3
  # Namespace for Policies resource.
4
4
  module Resource::Policies
5
5
  # List the scan polices.
6
- # @return [JSON]
6
+ # @return [JSON] list of policies.
7
7
  def policies
8
8
  request.get({ path: '/policies', headers: headers })
9
9
  end
10
+
11
+ # Get id of a policy by its name.
12
+ # @param [String] policy name.
13
+ # @return [Integer] ID of a policy.
14
+ def get_policy_id_by_name(policy_name)
15
+ policies['policies'].each do |policy|
16
+ return policy['id'] if policy['name'] == policy_name
17
+ end
18
+ end
19
+
20
+ # Get a policy by its name.
21
+ # @param [String] policy name.
22
+ # @return [JSON] policy object.
23
+ def get_policy_by_name(policy_name)
24
+ policy_id = get_policy_id_by_name(policy_name)
25
+ request.get({ path: "/policies/#{policy_id}", headers: headers })
26
+ end
27
+
28
+ # Get a list of credentials from a policy.
29
+ # @param [String] policy name.
30
+ # @return [JSON] credential list
31
+ def list_credentials_by_policy_name(policy_name)
32
+ get_policy_by_name(policy_name)['credentials']
33
+ end
34
+
35
+ # update a scan policy.
36
+ # @param [String] policy name.
37
+ # @param [String] history_id (nil) The `history_id` of a scan.
38
+ # @return nil
39
+ def update_policy_by_name(policy_name, payload)
40
+ id = get_policy_id_by_name(policy_name)
41
+ request.put({ path: "/policies/#{id}", headers: headers, payload: payload })
42
+ end
10
43
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -45,6 +45,16 @@ class NessusClient
45
45
  http_request(opts, :post)
46
46
  end
47
47
 
48
+ # Perform a HTTP PUT request.
49
+ # @param [Hash] opts to use in the request.
50
+ # @option opts [String] path The URI path to perform the request.
51
+ # @option opts [String] payload The HTTP body to send.
52
+ # @option opts [String] query The URI query to send.
53
+ # @return [Hash, String] The body of the resposnse if there is any.
54
+ def put(opts = {})
55
+ http_request(opts, :put)
56
+ end
57
+
48
58
  # Perform a HTTP DELETE request.
49
59
  # @param [Hash] opts to use in the request.
50
60
  # @option opts [String] path The URI path to perform the request.
File without changes
@@ -2,5 +2,5 @@
2
2
 
3
3
  class NessusClient
4
4
  # The current version of the libary.
5
- VERSION = '0.1.5'
5
+ VERSION = '0.1.6'
6
6
  end
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nessus_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Heyder
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2018-11-28 00:00:00.000000000 Z
@@ -17,6 +17,9 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.73.0
20
+ - - "~>"
21
+ - !ruby/object:Gem::Version
22
+ version: '0.73'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -24,6 +27,9 @@ dependencies:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: 0.73.0
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '0.73'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: oj
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +58,40 @@ dependencies:
52
58
  - - "~>"
53
59
  - !ruby/object:Gem::Version
54
60
  version: '1.12'
61
+ - !ruby/object:Gem::Dependency
62
+ name: codecov
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: 0.1.14
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: 0.1.14
75
+ - !ruby/object:Gem::Dependency
76
+ name: nokogiri
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: 1.8.5
82
+ - - "~>"
83
+ - !ruby/object:Gem::Version
84
+ version: 1.10.10
85
+ type: :development
86
+ prerelease: false
87
+ version_requirements: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: 1.8.5
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: 1.10.10
55
95
  - !ruby/object:Gem::Dependency
56
96
  name: pry
57
97
  requirement: !ruby/object:Gem::Requirement
@@ -73,6 +113,9 @@ dependencies:
73
113
  - - ">="
74
114
  - !ruby/object:Gem::Version
75
115
  version: 1.5.0
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: '1.5'
76
119
  type: :development
77
120
  prerelease: false
78
121
  version_requirements: !ruby/object:Gem::Requirement
@@ -80,6 +123,9 @@ dependencies:
80
123
  - - ">="
81
124
  - !ruby/object:Gem::Version
82
125
  version: 1.5.0
126
+ - - "~>"
127
+ - !ruby/object:Gem::Version
128
+ version: '1.5'
83
129
  - !ruby/object:Gem::Dependency
84
130
  name: rspec
85
131
  requirement: !ruby/object:Gem::Requirement
@@ -108,20 +154,6 @@ dependencies:
108
154
  - - "~>"
109
155
  - !ruby/object:Gem::Version
110
156
  version: 0.17.0
111
- - !ruby/object:Gem::Dependency
112
- name: codecov
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: 0.1.14
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: 0.1.14
125
157
  - !ruby/object:Gem::Dependency
126
158
  name: yard
127
159
  requirement: !ruby/object:Gem::Requirement
@@ -174,7 +206,7 @@ licenses:
174
206
  metadata:
175
207
  documentation_uri: https://rubydoc.info/github/heyder/nessus_client/
176
208
  source_code_uri: https://github.com/heyder/nessus_client
177
- post_install_message:
209
+ post_install_message:
178
210
  rdoc_options: []
179
211
  require_paths:
180
212
  - lib
@@ -190,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
222
  version: '0'
191
223
  requirements: []
192
224
  rubygems_version: 3.0.6
193
- signing_key:
225
+ signing_key:
194
226
  specification_version: 4
195
227
  summary: Usable, fast, simple Ruby gem for Tenable Nessus Pro from v7.0.1 to v8.3.1.
196
228
  test_files: []