metasploit_data_models 0.23.1 → 0.23.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/mdm/host.rb +42 -33
  3. data/app/models/mdm/loot.rb +9 -0
  4. data/app/models/mdm/module/detail.rb +28 -7
  5. data/app/models/mdm/module/ref.rb +4 -4
  6. data/app/models/mdm/ref.rb +5 -5
  7. data/app/models/mdm/session.rb +18 -1
  8. data/app/models/mdm/user.rb +13 -0
  9. data/app/models/mdm/vuln.rb +16 -7
  10. data/app/models/mdm/workspace.rb +16 -8
  11. data/app/models/metasploit_data_models/automatic_exploitation.rb +5 -0
  12. data/app/models/metasploit_data_models/automatic_exploitation/match.rb +42 -0
  13. data/app/models/metasploit_data_models/automatic_exploitation/match_result.rb +40 -0
  14. data/app/models/metasploit_data_models/automatic_exploitation/match_set.rb +30 -0
  15. data/app/models/metasploit_data_models/automatic_exploitation/run.rb +27 -0
  16. data/app/models/metasploit_data_models/module_run.rb +213 -0
  17. data/app/validators/password_is_strong_validator.rb +5 -5
  18. data/db/migrate/20131002004641_create_automatic_exploitation_matches.rb +13 -0
  19. data/db/migrate/20131002164449_create_automatic_exploitation_match_sets.rb +12 -0
  20. data/db/migrate/20131008213344_create_automatic_exploitation_runs.rb +11 -0
  21. data/db/migrate/20131011184338_module_detail_on_automatic_exploitation_match.rb +10 -0
  22. data/db/migrate/20131017150735_create_automatic_exploitation_match_results.rb +11 -0
  23. data/db/migrate/20131021185657_make_match_polymorphic.rb +11 -0
  24. data/db/migrate/20150219173821_create_module_runs.rb +23 -0
  25. data/db/migrate/20150219215039_add_module_run_to_session.rb +8 -0
  26. data/db/migrate/20150226151459_add_module_run_fk_to_loot.rb +8 -0
  27. data/db/migrate/20150312155312_add_module_full_name_to_match.rb +6 -0
  28. data/db/migrate/20150326183742_add_missing_ae_indices.rb +13 -0
  29. data/lib/metasploit_data_models/version.rb +1 -1
  30. data/spec/app/models/mdm/host_spec.rb +28 -27
  31. data/spec/app/models/mdm/loot_spec.rb +1 -0
  32. data/spec/app/models/mdm/module/detail_spec.rb +2 -2
  33. data/spec/app/models/mdm/session_spec.rb +21 -18
  34. data/spec/app/models/mdm/vuln_spec.rb +9 -10
  35. data/spec/app/models/metasploit_data_models/automatic_exploitation/match_result_spec.rb +88 -0
  36. data/spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb +48 -0
  37. data/spec/app/models/metasploit_data_models/automatic_exploitation/match_spec.rb +25 -0
  38. data/spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb +40 -0
  39. data/spec/app/models/metasploit_data_models/module_run_spec.rb +136 -0
  40. data/spec/dummy/db/structure.sql +369 -2
  41. data/spec/factories/mdm/module/details.rb +21 -21
  42. data/spec/factories/metasploit_data_models/automatic_exploitation/match_results.rb +7 -0
  43. data/spec/factories/metasploit_data_models/automatic_exploitation/match_sets.rb +8 -0
  44. data/spec/factories/metasploit_data_models/automatic_exploitation/matches.rb +6 -0
  45. data/spec/factories/metasploit_data_models/automatic_exploitation/runs.rb +6 -0
  46. data/spec/factories/module_runs.rb +40 -0
  47. metadata +30 -172
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e51d22eadaeed4e22c7baa124b8114e4da2eb18e
4
- data.tar.gz: 85d923444c7ef5c77c992247f2bbc8ec3a3ba5a0
3
+ metadata.gz: 4779d55987df4d62d75eaad7b3f5e40b0b880510
4
+ data.tar.gz: a87a7b50dae2bc02d2ea544290eeae4c406047fe
5
5
  SHA512:
