Browse Source

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.
Luke Imhoff 5 years ago
parent
commit
0c00c7cc50
No account linked to committer's email address

+ 6
- 6
lib/msf/base/serializer/readable_text.rb View File

@@ -20,17 +20,17 @@ class ReadableText
20 20
   # @return [String] formatted text output of the dump.
21 21
   def self.dump_module(mod, indent = "  ")
22 22
     case mod.type
23
-      when MODULE_PAYLOAD
23
+      when Msf::MODULE_PAYLOAD
24 24
         return dump_payload_module(mod, indent)
25
-      when MODULE_NOP
25
+      when Msf::MODULE_NOP
26 26
         return dump_basic_module(mod, indent)
27
-      when MODULE_ENCODER
27
+      when Msf::MODULE_ENCODER
28 28
         return dump_basic_module(mod, indent)
29
-      when MODULE_EXPLOIT
29
+      when Msf::MODULE_EXPLOIT
30 30
         return dump_exploit_module(mod, indent)
31
-      when MODULE_AUX
31
+      when Msf::MODULE_AUX
32 32
         return dump_auxiliary_module(mod, indent)
33
-      when MODULE_POST
33
+      when Msf::MODULE_POST
34 34
         return dump_post_module(mod, indent)
35 35
       else
36 36
         return dump_generic_module(mod, indent)

+ 6
- 6
lib/msf/base/simple/framework.rb View File

@@ -54,12 +54,12 @@ module Framework
54 54
 
55 55
   ModuleSimplifiers =
56 56
     {
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,
63 63
     }
64 64
 
65 65
   #

+ 2
- 2
lib/msf/core/auxiliary.rb View File

@@ -21,14 +21,14 @@ class Auxiliary < Msf::Module
21 21
   # Returns MODULE_AUX to indicate that this is an auxiliary module.
22 22
   #
23 23
   def self.type
24
-    MODULE_AUX
24
+    Msf::MODULE_AUX
25 25
   end
26 26
 
27 27
   #
28 28
   # Returns MODULE_AUX to indicate that this is an auxiliary module.
29 29
   #
30 30
   def type
31
-    MODULE_AUX
31
+    Msf::MODULE_AUX
32 32
   end
33 33
 
34 34
   #

+ 2
- 2
lib/msf/core/encoder.rb View File

@@ -150,14 +150,14 @@ class Encoder < Module
150 150
   # Returns MODULE_ENCODER to indicate that this is an encoder module.
151 151
   #
152 152
   def self.type
153
-    return MODULE_ENCODER
153
+    return Msf::MODULE_ENCODER
154 154
   end
155 155
 
156 156
   #
157 157
   # Returns MODULE_ENCODER to indicate that this is an encoder module.
158 158
   #
159 159
   def type
160
-    return MODULE_ENCODER
160
+    return Msf::MODULE_ENCODER
161 161
   end
162 162
 
163 163
   #

+ 2
- 2
lib/msf/core/exploit.rb View File

@@ -621,14 +621,14 @@ class Exploit < Msf::Module
621 621
   # Returns MODULE_EXPLOIT to indicate that this is an exploit module.
622 622
   #
623 623
   def self.type
624
-    MODULE_EXPLOIT
624
+    Msf::MODULE_EXPLOIT
625 625
   end
626 626
 
627 627
   #
628 628
   # Returns MODULE_EXPLOIT to indicate that this is an exploit module.
629 629
   #
630 630
   def type
631
-    MODULE_EXPLOIT
631
+    Msf::MODULE_EXPLOIT
632 632
   end
633 633
 
634 634
   #

+ 1
- 1
lib/msf/core/framework.rb View File

@@ -69,7 +69,7 @@ class Framework
69 69
   def initialize(opts={})
70 70
 
71 71
     # Allow specific module types to be loaded
72
-    types = opts[:module_types] || MODULE_TYPES
72
+    types = opts[:module_types] || Msf::MODULE_TYPES
73 73
 
74 74
     self.threads   = ThreadManager.new(self)
75 75
     self.events    = EventDispatcher.new(self)

+ 3
- 3
lib/msf/core/module/compatibility.rb View File

@@ -17,11 +17,11 @@ module Msf::Module::Compatibility
17 17
     return true if (mod == nil)
18 18
 
19 19
     # Determine which hash to used based on the supplied module type
20
-    if (mod.type == MODULE_ENCODER)
20
+    if (mod.type == Msf::MODULE_ENCODER)
21 21
       ch = self.compat['Encoder']
22
-    elsif (mod.type == MODULE_NOP)
22
+    elsif (mod.type == Msf::MODULE_NOP)
23 23
       ch = self.compat['Nop']
24
-    elsif (mod.type == MODULE_PAYLOAD)
24
+    elsif (mod.type == Msf::MODULE_PAYLOAD)
25 25
       ch = self.compat['Payload']
26 26
       if self.respond_to?("target") and self.target and self.target['Payload'] and self.target['Payload']['Compat']
