Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update vuln exceptions to use generally available API version #313

Merged
merged 3 commits into from
Jan 17, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/nexpose/vuln_exception.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ def list_vuln_exceptions(status = nil)
url_size = 500
url_page = 0

req = Nexpose::AJAX.get(self, "/api/experimental/vulnerability_exceptions?_size=#{url_size}&_page=#{url_page}")
req = Nexpose::AJAX.get(self, "/api/3/vulnerability_exceptions?size=#{url_size}&page=#{url_page}")
data = JSON.parse(req, object_class: OpenStruct)
ajax_data << data._resources
ajax_data << data.resources

if data._links.count > 1
if data.links.count > 1
loop do
url_page += 1
req = Nexpose::AJAX.get(self, "/api/experimental/vulnerability_exceptions?_size=#{url_size}&_page=#{url_page}")
req = Nexpose::AJAX.get(self, "/api/3/vulnerability_exceptions?size=#{url_size}&page=#{url_page}")
data = JSON.parse(req, object_class: OpenStruct)
ajax_data << data._resources
links = data._links.select { |ll| ['self', 'last'].include?(ll.rel) }
ajax_data << data.resources
links = data.links.select { |ll| ['self', 'last'].include?(ll.rel) }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use %w or %W for an array of words.

break if links[0].href == links[1].href
end
end
Expand Down