metasploit_data_models 2.0.17 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/.travis.yml +1 -1
  4. data/Gemfile +3 -8
  5. data/lib/mdm/host/operating_system_normalization.rb +2 -1
  6. data/lib/metasploit_data_models/engine.rb +7 -7
  7. data/lib/metasploit_data_models/version.rb +1 -1
  8. data/metasploit_data_models.gemspec +3 -1
  9. data/spec/app/models/mdm/client_spec.rb +3 -3
  10. data/spec/app/models/mdm/cred_spec.rb +34 -34
  11. data/spec/app/models/mdm/event_spec.rb +9 -9
  12. data/spec/app/models/mdm/exploit_attempt_spec.rb +5 -5
  13. data/spec/app/models/mdm/exploited_host_spec.rb +3 -3
  14. data/spec/app/models/mdm/host_detail_spec.rb +4 -4
  15. data/spec/app/models/mdm/host_spec.rb +47 -47
  16. data/spec/app/models/mdm/host_tag_spec.rb +5 -5
  17. data/spec/app/models/mdm/listener_spec.rb +12 -12
  18. data/spec/app/models/mdm/loot_spec.rb +8 -8
  19. data/spec/app/models/mdm/module/action_spec.rb +2 -2
  20. data/spec/app/models/mdm/module/arch_spec.rb +2 -2
  21. data/spec/app/models/mdm/module/author_spec.rb +3 -3
  22. data/spec/app/models/mdm/module/detail_spec.rb +71 -71
  23. data/spec/app/models/mdm/module/mixin_spec.rb +2 -2
  24. data/spec/app/models/mdm/module/platform_spec.rb +2 -2
  25. data/spec/app/models/mdm/module/ref_spec.rb +5 -5
  26. data/spec/app/models/mdm/module/target_spec.rb +2 -2
  27. data/spec/app/models/mdm/nexpose_console_spec.rb +15 -15
  28. data/spec/app/models/mdm/note_spec.rb +11 -11
  29. data/spec/app/models/mdm/ref_spec.rb +6 -6
  30. data/spec/app/models/mdm/route_spec.rb +3 -3
  31. data/spec/app/models/mdm/service_spec.rb +20 -20
  32. data/spec/app/models/mdm/session_event_spec.rb +3 -3
  33. data/spec/app/models/mdm/session_spec.rb +14 -14
  34. data/spec/app/models/mdm/tag_spec.rb +12 -12
  35. data/spec/app/models/mdm/task_cred_spec.rb +6 -6
  36. data/spec/app/models/mdm/task_host_spec.rb +6 -6
  37. data/spec/app/models/mdm/task_service_spec.rb +6 -6
  38. data/spec/app/models/mdm/task_session_spec.rb +6 -6
  39. data/spec/app/models/mdm/task_spec.rb +3 -3
  40. data/spec/app/models/mdm/user_spec.rb +3 -3
  41. data/spec/app/models/mdm/vuln_attempt_spec.rb +4 -4
  42. data/spec/app/models/mdm/vuln_detail_spec.rb +3 -3
  43. data/spec/app/models/mdm/vuln_ref_spec.rb +4 -4
  44. data/spec/app/models/mdm/vuln_spec.rb +20 -20
  45. data/spec/app/models/mdm/web_form_spec.rb +3 -3
  46. data/spec/app/models/mdm/web_page_spec.rb +4 -4
  47. data/spec/app/models/mdm/web_site_spec.rb +15 -15
  48. data/spec/app/models/mdm/web_vuln_spec.rb +4 -4
  49. data/spec/app/models/mdm/workspace_spec.rb +25 -25
  50. data/spec/app/models/metasploit_data_models/automatic_exploitation/match_result_spec.rb +4 -4
  51. data/spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb +2 -2
  52. data/spec/app/models/metasploit_data_models/automatic_exploitation/match_spec.rb +3 -3
  53. data/spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb +5 -5
  54. data/spec/app/models/metasploit_data_models/module_run_spec.rb +3 -3
  55. data/spec/app/models/metasploit_data_models/search/visitor/includes_spec.rb +4 -8
  56. data/spec/app/models/metasploit_data_models/search/visitor/joins_spec.rb +12 -12
  57. data/spec/app/models/metasploit_data_models/search/visitor/relation_spec.rb +16 -16
  58. data/spec/app/models/metasploit_data_models/search/visitor/where_spec.rb +3 -3
  59. data/spec/dummy/config/environments/test.rb +1 -1
  60. data/spec/dummy/db/structure.sql +2 -2
  61. data/spec/factories/mdm/addresses.rb +2 -2
  62. data/spec/factories/mdm/clients.rb +2 -2
  63. data/spec/factories/mdm/creds.rb +2 -2
  64. data/spec/factories/mdm/events.rb +3 -3
  65. data/spec/factories/mdm/exploit_attempts.rb +2 -2
  66. data/spec/factories/mdm/exploited_hosts.rb +1 -1
  67. data/spec/factories/mdm/fingerprints/nessus_fingerprints.rb +2 -2
  68. data/spec/factories/mdm/fingerprints/nexpose_fingerprints.rb +2 -2
  69. data/spec/factories/mdm/fingerprints/nmap_fingerprints.rb +2 -2
  70. data/spec/factories/mdm/fingerprints/retina_fingerprints.rb +2 -2
  71. data/spec/factories/mdm/fingerprints/session_fingerprints.rb +2 -2
  72. data/spec/factories/mdm/host_details.rb +2 -2
  73. data/spec/factories/mdm/host_tags.rb +2 -2
  74. data/spec/factories/mdm/hosts.rb +2 -2
  75. data/spec/factories/mdm/listeners.rb +2 -2
  76. data/spec/factories/mdm/loots.rb +2 -2
  77. data/spec/factories/mdm/module/actions.rb +2 -2
  78. data/spec/factories/mdm/module/archs.rb +2 -2
  79. data/spec/factories/mdm/module/authors.rb +2 -2
  80. data/spec/factories/mdm/module/details.rb +1 -1
  81. data/spec/factories/mdm/module/mixins.rb +2 -2
  82. data/spec/factories/mdm/module/platforms.rb +2 -2
  83. data/spec/factories/mdm/module/refs.rb +2 -2
  84. data/spec/factories/mdm/module/targets.rb +2 -2
  85. data/spec/factories/mdm/nexpose_consoles.rb +2 -2
  86. data/spec/factories/mdm/notes.rb +2 -2
  87. data/spec/factories/mdm/refs.rb +2 -2
  88. data/spec/factories/mdm/routes.rb +2 -2
  89. data/spec/factories/mdm/services.rb +3 -3
  90. data/spec/factories/mdm/session_events.rb +1 -1
  91. data/spec/factories/mdm/sessions.rb +2 -2
  92. data/spec/factories/mdm/tags.rb +2 -2
  93. data/spec/factories/mdm/task.rb +2 -2
  94. data/spec/factories/mdm/task_creds.rb +2 -2
  95. data/spec/factories/mdm/task_hosts.rb +2 -2
  96. data/spec/factories/mdm/task_services.rb +2 -2
  97. data/spec/factories/mdm/task_sessions.rb +2 -2
  98. data/spec/factories/mdm/users.rb +2 -2
  99. data/spec/factories/mdm/vuln_attempts.rb +2 -2
  100. data/spec/factories/mdm/vuln_details.rb +2 -2
  101. data/spec/factories/mdm/vuln_refs.rb +2 -2
  102. data/spec/factories/mdm/vulns.rb +2 -2
  103. data/spec/factories/mdm/web_forms.rb +1 -1
  104. data/spec/factories/mdm/web_pages.rb +2 -2
  105. data/spec/factories/mdm/web_sites.rb +2 -2
  106. data/spec/factories/mdm/web_vulns.rb +2 -2
  107. data/spec/factories/mdm/workspaces.rb +2 -2
  108. data/spec/factories/metasploit_data_models/automatic_exploitation/match_results.rb +1 -1
  109. data/spec/factories/metasploit_data_models/automatic_exploitation/match_sets.rb +2 -2
  110. data/spec/factories/metasploit_data_models/automatic_exploitation/matches.rb +1 -1
  111. data/spec/factories/metasploit_data_models/automatic_exploitation/runs.rb +1 -1
  112. data/spec/factories/module_runs.rb +1 -1
  113. data/spec/spec_helper.rb +2 -2
  114. data.tar.gz.sig +0 -0
  115. metadata +7 -7
  116. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f6c4d91c5ee463348977007580594874f2e80e0
