Path: blob/master/app/finders/plugins/javascript_var.rb
485 views
# frozen_string_literal: true12module WPScan3module Finders4module Plugins5# Plugins finder from the Dynamic Finder 'JavascriptVar'6class JavascriptVar < Finders::DynamicFinder::WpItems::Finder7DEFAULT_CONFIDENCE = 6089# @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'] || '//script[not(@src)]').each do |node|18next if config['pattern'] && !node.text.match(config['pattern'])1920return Model::Plugin.new(21slug,22target,23opts.merge(found_by: found_by(klass), confidence: config['confidence'] || DEFAULT_CONFIDENCE)24)25end26end27end28end29end30end313233