Merge branch 'jlee-r7-bug/activerecord-dep'
commit
32ad20d0e0
|
@ -1,5 +1,4 @@
|
||||||
# -*- coding: binary -*-
|
# -*- coding: binary -*-
|
||||||
require "active_record"
|
|
||||||
|
|
||||||
require 'msf/core'
|
require 'msf/core'
|
||||||
require 'msf/core/db'
|
require 'msf/core/db'
|
||||||
|
@ -7,14 +6,6 @@ require 'msf/core/task_manager'
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
require 'shellwords'
|
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
|
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.
|
# 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.
|
# 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])/
|
if ::RUBY_VERSION =~ /^1\.9\.[012]($|[^\d])/
|
||||||
$stderr.puts "**************************************************************************************"
|
$stderr.puts "**************************************************************************************"
|
||||||
$stderr.puts "Metasploit requires at least Ruby 1.9.3. For an easy upgrade path, see https://rvm.io/"
|
$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
|
||||||
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
|
# Provides :framework and other accessors
|
||||||
include Framework::Offspring
|
include Framework::Offspring
|
||||||
|
|
||||||
|
@ -117,6 +98,14 @@ class DBManager
|
||||||
# Database drivers can reset our KCODE, do not let them
|
# Database drivers can reset our KCODE, do not let them
|
||||||
$KCODE = 'NONE' if RUBY_VERSION =~ /^1\.8\./
|
$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
|
@usable = true
|
||||||
|
|
||||||
rescue ::Exception => e
|
rescue ::Exception => e
|
||||||
|
@ -125,6 +114,18 @@ class DBManager
|
||||||
return false
|
return false
|
||||||
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
|
||||||
|
unless defined? Mdm::Host
|
||||||
|
self.class.send :include, MetasploitDataModels
|
||||||
|
end
|
||||||
|
rescue NameError => e
|
||||||
|
warn_about_rubies
|
||||||
|
raise e
|
||||||
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Determine what drivers are available
|
# Determine what drivers are available
|
||||||
#
|
#
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
# Gems
|
# Gems
|
||||||
#
|
#
|
||||||
require 'active_support/concern'
|
require 'active_support/concern'
|
||||||
|
require 'active_support/core_ext/hash'
|
||||||
|
require 'active_support/core_ext/module'
|
||||||
|
|
||||||
# Deals with module paths in the {Msf::ModuleManager}
|
# Deals with module paths in the {Msf::ModuleManager}
|
||||||
module Msf::ModuleManager::ModulePaths
|
module Msf::ModuleManager::ModulePaths
|
||||||
|
|
Loading…
Reference in New Issue