Class: VulnerabilityMode
- Defined in:
- lib/nexpose_ticketing/modes/vulnerability_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_query_suffix ⇒ Object
Returns the suffix used for query method names.
-
#get_title(row) ⇒ Object
Returns the ticket’s title.
-
#initialize(options) ⇒ VulnerabilityMode
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.
Methods inherited from BaseMode
#finalize_description, #get_assets, #get_discovery_info, #get_field_info, #get_header, #get_references, #get_short_summary, #get_solutions, #get_vuln_info, #load_queries, #method_missing, #truncate_title, #updates_supported?
Constructor Details
#initialize(options) ⇒ VulnerabilityMode
Initializes the mode
6 7 8 |
# File 'lib/nexpose_ticketing/modes/vulnerability_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 |
# File 'lib/nexpose_ticketing/modes/vulnerability_mode.rb', line 31 def get_description(nexpose_id, row) description = { nxid: "NXID: #{get_nxid(nexpose_id, row)}" } fields = ['header', 'references', 'solutions', 'assets'] fields.each { |f| description[f.intern] = self.send("get_#{f}", row) } description end |
#get_matching_fields ⇒ Object
Returns the fields used to identify individual tickets
11 12 13 |
# File 'lib/nexpose_ticketing/modes/vulnerability_mode.rb', line 11 def get_matching_fields ['vulnerability_id'] end |
#get_nxid(nexpose_id, row) ⇒ Object
Generates a unique identifier for a ticket
21 22 23 |
# 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 ⇒ Object
Returns the suffix used for query method names
26 27 28 |
# File 'lib/nexpose_ticketing/modes/vulnerability_mode.rb', line 26 def get_query_suffix '_by_vuln_id' end |
#get_title(row) ⇒ Object
Returns the ticket’s title
16 17 18 |
# File 'lib/nexpose_ticketing/modes/vulnerability_mode.rb', line 16 def get_title(row) truncate_title "Vulnerability: #{row['title']}" end |
#print_description(description) ⇒ Object
Converts the ticket description object into a formatted string
45 46 47 48 49 |
# File 'lib/nexpose_ticketing/modes/vulnerability_mode.rb', line 45 def print_description(description) fields = [:header, :assets, :references, :solutions] finalize_description(fields.map { |f| description[f] }.join("\n"), description[:nxid]) end |
#update_description(description, row) ⇒ Object
Updates the ticket description based on row data
39 40 41 42 |
# File 'lib/nexpose_ticketing/modes/vulnerability_mode.rb', line 39 def update_description(description, row) description[:assets] += "\n#{get_assets(row)}" description end |