27 27
         ch = ch.merge(self.target['Payload']['Compat'])

+ 6
- 6
lib/msf/core/module/type.rb View File

@@ -18,42 +18,42 @@ module Msf::Module::Type
18 18
   # Returns true if this module is an auxiliary module.
19 19
   #
20 20
   def auxiliary?
21
-    (type == MODULE_AUX)
21
+    (type == Msf::MODULE_AUX)
22 22
   end
23 23
 
24 24
   #
25 25
   # Returns true if this module is an encoder module.
26 26
   #
27 27
   def encoder?
28
-    (type == MODULE_ENCODER)
28
+    (type == Msf::MODULE_ENCODER)
29 29
   end
30 30
 
31 31
   #
32 32
   # Returns true if this module is an exploit module.
33 33
   #
34 34
   def exploit?
35
-    (type == MODULE_EXPLOIT)
35
+    (type == Msf::MODULE_EXPLOIT)
36 36
   end
37 37
 
38 38
   #
39 39
   # Returns true if this module is a nop module.
40 40
   #
41 41
   def nop?
42
-    (type == MODULE_NOP)
42
+    (type == Msf::MODULE_NOP)
43 43
   end
44 44
 
45 45
   #
46 46
   # Returns true if this module is a payload module.
47 47
   #
48 48
   def payload?
49
-    (type == MODULE_PAYLOAD)
49
+    (type == Msf::MODULE_PAYLOAD)
50 50
   end
51 51
 
52 52
   #
53 53
   # Returns true if this module is an post-exploitation module.
54 54
   #
55 55
   def post?
56
-    (type == MODULE_POST)
56
+    (type == Msf::MODULE_POST)
57 57
   end
58 58
 
59 59
   #

+ 2
- 2
lib/msf/core/nop.rb View File

@@ -14,14 +14,14 @@ class Nop < Msf::Module
14 14
   # Returns MODULE_NOP to indicate that this is a NOP module.
15 15
   #
16 16
   def self.type
17
-    return MODULE_NOP
17
+    return Msf::MODULE_NOP
18 18
   end
19 19
 
20 20
   #
21 21
   # Returns MODULE_NOP to indicate that this is a NOP module.
22 22
   #
23 23
   def type
24
-    return MODULE_NOP
24
+    return Msf::MODULE_NOP
25 25
   end
26 26
 
27 27
   #

+ 2
- 2
lib/msf/core/payload.rb View File

@@ -102,14 +102,14 @@ class Payload < Msf::Module
102 102
   # Returns MODULE_PAYLOAD to indicate that this is a payload module.
103 103
   #
104 104
   def self.type
105
-    return MODULE_PAYLOAD
105
+    return Msf::MODULE_PAYLOAD
106 106
   end
107 107
 
108 108
   #
109 109
   # Returns MODULE_PAYLOAD to indicate that this is a payload module.
110 110
   #
111 111
   def type
112
-    return MODULE_PAYLOAD
112
+    return Msf::MODULE_PAYLOAD
113 113
   end
114 114
 
115 115
   #

+ 1
- 1
lib/msf/core/payload_set.rb View File

@@ -21,7 +21,7 @@ class PayloadSet < ModuleSet
21 21
   # set class that has custom handling for payloads.
22 22
   #
23 23
   def initialize
24
-    super(MODULE_PAYLOAD)
24
+    super(Msf::MODULE_PAYLOAD)
25 25
 
26 26
     # A hash of each of the payload types that holds an array
27 27
     # for all of the associated modules

+ 6
- 6
lib/msf/ui/console/command_dispatcher/core.rb View File

@@ -2364,17 +2364,17 @@ class Core
2364 2364
     dispatcher = nil
2365 2365
 
2366 2366
     case mod.type
2367
-      when MODULE_ENCODER
2367
+      when Msf::MODULE_ENCODER
2368 2368
         dispatcher = Msf::Ui::Console::CommandDispatcher::Encoder
2369
-      when MODULE_EXPLOIT
2369
+      when Msf::MODULE_EXPLOIT
2370 2370
         dispatcher = Msf::Ui::Console::CommandDispatcher::Exploit
2371
-      when MODULE_NOP
2371
+      when Msf::MODULE_NOP
2372 2372
         dispatcher = Msf::Ui::Console::CommandDispatcher::Nop
2373
-      when MODULE_PAYLOAD
2373
+      when Msf::MODULE_PAYLOAD
2374 2374
         dispatcher = Msf::Ui::Console::CommandDispatcher::Payload
2375
-      when MODULE_AUX
2375
+      when Msf::MODULE_AUX
2376 2376
         dispatcher = Msf::Ui::Console::CommandDispatcher::Auxiliary
2377
-      when MODULE_POST
2377
+      when Msf::MODULE_POST
2378 2378
         dispatcher = Msf::Ui::Console::CommandDispatcher::Post
2379 2379
       else
2380 2380
         print_error("Unsupported module type: #{mod.type}")

Loading…
Cancel
Save