Skip to content

Commit d17a6f9

Browse files
committed
Merge branch 'feature/deprecated-module-mixin' of github.com:jlee-r7/metasploit-framework into jlee-r7-feature/deprecated-module-mixin
2 parents f79ca25 + 011ff18 commit d17a6f9

File tree

4 files changed

+71
-13
lines changed

4 files changed

+71
-13
lines changed

lib/msf/core/module/deprecated.rb

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
2+
module Msf::Module::Deprecated
3+
4+
# Additional class methods for deprecated modules
5+
module ClassMethods
6+
# Mark this module as deprecated
7+
#
8+
# Any time this module is run it will print warnings to that effect.
9+
#
10+
# @param deprecation_date [Date,#to_s] The date on which this module will
11+
# be removed
12+
# @param replacement_module [String] The name of a module that users
13+
# should be using instead of this deprecated one
14+
# @return [void]
15+
def deprecated(deprecation_date=nil, replacement_module=nil)
16+
# Yes, class instance variables.
17+
@replacement_module = replacement_module
18+
@deprecation_date = deprecation_date
19+
end
20+
21+
# The name of a module that users should be using instead of this
22+
# deprecated one
23+
#
24+
# @return [String,nil]
25+
# @see ClassMethods#deprecated
26+
def replacement_module; @replacement_module; end
27+
28+
# The date on which this module will be removed
29+
#
30+
# @return [Date,nil]
31+
# @see ClassMethods#deprecated
32+
def deprecation_date; @deprecation_date; end
33+
end
34+
35+
# (see ClassMethods#replacement_module)
36+
def replacement_module; self.class.replacement_module; end
37+
# (see ClassMethods#deprecation_date)
38+
def deprecation_date; self.class.deprecation_date; end
39+
40+
# Extends with {ClassMethods}
41+
def self.included(base)
42+
base.extend(ClassMethods)
43+
end
44+
45+
def setup
46+
print_warning("*"*72)
47+
print_warning("*%red"+"This module is deprecated!".center(70)+"%clr*")
48+
if deprecation_date
49+
print_warning("*"+"It will be removed on or about #{deprecation_date}".center(70)+"*")
50+
end
51+
if replacement_module
52+
print_warning("*"+"Use #{replacement_module} instead".center(70)+"*")
53+
end
54+
print_warning("*"*72)
55+
super
56+
end
57+
58+
end

modules/post/windows/escalate/bypassuac.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010

1111
class Metasploit3 < Msf::Post
1212

13+
require 'msf/core/module/deprecated'
14+
include Msf::Module::Deprecated
15+
deprecated Date.new(2013,1,4), "exploit/windows/local/bypassuac"
16+
1317
def initialize(info={})
1418
super( update_info( info,
1519
'Name' => 'Windows Escalate UAC Protection Bypass',
@@ -36,12 +40,6 @@ def initialize(info={})
3640
end
3741

3842
def run
39-
print_error("***********************************************")
40-
print_error("* *")
41-
print_error("* Module will be depricated on Jan 4 2013 *")
42-
print_error("* Please use exploits/windows/local/bypassuac *")
43-
print_error("* *")
44-
print_error("***********************************************")
4543
vuln = false
4644
sysinfo = session.sys.config.sysinfo
4745
winver = sysinfo["OS"]

modules/post/windows/escalate/ms10_092_schelevator.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212

1313

1414
class Metasploit3 < Msf::Post
15+
16+
require 'msf/core/module/deprecated'
17+
include Msf::Module::Deprecated
18+
deprecated Date.new(2013,6,1), "exploit/windows/local/ms10_092_schelevator"
19+
1520
include Msf::Post::Common
1621

1722
def initialize(info={})

modules/post/windows/escalate/service_permissions.rb

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88
require 'msf/core'
99
require 'msf/core/post/windows/services'
1010
require 'rex'
11-
require 'msf/core//post/windows/services'
1211

1312
class Metasploit3 < Msf::Post
1413

14+
require 'msf/core/module/deprecated'
15+
include Msf::Module::Deprecated
16+
deprecated Date.new(2013,1,10), "exploit/windows/local/service_permissions"
17+
1518
include ::Msf::Post::Windows::Services
1619
def initialize(info={})
1720
super( update_info( info,
@@ -42,12 +45,6 @@ def initialize(info={})
4245
end
4346

4447
def run
45-
print_error("*********************************************************")
46-
print_error("* *")
47-
print_error("* Module will be depricated on Jan 10 2013 *")
48-
print_error("* Please use exploits/windows/local/service_permissions *")
49-
print_error("* *")
50-
print_error("*********************************************************")
5148
print_status("running")
5249

5350
lhost = datastore["LHOST"] || Rex::Socket.source_address

0 commit comments

Comments
 (0)