Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wpscanteam
GitHub Repository: wpscanteam/wpscan
Path: blob/master/app/finders/plugins/header_pattern.rb
485 views
1
# frozen_string_literal: true
2
3
module WPScan
4
module Finders
5
module Plugins
6
# Plugins finder from Dynamic Finder 'HeaderPattern'
7
class HeaderPattern < Finders::DynamicFinder::WpItems::Finder
8
DEFAULT_CONFIDENCE = 30
9
10
# @param [ Hash ] opts
11
#
12
# @return [ Array<Plugin> ]
13
def passive(opts = {})
14
found = []
15
headers = target.homepage_res.headers
16
17
return found if headers.empty?
18
19
DB::DynamicFinders::Plugin.passive_header_pattern_finder_configs.each do |slug, configs|
20
configs.each do |klass, config|
21
next unless headers[config['header']] && headers[config['header']].to_s =~ config['pattern']
22
23
found << Model::Plugin.new(
24
slug,
25
target,
26
opts.merge(found_by: found_by(klass), confidence: config['confidence'] || DEFAULT_CONFIDENCE)
27
)
28
end
29
end
30
31
found
32
end
33
34
# @param [ Hash ] opts
35
#
36
# @return [ nil ]
37
def aggressive(_opts = {})
38
# None
39
end
40
end
41
end
42
end
43
end
44
45