Class: WPScan::Finders::ThemeVersion::Style

Inherits:
CMSScanner::Finders::Finder
  • Object
show all
Defined in:
app/finders/theme_version/style.rb

Overview

Theme Version Finder from the style.css file

Instance Method Summary collapse

Instance Method Details

#aggressive(_opts = {}) ⇒ Version

Parameters:

  • opts (Hash)

Returns:

  • (Version)


18
19
20
21
22
# File 'app/finders/theme_version/style.rb', line 18

def aggressive(_opts = {})
  return if cached_style?

  style_version
end

#cached_style?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'app/finders/theme_version/style.rb', line 25

def cached_style?
  Typhoeus::Config.cache.get(browser.forge_request(target.style_url)) ? true : false
end

#passive(_opts = {}) ⇒ Version

Parameters:

  • opts (Hash)

Returns:

  • (Version)


9
10
11
12
13
# File 'app/finders/theme_version/style.rb', line 9

def passive(_opts = {})
  return unless cached_style?

  style_version
end

#style_versionVersion

Returns:

  • (Version)


30
31
32
33
34
35
36
37
38
39
# File 'app/finders/theme_version/style.rb', line 30

def style_version
  return unless Browser.get(target.style_url).body =~ /Version:[\t ]*(?!trunk)([0-9a-z\.-]+)/i

  WPScan::Version.new(
    Regexp.last_match[1],
    found_by: found_by,
    confidence: 80,
    interesting_entries: ["#{target.style_url}, Match: '#{Regexp.last_match}'"]
  )
end