module WPScan
module Finders
module ThemeVersion
class Style < CMSScanner::Finders::Finder
def passive(_opts = {})
return unless cached_style?
style_version
end
def aggressive(_opts = {})
return if cached_style?
style_version
end
def cached_style?
Typhoeus::Config.cache.get(browser.forge_request(target.style_url)) ? true : false
end
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
end
end
end
end