From 9b5c8e39df6ff53e82b7293d99304bd4f7a9540a Mon Sep 17 00:00:00 2001 From: Jess Date: Thu, 14 Nov 2019 22:09:44 -0800 Subject: [PATCH] Syntax changes --- extensions/autoloader/model.rb | 12 ++--- extensions/dns/model.rb | 19 +++----- extensions/ipec/models/ipec_exploits.rb | 18 +++----- extensions/ipec/models/ipec_exploits_run.rb | 14 +++--- extensions/network/models/network_host.rb | 23 ++++------ extensions/network/models/network_service.rb | 20 ++++----- extensions/requester/models/http.rb | 44 ++++++++----------- .../social_engineering/models/interceptor.rb | 13 ++---- .../social_engineering/models/mass_mailer.rb | 8 +--- .../social_engineering/models/web_cloner.rb | 16 +++---- extensions/webrtc/models/rtcmanage.rb | 17 +++---- extensions/webrtc/models/rtcmodulestatus.rb | 24 +++++----- extensions/webrtc/models/rtcsignal.rb | 18 +++----- extensions/webrtc/models/rtcstatus.rb | 20 ++++----- extensions/xssrays/models/xssraysdetail.rb | 17 +++---- extensions/xssrays/models/xssraysscan.rb | 27 +++++------- spec/beef/api/auth_rate_spec.rb | 6 ++- .../core/main/models/browser_details_spec.rb | 6 ++- spec/beef/extensions/dns_spec.rb | 9 ++-- spec/beef/extensions/ipec_tunnel_spec.rb | 6 ++- spec/beef/extensions/network_spec.rb | 6 ++- spec/beef/extensions/proxy_spec.rb | 6 ++- spec/beef/extensions/qrcode_spec.rb | 6 ++- spec/beef/extensions/requester_spec.rb | 6 ++- spec/beef/extensions/webrtc_spec.rb | 6 ++- spec/beef/extensions/xssrays_spec.rb | 6 ++- test/integration/tc_proxy.rb | 8 ++-- 27 files changed, 164 insertions(+), 217 deletions(-) diff --git a/extensions/autoloader/model.rb b/extensions/autoloader/model.rb index 15ecb9bea..f98197775 100644 --- a/extensions/autoloader/model.rb +++ b/extensions/autoloader/model.rb @@ -7,14 +7,10 @@ module BeEF module Core module Models -class Autoloading - - include DataMapper::Resource - - storage_names[:default] = 'autoloading' - - property :id, Serial - property :in_use, Boolean +class Autoloading < ActiveRecord::Base + + attribute :id, :Serial + attribute :in_use, :Boolean belongs_to :command diff --git a/extensions/dns/model.rb b/extensions/dns/model.rb index 9e899c008..befc2ff37 100644 --- a/extensions/dns/model.rb +++ b/extensions/dns/model.rb @@ -9,19 +9,14 @@ module BeEF module Dns # Represents an individual DNS rule. - class Rule - include DataMapper::Resource - - storage_names[:default] = 'extension_dns_rules' - - property :id, String, :key => true - property :pattern, Object, :required => true - property :resource, Object, :required => true - property :response, Object, :required => true - property :callback, Object, :required => true - + class Rule < ActiveRecord::Base + attribute :id, :String, :key => true + attribute :pattern, :Object, :required => true + attribute :resource, :Object, :required => true + attribute :response, :Object, :required => true + attribute :callback, :Object, :required => true # Hooks the model's "save" event. Validates pattern/response and generates a rule identifier. - before :save do |rule| + before_save do |rule| begin validate_pattern(rule.pattern) rule.callback = format_callback(rule.resource, rule.response) diff --git a/extensions/ipec/models/ipec_exploits.rb b/extensions/ipec/models/ipec_exploits.rb index baf725f2e..4c48589e3 100644 --- a/extensions/ipec/models/ipec_exploits.rb +++ b/extensions/ipec/models/ipec_exploits.rb @@ -6,19 +6,13 @@ module BeEF module Core module Models - class IpecExploits + class IpecExploits < ActiveRecord::Base + attribute :id, :Serial + attribute :name, :Text, :lazy => false + attribute :protocol, :String, :lazy => false + attribute :os, :String, :lazy => false - include DataMapper::Resource - #todo: use this table when we'll have a bigger IPEC exploits choice - storage_names[:default] = 'extension_ipec_exploits' - - property :id, Serial - - property :name, Text, :lazy => false - property :protocol, String, :lazy => false - property :os, String, :lazy => false - - has n, :extension_ipec_exploits_run, 'IpecExploitsRun' + belongs_to :extension_ipec_exploits_run, 'IpecExploitsRun' end diff --git a/extensions/ipec/models/ipec_exploits_run.rb b/extensions/ipec/models/ipec_exploits_run.rb index ce786c172..c87f7aed8 100644 --- a/extensions/ipec/models/ipec_exploits_run.rb +++ b/extensions/ipec/models/ipec_exploits_run.rb @@ -6,16 +6,12 @@ module BeEF module Core module Models - class IpecExploitsRun + class IpecExploitsRun < ActiveRecord::Base - include DataMapper::Resource - #todo: use this table when we'll have a bigger IPEC exploits choice - storage_names[:default] = 'extension_ipec_exploits_run' - - property :id, Serial - property :launched, Boolean, :lazy => false - property :http_headers, Text, :lazy => false - property :junk_size, String, :length => 3, :lazy => false + attribute :id, :Serial + attribute :launched, :Boolean, :lazy => false + attribute :http_headers, :Text, :lazy => false + attribute :junk_size, :String, :length => 3, :lazy => false belongs_to :ipec_exploits diff --git a/extensions/network/models/network_host.rb b/extensions/network/models/network_host.rb index ebeeccee1..ffdcf8476 100644 --- a/extensions/network/models/network_host.rb +++ b/extensions/network/models/network_host.rb @@ -9,20 +9,15 @@ module BeEF # # Table stores each host identified on the zombie browser's network(s) # - class NetworkHost - include DataMapper::Resource - storage_names[:default] = 'network_host' - - property :id, Serial - - property :hooked_browser_id, Text, lazy: false - property :ip, Text, lazy: false - property :hostname, String, lazy: false - property :type, String, lazy: false # proxy, router, gateway, dns, etc - property :os, String, lazy: false - property :mac, String, lazy: false - property :lastseen, String, length: 15 - + class NetworkHost < ActiveRecord::Base + attribute :id, :Serial + attribute :hooked_browser_id, :Text, lazy: false + attribute :ip, :Text, lazy: false + attribute :hostname, :String, lazy: false + attribute :type, :String, lazy: false # proxy, router, gateway, dns, etc + attribute :os, :String, lazy: false + attribute :mac, :String, lazy: false + attribute :lastseen, :String, length: 15 # # Stores a network host in the data store # diff --git a/extensions/network/models/network_service.rb b/extensions/network/models/network_service.rb index 06dafef1c..fb64b39a7 100644 --- a/extensions/network/models/network_service.rb +++ b/extensions/network/models/network_service.rb @@ -9,19 +9,15 @@ module BeEF # # Table stores each open port identified on the zombie browser's network(s) # - class NetworkService - include DataMapper::Resource - storage_names[:default] = 'network_service' + class NetworkService < ActiveRecord::Base + + attribute :id, :Serial + attribute :hooked_browser_id, :Text, lazy: false + attribute :proto, :String, lazy: false + attribute :ip, :Text, lazy: false + attribute :port, :String, lazy: false + attribute :type, :String, lazy: false - property :id, Serial - - property :hooked_browser_id, Text, lazy: false - property :proto, String, lazy: false - property :ip, Text, lazy: false - property :port, String, lazy: false - property :type, String, lazy: false - - # # Stores a network service in the data store # def self.add(service = {}) diff --git a/extensions/requester/models/http.rb b/extensions/requester/models/http.rb index edf6cfa32..127c97f34 100644 --- a/extensions/requester/models/http.rb +++ b/extensions/requester/models/http.rb @@ -9,67 +9,61 @@ module Models # # Table stores the http requests and responses from the requester. # - class Http - - include DataMapper::Resource - - storage_names[:default] = 'extension_requester_http' - - property :id, Serial + class Http < ActiveRecord::Base + attribute :id, :Serial # The hooked browser id - property :hooked_browser_id, Text, :lazy => false + attribute :hooked_browser_id, :Text, :lazy => false # The http request to perform. In clear text. - property :request, Text, :lazy => true + attribute :request, :Text, :lazy => true # Boolean value as string to say whether cross-domain requests are allowed - property :allow_cross_domain, Text, :lazy => false, :default => "true" + attribute :allow_cross_domain, :Text, :lazy => false, :default => "true" # The http response body received. In clear text. - property :response_data, Binary, :lazy => true, :length => 2097152 + attribute :response_data, :Binary, :lazy => true, :length => 2097152 # The http response code. Useful to handle cases like 404, 500, 302, ... - property :response_status_code, Integer, :lazy => true + attribute :response_status_code, :Integer, :lazy => true # The http response code. Human-readable code: success, error, ecc.. - property :response_status_text, Text, :lazy => true + attribute :response_status_text, :Text, :lazy => true # The port status. closed, open or not http - property :response_port_status, Text, :lazy => true + attribute :response_port_status, :Text, :lazy => true # The XHR Http response raw headers - property :response_headers, Text, :lazy => true + attribute :response_headers, :Text, :lazy => true # The http response method. GET or POST. - property :method, Text, :lazy => false + attribute :method, :Text, :lazy => false # The content length for the request. - property :content_length, Text, :lazy => false, :default => 0 + attribute :content_length, :Text, :lazy => false, :default => 0 # The request protocol/scheme (http/https) - property :proto, Text, :lazy => false + attribute :proto, :Text, :lazy => false # The domain on which perform the request. - property :domain, Text, :lazy => false + attribute :domain, :Text, :lazy => false # The port on which perform the request. - property :port, Text, :lazy => false + attribute :port, :Text, :lazy => false # Boolean value to say if the request was cross-domain - property :has_ran, Text, :lazy => false, :default => "waiting" + attribute :has_ran, :Text, :lazy => false, :default => "waiting" # The path of the request. # Example: /secret.html - property :path, Text, :lazy => false + attribute :path, :Text, :lazy => false # The date at which the http response has been saved. - property :response_date, DateTime, :lazy => false + attribute :response_date, :DateTime, :lazy => false # The date at which the http request has been saved. - property :request_date, DateTime, :lazy => false + attribute :request_date, :DateTime, :lazy => false - # # Removes a request/response from the data store # def self.delete(id) diff --git a/extensions/social_engineering/models/interceptor.rb b/extensions/social_engineering/models/interceptor.rb index 896936165..b8df088db 100644 --- a/extensions/social_engineering/models/interceptor.rb +++ b/extensions/social_engineering/models/interceptor.rb @@ -6,15 +6,10 @@ module BeEF module Core module Models - class Interceptor - - include DataMapper::Resource - - storage_names[:default] = 'extension_seng_interceptor' - - property :id, Serial - property :ip, Text, :lazy => false - property :post_data, Text, :lazy => false + class Interceptor < ActiveRecord::Base + attribute :id, :Serial + attribute :ip, :Text, :lazy => false + attribute :post_data, :Text, :lazy => false belongs_to :webcloner diff --git a/extensions/social_engineering/models/mass_mailer.rb b/extensions/social_engineering/models/mass_mailer.rb index 728d8a830..4e43efdc5 100644 --- a/extensions/social_engineering/models/mass_mailer.rb +++ b/extensions/social_engineering/models/mass_mailer.rb @@ -7,13 +7,9 @@ module BeEF module Core module Models - class Massmailer + class Massmailer < ActiveRecord::Base - include DataMapper::Resource - - storage_names[:default] = 'extension_seng_massmailer' - - property :id, Serial + attribute :id, Serial #todo fields end diff --git a/extensions/social_engineering/models/web_cloner.rb b/extensions/social_engineering/models/web_cloner.rb index d69583655..fa1977147 100644 --- a/extensions/social_engineering/models/web_cloner.rb +++ b/extensions/social_engineering/models/web_cloner.rb @@ -6,19 +6,13 @@ module BeEF module Core module Models - class Webcloner + class Webcloner < ActiveRecord::Base + attribute :id, :Serial - include DataMapper::Resource - - storage_names[:default] = 'extension_seng_webcloner' - - property :id, Serial - - property :uri, Text, :lazy => false - property :mount, Text, :lazy => false - - has n, :extension_seng_interceptor, 'Interceptor' + attribute :uri, :Text, :lazy => false + attribute :mount, :Text, :lazy => false + belongs_tos :extension_seng_interceptor, 'Interceptor' end end diff --git a/extensions/webrtc/models/rtcmanage.rb b/extensions/webrtc/models/rtcmanage.rb index 4d4fe28a6..027149711 100644 --- a/extensions/webrtc/models/rtcmanage.rb +++ b/extensions/webrtc/models/rtcmanage.rb @@ -9,23 +9,18 @@ module Models # # Table stores the queued up JS commands for managing the client-side webrtc logic. # - class Rtcmanage - - include DataMapper::Resource - - storage_names[:default] = 'extension_webrtc_rtcmanage' - - property :id, Serial + class Rtcmanage < ActiveRecord::Base + attribute :id, :Serial # The hooked browser id - property :hooked_browser_id, Text, :lazy => false + attribute :hooked_browser_id, :Text, :lazy => false # The message - property :message, Text, :lazy => true + attribute :message, :Text, :lazy => true # Boolean value to say if the signal has been sent to the target peer - property :has_sent, Text, :lazy => false, :default => "waiting" - + attribute :has_sent, :Text, :lazy => false, :default => "waiting" + # Starts the RTCPeerConnection process, establishing a WebRTC connection between the caller and the receiver def self.initiate(caller, receiver, verbosity = false) stunservers = BeEF::Core::Configuration.instance.get("beef.extension.webrtc.stunservers") diff --git a/extensions/webrtc/models/rtcmodulestatus.rb b/extensions/webrtc/models/rtcmodulestatus.rb index 93b8e62f4..c294c6582 100644 --- a/extensions/webrtc/models/rtcmodulestatus.rb +++ b/extensions/webrtc/models/rtcmodulestatus.rb @@ -13,32 +13,28 @@ module Models # - class Rtcmodulestatus - - include DataMapper::Resource - - storage_names[:default] = 'extension_webrtc_rtcmodulestatus' - - property :id, Serial + class Rtcmodulestatus < ActiveRecord::Base + attribute :id, :Serial # The hooked browser id - property :hooked_browser_id, Text, :lazy => false + attribute :hooked_browser_id, :Text, :lazy => false # The hooked browser's IP - # property :hooked_browser_ip, Text, :lazy => false + attribute :hooked_browser_ip, :Text, :lazy => false # The target hooked browser id - property :target_hooked_browser_id, Text, :lazy => false + attribute :target_hooked_browser_id, :Text, :lazy => false # The command module ID - property :command_module_id, Text, :lazy => false + attribute :command_module_id, :Text, :lazy => false # The status field - property :status, Text, :lazy => true + attribute :status, :Text, :lazy => true # Timestamps - property :created_at, DateTime - property :updated_at, DateTime + attribute :created_at, DateTime + attribute :updated_at, DateTime + end diff --git a/extensions/webrtc/models/rtcsignal.rb b/extensions/webrtc/models/rtcsignal.rb index 34efcd914..63ba6e1d1 100644 --- a/extensions/webrtc/models/rtcsignal.rb +++ b/extensions/webrtc/models/rtcsignal.rb @@ -9,25 +9,21 @@ module Models # # Table stores the webrtc signals from a hooked_browser, directed to a target_hooked_browser # - class Rtcsignal - - include DataMapper::Resource - - storage_names[:default] = 'extension_webrtc_rtcsignals' - - property :id, Serial + class Rtcsignal < ActiveRecord::Base + attribute :id, :Serial # The hooked browser id - property :hooked_browser_id, Text, :lazy => false + attribute :hooked_browser_id, :Text, :lazy => false # The target hooked browser id - property :target_hooked_browser_id, Text, :lazy => false + attribute :target_hooked_browser_id, :Text, :lazy => false # The WebRTC signal to submit. In clear text. - property :signal , Text, :lazy => true + attribute :signal , :Text, :lazy => true # Boolean value to say if the signal has been sent to the target peer - property :has_sent, Text, :lazy => false, :default => "waiting" + attribute :has_sent, :Text, :lazy => false, :default => "waiting" + end diff --git a/extensions/webrtc/models/rtcstatus.rb b/extensions/webrtc/models/rtcstatus.rb index 5217bb36d..3e8d798cf 100644 --- a/extensions/webrtc/models/rtcstatus.rb +++ b/extensions/webrtc/models/rtcstatus.rb @@ -13,32 +13,28 @@ module Models # - class Rtcstatus - - include DataMapper::Resource - - storage_names[:default] = 'extension_webrtc_rtcstatus' - - property :id, Serial + class Rtcstatus < ActiveRecord::Base + attribute :id, :Serial # The hooked browser id - property :hooked_browser_id, Text, :lazy => false + attribute :hooked_browser_id, :Text, :lazy => false # The hooked browser's IP # property :hooked_browser_ip, Text, :lazy => false # The target hooked browser id - property :target_hooked_browser_id, Text, :lazy => false + attribute :target_hooked_browser_id, :Text, :lazy => false # The target hooked browser's IP # property :target_hooked_browser_ip, Text, :lazy => false # The status field - property :status, Text, :lazy => true + attribute :status, :Text, :lazy => true # Timestamps - property :created_at, DateTime - property :updated_at, DateTime + attribute :created_at, DateTime + attribute :updated_at, DateTime + end diff --git a/extensions/xssrays/models/xssraysdetail.rb b/extensions/xssrays/models/xssraysdetail.rb index 1e76173f4..c56848837 100644 --- a/extensions/xssrays/models/xssraysdetail.rb +++ b/extensions/xssrays/models/xssraysdetail.rb @@ -9,25 +9,20 @@ module Models # # Store the rays details, basically verified XSS vulnerabilities # - class Xssraysdetail - - include DataMapper::Resource - - storage_names[:default] = 'extension_xssrays_details' - - property :id, Serial + class Xssraysdetail < ActiveRecord::Base + attribute :id, :Serial # The hooked browser id - property :hooked_browser_id, Text, :lazy => false + attribute :hooked_browser_id, :Text, :lazy => false # The XssRays vector name for the vulnerability - property :vector_name, Text, :lazy => true + attribute :vector_name, :Text, :lazy => true # The XssRays vector method (GET or POST) for the vulnerability - property :vector_method, Text, :lazy => true + attribute :vector_method, :Text, :lazy => true # The XssRays Proof of Concept for the vulnerability - property :vector_poc, Text, :lazy => true + attribute :vector_poc, :Text, :lazy => true belongs_to :xssraysscan end diff --git a/extensions/xssrays/models/xssraysscan.rb b/extensions/xssrays/models/xssraysscan.rb index 4f7a8ee78..eb435a27f 100644 --- a/extensions/xssrays/models/xssraysscan.rb +++ b/extensions/xssrays/models/xssraysscan.rb @@ -9,28 +9,23 @@ module Models # # Store the XssRays scans started and finished, with relative ID # - class Xssraysscan + class Xssraysscan < ActiveRecord::Base - include DataMapper::Resource + attribute :id, :Serial - storage_names[:default] = 'extension_xssrays_scans' + attribute :hooked_browser_id, :Text, :lazy => false - property :id, Serial + attribute :scan_start, :DateTime, :lazy => true + attribute :scan_finish, :DateTime, :lazy => true - property :hooked_browser_id, Text, :lazy => false + attribute :domain, :Text, :lazy => true + attribute :cross_domain, :Text, :lazy => true + attribute :clean_timeout, :Integer, :lazy => false - property :scan_start, DateTime, :lazy => true - property :scan_finish, DateTime, :lazy => true - - property :domain, Text, :lazy => true - property :cross_domain, Text, :lazy => true - property :clean_timeout, Integer, :lazy => false - - property :is_started, Boolean, :lazy => false, :default => false - property :is_finished, Boolean, :lazy => false, :default => false - - has n, :extension_xssrays_details, 'Xssraysdetail' + attribute :is_started, :Boolean, :lazy => false, :default => false + attribute :is_finished, :Boolean, :lazy => false, :default => false + belongs_to :extension_xssrays_details end end diff --git a/spec/beef/api/auth_rate_spec.rb b/spec/beef/api/auth_rate_spec.rb index e61d6c827..6cf48a781 100644 --- a/spec/beef/api/auth_rate_spec.rb +++ b/spec/beef/api/auth_rate_spec.rb @@ -9,8 +9,10 @@ RSpec.describe 'BeEF API Rate Limit' do before(:all) do # Note: rake spec passes --patterns which causes BeEF to pickup this argument via optparse. I can't see a better way at the moment to filter this out. Therefore ARGV=[] for this test. ARGV = [] - DataMapper.setup(:default, 'sqlite3::memory:') - DataMapper.auto_migrate! + ActiveRecord::Base.establish_connection( + database: "beef.db", + adapter: "sqlite3" + ) @config = BeEF::Core::Configuration.instance http_hook_server = BeEF::Core::Server.instance http_hook_server.prepare diff --git a/spec/beef/core/main/models/browser_details_spec.rb b/spec/beef/core/main/models/browser_details_spec.rb index 6f7feddac..b1a06b5ae 100644 --- a/spec/beef/core/main/models/browser_details_spec.rb +++ b/spec/beef/core/main/models/browser_details_spec.rb @@ -2,8 +2,10 @@ RSpec.describe 'BeEF BrowserDetails' do before(:all) do @session = (0...10).map { ('a'..'z').to_a[rand(26)] }.join - DataMapper.setup(:default, 'sqlite3::memory:') - DataMapper.auto_migrate! + ActiveRecord::Base.establish_connection( + database: "beef.db", + adapter: "sqlite3" + ) end it 'set nil value' do diff --git a/spec/beef/extensions/dns_spec.rb b/spec/beef/extensions/dns_spec.rb index 6a38cd06b..e9f27511a 100644 --- a/spec/beef/extensions/dns_spec.rb +++ b/spec/beef/extensions/dns_spec.rb @@ -1,13 +1,16 @@ require 'resolv' -require 'extensions/dns/extension.rb' +require 'extensions/dns/extension' RSpec.describe 'BeEF Extension DNS' do IN = Resolv::DNS::Resource::IN before(:all) do - DataMapper.setup(:default, 'sqlite3::memory:') - DataMapper.auto_migrate! + ActiveRecord::Base.establish_connection( + database: "beef.db", + adapter: "sqlite3" + ) + @config = BeEF::Core::Configuration.instance @config.load_extensions_config @dns = BeEF::Extension::Dns::Server.instance diff --git a/spec/beef/extensions/ipec_tunnel_spec.rb b/spec/beef/extensions/ipec_tunnel_spec.rb index 2ff497595..998faf847 100644 --- a/spec/beef/extensions/ipec_tunnel_spec.rb +++ b/spec/beef/extensions/ipec_tunnel_spec.rb @@ -3,8 +3,10 @@ require 'extensions/ipec/extension' RSpec.describe 'BeEF Extension IPEC' do before(:all) do - DataMapper.setup(:default, 'sqlite3::memory:') - DataMapper.auto_migrate! + ActiveRecord::Base.establish_connection( + database: "beef.db", + adapter: "sqlite3" + ) @config = BeEF::Core::Configuration.instance @config.load_extensions_config end diff --git a/spec/beef/extensions/network_spec.rb b/spec/beef/extensions/network_spec.rb index e47db4009..267a7f64d 100644 --- a/spec/beef/extensions/network_spec.rb +++ b/spec/beef/extensions/network_spec.rb @@ -4,8 +4,10 @@ require 'extensions/network/models/network_host' RSpec.describe 'BeEF Extension Network' do before(:all) do - DataMapper.setup(:default, 'sqlite3::memory:') - DataMapper.auto_migrate! + ActiveRecord::Base.establish_connection( + database: "beef.db", + adapter: "sqlite3" + ) end it 'add good host' do diff --git a/spec/beef/extensions/proxy_spec.rb b/spec/beef/extensions/proxy_spec.rb index 4c0919593..7253c056c 100644 --- a/spec/beef/extensions/proxy_spec.rb +++ b/spec/beef/extensions/proxy_spec.rb @@ -3,8 +3,10 @@ require 'extensions/proxy/extension' RSpec.describe 'BeEF Extension Proxy' do before(:all) do - DataMapper.setup(:default, 'sqlite3::memory:') - DataMapper.auto_migrate! + ActiveRecord::Base.establish_connection( + database: "beef.db", + adapter: "sqlite3" + ) @config = BeEF::Core::Configuration.instance @config.load_extensions_config end diff --git a/spec/beef/extensions/qrcode_spec.rb b/spec/beef/extensions/qrcode_spec.rb index 26a03bd3d..40da4e923 100644 --- a/spec/beef/extensions/qrcode_spec.rb +++ b/spec/beef/extensions/qrcode_spec.rb @@ -3,8 +3,10 @@ require 'extensions/qrcode/extension' RSpec.describe 'BeEF Extension QRCode' do before(:all) do - DataMapper.setup(:default, 'sqlite3::memory:') - DataMapper.auto_migrate! + ActiveRecord::Base.establish_connection( + database: "beef.db", + adapter: "sqlite3" + ) @config = BeEF::Core::Configuration.instance @config.load_extensions_config end diff --git a/spec/beef/extensions/requester_spec.rb b/spec/beef/extensions/requester_spec.rb index 01c44100c..993235f8e 100644 --- a/spec/beef/extensions/requester_spec.rb +++ b/spec/beef/extensions/requester_spec.rb @@ -3,8 +3,10 @@ require 'extensions/requester/extension' RSpec.describe 'BeEF Extension Requester' do before(:all) do - DataMapper.setup(:default, 'sqlite3::memory:') - DataMapper.auto_migrate! + ActiveRecord::Base.establish_connection( + database: "beef.db", + adapter: "sqlite3" + ) @config = BeEF::Core::Configuration.instance @config.load_extensions_config end diff --git a/spec/beef/extensions/webrtc_spec.rb b/spec/beef/extensions/webrtc_spec.rb index b245ad00e..6ec5e924a 100644 --- a/spec/beef/extensions/webrtc_spec.rb +++ b/spec/beef/extensions/webrtc_spec.rb @@ -3,8 +3,10 @@ require 'rest-client' RSpec.describe 'BeEF Extension WebRTC' do before(:all) do - DataMapper.setup(:default, 'sqlite3::memory:') - DataMapper.auto_migrate! + ActiveRecord::Base.establish_connection( + database: "beef.db", + adapter: "sqlite3" + ) @config = BeEF::Core::Configuration.instance @config.load_extensions_config diff --git a/spec/beef/extensions/xssrays_spec.rb b/spec/beef/extensions/xssrays_spec.rb index 572584502..cd621e958 100644 --- a/spec/beef/extensions/xssrays_spec.rb +++ b/spec/beef/extensions/xssrays_spec.rb @@ -3,8 +3,10 @@ require 'extensions/xssrays/extension' RSpec.describe 'BeEF Extension XSSRays' do before(:all) do - DataMapper.setup(:default, 'sqlite3::memory:') - DataMapper.auto_migrate! + ActiveRecord::Base.establish_connection( + database: "beef.db", + adapter: "sqlite3" + ) @config = BeEF::Core::Configuration.instance @config.load_extensions_config end diff --git a/test/integration/tc_proxy.rb b/test/integration/tc_proxy.rb index 9d946d58f..79710afba 100644 --- a/test/integration/tc_proxy.rb +++ b/test/integration/tc_proxy.rb @@ -25,9 +25,11 @@ class TC_Proxy < Test::Unit::TestCase @@proxy_config = config.get('beef.extension.proxy') @@proxy = "#{@@proxy_config['address']}:#{@@proxy_config['port']}" - # set up datamapper - DataMapper.setup(:default, 'sqlite3::memory:') - DataMapper.auto_migrate! + # set up active record + ActiveRecord::Base.establish_connection( + database: "beef.db" + adapter: "sqlite3" + ) # set headers for rest requests @@headers = { :content_type => :json, :accept => :json }