Class: Dradis::Plugins::Nexpose::Full::Importer
- Inherits:
-
Upload::Importer
- Object
- Upload::Importer
- Dradis::Plugins::Nexpose::Full::Importer
- Defined in:
- lib/dradis/plugins/nexpose/full/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.
-
#initialize(args = {}) ⇒ Importer
constructor
A new instance of Importer.
Constructor Details
Class Method Details
.templates ⇒ Object
14 15 16 |
# File 'lib/dradis/plugins/nexpose/full/importer.rb', line 14 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.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/dradis/plugins/nexpose/full/importer.rb', line 26 def import(params = {}) file_content = File.read(params[:file]) logger.info { 'Parsing NeXpose-Full XML output file...' } doc = Nokogiri::XML(file_content) logger.info { 'Done.' } unless doc.root.name == 'NexposeReport' error = "The document doesn't seem to be in NeXpose-Full XML format. Ensure you uploaded a NeXpose-Full XML report." logger.fatal{ error } content_service.create_note text: error return false end process_full(doc) logger.info { 'NeXpose-Full format successfully imported' } true end |