Class: Dradis::Plugins::Acunetix::Importer
- Inherits:
-
Upload::Importer
- Object
- Upload::Importer
- Dradis::Plugins::Acunetix::Importer
- Includes:
- Formats::Acunetix360, Formats::Standard
- Defined in:
- lib/dradis/plugins/acunetix/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.
Instance Attribute Details
#scan_node ⇒ Object
Returns the value of attribute scan_node.
9 10 11 |
# File 'lib/dradis/plugins/acunetix/importer.rb', line 9 def scan_node @scan_node end |
#xml ⇒ Object
Returns the value of attribute xml.
9 10 11 |
# File 'lib/dradis/plugins/acunetix/importer.rb', line 9 def xml @xml end |
Class Method Details
.templates ⇒ Object
11 12 13 |
# File 'lib/dradis/plugins/acunetix/importer.rb', line 11 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.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/dradis/plugins/acunetix/importer.rb', line 18 def import(params={}) file_content = File.read( params.fetch(:file) ) logger.info{'Parsing Acunetix output file...'} @xml = Nokogiri::XML( file_content ) logger.info{'Done.'} if xml.xpath('/ScanGroup/Scan').present? logger.info { 'Standard Acunetix import detected.' } process_standard return true elsif xml.xpath('//acunetix-360').present? logger.info { 'Acunetix360 import detected.' } process_acunetix360 return true else error = "No scan results were detected in the uploaded file (/ScanGroup/Scan). Ensure you uploaded an Acunetix XML report." logger.fatal{ error } content_service.create_note text: error return false end end |