metasploit_data_models 5.0.0 → 5.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/.github/workflows/verify.yml +7 -11
  4. data/Gemfile +1 -1
  5. data/Rakefile +1 -1
  6. data/app/models/mdm/event.rb +2 -0
  7. data/app/models/mdm/exploit_attempt.rb +4 -0
  8. data/app/models/mdm/listener.rb +1 -0
  9. data/app/models/mdm/loot.rb +2 -0
  10. data/app/models/mdm/note.rb +3 -0
  11. data/app/models/mdm/session.rb +1 -0
  12. data/app/models/mdm/tag.rb +1 -0
  13. data/app/models/mdm/vuln.rb +3 -0
  14. data/app/models/mdm/vuln_attempt.rb +2 -0
  15. data/app/models/mdm/vuln_detail.rb +1 -0
  16. data/app/models/mdm/workspace.rb +1 -1
  17. data/app/models/metasploit_data_models/automatic_exploitation/match.rb +1 -0
  18. data/app/models/metasploit_data_models/module_run.rb +2 -0
  19. data/db/migrate/20140905031549_add_detected_arch_to_host.rb +1 -1
  20. data/lib/metasploit_data_models/version.rb +1 -1
  21. data/spec/app/models/mdm/event_spec.rb +2 -2
  22. data/spec/app/models/mdm/listener_spec.rb +1 -1
  23. data/spec/app/models/mdm/loot_spec.rb +2 -2
  24. data/spec/app/models/mdm/note_spec.rb +3 -3
  25. data/spec/app/models/mdm/session_spec.rb +1 -1
  26. data/spec/app/models/mdm/tag_spec.rb +1 -1
  27. data/spec/app/models/mdm/vuln_spec.rb +3 -3
  28. data/spec/app/models/mdm/workspace_spec.rb +3 -3
  29. data/spec/app/models/metasploit_data_models/module_run_spec.rb +8 -8
  30. data/spec/app/models/metasploit_data_models/search/operation/range_spec.rb +2 -2
  31. data/spec/dummy/config/application.rb +3 -0
  32. data/spec/factories/mdm/sessions.rb +1 -0
  33. data/spec/factories/mdm/tags.rb +1 -0
  34. data/spec/factories/mdm/vuln_refs.rb +2 -0
  35. data/spec/factories/metasploit_data_models/automatic_exploitation/runs.rb +1 -0
  36. data/spec/factories/module_runs.rb +2 -2
  37. data.tar.gz.sig +0 -0
  38. metadata +2 -2
  39. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a15267e2f6c71ba5b58fdfea90153b170f940e65b01b85d3612bcdf1694c298f
4
- data.tar.gz: fb5e035e7e80f3dea304ed1ca8cacc463117300357c9386d341196e968003d8b
3
+ metadata.gz: 0c7a225ec93818d7ef28af89693e9f537cf13b5ad35707e803208697b81bc053
4
+ data.tar.gz: '038675160b56a384a60d894e5cd1337732ba0d0796c03a2e8d4f60fa09764635'
5
5
  SHA512:
6
- metadata.gz: 2670839b6eace925d4da176c76da44cfbb54e774a50755a7095ef3de8220a81c146a442d258eee7e6e91abad2fae76ab82e49e7998fef749ea95173a2871a98c
7
- data.tar.gz: e6a013485f5b639a31d1232743c847787853bb61fab191a2e619dbfe1d5853b8c4fe7bc905847a3a38910da59accd4b1488fe47eb81f10e96f98da3e38a14ba9
6
+ metadata.gz: caf065b47435a2f3807e013b1098ef614bbd2a82e560c3b6def52b19d8f102c8fd5faa0ea3bf9a549694674e968ea72b99ad656ea877fa3ffce5dac724cc1719
7
+ data.tar.gz: ea11b23c49c9e3b4597416ce4344f7cfdb72574473ec4eacc1cd4de91b46bd027d32d3d689f0d14d9de4e6efb8f7c9de6ca10f52ad1d94adb9c5bafb055eef88
checksums.yaml.gz.sig CHANGED
Binary file
@@ -10,7 +10,7 @@ on:
10
10
 
11
11
  jobs:
12
12
  test:
13
- runs-on: ubuntu-16.04
13
+ runs-on: ubuntu-18.04
14
14
  timeout-minutes: 40
15
15
 
