Class: Dradis::Plugins::Nexpose::Importer
- Inherits:
-
Upload::Importer
- Object
- Upload::Importer
- Dradis::Plugins::Nexpose::Importer
- Includes:
- Formats::Full, Formats::Simple
- Defined in:
- lib/dradis/plugins/nexpose/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
10 11 12 |
# File 'lib/dradis/plugins/nexpose/importer.rb', line 10 def self.templates { evidence: 'full_evidence', issue: 'full_vulnerability' } 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.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/dradis/plugins/nexpose/importer.rb', line 17 def import(params={}) file_content = File.read( params[:file] ) logger.info { 'Parsing NeXpose output file...' } doc = Nokogiri::XML(file_content) logger.info { 'Done.' } if doc.root.name == 'NeXposeSimpleXML' logger.info { 'NeXpose-Simple format detected' } process_simple(doc) elsif doc.root.name == 'NexposeReport' logger.info { 'NeXpose-Full format detected' } process_full(doc) else error = "The document doesn't seem to be in either NeXpose-Simple or NeXpose-Full XML format. Ensure you uploaded a Nexpose XML report." logger.fatal{ error } content_service.create_note text: error return false end end |