# frozen_string_literal: true12module WPScan3module Finders4module Plugins5# Plugins finder from the Dynamic Finder 'Comment'6class Comment < Finders::DynamicFinder::WpItems::Finder7DEFAULT_CONFIDENCE = 3089# @param [ Hash ] opts The options from the #passive, #aggressive methods10# @param [ Typhoeus::Response ] response11# @param [ String ] slug12# @param [ String ] klass13# @param [ Hash ] config The related dynamic finder config hash14#15# @return [ Plugin ] The detected plugin in the response, related to the config16def process_response(opts, response, slug, klass, config)17response.html.xpath(config['xpath'] || '//comment()').each do |node|18comment = node.text.to_s.strip1920next unless comment&.match?(config['pattern'])2122return Model::Plugin.new(23slug,24target,25opts.merge(found_by: found_by(klass), confidence: config['confidence'] || DEFAULT_CONFIDENCE)26)27end28end29end30end31end32end333435