class VulnerabilityMode

Public Class Methods

new(options) click to toggle source

Initializes the mode

Calls superclass method BaseMode::new
# File lib/nexpose_ticketing/modes/vulnerability_mode.rb, line 6
def initialize(options)
  super(options)
end

Public Instance Methods

get_description(nexpose_id, row) click to toggle source

Returns the base ticket description object

# File lib/nexpose_ticketing/modes/vulnerability_mode.rb, line 36
def get_description(nexpose_id, row)
  description = { nxid: "NXID: #{get_nxid(nexpose_id, row)}" }
  fields = ['header', 'references', 'solutions', 'assets', 'vuln_description']
  fields.each { |f| description[f.intern] = self.send("get_#{f}", row) }
  description
end
get_matching_fields() click to toggle source

Returns the fields used to identify individual tickets

# File lib/nexpose_ticketing/modes/vulnerability_mode.rb, line 11
def get_matching_fields
  ['vulnerability_id']
end
get_nxid(nexpose_id, row) click to toggle source

Generates a unique identifier for a ticket

# File lib/nexpose_ticketing/modes/vulnerability_mode.rb, line 21
def get_nxid(nexpose_id, row)
  "#{nexpose_id}v#{row['vulnerability_id']}"
end
get_query_suffix() click to toggle source

Returns the suffix used for query method names

# File lib/nexpose_ticketing/modes/vulnerability_mode.rb, line 26
def get_query_suffix
  '_by_vuln_id'
end
get_title(row) click to toggle source

Returns the ticket's title

# File lib/nexpose_ticketing/modes/vulnerability_mode.rb, line 16
def get_title(row)
  truncate_title "Vulnerability: #{row['title']}"
end
get_vuln_description(row) click to toggle source
# File lib/nexpose_ticketing/modes/vulnerability_mode.rb, line 30
def get_vuln_description(row)
  return '' if row['description'].to_s == ''
  "\nVulnerability Description: #{row['description']}"
end
print_description(description) click to toggle source

Converts the ticket description object into a formatted string

update_description(description, row) click to toggle source

Updates the ticket description based on row data

# File lib/nexpose_ticketing/modes/vulnerability_mode.rb, line 44
def update_description(description, row)
  description[:assets] += "\n#{get_assets(row)}"
  description
end