metasploit_data_models 1.2.6 → 1.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a2851ff0a874979d51536d4c91b346339923d0d
4
- data.tar.gz: 2f917872a6e4cbf0589aca13bb50ef5c3b8e453d
3
+ metadata.gz: a832e9ced35288ddac2edbb5e3cd4d4eb19cbb5c
4
+ data.tar.gz: a9f00670c0d01fe19f0991471f7344c6c3370915
5
5
  SHA512:
6
- metadata.gz: 991277f433519b3f5c5378ef266d2425cc8a3470f8d824b432071cf63e82e91cc6073fad54c7b313b3ee60f50f558d052379b8dde564142e417358add1c854fd
7
- data.tar.gz: d2c14f9973c35435367ad37f0080a97b167880163045551f0042e644c1ba73ad502fa547353b400561416021c79e19d0329558b59a10af66d1907705086e57b0
6
+ metadata.gz: 255b6a0e805116a6c992657c38d1f25ba81a863cec6dde9f79c5263016c693043c80c99c812329bc4186aab2bc7bccafebde2e9967102afffb2fb50520c58aa1
7
+ data.tar.gz: a0c035e7112895aee64de5fb2af85824dade5095b9d0da642d612c6d59d75d08a1a8216ac83cd95578fe68228561c0ba78ab8504c10d0971621b76eb62b54aef
@@ -22,6 +22,14 @@ class Mdm::Vuln < ActiveRecord::Base
22
22
  counter_cache: :vuln_count,
23
23
  inverse_of: :vulns
24
24
 
25
+ # @!attribute [rw] matches
26
+ # The matches for this vuln
27
+ #
28
+ # @return [ActiveRecord::Relation<MetasploitDataModels::AutomaticExploitation::Match>]
29
+ has_many :matches, class_name: "MetasploitDataModels::AutomaticExploitation::Match",
30
+ as: :matchable,
31
+ dependent: :destroy
32
+
25
33
  # @!attribute [rw] service
26
34
  # The service with the vulnerability.
27
35
  #
@@ -118,6 +126,8 @@ class Mdm::Vuln < ActiveRecord::Base
118
126
  :class_name => 'Mdm::Module::Detail',
119
127
  :source => :detail,
120
128
  :through => :module_refs
129
+
130
+
121
131
  #
122
132
  # Attributes
123
133
  #
@@ -25,5 +25,19 @@ class MetasploitDataModels::AutomaticExploitation::Match < ActiveRecord::Base
25
25
  foreign_key: :module_fullname,
26
26
  primary_key: :fullname
27
27
 
28
+ # Scope a match to a MetasploitDataModels::AutomaticExploitation::Run
29
+ scope :by_run_and_vuln,
30
+ ->(run,vuln){
31
+ joins(
32
+ MetasploitDataModels::AutomaticExploitation::Match.join_association(:match_set),
33
+ MetasploitDataModels::AutomaticExploitation::MatchSet.join_association(:runs)
34
+ ).where(
35
+ MetasploitDataModels::AutomaticExploitation::Run[:id].eq(run.id)
36
+ ).where(
37
+ MetasploitDataModels::AutomaticExploitation::Match[:matchable_id].eq(vuln.id),
38
+ MetasploitDataModels::AutomaticExploitation::Match[:matchable_type].eq("Mdm::Vuln")
39
+ )
40
+ }
41
+
28
42
  Metasploit::Concern.run(self)
29
43
  end
@@ -10,7 +10,7 @@ module MetasploitDataModels
10
10
  # The minor version number, scoped to the {MAJOR} version number.
11
11
  MINOR = 2
12
12
  # The patch version number, scoped to the {MAJOR} and {MINOR} version numbers.
13
- PATCH = 6
13
+ PATCH = 7
14
14
 
15
15
 
16
16
  #
@@ -41,6 +41,7 @@ RSpec.describe Mdm::Vuln, type: :model do
41
41
  it { is_expected.to have_many(:vuln_details).class_name('Mdm::VulnDetail').dependent(:destroy) }
42
42
  it { is_expected.to have_many(:vulns_refs).class_name('Mdm::VulnRef').dependent(:destroy) }
43
43
  it { is_expected.to have_many(:notes).class_name('Mdm::Note').dependent(:delete_all).order('notes.created_at') }
44
+ it { is_expected.to have_many(:matches).class_name("MetasploitDataModels::AutomaticExploitation::Match").dependent(:destroy) }
44
45
 
45
46
  context 'module_details' do
46
47
  it { is_expected.to have_many(:module_details).class_name('Mdm::Module::Detail').through(:module_refs) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metasploit_data_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.6
4
+ version: 1.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Huckins
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-07-02 00:00:00.000000000 Z
14
+ date: 2015-09-29 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: metasploit-version