Sha256: 99fb1aaa314fa60d4bde8ae071ddcdfaeb83722d2fdcd6b67be7a7e5f30f31ab

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

module WPScan
  # WP Version
  class WpVersion < CMSScanner::Version
    include Vulnerable
    attr_reader :db_data

    def initialize(number, opts = {})
      raise InvalidWordPressVersion unless WpVersion.valid?(number.to_s)

      super(number, opts)
    end

    # @param [ String ] number
    #
    # @return [ Boolean ] true if the number is a valid WP version, false otherwise
    def self.valid?(number)
      all.include?(number)
    end

    # @return [ Array<String> ] All the version numbers
    def self.all
      return @all_numbers if @all_numbers

      @all_numbers = []

      DB::Version.all.each { |v| @all_numbers << v.number }

      @all_numbers
    end

    # @return [ JSON ]
    def db_data
      DB::Version.db_data(number)
    end

    # @return [ Array<Vulnerability> ]
    def vulnerabilities
      return @vulnerabilities if @vulnerabilities

      @vulnerabilities = []

      [*db_data['vulnerabilities']].each do |json_vuln|
        @vulnerabilities << Vulnerability.load_from_json(json_vuln)
      end

      @vulnerabilities
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wpscan-3.0.3 app/models/wp_version.rb
wpscan-3.0.2 app/models/wp_version.rb
wpscan-3.0.1 app/models/wp_version.rb
wpscan-3.0 app/models/wp_version.rb