nexpose 7.0.0 → 7.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2 -3
  3. data/Gemfile.lock +1 -1
  4. data/lib/nexpose/ajax.rb +12 -16
  5. data/lib/nexpose/alert.rb +20 -21
  6. data/lib/nexpose/api.rb +3 -3
  7. data/lib/nexpose/asset.rb +23 -23
  8. data/lib/nexpose/blackout.rb +6 -14
  9. data/lib/nexpose/common.rb +87 -92
  10. data/lib/nexpose/connection.rb +8 -10
  11. data/lib/nexpose/console.rb +9 -9
  12. data/lib/nexpose/dag.rb +2 -2
  13. data/lib/nexpose/data_table.rb +8 -12
  14. data/lib/nexpose/device.rb +35 -34
  15. data/lib/nexpose/discovery.rb +69 -69
  16. data/lib/nexpose/discovery/filter.rb +7 -8
  17. data/lib/nexpose/engine.rb +22 -21
  18. data/lib/nexpose/error.rb +7 -5
  19. data/lib/nexpose/external.rb +21 -16
  20. data/lib/nexpose/filter.rb +51 -52
  21. data/lib/nexpose/global_blackout.rb +6 -7
  22. data/lib/nexpose/global_settings.rb +2 -3
  23. data/lib/nexpose/group.rb +25 -19
  24. data/lib/nexpose/json_serializer.rb +4 -14
  25. data/lib/nexpose/maint.rb +8 -9
  26. data/lib/nexpose/manage.rb +2 -2
  27. data/lib/nexpose/multi_tenant_user.rb +42 -42
  28. data/lib/nexpose/password_policy.rb +14 -14
  29. data/lib/nexpose/pool.rb +6 -5
  30. data/lib/nexpose/report.rb +30 -34
  31. data/lib/nexpose/report_template.rb +17 -18
  32. data/lib/nexpose/role.rb +64 -55
  33. data/lib/nexpose/scan.rb +77 -60
  34. data/lib/nexpose/scan_template.rb +17 -17
  35. data/lib/nexpose/scheduled_backup.rb +8 -8
  36. data/lib/nexpose/scheduled_maintenance.rb +9 -9
  37. data/lib/nexpose/shared_credential.rb +30 -33
  38. data/lib/nexpose/shared_secret.rb +5 -5
  39. data/lib/nexpose/silo.rb +68 -66
  40. data/lib/nexpose/silo_profile.rb +47 -50
  41. data/lib/nexpose/site.rb +101 -123
  42. data/lib/nexpose/site_credentials.rb +15 -17
  43. data/lib/nexpose/tag.rb +73 -80
  44. data/lib/nexpose/ticket.rb +45 -42
  45. data/lib/nexpose/user.rb +45 -45
  46. data/lib/nexpose/util.rb +1 -1
  47. data/lib/nexpose/version.rb +1 -1
  48. data/lib/nexpose/vuln.rb +45 -43
  49. data/lib/nexpose/vuln_def.rb +7 -7
  50. data/lib/nexpose/vuln_exception.rb +35 -36
  51. data/lib/nexpose/wait.rb +32 -28
  52. data/lib/nexpose/web_credentials.rb +34 -36
  53. metadata +2 -2
@@ -5,14 +5,14 @@ module Nexpose
5
5
  attr_reader :ttl
6
6
 
7
7
  def initialize(console, time_to_live)
8
- uri = "/data/admin/global/shared-secret?time-to-live=#{time_to_live}"
8
+ uri = "/data/admin/global/shared-secret?time-to-live=#{time_to_live}"
9
9
  json = JSON.parse(AJAX.put(console, uri))
10
10
  self.from_json(json)
11
11
  end
12
12
 
13
13
  def from_json(json)
14
14
  @key_string = json['keyString']
15
- @ttl = json['timeToLiveInSeconds']
15
+ @ttl = json['timeToLiveInSeconds']
16
16
  end
17
17
 
18
18
  def delete(console)
@@ -22,10 +22,10 @@ module Nexpose
22
22
 
23
23
  def ==(other)
