Module: WpPlugins::Detectable

Included in:
WpPlugins
Defined in:
lib/common/collections/wp_plugins/detectable.rb

Instance Method Summary (collapse)

Instance Method Details

- (WpPlugins) from_content(wp_target) (protected)

<!-- Cached page generated by WP-Super-Cache on 2013-05-03 14:46:37 --> <!-- Performance optimized by W3 Total Cache.

Parameters:

Returns:



60
61
62
63
64
65
66
67
68
# File 'lib/common/collections/wp_plugins/detectable.rb', line 60

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/i
  wp_plugins.add('w3-total-cache') if body =~ /w3 total cache/i

  wp_plugins
end

- (WpPlugins) from_header(wp_target) (protected)

X-Powered-By: W3 Total Cache/0.9.2.5 WP-Super-Cache: Served supercache file from PHP

Parameters:

Returns:



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/common/collections/wp_plugins/detectable.rb', line 37

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.]+)/i.match(powered_by)
      wp_plugins.add('w3-total-cache', version: matches[1])
    end

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

  wp_plugins
end

- (String) item_xpath

Returns:

  • (String)


12
13
14
# File 'lib/common/collections/wp_plugins/detectable.rb', line 12

def item_xpath
  '//plugin'
end

- (WpPlugins) passive_detection(wp_target, options = {})

Parameters:

  • wp_target (WpTarget)
  • options (Hash) (defaults to: {})

Returns:



20
21
22
23
24
25
26
27
28
# File 'lib/common/collections/wp_plugins/detectable.rb', line 20

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

- (String) vulns_file

Returns:

  • (String)


7
8
9
# File 'lib/common/collections/wp_plugins/detectable.rb', line 7

def vulns_file
  PLUGINS_VULNS_FILE
end