Browse Source

Inconstancy - If datastore['VERBOSE'] vs vprint

g0tmi1k 4 years ago
parent
commit
ce9481d2b7

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

@@ -36,14 +36,14 @@ module Exploit::DHCPServer
36 36
 
37 37
   def start_service(hash = {}, context = {})
38 38
     @dhcp = Rex::Proto::DHCP::Server.new(hash, context)
39
-    print_status("Starting DHCP server") if datastore['VERBOSE']
39
+    vprint_status("Starting DHCP server")
40 40
     @dhcp.start
41 41
     add_socket(@dhcp.sock)
42 42
     @dhcp
43 43
   end
44 44
 
45 45
   def stop_service
46
-    print_status("Stopping DHCP server") if datastore['VERBOSE']
46
+    vprint_status("Stopping DHCP server")
47 47
     @dhcp.stop
48 48
   end
49 49
 

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

@@ -20,14 +20,14 @@ module Exploit::TFTPServer
20 20
   def start_service(tag, exe)
21 21
     @tftp = Rex::Proto::TFTP::Server.new
22 22
     @tftp.register_file(tag, exe)
23
-    print_status("Starting TFTP server to host \"#{tag}\" (#{exe.length} bytes)") if datastore['VERBOSE']
23
+    vprint_status("Starting TFTP server to host \"#{tag}\" (#{exe.length} bytes)")
24 24
     @tftp.start
25 25
     add_socket(@tftp.sock)
26 26
     @tftp
27 27
   end
28 28
 
29 29
   def stop_service
30
-    print_status("Stopping TFTP server") if datastore['VERBOSE']
30
+    vprint_status("Stopping TFTP server")
31 31
     @tftp.stop
32 32
   end
33 33
 

+ 1
- 1
modules/auxiliary/spoof/replay/pcap_replay.rb View File

@@ -47,7 +47,7 @@ class Metasploit3 < Msf::Auxiliary
47 47
     open_pcap
48 48
     print_status("Sending file...") unless verbose
49 49
     while (loop > 0 or infinity) do
50
-      vprint_status("Sending file (loop : #{count = count + 1})")
50
+      vprint_status("Sending file (loop: #{count = count + 1})")
51 51
       inject_pcap(filename, file_filter, pkt_delay )
52 52
       loop -= 1 unless infinity
53 53
       Kernel.select(nil, nil, nil, (delay * 1.0)/1000) if loop > 0 or infinity

+ 3
- 3
modules/exploits/multi/http/jboss_invoke_deploy.rb View File

@@ -102,7 +102,7 @@ class Metasploit4 < Msf::Exploit::Remote
102 102
     return Exploit::CheckCode::Appears if res.body =~ /SVNTag=JBoss_4_/
103 103
     return Exploit::CheckCode::Appears if res.body =~ /SVNTag=JBoss_5_/
104 104
 
105
-    if res.body =~ /ServletException/	# Simple check, if we caused an exception.
105
+    if res.body =~ /ServletException/   # Simple check, if we caused an exception.
106 106
       vprint_status('Target seems vulnerable, but the used JBoss version is not supported by this exploit')
107 107
       return Exploit::CheckCode::Appears
108 108
     end
@@ -302,13 +302,13 @@ EOT
302 302
       elsif res.code < 200 || res.code >= 300
303 303
         msg = "http request failed to #{uri} [#{res.code}]"
304 304
       elsif res.code == 200
305
-        print_status("Successfully called '#{uri}'") if datastore['VERBOSE']
305
+        vprint_status("Successfully called '#{uri}'")
306 306
         return res
307 307
       end
308 308
 
309 309
       if attempt < num_attempts - 1
310 310
         msg << ', retrying in 5 seconds...'
311
-        print_status(msg) if datastore['VERBOSE']
311
+        vprint_status(msg)
312 312
         select(nil, nil, nil, 5)
313 313
       else
314 314
         print_error(msg)

+ 13
- 13
modules/post/multi/manage/shell_to_meterpreter.rb View File

@@ -78,15 +78,15 @@ class Metasploit3 < Msf::Post
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 @@ class Metasploit3 < Msf::Post
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 @@ class Metasploit3 < Msf::Post
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 @@ class Metasploit3 < Msf::Post
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 @@ class Metasploit3 < Msf::Post
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

+ 1
- 1
modules/post/windows/gather/credentials/spark_im.rb View File

@@ -131,7 +131,7 @@ class Metasploit3 < Msf::Post
131 131
           end
132 132
 
133 133
           hash = pass.split("password").join.chomp
134
-          print_status("Spark password hash: #{hash}") if datastore['VERBOSE']
134
+          vprint_status("Spark password hash: #{hash}")
135 135
 
136 136
           # call method to decrypt hash
137 137
           decrypt(hash)

Loading…
Cancel
Save