Class: Dradis::Plugins::Nexpose::Simple::Importer
- Inherits:
-
Upload::Importer
- Object
- Upload::Importer
- Dradis::Plugins::Nexpose::Simple::Importer
- Defined in:
- lib/dradis/plugins/nexpose/simple/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
13 14 15 |
# File 'lib/dradis/plugins/nexpose/simple/importer.rb', line 13 def self.templates {} 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.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/dradis/plugins/nexpose/simple/importer.rb', line 25 def import(params = {}) file_content = File.read( params[:file] ) logger.info { 'Parsing NeXpose output file...' } doc = Nokogiri::XML(file_content) logger.info { 'Done.' } unless doc.root.name == 'NeXposeSimpleXML' 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 process_simple(doc) logger.info { 'NeXpose-Simple format uploaded successfully' } true end |