16
16
  services:
@@ -30,7 +30,10 @@ jobs:
30
30
  fail-fast: true
31
31
  matrix:
32
32
  ruby:
33
+ - 2.5
34
+ - 2.6
33
35
  - 2.7
36
+ - 3.0
34
37
 
35
38
  env:
36
39
  RAILS_ENV: test
@@ -43,18 +46,11 @@ jobs:
43
46
  - name: Checkout code
44
47
  uses: actions/checkout@v2
45
48
 
46
- - uses: actions/setup-ruby@v1
49
+ - name: Setup Ruby
50
+ uses: ruby/setup-ruby@v1
47
51
  with:
48
52
  ruby-version: ${{ matrix.ruby }}
49
-
50
- - name: Setup bundler
51
- run: |
52
- gem install bundler
53
-
54
- - name: Bundle install
55
- run: |
56
- bundle config path vendor/bundle
57
- bundle install --jobs 4 --retry 3
53
+ bundler-cache: true
58
54
 
59
55
  - name: Test
60
56
  run: |
data/Gemfile CHANGED
@@ -20,7 +20,7 @@ group :development, :test do
20
20
  # auto-load factories from spec/factories
21
21
  gem 'factory_bot_rails'
22
22
 
23
- gem 'rails'
23
+ gem 'rails', '~> 6.0'
24
24
  # Used to create fake data
25
25
  gem "faker"
26
26
 
data/Rakefile CHANGED
@@ -66,7 +66,7 @@ else
66
66
  end
67
67
 
68
68
  if print_without
69
- puts "Bundle currently installed '--without #{Bundler.settings.without.join(' ')}'."
69
+ puts "Bundle currently installed '--without #{Bundler.settings[:without].join(' ')}'."
70
70
  puts "To clear the without option do `bundle install --without ''` (the --without flag with an empty string) or " \
71
71
  "`rm -rf .bundle` to remove the .bundle/config manually and then `bundle install`"
72
72
  end
@@ -11,12 +11,14 @@ class Mdm::Event < ApplicationRecord
11
11
  # @return [nil] if event did not occur on a host.
12
12
  belongs_to :host,
13
13
  class_name: 'Mdm::Host',
14
+ optional: true,
14
15
  inverse_of: :events
15
16
 
16
17
  # {Mdm::Workspace} in which this event occured. If {#host} is present, then this will match
17
18
  # {Mdm::Host#workspace `host.workspace`}.
18
19
  belongs_to :workspace,
19
20
  class_name: 'Mdm::Workspace',
21
+ optional: true,
20
22
  inverse_of: :events
21
23
 
22
24
  #
@@ -18,6 +18,7 @@ class Mdm::ExploitAttempt < ApplicationRecord
18
18
  # @return [Mdm::Loot, nil]
19
19
  belongs_to :loot,
20
20
  class_name: 'Mdm::Loot',
21
+ optional: true,
21
22
  inverse_of: :exploit_attempt
22
23
 
23
24
  # The service being exploited on {#host}.
@@ -25,6 +26,7 @@ class Mdm::ExploitAttempt < ApplicationRecord
25
26
  # @return [Mdm::Service, nil]
26
27
  belongs_to :service,
27
28
  class_name: 'Mdm::Service',
29
+ optional: true,
28
30
  inverse_of: :exploit_attempts
29
31
 
30
32
  # The session that was established when this attempt was successful.
@@ -33,6 +35,7 @@ class Mdm::ExploitAttempt < ApplicationRecord
33
35
  # @return [nil] if session was not established.
34
36
  belongs_to :session,
35
37
  class_name: 'Mdm::Session',
38
+ optional: true,
36
39
  inverse_of: :exploit_attempt
37
40
 
38
41
  # The vulnerability that was attempted to be exploited.
@@ -40,6 +43,7 @@ class Mdm::ExploitAttempt < ApplicationRecord
40
43
  # @return [Mdm::Vuln, nil]
41
44
  belongs_to :vuln,
42
45
  class_name: 'Mdm::Vuln',
46
+ optional: true,
43
47
  inverse_of: :exploit_attempts
44
48
 
45
49
  #
@@ -8,6 +8,7 @@ class Mdm::Listener < ApplicationRecord
8
8
  # Task that spawned this listener.
9
9
  belongs_to :task,
10
10
  class_name: 'Mdm::Task',
