Merge pull request #3202 from zinduolis/activerecord_upgrade_to_7_2
Upgrade activerecord to 7.2 and refactor code for new version
This commit is contained in:
2
.github/workflows/github_actions.yml
vendored
2
.github/workflows/github_actions.yml
vendored
@@ -34,7 +34,7 @@ jobs:
|
||||
local-identifier: random
|
||||
|
||||
- name: 'Checkout the repository'
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
fetch-depth: 2
|
||||
|
||||
2
Gemfile
2
Gemfile
@@ -21,7 +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 'activerecord', '~> 7.2'
|
||||
gem 'otr-activerecord', '~> 2.4.0'
|
||||
gem 'sqlite3', '~> 1.4'
|
||||
gem 'rubocop', '~> 1.68.0', require: false
|
||||
|
||||
37
Gemfile.lock
37
Gemfile.lock
@@ -1,22 +1,24 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
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)
|
||||
activemodel (7.2.2)
|
||||
activesupport (= 7.2.2)
|
||||
activerecord (7.2.2)
|
||||
activemodel (= 7.2.2)
|
||||
activesupport (= 7.2.2)
|
||||
timeout (>= 0.4.0)
|
||||
activesupport (7.1.4.2)
|
||||
activesupport (7.2.2)
|
||||
base64
|
||||
benchmark (>= 0.3)
|
||||
bigdecimal
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
concurrent-ruby (~> 1.0, >= 1.3.1)
|
||||
connection_pool (>= 2.2.5)
|
||||
drb
|
||||
i18n (>= 1.6, < 2)
|
||||
logger (>= 1.4.2)
|
||||
minitest (>= 5.1)
|
||||
mutex_m
|
||||
tzinfo (~> 2.0)
|
||||
securerandom (>= 0.3)
|
||||
tzinfo (~> 2.0, >= 2.0.5)
|
||||
addressable (2.8.7)
|
||||
public_suffix (>= 2.0.2, < 7.0)
|
||||
ansi (1.5.0)
|
||||
@@ -32,6 +34,7 @@ GEM
|
||||
async-io (1.43.2)
|
||||
async
|
||||
base64 (0.2.0)
|
||||
benchmark (0.3.0)
|
||||
bigdecimal (3.1.8)
|
||||
browserstack-local (1.4.3)
|
||||
byebug (11.1.3)
|
||||
@@ -102,13 +105,12 @@ GEM
|
||||
msgpack (1.7.3)
|
||||
mustermann (3.0.3)
|
||||
ruby2_keywords (~> 0.0.1)
|
||||
mutex_m (0.2.0)
|
||||
net-protocol (0.2.2)
|
||||
timeout
|
||||
net-smtp (0.5.0)
|
||||
net-protocol
|
||||
netrc (0.11.0)
|
||||
nio4r (2.7.3)
|
||||
nio4r (2.7.4)
|
||||
nokogiri (1.16.7-aarch64-linux)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.16.7-arm-linux)
|
||||
@@ -126,7 +128,7 @@ GEM
|
||||
hashie-forbidden_attributes (~> 0.1)
|
||||
parallel (1.26.3)
|
||||
parseconfig (1.1.2)
|
||||
parser (3.3.5.0)
|
||||
parser (3.3.5.1)
|
||||
ast (~> 2.4.1)
|
||||
racc
|
||||
power_assert (2.0.4)
|
||||
@@ -168,7 +170,7 @@ GEM
|
||||
rspec-core (~> 3.13.0)
|
||||
rspec-expectations (~> 3.13.0)
|
||||
rspec-mocks (~> 3.13.0)
|
||||
rspec-core (3.13.1)
|
||||
rspec-core (3.13.2)
|
||||
rspec-support (~> 3.13.0)
|
||||
rspec-expectations (3.13.3)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
@@ -187,7 +189,7 @@ GEM
|
||||
rubocop-ast (>= 1.32.2, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 2.4.0, < 3.0)
|
||||
rubocop-ast (1.33.0)
|
||||
rubocop-ast (1.33.1)
|
||||
parser (>= 3.3.1.0)
|
||||
ruby-progressbar (1.13.0)
|
||||
ruby2_keywords (0.0.5)
|
||||
@@ -195,6 +197,7 @@ GEM
|
||||
rushover (0.3.0)
|
||||
json
|
||||
rest-client
|
||||
securerandom (0.3.1)
|
||||
selenium-webdriver (4.26.0)
|
||||
base64 (~> 0.2)
|
||||
logger (~> 1.4)
|
||||
@@ -241,7 +244,7 @@ GEM
|
||||
tilt (2.4.0)
|
||||
timeout (0.4.1)
|
||||
timers (4.3.5)
|
||||
tins (1.35.0)
|
||||
tins (1.37.0)
|
||||
bigdecimal
|
||||
sync
|
||||
tzinfo (2.0.6)
|
||||
@@ -249,7 +252,7 @@ GEM
|
||||
uglifier (4.2.1)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
unicode-display_width (2.6.0)
|
||||
webrick (1.8.2)
|
||||
webrick (1.9.0)
|
||||
websocket (1.2.11)
|
||||
websocket-client-simple (0.6.1)
|
||||
event_emitter
|
||||
@@ -268,7 +271,7 @@ PLATFORMS
|
||||
x86_64-linux
|
||||
|
||||
DEPENDENCIES
|
||||
activerecord (~> 7.0)
|
||||
activerecord (~> 7.2)
|
||||
ansi (~> 1.5)
|
||||
async (~> 1.32)
|
||||
async-dns (~> 1.3)
|
||||
|
||||
5
beef
5
beef
@@ -194,7 +194,6 @@ end
|
||||
|
||||
# Connect to DB
|
||||
ActiveRecord::Base.logger = nil
|
||||
OTR::ActiveRecord.migrations_paths = [File.join('core', 'main', 'ar-migrations')]
|
||||
OTR::ActiveRecord.configure_from_hash!(adapter:'sqlite3', database:db_file)
|
||||
# otr-activerecord require you to manually establish the connection with the following line
|
||||
#Also a check to confirm that the correct Gem version is installed to require it, likely easier for old systems.
|
||||
@@ -204,10 +203,12 @@ end
|
||||
|
||||
# Migrate (if required)
|
||||
ActiveRecord::Migration.verbose = false # silence activerecord migration stdout messages
|
||||
context = ActiveRecord::Migration.new.migration_context
|
||||
ActiveRecord::Migrator.migrations_paths = [File.join('core', 'main', 'ar-migrations')]
|
||||
context = ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths)
|
||||
if context.needs_migration?
|
||||
ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration, context.internal_metadata).migrate
|
||||
end
|
||||
|
||||
#
|
||||
# @note Extensions may take a moment to load, thus we print out a please wait message
|
||||
#
|
||||
|
||||
@@ -42,14 +42,14 @@ RSpec.describe 'AutoRunEngine Test', run_on_browserstack: true do
|
||||
|
||||
# Load up DB and migrate if necessary
|
||||
ActiveRecord::Base.logger = nil
|
||||
OTR::ActiveRecord.migrations_paths = [File.join('core', 'main', 'ar-migrations')]
|
||||
OTR::ActiveRecord.configure_from_hash!(adapter: 'sqlite3', database: db_file)
|
||||
# otr-activerecord require you to manually establish the connection with the following line
|
||||
#Also a check to confirm that the correct Gem version is installed to require it, likely easier for old systems.
|
||||
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.migrations_paths = [File.join('core', 'main', 'ar-migrations')]
|
||||
context = ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths)
|
||||
ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration, context.internal_metadata).migrate if context.needs_migration?
|
||||
|
||||
BeEF::Core::Migration.instance.update_db!
|
||||
|
||||
@@ -41,7 +41,6 @@ RSpec.describe 'Browser Details Handler', run_on_browserstack: true do
|
||||
|
||||
# Load up DB and migrate if necessary
|
||||
ActiveRecord::Base.logger = nil
|
||||
OTR::ActiveRecord.migrations_paths = [File.join('core', 'main', 'ar-migrations')]
|
||||
OTR::ActiveRecord.configure_from_hash!(adapter: 'sqlite3', database: db_file)
|
||||
# otr-activerecord require you to manually establish the connection with the following line
|
||||
#Also a check to confirm that the correct Gem version is installed to require it, likely easier for old systems.
|
||||
@@ -49,8 +48,11 @@ RSpec.describe 'Browser Details Handler', run_on_browserstack: true do
|
||||
OTR::ActiveRecord.establish_connection!
|
||||
end
|
||||
|
||||
context = ActiveRecord::Migration.new.migration_context
|
||||
# Migrate (if required)
|
||||
ActiveRecord::Migrator.migrations_paths = [File.join('core', 'main', 'ar-migrations')]
|
||||
context = ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths)
|
||||
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
|
||||
|
||||
@@ -34,12 +34,12 @@ RSpec.describe 'BeEF Extension Requester' do
|
||||
|
||||
# Connect to DB
|
||||
ActiveRecord::Base.logger = nil
|
||||
OTR::ActiveRecord.migrations_paths = [File.join('core', 'main', 'ar-migrations')]
|
||||
OTR::ActiveRecord.configure_from_hash!(adapter: 'sqlite3', database: 'beef.db')
|
||||
OTR::ActiveRecord.establish_connection! if Gem.loaded_specs['otr-activerecord'].version > Gem::Version.create('1.4.2')
|
||||
|
||||
# Migrate if required
|
||||
context = ActiveRecord::Migration.new.migration_context
|
||||
ActiveRecord::Migrator.migrations_paths = [File.join('core', 'main', 'ar-migrations')]
|
||||
context = ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths)
|
||||
ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration, context.internal_metadata).migrate if context.needs_migration?
|
||||
|
||||
# Start HTTP hook server
|
||||
|
||||
@@ -41,15 +41,17 @@ RSpec.describe 'Browser hooking with Websockets', run_on_browserstack: true do
|
||||
end
|
||||
# Load up DB and migrate if necessary
|
||||
ActiveRecord::Base.logger = nil
|
||||
OTR::ActiveRecord.migrations_paths = [File.join('core', 'main', 'ar-migrations')]
|
||||
OTR::ActiveRecord.configure_from_hash!(adapter: 'sqlite3', database: db_file)
|
||||
# otr-activerecord require you to manually establish the connection with the following line
|
||||
#Also a check to confirm that the correct Gem version is installed to require it, likely easier for old systems.
|
||||
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.migrations_paths = [File.join('core', 'main', 'ar-migrations')]
|
||||
context = ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths)
|
||||
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'
|
||||
|
||||
@@ -39,14 +39,15 @@ RSpec.describe 'BeEF Debug Command Modules:', run_on_browserstack: true do
|
||||
|
||||
# Load up DB and migrate if necessary
|
||||
ActiveRecord::Base.logger = nil
|
||||
OTR::ActiveRecord.migrations_paths = [File.join('core', 'main', 'ar-migrations')]
|
||||
OTR::ActiveRecord.configure_from_hash!(adapter: 'sqlite3', database: db_file)
|
||||
# otr-activerecord require you to manually establish the connection with the following line
|
||||
#Also a check to confirm that the correct Gem version is installed to require it, likely easier for old systems.
|
||||
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.migrations_paths = [File.join('core', 'main', 'ar-migrations')]
|
||||
context = ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths)
|
||||
ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration, context.internal_metadata).migrate if context.needs_migration?
|
||||
|
||||
BeEF::Core::Migration.instance.update_db!
|
||||
|
||||
@@ -50,7 +50,6 @@ CONFIG['key'] = ENV['BROWSERSTACK_ACCESS_KEY'] || ''
|
||||
|
||||
## DB config
|
||||
ActiveRecord::Base.logger = nil
|
||||
OTR::ActiveRecord.migrations_paths = [File.join('core', 'main', 'ar-migrations')]
|
||||
OTR::ActiveRecord.configure_from_hash!(adapter: 'sqlite3', database: ':memory:')
|
||||
|
||||
# otr-activerecord requires manually establishing the connection with the following line
|
||||
@@ -62,7 +61,8 @@ ActiveRecord::Schema.verbose = false
|
||||
|
||||
# Migrate (if required)
|
||||
ActiveRecord::Migration.verbose = false # silence activerecord migration stdout messages
|
||||
context = ActiveRecord::Migration.new.migration_context
|
||||
ActiveRecord::Migrator.migrations_paths = [File.join('core', 'main', 'ar-migrations')]
|
||||
context = ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths)
|
||||
if context.needs_migration?
|
||||
ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration, context.internal_metadata).migrate
|
||||
end
|
||||
@@ -160,7 +160,6 @@ require 'socket'
|
||||
|
||||
# Load up DB and migrate if necessary
|
||||
ActiveRecord::Base.logger = nil
|
||||
OTR::ActiveRecord.migrations_paths = [File.join('core', 'main', 'ar-migrations')]
|
||||
OTR::ActiveRecord.configure_from_hash!(adapter:'sqlite3', database: db_file)
|
||||
# otr-activerecord require you to manually establish the connection with the following line
|
||||
#Also a check to confirm that the correct Gem version is installed to require it, likely easier for old systems.
|
||||
@@ -170,10 +169,12 @@ require 'socket'
|
||||
|
||||
# Migrate (if required)
|
||||
ActiveRecord::Migration.verbose = false # silence activerecord migration stdout messages
|
||||
context = ActiveRecord::Migration.new.migration_context
|
||||
ActiveRecord::Migrator.migrations_paths = [File.join('core', 'main', 'ar-migrations')]
|
||||
context = ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths)
|
||||
if context.needs_migration?
|
||||
ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration, context.internal_metadata).migrate
|
||||
end
|
||||
|
||||
BeEF::Core::Migration.instance.update_db!
|
||||
|
||||
# Spawn HTTP Server
|
||||
|
||||
Reference in New Issue
Block a user