24
24
  return false unless self.class == other.class
25
- return false unless key_string.upcase == other.key_string.upcase
26
-
25
+ return false unless key_string.downcase == other.key_string.downcase
27
26
  true
28
27
  end
29
- alias_method :eql?, :==
28
+ alias eql? ==
30
29
  end
30
+
31
31
  end
@@ -18,14 +18,14 @@ module Nexpose
18
18
  arr
19
19
  end
20
20
 
21
- alias_method :silos, :list_silos
21
+ alias silos list_silos
22
22
 
23
23
  # Delete the specified silo
24
24
  #
25
25
  # @return Whether or not the delete request succeeded.
26
26
  #
27
27
  def delete_silo(silo_id)
28
- r = execute(make_xml('SiloDeleteRequest', {'silo-id' => silo_id}), '1.2')
28
+ r = execute(make_xml('SiloDeleteRequest', { 'silo-id' => silo_id }), '1.2')
29
29
  r.success
30
30
  end
31
31
  end
@@ -39,13 +39,13 @@ module Nexpose
39
39
  attr_accessor :max_users
40
40
  attr_accessor :max_hosted_assets
41
41
 
42
- #Optional fields
42
+ # Optional fields
43
43
  attr_accessor :description
44
44
  attr_accessor :merchant
45
45
  attr_accessor :organization
46
46
 
47
47
  def initialize(&block)
48
- instance_eval &block if block_given?
48
+ instance_eval(&block) if block_given?
49
49
  end
50
50
 
51
51
  # Copy an existing configuration from a Nexpose instance.
@@ -56,8 +56,8 @@ module Nexpose
56
56
  # @return [Silo] Silo configuration loaded from a Nexpose console.
57
57
  #
58
58
  def self.copy(connection, id)
59
- silo = load(connection, id)
60
- silo.id = nil
59
+ silo = load(connection, id)
60
+ silo.id = nil
61
61
  silo.name = nil
62
62
  silo
63
63
  end
@@ -69,7 +69,7 @@ module Nexpose
69
69
  # @return [Silo] Silo configuration loaded from a Nexpose console.
70
70
  #
71
71
  def self.load(connection, id)
72
- r = connection.execute(connection.make_xml('SiloConfigRequest', {'silo-id' => id}), '1.2')
72
+ r = connection.execute(connection.make_xml('SiloConfigRequest', { 'silo-id' => id }), '1.2')
73
73
 
74
74
  if r.success
75
75
  r.res.elements.each('SiloConfigResponse/SiloConfig') do |config|
@@ -80,12 +80,10 @@ module Nexpose
80
80
  end
81
81
 
82
82
  def save(connection)
83
- begin
84
- update(connection)
85
- rescue APIError => error
86
- raise error unless (error.message =~ /A silo .* does not exist./)
87
- create(connection)
88
- end
83
+ update(connection)
84
+ rescue APIError => error
85
+ raise error unless error.message =~ /A silo .* does not exist./
86
+ create(connection)
89
87
  end
90
88
 
91
89
  # Updates this silo on a Nexpose console.
@@ -118,7 +116,8 @@ module Nexpose
118
116
 
119
117
  def as_xml
120
118
  xml = REXML::Element.new('SiloConfig')
121
- xml.add_attributes({'description' => @description, 'name' => @name, 'id' => @id, 'silo-profile-id' => @profile_id, 'max-assets' => @max_assets, 'max-users' => @max_users, 'max-hosted-assets' => @max_hosted_assets})
119
+ xml.add_attributes({ 'description' => @description, 'name' => @name, 'id' => @id, 'silo-profile-id' => @profile_id,
120
+ 'max-assets' => @max_assets, 'max-users' => @max_users, 'max-hosted-assets' => @max_hosted_assets })
122
121
  xml.add(@merchant.as_xml) if @merchant
123
122
  xml.add(@organization.as_xml) if @organization
124
123
  xml
@@ -130,13 +129,13 @@ module Nexpose
130
129
 
131
130
  def self.parse(xml)
132
131
  new do |silo|
