Class: DefaultMode
- Defined in:
- lib/nexpose_ticketing/modes/default_mode.rb
Instance Method Summary collapse
-
#get_description(nexpose_id, row) ⇒ Object
Returns the base ticket description object.
-
#get_matching_fields ⇒ Object
Returns the fields used to identify individual tickets.
-
#get_nxid(nexpose_id, row) ⇒ Object
Generates a unique identifier for a ticket.
-
#get_title(row) ⇒ Object
Returns the ticket’s title.
-
#initialize(options) ⇒ DefaultMode
constructor
Initializes the mode.
-
#print_description(description) ⇒ Object
Converts the ticket description object into a formatted string.
-
#update_description(description, row) ⇒ Object
Updates the ticket description based on row data.
-
#updates_supported? ⇒ Boolean
True if this mode supports ticket updates.
Methods inherited from BaseMode
#finalize_description, #get_assets, #get_discovery_info, #get_field_info, #get_header, #get_query_suffix, #get_references, #get_short_summary, #get_solutions, #get_vuln_info, #load_queries, #method_missing, #set_solution_store, #truncate_title
Constructor Details
#initialize(options) ⇒ DefaultMode
Initializes the mode
6 7 8 |
# File 'lib/nexpose_ticketing/modes/default_mode.rb', line 6 def initialize() super() end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class BaseMode
Instance Method Details
#get_description(nexpose_id, row) ⇒ Object
Returns the base ticket description object
31 32 33 34 35 36 37 |
# File 'lib/nexpose_ticketing/modes/default_mode.rb', line 31 def get_description(nexpose_id, row) description = { nxid: "NXID: #{get_nxid(nexpose_id, row)}" } fields = %w(header references solutions) fields.each { |f| description[f.intern] = self.send("get_#{f}", row) } description[:header] << get_discovery_info(row) description end |
#get_matching_fields ⇒ Object
Returns the fields used to identify individual tickets
16 17 18 |
# File 'lib/nexpose_ticketing/modes/default_mode.rb', line 16 def get_matching_fields %w(ip_address vulnerability_id) end |
#get_nxid(nexpose_id, row) ⇒ Object
Generates a unique identifier for a ticket
26 27 28 |
# File 'lib/nexpose_ticketing/modes/default_mode.rb', line 26 def get_nxid(nexpose_id, row) "#{nexpose_id}d#{row['asset_id']}d#{row['vulnerability_id']}" end |
#get_title(row) ⇒ Object
Returns the ticket’s title
21 22 23 |
# File 'lib/nexpose_ticketing/modes/default_mode.rb', line 21 def get_title(row) truncate_title "#{row['ip_address']} => #{get_short_summary(row)}" end |
#print_description(description) ⇒ Object
Converts the ticket description object into a formatted string
45 46 47 48 49 |
# File 'lib/nexpose_ticketing/modes/default_mode.rb', line 45 def print_description(description) fields = [:header, :references, :solutions].map { |f| description[f] } finalize_description(fields.join("\n"), description[:nxid]) end |
#update_description(description, row) ⇒ Object
Updates the ticket description based on row data
40 41 42 |
# File 'lib/nexpose_ticketing/modes/default_mode.rb', line 40 def update_description(description, row) description end |
#updates_supported? ⇒ Boolean
True if this mode supports ticket updates
11 12 13 |
# File 'lib/nexpose_ticketing/modes/default_mode.rb', line 11 def updates_supported? false end |