Class: Dradis::Plugins::Acunetix::Acunetix360::Importer
- Inherits:
-
Upload::Importer
- Object
- Upload::Importer
- Dradis::Plugins::Acunetix::Acunetix360::Importer
- Defined in:
- lib/dradis/plugins/acunetix/acunetix360/importer.rb
Instance Attribute Summary collapse
-
#scan_node ⇒ Object
Returns the value of attribute scan_node.
-
#xml ⇒ Object
Returns the value of attribute xml.
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
Instance Attribute Details
#scan_node ⇒ Object
Returns the value of attribute scan_node.
13 14 15 |
# File 'lib/dradis/plugins/acunetix/acunetix360/importer.rb', line 13 def scan_node @scan_node end |
#xml ⇒ Object
Returns the value of attribute xml.
13 14 15 |
# File 'lib/dradis/plugins/acunetix/acunetix360/importer.rb', line 13 def xml @xml end |
Class Method Details
.templates ⇒ Object
15 16 17 |
# File 'lib/dradis/plugins/acunetix/acunetix360/importer.rb', line 15 def self.templates { evidence: 'evidence_360', issue: 'vulnerability_360' } 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.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/dradis/plugins/acunetix/acunetix360/importer.rb', line 27 def import(params = {}) file_content = File.read(params.fetch(:file)) logger.info { 'Parsing Acunetix360 output file...' } @xml = Nokogiri::XML( file_content ) logger.info { 'Done.' } unless xml.xpath('//acunetix-360').present? error = 'No Acunetix360 results were detected in the uploaded file. Ensure you uploaded an Acunetix360 XML report.' logger.fatal { error } content_service.create_note text: error return false end process_acunetix360 logger.info { 'Acunetix360 file successfully imported' } true end |