6
- metadata.gz: 985147647109e0da1c592add750c845ee35e9e219b13c23f9ef9f21623b0597c9ca3156dac90068eabf2179341539f2500ec8ea2c9e70709087365a8b78221f0
7
- data.tar.gz: 3d069e07db3b8ff62ea29690e1abad596c11cd16ba45639464c876612c0b0ca9d2d21fa9d8dad3c7082768d4e62551c30079a846013c8ec76be0a0544b79d221
6
+ metadata.gz: 8be1a0f211354eda1de426d22ba9b1ccb81627ab9f0abde742af2b4ce90defd4632650bf8f237c83495c7db9c5c0c4eec499eabf94c48882dcc03f4a9029252a
7
+ data.tar.gz: fc93045d392e8107af1b77619742fd1743f49df7fac46259e48a44e57a5df9d45461f87694b4889b15e73a8c7b38f2509d39dbdf678e875fc4e0e72b02d07047
@@ -66,7 +66,7 @@ class Mdm::Host < ActiveRecord::Base
66
66
  # @!attribute [rw] clients
67
67
  # Users connected to this host
68
68
  #
69
- # @return [Array<Mdm::Client>]
69
+ # @return [ActiveRecord::Relation<Mdm::Client>]
70
70
  has_many :clients,
71
71
  class_name: 'Mdm::Client',
72
72
  dependent: :destroy,
@@ -84,7 +84,7 @@ class Mdm::Host < ActiveRecord::Base
84
84
  # @!attribute [rw] task_hosts
85
85
  # Details about what Tasks touched this host
86
86
  #
87
- # @return [Array<Mdm::TaskHost>]
87
+ # @return [ActiveRecord::Relation<Mdm::TaskHost>]
88
88
  has_many :task_hosts,
89
89
  class_name: 'Mdm::TaskHost',
90
90
  dependent: :destroy,
@@ -93,7 +93,7 @@ class Mdm::Host < ActiveRecord::Base
93
93
  # @!attribute [rw] exploit_attempts
94
94
  # Attempts to run exploits against this host.
95
95
  #
96
- # @return [Array<Mdm::ExploitAttempt]
96
+ # @return [ActiveRecord::Relation<Mdm::ExploitAttempt]
97
97
  has_many :exploit_attempts,
98
98
  class_name: 'Mdm::ExploitAttempt',
99
99
  dependent: :destroy,
@@ -108,7 +108,7 @@ class Mdm::Host < ActiveRecord::Base
108
108
  inverse_of: :host
109
109
 
110
110
  # @!attribute [rw] host_details
111
- # @return [Array<Mdm::HostDetail>]
111
+ # @return [ActiveRecord::Relation<Mdm::HostDetail>]
112
112
  has_many :host_details,
113
113
  class_name: 'Mdm::HostDetail',
114
114
  dependent: :destroy,
@@ -138,7 +138,7 @@ class Mdm::Host < ActiveRecord::Base
138
138
  # @!attribute [rw] notes
139
139
  # Notes about the host entered by a user with {Mdm::Note#created_at oldest notes} first.
140
140
  #
141
- # @return [Array<Mdm::Note>]
141
+ # @return [ActiveRecord::Relation<Mdm::Note>]
142
142
  has_many :notes,
143
143
  class_name: 'Mdm::Note',
144
144
  inverse_of: :host,
@@ -149,7 +149,7 @@ class Mdm::Host < ActiveRecord::Base
149
149
  # The services running on {Mdm::Service#port ports} on the host with services ordered by {Mdm::Service#port port}
150
150
  # and {Mdm::Service#proto protocol}.
151
151
  #
