Class: WPScan::Model::Plugin
Overview
WordPress Plugin
Constant Summary
Constants inherited from WpItem
Instance Attribute Summary
Attributes inherited from WpItem
#blog, #detection_opts, #path_from_blog, #slug, #uri, #version_detection_opts
Instance Method Summary collapse
- #db_data ⇒ Hash
-
#initialize(slug, blog, opts = {}) ⇒ Plugin
constructor
See WpItem.
-
#metadata ⇒ Hash
Retrieve the metadata from the vuln API if available (and a valid token is given), or the local metadata db otherwise.
- #potential_readme_filenames ⇒ Array<String>
- #version(opts = {}) ⇒ Model::Version, false
Methods inherited from WpItem
#==, #classify, #directory_listing?, #error_log?, #head_and_get, #last_updated, #latest_version, #outdated?, #popular?, #readme_url, #to_s, #url, #vulnerabilities, #vulnerable_to?
Methods included from Vulnerable
Constructor Details
#initialize(slug, blog, opts = {}) ⇒ Plugin
See WpItem
8 9 10 11 12 13 14 15 16 |
# File 'app/models/plugin.rb', line 8 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 |
Instance Method Details
#db_data ⇒ Hash
26 27 28 |
# File 'app/models/plugin.rb', line 26 def db_data @db_data ||= DB::VulnApi.plugin_data(slug) end |
#metadata ⇒ Hash
Retrieve the metadata from the vuln API if available (and a valid token is given), or the local metadata db otherwise
21 22 23 |
# File 'app/models/plugin.rb', line 21 def @metadata ||= db_data.empty? ? DB::Plugin.(slug) : db_data end |
#potential_readme_filenames ⇒ Array<String>
40 41 42 |
# File 'app/models/plugin.rb', line 40 def potential_readme_filenames @potential_readme_filenames ||= Array((DB::DynamicFinders::Plugin.df_data.dig(slug, 'Readme', 'path') || super)) end |
#version(opts = {}) ⇒ Model::Version, false
33 34 35 36 37 |
# File 'app/models/plugin.rb', line 33 def version(opts = {}) @version = Finders::PluginVersion::Base.find(self, version_detection_opts.merge(opts)) if @version.nil? @version end |