Class: IPMode
- Defined in:
- lib/nexpose_ticketing/modes/ip_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) ⇒ IPMode
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_query_suffix, #get_references, #get_short_summary, #get_solutions, #get_vuln_info, #load_queries, #method_missing, #set_solution_store, #truncate_title, #updates_supported?
Constructor Details
#initialize(options) ⇒ IPMode
Initializes the mode
6 7 8 |
# File 'lib/nexpose_ticketing/modes/ip_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
26 27 28 29 30 31 32 33 |
# 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 ⇒ Object
Returns the fields used to identify individual tickets
11 12 13 |
# File 'lib/nexpose_ticketing/modes/ip_mode.rb', line 11 def get_matching_fields ['ip_address'] end |
#get_nxid(nexpose_id, row) ⇒ Object
Generates a unique identifier for a ticket
21 22 23 |
# 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) ⇒ Object
Returns the ticket’s title
16 17 18 |
# File 'lib/nexpose_ticketing/modes/ip_mode.rb', line 16 def get_title(row) truncate_title "#{row['ip_address']} => Vulnerabilities" end |
#print_description(description) ⇒ Object
Converts the ticket description object into a formatted string
48 49 50 51 |
# File 'lib/nexpose_ticketing/modes/ip_mode.rb', line 48 def print_description(description) finalize_description(description[:vulnerabilities].join("\n"), description[:nxid]) end |
#update_description(description, row) ⇒ Object
Updates the ticket description based on row data
36 37 38 39 40 41 42 43 44 45 |
# 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 |