Sha256: 013861733050b30e5101c71c5da06043f99e03ad4ad88346381f2182c13e35ca

Contents?: true

Size: 1.6 KB

Versions: 32

Compression:

Stored size: 1.6 KB

Contents

# Matches {#matchable} {Mdm::Service} or {Mdm::Vuln} to a {#module_detail Metasploit Module} that can exploit it.
class MetasploitDataModels::AutomaticExploitation::Match < ActiveRecord::Base
  #
  # Associations
  #

  # A (polymorphic) "matchable" entity like a {Mdm::Vuln} or {Mdm::Service}
  #
  # @return [Mdm::Service, Mdm::Vuln]
  belongs_to :matchable, polymorphic: true

  # The {MatchSet} this match is part of
  has_many :match_results,
           class_name: 'MetasploitDataModels::AutomaticExploitation::MatchResult',
           inverse_of: :match

  # The {MatchSet} this match is part of
  belongs_to :match_set,
             class_name: 'MetasploitDataModels::AutomaticExploitation::MatchSet',
             inverse_of: :matches

  # The Metasploit Module that this match connects to
  belongs_to :module_detail,
             class_name: 'Mdm::Module::Detail',
             foreign_key: :module_fullname,
             primary_key: :fullname

  # Scope a match to a MetasploitDataModels::AutomaticExploitation::Run
  scope :by_run_and_vuln,
        ->(run,vuln){
          joins(
            MetasploitDataModels::AutomaticExploitation::Match.join_association(:match_set),
            MetasploitDataModels::AutomaticExploitation::MatchSet.join_association(:runs)
          ).where(
            MetasploitDataModels::AutomaticExploitation::Run[:id].eq(run.id)
          ).where(
            MetasploitDataModels::AutomaticExploitation::Match[:matchable_id].eq(vuln.id),
            MetasploitDataModels::AutomaticExploitation::Match[:matchable_type].eq("Mdm::Vuln")
          )
        }

  Metasploit::Concern.run(self)
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
metasploit_data_models-3.0.10 app/models/metasploit_data_models/automatic_exploitation/match.rb
metasploit_data_models-3.0.9 app/models/metasploit_data_models/automatic_exploitation/match.rb
metasploit_data_models-3.0.8 app/models/metasploit_data_models/automatic_exploitation/match.rb
metasploit_data_models-3.0.7 app/models/metasploit_data_models/automatic_exploitation/match.rb
metasploit_data_models-3.0.6 app/models/metasploit_data_models/automatic_exploitation/match.rb
metasploit_data_models-3.0.5 app/models/metasploit_data_models/automatic_exploitation/match.rb
metasploit_data_models-2.0.17 app/models/metasploit_data_models/automatic_exploitation/match.rb
metasploit_data_models-3.0.4 app/models/metasploit_data_models/automatic_exploitation/match.rb
metasploit_data_models-3.0.2 app/models/metasploit_data_models/automatic_exploitation/match.rb
metasploit_data_models-3.0.1 app/models/metasploit_data_models/automatic_exploitation/match.rb
metasploit_data_models-3.0.0 app/models/metasploit_data_models/automatic_exploitation/match.rb
metasploit_data_models-2.0.16 app/models/metasploit_data_models/automatic_exploitation/match.rb
metasploit_data_models-2.0.15 app/models/metasploit_data_models/automatic_exploitation/match.rb
metasploit_data_models-2.0.14 app/models/metasploit_data_models/automatic_exploitation/match.rb
metasploit_data_models-2.0.13 app/models/metasploit_data_models/automatic_exploitation/match.rb
metasploit_data_models-2.0.12 app/models/metasploit_data_models/automatic_exploitation/match.rb
metasploit_data_models-2.0.11 app/models/metasploit_data_models/automatic_exploitation/match.rb
metasploit_data_models-2.0.10 app/models/metasploit_data_models/automatic_exploitation/match.rb
metasploit_data_models-2.0.9 app/models/metasploit_data_models/automatic_exploitation/match.rb
metasploit_data_models-2.0.8 app/models/metasploit_data_models/automatic_exploitation/match.rb