File tree Expand file tree Collapse file tree 2 files changed +26
-5
lines changed Expand file tree Collapse file tree 2 files changed +26
-5
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,31 @@ def self.optionally(name, without_warning)
34
34
end
35
35
end
36
36
37
+ # Tries to `require 'active_record/railtie'` to define the activerecord Rails initializers and rake tasks.
38
+ #
39
+ # @example Optionally requiring 'active_record/railtie'
40
+ # require 'metasploit/framework/require'
41
+ #
42
+ # class MyClass
43
+ # def setup
44
+ # if database_enabled
45
+ # Metasploit::Framework::Require.optionally_active_record_railtie
46
+ # end
47
+ # end
48
+ # end
49
+ #
50
+ # @return [void]
51
+ def self . optionally_active_record_railtie
52
+ if ::File . exist? ( Rails . application . config . paths [ 'config/database' ] . first )
53
+ optionally (
54
+ 'active_record/railtie' ,
55
+ 'activerecord not in the bundle, so database support will be disabled.'
56
+ )
57
+ else
58
+ warn 'Could not find database.yml, so database support will be disabled.'
59
+ end
60
+ end
61
+
37
62
# Tries to `require 'metasploit/credential/creation'` and include it in the `including_module`.
38
63
#
39
64
# @param including_module [Module] `Class` or `Module` that wants to `include Metasploit::Credential::Creation`.
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env ruby
2
2
# -*- coding: binary -*-
3
3
#
4
- # $Id$
5
- #
6
4
# This user interface provides users with a command console interface to the
7
5
# framework.
8
6
#
9
- # $Revision$
10
- #
11
7
12
8
#
13
9
# Standard Library
@@ -20,7 +16,7 @@ require 'pathname'
20
16
#
21
17
22
18
# @see https://github.com/rails/rails/blob/v3.2.17/railties/lib/rails/generators/rails/app/templates/script/rails#L3-L5
23
- require Pathname . new ( __FILE__ ) . expand_path . parent . join ( 'config' , 'boot' )
19
+ require Pathname . new ( __FILE__ ) . realpath . expand_path . parent . join ( 'config' , 'boot' )
24
20
require 'metasploit/framework/command/console'
25
21
26
22
Metasploit ::Framework ::Command ::Console . start
You can’t perform that action at this time.
0 commit comments