Merge branch 'jlee-r7-bug/activerecord-dep'
commit
32ad20d0e0
|
@ -1,5 +1,4 @@
|
|||
# -*- coding: binary -*-
|
||||
require "active_record"
|
||||
|
||||
require 'msf/core'
|
||||
require 'msf/core/db'
|
||||
|
@ -7,14 +6,6 @@ require 'msf/core/task_manager'
|
|||
require 'fileutils'
|
||||
require 'shellwords'
|
||||
|
||||
# Provide access to ActiveRecord models shared w/ commercial versions
|
||||
require "metasploit_data_models"
|
||||
|
||||
# Patches issues with ActiveRecord
|
||||
require "msf/core/patches/active_record"
|
||||
|
||||
|
||||
|
||||
module Msf
|
||||
|
||||
###
|
||||
|
@ -28,7 +19,7 @@ class DBManager
|
|||
|
||||
# Mainly, it's Ruby 1.9.1 that cause a lot of problems now, along with Ruby 1.8.6.
|
||||
# Ruby 1.8.7 actually seems okay, but why tempt fate? Let's say 1.9.3 and beyond.
|
||||
def self.warn_about_rubies
|
||||
def warn_about_rubies
|
||||
if ::RUBY_VERSION =~ /^1\.9\.[012]($|[^\d])/
|
||||
$stderr.puts "**************************************************************************************"
|
||||
$stderr.puts "Metasploit requires at least Ruby 1.9.3. For an easy upgrade path, see https://rvm.io/"
|
||||
|
@ -36,16 +27,6 @@ class DBManager
|
|||
end
|
||||
end
|
||||
|
||||
# Only include Mdm if we're not using Metasploit commercial versions
|
||||
# If Mdm::Host is defined, the dynamically created classes
|
||||
# are already in the object space
|
||||
begin
|
||||
include MetasploitDataModels unless defined? Mdm::Host
|
||||
rescue NameError => e
|
||||
warn_about_rubies
|
||||
raise e
|
||||
end
|
||||
|
||||
# Provides :framework and other accessors
|
||||
include Framework::Offspring
|
||||
|
||||
|
@ -117,6 +98,14 @@ class DBManager
|
|||
# Database drivers can reset our KCODE, do not let them
|
||||
$KCODE = 'NONE' if RUBY_VERSION =~ /^1\.8\./
|
||||
|
||||
require "active_record"
|
||||
|
||||
# Provide access to ActiveRecord models shared w/ commercial versions
|
||||
require "metasploit_data_models"
|
||||
|
||||
# Patches issues with ActiveRecord
|
||||
require "msf/core/patches/active_record"
|
||||
|
||||
@usable = true
|
||||
|
||||
rescue ::Exception => e
|
||||
|
@ -125,6 +114,18 @@ class DBManager
|
|||
return false
|
||||
end
|
||||
|
||||
# Only include Mdm if we're not using Metasploit commercial versions
|
||||
# If Mdm::Host is defined, the dynamically created classes
|
||||
# are already in the object space
|
||||
begin
|
||||
unless defined? Mdm::Host
|
||||
self.class.send :include, MetasploitDataModels
|
||||
end
|
||||
rescue NameError => e
|
||||
warn_about_rubies
|
||||
raise e
|
||||
end
|
||||
|
||||
#
|
||||
# Determine what drivers are available
|
||||
#
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
# Gems
|
||||
#
|
||||
require 'active_support/concern'
|
||||
require 'active_support/core_ext/hash'
|
||||
require 'active_support/core_ext/module'
|
||||
|
||||
# Deals with module paths in the {Msf::ModuleManager}
|
||||
module Msf::ModuleManager::ModulePaths
|
||||
|
|
Loading…
Reference in New Issue