diff --git a/Gemfile.lock b/Gemfile.lock index 0c3240580adaf..05c2e06ce1645 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -4,9 +4,9 @@ PATH metasploit-framework (6.4.57) aarch64 abbrev - actionpack (~> 7.0.0) - activerecord (~> 7.0.0) - activesupport (~> 7.0.0) + actionpack (~> 7.1.0) + activerecord (~> 7.1.0) + activesupport (~> 7.1.0) aws-sdk-ec2 aws-sdk-ec2instanceconnect aws-sdk-iam @@ -46,7 +46,7 @@ PATH metasploit-credential metasploit-model metasploit-payloads (= 2.0.189) - metasploit_data_models + metasploit_data_models (>= 6.0.7) metasploit_payloads-mettle (= 1.0.35) mqtt msgpack (~> 1.6.0) @@ -123,28 +123,40 @@ GEM aarch64 (2.1.0) racc (~> 1.6) abbrev (0.1.2) - actionpack (7.0.8.7) - actionview (= 7.0.8.7) - activesupport (= 7.0.8.7) - rack (~> 2.0, >= 2.2.4) + actionpack (7.1.5.1) + actionview (= 7.1.5.1) + activesupport (= 7.1.5.1) + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4) + rack-session (>= 1.0.1) rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actionview (7.0.8.7) - activesupport (= 7.0.8.7) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + actionview (7.1.5.1) + activesupport (= 7.1.5.1) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activemodel (7.0.8.7) - activesupport (= 7.0.8.7) - activerecord (7.0.8.7) - activemodel (= 7.0.8.7) - activesupport (= 7.0.8.7) - activesupport (7.0.8.7) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activemodel (7.1.5.1) + activesupport (= 7.1.5.1) + activerecord (7.1.5.1) + activemodel (= 7.1.5.1) + activesupport (= 7.1.5.1) + timeout (>= 0.4.0) + activesupport (7.1.5.1) + base64 + benchmark (>= 0.3) + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) + mutex_m + securerandom (>= 0.3) tzinfo (~> 2.0) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) @@ -202,6 +214,7 @@ GEM chunky_png (1.4.0) coderay (1.1.3) concurrent-ruby (1.3.4) + connection_pool (2.5.0) cookiejar (0.3.4) crass (1.0.6) csv (3.3.2) @@ -391,8 +404,13 @@ GEM rack-protection (3.2.0) base64 (>= 0.1.0) rack (~> 2.2, >= 2.2.4) + rack-session (1.0.2) + rack (< 3) rack-test (2.2.0) rack (>= 1.3) + rackup (1.0.1) + rack (< 3) + webrick rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -400,13 +418,14 @@ GEM rails-html-sanitizer (1.6.2) loofah (~> 2.21) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) - railties (7.0.8.7) - actionpack (= 7.0.8.7) - activesupport (= 7.0.8.7) - method_source + railties (7.1.5.1) + actionpack (= 7.1.5.1) + activesupport (= 7.1.5.1) + irb + rackup (>= 1.0.0) rake (>= 12.2) - thor (~> 1.0) - zeitwerk (~> 2.5) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.2.1) rasn1 (0.14.0) @@ -527,6 +546,7 @@ GEM sawyer (0.9.2) addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) + securerandom (0.4.1) simplecov (0.18.2) docile (~> 1.1) simplecov-html (~> 0.11) diff --git a/config/application.rb b/config/application.rb index bda8166b912e7..2140840327ec6 100644 --- a/config/application.rb +++ b/config/application.rb @@ -41,18 +41,9 @@ class Application < Rails::Application config.paths['config/database'] = [Metasploit::Framework::Database.configurations_pathname.try(:to_path)] config.autoloader = :zeitwerk - case Rails.env - when "development" - config.eager_load = false - when "test" - config.eager_load = false - when "production" - config.eager_load = false - end - - if ActiveRecord.respond_to?(:legacy_connection_handling=) - ActiveRecord.legacy_connection_handling = false - end + config.load_defaults 7.1 + + config.eager_load = false end end end diff --git a/db/schema.rb b/db/schema.rb index 0c01a8d61cd72..e92a43b8e52f8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2025_02_04_172657) do +ActiveRecord::Schema[7.1].define(version: 2025_02_04_172657) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" diff --git a/lib/metasploit/framework/common_engine.rb b/lib/metasploit/framework/common_engine.rb index 6198dbc176bb2..41d56f69f75c6 100644 --- a/lib/metasploit/framework/common_engine.rb +++ b/lib/metasploit/framework/common_engine.rb @@ -40,10 +40,6 @@ module Metasploit::Framework::CommonEngine config.active_support.deprecation = :stderr - if ActiveRecord.respond_to?(:legacy_connection_handling=) - ActiveRecord.legacy_connection_handling = false - end - # @see https://github.com/rapid7/metasploit_data_models/blob/54a17149d5ccd0830db742d14c4987b48399ceb7/lib/metasploit_data_models/yaml.rb#L10 # @see https://github.com/rapid7/metasploit_data_models/blob/54a17149d5ccd0830db742d14c4987b48399ceb7/lib/metasploit_data_models/base64_serializer.rb#L28-L31 ActiveRecord.yaml_column_permitted_classes = (ActiveRecord.yaml_column_permitted_classes + MetasploitDataModels::YAML::PERMITTED_CLASSES).uniq diff --git a/lib/metasploit/framework/rails_version_constraint.rb b/lib/metasploit/framework/rails_version_constraint.rb index 474a5b494f6cd..c1eb7b389f53d 100644 --- a/lib/metasploit/framework/rails_version_constraint.rb +++ b/lib/metasploit/framework/rails_version_constraint.rb @@ -3,7 +3,7 @@ module Metasploit module Framework module RailsVersionConstraint - RAILS_VERSION = '~> 7.0.0' + RAILS_VERSION = '~> 7.1.0' end end end diff --git a/lib/msf/core/db_manager/connection.rb b/lib/msf/core/db_manager/connection.rb index 97c878b8867d1..edcf05f664584 100644 --- a/lib/msf/core/db_manager/connection.rb +++ b/lib/msf/core/db_manager/connection.rb @@ -116,9 +116,11 @@ def create_db(opts) def connection_established? begin # use with_connection so the connection doesn't stay pinned to the thread. - ApplicationRecord.connection_pool.with_connection { - ApplicationRecord.connection.active? - } + ApplicationRecord.connection_pool.with_connection do + # There's a bug in Rails 7.1 where ApplicationRecord.connection.active? returns false even though we can get a connection + # calling `verify!` instead will ensure we are connected even if `active?` incorrectly returns false + ApplicationRecord.connection.verify! + end rescue ActiveRecord::ConnectionNotEstablished, PG::ConnectionBad => error false end diff --git a/lib/msf/core/db_manager/migration.rb b/lib/msf/core/db_manager/migration.rb index 32f5e0579eb8c..afa2be99e7d70 100644 --- a/lib/msf/core/db_manager/migration.rb +++ b/lib/msf/core/db_manager/migration.rb @@ -69,11 +69,6 @@ def with_migration_context yield ActiveRecord::MigrationContext.new(gather_engine_migration_paths) end - # @return [ActiveRecord::MigrationContext] - def default_migration_context - ActiveRecord::MigrationContext.new(gather_engine_migration_paths, ActiveRecord::SchemaMigration) - end - # Loads gathers migration paths from all loaded Rails engines. # # @return Array[String] diff --git a/lib/msf/core/thread_manager.rb b/lib/msf/core/thread_manager.rb index 7fe59f501805e..9bc89ae37ca6f 100644 --- a/lib/msf/core/thread_manager.rb +++ b/lib/msf/core/thread_manager.rb @@ -111,16 +111,6 @@ def spawn(name, crit, *args, &block) error: e ) raise e - ensure - if framework.db && framework.db.active && framework.db.is_local? - # NOTE: despite the Deprecation Warning's advice, this should *NOT* - # be ApplicationRecord.connection.close which causes unrelated - # threads to raise ActiveRecord::StatementInvalid exceptions at - # some point in the future, presumably due to the pool manager - # believing that the connection is still usable and handing it out - # to another thread. - ::ApplicationRecord.connection_pool.release_connection - end end end else diff --git a/metasploit-framework.gemspec b/metasploit-framework.gemspec index 8fcdd242a3d3d..8c620476dbc70 100644 --- a/metasploit-framework.gemspec +++ b/metasploit-framework.gemspec @@ -69,7 +69,7 @@ Gem::Specification.new do |spec| # Metasploit::Credential database models spec.add_runtime_dependency 'metasploit-credential' # Database models shared between framework and Pro. - spec.add_runtime_dependency 'metasploit_data_models' + spec.add_runtime_dependency 'metasploit_data_models', '>= 6.0.7' # Things that would normally be part of the database model, but which # are needed when there's no database spec.add_runtime_dependency 'metasploit-model' diff --git a/spec/allure_config.rb b/spec/allure_config.rb index 97b9a34df4d57..84b0e33a9f7a2 100644 --- a/spec/allure_config.rb +++ b/spec/allure_config.rb @@ -1,4 +1,6 @@ require "allure-rspec" +require "active_support" +require "active_support/core_ext/object" AllureRspec.configure do |config| config.results_directory = "tmp/allure-raw-data" diff --git a/spec/lib/msf/ui/console/command_dispatcher/db/klist_spec.rb b/spec/lib/msf/ui/console/command_dispatcher/db/klist_spec.rb index d51739d50b8f0..17484ca9813ed 100644 --- a/spec/lib/msf/ui/console/command_dispatcher/db/klist_spec.rb +++ b/spec/lib/msf/ui/console/command_dispatcher/db/klist_spec.rb @@ -209,8 +209,8 @@ def as_ccache(data) ============== id host principal sname enctype issued status path -- ---- --------- ----- ------- ------ ------ ---- - [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} active #{valid_ccache_path} - [id] 192.0.2.24 Administrator@ADF3.LOCAL krbtgt/ADF3.LOCAL@ADF3.LOCAL AES256 #{Time.parse('2022-12-16 12:05:05 +0000').to_time} >>expired<< #{expired_ccache_path} + [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} active #{valid_ccache_path} + [id] 192.0.2.24 Administrator@ADF3.LOCAL krbtgt/ADF3.LOCAL@ADF3.LOCAL AES256 #{Time.parse('2022-12-16 12:05:05 +0000').localtime} >>expired<< #{expired_ccache_path} TABLE end end @@ -223,7 +223,7 @@ def as_ccache(data) ============== id host principal sname enctype issued status path -- ---- --------- ----- ------- ------ ------ ---- - [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} active #{valid_ccache_path} + [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} active #{valid_ccache_path} TABLE end end @@ -270,10 +270,10 @@ def as_ccache(data) Addresses: 0 Authdatas: 0 Times: - Auth time: #{Time.parse('2022-11-28 15:51:29 +0000').to_time} - Start time: #{Time.parse('2022-11-28 15:51:29 +0000').to_time} - End time: #{Time.parse('2032-11-25 15:51:29 +0000').to_time} - Renew Till: #{Time.parse('2032-11-25 15:51:29 +0000').to_time} + Auth time: #{Time.parse('2022-11-28 15:51:29 +0000').localtime} + Start time: #{Time.parse('2022-11-28 15:51:29 +0000').localtime} + End time: #{Time.parse('2032-11-25 15:51:29 +0000').localtime} + Renew Till: #{Time.parse('2032-11-25 15:51:29 +0000').localtime} Ticket: Ticket Version Number: 5 Realm: WINDOMAIN.LOCAL @@ -298,8 +298,8 @@ def as_ccache(data) ============== id host principal sname enctype issued status path -- ---- --------- ----- ------- ------ ------ ---- - [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} active #{old_valid_ccache_path} - [id] 192.0.2.24 Administrator@ADF3.LOCAL krbtgt/ADF3.LOCAL@ADF3.LOCAL AES256 #{Time.parse('2022-12-16 12:05:05 +0000').to_time} >>expired<< #{old_expired_ccache_path} + [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} active #{old_valid_ccache_path} + [id] 192.0.2.24 Administrator@ADF3.LOCAL krbtgt/ADF3.LOCAL@ADF3.LOCAL AES256 #{Time.parse('2022-12-16 12:05:05 +0000').localtime} >>expired<< #{old_expired_ccache_path} Deleted 2 entries TABLE expect(kerberos_ticket_storage.tickets.length).to eq(0) @@ -314,7 +314,7 @@ def as_ccache(data) ============== id host principal sname enctype issued status path -- ---- --------- ----- ------- ------ ------ ---- - [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} active #{valid_ccache_path} + [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} active #{valid_ccache_path} TABLE end end @@ -327,8 +327,8 @@ def as_ccache(data) ============== id host principal sname enctype issued status path -- ---- --------- ----- ------- ------ ------ ---- - [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} active #{valid_ccache_path} - [id] 192.0.2.24 Administrator@ADF3.LOCAL krbtgt/ADF3.LOCAL@ADF3.LOCAL AES256 #{Time.parse('2022-12-16 12:05:05 +0000').to_time} >>expired<< #{expired_ccache_path} + [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} active #{valid_ccache_path} + [id] 192.0.2.24 Administrator@ADF3.LOCAL krbtgt/ADF3.LOCAL@ADF3.LOCAL AES256 #{Time.parse('2022-12-16 12:05:05 +0000').localtime} >>expired<< #{expired_ccache_path} TABLE end end @@ -341,8 +341,8 @@ def as_ccache(data) ============== id host principal sname enctype issued status path -- ---- --------- ----- ------- ------ ------ ---- - [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} active #{valid_ccache_path} - [id] 192.0.2.24 Administrator@ADF3.LOCAL krbtgt/ADF3.LOCAL@ADF3.LOCAL AES256 #{Time.parse('2022-12-16 12:05:05 +0000').to_time} >>expired<< #{expired_ccache_path} + [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} active #{valid_ccache_path} + [id] 192.0.2.24 Administrator@ADF3.LOCAL krbtgt/ADF3.LOCAL@ADF3.LOCAL AES256 #{Time.parse('2022-12-16 12:05:05 +0000').localtime} >>expired<< #{expired_ccache_path} TABLE end end @@ -355,8 +355,8 @@ def as_ccache(data) ============== id host principal sname enctype issued status path -- ---- --------- ----- ------- ------ ------ ---- - [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} active #{valid_ccache_path} - [id] 192.0.2.24 Administrator@ADF3.LOCAL krbtgt/ADF3.LOCAL@ADF3.LOCAL AES256 #{Time.parse('2022-12-16 12:05:05 +0000').to_time} >>expired<< #{expired_ccache_path} + [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} active #{valid_ccache_path} + [id] 192.0.2.24 Administrator@ADF3.LOCAL krbtgt/ADF3.LOCAL@ADF3.LOCAL AES256 #{Time.parse('2022-12-16 12:05:05 +0000').localtime} >>expired<< #{expired_ccache_path} TABLE end end @@ -369,8 +369,8 @@ def as_ccache(data) ============== id host principal sname enctype issued status path -- ---- --------- ----- ------- ------ ------ ---- - [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} active #{valid_ccache_path} - [id] 192.0.2.24 Administrator@ADF3.LOCAL krbtgt/ADF3.LOCAL@ADF3.LOCAL AES256 #{Time.parse('2022-12-16 12:05:05 +0000').to_time} >>expired<< #{expired_ccache_path} + [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} active #{valid_ccache_path} + [id] 192.0.2.24 Administrator@ADF3.LOCAL krbtgt/ADF3.LOCAL@ADF3.LOCAL AES256 #{Time.parse('2022-12-16 12:05:05 +0000').localtime} >>expired<< #{expired_ccache_path} TABLE end end @@ -420,8 +420,8 @@ def as_ccache(data) ============== id host principal sname enctype issued status path -- ---- --------- ----- ------- ------ ------ ---- - [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} inactive #{valid_ccache_path} - [id] 192.0.2.24 Administrator@ADF3.LOCAL krbtgt/ADF3.LOCAL@ADF3.LOCAL AES256 #{Time.parse('2022-12-16 12:05:05 +0000').to_time} >>expired<< #{expired_ccache_path} + [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} inactive #{valid_ccache_path} + [id] 192.0.2.24 Administrator@ADF3.LOCAL krbtgt/ADF3.LOCAL@ADF3.LOCAL AES256 #{Time.parse('2022-12-16 12:05:05 +0000').localtime} >>expired<< #{expired_ccache_path} Deactivated 2 entries TABLE end @@ -441,8 +441,8 @@ def as_ccache(data) ============== id host principal sname enctype issued status path -- ---- --------- ----- ------- ------ ------ ---- - [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} active #{valid_ccache_path} - [id] 192.0.2.24 Administrator@ADF3.LOCAL krbtgt/ADF3.LOCAL@ADF3.LOCAL AES256 #{Time.parse('2022-12-16 12:05:05 +0000').to_time} >>expired<< #{expired_ccache_path} + [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} active #{valid_ccache_path} + [id] 192.0.2.24 Administrator@ADF3.LOCAL krbtgt/ADF3.LOCAL@ADF3.LOCAL AES256 #{Time.parse('2022-12-16 12:05:05 +0000').localtime} >>expired<< #{expired_ccache_path} Activated 2 entries TABLE end @@ -459,7 +459,7 @@ def as_ccache(data) ============== id host principal sname enctype issued status path -- ---- --------- ----- ------- ------ ------ ---- - [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} active #{old_valid_ccache_path} + [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} active #{old_valid_ccache_path} Deleted 1 entry TABLE expect(kerberos_ticket_storage.tickets.length).to eq(1) @@ -474,7 +474,7 @@ def as_ccache(data) ============== id host principal sname enctype issued status path -- ---- --------- ----- ------- ------ ------ ---- - [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} inactive #{valid_ccache_path} + [id] 192.0.2.2 Administrator@WINDOMAIN.LOCAL krbtgt/WINDOMAIN.LOCAL@WINDOMAIN.LOCAL AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} inactive #{valid_ccache_path} Deactivated 1 entry TABLE end diff --git a/spec/modules/auxiliary/admin/kerberos/forge_ticket_spec.rb b/spec/modules/auxiliary/admin/kerberos/forge_ticket_spec.rb index b64200d397767..0ab80e0f3a13f 100644 --- a/spec/modules/auxiliary/admin/kerberos/forge_ticket_spec.rb +++ b/spec/modules/auxiliary/admin/kerberos/forge_ticket_spec.rb @@ -56,10 +56,10 @@ Addresses: 0 Authdatas: 0 Times: - Auth time: #{Time.parse('2022-07-15 13:33:40 +0100').to_time} - Start time: #{Time.parse('2022-07-15 13:33:40 +0100').to_time} - End time: #{Time.parse('2032-07-12 13:33:40 +0100').to_time} - Renew Till: #{Time.parse('2032-07-12 13:33:40 +0100').to_time} + Auth time: #{Time.parse('2022-07-15 13:33:40 +0100').localtime} + Start time: #{Time.parse('2022-07-15 13:33:40 +0100').localtime} + End time: #{Time.parse('2032-07-12 13:33:40 +0100').localtime} + Renew Till: #{Time.parse('2032-07-12 13:33:40 +0100').localtime} Ticket: Ticket Version Number: 5 Realm: DEMO.LOCAL @@ -69,10 +69,10 @@ Key Version Number: 2 Decrypted (with key: 767400b2c71afa35a5dca216f2389cd9): Times: - Auth time: #{Time.parse('2022-07-15 12:33:40 UTC').to_time} - Start time: #{Time.parse('2022-07-15 12:33:40 UTC').to_time} - End time: #{Time.parse('2032-07-12 12:33:40 UTC').to_time} - Renew Till: #{Time.parse('2032-07-12 12:33:40 UTC').to_time} + Auth time: #{Time.parse('2022-07-15 12:33:40 UTC').localtime} + Start time: #{Time.parse('2022-07-15 12:33:40 UTC').localtime} + End time: #{Time.parse('2032-07-12 12:33:40 UTC').localtime} + Renew Till: #{Time.parse('2032-07-12 12:33:40 UTC').localtime} Client Addresses: 0 Transited: tr_type: 0, Contents: "" Client Name: 'Administrator' @@ -82,7 +82,7 @@ Flags: 0x50e00000 (FORWARDABLE, PROXIABLE, RENEWABLE, INITIAL, PRE_AUTHENT) PAC: Validation Info: - Logon Time: #{Time.parse('2022-07-15 13:33:40 +0100').to_time} + Logon Time: #{Time.parse('2022-07-15 13:33:40 +0100').localtime} Logoff Time: Never Expires (inf) Kick Off Time: Never Expires (inf) Password Last Set: No Time Set (0) @@ -185,7 +185,7 @@ Logon Domain Name: 'DEMO.LOCAL' Client Info: Name: 'Administrator' - Client ID: #{Time.parse('2022-07-15 13:33:40 +0100').to_time} + Client ID: #{Time.parse('2022-07-15 13:33:40 +0100').localtime} Pac Requestor: SID: S-1-5-21-1266190811-2419310613-1856291569-500 Pac Attributes: diff --git a/spec/modules/auxiliary/admin/kerberos/inspect_ticket_spec.rb b/spec/modules/auxiliary/admin/kerberos/inspect_ticket_spec.rb index 7c828d93932f5..89f9855729e0e 100644 --- a/spec/modules/auxiliary/admin/kerberos/inspect_ticket_spec.rb +++ b/spec/modules/auxiliary/admin/kerberos/inspect_ticket_spec.rb @@ -475,10 +475,10 @@ Addresses: 0 Authdatas: 0 Times: - Auth time: #{Time.parse('2023-01-13 14:31:25 UTC').to_time} - Start time: #{Time.parse('2023-01-13 14:31:25 UTC').to_time} - End time: #{Time.parse('2033-01-10 14:31:25 UTC').to_time} - Renew Till: #{Time.parse('2033-01-10 14:31:25 UTC').to_time} + Auth time: #{Time.parse('2023-01-13 14:31:25 UTC').localtime} + Start time: #{Time.parse('2023-01-13 14:31:25 UTC').localtime} + End time: #{Time.parse('2033-01-10 14:31:25 UTC').localtime} + Renew Till: #{Time.parse('2033-01-10 14:31:25 UTC').localtime} Ticket: Ticket Version Number: 5 Realm: WINDOMAIN.LOCAL @@ -488,10 +488,10 @@ Key Version Number: 2 Decrypted (with key: 4b912be0366a6f37f4a7d571bee18b1173d93195ef76f8d1e3e81ef6172ab326): Times: - Auth time: #{Time.parse('2023-01-13 14:31:25 UTC').to_time} - Start time: #{Time.parse('2023-01-13 14:31:25 UTC').to_time} - End time: #{Time.parse('2033-01-10 14:31:25 UTC').to_time} - Renew Till: #{Time.parse('2033-01-10 14:31:25 UTC').to_time} + Auth time: #{Time.parse('2023-01-13 14:31:25 UTC').localtime} + Start time: #{Time.parse('2023-01-13 14:31:25 UTC').localtime} + End time: #{Time.parse('2033-01-10 14:31:25 UTC').localtime} + Renew Till: #{Time.parse('2033-01-10 14:31:25 UTC').localtime} Client Addresses: 0 Transited: tr_type: 0, Contents: "" Client Name: 'Administrator' @@ -501,7 +501,7 @@ Flags: 0x50a00000 (FORWARDABLE, PROXIABLE, RENEWABLE, PRE_AUTHENT) PAC: Validation Info: - Logon Time: #{Time.parse('2023-01-13 14:31:25 UTC').to_time} + Logon Time: #{Time.parse('2023-01-13 14:31:25 UTC').localtime} Logoff Time: Never Expires (inf) Kick Off Time: Never Expires (inf) Password Last Set: No Time Set (0) @@ -602,7 +602,7 @@ Logon Domain Name: 'WINDOMAIN.LOCAL' Client Info: Name: 'Administrator' - Client ID: #{Time.parse('2023-01-13 14:31:25 UTC').to_time} + Client ID: #{Time.parse('2023-01-13 14:31:25 UTC').localtime} Pac Server Checksum: Signature: 81a20da731b3b9bdd2e756dc Pac Privilege Server Checksum: @@ -630,10 +630,10 @@ Addresses: 0 Authdatas: 0 Times: - Auth time: #{Time.parse('2023-01-13 14:31:25 UTC').to_time} - Start time: #{Time.parse('2023-01-13 14:31:25 UTC').to_time} - End time: #{Time.parse('2033-01-10 14:31:25 UTC').to_time} - Renew Till: #{Time.parse('2033-01-10 14:31:25 UTC').to_time} + Auth time: #{Time.parse('2023-01-13 14:31:25 UTC').localtime} + Start time: #{Time.parse('2023-01-13 14:31:25 UTC').localtime} + End time: #{Time.parse('2033-01-10 14:31:25 UTC').localtime} + Renew Till: #{Time.parse('2033-01-10 14:31:25 UTC').localtime} Ticket: Ticket Version Number: 5 Realm: WINDOMAIN.LOCAL @@ -665,10 +665,10 @@ Addresses: 0 Authdatas: 0 Times: - Auth time: #{Time.parse('2023-01-13 14:36:39 UTC').to_time} - Start time: #{Time.parse('2023-01-13 14:36:39 UTC').to_time} - End time: #{Time.parse('2033-01-10 14:36:39 UTC').to_time} - Renew Till: #{Time.parse('2033-01-10 14:36:39 UTC').to_time} + Auth time: #{Time.parse('2023-01-13 14:36:39 UTC').localtime} + Start time: #{Time.parse('2023-01-13 14:36:39 UTC').localtime} + End time: #{Time.parse('2033-01-10 14:36:39 UTC').localtime} + Renew Till: #{Time.parse('2033-01-10 14:36:39 UTC').localtime} Ticket: Ticket Version Number: 5 Realm: WINDOMAIN.LOCAL @@ -678,10 +678,10 @@ Key Version Number: 2 Decrypted (with key: 88e4d9fabaecf3dec18dd80905521b29): Times: - Auth time: #{Time.parse('2023-01-13 14:36:39 UTC').to_time} - Start time: #{Time.parse('2023-01-13 14:36:39 UTC').to_time} - End time: #{Time.parse('2033-01-10 14:36:39 UTC').to_time} - Renew Till: #{Time.parse('2033-01-10 14:36:39 UTC').to_time} + Auth time: #{Time.parse('2023-01-13 14:36:39 UTC').localtime} + Start time: #{Time.parse('2023-01-13 14:36:39 UTC').localtime} + End time: #{Time.parse('2033-01-10 14:36:39 UTC').localtime} + Renew Till: #{Time.parse('2033-01-10 14:36:39 UTC').localtime} Client Addresses: 0 Transited: tr_type: 0, Contents: "" Client Name: 'Administrator' @@ -691,7 +691,7 @@ Flags: 0x50a00000 (FORWARDABLE, PROXIABLE, RENEWABLE, PRE_AUTHENT) PAC: Validation Info: - Logon Time: #{Time.parse('2023-01-13 14:36:39 UTC').to_time} + Logon Time: #{Time.parse('2023-01-13 14:36:39 UTC').localtime} Logoff Time: Never Expires (inf) Kick Off Time: Never Expires (inf) Password Last Set: No Time Set (0) @@ -792,7 +792,7 @@ Logon Domain Name: 'WINDOMAIN.LOCAL' Client Info: Name: 'Administrator' - Client ID: #{Time.parse('2023-01-13 14:36:39 UTC').to_time} + Client ID: #{Time.parse('2023-01-13 14:36:39 UTC').localtime} Pac Server Checksum: Signature: 1a038d8dd257a7d9b875280259ab0e4a Pac Privilege Server Checksum: @@ -820,10 +820,10 @@ Addresses: 0 Authdatas: 0 Times: - Auth time: #{Time.parse('2023-01-13 14:36:39 UTC').to_time} - Start time: #{Time.parse('2023-01-13 14:36:39 UTC').to_time} - End time: #{Time.parse('2033-01-10 14:36:39 UTC').to_time} - Renew Till: #{Time.parse('2033-01-10 14:36:39 UTC').to_time} + Auth time: #{Time.parse('2023-01-13 14:36:39 UTC').localtime} + Start time: #{Time.parse('2023-01-13 14:36:39 UTC').localtime} + End time: #{Time.parse('2033-01-10 14:36:39 UTC').localtime} + Renew Till: #{Time.parse('2033-01-10 14:36:39 UTC').localtime} Ticket: Ticket Version Number: 5 Realm: WINDOMAIN.LOCAL diff --git a/spec/modules/auxiliary/admin/kerberos/keytab_spec.rb b/spec/modules/auxiliary/admin/kerberos/keytab_spec.rb index cc3e2bd9496fe..be37ba0d32e45 100644 --- a/spec/modules/auxiliary/admin/kerberos/keytab_spec.rb +++ b/spec/modules/auxiliary/admin/kerberos/keytab_spec.rb @@ -79,7 +79,7 @@ kvno type principal hash date ---- ---- --------- ---- ---- - 1 18 (AES256) Administrator@DOMAIN.LOCAL c4a3f31d64afa648a6d08d0776563e1238b976d0b90f79ea072194368294e929 #{Time.parse('1970-01-01 00:00:00 +0000').to_time} + 1 18 (AES256) Administrator@DOMAIN.LOCAL c4a3f31d64afa648a6d08d0776563e1238b976d0b90f79ea072194368294e929 #{Time.parse('1970-01-01 00:00:00 +0000').localtime} TABLE end end @@ -101,11 +101,11 @@ kvno type principal hash date ---- ---- --------- ---- ---- - 1 3 (DES_CBC_MD5) Administrator@DOMAIN.LOCAL 89d3b923d6a7195e #{Time.parse('1970-01-01 00:00:00 +0000').to_time} - 1 16 (DES3_CBC_SHA1) Administrator@DOMAIN.LOCAL 341994e0ba5b1a20d640911cda23c137b637d51a6416d6cb #{Time.parse('1970-01-01 00:00:00 +0000').to_time} - 1 23 (RC4_HMAC) Administrator@DOMAIN.LOCAL 8846f7eaee8fb117ad06bdd830b7586c #{Time.parse('1970-01-01 00:00:00 +0000').to_time} - 1 17 (AES128) Administrator@DOMAIN.LOCAL baba43a8b97baca153bd54b2f0774ad7 #{Time.parse('1970-01-01 00:00:00 +0000').to_time} - 1 18 (AES256) Administrator@DOMAIN.LOCAL c4a3f31d64afa648a6d08d0776563e1238b976d0b90f79ea072194368294e929 #{Time.parse('1970-01-01 00:00:00 +0000').to_time} + 1 3 (DES_CBC_MD5) Administrator@DOMAIN.LOCAL 89d3b923d6a7195e #{Time.parse('1970-01-01 00:00:00 +0000').localtime} + 1 16 (DES3_CBC_SHA1) Administrator@DOMAIN.LOCAL 341994e0ba5b1a20d640911cda23c137b637d51a6416d6cb #{Time.parse('1970-01-01 00:00:00 +0000').localtime} + 1 23 (RC4_HMAC) Administrator@DOMAIN.LOCAL 8846f7eaee8fb117ad06bdd830b7586c #{Time.parse('1970-01-01 00:00:00 +0000').localtime} + 1 17 (AES128) Administrator@DOMAIN.LOCAL baba43a8b97baca153bd54b2f0774ad7 #{Time.parse('1970-01-01 00:00:00 +0000').localtime} + 1 18 (AES256) Administrator@DOMAIN.LOCAL c4a3f31d64afa648a6d08d0776563e1238b976d0b90f79ea072194368294e929 #{Time.parse('1970-01-01 00:00:00 +0000').localtime} TABLE end @@ -128,7 +128,7 @@ kvno type principal hash date ---- ---- --------- ---- ---- - 1 18 (AES256) Administrator@DOMAIN.LOCAL c4a3f31d64afa648a6d08d0776563e1238b976d0b90f79ea072194368294e929 #{Time.parse('1970-01-01 00:00:00 +0000').to_time} + 1 18 (AES256) Administrator@DOMAIN.LOCAL c4a3f31d64afa648a6d08d0776563e1238b976d0b90f79ea072194368294e929 #{Time.parse('1970-01-01 00:00:00 +0000').localtime} TABLE end end @@ -157,10 +157,10 @@ kvno type principal hash date ---- ---- --------- ---- ---- - 1 18 (AES256) Administrator@DOMAIN.LOCAL c4a3f31d64afa648a6d08d0776563e1238b976d0b90f79ea072194368294e929 #{Time.parse('2022-10-01 17:51:29 +0000').to_time} - 1 17 (AES128) Administrator@DOMAIN.LOCAL baba43a8b97baca153bd54b2f0774ad7 #{Time.parse('2022-10-01 17:51:29 +0000').to_time} - 1 23 (RC4_HMAC) Administrator@DOMAIN.LOCAL 8846f7eaee8fb117ad06bdd830b7586c #{Time.parse('2022-10-01 17:51:29 +0000').to_time} - 1 18 (AES256) Administrator@DOMAIN.LOCAL c4a3f31d64afa648a6d08d0776563e1238b976d0b90f79ea072194368294e929 #{Time.parse('1970-01-01 00:00:00 +0000').to_time} + 1 18 (AES256) Administrator@DOMAIN.LOCAL c4a3f31d64afa648a6d08d0776563e1238b976d0b90f79ea072194368294e929 #{Time.parse('2022-10-01 17:51:29 +0000').localtime} + 1 17 (AES128) Administrator@DOMAIN.LOCAL baba43a8b97baca153bd54b2f0774ad7 #{Time.parse('2022-10-01 17:51:29 +0000').localtime} + 1 23 (RC4_HMAC) Administrator@DOMAIN.LOCAL 8846f7eaee8fb117ad06bdd830b7586c #{Time.parse('2022-10-01 17:51:29 +0000').localtime} + 1 18 (AES256) Administrator@DOMAIN.LOCAL c4a3f31d64afa648a6d08d0776563e1238b976d0b90f79ea072194368294e929 #{Time.parse('1970-01-01 00:00:00 +0000').localtime} TABLE end end @@ -188,9 +188,9 @@ kvno type principal hash date ---- ---- --------- ---- ---- - 1 18 (AES256) Administrator@DOMAIN.LOCAL c4a3f31d64afa648a6d08d0776563e1238b976d0b90f79ea072194368294e929 #{Time.parse('2022-10-01 17:51:29 +0000').to_time} - 1 17 (AES128) Administrator@DOMAIN.LOCAL baba43a8b97baca153bd54b2f0774ad7 #{Time.parse('2022-10-01 17:51:29 +0000').to_time} - 1 23 (RC4_HMAC) Administrator@DOMAIN.LOCAL 8846f7eaee8fb117ad06bdd830b7586c #{Time.parse('2022-10-01 17:51:29 +0000').to_time} + 1 18 (AES256) Administrator@DOMAIN.LOCAL c4a3f31d64afa648a6d08d0776563e1238b976d0b90f79ea072194368294e929 #{Time.parse('2022-10-01 17:51:29 +0000').localtime} + 1 17 (AES128) Administrator@DOMAIN.LOCAL baba43a8b97baca153bd54b2f0774ad7 #{Time.parse('2022-10-01 17:51:29 +0000').localtime} + 1 23 (RC4_HMAC) Administrator@DOMAIN.LOCAL 8846f7eaee8fb117ad06bdd830b7586c #{Time.parse('2022-10-01 17:51:29 +0000').localtime} TABLE end @@ -295,9 +295,9 @@ def report_creds( kvno type principal hash date ---- ---- --------- ---- ---- - 1 23 (RC4_HMAC) user_without_realm@ e02bc503339d51f71d913c245d35b50b #{Time.parse('1970-01-01 01:00:00 +0100').to_time} - 1 23 (RC4_HMAC) user_with_realm@example.local 32ede47af254546a82b1743953cc4950 #{Time.parse('1970-01-01 01:00:00 +0100').to_time} - 1 18 (AES256) user_with_krbkey@demo.local 63346133663331643634616661363438613664303864303737363536336531323338623937366430623930663739656130373231393433363832393465393239 #{Time.parse('1970-01-01 01:00:00 +0100').to_time} + 1 23 (RC4_HMAC) user_without_realm@ e02bc503339d51f71d913c245d35b50b #{Time.parse('1970-01-01 01:00:00 +0100').localtime} + 1 23 (RC4_HMAC) user_with_realm@example.local 32ede47af254546a82b1743953cc4950 #{Time.parse('1970-01-01 01:00:00 +0100').localtime} + 1 18 (AES256) user_with_krbkey@demo.local 63346133663331643634616661363438613664303864303737363536336531323338623937366430623930663739656130373231393433363832393465393239 #{Time.parse('1970-01-01 01:00:00 +0100').localtime} TABLE end diff --git a/spec/support/shared/examples/credential/core/to_credential.rb b/spec/support/shared/examples/credential/core/to_credential.rb index 0b0624157632b..552f29a3148e5 100644 --- a/spec/support/shared/examples/credential/core/to_credential.rb +++ b/spec/support/shared/examples/credential/core/to_credential.rb @@ -3,23 +3,28 @@ RSpec.shared_examples_for 'Metasploit::Credential::Core::ToCredential' do context "methods" do context ".to_credential" do + let!(:origin) { FactoryBot.create(:metasploit_credential_origin_import) } + let!(:workspace) { FactoryBot.create(:mdm_workspace) } - subject(:crednetial_core) do - FactoryBot.create(:metasploit_credential_core) + + subject(:credential_core) do + FactoryBot.create(:metasploit_credential_core, + origin: origin, + workspace: workspace) end it { is_expected.to respond_to :to_credential } it "should return a Metasploit::Framework::Credential" do expect( - crednetial_core.to_credential + credential_core.to_credential ).to be_a Metasploit::Framework::Credential end it "should set the parent to the credential object" do expect( - crednetial_core.to_credential.parent - ).to eq(crednetial_core) + credential_core.to_credential.parent + ).to eq(credential_core) end end end diff --git a/spec/support/shared/examples/msf/db_manager/migration.rb b/spec/support/shared/examples/msf/db_manager/migration.rb index 1b3a8c2d8dc92..cde402a12cd0a 100644 --- a/spec/support/shared/examples/msf/db_manager/migration.rb +++ b/spec/support/shared/examples/msf/db_manager/migration.rb @@ -55,7 +55,7 @@ def migrate end before(:example) do - mockContext = ActiveRecord::MigrationContext.new(nil, ActiveRecord::SchemaMigration) + mockContext = ActiveRecord::MigrationContext.new(nil) expect(ActiveRecord::MigrationContext).to receive(:new).and_return(mockContext) expect(mockContext).to receive(:needs_migration?).and_return(true) expect(mockContext).to receive(:migrate).and_raise(standard_error)