Sha256: e8a5974311afd201a16fe3400d8290f31a1ce60ad1c3336d1a46d314b9745814
Contents?: true
Size: 1.24 KB
Versions: 9
Compression:
Stored size: 1.24 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 def self.templates { evidence: 'full_evidence', issue: 'full_vulnerability' } end # 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
9 entries across 9 versions & 1 rubygems