152
- # @return [Array<Mdm::Service>]
152
+ # @return [ActiveRecord::Relation<Mdm::Service>]
153
153
  has_many :services,
154
154
  class_name: 'Mdm::Service',
155
155
  dependent: :destroy,
@@ -160,7 +160,7 @@ class Mdm::Host < ActiveRecord::Base
160
160
  # Sessions that are open or previously were open on the host ordered by {Mdm::Session#opened_at when the session was
161
161
  # opened}
162
162
  #
163
- # @return [Array<Mdm::Session]
163
+ # @return [ActiveRecord::Relation<Mdm::Session]
164
164
  has_many :sessions,
165
165
  class_name: 'Mdm::Session',
166
166
  dependent: :destroy,
@@ -170,7 +170,7 @@ class Mdm::Host < ActiveRecord::Base
170
170
  # @!attribute [rw] vulns
171
171
  # Vulnerabilities found on the host.
172
172
  #
173
- # @return [Array<Mdm::Vuln>]
173
+ # @return [ActiveRecord::Relation<Mdm::Vuln>]
174
174
  has_many :vulns,
175
175
  class_name: 'Mdm::Vuln',
176
176
  dependent: :delete_all,
@@ -191,7 +191,7 @@ class Mdm::Host < ActiveRecord::Base
191
191
  # @!attribute [r] tags
192
192
  # The tags on this host. Tags are used to filter hosts.
193
193
  #
194
- # @return [Array<Mdm::Tag>]
194
+ # @return [ActiveRecord::Relation<Mdm::Tag>]
195
195
  # @see #hosts_tags
196
196
  has_many :tags, :class_name => 'Mdm::Tag', :through => :hosts_tags
197
197
 
@@ -202,14 +202,14 @@ class Mdm::Host < ActiveRecord::Base
202
202
  # @!attribute [r] creds
203
203
  # Credentials captured from {#services}.
204
204
  #
205
- # @return [Array<Mdm::Cred>]
205
+ # @return [ActiveRecord::Relation<Mdm::Cred>]
206
206
  # @see #services
207
207
  has_many :creds, :class_name => 'Mdm::Cred', :through => :services
208
208
 
209
209
  # @!attribute [r] service_notes
210
210
  # {Mdm::Note Notes} about {#services} running on this host.
211
211
  #
212
- # @return [Array<Mdm::Note>]
212
+ # @return [ActiveRecord::Relation<Mdm::Note>]
213
213
  # @see #services
214
214
  has_many :service_notes,
215
215
  class_name: 'Mdm::Note',
@@ -219,10 +219,20 @@ class Mdm::Host < ActiveRecord::Base
219
219
  # @!attribute [r] web_sites
220
220
  # {Mdm::WebSite Web sites} running on top of {#services} on this host.
221
221
  #
222
- # @return [Array<Mdm::WebSite>]
222
+ # @return [ActiveRecord::Relation<Mdm::WebSite>]
223
223
  # @see services
224
224
  has_many :web_sites, :class_name => 'Mdm::WebSite', :through => :services
225
225
 
226
+ # @!attribute [r] module_runs
227
+ # Records of Metasploit modules being run on/against this {Mdm::Host}
228
+ #
229
+ # @return [ActiveRecord::Relation<MetasploitDataModels::ModuleRun>]
230
+ # @see services
231
+ has_many :module_runs,
232
+ class_name: 'MetasploitDataModels::ModuleRun',
233
+ as: :trackable
234
+
235
+
226
236
  #
227
237
  # through: :task_hosts
228
238
  #
@@ -235,49 +245,49 @@ class Mdm::Host < ActiveRecord::Base
235
245
  class_name: 'Mdm::Task',
236
246
  through: :task_hosts
237
247
 
238
- #
239
- # Through vulns
240
- #
248
+ #
249
+ # Through vulns
250
+ #
241
251
 
242
252
  # @!attribute [r] vuln_refs
243
253
  # Join model between {#vulns} and {#refs}. Use either of those asssociations instead of this join model.
