Class: WPScan::Finders::DynamicFinder::Version::Xpath

Inherits:
Finder
  • Object
show all
Defined in:
lib/wpscan/finders/dynamic_finder/version/xpath.rb

Overview

Version finder using Xpath method

Direct Known Subclasses

Comment, WpItemVersion::Xpath, WpVersion::Xpath

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Finder

#aggressive, child_class_constant, create_child_class, #passive

Class Method Details

.child_class_constantsHash

Returns:

  • (Hash)


10
11
12
13
14
# File 'lib/wpscan/finders/dynamic_finder/version/xpath.rb', line 10

def self.child_class_constants
  @child_class_constants ||= super().merge(
    XPATH: nil, PATTERN: /\A(?<v>\d+\.[.\d]+)/, CONFIDENCE: 60
  )
end

Instance Method Details

#find(response, _opts = {}) ⇒ Version

Parameters:

Returns:



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/wpscan/finders/dynamic_finder/version/xpath.rb', line 19

def find(response, _opts = {})
  target.xpath_pattern_from_page(
    self.class::XPATH, self.class::PATTERN, response
  ) do |match_data, _node|
    next unless match_data[:v]

    return create_version(
      match_data[:v],
      interesting_entries: ["#{response.effective_url}, Match: '#{match_data}'"]
    )
  end
  nil
end