Skip to content

Commit 64b69d5

Browse files
committed
Add report_download and db_scan APIs
1 parent d3c52f3 commit 64b69d5

File tree

2 files changed

+107
-79
lines changed

2 files changed

+107
-79
lines changed

lib/nessus/nessus-xmlrpc.rb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def scan_export_status(scan_id, file_id)
180180
if res.code == "200"
181181
return "ready"
182182
else
183-
res = JSON.parse(resp.body)
183+
res = JSON.parse(res.body)
184184
return res
185185
end
186186
end
@@ -206,8 +206,8 @@ def report_host_ports
206206
raise NotImplementedError
207207
end
208208

209-
def report_download
210-
raise NotImplementedError
209+
def report_download(scan_id, file_id)
210+
res = http_get(:uri=>"/scans/#{scan_id}/export/#{file_id}/download", :raw_content=> true, :fields=>x_cookie)
211211
end
212212

213213
private
@@ -256,6 +256,7 @@ def http_delete(opts={})
256256
def http_get(opts={})
257257
uri = opts[:uri]
258258
fields = opts[:fields] || {}
259+
raw_content = opts[:raw_content] || false
259260
json = {}
260261

261262
req = Net::HTTP::Get.new(uri)
@@ -268,8 +269,11 @@ def http_get(opts={})
268269
rescue URI::InvalidURIError
269270
return json
270271
end
271-
272-
parse_json(res.body)
272+
if !raw_content
273+
parse_json(res.body)
274+
else
275+
res.body
276+
end
273277
end
274278

275279
def http_post(opts={})

0 commit comments

Comments
 (0)