Module: Msf::HTTP::Wordpress::Version

Included in:
Msf::HTTP::Wordpress
Defined in:
lib/msf/http/wordpress/version.rb

Instance Method Summary collapse

Instance Method Details

#wordpress_versionString?

Extracts the Wordpress version information from various sources

Returns:

  • (String, nil)

    Wordpress version if found, nil otherwise


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/msf/http/wordpress/version.rb', line 8

def wordpress_version
  # detect version from generator
  version = wordpress_version_helper(normalize_uri(target_uri.path), /<meta name="generator" content="WordPress #{wordpress_version_pattern}" \/>/i)
  return version if version

  # detect version from readme
  version = wordpress_version_helper(wordpress_url_readme, /<br \/>\sversion #{wordpress_version_pattern}/i)
  return version if version

  # detect version from rss
  version = wordpress_version_helper(wordpress_url_rss, /<generator>http:\/\/wordpress.org\/\?v=#{wordpress_version_pattern}<\/generator>/i)
  return version if version

  # detect version from rdf
  version = wordpress_version_helper(wordpress_url_rdf, /<admin:generatorAgent rdf:resource="http:\/\/wordpress.org\/\?v=#{wordpress_version_pattern}" \/>/i)
  return version if version

  # detect version from atom
  version = wordpress_version_helper(wordpress_url_atom, /<generator uri="http:\/\/wordpress.org\/" version="#{wordpress_version_pattern}">WordPress<\/generator>/i)
  return version if version

  # detect version from sitemap
  version = wordpress_version_helper(wordpress_url_sitemap, /generator="wordpress\/#{wordpress_version_pattern}"/i)
  return version if version

  # detect version from opml
  version = wordpress_version_helper(wordpress_url_opml, /generator="wordpress\/#{wordpress_version_pattern}"/i)
  return version if version

  nil
end