Class: Dradis::Plugins::Nessus::Importer
- Inherits:
-
Upload::Importer
- Object
- Upload::Importer
- Dradis::Plugins::Nessus::Importer
- Defined in:
- lib/dradis/plugins/nessus/importer.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#import(params = {}) ⇒ Object
The framework will call this function if the user selects this plugin from the dropdown list and uploads a file.
Class Method Details
.templates ⇒ Object
3 4 5 |
# File 'lib/dradis/plugins/nessus/importer.rb', line 3 def self.templates { evidence: 'evidence', issue: 'report_item' } end |
Instance Method Details
#import(params = {}) ⇒ Object
The framework will call this function if the user selects this plugin from the dropdown list and uploads a file.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/dradis/plugins/nessus/importer.rb', line 10 def import(params={}) file_content = File.read( params[:file] ) logger.info{'Parsing nessus output file...'} doc = Nokogiri::XML( file_content ) logger.info{'Done.'} if doc.xpath('/NessusClientData_v2/Report').empty? error = "No reports were detected in the uploaded file (/NessusClientData_v2/Report). Ensure you uploaded a Nessus XML v2 (.nessus) report." logger.fatal{ error } content_service.create_note text: error return false end doc.xpath('/NessusClientData_v2/Report').each do |xml_report| report_label = xml_report.attributes['name'].value logger.info{ "Processing report: #{report_label}" } # No need to create a report node for each report. It may be good to # create a plugin.output/nessus.reports with info for each scan, but # for the time being we just append stuff to the Host # report_node = parent.children.find_or_create_by_label(report_label) xml_report.xpath('./ReportHost').each do |xml_host| process_report_host(xml_host) end #/ReportHost logger.info{ "Report processed." } end #/Report return true end |