133
- silo.id = xml.attributes['id']
134
- silo.profile_id = xml.attributes['silo-profile-id']
135
- silo.name = xml.attributes['name']
136
- silo.max_assets = xml.attributes['max-assets'].to_i
137
- silo.max_users = xml.attributes['max-users'].to_i
132
+ silo.id = xml.attributes['id']
133
+ silo.profile_id = xml.attributes['silo-profile-id']
134
+ silo.name = xml.attributes['name']
135
+ silo.max_assets = xml.attributes['max-assets'].to_i
136
+ silo.max_users = xml.attributes['max-users'].to_i
138
137
  silo.max_hosted_assets = xml.attributes['max-hosted-assets'].to_i
139
- silo.description = xml.attributes['description']
138
+ silo.description = xml.attributes['description']
140
139
 
141
140
  xml.elements.each('Merchant') do |merchant|
142
141
  silo.merchant = Merchant.parse(merchant)
@@ -156,25 +155,24 @@ module Nexpose
156
155
  attr_accessor :zip
157
156
  attr_accessor :country
158
157
 
159
-
160
158
  def initialize(&block)
161
- instance_eval &block if block_given?
159
+ instance_eval(&block) if block_given?
162
160
  end
163
161
 
164
162
  def self.parse(xml)
165
163
  new do |address|
166
- address.line1 = xml.attributes['line1']
167
- address.line2 = xml.attributes['line2']
168
- address.city = xml.attributes['city']
169
- address.state = xml.attributes['state']
170
- address.zip = xml.attributes['zip']
164
+ address.line1 = xml.attributes['line1']
165
+ address.line2 = xml.attributes['line2']
166
+ address.city = xml.attributes['city']
167
+ address.state = xml.attributes['state']
168
+ address.zip = xml.attributes['zip']
171
169
  address.country = xml.attributes['country']
172
170
  end
173
171
  end
174
172
 
175
173
  def as_xml
176
174
  xml = REXML::Element.new('Address')
177
- xml.add_attributes({'city' => @city, 'country' => @country, 'line1' => @line1, 'line2' => @line2, 'state' => @state, 'zip' => @zip})
175
+ xml.add_attributes({ 'city' => @city, 'country' => @country, 'line1' => @line1, 'line2' => @line2, 'state' => @state, 'zip' => @zip })
178
176
  xml
179
177
  end
180
178
  end
@@ -190,28 +188,29 @@ module Nexpose
190
188
  attr_accessor :url
191
189
 
192
190
  def initialize(&block)
193
- instance_eval &block if block_given?
191
+ instance_eval(&block) if block_given?
194
192
  end
195
193
 
196
194
  def as_xml
197
195
  xml = REXML::Element.new('Organization')
198
- xml.add_attributes({'company' => @company, 'email-address' => @email, 'first-name' => @first_name, 'last-name' => @last_name, 'phone-number' => @phone, 'title' => @title, 'url' => @url})
196
+ xml.add_attributes({ 'company' => @company, 'email-address' => @email, 'first-name' => @first_name,
197
+ 'last-name' => @last_name, 'phone-number' => @phone, 'title' => @title, 'url' => @url })
199
198
  xml.add(@address.as_xml)
200
199
  xml
201
200
  end
202
201
 
203
202
  def self.parse(xml)
204
203
  new do |organization|
205
- organization.company = xml.attributes['company']
204
+ organization.company = xml.attributes['company']
206
205
  organization.first_name = xml.attributes['first-name']
207
- organization.last_name = xml.attributes['last-name']
208
- organization.phone = xml.attributes['phone-number']
206
+ organization.last_name = xml.attributes['last-name']
207
+ organization.phone = xml.attributes['phone-number']
209
208
  xml.elements.each('Address') do |address|
210
209
  organization.address = Address.parse(address)
211
210
  end
212
211
  organization.email = xml.attributes['email']
213
212
  organization.title = xml.attributes['title']
214
- organization.url = xml.attributes['url']
213
+ organization.url = xml.attributes['url']
215
214
  end
216
215
  end
217
216
  end
