diff --git a/Gemfile b/Gemfile index 76355a058..c8f2fc27e 100644 --- a/Gemfile +++ b/Gemfile @@ -21,6 +21,7 @@ gem 'term-ansicolor', :require => 'term/ansicolor' gem 'rubyzip', '~> 2.3' gem 'espeak-ruby', '~> 1.1.0' # Text-to-Voice gem 'rake', '~> 13.2' +gem 'activerecord', '~> 7.0' gem 'otr-activerecord', '~> 2.2.0' gem 'sqlite3', '~> 1.4' gem 'rubocop', '~> 1.66.1', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 6f3e432b3..5f3d09c99 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,13 +1,13 @@ GEM remote: https://rubygems.org/ specs: - activemodel (7.1.4) - activesupport (= 7.1.4) - activerecord (7.1.4) - activemodel (= 7.1.4) - activesupport (= 7.1.4) + activemodel (7.1.4.2) + activesupport (= 7.1.4.2) + activerecord (7.1.4.2) + activemodel (= 7.1.4.2) + activesupport (= 7.1.4.2) timeout (>= 0.4.0) - activesupport (7.1.4) + activesupport (7.1.4.2) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -268,6 +268,7 @@ PLATFORMS x86_64-linux DEPENDENCIES + activerecord (~> 7.0) ansi (~> 1.5) async (~> 1.32) async-dns (~> 1.3) diff --git a/spec/beef/core/main/autorun_engine/autorun_engine_spec.rb b/spec/beef/core/main/autorun_engine/autorun_engine_spec.rb index 5d4d99789..f5b621c8c 100644 --- a/spec/beef/core/main/autorun_engine/autorun_engine_spec.rb +++ b/spec/beef/core/main/autorun_engine/autorun_engine_spec.rb @@ -50,7 +50,7 @@ RSpec.describe 'AutoRunEngine Test', run_on_browserstack: true do OTR::ActiveRecord.establish_connection! end context = ActiveRecord::Migration.new.migration_context - ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration).migrate if context.needs_migration? + ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration, context.internal_metadata).migrate if context.needs_migration? BeEF::Core::Migration.instance.update_db! diff --git a/spec/beef/core/main/handlers/browser_details_handler_spec.rb b/spec/beef/core/main/handlers/browser_details_handler_spec.rb index cc172e871..f47deec09 100644 --- a/spec/beef/core/main/handlers/browser_details_handler_spec.rb +++ b/spec/beef/core/main/handlers/browser_details_handler_spec.rb @@ -48,9 +48,9 @@ RSpec.describe 'Browser Details Handler', run_on_browserstack: true do if Gem.loaded_specs['otr-activerecord'].version > Gem::Version.create('1.4.2') OTR::ActiveRecord.establish_connection! end - context = ActiveRecord::Migration.new.migration_context - ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration).migrate if context.needs_migration? + context = ActiveRecord::Migration.new.migration_context + ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration, context.internal_metadata).migrate if context.needs_migration? BeEF::Core::Migration.instance.update_db! # Spawn HTTP Server diff --git a/spec/beef/extensions/requester_spec.rb b/spec/beef/extensions/requester_spec.rb index 6a9298224..4f4d7e929 100644 --- a/spec/beef/extensions/requester_spec.rb +++ b/spec/beef/extensions/requester_spec.rb @@ -40,7 +40,7 @@ RSpec.describe 'BeEF Extension Requester' do # Migrate if required context = ActiveRecord::Migration.new.migration_context - ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration).migrate if context.needs_migration? + ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration, context.internal_metadata).migrate if context.needs_migration? # Start HTTP hook server http_hook_server = BeEF::Core::Server.instance diff --git a/spec/beef/extensions/websocket_hooked_browser_spec.rb b/spec/beef/extensions/websocket_hooked_browser_spec.rb index 774cf1447..7abd8d97c 100644 --- a/spec/beef/extensions/websocket_hooked_browser_spec.rb +++ b/spec/beef/extensions/websocket_hooked_browser_spec.rb @@ -49,7 +49,7 @@ RSpec.describe 'Browser hooking with Websockets', run_on_browserstack: true do OTR::ActiveRecord.establish_connection! end context = ActiveRecord::Migration.new.migration_context - ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration).migrate if context.needs_migration? + ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration, context.internal_metadata).migrate if context.needs_migration? BeEF::Core::Migration.instance.update_db! # Spawn HTTP Server print_info 'Starting HTTP Hook Server' diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index b1e7fce94..1912d331c 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -47,7 +47,7 @@ RSpec.describe 'BeEF Debug Command Modules:', run_on_browserstack: true do OTR::ActiveRecord.establish_connection! end context = ActiveRecord::Migration.new.migration_context - ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration).migrate if context.needs_migration? + ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration, context.internal_metadata).migrate if context.needs_migration? BeEF::Core::Migration.instance.update_db! @@ -90,10 +90,17 @@ RSpec.describe 'BeEF Debug Command Modules:', run_on_browserstack: true do # Grab Command Module IDs as they can differ from machine to machine @debug_mod_ids = JSON.parse(RestClient.get("#{RESTAPI_MODULES}?token=#{@token}")) @debug_mod_names_ids = {} - @debug_mods = @debug_mod_ids.to_a.select { |cmd_mod| cmd_mod[1]['category'] == 'Debug' } - .map do |debug_mod| - @debug_mod_names_ids[debug_mod[1]['class']] = debug_mod[1]['id'] - end + @debug_mods = @debug_mod_ids.to_a.select do |cmd_mod| + category = Array(cmd_mod['category']) + category_string = if category.is_a?(Array) + category.join(', ') + else + category.to_s + end + category_string.include?('Debug') + end.map do |debug_mod| + @debug_mod_names_ids[debug_mod['class']] = debug_mod['id'] + end rescue StandardError => e print_info "Exception: #{e}" print_info "Exception Class: #{e.class}"