4
- data.tar.gz: 245a7da5c16d5381be8efb8530899e6e6ed9edbb
3
+ metadata.gz: 03b4a325dada926f12b72a8e49fec3c93072210f
4
+ data.tar.gz: 077bff5e070fc282f664c4ccbbbc553f4eb4ff6e
5
5
  SHA512:
6
- metadata.gz: 98ef040c50d959c37146c2eea63d1f9e3d504d89d1a3060d6da8595a328030a09895b58e84fd5cd9d34a87fe9ef7c610f065b980bf223b6228baf02336fc7f91
7
- data.tar.gz: e9d00968b60ad4152f21afddcdddbf2ccd06a6ec84fcdccb23583d5ffbf5b8eb473aa786d2ed1f14894ce91eb2bd26170f0e3d69a209603c10605acb619778dd
6
+ metadata.gz: 121c9cf293efe9c2fff5ae2db10c5a1559b43e6dbeda0e36260db53cac5fb7555869c8d6a9c4ebcab9bcf0bc7f4b1c69fbcdb90a352fe0a4ed3fe4341d569409
7
+ data.tar.gz: 0ff5b5cd7990f6f1df049f70cd80533f586d0fd3cd487dfc538bd5052430a4395c7fe7d2e04976f2cd5cd2a6e57203a04f707df605e6efc6ac9a98418f23092b
checksums.yaml.gz.sig CHANGED
Binary file
data/.travis.yml CHANGED
@@ -10,7 +10,7 @@ addons:
10
10
  - libpcap-dev
