Class: WPScan::Finders::WpVersion::RDFGenerator

Inherits:
CMSScanner::Finders::Finder
  • Object
show all
Includes:
Finder::WpVersion::SmartURLChecker
Defined in:
app/finders/wp_version/rdf_generator.rb

Overview

RDF Generator Version Finder

Instance Method Summary collapse

Methods included from Finder::WpVersion::SmartURLChecker

#create_version

Instance Method Details

#aggressive_urls(_opts = {}) ⇒ Object



34
35
36
# File 'app/finders/wp_version/rdf_generator.rb', line 34

def aggressive_urls(_opts = {})
  [target.url('feed/rdf/')]
end

#passive_urls_xpathObject



30
31
32
# File 'app/finders/wp_version/rdf_generator.rb', line 30

def passive_urls_xpath
  '//a[contains(@href, "/rdf")]/@href'
end

#process_urls(urls, _opts = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/finders/wp_version/rdf_generator.rb', line 10

def process_urls(urls, _opts = {})
  found = Findings.new

  urls.each do |url|
    res = Browser.get_and_follow_location(url)

    res.html.xpath('//generatoragent').each do |node|
      next unless node['rdf:resource'] =~ %r{\Ahttps?://wordpress\.(?:[a-z.]+)/\?v=(.*)\z}i

      found << create_version(
        Regexp.last_match[1],
        found_by: found_by,
        entries: ["#{res.effective_url}, #{node.to_s.strip}"]
      )
    end
  end

  found
end