244
254
  #
245
255
  # @todo https://www.pivotaltracker.com/story/show/49004623
246
- # @return [Array<Mdm::VulnRef>]
256
+ # @return [ActiveRecord::Relation<Mdm::VulnRef>]
247
257
  # @see #refs
248
258
  # @see #vulns
249
- has_many :vuln_refs, :class_name => 'Mdm::VulnRef', :source => :vulns_refs, :through => :vulns
259
+ has_many :vuln_refs, :class_name => 'Mdm::VulnRef', :source => :vulns_refs, :through => :vulns
250
260
 
251
- #
252
- # Through vuln_refs
253
- #
261
+ #
262
+ # Through vuln_refs
263
+ #
254
264
 
255
265
  # @!attribute [r] refs
256
266
  # External references, such as CVE, to vulnerabilities found on this host.
257
267
  #
258
- # @return [Array<Mdm::Ref>]
268
+ # @return [ActiveRecord::Relation<Mdm::Ref>]
259
269
  # @see #vuln_refs
260
- has_many :refs, :class_name => 'Mdm::Ref', :through => :vuln_refs
270
+ has_many :refs, :class_name => 'Mdm::Ref', :through => :vuln_refs
261
271
 
262
- #
263
- # Through refs
264
- #
272
+ #
273
+ # Through refs
274
+ #
265
275
 
266
276
  # @!attribute [r] module_refs
267
277
  # {Mdm::Module::Ref References for modules} for {Mdm::Ref references for vulnerabilities}.
268
278
  #
269
- # @return [Array<Mdm::Module::Ref>]
270
- has_many :module_refs, :class_name => 'Mdm::Module::Ref', :through => :refs
279
+ # @return [ActiveRecord::Relation<Mdm::Module::Ref>]
280
+ has_many :module_refs, :class_name => 'Mdm::Module::Ref', :through => :refs
271
281
 
272
- #
273
- # Through module_refs
274
- #
282
+ #
283
+ # Through module_refs
284
+ #
275
285
 
276
286
  # @!attribute [r] module_details
277
287
  # {Mdm::Module::Detail Details about modules} that were used to find {#vulns vulnerabilities} on this host.
278
288
  #
279
- # @return [Array<Mdm::Module::Detail]
280
- has_many :module_details,
289
+ # @return [ActiveRecord::Relation<Mdm::Module::Detail]
290
+ has_many :module_details,
281
291
  :class_name => 'Mdm::Module::Detail',
282
292
  :source =>:detail,
283
293
  :through => :module_refs,
@@ -571,4 +581,3 @@ class Mdm::Host < ActiveRecord::Base
571
581
 
572
582
  Metasploit::Concern.run(self)
573
583
  end
574
-
@@ -32,6 +32,15 @@ class Mdm::Loot < ActiveRecord::Base
32
32
  class_name: 'Mdm::Host',
33
33
  inverse_of: :loots
34
34
 
35
+ # @!attribute [rw] module_run
36
+ # The run of Metasploit content that acquired the loot
37
+ #
38
+ # @return [MetasploitDataModels::ModuleRun]
39
+ belongs_to :module_run,
40
+ class_name: 'MetasploitDataModels::ModuleRun',
41
+ foreign_key: :module_run_id,
42
+ inverse_of: :loots
43
+
35
44
  # @!attribute [rw] service
36
45
  # The service running on the {#host} from which the loot was gathered.
37
46
  #
@@ -49,44 +49,65 @@ class Mdm::Module::Detail < ActiveRecord::Base
49
49
  # @!attribute [rw] actions
50
50
  # Auxiliary actions to perform when this running this module.
51
51
  #
52
- # @return [Array<Mdm::Module::Action>]
52
+ # @return [ActiveRecord::Relation<Mdm::Module::Action>]
53
53
  has_many :actions, :class_name => 'Mdm::Module::Action', :dependent => :destroy