11
+ optional: true,
11
12
  inverse_of: :listeners
12
13
 
13
14
  # Workspace which controls this listener.
@@ -40,6 +40,7 @@ class Mdm::Loot < ApplicationRecord
40
40
  belongs_to :module_run,
41
41
  class_name: 'MetasploitDataModels::ModuleRun',
42
42
  foreign_key: :module_run_id,
43
+ optional: true, # allow for manually stored loot?
43
44
  inverse_of: :loots
44
45
 
45
46
  # @!attribute [rw] service
@@ -48,6 +49,7 @@ class Mdm::Loot < ApplicationRecord
48
49
  # @return [Mdm::Service]
49
50
  belongs_to :service,
50
51
  class_name: 'Mdm::Service',
52
+ optional: true,
51
53
  inverse_of: :loots
52
54
 
53
55
  # @!attribute vuln_attempt
@@ -13,6 +13,7 @@ class Mdm::Note < ApplicationRecord
13
13
  belongs_to :host,
14
14
  class_name: 'Mdm::Host',
15
15
  counter_cache: :note_count,
16
+ optional: true,
16
17
  inverse_of: :notes
17
18
 
18
19
  # @!attribute [rw] service
@@ -22,6 +23,7 @@ class Mdm::Note < ApplicationRecord
22
23
  # @return [nil] if not is attached to an {Mdm::Host}.
23
24
  belongs_to :service,
24
25
  class_name: 'Mdm::Service',
26
+ optional: true,
25
27
  inverse_of: :notes
26
28
 
27
29
  # @!attribute [rw] vuln
@@ -31,6 +33,7 @@ class Mdm::Note < ApplicationRecord
31
33
  # @return [nil] if not is attached to an {Mdm::Host}.
32
34
  belongs_to :vuln,
33
35
  class_name: 'Mdm::Vuln',
36
+ optional: true,
34
37
  inverse_of: :notes
35
38
 
36
39
  # @!attribute [rw] workspace
@@ -47,6 +47,7 @@ class Mdm::Session < ApplicationRecord
47
47
  # @return [MetasploitDataModels::ModuleRun]
48
48
  belongs_to :originating_module_run,
49
49
  class_name: 'MetasploitDataModels::ModuleRun',
50
+ optional: true, # no code currently generates a module_run
50
51
  foreign_key: :module_run_id,
51
52
  inverse_of: :spawned_session
52
53
 
@@ -15,6 +15,7 @@ class Mdm::Tag < ApplicationRecord
15
15
  # User that created this tag.
16
16
  belongs_to :user,
17
17
  class_name: 'Mdm::User',
18
+ optional: true, # no tags have ever actually had user set.
18
19
  inverse_of: :tags
19
20
 
20
21
  #
@@ -20,6 +20,7 @@ class Mdm::Vuln < ApplicationRecord
20
20
  belongs_to :host,
21
21
  class_name: 'Mdm::Host',
22
22
  counter_cache: :vuln_count,
23
+ optional: true,
23
24
  inverse_of: :vulns
24
25
 
25
26
  # @!attribute [rw] matches
@@ -36,6 +37,7 @@ class Mdm::Vuln < ApplicationRecord
36
37
  # @return [Mdm::Service]
37
38
  belongs_to :service,
38
39
  class_name: 'Mdm::Service',
40
+ optional: true,
39
41
  inverse_of: :vulns
40
42
 
41
43
  # @!attribute [rw] origin
@@ -44,6 +46,7 @@ class Mdm::Vuln < ApplicationRecord
44
46
  #
45
47
  # @return [ActiveRecord::Relation<origin>]
46
48
  belongs_to :origin,
49
+ optional: true,
47
50
  polymorphic: true
48
51
 
49
52
  # @!attribute [rw] vuln_attempts
@@ -11,6 +11,7 @@ class Mdm::VulnAttempt < ApplicationRecord
11
11
  # @return [nil] if {#exploited} is `false`.
12
12
  belongs_to :loot,
13
13
  class_name: 'Mdm::Loot',
14
+ optional: true,
14
15
  inverse_of: :vuln_attempt
15
16
 
16
17
  # The session opened by this attempt.
@@ -19,6 +20,7 @@ class Mdm::VulnAttempt < ApplicationRecord
19
20
  # @return [nil] if {#exploited} is `false`.
