Class: WPScan::Finders::Plugins::Comment

Inherits:
DynamicFinder::WpItems::Finder show all
Defined in:
app/finders/plugins/comment.rb

Overview

Plugins finder from the Dynamic Finder ‘Comment’

Constant Summary collapse

DEFAULT_CONFIDENCE =
30

Instance Method Summary collapse

Methods inherited from DynamicFinder::WpItems::Finder

#aggressive, #aggressive_, #aggressive_configs, #aggressive_path, #passive, #passive_configs

Instance Method Details

#process_response(opts, response, slug, klass, config) ⇒ Plugin

Returns The detected plugin in the response, related to the config.

Parameters:

  • opts (Hash)

    The options from the #passive, #aggressive methods

  • response (Typhoeus::Response)
  • slug (String)
  • klass (String)
  • config (Hash)

    The related dynamic finder config hash

Returns:

  • (Plugin)

    The detected plugin in the response, related to the config



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/finders/plugins/comment.rb', line 17

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