Skip to content

Commit f5ff22e

Browse files
committed
msfconsole with bundle install --without db
MSP-10905
1 parent 38da44c commit f5ff22e

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

lib/msf/core/auxiliary/report.rb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
require 'metasploit/credential/creation'
21
# -*- coding: binary -*-
32
module Msf
43

@@ -9,8 +8,18 @@ module Msf
98
###
109

1110
module Auxiliary::Report
12-
13-
include Metasploit::Credential::Creation
11+
begin
12+
require 'metasploit/credential/creation'
13+
rescue LoadError
14+
warn "metasploit-credential not in the bundle, so Metasploit::Credential creation will fail for Msf::Auxiliary::Report."
15+
warn "Bundle installed '--without #{Bundler.settings.without.join(' ')}'"
16+
warn "To clear the without option do `bundle install --without ''` " \
17+
"(the --without flag with an empty string) or " \
18+
"`rm -rf .bundle` to remove the .bundle/config manually and " \
19+
"then `bundle install`"
20+
else
21+
include Metasploit::Credential::Creation
22+
end
1423

1524
# This method overrides the method from Metasploit::Credential to check for an active db
1625
def active_db?

lib/msf/core/db.rb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
#
5757

5858
require 'msf/core/db_manager/import_msf_xml'
59-
require 'metasploit/credential/creation'
6059

6160
module Msf
6261

@@ -157,7 +156,19 @@ class DBImportError < RuntimeError
157156
###
158157
class DBManager
159158
include Msf::DBManager::ImportMsfXml
160-
include Metasploit::Credential::Creation
159+
160+
begin
161+
require 'metasploit/credential/creation'
162+
rescue LoadError
163+
warn "metasploit-credential not in the bundle, so Metasploit::Credential creation will fail for Msf::DBManager"
164+
warn "Bundle installed '--without #{Bundler.settings.without.join(' ')}'"
165+
warn "To clear the without option do `bundle install --without ''` " \
166+
"(the --without flag with an empty string) or " \
167+
"`rm -rf .bundle` to remove the .bundle/config manually and " \
168+
"then `bundle install`"
169+
else
170+
include Metasploit::Credential::Creation
171+
end
161172

162173
def rfc3330_reserved(ip)
163174
case ip.class.to_s

lib/msf/core/db_manager/import_msf_xml.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require 'metasploit/credential/creation'
2-
31
module Msf
42
class DBManager
53
# Handles importing of the xml format exported by Pro. The methods are in a
@@ -8,7 +6,6 @@ class DBManager
86
# methods defined in a class cannot be overridden by including a module
97
# (unless you're running Ruby 2.0 and can use prepend)
108
module ImportMsfXml
11-
include Metasploit::Credential::Creation
129
#
1310
# CONSTANTS
1411
#

0 commit comments

Comments
 (0)