20
21
  belongs_to :session,
21
22
  class_name: 'Mdm::Session',
23
+ optional: true,
22
24
  inverse_of: :vuln_attempt
23
25
 
24
26
  # The {Mdm::Vuln vulnerability} that this attempt was exploiting.
@@ -67,6 +67,7 @@ class Mdm::VulnDetail < ApplicationRecord
67
67
  belongs_to :nexpose_console,
68
68
  class_name: 'Mdm::NexposeConsole',
69
69
  foreign_key: :nx_console_id,
70
+ optional: true,
70
71
  inverse_of: :vuln_details
71
72
 
72
73
  # @!attribute nx_added
@@ -36,7 +36,7 @@ class Mdm::Workspace < ApplicationRecord
36
36
 
37
37
  # User that owns this workspace and has full permissions within this workspace even if they are not an
38
38
  # {Mdm::User#admin administrator}.
39
- belongs_to :owner, :class_name => 'Mdm::User', :foreign_key => 'owner_id'
39
+ belongs_to :owner, :class_name => 'Mdm::User', :foreign_key => 'owner_id', optional: true
40
40
 
41
41
  # Tasks run inside this workspace.
42
42
  has_many :tasks,
@@ -17,6 +17,7 @@ class MetasploitDataModels::AutomaticExploitation::Match < ApplicationRecord
17
17
  # The {MatchSet} this match is part of
18
18
  belongs_to :match_set,
19
19
  class_name: 'MetasploitDataModels::AutomaticExploitation::MatchSet',
20
+ optional: true,
20
21
  inverse_of: :matches
21
22
 
22
23
  # The Metasploit Module that this match connects to
@@ -109,6 +109,7 @@ class MetasploitDataModels::ModuleRun < ApplicationRecord
109
109
  belongs_to :target_session,
110
110
  class_name: 'Mdm::Session',
111
111
  foreign_key: :session_id,
112
+ optional: true,
112
113
  inverse_of: :target_module_runs
113
114
 
114
115
 
@@ -130,6 +131,7 @@ class MetasploitDataModels::ModuleRun < ApplicationRecord
130
131
  belongs_to :user,
131
132
  class_name: 'Mdm::User',
132
133
  foreign_key: 'user_id',
134
+ optional: true,
133
135
  inverse_of: :module_runs
134
136
 
135
137
 
@@ -1,5 +1,5 @@
1
1
  class AddDetectedArchToHost < ActiveRecord::Migration[4.2]
2
2
  def change
3
- add_column :hosts, :detected_arch, :string, { :null => true }
3
+ add_column :hosts, :detected_arch, :string, :null => true
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  module MetasploitDataModels
2
2
  # VERSION is managed by GemRelease
3
- VERSION = '5.0.0'
3
+ VERSION = '5.0.4'
4
4
 
5
5
  # @return [String]
6
6
  #
@@ -2,8 +2,8 @@ RSpec.describe Mdm::Event, type: :model do
2
2
  it_should_behave_like 'Metasploit::Concern.run'
3
3
 
4
4
  context 'associations' do
5
- it { is_expected.to belong_to(:host).class_name('Mdm::Host') }
6
- it { is_expected.to belong_to(:workspace).class_name('Mdm::Workspace') }
5
+ it { is_expected.to belong_to(:host).optional.class_name('Mdm::Host') }
6
+ it { is_expected.to belong_to(:workspace).optional.class_name('Mdm::Workspace') }
7
7
  end
8
8
 
9
9
  context 'database' do
@@ -3,7 +3,7 @@ RSpec.describe Mdm::Listener, type: :model do
3
3
 
4
4
  context 'associations' do
5
5
  it { is_expected.to belong_to(:workspace).class_name('Mdm::Workspace') }
6
- it { is_expected.to belong_to(:task).class_name('Mdm::Task') }
6
+ it { is_expected.to belong_to(:task).optional.class_name('Mdm::Task') }
7
7
  end
8
8
 
9
9
  context 'database' do
@@ -3,9 +3,9 @@ RSpec.describe Mdm::Loot, type: :model do
3
3
 
4
4
  context 'associations' do
5
5
  it { is_expected.to belong_to(:workspace).class_name('Mdm::Workspace') }
