Sha256: 4ae1f0041cfedd21dff77ec0acb53586695bb4544ecc31fca7b1e87f6ea52b42

Contents?: true

Size: 1.55 KB

Versions: 2

Compression:

Stored size: 1.55 KB

Contents

# The result of {#run running} a {#match}.
class MetasploitDataModels::AutomaticExploitation::MatchResult < ActiveRecord::Base
  #
  # CONSTANTS
  #

  # Running associated exploit did NOT create a session
  FAILED = "failed"
  # Running associated exploit created a session
  SUCCEEDED = "succeeded"

  # Valid values for {#state}
  VALID_STATES = [FAILED, SUCCEEDED]

  #
  # Associations
  #

  # A {MetasploitDataModels::AutomaticExploitation::Match#module_detail Metasploit Module} matched to
  # {MetasploitDataModels::AutomaticExploitation::Match#matchable Mdm::Host or Mdm::Service}.
  belongs_to :match,
             class_name: 'MetasploitDataModels::AutomaticExploitation::Match',
             inverse_of: :match_results,
             dependent: :destroy

  # A mass automatic exploitation run.
  belongs_to :run,
             inverse_of: :match_results,
             class_name: 'MetasploitDataModels::AutomaticExploitation::Run'

  #
  # Attributes
  #

  # @!attribute state
  #   Whether the {#run} of {#match} succeeded.
  #
  #   @return ['failed', 'succeeded']

  #
  # Mass Assignment Security
  #

  attr_accessible :match_id
  attr_accessible :run_id
  attr_accessible :state

  #
  # Validations
  #

  # must be present and one of allowable values
  validates :state,
            presence: true,
            inclusion: VALID_STATES

  #
  # Scopes
  #

  # Runs of {#match} that failed
  scope :failed, lambda { where(state:"failed") }

  # Runs of {#match} that succeeded
  scope :succeeded, lambda { where(state:"succeeded") }

  Metasploit::Concern.run(self)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
metasploit_data_models-0.24.3 app/models/metasploit_data_models/automatic_exploitation/match_result.rb
metasploit_data_models-0.24.2 app/models/metasploit_data_models/automatic_exploitation/match_result.rb