Sha256: 83f8ddcb4403ba15af9b3b1aaaf2d4c113421fa5fe778f22795fe74effdfd467

Contents?: true

Size: 1.52 KB

Versions: 31

Compression:

Stored size: 1.52 KB

Contents

# Implementation of {Metasploit::Model::Platform} to allow testing of {Metasploit::Model::Platform} using an in-memory
# ActiveModel and use of factories.
class Dummy::Platform < Metasploit::Model::Base
  include Metasploit::Model::Platform

  #
  # Attributes
  #

  # @!attribute [rw] fully_qualified_name
  #   The fully qualified name of this platform, as would be used in the platform list in a metasploit-framework
  #   module.
  #
  #   @return [String]
  attr_accessor :fully_qualified_name

  # @!attribute [rw] parent
  #   The parent platform of this platform.  For example, Windows is parent of Windows 98, which is the parent of
  #   Windows 98 FE.
  #
  #   @return [nil] if this is a top-level platform, such as Windows or Linux.
  #   @return [Metasploit::Model::Platform]
  attr_accessor :parent

  # @!attribute [rw] relative_name
  #   The name of this platform relative to the {#fully_qualified_name} of {#parent}.
  #
  #   @return [String]
  attr_accessor :relative_name

  #
  # Methods
  #

  def self.all
    # cache so that Dummy::Platform can be compared by identity
    unless instance_variable_defined? :@all
      @all = []

      Metasploit::Model::Platform.each_seed_attributes do |attributes|
        child = new(attributes)
        # validate to populate {#fully_qualified_name}
        child.valid!

        @all << child

        # yieldreturn
        child
      end

      # freeze objects to prevent specs from modifying them and interfering with other specs.
      @all.map(&:freeze)
    end

    @all
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
metasploit-model-0.25.3 spec/dummy/app/models/dummy/platform.rb
metasploit-model-0.25.3-java spec/dummy/app/models/dummy/platform.rb
metasploit-model-0.25.2 spec/dummy/app/models/dummy/platform.rb
metasploit-model-0.25.2-java spec/dummy/app/models/dummy/platform.rb
metasploit-model-0.25.1 spec/dummy/app/models/dummy/platform.rb
metasploit-model-0.25.1-java spec/dummy/app/models/dummy/platform.rb
metasploit-model-0.25.1.pre.metasploit.pre.model.pre.search.pre.operator.pre.and.pre.operation.pre.groups-java spec/dummy/app/models/dummy/platform.rb
metasploit-model-0.25.1.pre.metasploit.pre.model.pre.search.pre.operator.pre.and.pre.operation.pre.groups spec/dummy/app/models/dummy/platform.rb
metasploit-model-0.24.1-java spec/dummy/app/models/dummy/platform.rb
metasploit-model-0.24.1 spec/dummy/app/models/dummy/platform.rb
metasploit-model-0.24.1.pre.semantic.pre.versioning.pre.2.pre.0 spec/dummy/app/models/dummy/platform.rb