54
54
 
55
55
  # @!attribute [rw] archs
56
56
  # Architectures supported by this module.
57
57
  #
58
- # @return [Array<Mdm::Module::Arch>]
58
+ # @return [ActiveRecord::Relation<Mdm::Module::Arch>]
59
59
  has_many :archs, :class_name => 'Mdm::Module::Arch', :dependent => :destroy
60
60
 
61
61
  # @!attribute [rw] authors
62
62
  # Authors (and their emails) of this module. Usually includes the original discoverer who wrote the
63
63
  # proof-of-concept and then the people that ported the proof-of-concept to metasploit-framework.
64
64
  #
65
- # @return [Array<Mdm::Module::Mixin>]
65
+ # @return [ActiveRecord::Relation<Mdm::Module::Mixin>]
66
66
  has_many :authors, :class_name => 'Mdm::Module::Author', :dependent => :destroy
67
67
 
68
+ # @!attribute [rw] matches
69
+ # Matches for this module
70
+ #
71
+ # @return [ActiveRecord::Relation<MetasploitDataModels::AutomaticExploitation::Match>]
72
+ has_many :matches,
73
+ :class_name => 'MetasploitDataModels::AutomaticExploitation::Match',
74
+ :dependent => :destroy,
75
+ :primary_key => :fullname,
76
+ :foreign_key => :module_fullname,
77
+ :inverse_of => :module_detail
78
+
68
79
  # @!attribute [rw] mixins
69
80
  # Mixins used by this module.
70
81
  #
71
- # @return [Array<Mdm::Module::Mixin>]
82
+ # @return [ActiveRecord::Relation<Mdm::Module::Mixin>]
72
83
  has_many :mixins, :class_name => 'Mdm::Module::Mixin', :dependent => :destroy
73
84
 
85
+ # @!attribute [rw] module_runs
86
+ # Records of times when this module has been used
87
+ #
88
+ # @return [ActiveRecord::Relation<MetasploitDataModels::ModuleRun>]
89
+ has_many :module_runs,
90
+ :class_name => 'MetasploitDataModels::ModuleRun',
91
+ :primary_key => :fullname,
92
+ :foreign_key => :module_fullname,
93
+ :inverse_of => :module_detail
94
+
74
95
  # @!attribute [rw] platforms
75
96
  # Platforms supported by this module.
76
97
  #
77
- # @return [Array<Mdm::Module::Platform>]
98
+ # @return [ActiveRecord::Relation<Mdm::Module::Platform>]
78
99
  has_many :platforms, :class_name => 'Mdm::Module::Platform', :dependent => :destroy
79
100
 
80
101
  # @!attribute [rw] refs
81
102
  # External references to the vulnerabilities this module exploits.
82
103
  #
83
- # @return [Array<Mdm::Module::Ref>]
104
+ # @return [ActiveRecord::Relation<Mdm::Module::Ref>]
84
105
  has_many :refs, :class_name => 'Mdm::Module::Ref', :dependent => :destroy
85
106
 
86
107
  # @!attribute [rw] targets
87
108
  # Names of targets with different configurations that can be exploited by this module.
88
109
  #
89
- # @return [Array<Mdm::Module::Target>]
110
+ # @return [ActiveRecord::Relation<Mdm::Module::Target>]
90
111
  has_many :targets, :class_name => 'Mdm::Module::Target', :dependent => :destroy
91
112
 
92
113
  #
@@ -16,10 +16,10 @@ class Mdm::Module::Ref < ActiveRecord::Base
16
16
  # References with the same name attached to {Mdm::Vuln Mdm::Vulns}.
17
17
  #
18
18
  # @return [Array<Mdm::Ref>]
19
- has_many :refs,
20
- :class_name => 'Mdm::Ref',
21
- :foreign_key => :name,
22
- :primary_key => :name
19
+ has_many :refs,
20
+ :class_name => 'Mdm::Ref',
21
+ :foreign_key => :name,
22
+ :primary_key => :name
23
23
 