6
- it { is_expected.to belong_to(:service).class_name('Mdm::Service') }
6
+ it { is_expected.to belong_to(:service).optional.class_name('Mdm::Service') }
7
7
  it { is_expected.to belong_to(:host).class_name('Mdm::Host') }
8
- it { is_expected.to belong_to(:module_run).class_name('MetasploitDataModels::ModuleRun') }
8
+ it { is_expected.to belong_to(:module_run).optional.class_name('MetasploitDataModels::ModuleRun') }
9
9
  end
10
10
 
11
11
  context 'database' do
@@ -41,9 +41,9 @@ RSpec.describe Mdm::Note, type: :model do
41
41
 
42
42
  context 'associations' do
43
43
  it { is_expected.to belong_to(:workspace).class_name('Mdm::Workspace') }
44
- it { is_expected.to belong_to(:host).class_name('Mdm::Host') }
45
- it { is_expected.to belong_to(:service).class_name('Mdm::Service') }
46
- it { is_expected.to belong_to(:vuln).class_name('Mdm::Vuln') }
44
+ it { is_expected.to belong_to(:host).optional.class_name('Mdm::Host') }
45
+ it { is_expected.to belong_to(:service).optional.class_name('Mdm::Service') }
46
+ it { is_expected.to belong_to(:vuln).optional.class_name('Mdm::Vuln') }
47
47
  end
48
48
 
49
49
  context 'scopes' do
@@ -45,7 +45,7 @@ RSpec.describe Mdm::Session, type: :model do
45
45
  context 'associations' do
46
46
  it { is_expected.to have_many(:events).class_name('Mdm::SessionEvent').dependent(:delete_all) }
47
47
  it { is_expected.to belong_to(:host).class_name('Mdm::Host') }
48
- it { is_expected.to belong_to(:originating_module_run).class_name('MetasploitDataModels::ModuleRun') }
48
+ it { is_expected.to belong_to(:originating_module_run).optional.class_name('MetasploitDataModels::ModuleRun') }
49
49
  it { is_expected.to have_many(:routes).class_name('Mdm::Route').dependent(:delete_all) }
50
50
  it { is_expected.to have_many(:target_module_runs).class_name('MetasploitDataModels::ModuleRun') }
51
51
  it { is_expected.to have_many(:tasks).class_name('Mdm::Task').through(:task_sessions)}
@@ -6,7 +6,7 @@ RSpec.describe Mdm::Tag, type: :model do
6
6
  context 'associations' do
7
7
  it { is_expected.to have_many(:hosts_tags).class_name('Mdm::HostTag') }
8
8
  it { is_expected.to have_many(:hosts).class_name('Mdm::Host').through(:hosts_tags) }
9
- it { is_expected.to belong_to(:user).class_name('Mdm::User') }
9
+ it { is_expected.to belong_to(:user).optional.class_name('Mdm::User') }
10
10
  end
11
11
 
12
12
  context 'database' do
@@ -31,9 +31,9 @@ RSpec.describe Mdm::Vuln, type: :model do
31
31
 
32
32
 
33
33
  context 'associations' do
34
- it { is_expected.to belong_to(:host).class_name('Mdm::Host') }
35
- it { is_expected.to belong_to(:origin) }
36
- it { is_expected.to belong_to(:service).class_name('Mdm::Service') }
34
+ it { is_expected.to belong_to(:host).optional.class_name('Mdm::Host') }
35
+ it { is_expected.to belong_to(:origin).optional }
36
+ it { is_expected.to belong_to(:service).optional.class_name('Mdm::Service') }
37
37
  it { is_expected.to have_many(:module_refs).class_name('Mdm::Module::Ref').through(:refs) }
38
38
  it { is_expected.to have_many(:module_runs).class_name('MetasploitDataModels::ModuleRun') }
39
39
  it { is_expected.to have_many(:refs).class_name('Mdm::Ref').through(:vulns_refs) }
@@ -46,7 +46,7 @@ RSpec.describe Mdm::Workspace, type: :model do
46
46
  it { is_expected.to have_many(:listeners).class_name('Mdm::Listener').dependent(:destroy) }
47
47
  it { is_expected.to have_many(:loots).class_name('Mdm::Loot').through(:hosts) }
48
48
  it { is_expected.to have_many(:notes).class_name('Mdm::Note') }
