Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wpscanteam
GitHub Repository: wpscanteam/wpscan
Path: blob/master/app/finders/theme_version/style.rb
485 views
1
# frozen_string_literal: true
2
3
module WPScan
4
module Finders
5
module ThemeVersion
6
# Theme Version Finder from the style.css file
7
class Style < CMSScanner::Finders::Finder
8
# @param [ Hash ] opts
9
#
10
# @return [ Version ]
11
def passive(_opts = {})
12
return unless cached_style?
13
14
style_version
15
end
16
17
# @param [ Hash ] opts
18
#
19
# @return [ Version ]
20
def aggressive(_opts = {})
21
return if cached_style?
22
23
style_version
24
end
25
26
# @return [ Boolean ]
27
def cached_style?
28
Typhoeus::Config.cache.get(browser.forge_request(target.style_url)) ? true : false
29
end
30
31
# @return [ Version ]
32
def style_version
33
return unless Browser.get(target.style_url).body =~ /Version:[\t ]*(?!trunk)([0-9a-z.-]+)/i
34
35
Model::Version.new(
36
Regexp.last_match[1],
37
found_by: found_by,
38
confidence: 80,
39
interesting_entries: ["#{target.style_url}, Match: '#{Regexp.last_match}'"]
40
)
41
end
42
end
43
end
44
end
45
end
46
47