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

allow creating vuln exception with site scope #91

Merged
merged 1 commit into from
Nov 12, 2014
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
allow creating vuln exception with site scope
  • Loading branch information
gschneider-r7 committed Nov 12, 2014
commit 15a74f548f2f21b1530593473d3ecf600987ce8c
7 changes: 6 additions & 1 deletion lib/nexpose/vuln_exception.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ class VulnException
attr_accessor :asset_id
alias :device_id :asset_id
alias :device_id= :asset_id=

# Id of the site, if this exception applies to all instances on a site
attr_accessor :site_id
# Port on a asset, if this exception applies to a specific port.
attr_accessor :port
# The specific vulnerable component in a discovered instance of the
Expand Down Expand Up @@ -153,6 +154,8 @@ def save(connection, comment = nil)
xml.add_attributes({ 'device-id' => @asset_id,
'port-no' => @port,
'vuln-key' => @vuln_key })
when Scope::ALL_INSTANCES_IN_A_SPECIFIC_SITE
xml.add_attributes({ 'site-id ' => @site_id })
end

@submitter_comment = comment if comment
Expand Down Expand Up @@ -313,6 +316,8 @@ def validate
when Scope::SPECIFIC_INSTANCE_OF_SPECIFIC_ASSET
raise ArgumentError.new('No asset_id.') unless @asset_id
raise ArgumentError.new('Port or vuln_key is required.') unless @port || @vuln_key
when Scope::ALL_INSTANCES_IN_A_SPECIFIC_SITE
raise ArgumentError.new('No site_id.') unless @site_id
else
raise ArgumentError.new("Invalid scope: #{@scope}")
end
Expand Down