11
11
  - graphviz
12
12
  rvm:
13
- - 2.3.3
13
+ - 2.5.0
14
14
  before_script:
15
15
  - cp spec/dummy/config/database.yml.travis spec/dummy/config/database.yml
16
16
  - bundle exec rake --version
data/Gemfile CHANGED
@@ -15,19 +15,14 @@ group :development, :test do
15
15
  # Upload coverage reports to coveralls.io
16
16
  gem 'coveralls', require: false
17
17
  # supplies factories for producing model instance for specs
18
- # Version 4.1.0 or newer is needed to support generate calls without the 'FactoryGirl.' in factory definitions syntax.
19
- gem 'factory_girl'
18
+ # Version 4.1.0 or newer is needed to support generate calls without the 'FactoryBot.' in factory definitions syntax.
19
+ gem 'factory_bot'
20
20
  # auto-load factories from spec/factories
21
- gem 'factory_girl_rails'
22
-
21
+ gem 'factory_bot_rails'
23
22
 
24
23
  gem 'rails', '~>4.2.6'
25
24
  # Used to create fake data
26
25
  gem "faker"
27
-
28
- # bound to 0.20 for Activerecord 4.2.8 deprecation warnings:
29
- # https://github.com/ged/ruby-pg/commit/c90ac644e861857ae75638eb6954b1cb49617090
30
- gem 'pg', "0.20.0"
31
26
  end
32
27
 
33
28
  group :test do
@@ -493,7 +493,8 @@ module Mdm::Host::OperatingSystemNormalization
493
493
  i.each_char do |j|
494
494
  begin
495
495
  pstr << j.downcase.encode("UTF-8")
496
- rescue Encoding::UndefinedConversionError => e
496
+ rescue Encoding::UndefinedConversionError
497
+ # rescue Encoding::UndefinedConversionError => e
497
498
  # this works in Framework, but causes a Travis CI error
498
499
  # elog("Found incompatible (non-ANSI) character in guess_purpose_from_match")
499
500
  end
@@ -1,12 +1,12 @@
1
1
  require 'rails'
2
2
 
3
3
  # `Rails::Engine` that exposes MetasploitDataModel's `ActiveRecord::Base` subclasses and automatically loads its
4
- # `FactoryGirl` factories, sequences, and traits.
4
+ # `FactoryBot` factories, sequences, and traits.
5
5
  class MetasploitDataModels::Engine < Rails::Engine
6
6
  # @see http://viget.com/extend/rails-engine-testing-with-rspec-capybara-and-factorygirl
7
7
  config.generators do |g|
8
8
  g.assets false
9
- g.fixture_replacement :factory_girl, :dir => 'spec/factories'
9
+ g.fixture_replacement :factory_bot, :dir => 'spec/factories'
10
10
  g.helper false
11
11
  g.test_framework :rspec, :fixture => false
12
12
  end
@@ -20,13 +20,13 @@ class MetasploitDataModels::Engine < Rails::Engine
20
20
  path.skip_load_path!
21
21
  end
22
22
 
23
- initializer 'metasploit_data_models.prepend_factory_path', :after => 'factory_girl.set_factory_paths' do
24
- if defined? FactoryGirl
25
- relative_definition_file_path = config.generators.options[:factory_girl][:dir]
23
+ initializer 'metasploit_data_models.prepend_factory_path', :after => 'factory_bot.set_factory_paths' do
24
+ if defined? FactoryBot
25
+ relative_definition_file_path = config.generators.options[:factory_bot][:dir]
26
26
  definition_file_path = root.join(relative_definition_file_path)
27
27
 
28
28
  # unshift so that Pro can modify mdm factories
29
- FactoryGirl.definition_file_paths.unshift definition_file_path
29
+ FactoryBot.definition_file_paths.unshift definition_file_path
30
30
  end
31
31
  end
