Parent

Files

WpTheme

Attributes

name[R]
style_url[R]
version[R]

Public Class Methods

find(target_uri) click to toggle source
# File lib/wpscan/wp_theme.rb, line 53
def self.find(target_uri)
  self.methods.grep(/find_from_/).each do |method_to_call|
    theme = self.send(method_to_call, target_uri)

    return theme if theme
  end
  nil
end
new(options = {}) click to toggle source
# File lib/wpscan/wp_theme.rb, line 25
def initialize(options = {})
  @url            = options[:url]
  @name           = options[:name] || extract_name_from_url(get_url)
  @path           = options[:path]
  @wp_content_dir = options[:wp_content_dir]
  @vulns_xml      = options[:vulns_xml] || DATA_DIR + '/wp_theme_vulns.xml'
  @vulns_xpath    = "//theme[@name='#{@name}']/vulnerability"

  @version        = options[:version]
  @style_url      = options[:style_url]

  raise("url not set") unless @url
  raise("path not set") unless @path
  raise("wp_content_dir not set") unless @wp_content_dir
  raise("name not set") unless @name
  raise("vulns_xml not set") unless @vulns_xml
end

Protected Class Methods

find_from_wooframework(target_uri) click to toggle source

code.google.com/p/wpscan/issues/detail?id=141

# File lib/wpscan/wp_theme.rb, line 91
def self.find_from_wooframework(target_uri)
  body = Browser.instance.get(target_uri.to_s).body
  regexp = %{<meta name="generator" content="([^\s"]+)\s?([^"]+)?" />\s+<meta name="generator" content="WooFramework\s?([^"]+)?" />}

  if matches = regexp.match(body)
    woo_theme_name        = matches[1]
    woo_theme_version     = matches[2]
    woo_framework_version = matches[3] # Not used at this time

    return new(:name            => woo_theme_name,
               :version         => woo_theme_version,
               :url             => matches[0],
               :path            => "",
               :wp_content_dir  => ""
    )
  end
end

Public Instance Methods

===(wp_theme) click to toggle source
# File lib/wpscan/wp_theme.rb, line 67
def ===(wp_theme)
  wp_theme.name === @name and wp_theme.version === @version
end
to_s() click to toggle source
# File lib/wpscan/wp_theme.rb, line 62
def to_s
  version = version()
  "#{@name}#{' v' + version if version}"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.