Sha256: 4eb8873030eef1d902fa183d32bfd1e50664baa22ffa2a0490c1a1a61f27c429

Contents?: true

Size: 1.25 KB

Versions: 25

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

module WPScan
  module Model
    # WordPress Plugin
    class Plugin < WpItem
      # See WpItem
      def initialize(slug, blog, opts = {})
        super(slug, blog, opts)

        # To be used by #head_and_get
        # If custom wp-content, it will be replaced by blog#url
        @path_from_blog = "wp-content/plugins/#{slug}/"

        @uri = Addressable::URI.parse(blog.url(path_from_blog))
      end

      # Retrieve the metadata from the vuln API if available (and a valid token is given),
      # or the local metadata db otherwise
      # @return [ Hash ]
      def metadata
        @metadata ||= db_data.empty? ? DB::Plugin.metadata_at(slug) : db_data
      end

      # @return [ Hash ]
      def db_data
        @db_data ||= DB::VulnApi.plugin_data(slug)
      end

      # @param [ Hash ] opts
      #
      # @return [ Model::Version, false ]
      def version(opts = {})
        @version = Finders::PluginVersion::Base.find(self, version_detection_opts.merge(opts)) if @version.nil?

        @version
      end

      # @return [ Array<String> ]
      def potential_readme_filenames
        @potential_readme_filenames ||= Array((DB::DynamicFinders::Plugin.df_data.dig(slug, 'Readme', 'path') || super))
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
wpscan-3.8.28 app/models/plugin.rb
wpscan-3.8.27 app/models/plugin.rb
wpscan-3.8.26 app/models/plugin.rb
wpscan-3.8.25 app/models/plugin.rb
wpscan-3.8.24 app/models/plugin.rb
wpscan-3.8.22 app/models/plugin.rb
wpscan-3.8.21 app/models/plugin.rb
wpscan-3.8.20 app/models/plugin.rb
wpscan-3.8.19 app/models/plugin.rb
wpscan-3.8.18 app/models/plugin.rb
wpscan-3.8.17 app/models/plugin.rb
wpscan-3.8.16 app/models/plugin.rb
wpscan-3.8.15 app/models/plugin.rb
wpscan-3.8.14 app/models/plugin.rb
wpscan-3.8.13 app/models/plugin.rb
wpscan-3.8.12 app/models/plugin.rb
wpscan-3.8.11 app/models/plugin.rb
wpscan-3.8.10 app/models/plugin.rb
wpscan-3.8.9 app/models/plugin.rb
wpscan-3.8.8 app/models/plugin.rb