24
24
  #
25
25
  # Attributes
@@ -10,15 +10,15 @@ class Mdm::Ref < ActiveRecord::Base
10
10
  # {Mdm::Module::Ref Mdm::Module::Refs} with the same name as this ref.
11
11
  #
12
12
  # @return [Array<Mdm::Module::Ref>]
13
- has_many :module_refs,
14
- :class_name => 'Mdm::Module::Ref',
15
- :foreign_key => :name,
16
- :primary_key => :name
13
+ has_many :module_refs,
14
+ :class_name => 'Mdm::Module::Ref',
15
+ :foreign_key => :name,
16
+ :primary_key => :name
17
17
 
18
18
  # @!attribute [rw] vulns_refs
19
19
  # Join model to {Mdm::Vuln Mdm::Vulns}. Use {#vulns} to get the actual {Mdm::Vuln Mdm::Vulns}.
20
20
  #
21
- # @todo MSP-3066
21
+ # @todo MSP-3066
22
22
  # @return [Array<Mdm::VulnRef>]
23
23
  has_many :vulns_refs,
24
24
  :class_name => 'Mdm::VulnRef',
@@ -34,12 +34,29 @@ class Mdm::Session < ActiveRecord::Base
34
34
  # @!attribute [rw] routes
35
35
  # Routes tunneled throug this session.
36
36
  #
37
- # @return [Array<Mdm::Route>]
37
+ # @return [ActiveRecord::Relation<Mdm::Route>]
38
38
  has_many :routes,
39
39
  class_name: 'Mdm::Route',
40
40
  dependent: :delete_all,
41
41
  inverse_of: :session
42
42
 
43
+ # @!attribute [rw] originating_module_run
44
+ # Records the Metasploit modules run that created this session
45
+ #
46
+ # @return [MetasploitDataModels::ModuleRun]
47
+ belongs_to :originating_module_run,
48
+ class_name: 'MetasploitDataModels::ModuleRun',
49
+ foreign_key: :module_run_id,
50
+ inverse_of: :spawned_session
51
+
52
+ # @!attribute [rw] target_module_runs
53
+ # Records the Metasploit modules run on this session
54
+ #
55
+ # @return [ActiveRecord::Relation<MetasploitDataModels::ModuleRun>]
56
+ has_many :target_module_runs,
57
+ class_name: 'MetasploitDataModels::ModuleRun',
58
+ inverse_of: :target_session
59
+
43
60
  # @!attribute vuln_attempt
44
61
  # Vulnerability attempt that created this session.
45
62
  #
@@ -5,15 +5,28 @@ class Mdm::User < ActiveRecord::Base
5
5
  # Relations
6
6
  #
7
7
 
8
+ has_many :automatic_exploitation_runs,
9
+ class_name: 'MetasploitDataModels::AutomaticExploitation::Run',
10
+ inverse_of: :user
11
+
12
+ has_many :automatic_exploitation_match_sets,
13
+ class_name: 'MetasploitDataModels::AutomaticExploitation::MatchSet',
14
+ inverse_of: :user
15
+
8
16
  has_many :owned_workspaces,
9
17
  class_name: 'Mdm::Workspace',
10
18
  foreign_key: 'owner_id',
11
19
  inverse_of: :owner
12
20
 
21
+ has_many :module_runs,
22
+ class_name: 'MetasploitDataModels::ModuleRun',
23
+ inverse_of: :user
24
+
13
25
  has_many :tags,
14
26
  class_name: 'Mdm::Tag',
15
27
  inverse_of: :user
16
28
 
29
+
17
30
  has_and_belongs_to_many :workspaces, :join_table => 'workspace_members', :uniq => true, :class_name => 'Mdm::Workspace'
18
31
 
19
32
  #
@@ -32,7 +32,7 @@ class Mdm::Vuln < ActiveRecord::Base
32
32
  # @!attribute [rw] vuln_attempts
