class Dradis::Plugins::Acunetix::Importer

Attributes

scan_node[RW]
xml[RW]

Public Instance Methods

import(params={}) click to toggle source

The framework will call this function if the user selects this plugin from the dropdown list and uploads a file. @returns true if the operation was successful, false otherwise

# File lib/dradis/plugins/acunetix/importer.rb, line 14
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