Skip to content

Commit 0c00c7c

Browse files
committed
Fully-qualifiy Msf::MODULE_TYPES constants
MSP-11126 Fully-qualify `Msf::MODULE_TYPES`, `Msf::MODULE_ANY`, Msf::MODULE_ENCODER`, `Msf::MODULE_EXPLOIT`, `Msf::MODULE_NOP`, `Msf::MODULE_AUX`, `Msf::MODULE_PAYLOAD`, `Msf::MODULE_POST` so that their usage isn't dependent on nested lexical scoping.
1 parent 7ffd07c commit 0c00c7c

File tree

12 files changed

+39
-39
lines changed

12 files changed

+39
-39
lines changed

lib/msf/base/serializer/readable_text.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ class ReadableText
2020
# @return [String] formatted text output of the dump.
2121
def self.dump_module(mod, indent = " ")
2222
case mod.type
23-
when MODULE_PAYLOAD
23+
when Msf::MODULE_PAYLOAD
2424
return dump_payload_module(mod, indent)
25-
when MODULE_NOP
25+
when Msf::MODULE_NOP
2626
return dump_basic_module(mod, indent)
27-
when MODULE_ENCODER
27+
when Msf::MODULE_ENCODER
2828
return dump_basic_module(mod, indent)
29-
when MODULE_EXPLOIT
29+
when Msf::MODULE_EXPLOIT
3030
return dump_exploit_module(mod, indent)
31-
when MODULE_AUX
31+
when Msf::MODULE_AUX
3232
return dump_auxiliary_module(mod, indent)
33-
when MODULE_POST
33+
when Msf::MODULE_POST
3434
return dump_post_module(mod, indent)
3535
else
3636
return dump_generic_module(mod, indent)

lib/msf/base/simple/framework.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ def on_module_created(instance)
5454

5555
ModuleSimplifiers =
5656
{
57-
MODULE_ENCODER => Msf::Simple::Encoder,
58-
MODULE_EXPLOIT => Msf::Simple::Exploit,
59-
MODULE_NOP => Msf::Simple::Nop,
60-
MODULE_PAYLOAD => Msf::Simple::Payload,
61-
MODULE_AUX => Msf::Simple::Auxiliary,
62-
MODULE_POST => Msf::Simple::Post,
57+
Msf::MODULE_ENCODER => Msf::Simple::Encoder,
58+
Msf::MODULE_EXPLOIT => Msf::Simple::Exploit,
59+
Msf::MODULE_NOP => Msf::Simple::Nop,
60+
Msf::MODULE_PAYLOAD => Msf::Simple::Payload,
61+
Msf::MODULE_AUX => Msf::Simple::Auxiliary,
62+
Msf::MODULE_POST => Msf::Simple::Post,
6363
}
6464

6565
#

lib/msf/core/auxiliary.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ class Auxiliary < Msf::Module
2121
# Returns MODULE_AUX to indicate that this is an auxiliary module.
2222
#
2323
def self.type
24-
MODULE_AUX
24+
Msf::MODULE_AUX
2525
end
2626

2727
#
2828
# Returns MODULE_AUX to indicate that this is an auxiliary module.
2929
#
3030
def type
31-
MODULE_AUX
31+
Msf::MODULE_AUX
3232
end
3333

3434
#

lib/msf/core/encoder.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,14 @@ def initialize(info)
150150
# Returns MODULE_ENCODER to indicate that this is an encoder module.
151151
#
152152
def self.type
153-
return MODULE_ENCODER
153+
return Msf::MODULE_ENCODER
154154
end
155155

156156
#
157157
# Returns MODULE_ENCODER to indicate that this is an encoder module.
158158
#
159159
def type
160-
return MODULE_ENCODER
160+
return Msf::MODULE_ENCODER
161161
end
162162

163163
#

lib/msf/core/exploit.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,14 +621,14 @@ def capabilities
621621
# Returns MODULE_EXPLOIT to indicate that this is an exploit module.
622622
#
623623
def self.type
624-
MODULE_EXPLOIT
624+
Msf::MODULE_EXPLOIT
625625
end
626626

627627
#
628628
# Returns MODULE_EXPLOIT to indicate that this is an exploit module.
629629
#
630630
def type
631-
MODULE_EXPLOIT
631+
Msf::MODULE_EXPLOIT
632632
end
633633

634634
#

lib/msf/core/framework.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ module Offspring
6969
def initialize(opts={})
7070

7171
# Allow specific module types to be loaded
72-
types = opts[:module_types] || MODULE_TYPES
72+
types = opts[:module_types] || Msf::MODULE_TYPES
7373

7474
self.threads = ThreadManager.new(self)
7575
self.events = EventDispatcher.new(self)

lib/msf/core/module/compatibility.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ def compatible?(mod)
1717
return true if (mod == nil)
1818

1919
# Determine which hash to used based on the supplied module type
20-
if (mod.type == MODULE_ENCODER)
20+
if (mod.type == Msf::MODULE_ENCODER)
2121
ch = self.compat['Encoder']
22-
elsif (mod.type == MODULE_NOP)
22+
elsif (mod.type == Msf::MODULE_NOP)
2323
ch = self.compat['Nop']
24-
elsif (mod.type == MODULE_PAYLOAD)
24+
elsif (mod.type == Msf::MODULE_PAYLOAD)
2525
ch = self.compat['Payload']
2626
if self.respond_to?("target") and self.target and self.target['Payload'] and self.target['Payload']['Compat']
2727
ch = ch.merge(self.target['Payload']['Compat'])

lib/msf/core/module/type.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,42 +18,42 @@ def type
1818
# Returns true if this module is an auxiliary module.
1919
#
2020
def auxiliary?
21-
(type == MODULE_AUX)
21+
(type == Msf::MODULE_AUX)
2222
end
2323

2424
#
2525
# Returns true if this module is an encoder module.
2626
#
2727
def encoder?
28-
(type == MODULE_ENCODER)
28+
(type == Msf::MODULE_ENCODER)
2929
end
3030

3131
#
3232
# Returns true if this module is an exploit module.
3333
#
3434
def exploit?
35-
(type == MODULE_EXPLOIT)
35+
(type == Msf::MODULE_EXPLOIT)
3636
end
3737

3838
#
3939
# Returns true if this module is a nop module.
4040
#
4141
def nop?
42-
(type == MODULE_NOP)
42+
(type == Msf::MODULE_NOP)
4343
end
4444

4545
#
4646
# Returns true if this module is a payload module.
4747
#
4848
def payload?
49-
(type == MODULE_PAYLOAD)
49+
(type == Msf::MODULE_PAYLOAD)
5050
end
5151

5252
#
5353
# Returns true if this module is an post-exploitation module.
5454
#
5555
def post?
56-
(type == MODULE_POST)
56+
(type == Msf::MODULE_POST)
5757
end
5858

5959
#

lib/msf/core/nop.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ class Nop < Msf::Module
1414
# Returns MODULE_NOP to indicate that this is a NOP module.
1515
#
1616
def self.type
17-
return MODULE_NOP
17+
return Msf::MODULE_NOP
1818
end
1919

2020
#
2121
# Returns MODULE_NOP to indicate that this is a NOP module.
2222
#
2323
def type
24-
return MODULE_NOP
24+
return Msf::MODULE_NOP
2525
end
2626

2727
#

lib/msf/core/payload.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,14 @@ def initialize(info = {})
102102
# Returns MODULE_PAYLOAD to indicate that this is a payload module.
103103
#
104104
def self.type
105-
return MODULE_PAYLOAD
105+
return Msf::MODULE_PAYLOAD
106106
end
107107

108108
#
109109
# Returns MODULE_PAYLOAD to indicate that this is a payload module.
110110
#
111111
def type
112-
return MODULE_PAYLOAD
112+
return Msf::MODULE_PAYLOAD
113113
end
114114

115115
#

0 commit comments

Comments
 (0)