nexpose 0.1.11 → 0.1.12

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 (2) hide show
  1. data/lib/nexpose/report.rb +14 -7
  2. metadata +2 -2
@@ -172,7 +172,8 @@ module Nexpose
172
172
 
173
173
  # Definition object for an adhoc report configuration.
174
174
  #
175
- # NOTE: Only text, pdf, and csv currently work reliably.
175
+ # NOTE: XML reports only return the text of the report, but no images.
176
+ #
176
177
  class AdhocReportConfig
177
178
  # The ID of the report template used.
178
179
  attr_accessor :template_id
@@ -223,8 +224,13 @@ module Nexpose
223
224
 
224
225
  include XMLUtils
225
226
 
226
- # Generate a report once using a simple configuration, and send it back
227
- # in a multi-part mime response.
227
+ # Generate a report once using a simple configuration.
228
+ #
229
+ # For XML-based reports, only the raw report is returned and not any images.
230
+ #
231
+ # @param [Connection] connection Nexpose connection.
232
+ # @return Report in text format except for PDF, which returns binary data.
233
+ #
228
234
  def generate(connection)
229
235
  xml = %Q{<ReportAdhocGenerateRequest session-id='#{connection.session_id}'>}
230
236
  xml << to_xml
@@ -243,11 +249,12 @@ module Nexpose
243
249
  doc = Rex::MIME::Message.new(data)
244
250
  doc.parts.each do |part|
245
251
  if /.*base64.*/ =~ part.header.to_s
246
- if (@format == 'text') or (@format == 'pdf') or (@format == 'csv')
252
+ if @format =~ /(?:ht|x)ml/
253
+ if part.header.to_s =~ %r(text/(?:ht|x)ml)
254
+ return parse_xml(part.content.unpack("m*")[0]).to_s
255
+ end
256
+ else # text|pdf|csv|rtf
247
257
  return part.content.unpack('m*')[0]
248
- else
249
- # FIXME This isn't working.
250
- return parse_xml(part.content.unpack("m*")[0])
251
258
  end
252
259
  end
253
260
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nexpose
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-04-02 00:00:00.000000000 Z
14
+ date: 2013-04-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: librex