Sha256: 3e029f140287d6ef4ac12bb8e009d6da04a0247a30347d9648b40237aefdf117

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 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 =~ 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

3 entries across 3 versions & 1 rubygems

Version Path
wpscan-3.6.1 app/finders/plugins/comment.rb
wpscan-3.6.0 app/finders/plugins/comment.rb
wpscan-3.5.5 app/finders/plugins/comment.rb