49
- it { is_expected.to belong_to(:owner).class_name('Mdm::User').with_foreign_key('owner_id') }
49
+ it { is_expected.to belong_to(:owner).optional.class_name('Mdm::User').with_foreign_key('owner_id') }
50
50
  it { is_expected.to have_many(:services).class_name('Mdm::Service').through(:hosts).with_foreign_key('service_id') }
51
51
  it { is_expected.to have_many(:sessions).class_name('Mdm::Session').through(:hosts) }
52
52
  it { is_expected.to have_many(:tasks).class_name('Mdm::Task').dependent(:destroy).order('created_at DESC') }
@@ -185,7 +185,7 @@ RSpec.describe Mdm::Workspace, type: :model do
185
185
  before(:example) do
186
186
  FactoryBot.create(
187
187
  :mdm_workspace,
188
- :name => default
188
+ :name => Mdm::Workspace::DEFAULT
189
189
  )
190
190
  end
191
191
 
@@ -220,7 +220,7 @@ RSpec.describe Mdm::Workspace, type: :model do
220
220
 
221
221
  context 'with DEFAULT name' do
222
222
  before(:example) do
223
- workspace.name = default
223
+ workspace.name = Mdm::Workspace::DEFAULT
224
224
  end
225
225
 
226
226
  it { is_expected.to eq(true) }
@@ -18,10 +18,10 @@ RSpec.describe MetasploitDataModels::ModuleRun, type: :model do
18
18
  end
19
19
 
20
20
  context "associations" do
21
- it { is_expected.to belong_to(:user).class_name('Mdm::User') }
22
- it { is_expected.to belong_to(:user).inverse_of(:module_runs) }
23
- it { is_expected.to belong_to(:target_session).class_name('Mdm::Session') }
24
- it { is_expected.to belong_to(:target_session).inverse_of(:target_module_runs) }
21
+ it { is_expected.to belong_to(:user).optional.class_name('Mdm::User') }
22
+ it { is_expected.to belong_to(:user).optional.inverse_of(:module_runs) }
23
+ it { is_expected.to belong_to(:target_session).optional.class_name('Mdm::Session') }
24
+ it { is_expected.to belong_to(:target_session).optional.inverse_of(:target_module_runs) }
25
25
  it { is_expected.to belong_to(:trackable) }
26
26
  it { is_expected.to belong_to(:module_detail).class_name('Mdm::Module::Detail') }
27
27
  it { is_expected.to belong_to(:module_detail).inverse_of(:module_runs) }
@@ -40,7 +40,7 @@ RSpec.describe MetasploitDataModels::ModuleRun, type: :model do
40
40
  context "when the module is an exploit" do
41
41
  context "and that exploit IS NOT local" do
42
42
  before(:example) do
43
- module_run.module_fullname = 'exploit/windows/mah-crazy-exploit'
43
+ module_run.module_detail = FactoryBot.create(:mdm_module_detail, fullname: 'exploit/windows/mah-crazy-exploit')
44
44
  end
45
45
 
46
46
  it { is_expected.to_not be_valid }
@@ -48,7 +48,7 @@ RSpec.describe MetasploitDataModels::ModuleRun, type: :model do
48
48
 
49
49
  context "and that exploit IS local" do
50
50
  before(:example) do
51
- module_run.module_fullname = 'exploit/windows/local/mah-crazy-exploit'
51
+ module_run.module_detail = FactoryBot.create(:mdm_module_detail, fullname: 'exploit/windows/local/mah-crazy-exploit')
52
52
  end
53
53
 
54
54
  it { is_expected.to be_valid }
@@ -65,7 +65,7 @@ RSpec.describe MetasploitDataModels::ModuleRun, type: :model do
65
65
 
66
66
  context "and it IS NOT a login scanner" do
67
67
  before(:example) do
68
- module_run.module_fullname = 'post/multi/gather/steal-minecraft-maps'
68
+ module_run.module_detail = FactoryBot.create(:mdm_module_detail, fullname: 'post/multi/gather/steal-minecraft-maps')
69
69
  end
70
70
 
71
71
  it { is_expected.to_not be_valid }
@@ -73,7 +73,7 @@ RSpec.describe MetasploitDataModels::ModuleRun, type: :model do
73
73
 
74
74
  context "and it IS a login scanner" do
75
75
  before(:example) do
