nexpose 0.1.11 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/nexpose/report.rb +14 -7
- metadata +2 -2
data/lib/nexpose/report.rb
CHANGED
@@ -172,7 +172,8 @@ module Nexpose
|
|
172
172
|
|
173
173
|
# Definition object for an adhoc report configuration.
|
174
174
|
#
|
175
|
-
# NOTE:
|
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
|
227
|
-
#
|
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
|
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.
|
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-
|
14
|
+
date: 2013-04-18 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: librex
|