@@ -233,32 +232,32 @@ module Nexpose
233
232
  attr_accessor :qsa
234
233
 
235
234
  def initialize(&block)
236
- instance_eval &block if block_given?
237
- @dbas = Array(@dbas)
235
+ instance_eval(&block) if block_given?
236
+ @dbas = Array(@dbas)
238
237
  @industries = Array(@industries)
239
- @qsa = Array(@qsa)
238
+ @qsa = Array(@qsa)
240
239
  end
241
240
 
242
241
  def self.parse(xml)
243
242
  new do |merchant|
244
243
  merchant.acquirer_relationship = xml.attributes['acquirer-relationship'].to_s.chomp.eql?('true')
245
- merchant.agent_relationship = xml.attributes['agent-relationship'].to_s.chomp.eql?('true')
246
- merchant.ecommerce = xml.attributes['ecommerce'].to_s.chomp.eql?('true')
247
- merchant.grocery = xml.attributes['grocery'].to_s.chomp.eql?('true')
248
- merchant.mail_order = xml.attributes['mail-order'].to_s.chomp.eql?('true')
249
- merchant.payment_application = xml.attributes['payment-application']
250
- merchant.payment_version = xml.attributes['payment-version']
251
- merchant.petroleum = xml.attributes['petroleum'].to_s.chomp.eql?('true')
252
- merchant.retail = xml.attributes['retail'].to_s.chomp.eql?('true')
253
- merchant.telecommunication = xml.attributes['telecommunication'].to_s.chomp.eql?('true')
254
- merchant.travel = xml.attributes['travel'].to_s.chomp.eql?('true')
255
- merchant.company = xml.attributes['company']
256
- merchant.first_name = xml.attributes['first-name']
257
- merchant.last_name = xml.attributes['last-name']
258
- merchant.phone = xml.attributes['phone-number']
259
- merchant.email = xml.attributes['email']
260
- merchant.title = xml.attributes['title']
261
- merchant.url = xml.attributes['url']
244
+ merchant.agent_relationship = xml.attributes['agent-relationship'].to_s.chomp.eql?('true')
245
+ merchant.ecommerce = xml.attributes['ecommerce'].to_s.chomp.eql?('true')
246
+ merchant.grocery = xml.attributes['grocery'].to_s.chomp.eql?('true')
247
+ merchant.mail_order = xml.attributes['mail-order'].to_s.chomp.eql?('true')
248
+ merchant.payment_application = xml.attributes['payment-application']
249
+ merchant.payment_version = xml.attributes['payment-version']
250
+ merchant.petroleum = xml.attributes['petroleum'].to_s.chomp.eql?('true')
251
+ merchant.retail = xml.attributes['retail'].to_s.chomp.eql?('true')
252
+ merchant.telecommunication = xml.attributes['telecommunication'].to_s.chomp.eql?('true')
253
+ merchant.travel = xml.attributes['travel'].to_s.chomp.eql?('true')
254
+ merchant.company = xml.attributes['company']
255
+ merchant.first_name = xml.attributes['first-name']
256
+ merchant.last_name = xml.attributes['last-name']
257
+ merchant.phone = xml.attributes['phone-number']
258
+ merchant.email = xml.attributes['email']
259
+ merchant.title = xml.attributes['title']
260
+ merchant.url = xml.attributes['url']
262
261
 
263
262
  xml.elements.each('Address') do |address|
264
263
  merchant.address = Address.parse(address)
@@ -284,20 +283,22 @@ module Nexpose
284
283
  def as_xml
285
284
  xml = super
286
285
  xml.name = 'Merchant'