32
- end
32
+ end
@@ -1,6 +1,6 @@
1
1
  module MetasploitDataModels
2
2
  # VERSION is managed by GemRelease
3
- VERSION = '2.0.17'
3
+ VERSION = '3.0.0'
4
4
 
5
5
  # @return [String]
6
6
  #
@@ -71,7 +71,9 @@ Gem::Specification.new do |s|
71
71
  # markdown formatting for yard
72
72
  s.add_development_dependency 'redcarpet'
73
73
 
74
- s.add_runtime_dependency 'pg'
74
+ # bound to 0.20 for Activerecord 4.2.8 deprecation warnings:
75
+ # https://github.com/ged/ruby-pg/commit/c90ac644e861857ae75638eb6954b1cb49617090
76
+ s.add_runtime_dependency 'pg', "0.20.0"
75
77
 
76
78
  s.platform = Gem::Platform::RUBY
77
79
  end
@@ -8,7 +8,7 @@ RSpec.describe Mdm::Client, type: :model do
8
8
 
9
9
  context '#destroy' do
10
10
  it 'should successfully destroy the object' do
11
- client = FactoryGirl.create(:mdm_client, :ua_string => 'user-agent')
11
+ client = FactoryBot.create(:mdm_client, :ua_string => 'user-agent')
12
12
  expect {
13
13
  client.destroy
14
14
  }.to_not raise_error
@@ -20,7 +20,7 @@ RSpec.describe Mdm::Client, type: :model do
20
20
 
21
21
  context 'factory' do
22
22
  it 'should be valid' do
23
- client = FactoryGirl.build(:mdm_client)
23
+ client = FactoryBot.build(:mdm_client)
24
24
  expect(client).to be_valid
25
25
  end
26
26
  end
@@ -40,4 +40,4 @@ RSpec.describe Mdm::Client, type: :model do
40
40
 
41
41
  end
42
42
 
43
- end
43
+ end
@@ -27,8 +27,8 @@ RSpec.describe Mdm::Cred, type: :model do
27
27
 
28
28
  context '#destroy' do
29
29
  it 'should successfully destroy the object and all dependent objects' do
30
- cred = FactoryGirl.create(:mdm_cred)
31
- task_cred = FactoryGirl.create(:mdm_task_cred, :cred => cred)
30
+ cred = FactoryBot.create(:mdm_cred)
31
+ task_cred = FactoryBot.create(:mdm_task_cred, :cred => cred)
32
32
  expect {
33
33
  cred.destroy
34
34
  }.to_not raise_error
@@ -44,19 +44,19 @@ RSpec.describe Mdm::Cred, type: :model do
44
44
  context 'callbacks' do
45
45
  context 'after_create' do
46
46
  it 'should increment cred_count on the host' do
47
- host = FactoryGirl.create(:mdm_host)
48
- svc = FactoryGirl.create(:mdm_service, :host => host)
47
+ host = FactoryBot.create(:mdm_host)
48
+ svc = FactoryBot.create(:mdm_service, :host => host)
49
49
  expect {
50
- FactoryGirl.create(:mdm_cred, :service => svc)
50
+ FactoryBot.create(:mdm_cred, :service => svc)
51
51
  }.to change{ Mdm::Host.find(host.id).cred_count}.by(1)
52
52
  end
53
53
  end
54
54
 
55
55
  context 'after_destroy' do
56
56
  it 'should decrement cred_count on the host' do
57
- host = FactoryGirl.create(:mdm_host)
58
- svc = FactoryGirl.create(:mdm_service, :host => host)
59
- cred =FactoryGirl.create(:mdm_cred, :service => svc)
57
+ host = FactoryBot.create(:mdm_host)
58
+ svc = FactoryBot.create(:mdm_service, :host => host)
59
+ cred =FactoryBot.create(:mdm_cred, :service => svc)
60
60
  expect {
61
61
  cred.destroy
62
62
  }.to change{ Mdm::Host.find(host.id).cred_count}.by(-1)
@@ -84,28 +84,28 @@ RSpec.describe Mdm::Cred, type: :model do
84
84
 
85
85
  context 'methods' do
