Class: WPScan::Finders::Plugins::JavascriptVar

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

Overview

Plugins finder from the Dynamic Finder ‘JavascriptVar’

Constant Summary collapse

DEFAULT_CONFIDENCE =
60

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
# File 'app/finders/plugins/javascript_var.rb', line 17

def process_response(opts, response, slug, klass, config)
  response.html.xpath(config['xpath'] || '//script[not(@src)]').each do |node|
    next if config['pattern'] && !node.text.match(config['pattern'])

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