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)


20
21
22
23
24
# File 'app/finders/theme_version/style.rb', line 20

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

  style_version
end

#cached_style?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'app/finders/theme_version/style.rb', line 27

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

#passive(_opts = {}) ⇒ Version

Parameters:

  • opts (Hash)

Returns:

  • (Version)


11
12
13
14
15
# File 'app/finders/theme_version/style.rb', line 11

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

  style_version
end

#style_versionVersion

Returns:

  • (Version)


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

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

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