287
- xml.add_attributes({'acquirer-relationship' => @acquirer_relationship, 'agent-relationship' => @agent_relationship, 'ecommerce' => @ecommerce, 'grocery' => @grocery, 'mail-order' => @mail_order})
288
- xml.add_attributes({'payment-application' => @payment_application, 'payment-version' => @payment_version, 'petroleum' => @petroleum, 'retail' => @retail, 'telecommunication' => @telecommunication, 'travel' => @travel})
286
+ xml.add_attributes({ 'acquirer-relationship' => @acquirer_relationship, 'agent-relationship' => @agent_relationship,
287
+ 'ecommerce' => @ecommerce, 'grocery' => @grocery, 'mail-order' => @mail_order })
288
+ xml.add_attributes({ 'payment-application' => @payment_application, 'payment-version' => @payment_version,
289
+ 'petroleum' => @petroleum, 'retail' => @retail, 'telecommunication' => @telecommunication, 'travel' => @travel })
289
290
 
290
291
  unless dbas.empty?
291
292
  dbas = REXML::Element.new('DBAs')
292
293
  @dbas.each do |dba|
293
- dbas.add_element('DBA', {'name' => dba})
294
+ dbas.add_element('DBA', { 'name' => dba })
294
295
  end
295
296
  end
296
297
 
297
298
  unless @industries.empty?
298
299
  industries = REXML::Element.new('OtherIndustries')
299
300
  @industries.each do |industry|
300
- industries.add_element('Industry', {'name' => industry})
301
+ industries.add_element('Industry', { 'name' => industry })
301
302
  end
302
303
  end
303
304
 
@@ -331,23 +332,24 @@ module Nexpose
331
332
  attr_reader :max_users
332
333
 
333
334
  def initialize(&block)
334
- instance_eval &block if block_given?
335
+ instance_eval(&block) if block_given?
335
336
  end
336
337
 
337
338
  def self.parse(xml)
338
339
  new do
339
- @id = xml.attributes['id']
340
- @name = xml.attributes['name']
340
+ @id = xml.attributes['id']
341
+ @name = xml.attributes['name']
341
342
  @description = xml.attributes['description']
342
- @profile_id = xml.attributes['silo-profile-id']
343
+ @profile_id = xml.attributes['silo-profile-id']
343
344
  xml.elements.each('LicenseSummary') do |license|
344
- @assets = license.attributes['assets']
345
- @max_assets = license.attributes['max-assets']
345
+ @assets = license.attributes['assets']
346
+ @max_assets = license.attributes['max-assets']
346
347
  @max_hosted_assets = license.attributes['max-hosted-assets']
347
- @users = license.attributes['users']
348
- @max_users = license.attributes['max-users']
348
+ @users = license.attributes['users']
349
+ @max_users = license.attributes['max-users']
349
350
  end
350
351
  end
351
352
  end
352
353
  end
354
+
353
355
  end
@@ -18,14 +18,14 @@ module Nexpose
18
18
  arr
19
19
  end
20
20
 
21
- alias_method :silo_profiles, :list_silo_profiles
21
+ alias silo_profiles list_silo_profiles
22
22
 
23
23
  # Delete the specified silo profile
24
24
  #
25
25
  # @return Whether or not the delete request succeeded.
26
26
  #
27
27
  def delete_silo_profile(silo_profile_id)
28
- r = execute(make_xml('SiloProfileDeleteRequest', {'silo-profile-id' => silo_profile_id}), '1.2')
28
+ r = execute(make_xml('SiloProfileDeleteRequest', { 'silo-profile-id' => silo_profile_id }), '1.2')
29
29
  r.success
30
30
  end
31
31
  end
@@ -46,24 +46,24 @@ module Nexpose
46
46
  attr_accessor :restricted_report_sections
47
47
 
48
48
  def initialize(&block)
49
- instance_eval &block if block_given?
50
- @global_report_templates = Array(@global_report_templates)
51
- @global_scan_engines = Array(@global_scan_engines)
52
- @global_scan_templates = Array(@global_scan_templates)
53
- @licensed_modules = Array(@licensed_modules)
54
- @restricted_report_formats = Array(@restricted_report_formats)
49
+ instance_eval(&block) if block_given?
50
+ @global_report_templates = Array(@global_report_templates)
51
+ @global_scan_engines = Array(@global_scan_engines)
52
+ @global_scan_templates = Array(@global_scan_templates)
53
+ @licensed_modules = Array(@licensed_modules)
54
+ @restricted_report_formats = Array(@restricted_report_formats)
55
55
  @restricted_report_sections = Array(@restricted_report_sections)