76
- module_run.module_fullname = 'auxiliary/scanner/ssh/ssh_login'
76
+ module_run.module_detail = FactoryBot.create(:mdm_module_detail, fullname: 'auxiliary/scanner/ssh/ssh_login')
77
77
  end
78
78
 
79
79
  it { is_expected.to be_valid }
@@ -39,7 +39,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::Range, type: :model do
39
39
 
40
40
  context '#ordered' do
41
41
  let(:error) {
42
- I18n.translate!('metasploit.model.errors.models.metasploit_data_models/search/operation/range.attributes.value.order', error_attributes)
42
+ I18n.translate!('metasploit.model.errors.models.metasploit_data_models/search/operation/range.attributes.value.order', **error_attributes)
43
43
  }
44
44
 
45
45
  context 'with Range' do
@@ -230,4 +230,4 @@ RSpec.describe MetasploitDataModels::Search::Operation::Range, type: :model do
230
230
  end
231
231
  end
232
232
  end
233
- end
233
+ end
@@ -51,6 +51,9 @@ module Dummy
51
51
  # like if you have constraints or database-specific column types
52
52
  config.active_record.schema_format = :sql
53
53
 
54
+ # 5.x change to belongs_to
55
+ config.active_record.belongs_to_required_by_default = true
56
+
54
57
  # Enable the asset pipeline
55
58
  config.assets.enabled = false
56
59
 
@@ -4,6 +4,7 @@ FactoryBot.define do
4
4
  # Associations
5
5
  #
6
6
  association :host, :factory => :mdm_host
7
+ association :originating_module_run, :factory => :metasploit_data_models_module_run
7
8
 
8
9
  #
9
10
  # Attributes
@@ -1,5 +1,6 @@
1
1
  FactoryBot.define do
2
2
  factory :mdm_tag, :class => Mdm::Tag do
3
+ association :user, factory: :mdm_user
3
4
  desc { generate :mdm_tag_desc }
4
5
  name { generate :mdm_tag_name }
5
6
  end
@@ -1,4 +1,6 @@
1
1
  FactoryBot.define do
2
2
  factory :mdm_vuln_ref, :class => Mdm::VulnRef do
3
+ association :ref, factory: :mdm_ref
4
+ association :vuln, factory: :mdm_vuln
3
5
  end
4
6
  end
@@ -2,5 +2,6 @@ FactoryBot.define do
2
2
  factory :automatic_exploitation_run, :class => MetasploitDataModels::AutomaticExploitation::Run do
3
3
  association :workspace, factory: :mdm_workspace
4
4
  association :user, factory: :mdm_user
5
+ association :match_set, factory: :automatic_exploitation_match_set
5
6
  end
6
7
  end
@@ -4,6 +4,8 @@ FactoryBot.define do
4
4
  factory :metasploit_data_models_module_run, class: MetasploitDataModels::ModuleRun do
5
5
 
6
6
  association :user, factory: :mdm_user
7
+ association :module_detail, factory: :mdm_module_detail
8
+ association :trackable, factory: :mdm_host
7
9
 
8
10
  trait :failed do
9
11
  status { MetasploitDataModels::ModuleRun::FAIL }
@@ -18,13 +20,11 @@ FactoryBot.define do
18
20
  end
19
21
 
20
22
  attempted_at { Time.now }
21
- session_id { 1 }
22
23
  port { generate :port }
23
24
  proto { "tcp" }
24
25
  fail_detail { generate :module_run_fail_detail }
25
26
  status { MetasploitDataModels::ModuleRun::SUCCEED }
26
27
  username { "joefoo" }
27
- module_fullname { generate :module_run_module_fullname }
28
28
  end
29
29
 
30
30
  sequence :module_run_module_fullname do |n|
data.tar.gz.sig CHANGED
Binary file
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: 5.0.0
4
+ version: 5.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Metasploit Hackers
@@ -93,7 +93,7 @@ cert_chain:
93
93
  EknWpNgVhohbot1lfVAMmIhdtOVaRVcQQixWPwprDj/ydB8ryDMDosIMcw+fkoXU
94
94
  9GJsSaSRRYQ9UUkVL27b64okU8D48m8=
95
95
  -----END CERTIFICATE-----
96
- date: 2021-04-29 00:00:00.000000000 Z
96
+ date: 2021-09-16 00:00:00.000000000 Z
97
97
  dependencies:
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: metasploit-yard
metadata.gz.sig CHANGED
Binary file