86
86
  let(:host) {
87
- FactoryGirl.create(
87
+ FactoryBot.create(
88
88
  :mdm_host,
89
89
  workspace: workspace
90
90
  )
91
91
  }
92
92
 
93
93
  let(:other_service) {
94
- FactoryGirl.create(
94
+ FactoryBot.create(
95
95
  :mdm_service,
96
96
  host: host
97
97
  )
98
98
  }
99
99
 
100
100
  let(:service) {
101
- FactoryGirl.create(
101
+ FactoryBot.create(
102
102
  :mdm_service,
103
103
  host: host
104
104
  )
105
105
  }
106
106
 
107
107
  let(:ssh_key) {
108
- FactoryGirl.create(
108
+ FactoryBot.create(
109
109
  :mdm_cred,
110
110
  pass: '/path/to/keyfile',
111
111
  proof: "KEY=57:c3:11:5d:77:c5:63:90:33:2d:c5:c4:99:78:62:7a",
@@ -116,7 +116,7 @@ RSpec.describe Mdm::Cred, type: :model do
116
116
  }
117
117
 
118
118
  let(:ssh_pubkey) {
119
- FactoryGirl.create(
119
+ FactoryBot.create(
120
120
  :mdm_cred,
121
121
  pass: '/path/to/keyfile',
122
122
  proof: "KEY=57:c3:11:5d:77:c5:63:90:33:2d:c5:c4:99:78:62:7a",
@@ -127,49 +127,49 @@ RSpec.describe Mdm::Cred, type: :model do
127
127
  }
128
128
 
129
129
  let(:workspace) {
130
- FactoryGirl.create(:mdm_workspace)
130
+ FactoryBot.create(:mdm_workspace)
131
131
  }
132
132
 
133
133
  context '#ptype_human' do
134
134
  it "should return 'read/write password' for 'password_rw'" do
135
- cred = FactoryGirl.build(:mdm_cred, :user => 'msfadmin', :pass => 'msfadmin', :ptype => 'password_rw')
135
+ cred = FactoryBot.build(:mdm_cred, :user => 'msfadmin', :pass => 'msfadmin', :ptype => 'password_rw')
136
136
  expect(cred.ptype_human).to eq('read/write password')
137
137
  end
138
138
 
139
139
  it "should return 'read-only password' for 'password_ro'" do
140
- cred = FactoryGirl.build(:mdm_cred, :user => 'msfadmin', :pass => 'msfadmin', :ptype => 'password_ro')
140
+ cred = FactoryBot.build(:mdm_cred, :user => 'msfadmin', :pass => 'msfadmin', :ptype => 'password_ro')
141
141
  expect(cred.ptype_human).to eq('read-only password')
142
142
  end
143
143
 
144
144
  it "should return 'SMB Hash' for 'smb_hash'" do
145
- cred = FactoryGirl.build(:mdm_cred, :user => 'msfadmin', :pass => 'msfadmin', :ptype => 'smb_hash')
145
+ cred = FactoryBot.build(:mdm_cred, :user => 'msfadmin', :pass => 'msfadmin', :ptype => 'smb_hash')
146
146
  expect(cred.ptype_human).to eq('SMB hash')
147
147
  end
148
148
 
149
149
  it "should return 'SSH private key' for 'ssh_key'" do
150
- cred = FactoryGirl.build(:mdm_cred, :user => 'msfadmin', :pass => 'msfadmin', :ptype => 'ssh_key')
150
+ cred = FactoryBot.build(:mdm_cred, :user => 'msfadmin', :pass => 'msfadmin', :ptype => 'ssh_key')
151
151
  expect(cred.ptype_human).to eq('SSH private key')
152
152
  end
153
153
 
154
154
  it "should return 'SSH public key' for 'ssh_pubkey'" do
155
- cred = FactoryGirl.build(:mdm_cred, :user => 'msfadmin', :pass => 'msfadmin', :ptype => 'ssh_pubkey')
155
+ cred = FactoryBot.build(:mdm_cred, :user => 'msfadmin', :pass => 'msfadmin', :ptype => 'ssh_pubkey')
156
156
  expect(cred.ptype_human).to eq('SSH public key')
157
157
  end
158
158
  end
159
159
 
160
160
  context '#ssh_key_id' do
161
161
  it 'should return nil if not an ssh_key' do
162
- cred = FactoryGirl.build(:mdm_cred, :user => 'msfadmin', :pass => 'msfadmin', :ptype => 'password_rw')
162
+ cred = FactoryBot.build(:mdm_cred, :user => 'msfadmin', :pass => 'msfadmin', :ptype => 'password_rw')
163
163
  expect(cred.ssh_key_id).to eq(nil)
164
164
  end
165
165
 
166
166
  it 'should return nil if proof does not contain the key id' do
167
- cred = FactoryGirl.build(:mdm_cred, :user => 'msfadmin', :pass => '/path/to/keyfile', :ptype => 'ssh_key', :proof => "no key here")
167
+ cred = FactoryBot.build(:mdm_cred, :user => 'msfadmin', :pass => '/path/to/keyfile', :ptype => 'ssh_key', :proof => "no key here")
168
168
  expect(cred.ssh_key_id).to eq(nil)
169
169
  end
170
170
 
171
171
  it 'should return the key id for an ssh_key' do
172
- cred = FactoryGirl.build(:mdm_cred, :user => 'msfadmin', :pass => '/path/to/keyfile', :ptype => 'ssh_key', :proof => "KEY=57:c3:11:5d:77:c5:63:90:33:2d:c5:c4:99:78:62:7a")
172
+ cred = FactoryBot.build(:mdm_cred, :user => 'msfadmin', :pass => '/path/to/keyfile', :ptype => 'ssh_key', :proof => "KEY=57:c3:11:5d:77:c5:63:90:33:2d:c5:c4:99:78:62:7a")
173
173
  expect(cred.ssh_key_id).to eq('57:c3:11:5d:77:c5:63:90:33:2d:c5:c4:99:78:62:7a')
174
174
  end
175
175
 
@@ -177,7 +177,7 @@ RSpec.describe Mdm::Cred, type: :model do
177
177
 
178
178
  context '#ssh_key_matches?' do
179
179
  it 'should return true if the ssh_keys match' do
180
- other_ssh_key = FactoryGirl.create(
180
+ other_ssh_key = FactoryBot.create(
181
181
  :mdm_cred,
182
182
  pass: '/path/to/keyfile',
183
183
  proof: 'KEY=57:c3:11:5d:77:c5:63:90:33:2d:c5:c4:99:78:62:7a',
@@ -194,7 +194,7 @@ RSpec.describe Mdm::Cred, type: :model do
194
194
  end
195
195
 
196
196
  it 'should return false if the ptypes do not match' do
197
- different_ptype = FactoryGirl.create(
197
+ different_ptype = FactoryBot.create(
198
198
  :mdm_cred,
199
199
  pass: '/path/to/keyfile',
200
200
  proof: 'KEY=57:c3:11:5d:77:c5:63:90:33:2d:c5:c4:99:78:62:7a',
@@ -207,7 +207,7 @@ RSpec.describe Mdm::Cred, type: :model do
207
207
  end
208
208
 
209
209
  it 'should return false if the key ids do not match' do
210
- different_proof = FactoryGirl.create(
210
+ different_proof = FactoryBot.create(
211
211
  :mdm_cred,
212
212
  pass: '/path/to/keyfile',
213
213
  proof: 'KEY=66:d4:22:6e:88:d6:74:A1:44:3e:d6:d5:AA:89:73:8b',
@@ -220,15 +220,15 @@ RSpec.describe Mdm::Cred, type: :model do
220
220
  end
221
221
 
222
222
  it 'should behave the same for public keys as private keys' do
223
- pubkey2 = FactoryGirl.create(:mdm_cred, :service => service, :user => 'msfadmin', :pass => '/path/to/keyfile', :ptype => 'ssh_pubkey', :proof => "KEY=57:c3:11:5d:77:c5:63:90:33:2d:c5:c4:99:78:62:7a")
224
- pubkey3 = FactoryGirl.create(:mdm_cred, :service => service, :user => 'msfadmin', :pass => '/path/to/keyfile', :ptype => 'ssh_pubkey', :proof => "KEY=66:d4:22:6e:88:d6:74:A1:44:3e:d6:d5:AA:89:73:8b")
223
+ pubkey2 = FactoryBot.create(:mdm_cred, :service => service, :user => 'msfadmin', :pass => '/path/to/keyfile', :ptype => 'ssh_pubkey', :proof => "KEY=57:c3:11:5d:77:c5:63:90:33:2d:c5:c4:99:78:62:7a")
224
+ pubkey3 = FactoryBot.create(:mdm_cred, :service => service, :user => 'msfadmin', :pass => '/path/to/keyfile', :ptype => 'ssh_pubkey', :proof => "KEY=66:d4:22:6e:88:d6:74:A1:44:3e:d6:d5:AA:89:73:8b")
225
225
  expect(pubkey2.ssh_key_matches?(ssh_pubkey)).to eq(true)
226
226
  expect(pubkey2.ssh_key_matches?(pubkey3)).to eq(false)
227
227
  end
228
228
 
229
229
  it 'should always return false for non ssh key creds' do
230
- cred2 = FactoryGirl.create(:mdm_cred, :service => other_service, :ptype => 'password', :user => 'msfadmin', :pass => 'msfadmin' )
231
- cred3 = FactoryGirl.create(:mdm_cred, :service => other_service, :ptype => 'password', :user => 'msfadmin', :pass => 'msfadmin' )
230
+ cred2 = FactoryBot.create(:mdm_cred, :service => other_service, :ptype => 'password', :user => 'msfadmin', :pass => 'msfadmin' )
231
+ cred3 = FactoryBot.create(:mdm_cred, :service => other_service, :ptype => 'password', :user => 'msfadmin', :pass => 'msfadmin' )
232
232
  expect(cred2.ssh_key_matches?(cred3)).to eq(false)
233
233
  end
234
234
  end
@@ -239,7 +239,7 @@ RSpec.describe Mdm::Cred, type: :model do
239
239
  #
240
240
 
241
241
  let(:other_ssh_key) {
242
- FactoryGirl.create(
242
+ FactoryBot.create(
243
243
  :mdm_cred,
244
244
  pass: '/path/to/keyfile',
245
245
  proof: 'KEY=57:c3:11:5d:77:c5:63:90:33:2d:c5:c4:99:78:62:7a',
@@ -273,7 +273,7 @@ RSpec.describe Mdm::Cred, type: :model do
273
273
  #
274
274
 
275
275
  let(:other_ssh_key) {
276
- FactoryGirl.create(
276
+ FactoryBot.create(
277
277
  :mdm_cred,
278
278
  pass: '/path/to/keyfile',
279
279
  proof: 'KEY=57:c3:11:5d:77:c5:63:90:33:2d:c5:c4:99:78:62:7a',
@@ -307,7 +307,7 @@ RSpec.describe Mdm::Cred, type: :model do
307
307
  #
308
308
 
309
309
  let(:other_ssh_key) {
310
- FactoryGirl.create(
310
+ FactoryBot.create(
311
311
  :mdm_cred,
312
312
  pass: '/path/to/keyfile',
313
313
  proof: 'KEY=57:c3:11:5d:77:c5:63:90:33:2d:c5:c4:99:78:62:7a',
@@ -338,9 +338,9 @@ RSpec.describe Mdm::Cred, type: :model do
338
338
 
339
339
  context 'factory' do
340
340
  it 'should be valid' do
341
- cred = FactoryGirl.build(:mdm_cred)
341
+ cred = FactoryBot.build(:mdm_cred)
342
342
  expect(cred).to be_valid
343
343
  end
344
344
  end
345
345
 
346
- end
346
+ end
@@ -25,7 +25,7 @@ RSpec.describe Mdm::Event, type: :model do
25
25
 
26
26
  context '#destroy' do
27
27
  it 'should successfully destroy the object and all dependent objects' do
28
- event = FactoryGirl.create(:mdm_event)
28
+ event = FactoryBot.create(:mdm_event)
29
29
  expect {
30
30
  event.destroy
31
31
  }.to_not raise_error
@@ -38,9 +38,9 @@ RSpec.describe Mdm::Event, type: :model do
38
38
 
39
39
  context 'scopes' do
40
40
  context 'flagged' do
41
- let(:workspace) {FactoryGirl.create(:mdm_workspace)}
42
- let(:flagged_event) { FactoryGirl.create(:mdm_event, :workspace => workspace, :name => 'flagme', :critical => true, :seen => false) }
43
- let(:non_critical_event) { FactoryGirl.create(:mdm_event, :workspace => workspace, :name => 'dontflagmebro', :critical => false, :seen => false) }
41
+ let(:workspace) {FactoryBot.create(:mdm_workspace)}
42
+ let(:flagged_event) { FactoryBot.create(:mdm_event, :workspace => workspace, :name => 'flagme', :critical => true, :seen => false) }
43
+ let(:non_critical_event) { FactoryBot.create(:mdm_event, :workspace => workspace, :name => 'dontflagmebro', :critical => false, :seen => false) }
44
44
 
45
45
  before(:example) do
46
46
  flagged_event
@@ -63,8 +63,8 @@ RSpec.describe Mdm::Event, type: :model do
63
63
 
64
64
  context 'module_run' do
65
65
  it 'should only return module_run events' do
66
- flagged_event = FactoryGirl.create(:mdm_event, :name => 'module_run')
67
- non_critical_event = FactoryGirl.create(:mdm_event, :name => 'dontflagmebro')
66
+ flagged_event = FactoryBot.create(:mdm_event, :name => 'module_run')
67
+ non_critical_event = FactoryBot.create(:mdm_event, :name => 'dontflagmebro')
68
68
  flagged_set = Mdm::Event.module_run
69
69
  expect(flagged_set).to include(flagged_event)
70
70
  expect(flagged_set).not_to include(non_critical_event)
@@ -74,7 +74,7 @@ RSpec.describe Mdm::Event, type: :model do
74
74
 
75
75
  context 'validations' do
76
76
  it 'should require name' do
77
- unnamed_event = FactoryGirl.build(:mdm_event, :name => nil)
77
+ unnamed_event = FactoryBot.build(:mdm_event, :name => nil)
78
78
  expect(unnamed_event).not_to be_valid
79
79
  expect(unnamed_event.errors[:name]).to include("can't be blank")
80
80
  end
@@ -82,9 +82,9 @@ RSpec.describe Mdm::Event, type: :model do
82
82
 
83
83
  context 'factory' do
84
84
  it 'should be valid' do
85
- event = FactoryGirl.build(:mdm_event)
85
+ event = FactoryBot.build(:mdm_event)
86
86
  expect(event).to be_valid
87
87
  end
88
88
  end
89
89
 
90
- end
90
+ end
@@ -29,7 +29,7 @@ RSpec.describe Mdm::ExploitAttempt, type: :model do
29
29
 
30
30
  context '#destroy' do
31
31
  it 'should successfully destroy the object and all dependent objects' do
32
- exploit_attempt = FactoryGirl.create(:mdm_exploit_attempt)
32
+ exploit_attempt = FactoryBot.create(:mdm_exploit_attempt)
33
33
  expect {
34
34
  exploit_attempt.destroy
35
35
  }.to_not raise_error
@@ -42,18 +42,18 @@ RSpec.describe Mdm::ExploitAttempt, type: :model do
42
42
 
43
43
  context 'validations' do
44
44
  it 'should only be valid with a host_id' do
45
- orphaned_attempt = FactoryGirl.build(:mdm_exploit_attempt, :host => nil)
45
+ orphaned_attempt = FactoryBot.build(:mdm_exploit_attempt, :host => nil)
46
46
  expect(orphaned_attempt).not_to be_valid
47
47
  expect(orphaned_attempt.errors[:host_id]).to include("can't be blank")
48
- propper_attempt = FactoryGirl.build(:mdm_exploit_attempt)
48
+ propper_attempt = FactoryBot.build(:mdm_exploit_attempt)
49
49
  expect(propper_attempt).to be_valid
50
50
  end
51
51
  end
52
52
 
53
53
  context 'factory' do
54
54
  it 'should be valid' do
55
- exploit_attempt = FactoryGirl.build(:mdm_exploit_attempt)
55
+ exploit_attempt = FactoryBot.build(:mdm_exploit_attempt)
56
56
  expect(exploit_attempt).to be_valid
57
57
  end
58
58
  end
59
- end
59
+ end
@@ -24,7 +24,7 @@ RSpec.describe Mdm::ExploitedHost, type: :model do
24
24
 
25
25
  context '#destroy' do
26
26
  it 'should successfully destroy the object and all dependent objects' do
27
- exploited_host = FactoryGirl.create(:mdm_exploited_host)
27
+ exploited_host = FactoryBot.create(:mdm_exploited_host)
28
28
  expect {
29
29
  exploited_host.destroy
30
30
  }.to_not raise_error
@@ -36,9 +36,9 @@ RSpec.describe Mdm::ExploitedHost, type: :model do
36
36
 
37
37
  context 'factory' do
38
38
  it 'should be valid' do
39
- exploited_host = FactoryGirl.build(:mdm_exploited_host)
39
+ exploited_host = FactoryBot.build(:mdm_exploited_host)
40
40
  expect(exploited_host).to be_valid
41
41
  end
42
42
  end
43
43
 
44
- end
44
+ end
@@ -20,7 +20,7 @@ RSpec.describe Mdm::HostDetail, type: :model do
20
20
 
21
21
  context 'validations' do
22
22
  it 'should only be valid with a host_id' do
23
- orphan_detail = FactoryGirl.build(:mdm_host_detail, :host => nil)
23
+ orphan_detail = FactoryBot.build(:mdm_host_detail, :host => nil)
24
24
  expect(orphan_detail).not_to be_valid
25
25
  expect(orphan_detail.errors[:host_id]).to include("can't be blank")
26
26
  end
@@ -28,14 +28,14 @@ RSpec.describe Mdm::HostDetail, type: :model do
28
28
 
29
29
  context 'factory' do
30
30
  it 'should be valid' do
31
- host_detail = FactoryGirl.build(:mdm_host_detail)
31
+ host_detail = FactoryBot.build(:mdm_host_detail)
32
32
  expect(host_detail).to be_valid
33
33
  end
34
34
  end
35
35
 
36
36
  context '#destroy' do
37
37
  it 'should successfully destroy the object' do
38
- detail = FactoryGirl.create(:mdm_host_detail)
38
+ detail = FactoryBot.create(:mdm_host_detail)
39
39
  expect{
40
40
  detail.destroy
41
41
  }.to_not raise_error
@@ -45,4 +45,4 @@ RSpec.describe Mdm::HostDetail, type: :model do
45
45
  end
46
46
  end
47
47
 
48
- end
48
+ end