WpPlugins::Detectable

Public Instance Methods

item_xpath() click to toggle source

@return [ String ]

# File lib/common/collections/wp_plugins/detectable.rb, line 11
def item_xpath
  '//plugin'
end
passive_detection(wp_target, options = {}) click to toggle source

@param [ WpTarget ] wp_target @param [ Hash ] options

@return [ WpPlugins ]

# File lib/common/collections/wp_plugins/detectable.rb, line 19
def passive_detection(wp_target, options = {})
  detected = super(wp_target, options)

  detected += from_header(wp_target)
  detected += from_content(wp_target)

  detected.uniq! { |i| i.name }
  detected
end
vulns_file() click to toggle source

@return [ String ]

# File lib/common/collections/wp_plugins/detectable.rb, line 6
def vulns_file
  PLUGINS_VULNS_FILE
end

Protected Instance Methods

from_content(wp_target) click to toggle source

<!– Cached page generated by WP-Super-Cache on 2013-05-03 14:46:37 –> <!– Performance optimized by W3 Total Cache. @param [ WpTarget ] wp_target

@return [ WpPlugins ]

# File lib/common/collections/wp_plugins/detectable.rb, line 59
def from_content(wp_target)
  body       = Browser.get(wp_target.url).body
  wp_plugins = WpPlugins.new(wp_target)

  wp_plugins.add('wp-super-cache') if body =~ /wp-super-cache/
  wp_plugins.add('w3-total-cache') if body =~ /w3 total cache/

  wp_plugins
end
from_header(wp_target) click to toggle source

X-Powered-By: W3 Total Cache/0.9.2.5 WP-Super-Cache: Served supercache file from PHP @param [ WpTarget ] wp_target

@return [ WpPlugins ]

# File lib/common/collections/wp_plugins/detectable.rb, line 36
def from_header(wp_target)
  headers    = Browser.get(wp_target.url).headers
  wp_plugins = WpPlugins.new(wp_target)

  if headers
    powered_by     = headers['X-Powered-By'].to_s
    wp_super_cache = headers['wp-super-cache'].to_s

    if matches = /W3 Total Cache\/([0-9.]+)/.match(powered_by)
      wp_plugins.add('w3-total-cache', version: matches[1])
    end

    wp_plugins.add('wp-super-cache') if wp_super_cache =~ /supercache/
  end

  wp_plugins
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.