class IPMode

Public Class Methods

new(options) click to toggle source

Initializes the mode

Calls superclass method BaseMode::new
# File lib/nexpose_ticketing/modes/ip_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/ip_mode.rb, line 26
def get_description(nexpose_id, row)
  description = { nxid: "NXID: #{get_nxid(nexpose_id, row)}" }
  status = row['comparison']
  description[:ticket_status] = status
  header = "++ #{status} Vulnerabilities ++\n" if !status.nil?
  description[:vulnerabilities] = [ header.to_s + get_vuln_info(row) ]
  description
end
get_matching_fields() click to toggle source

Returns the fields used to identify individual tickets

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

Generates a unique identifier for a ticket

# File lib/nexpose_ticketing/modes/ip_mode.rb, line 21
def get_nxid(nexpose_id, row)
  "#{nexpose_id}i#{row['ip_address']}"
end
get_title(row) click to toggle source

Returns the ticket's title

# File lib/nexpose_ticketing/modes/ip_mode.rb, line 16
def get_title(row)
  truncate_title "#{row['ip_address']} => Vulnerabilities"
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/ip_mode.rb, line 36
def update_description(description, row)
  header = ""
  if description[:ticket_status] != row['comparison']
    header = "++ #{row['comparison']} Vulnerabilities ++\n"
    description[:ticket_status] = row['comparison']
  end

  description[:vulnerabilities] << "#{header}#{get_vuln_info(row)}"
  description
end