Sha256: 90287a436b2b4053c6f1b2b732d7baab6ab7376c20e1b39d6af55dc5abe5e271

Contents?: true

Size: 1.14 KB

Versions: 22

Compression:

Stored size: 1.14 KB

Contents

require 'dradis/plugins/nexpose/formats/full'
require 'dradis/plugins/nexpose/formats/simple'

module Dradis::Plugins::Nexpose
  class Importer < Dradis::Plugins::Upload::Importer

    include Formats::Full
    include Formats::Simple

    # 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
    def import(params={})
      file_content = File.read( params[:file] )

      logger.info { 'Parsing NeXpose output file...' }
      doc = Nokogiri::XML(file_content)
      logger.info { 'Done.' }

      if doc.root.name == 'NeXposeSimpleXML'
        logger.info { 'NeXpose-Simple format detected' }
        process_simple(doc)
      elsif doc.root.name == 'NexposeReport'
        logger.info { 'NeXpose-Full format detected' }
        process_full(doc)
      else
        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
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
dradis-nexpose-4.3.0 lib/dradis/plugins/nexpose/importer.rb
dradis-nexpose-4.2.0 lib/dradis/plugins/nexpose/importer.rb
dradis-nexpose-4.1.0 lib/dradis/plugins/nexpose/importer.rb
dradis-nexpose-4.0.0 lib/dradis/plugins/nexpose/importer.rb
dradis-nexpose-3.22.0 lib/dradis/plugins/nexpose/importer.rb
dradis-nexpose-3.21.0 lib/dradis/plugins/nexpose/importer.rb
dradis-nexpose-3.20.0 lib/dradis/plugins/nexpose/importer.rb
dradis-nexpose-3.19.0 lib/dradis/plugins/nexpose/importer.rb
dradis-nexpose-3.18.0 lib/dradis/plugins/nexpose/importer.rb
dradis-nexpose-3.17.0 lib/dradis/plugins/nexpose/importer.rb
dradis-nexpose-3.16.0 lib/dradis/plugins/nexpose/importer.rb
dradis-nexpose-3.15.0 lib/dradis/plugins/nexpose/importer.rb
dradis-nexpose-3.14.0 lib/dradis/plugins/nexpose/importer.rb
dradis-nexpose-3.13.0 lib/dradis/plugins/nexpose/importer.rb
dradis-nexpose-3.12.0 lib/dradis/plugins/nexpose/importer.rb
dradis-nexpose-3.11.0 lib/dradis/plugins/nexpose/importer.rb
dradis-nexpose-3.10.1 lib/dradis/plugins/nexpose/importer.rb
dradis-nexpose-3.10.0 lib/dradis/plugins/nexpose/importer.rb
dradis-nexpose-3.9.0 lib/dradis/plugins/nexpose/importer.rb
dradis-nexpose-3.8.0 lib/dradis/plugins/nexpose/importer.rb