Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wpscanteam
GitHub Repository: wpscanteam/wpscan
Path: blob/master/app/finders/plugins/body_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 'BodyPattern'
7
class BodyPattern < Finders::DynamicFinder::WpItems::Finder
8
DEFAULT_CONFIDENCE = 30
9
10
# @param [ Hash ] opts The options from the #passive, #aggressive methods
11
# @param [ Typhoeus::Response ] response
12
# @param [ String ] slug
13
# @param [ String ] klass
14
# @param [ Hash ] config The related dynamic finder config hash
15
#
16
# @return [ Plugin ] The detected plugin in the response, related to the config
17
def process_response(opts, response, slug, klass, config)
18
return unless response.body&.match?(config['pattern'])
19
20
Model::Plugin.new(
21
slug,
22
target,
23
opts.merge(found_by: found_by(klass), confidence: config['confidence'] || DEFAULT_CONFIDENCE)
24
)
25
end
26
end
27
end
28
end
29
end
30
31