Sha256: eb88d8faf27d38b035375752e8836bce5b4af88ad58dc00704411335e3df246f

Contents?: true

Size: 1.08 KB

Versions: 41

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

module WPScan
  module Finders
    module Plugins
      # Plugins finder from the Dynamic Finder 'Comment'
      class Comment < Finders::DynamicFinder::WpItems::Finder
        DEFAULT_CONFIDENCE = 30

        # @param [ Hash ] opts The options from the #passive, #aggressive methods
        # @param [ Typhoeus::Response ] response
        # @param [ String ] slug
        # @param [ String ] klass
        # @param [ Hash ] config The related dynamic finder config hash
        #
        # @return [ Plugin ] The detected plugin in the response, related to the config
        def process_response(opts, response, slug, klass, config)
          response.html.xpath(config['xpath'] || '//comment()').each do |node|
            comment = node.text.to_s.strip

            next unless comment&.match?(config['pattern'])

            return Model::Plugin.new(
              slug,
              target,
              opts.merge(found_by: found_by(klass), confidence: config['confidence'] || DEFAULT_CONFIDENCE)
            )
          end
        end
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
wpscan-3.8.6 app/finders/plugins/comment.rb
wpscan-3.8.5 app/finders/plugins/comment.rb
wpscan-3.8.4 app/finders/plugins/comment.rb
wpscan-3.8.3 app/finders/plugins/comment.rb
wpscan-3.8.2 app/finders/plugins/comment.rb
wpscan-3.8.1 app/finders/plugins/comment.rb
wpscan-3.8.0 app/finders/plugins/comment.rb
wpscan-3.7.11 app/finders/plugins/comment.rb
wpscan-3.7.10 app/finders/plugins/comment.rb
wpscan-3.7.9 app/finders/plugins/comment.rb
wpscan-3.7.8 app/finders/plugins/comment.rb
wpscan-3.7.7 app/finders/plugins/comment.rb
wpscan-3.7.6 app/finders/plugins/comment.rb
wpscan-3.7.5 app/finders/plugins/comment.rb
wpscan-3.7.4 app/finders/plugins/comment.rb
wpscan-3.7.3 app/finders/plugins/comment.rb
wpscan-3.7.2 app/finders/plugins/comment.rb
wpscan-3.7.1 app/finders/plugins/comment.rb
wpscan-3.7.0 app/finders/plugins/comment.rb
wpscan-3.6.3 app/finders/plugins/comment.rb