56
56
  end
57
57
 
58
58
  def self.copy(connection, id)
59
- profile = load(connection, id)
60
- profile.id = nil
59
+ profile = load(connection, id)
60
+ profile.id = nil
61
61
  profile.name = nil
62
62
  profile
63
63
  end
64
64
 
65
65
  def self.load(connection, id)
66
- r = connection.execute(connection.make_xml('SiloProfileConfigRequest', {'silo-profile-id' => id}), '1.2')
66
+ r = connection.execute(connection.make_xml('SiloProfileConfigRequest', { 'silo-profile-id' => id }), '1.2')
67
67
 
68
68
  if r.success
69
69
  r.res.elements.each('SiloProfileConfigResponse/SiloProfileConfig') do |config|
@@ -75,13 +75,13 @@ module Nexpose
75
75
 
76
76
  def self.parse(xml)
77
77
  new do |profile|
78
- profile.id = xml.attributes['id']
79
- profile.name = xml.attributes['name']
80
- profile.description = xml.attributes['description']
81
- profile.all_licensed_modules = xml.attributes['all-licensed-modules'].to_s.chomp.eql?('true')
82
- profile.all_global_engines = xml.attributes['all-global-engines'].to_s.chomp.eql?('true')
78
+ profile.id = xml.attributes['id']
79
+ profile.name = xml.attributes['name']
80
+ profile.description = xml.attributes['description']
81
+ profile.all_licensed_modules = xml.attributes['all-licensed-modules'].to_s.chomp.eql?('true')
82
+ profile.all_global_engines = xml.attributes['all-global-engines'].to_s.chomp.eql?('true')
83
83
  profile.all_global_report_templates = xml.attributes['all-global-report-templates'].to_s.chomp.eql?('true')
84
- profile.all_global_scan_templates = xml.attributes['all-global-scan-templates'].to_s.chomp.eql?('true')
84
+ profile.all_global_scan_templates = xml.attributes['all-global-scan-templates'].to_s.chomp.eql?('true')
85
85
 
86
86
  profile.global_report_templates = []
87
87
  xml.elements.each('GlobalReportTemplates/GlobalReportTemplate') { |template| profile.global_report_templates << template.attributes['name'] }
@@ -104,12 +104,10 @@ module Nexpose
104
104
  end
105
105
 
106
106
  def save(connection)
107
- begin
108
- update(connection)
109
- rescue APIError => error
110
- raise error unless (error.message =~ /silo profile(\S*|.*?)does not exist/i)
111
- create(connection)
112
- end
107
+ update(connection)
108
+ rescue APIError => error
109
+ raise error unless error.message =~ /silo profile(\S*|.*?)does not exist/i
110
+ create(connection)
113
111
  end
114
112
 
115
113
  # Updates an existing silo profile on a Nexpose console.
@@ -142,53 +140,53 @@ module Nexpose
142
140
 
143
141
  def as_xml
144
142
  xml = REXML::Element.new('SiloProfileConfig')
145
- xml.add_attributes({'id' => @id,
146
- 'name' => @name,
147
- 'description' => @description,
148
- 'all-licensed-modules' => @all_licensed_modules,
149
- 'all-global-engines' => @all_global_engines,
150
- 'all-global-report-templates' => @all_global_report_templates,
151
- 'all-global-scan-templates' => @all_global_scan_templates})
143
+ xml.add_attributes({ 'id' => @id,
144
+ 'name' => @name,
145
+ 'description' => @description,
146
+ 'all-licensed-modules' => @all_licensed_modules,
147
+ 'all-global-engines' => @all_global_engines,
148
+ 'all-global-report-templates' => @all_global_report_templates,
149
+ 'all-global-scan-templates' => @all_global_scan_templates })
152
150
 
153
151
  unless @global_report_templates.empty?
154
152
  templates = xml.add_element('GlobalReportTemplates')
155
153
  @global_report_templates.each do |template|
