From 7d873ea7ab47367be0fc363ff0b7fa5a5c7244dd Mon Sep 17 00:00:00 2001 From: Christian Mehlmauer Date: Wed, 21 Mar 2018 23:21:37 +0100 Subject: [PATCH] replace factory_girls with factory_bot fixes #9736 --- Gemfile | 2 +- Gemfile.lock | 8 +- LICENSE_GEMS | 149 +++++++++--------- spec/factories/mdm/exported_web_vulns.rb | 2 +- spec/factories/mdm/module_details.rb | 2 +- .../metasploit/framework/jtr/wordlist_spec.rb | 6 +- spec/lib/msf/core/auxiliary/cisco_spec.rb | 14 +- spec/lib/msf/core/exploit/auto_target_spec.rb | 18 +-- spec/lib/msf/core/module_set_spec.rb | 4 +- spec/lib/msf/db_manager/export_spec.rb | 4 +- .../console/command_dispatcher/creds_spec.rb | 94 +++++------ .../ui/console/command_dispatcher/db_spec.rb | 16 +- .../examples/credential/core/to_credential.rb | 2 +- .../msf/db_manager/exploit_attempt.rb | 34 ++-- .../import/metasploit_framework/xml.rb | 16 +- .../examples/msf/db_manager/module_cache.rb | 62 ++++---- ..._name_or_mdm_module_target_name_keyword.rb | 4 +- .../mdm_module_ref_name_keyword.rb | 4 +- .../shared/examples/msf/db_manager/session.rb | 24 +-- .../examples/msf/module_manager/cache.rb | 2 +- 20 files changed, 236 insertions(+), 231 deletions(-) diff --git a/Gemfile b/Gemfile index 2b48e2087f..1d9de9700d 100755 --- a/Gemfile +++ b/Gemfile @@ -35,7 +35,7 @@ end group :development, :test do # automatically include factories from spec/factories - gem 'factory_girl_rails' + gem 'factory_bot_rails' # Make rspec output shorter and more useful gem 'fivemat' # running documentation generation tasks and rspec tasks diff --git a/Gemfile.lock b/Gemfile.lock index 9397d24518..8875054caf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -118,10 +118,10 @@ GEM dnsruby (1.60.2) docile (1.3.0) erubis (2.7.0) - factory_girl (4.9.0) + factory_bot (4.8.2) activesupport (>= 3.0.0) - factory_girl_rails (4.9.0) - factory_girl (~> 4.9.0) + factory_bot_rails (4.8.2) + factory_bot (~> 4.8.2) railties (>= 3.0.0) faker (1.8.7) i18n (>= 0.7) @@ -363,7 +363,7 @@ PLATFORMS ruby DEPENDENCIES - factory_girl_rails + factory_bot_rails fivemat google-protobuf (= 3.5.1) grpc (= 1.8.3) diff --git a/LICENSE_GEMS b/LICENSE_GEMS index e3c4b86663..e67bfb59b1 100644 --- a/LICENSE_GEMS +++ b/LICENSE_GEMS @@ -1,130 +1,135 @@ This file is auto-generated by tools/dev/update_gem_licenses.sh -Ascii85, 1.0.2, MIT -actionpack, 4.2.9, MIT -actionview, 4.2.9, MIT -activemodel, 4.2.9, MIT -activerecord, 4.2.9, MIT -activesupport, 4.2.9, MIT -addressable, 2.5.1, "Apache 2.0" +Ascii85, 1.0.3, MIT +actionpack, 4.2.10, MIT +actionview, 4.2.10, MIT +activemodel, 4.2.10, MIT +activerecord, 4.2.10, MIT +activesupport, 4.2.10, MIT +addressable, 2.5.2, "Apache 2.0" afm, 0.2.2, MIT arel, 6.0.4, MIT -arel-helpers, 2.4.0, unknown -backports, 3.8.0, MIT +arel-helpers, 2.6.1, MIT +backports, 3.11.1, MIT bcrypt, 3.1.11, MIT -bindata, 2.4.0, ruby +bcrypt_pbkdf, 1.0.0, MIT +bindata, 2.4.3, ruby bit-struct, 0.16, ruby builder, 3.2.3, MIT -bundler, 1.15.1, MIT -coderay, 1.1.1, MIT +bundler, 1.16.1, MIT +coderay, 1.1.2, MIT +concurrent-ruby, 1.0.5, MIT +crass, 1.0.3, MIT diff-lcs, 1.3, "MIT, Artistic-2.0, GPL-2.0+" -dnsruby, 1.60.1, "Apache 2.0" -docile, 1.1.5, MIT +dnsruby, 1.60.2, "Apache 2.0" +docile, 1.3.0, MIT erubis, 2.7.0, MIT -factory_girl, 4.8.0, MIT -factory_girl_rails, 4.8.0, MIT -faraday, 0.12.1, MIT +factory_bot, 4.8.2, MIT +factory_bot_rails, 4.8.2, MIT +faker, 1.8.7, MIT +faraday, 0.14.0, MIT filesize, 0.1.1, MIT -fivemat, 1.3.5, MIT -google-protobuf, 3.3.0, "New BSD" -googleauth, 0.5.1, "Apache 2.0" -grpc, 1.4.1, "New BSD" +fivemat, 1.3.6, MIT +google-protobuf, 3.5.1, "New BSD" +googleapis-common-protos-types, 1.0.1, "Apache 2.0" +googleauth, 0.6.2, "Apache 2.0" +grpc, 1.8.3, "Apache 2.0" hashery, 2.1.2, "Simplified BSD" -i18n, 0.8.6, MIT +i18n, 0.9.5, MIT jsobfu, 0.4.2, "New BSD" json, 2.1.0, ruby -jwt, 1.5.6, MIT +jwt, 2.1.0, MIT little-plugger, 1.1.4, MIT logging, 2.2.2, MIT -loofah, 2.0.3, MIT +loofah, 2.2.0, MIT memoist, 0.16.0, MIT metasm, 1.0.3, LGPL -metasploit-aggregator, 0.2.1, "New BSD" +metasploit-aggregator, 1.0.0, "New BSD" metasploit-concern, 2.0.5, "New BSD" -metasploit-credential, 2.0.10, "New BSD" -metasploit-framework, 4.15.0, "New BSD" +metasploit-credential, 2.0.13, "New BSD" +metasploit-framework, 5.0.0, "New BSD" metasploit-model, 2.0.4, "New BSD" -metasploit-payloads, 1.2.37, "3-clause (or ""modified"") BSD" -metasploit_data_models, 2.0.15, "New BSD" -metasploit_payloads-mettle, 0.1.10, "3-clause (or ""modified"") BSD" -method_source, 0.8.2, MIT -mini_portile2, 2.2.0, MIT -minitest, 5.10.2, MIT -msgpack, 1.1.0, "Apache 2.0" -multi_json, 1.12.1, MIT +metasploit-payloads, 1.3.31, "3-clause (or ""modified"") BSD" +metasploit_data_models, 2.0.16, "New BSD" +metasploit_payloads-mettle, 0.3.7, "3-clause (or ""modified"") BSD" +method_source, 0.9.0, MIT +mini_portile2, 2.3.0, MIT +minitest, 5.11.3, MIT +mqtt, 0.5.0, MIT +msgpack, 1.2.4, "Apache 2.0" +multi_json, 1.13.1, MIT multipart-post, 2.0.0, MIT nessus_rest, 0.1.6, MIT -net-ssh, 4.1.0, MIT -network_interface, 0.0.1, MIT -nexpose, 6.1.0, BSD -nokogiri, 1.8.0, MIT -octokit, 4.7.0, MIT +net-ssh, 4.2.0, MIT +network_interface, 0.0.2, MIT +nexpose, 7.2.0, BSD +nokogiri, 1.8.2, MIT +octokit, 4.8.0, MIT openssl-ccm, 1.2.1, MIT openvas-omp, 0.0.4, MIT os, 0.9.6, MIT packetfu, 1.1.13, BSD patch_finder, 1.0.2, "New BSD" pcaprub, 0.12.4, LGPL-2.1 -pdf-reader, 2.0.0, MIT +pdf-reader, 2.1.0, MIT pg, 0.20.0, "New BSD" pg_array_parser, 0.0.9, unknown postgres_ext, 3.0.0, MIT -pry, 0.10.4, MIT -public_suffix, 2.0.5, MIT -rack, 1.6.8, MIT +pry, 0.11.3, MIT +public_suffix, 3.0.2, MIT +rack, 1.6.9, MIT rack-test, 0.6.3, MIT rails-deprecated_sanitizer, 1.0.3, MIT -rails-dom-testing, 1.0.8, MIT +rails-dom-testing, 1.0.9, MIT rails-html-sanitizer, 1.0.3, MIT -railties, 4.2.9, MIT -rake, 12.0.0, MIT -rb-readline, 0.5.4, BSD -recog, 2.1.11, unknown +railties, 4.2.10, MIT +rake, 12.3.0, MIT +rb-readline, 0.5.5, BSD +recog, 2.1.18, unknown redcarpet, 3.4.0, MIT -rex-arch, 0.1.9, "New BSD" +rex-arch, 0.1.13, "New BSD" rex-bin_tools, 0.1.4, "New BSD" -rex-core, 0.1.11, "New BSD" +rex-core, 0.1.13, "New BSD" rex-encoder, 0.1.4, "New BSD" -rex-exploitation, 0.1.15, "New BSD" +rex-exploitation, 0.1.17, "New BSD" rex-java, 0.1.5, "New BSD" rex-mime, 0.1.5, "New BSD" rex-nop, 0.1.1, "New BSD" rex-ole, 0.1.6, "New BSD" -rex-powershell, 0.1.72, "New BSD" -rex-random_identifier, 0.1.2, "New BSD" +rex-powershell, 0.1.77, "New BSD" +rex-random_identifier, 0.1.4, "New BSD" rex-registry, 0.1.3, "New BSD" rex-rop_builder, 0.1.3, "New BSD" -rex-socket, 0.1.8, "New BSD" -rex-sslscan, 0.1.4, "New BSD" +rex-socket, 0.1.10, "New BSD" +rex-sslscan, 0.1.5, "New BSD" rex-struct2, 0.1.2, "New BSD" -rex-text, 0.2.15, "New BSD" +rex-text, 0.2.16, "New BSD" rex-zip, 0.1.3, "New BSD" rkelly-remix, 0.0.7, MIT -robots, 0.10.1, MIT -rspec, 3.6.0, MIT -rspec-core, 3.6.0, MIT -rspec-expectations, 3.6.0, MIT -rspec-mocks, 3.6.0, MIT -rspec-rails, 3.6.0, MIT +rspec, 3.7.0, MIT +rspec-core, 3.7.1, MIT +rspec-expectations, 3.7.0, MIT +rspec-mocks, 3.7.0, MIT +rspec-rails, 3.7.2, MIT rspec-rerun, 1.1.0, MIT -rspec-support, 3.6.0, MIT +rspec-support, 3.7.1, MIT +ruby-macho, 1.1.0, MIT ruby-rc4, 0.1.5, MIT ruby_smb, 0.0.18, "New BSD" rubyntlm, 0.6.2, MIT rubyzip, 1.2.1, "Simplified BSD" sawyer, 0.8.1, MIT -signet, 0.7.3, "Apache 2.0" -simplecov, 0.14.1, MIT -simplecov-html, 0.10.1, MIT -slop, 3.6.0, MIT +signet, 0.8.1, "Apache 2.0" +simplecov, 0.16.0, MIT +simplecov-html, 0.10.2, MIT sqlite3, 1.3.13, "New BSD" sshkey, 1.9.0, MIT -thor, 0.19.4, MIT +thor, 0.20.0, MIT thread_safe, 0.3.6, "Apache 2.0" timecop, 0.9.1, MIT ttfunk, 1.5.1, "Nonstandard, GPL-2.0, GPL-3.0" -tzinfo, 1.2.3, MIT -tzinfo-data, 1.2017.2, MIT +tzinfo, 1.2.5, MIT +tzinfo-data, 1.2018.3, MIT windows_error, 0.1.2, BSD xdr, 2.0.0, "Apache 2.0" xmlrpc, 0.3.0, ruby -yard, 0.9.9, MIT +yard, 0.9.12, MIT diff --git a/spec/factories/mdm/exported_web_vulns.rb b/spec/factories/mdm/exported_web_vulns.rb index 0e97fa6b6e..fcd6806527 100644 --- a/spec/factories/mdm/exported_web_vulns.rb +++ b/spec/factories/mdm/exported_web_vulns.rb @@ -1,4 +1,4 @@ -FactoryGirl.define do +FactoryBot.define do factory :exported_web_vuln, :parent => :mdm_web_vuln do blame { generate :mdm_web_vuln_blame } description { generate :mdm_web_vuln_description } diff --git a/spec/factories/mdm/module_details.rb b/spec/factories/mdm/module_details.rb index 63fdb2276b..41c8632d14 100644 --- a/spec/factories/mdm/module_details.rb +++ b/spec/factories/mdm/module_details.rb @@ -1,4 +1,4 @@ -FactoryGirl.modify do +FactoryBot.modify do factory :mdm_module_detail do transient do root { diff --git a/spec/lib/metasploit/framework/jtr/wordlist_spec.rb b/spec/lib/metasploit/framework/jtr/wordlist_spec.rb index 5171ef744b..24bb56bb9d 100644 --- a/spec/lib/metasploit/framework/jtr/wordlist_spec.rb +++ b/spec/lib/metasploit/framework/jtr/wordlist_spec.rb @@ -9,9 +9,9 @@ RSpec.describe Metasploit::Framework::JtR::Wordlist do let(:expansion_word) { 'Foo bar_baz-bat.bam\\foo//bar' } let(:common_root_path) { File.expand_path('fake_common_roots.txt',FILE_FIXTURES_PATH) } let(:default_wordlist_path) { File.expand_path('fake_default_wordlist.txt',FILE_FIXTURES_PATH) } - let(:password) { FactoryGirl.create(:metasploit_credential_password) } - let(:public) { FactoryGirl.create(:metasploit_credential_public) } - let(:realm) { FactoryGirl.create(:metasploit_credential_realm) } + let(:password) { FactoryBot.create(:metasploit_credential_password) } + let(:public) { FactoryBot.create(:metasploit_credential_public) } + let(:realm) { FactoryBot.create(:metasploit_credential_realm) } let(:mutate_me) { 'password' } let(:mutants) { [ "pa55word", diff --git a/spec/lib/msf/core/auxiliary/cisco_spec.rb b/spec/lib/msf/core/auxiliary/cisco_spec.rb index f9adb0a9d2..d78cee075b 100644 --- a/spec/lib/msf/core/auxiliary/cisco_spec.rb +++ b/spec/lib/msf/core/auxiliary/cisco_spec.rb @@ -32,21 +32,21 @@ RSpec.describe Msf::Auxiliary::Cisco do subject(:aux_cisco) { DummyClass.new } - let!(:workspace) { FactoryGirl.create(:mdm_workspace) } + let!(:workspace) { FactoryBot.create(:mdm_workspace) } context '#create_credential_and_login' do - let(:session) { FactoryGirl.create(:mdm_session) } + let(:session) { FactoryBot.create(:mdm_session) } - let(:task) { FactoryGirl.create(:mdm_task, workspace: workspace)} + let(:task) { FactoryBot.create(:mdm_task, workspace: workspace)} - let(:user) { FactoryGirl.create(:mdm_user)} + let(:user) { FactoryBot.create(:mdm_user)} subject(:test_object) { DummyClass.new } - let(:workspace) { FactoryGirl.create(:mdm_workspace) } - let(:service) { FactoryGirl.create(:mdm_service, host: FactoryGirl.create(:mdm_host, workspace: workspace)) } - let(:task) { FactoryGirl.create(:mdm_task, workspace: workspace) } + let(:workspace) { FactoryBot.create(:mdm_workspace) } + let(:service) { FactoryBot.create(:mdm_service, host: FactoryBot.create(:mdm_host, workspace: workspace)) } + let(:task) { FactoryBot.create(:mdm_task, workspace: workspace) } let(:login_data) { { diff --git a/spec/lib/msf/core/exploit/auto_target_spec.rb b/spec/lib/msf/core/exploit/auto_target_spec.rb index 65f680063e..84c5a4c5c5 100644 --- a/spec/lib/msf/core/exploit/auto_target_spec.rb +++ b/spec/lib/msf/core/exploit/auto_target_spec.rb @@ -50,7 +50,7 @@ RSpec.describe Msf::Exploit::AutoTarget do describe '#auto_target?' do it 'should return true if the automatic target is selected' do host_addr = '192.168.1.5' - host_obj = FactoryGirl.create(:mdm_host, address: host_addr ) + host_obj = FactoryBot.create(:mdm_host, address: host_addr ) windows_exploit.datastore['TARGET'] = 0 windows_exploit.datastore['WORKSPACE'] = host_obj.workspace.name windows_exploit.datastore['RHOST'] = host_addr @@ -71,7 +71,7 @@ RSpec.describe Msf::Exploit::AutoTarget do context 'finding the target host' do it 'should return a matching Mdm::host if there is one' do host_addr = '192.168.1.5' - host_obj = FactoryGirl.create(:mdm_host, address: host_addr ) + host_obj = FactoryBot.create(:mdm_host, address: host_addr ) windows_exploit.datastore['WORKSPACE'] = host_obj.workspace.name windows_exploit.datastore['RHOST'] = host_addr expect(windows_exploit.auto_target_host).to eq host_obj @@ -84,12 +84,12 @@ RSpec.describe Msf::Exploit::AutoTarget do end context 'filtering targets' do - let(:windows_xp_host) { FactoryGirl.create(:mdm_host, address: '192.168.172.150', os_family: 'Windows', os_name: 'Windows XP' ) } - let(:windows_xp_sp1_host) { FactoryGirl.create(:mdm_host, address: '192.168.172.150', os_family: 'Windows', os_name: 'Windows XP', os_sp: 'SP1' ) } - let(:windows_xp_sp2_host) { FactoryGirl.create(:mdm_host, address: '192.168.172.150', os_family: 'Windows', os_name: 'Windows XP', os_sp: 'SP2' ) } - let(:windows_xp_sp3_host) { FactoryGirl.create(:mdm_host, address: '192.168.172.150', os_family: 'Windows', os_name: 'Windows XP', os_sp: 'SP3' ) } - let(:windows_7_host) { FactoryGirl.create(:mdm_host, address: '192.168.172.150', os_family: 'Windows', os_name: 'Windows 7' ) } - let(:unknown_host) { FactoryGirl.create(:mdm_host, address: '192.168.172.150', os_family: nil ) } + let(:windows_xp_host) { FactoryBot.create(:mdm_host, address: '192.168.172.150', os_family: 'Windows', os_name: 'Windows XP' ) } + let(:windows_xp_sp1_host) { FactoryBot.create(:mdm_host, address: '192.168.172.150', os_family: 'Windows', os_name: 'Windows XP', os_sp: 'SP1' ) } + let(:windows_xp_sp2_host) { FactoryBot.create(:mdm_host, address: '192.168.172.150', os_family: 'Windows', os_name: 'Windows XP', os_sp: 'SP2' ) } + let(:windows_xp_sp3_host) { FactoryBot.create(:mdm_host, address: '192.168.172.150', os_family: 'Windows', os_name: 'Windows XP', os_sp: 'SP3' ) } + let(:windows_7_host) { FactoryBot.create(:mdm_host, address: '192.168.172.150', os_family: 'Windows', os_name: 'Windows 7' ) } + let(:unknown_host) { FactoryBot.create(:mdm_host, address: '192.168.172.150', os_family: nil ) } let(:potential_targets) { windows_exploit.filter_by_os_family(windows_xp_host) } let(:xp_targets) { windows_exploit.filter_by_os_name(potential_targets,windows_xp_host) } @@ -182,4 +182,4 @@ RSpec.describe Msf::Exploit::AutoTarget do -end \ No newline at end of file +end diff --git a/spec/lib/msf/core/module_set_spec.rb b/spec/lib/msf/core/module_set_spec.rb index db38186dfb..a8d075818b 100644 --- a/spec/lib/msf/core/module_set_spec.rb +++ b/spec/lib/msf/core/module_set_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Msf::ModuleSet do } let(:module_type) { - FactoryGirl.generate :mdm_module_detail_mtype + FactoryBot.generate :mdm_module_detail_mtype } context '#rank_modules' do @@ -207,4 +207,4 @@ RSpec.describe Msf::ModuleSet do end end end -end \ No newline at end of file +end diff --git a/spec/lib/msf/db_manager/export_spec.rb b/spec/lib/msf/db_manager/export_spec.rb index 7118765db5..02bdaf89fe 100644 --- a/spec/lib/msf/db_manager/export_spec.rb +++ b/spec/lib/msf/db_manager/export_spec.rb @@ -14,7 +14,7 @@ RSpec.describe Msf::DBManager::Export do end let(:workspace) do - FactoryGirl.create( + FactoryBot.create( :mdm_workspace ) end @@ -42,7 +42,7 @@ RSpec.describe Msf::DBManager::Export do end let!(:module_details) do - FactoryGirl.create_list( + FactoryBot.create_list( :mdm_module_detail, module_detail_count ) diff --git a/spec/lib/msf/ui/console/command_dispatcher/creds_spec.rb b/spec/lib/msf/ui/console/command_dispatcher/creds_spec.rb index 8fb4534f0d..990e9ddb39 100644 --- a/spec/lib/msf/ui/console/command_dispatcher/creds_spec.rb +++ b/spec/lib/msf/ui/console/command_dispatcher/creds_spec.rb @@ -30,30 +30,30 @@ RSpec.describe Msf::Ui::Console::CommandDispatcher::Creds do let(:nonblank_username) { 'nonblank_user' } let(:nonblank_password) { 'nonblank_pass' } - let!(:origin) { FactoryGirl.create(:metasploit_credential_origin_import) } + let!(:origin) { FactoryBot.create(:metasploit_credential_origin_import) } - let!(:priv) { FactoryGirl.create(:metasploit_credential_password, data: password) } - let!(:pub) { FactoryGirl.create(:metasploit_credential_username, username: username) } - let!(:blank_pub) { blank_pub = FactoryGirl.create(:metasploit_credential_blank_username) } - let!(:nonblank_priv) { FactoryGirl.create(:metasploit_credential_password, data: nonblank_password) } - let!(:nonblank_pub) { FactoryGirl.create(:metasploit_credential_username, username: nonblank_username) } - let!(:blank_priv) { FactoryGirl.create(:metasploit_credential_password, data: blank_password) } + let!(:priv) { FactoryBot.create(:metasploit_credential_password, data: password) } + let!(:pub) { FactoryBot.create(:metasploit_credential_username, username: username) } + let!(:blank_pub) { blank_pub = FactoryBot.create(:metasploit_credential_blank_username) } + let!(:nonblank_priv) { FactoryBot.create(:metasploit_credential_password, data: nonblank_password) } + let!(:nonblank_pub) { FactoryBot.create(:metasploit_credential_username, username: nonblank_username) } + let!(:blank_priv) { FactoryBot.create(:metasploit_credential_password, data: blank_password) } before(:example) do - FactoryGirl.create(:metasploit_credential_core, + FactoryBot.create(:metasploit_credential_core, origin: origin, private: priv, public: pub, realm: nil, workspace: framework.db.workspace) - FactoryGirl.create(:metasploit_credential_core, + FactoryBot.create(:metasploit_credential_core, origin: origin, private: nonblank_priv, public: blank_pub, realm: nil, workspace: framework.db.workspace) - FactoryGirl.create(:metasploit_credential_core, + FactoryBot.create(:metasploit_credential_core, origin: origin, private: blank_priv, public: nonblank_pub, @@ -167,12 +167,12 @@ RSpec.describe Msf::Ui::Console::CommandDispatcher::Creds do let(:ntlm_hash) { '1443d06412d8c0e6e72c57ef50f76a05:27c433245e4763d074d30a05aae0af2c' } let!(:pub) do - FactoryGirl.create(:metasploit_credential_username, username: username) + FactoryBot.create(:metasploit_credential_username, username: username) end let!(:password_core) do - priv = FactoryGirl.create(:metasploit_credential_password, data: password) - FactoryGirl.create(:metasploit_credential_core, - origin: FactoryGirl.create(:metasploit_credential_origin_import), + priv = FactoryBot.create(:metasploit_credential_password, data: password) + FactoryBot.create(:metasploit_credential_core, + origin: FactoryBot.create(:metasploit_credential_origin_import), private: priv, public: pub, realm: nil, @@ -182,18 +182,18 @@ RSpec.describe Msf::Ui::Console::CommandDispatcher::Creds do # # Somehow this is hitting a unique constraint on Cores with the same # # Public, even though it has a different Private. Skip for now # let!(:ntlm_core) do - # priv = FactoryGirl.create(:metasploit_credential_ntlm_hash, data: ntlm_hash) - # FactoryGirl.create(:metasploit_credential_core, - # origin: FactoryGirl.create(:metasploit_credential_origin_import), + # priv = FactoryBot.create(:metasploit_credential_ntlm_hash, data: ntlm_hash) + # FactoryBot.create(:metasploit_credential_core, + # origin: FactoryBot.create(:metasploit_credential_origin_import), # private: priv, # public: pub, # realm: nil, # workspace: framework.db.workspace) # end # let!(:nonreplayable_core) do - # priv = FactoryGirl.create(:metasploit_credential_nonreplayable_hash, data: 'asdf') - # FactoryGirl.create(:metasploit_credential_core, - # origin: FactoryGirl.create(:metasploit_credential_origin_import), + # priv = FactoryBot.create(:metasploit_credential_nonreplayable_hash, data: 'asdf') + # FactoryBot.create(:metasploit_credential_core, + # origin: FactoryBot.create(:metasploit_credential_origin_import), # private: priv, # public: pub, # realm: nil, @@ -241,9 +241,9 @@ RSpec.describe Msf::Ui::Console::CommandDispatcher::Creds do end end describe 'Adding' do - let(:pub) { FactoryGirl.create(:metasploit_credential_username, username: username) } - let(:priv) { FactoryGirl.create(:metasploit_credential_password, data: password) } - let(:r) { FactoryGirl.create(:metasploit_credential_realm, key: realm_type, value: realm) } + let(:pub) { FactoryBot.create(:metasploit_credential_username, username: username) } + let(:priv) { FactoryBot.create(:metasploit_credential_password, data: password) } + let(:r) { FactoryBot.create(:metasploit_credential_realm, key: realm_type, value: realm) } context 'Cores with public privates and realms' do context 'username password and realm' do it 'creates a core if one does not exist' do @@ -252,8 +252,8 @@ RSpec.describe Msf::Ui::Console::CommandDispatcher::Creds do }.to change { Metasploit::Credential::Core.count }.by 1 end it 'does not create a core if it already exists' do - FactoryGirl.create(:metasploit_credential_core, - origin: FactoryGirl.create(:metasploit_credential_origin_import), + FactoryBot.create(:metasploit_credential_core, + origin: FactoryBot.create(:metasploit_credential_origin_import), private: priv, public: pub, realm: r, @@ -270,8 +270,8 @@ RSpec.describe Msf::Ui::Console::CommandDispatcher::Creds do }.to change { Metasploit::Credential::Core.count }.by 1 end it 'does not create a core if it already exists' do - FactoryGirl.create(:metasploit_credential_core, - origin: FactoryGirl.create(:metasploit_credential_origin_import), + FactoryBot.create(:metasploit_credential_core, + origin: FactoryBot.create(:metasploit_credential_origin_import), private: nil, public: pub, realm: r, @@ -289,8 +289,8 @@ RSpec.describe Msf::Ui::Console::CommandDispatcher::Creds do }.to change { Metasploit::Credential::Core.count }.by 1 end it 'does not create a core if it already exists' do - FactoryGirl.create(:metasploit_credential_core, - origin: FactoryGirl.create(:metasploit_credential_origin_import), + FactoryBot.create(:metasploit_credential_core, + origin: FactoryBot.create(:metasploit_credential_origin_import), private: priv, public: pub, realm: nil, @@ -308,8 +308,8 @@ RSpec.describe Msf::Ui::Console::CommandDispatcher::Creds do }.to change { Metasploit::Credential::Core.count }.by 1 end it 'does not create a core if it already exists' do - FactoryGirl.create(:metasploit_credential_core, - origin: FactoryGirl.create(:metasploit_credential_origin_import), + FactoryBot.create(:metasploit_credential_core, + origin: FactoryBot.create(:metasploit_credential_origin_import), private: priv, public: nil, realm: r, @@ -327,8 +327,8 @@ RSpec.describe Msf::Ui::Console::CommandDispatcher::Creds do }.to change { Metasploit::Credential::Core.count }.by 1 end it 'does not create a core if it already exists' do - FactoryGirl.create(:metasploit_credential_core, - origin: FactoryGirl.create(:metasploit_credential_origin_import), + FactoryBot.create(:metasploit_credential_core, + origin: FactoryBot.create(:metasploit_credential_origin_import), private: nil, public: pub, realm: nil, @@ -346,8 +346,8 @@ RSpec.describe Msf::Ui::Console::CommandDispatcher::Creds do }.to change { Metasploit::Credential::Core.count }.by 1 end it 'does not create a core if it already exists' do - FactoryGirl.create(:metasploit_credential_core, - origin: FactoryGirl.create(:metasploit_credential_origin_import), + FactoryBot.create(:metasploit_credential_core, + origin: FactoryBot.create(:metasploit_credential_origin_import), private: priv, public: nil, realm: nil, @@ -358,15 +358,15 @@ RSpec.describe Msf::Ui::Console::CommandDispatcher::Creds do end end context 'ntlm' do - let(:priv) { FactoryGirl.create(:metasploit_credential_ntlm_hash) } + let(:priv) { FactoryBot.create(:metasploit_credential_ntlm_hash) } it 'creates a core if one does not exist' do expect { creds.cmd_creds('add', "ntlm:#{priv.data}") }.to change { Metasploit::Credential::Core.count }.by 1 end it 'does not create a core if it already exists' do - FactoryGirl.create(:metasploit_credential_core, - origin: FactoryGirl.create(:metasploit_credential_origin_import), + FactoryBot.create(:metasploit_credential_core, + origin: FactoryBot.create(:metasploit_credential_origin_import), private: priv, public: nil, realm: nil, @@ -377,15 +377,15 @@ RSpec.describe Msf::Ui::Console::CommandDispatcher::Creds do end end context 'hash' do - let(:priv) { FactoryGirl.create(:metasploit_credential_nonreplayable_hash) } + let(:priv) { FactoryBot.create(:metasploit_credential_nonreplayable_hash) } it 'creates a core if one does not exist' do expect { creds.cmd_creds('add', "hash:#{priv.data}") }.to change { Metasploit::Credential::Core.count }.by 1 end it 'does not create a core if it already exists' do - FactoryGirl.create(:metasploit_credential_core, - origin: FactoryGirl.create(:metasploit_credential_origin_import), + FactoryBot.create(:metasploit_credential_core, + origin: FactoryBot.create(:metasploit_credential_origin_import), private: priv, public: nil, realm: nil, @@ -396,7 +396,7 @@ RSpec.describe Msf::Ui::Console::CommandDispatcher::Creds do end end context 'ssh-key' do - let(:priv) { FactoryGirl.create(:metasploit_credential_ssh_key) } + let(:priv) { FactoryBot.create(:metasploit_credential_ssh_key) } before(:each) do @file = Tempfile.new('id_rsa') @file.write(priv.data) @@ -408,8 +408,8 @@ RSpec.describe Msf::Ui::Console::CommandDispatcher::Creds do }.to change { Metasploit::Credential::Core.count }.by 1 end it 'does not create a core if it already exists' do - FactoryGirl.create(:metasploit_credential_core, - origin: FactoryGirl.create(:metasploit_credential_origin_import), + FactoryBot.create(:metasploit_credential_core, + origin: FactoryBot.create(:metasploit_credential_origin_import), private: priv, public: pub, realm: nil, @@ -423,15 +423,15 @@ RSpec.describe Msf::Ui::Console::CommandDispatcher::Creds do context 'realm-types' do Metasploit::Model::Realm::Key::SHORT_NAMES.each do |short_name, long_name| context "#{short_name}" do - let(:r) { FactoryGirl.create(:metasploit_credential_realm, key: long_name) } + let(:r) { FactoryBot.create(:metasploit_credential_realm, key: long_name) } it 'creates a core if one does not exist' do expect { creds.cmd_creds('add', "realm:#{r.value}", "realm-type:#{short_name}") }.to change { Metasploit::Credential::Core.count }.by 1 end it 'does not create a core if it already exists' do - FactoryGirl.create(:metasploit_credential_core, - origin: FactoryGirl.create(:metasploit_credential_origin_import), + FactoryBot.create(:metasploit_credential_core, + origin: FactoryBot.create(:metasploit_credential_origin_import), private: nil, public: nil, realm: r, diff --git a/spec/lib/msf/ui/console/command_dispatcher/db_spec.rb b/spec/lib/msf/ui/console/command_dispatcher/db_spec.rb index 57f047a3a8..e27f165a07 100644 --- a/spec/lib/msf/ui/console/command_dispatcher/db_spec.rb +++ b/spec/lib/msf/ui/console/command_dispatcher/db_spec.rb @@ -214,10 +214,10 @@ RSpec.describe Msf::Ui::Console::CommandDispatcher::Db do end describe "-p" do before(:example) do - host = FactoryGirl.create(:mdm_host, :workspace => framework.db.workspace, :address => "192.168.0.1") - FactoryGirl.create(:mdm_service, :host => host, :port => 1024, name: 'Service1', proto: 'udp') - FactoryGirl.create(:mdm_service, :host => host, :port => 1025, name: 'Service2', proto: 'tcp') - FactoryGirl.create(:mdm_service, :host => host, :port => 1026, name: 'Service3', proto: 'udp') + host = FactoryBot.create(:mdm_host, :workspace => framework.db.workspace, :address => "192.168.0.1") + FactoryBot.create(:mdm_service, :host => host, :port => 1024, name: 'Service1', proto: 'udp') + FactoryBot.create(:mdm_service, :host => host, :port => 1025, name: 'Service2', proto: 'tcp') + FactoryBot.create(:mdm_service, :host => host, :port => 1026, name: 'Service3', proto: 'udp') end it "should list services that are on a given port" do db.cmd_services "-p", "1024,1025" @@ -234,10 +234,10 @@ RSpec.describe Msf::Ui::Console::CommandDispatcher::Db do end describe "-np" do before(:example) do - host = FactoryGirl.create(:mdm_host, :workspace => framework.db.workspace, :address => "192.168.0.1") - FactoryGirl.create(:mdm_service, :host => host, :port => 1024) - FactoryGirl.create(:mdm_service, :host => host, :port => 1025) - FactoryGirl.create(:mdm_service, :host => host, :port => 1026) + host = FactoryBot.create(:mdm_host, :workspace => framework.db.workspace, :address => "192.168.0.1") + FactoryBot.create(:mdm_service, :host => host, :port => 1024) + FactoryBot.create(:mdm_service, :host => host, :port => 1025) + FactoryBot.create(:mdm_service, :host => host, :port => 1026) end it "should list services that are not on a given port" do skip { diff --git a/spec/support/shared/examples/credential/core/to_credential.rb b/spec/support/shared/examples/credential/core/to_credential.rb index 45577bdddf..0b06241576 100644 --- a/spec/support/shared/examples/credential/core/to_credential.rb +++ b/spec/support/shared/examples/credential/core/to_credential.rb @@ -5,7 +5,7 @@ RSpec.shared_examples_for 'Metasploit::Credential::Core::ToCredential' do context ".to_credential" do subject(:crednetial_core) do - FactoryGirl.create(:metasploit_credential_core) + FactoryBot.create(:metasploit_credential_core) end it { is_expected.to respond_to :to_credential } diff --git a/spec/support/shared/examples/msf/db_manager/exploit_attempt.rb b/spec/support/shared/examples/msf/db_manager/exploit_attempt.rb index 537621b1a8..86162c4a65 100644 --- a/spec/support/shared/examples/msf/db_manager/exploit_attempt.rb +++ b/spec/support/shared/examples/msf/db_manager/exploit_attempt.rb @@ -11,15 +11,15 @@ RSpec.shared_examples_for 'Msf::DBManager::ExploitAttempt' do let(:run) do match - FactoryGirl.create(:automatic_exploitation_run, user: workspace.owner,workspace:workspace, match_set_id: match_set.id) + FactoryBot.create(:automatic_exploitation_run, user: workspace.owner,workspace:workspace, match_set_id: match_set.id) end let(:match_set) do - FactoryGirl.create(:automatic_exploitation_match_set, user: workspace.owner,workspace:workspace) + FactoryBot.create(:automatic_exploitation_match_set, user: workspace.owner,workspace:workspace) end let(:match) do - FactoryGirl.create(:automatic_exploitation_match, + FactoryBot.create(:automatic_exploitation_match, match_set_id: match_set.id, matchable_id:vuln_with_match.id, matchable_type: "Mdm::Vuln" @@ -27,19 +27,19 @@ RSpec.shared_examples_for 'Msf::DBManager::ExploitAttempt' do end let(:vuln_with_match) do - FactoryGirl.create(:mdm_vuln) + FactoryBot.create(:mdm_vuln) end let(:host) do - FactoryGirl.create(:mdm_host, workspace:workspace) + FactoryBot.create(:mdm_host, workspace:workspace) end let(:workspace) do - FactoryGirl.create(:mdm_workspace) + FactoryBot.create(:mdm_workspace) end let(:refs) do - [ FactoryGirl.create(:mdm_ref) ] + [ FactoryBot.create(:mdm_ref) ] end context "with a run" do @@ -137,7 +137,7 @@ RSpec.shared_examples_for 'Msf::DBManager::ExploitAttempt' do context "without a run" do let(:vuln) do - FactoryGirl.create(:mdm_vuln) + FactoryBot.create(:mdm_vuln) end let(:opts) do @@ -226,20 +226,20 @@ RSpec.shared_examples_for 'Msf::DBManager::ExploitAttempt' do end let(:session_id) do - FactoryGirl.create(:session, host: host).id + FactoryBot.create(:session, host: host).id end let(:run) do match - FactoryGirl.create(:automatic_exploitation_run, user: workspace.owner,workspace:workspace, match_set_id: match_set.id) + FactoryBot.create(:automatic_exploitation_run, user: workspace.owner,workspace:workspace, match_set_id: match_set.id) end let(:match_set) do - FactoryGirl.create(:automatic_exploitation_match_set, user: workspace.owner,workspace:workspace) + FactoryBot.create(:automatic_exploitation_match_set, user: workspace.owner,workspace:workspace) end let(:match) do - FactoryGirl.create(:automatic_exploitation_match, + FactoryBot.create(:automatic_exploitation_match, match_set_id: match_set.id, matchable_id:vuln_with_match.id, matchable_type: "Mdm::Vuln" @@ -247,19 +247,19 @@ RSpec.shared_examples_for 'Msf::DBManager::ExploitAttempt' do end let(:vuln_with_match) do - FactoryGirl.create(:mdm_vuln) + FactoryBot.create(:mdm_vuln) end let(:host) do - FactoryGirl.create(:mdm_host, workspace:workspace) + FactoryBot.create(:mdm_host, workspace:workspace) end let(:workspace) do - FactoryGirl.create(:mdm_workspace) + FactoryBot.create(:mdm_workspace) end let(:refs) do - [ FactoryGirl.create(:mdm_ref) ] + [ FactoryBot.create(:mdm_ref) ] end context "with a run" do @@ -357,7 +357,7 @@ RSpec.shared_examples_for 'Msf::DBManager::ExploitAttempt' do context "without a run" do let(:vuln) do - FactoryGirl.create(:mdm_vuln) + FactoryBot.create(:mdm_vuln) end let(:opts) do diff --git a/spec/support/shared/examples/msf/db_manager/import/metasploit_framework/xml.rb b/spec/support/shared/examples/msf/db_manager/import/metasploit_framework/xml.rb index ad5236f5f8..2630a03c63 100644 --- a/spec/support/shared/examples/msf/db_manager/import/metasploit_framework/xml.rb +++ b/spec/support/shared/examples/msf/db_manager/import/metasploit_framework/xml.rb @@ -35,7 +35,7 @@ RSpec.shared_examples_for 'Msf::DBManager::Import::MetasploitFramework::XML' do end let(:host_attributes) do - FactoryGirl.attributes_for(:mdm_host) + FactoryBot.attributes_for(:mdm_host) end let(:msf_web_text_element_names) do @@ -65,15 +65,15 @@ RSpec.shared_examples_for 'Msf::DBManager::Import::MetasploitFramework::XML' do end let(:service_attributes) do - FactoryGirl.attributes_for(:web_service) + FactoryBot.attributes_for(:web_service) end let(:web_form_attributes) do - FactoryGirl.attributes_for(:mdm_web_form, :exported) + FactoryBot.attributes_for(:mdm_web_form, :exported) end let(:web_page_attributes) do - FactoryGirl.attributes_for(:mdm_web_page) + FactoryBot.attributes_for(:mdm_web_page) end let(:workspace) do @@ -304,7 +304,7 @@ RSpec.shared_examples_for 'Msf::DBManager::Import::MetasploitFramework::XML' do end let(:web_vuln) do - FactoryGirl.create(:mdm_web_vuln) + FactoryBot.create(:mdm_web_vuln) end before(:example) do @@ -345,7 +345,7 @@ RSpec.shared_examples_for 'Msf::DBManager::Import::MetasploitFramework::XML' do context 'without :workspace' do let(:workspace) do - FactoryGirl.create(:mdm_workspace) + FactoryBot.create(:mdm_workspace) end before(:example) do @@ -831,7 +831,7 @@ RSpec.shared_examples_for 'Msf::DBManager::Import::MetasploitFramework::XML' do end let(:web_vuln_attributes) do - FactoryGirl.attributes_for(:exported_web_vuln) + FactoryBot.attributes_for(:exported_web_vuln) end subject(:import_msf_web_vuln_element) do @@ -1150,7 +1150,7 @@ RSpec.shared_examples_for 'Msf::DBManager::Import::MetasploitFramework::XML' do end let(:web_vuln) do - FactoryGirl.create(:mdm_web_vuln) + FactoryBot.create(:mdm_web_vuln) end it 'should call #import_msf_web_vuln_element' do diff --git a/spec/support/shared/examples/msf/db_manager/module_cache.rb b/spec/support/shared/examples/msf/db_manager/module_cache.rb index d1c44ad302..1125933fc0 100644 --- a/spec/support/shared/examples/msf/db_manager/module_cache.rb +++ b/spec/support/shared/examples/msf/db_manager/module_cache.rb @@ -20,7 +20,7 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do end let!(:module_details) do - FactoryGirl.create_list( + FactoryBot.create_list( :mdm_module_detail, module_detail_count ) @@ -83,15 +83,15 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do end let(:mtype) do - FactoryGirl.generate :mdm_module_detail_mtype + FactoryBot.generate :mdm_module_detail_mtype end let(:refname) do - FactoryGirl.generate :mdm_module_detail_refname + FactoryBot.generate :mdm_module_detail_refname end let!(:module_detail) do - FactoryGirl.create( + FactoryBot.create( :mdm_module_detail ) end @@ -106,7 +106,7 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do end let!(:module_detail) do - FactoryGirl.create(:mdm_module_detail) + FactoryBot.create(:mdm_module_detail) end context 'with matching Mdm::Module::Detail' do @@ -159,7 +159,7 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do before(:example) do Mdm::Module::Detail::STANCES.each do |stance| - FactoryGirl.create(:mdm_module_detail, :stance => stance) + FactoryBot.create(:mdm_module_detail, :stance => stance) end end @@ -203,7 +203,7 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do end let!(:module_authors) do - FactoryGirl.create_list(:mdm_module_author, 2) + FactoryBot.create_list(:mdm_module_author, 2) end let(:target_module_author) do @@ -258,7 +258,7 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do end let!(:existing_module_details) do - FactoryGirl.create_list(:mdm_module_detail, 2) + FactoryBot.create_list(:mdm_module_detail, 2) end let(:target_module_detail) do @@ -305,7 +305,7 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do context 'with ref keyword' do let(:ref) do - FactoryGirl.generate :mdm_module_ref_name + FactoryBot.generate :mdm_module_ref_name end let(:search_string) do @@ -314,7 +314,7 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do end let!(:module_ref) do - FactoryGirl.create(:mdm_module_ref) + FactoryBot.create(:mdm_module_ref) end context 'with Mdm::Module::Ref#name' do @@ -344,7 +344,7 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do context 'with type keyword' do let(:type) do - FactoryGirl.generate :mdm_module_detail_mtype + FactoryBot.generate :mdm_module_detail_mtype end let(:search_string) do @@ -356,7 +356,7 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do end let!(:all_module_details) do - FactoryGirl.create_list(:mdm_module_detail, 2) + FactoryBot.create_list(:mdm_module_detail, 2) end context 'with Mdm::Module::Ref#name' do @@ -389,7 +389,7 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do end let!(:module_action) do - FactoryGirl.create(:mdm_module_action) + FactoryBot.create(:mdm_module_action) end it 'should match Mdm::Module::Action#name' do @@ -411,7 +411,7 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do end let!(:module_arch) do - FactoryGirl.create(:mdm_module_arch) + FactoryBot.create(:mdm_module_arch) end it 'should match Mdm::Module::Arch#name' do @@ -433,7 +433,7 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do end let!(:module_author) do - FactoryGirl.create(:mdm_module_author) + FactoryBot.create(:mdm_module_author) end it 'should match Mdm::Module::Author#name' do @@ -455,7 +455,7 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do end let!(:all_module_details) do - FactoryGirl.create_list(:mdm_module_detail, 3) + FactoryBot.create_list(:mdm_module_detail, 3) end context 'with #description' do @@ -515,7 +515,7 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do end let!(:module_platform) do - FactoryGirl.create(:mdm_module_platform) + FactoryBot.create(:mdm_module_platform) end it 'should match Mdm::Module::Platform#name' do @@ -537,7 +537,7 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do end let!(:module_ref) do - FactoryGirl.create(:mdm_module_ref) + FactoryBot.create(:mdm_module_ref) end it 'should match Mdm::Module::Ref#name' do @@ -559,7 +559,7 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do end let!(:module_target) do - FactoryGirl.create(:mdm_module_target) + FactoryBot.create(:mdm_module_target) end it 'should match Mdm::Module::Target#name' do @@ -663,7 +663,7 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do let!(:module_detail) do # needs to reference a real module so that it can be loaded - FactoryGirl.create( + FactoryBot.create( :mdm_module_detail, :file => module_pathname.to_path, :mtime => modification_time, @@ -836,15 +836,15 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do end let(:privileged) do - FactoryGirl.generate :mdm_module_detail_privileged + FactoryBot.generate :mdm_module_detail_privileged end let(:rank) do - FactoryGirl.generate :mdm_module_detail_rank + FactoryBot.generate :mdm_module_detail_rank end let(:stance) do - FactoryGirl.generate :mdm_module_detail_stance + FactoryBot.generate :mdm_module_detail_stance end before(:example) do @@ -885,7 +885,7 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do context 'with :action' do let(:name) do - FactoryGirl.generate :mdm_module_action_name + FactoryBot.generate :mdm_module_action_name end let(:bits) do @@ -922,7 +922,7 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do context 'with :arch' do let(:name) do - FactoryGirl.generate :mdm_module_arch_name + FactoryBot.generate :mdm_module_arch_name end let(:bits) do @@ -959,11 +959,11 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do context 'with :author' do let(:email) do - FactoryGirl.generate :mdm_module_author_email + FactoryBot.generate :mdm_module_author_email end let(:name) do - FactoryGirl.generate :mdm_module_author_name + FactoryBot.generate :mdm_module_author_name end let(:bits) do @@ -1011,7 +1011,7 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do end let(:name) do - FactoryGirl.generate :mdm_module_platform_name + FactoryBot.generate :mdm_module_platform_name end it 'should create an Mdm::Module::Platform' do @@ -1048,7 +1048,7 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do end let(:name) do - FactoryGirl.generate :mdm_module_ref_name + FactoryBot.generate :mdm_module_ref_name end it 'should create an Mdm::Module::Ref' do @@ -1086,11 +1086,11 @@ RSpec.shared_examples_for 'Msf::DBManager::ModuleCache' do end let(:index) do - FactoryGirl.generate :mdm_module_target_index + FactoryBot.generate :mdm_module_target_index end let(:name) do - FactoryGirl.generate :mdm_module_target_name + FactoryBot.generate :mdm_module_target_name end it 'should create an Mdm::Module::Target' do diff --git a/spec/support/shared/examples/msf/db_manager/search_modules/mdm_module_platform_name_or_mdm_module_target_name_keyword.rb b/spec/support/shared/examples/msf/db_manager/search_modules/mdm_module_platform_name_or_mdm_module_target_name_keyword.rb index 0abf9541ec..bfc4a0603f 100644 --- a/spec/support/shared/examples/msf/db_manager/search_modules/mdm_module_platform_name_or_mdm_module_target_name_keyword.rb +++ b/spec/support/shared/examples/msf/db_manager/search_modules/mdm_module_platform_name_or_mdm_module_target_name_keyword.rb @@ -5,11 +5,11 @@ RSpec.shared_examples_for 'Msf::DBManager#search_modules Mdm::Module::Platform#n end let!(:module_platform) do - FactoryGirl.create(:mdm_module_platform) + FactoryBot.create(:mdm_module_platform) end let!(:module_target) do - FactoryGirl.create(:mdm_module_target) + FactoryBot.create(:mdm_module_target) end context 'with Mdm::Module::Platform#name' do diff --git a/spec/support/shared/examples/msf/db_manager/search_modules/mdm_module_ref_name_keyword.rb b/spec/support/shared/examples/msf/db_manager/search_modules/mdm_module_ref_name_keyword.rb index 00e708befe..ff2cd55e96 100644 --- a/spec/support/shared/examples/msf/db_manager/search_modules/mdm_module_ref_name_keyword.rb +++ b/spec/support/shared/examples/msf/db_manager/search_modules/mdm_module_ref_name_keyword.rb @@ -5,7 +5,7 @@ RSpec.shared_examples_for 'Msf::DBManager#search_modules Mdm::Module::Ref#name k end let(:name) do - FactoryGirl.generate :mdm_module_ref_name + FactoryBot.generate :mdm_module_ref_name end let(:search_string) do @@ -13,7 +13,7 @@ RSpec.shared_examples_for 'Msf::DBManager#search_modules Mdm::Module::Ref#name k end before(:example) do - FactoryGirl.create(:mdm_module_ref, :name => name) + FactoryBot.create(:mdm_module_ref, :name => name) end name_prefix = "#{keyword.to_s.upcase}-" diff --git a/spec/support/shared/examples/msf/db_manager/session.rb b/spec/support/shared/examples/msf/db_manager/session.rb index dab5c51caa..f9efd15dd9 100644 --- a/spec/support/shared/examples/msf/db_manager/session.rb +++ b/spec/support/shared/examples/msf/db_manager/session.rb @@ -33,7 +33,7 @@ RSpec.shared_examples_for 'Msf::DBManager::Session' do end let(:host) do - FactoryGirl.create(:mdm_host, :workspace => session_workspace) + FactoryBot.create(:mdm_host, :workspace => session_workspace) end let(:module_instance) do @@ -50,7 +50,7 @@ RSpec.shared_examples_for 'Msf::DBManager::Session' do end let(:options_workspace) do - FactoryGirl.create(:mdm_workspace) + FactoryBot.create(:mdm_workspace) end let(:parent_module_fullname) do @@ -95,7 +95,7 @@ RSpec.shared_examples_for 'Msf::DBManager::Session' do end let(:session_workspace) do - FactoryGirl.create(:mdm_workspace) + FactoryBot.create(:mdm_workspace) end before(:example) do @@ -115,7 +115,7 @@ RSpec.shared_examples_for 'Msf::DBManager::Session' do } ) - FactoryGirl.create( + FactoryBot.create( :mdm_module_detail, :fullname => parent_module_fullname, :name => parent_module_name @@ -128,11 +128,11 @@ RSpec.shared_examples_for 'Msf::DBManager::Session' do end let(:match_set) do - FactoryGirl.create(:automatic_exploitation_match_set, user: session_workspace.owner,workspace:session_workspace) + FactoryBot.create(:automatic_exploitation_match_set, user: session_workspace.owner,workspace:session_workspace) end let(:run) do - FactoryGirl.create(:automatic_exploitation_run, workspace: session_workspace, match_set_id: match_set.id) + FactoryBot.create(:automatic_exploitation_run, workspace: session_workspace, match_set_id: match_set.id) end let(:user_data) do @@ -189,7 +189,7 @@ RSpec.shared_examples_for 'Msf::DBManager::Session' do context 'with session responds to arch' do let(:arch) do - FactoryGirl.generate :mdm_host_arch + FactoryBot.generate :mdm_host_arch end before(:example) do @@ -320,7 +320,7 @@ RSpec.shared_examples_for 'Msf::DBManager::Session' do end let(:service) do - FactoryGirl.create( + FactoryBot.create( :mdm_service, :host => host ) @@ -532,7 +532,7 @@ RSpec.shared_examples_for 'Msf::DBManager::Session' do context 'with session responds to arch' do let(:arch) do - FactoryGirl.generate :mdm_host_arch + FactoryBot.generate :mdm_host_arch end before(:example) do @@ -663,7 +663,7 @@ RSpec.shared_examples_for 'Msf::DBManager::Session' do end let(:service) do - FactoryGirl.create( + FactoryBot.create( :mdm_service, :host => host ) @@ -846,7 +846,7 @@ RSpec.shared_examples_for 'Msf::DBManager::Session' do context 'with Mdm::Host' do let(:host) do - FactoryGirl.create(:mdm_host) + FactoryBot.create(:mdm_host) end context 'created Mdm::Session' do @@ -951,7 +951,7 @@ RSpec.shared_examples_for 'Msf::DBManager::Session' do context 'with :routes' do let(:routes) do - FactoryGirl.build_list( + FactoryBot.build_list( :mdm_route, 1, :session => nil diff --git a/spec/support/shared/examples/msf/module_manager/cache.rb b/spec/support/shared/examples/msf/module_manager/cache.rb index ab293818bd..d5dbafba06 100644 --- a/spec/support/shared/examples/msf/module_manager/cache.rb +++ b/spec/support/shared/examples/msf/module_manager/cache.rb @@ -311,7 +311,7 @@ RSpec.shared_examples_for 'Msf::ModuleManager::Cache' do # let!(:mdm_module_detail) do - FactoryGirl.create(:mdm_module_detail, + FactoryBot.create(:mdm_module_detail, :file => path, :mtype => type, :mtime => pathname.mtime,