33
33
  # Attempts to exploit this vulnerability.
34
34
  #
35
- # @return [Array<Mdm::VulnAttempt>]
35
+ # @return [ActiveRecord::Relation<Mdm::VulnAttempt>]
36
36
  has_many :vuln_attempts,
37
37
  class_name: 'Mdm::VulnAttempt',
38
38
  dependent: :destroy,
@@ -41,7 +41,7 @@ class Mdm::Vuln < ActiveRecord::Base
41
41
  # @!attribute [rw] vuln_details
42
42
  # Additional information about this vulnerability.
43
43
  #
44
- # @return [Array<Mdm::VulnDetail>]
44
+ # @return [ActiveRecord::Relation<Mdm::VulnDetail>]
45
45
  has_many :vuln_details,
46
46
  class_name: 'Mdm::VulnDetail',
47
47
  dependent: :destroy,
@@ -50,7 +50,7 @@ class Mdm::Vuln < ActiveRecord::Base
50
50
  # @!attribute [rw] vulns_refs
51
51
  # Join model that joins this vuln to its {Mdm::Ref external references}.
52
52
  #
53
- # @return [Array<Mdm::VulnRef>]
53
+ # @return [ActiveRecord::Relation<Mdm::VulnRef>]
54
54
  has_many :vulns_refs,
55
55
  class_name: 'Mdm::VulnRef',
56
56
  dependent: :destroy,
@@ -59,7 +59,7 @@ class Mdm::Vuln < ActiveRecord::Base
59
59
  # @!attribute [rw] notes
60
60
  # Notes about the vuln entered by a user with {Mdm::Note#created_at oldest notes} first.
61
61
  #
62
- # @return [Array<Mdm::Note>]
62
+ # @return [<ActiveRecord::RelationMdm::Note>]
63
63
  has_many :notes,
64
64
  class_name: 'Mdm::Note',
65
65
  inverse_of: :vuln,
@@ -73,7 +73,7 @@ class Mdm::Vuln < ActiveRecord::Base
73
73
  # @!attribute [r] refs
74
74
  # External references to this vulnerability.
75
75
  #
76
- # @return [Array<Mdm::Ref>]
76
+ # @return [ActiveRecord::Relation<Mdm::Ref>]
77
77
  has_many :refs, :class_name => 'Mdm::Ref', :through => :vulns_refs
78
78
 
79
79
  #
@@ -83,9 +83,18 @@ class Mdm::Vuln < ActiveRecord::Base
83
83
  # @!attribute [r] module_refs
84
84
  # References in module that match {Mdm::Ref#name names} in {#refs}.
85
85
  #
86
- # @return [Array<Mdm::Module::Ref>]
86
+ # @return [ActiveRecord::Relation<Mdm::Module::Ref>]
87
87
  has_many :module_refs, :class_name => 'Mdm::Module::Ref', :through => :refs
88
88
 
89
+
90
+ # @!attribute [r] module_runs
91
+ # References to times that a module has been run to exercise this vuln
92
+ #
93
+ # @return [ActiveRecord::Relation<MetasploitDataModels::ModuleRun>]
94
+ has_many :module_runs,
95
+ class_name: 'MetasploitDataModels::ModuleRun',
96
+ as: :trackable
97
+
89
98
  #
90
99
  # Through module_refs
91
100
  #
@@ -93,7 +102,7 @@ class Mdm::Vuln < ActiveRecord::Base
93
102
  # @!attribute [r] module_details
94
103
  # {Mdm::Module::Detail Modules} that share the same external references as this vuln.
95
104
  #
96
- # @return [Array<Mdm::Module::Detail>]
105
+ # @return [ActiveRecord::Relation<Mdm::Module::Detail>]
97
106
  has_many :module_details,
98
107
  :class_name => 'Mdm::Module::Detail',
99
108
  :source => :detail,