156
- templates.add_element('GlobalReportTemplate', {'name' => template})
154
+ templates.add_element('GlobalReportTemplate', { 'name' => template })
157
155
  end
158
156
  end
159
157
 
160
158
  unless @global_scan_engines.empty?
161
159
  engines = xml.add_element('GlobalScanEngines')
162
160
  @global_scan_engines.each do |engine|
163
- engines.add_element('GlobalScanEngine', {'name' => engine})
161
+ engines.add_element('GlobalScanEngine', { 'name' => engine })
164
162
  end
165
163
  end
166
164
 
167
165
  unless @global_scan_templates.empty?
168
166
  templates = xml.add_element('GlobalScanTemplates')
169
167
  @global_scan_templates.each do |template|
170
- templates.add_element('GlobalScanTemplate', {'name' => template})
168
+ templates.add_element('GlobalScanTemplate', { 'name' => template })
171
169
  end
172
170
  end
173
171
 
174
172
  unless @licensed_modules.empty?
175
173
  licensed_modules = xml.add_element('LicensedModules')
176
174
  @licensed_modules.each do |licensed_module|
177
- licensed_modules.add_element('LicensedModule', {'name' => licensed_module})
175
+ licensed_modules.add_element('LicensedModule', { 'name' => licensed_module })
178
176
  end
179
177
  end
180
178
 
181
179
  unless @restricted_report_formats.empty?
182
180
  formats = xml.add_element('RestrictedReportFormats')
183
181
  @restricted_report_formats.each do |format|
184
- formats.add_element('RestrictedReportFormat', {'name' => format})
182
+ formats.add_element('RestrictedReportFormat', { 'name' => format })
185
183
  end
186
184
  end
187
185
 
188
186
  unless @restricted_report_sections.empty?
189
187
  sections = xml.add_element('RestrictedReportSections')
190
188
  @restricted_report_sections.each do |section|
191
- sections.add_element('RestrictedReportSection', {'name' => section})
189
+ sections.add_element('RestrictedReportSection', { 'name' => section })
192
190
  end
193
191
  end
194
192
 
@@ -214,26 +212,25 @@ module Nexpose
214
212
  attr_reader :all_global_report_templates
215
213
  attr_reader :all_global_scan_templates
216
214
 
217
-
218
215
  def initialize(&block)
219
- instance_eval &block if block_given?
216
+ instance_eval(&block) if block_given?
220
217
  end
221
218
 
222
219
  def self.parse(xml)
223
220
  new do
224
- @id = xml.attributes['id']
225
- @name = xml.attributes['name']
226
- @description = xml.attributes['description']
227
- @global_report_template_count = xml.attributes['global-report-template-count']
228
- @global_scan_engine_count = xml.attributes['global-scan-engine-count']
229
- @global_scan_template_count = xml.attributes['global-scan-template-count']
230
- @licensed_module_count = xml.attributes['licensed-module-count']
221
+ @id = xml.attributes['id']
222
+ @name = xml.attributes['name']
223
+ @description = xml.attributes['description']
224
+ @global_report_template_count = xml.attributes['global-report-template-count']
225
+ @global_scan_engine_count = xml.attributes['global-scan-engine-count']
226
+ @global_scan_template_count = xml.attributes['global-scan-template-count']
227
+ @licensed_module_count = xml.attributes['licensed-module-count']
231
228
  @restricted_report_section_count = xml.attributes['restricted-report-section-count']
232
- @all_licensed_modules = xml.attributes['all-licensed-modules']
233
- @all_global_engines = xml.attributes['all-global-engines']
234
- @all_global_report_templates = xml.attributes['all-global-report-templates']
235
- @all_global_scan_templates = xml.attributes['all-global-scan-templates']
229
+ @all_licensed_modules = xml.attributes['all-licensed-modules']
230
+ @all_global_engines = xml.attributes['all-global-engines']
231
+ @all_global_report_templates = xml.attributes['all-global-report-templates']
232
+ @all_global_scan_templates = xml.attributes['all-global-scan-templates']
236
233
  end
237
234
  end
238
235
  end
239
- end
236
+ end