@@ -138,15 +138,6 @@ def initialize(prompt = DefaultPrompt, prompt_char = DefaultPromptChar, opts = {
138
138
print_error ( "***" )
139
139
end
140
140
141
- begin
142
- require 'openssl'
143
- rescue ::LoadError
144
- print_error ( "***" )
145
- print_error ( "* WARNING: No OpenSSL support. This is required by meterpreter payloads and many exploits" )
146
- print_error ( "* Please install the ruby-openssl package (apt-get install libopenssl-ruby on Debian/Ubuntu" )
147
- print_error ( "***" )
148
- end
149
-
150
141
# Register event handlers
151
142
register_event_handlers
152
143
@@ -191,24 +182,10 @@ def initialize(prompt = DefaultPrompt, prompt_char = DefaultPromptChar, opts = {
191
182
end
192
183
end
193
184
194
- # framework.db.active will be true if after_establish_connection ran directly when connection_established? was
195
- # already true or if framework.db.connect called after_establish_connection.
196
- if !! framework . db . error
197
- if framework . db . error . to_s =~ /RubyGem version.*pg.*0\. 11/i
198
- print_error ( "***" )
199
- print_error ( "*" )
200
- print_error ( "* Metasploit now requires version 0.11 or higher of the 'pg' gem for database support" )
201
- print_error ( "* There a three ways to accomplish this upgrade:" )
202
- print_error ( "* 1. If you run Metasploit with your system ruby, simply upgrade the gem:" )
203
- print_error ( "* $ rvmsudo gem install pg " )
204
- print_error ( "* 2. Use the Community Edition web interface to apply a Software Update" )
205
- print_error ( "* 3. Uninstall, download the latest version, and reinstall Metasploit" )
206
- print_error ( "*" )
207
- print_error ( "***" )
208
- print_error ( "" )
209
- print_error ( "" )
210
- end
211
-
185
+ # framework.db.active will be true if after_establish_connection ran
186
+ # directly when connection_established? was already true or if
187
+ # framework.db.connect called after_establish_connection.
188
+ if !!framework . db . error
212
189
print_error ( "Failed to connect to the database: #{ framework . db . error } " )
213
190
end
214
191
end
@@ -250,108 +227,6 @@ def initialize(prompt = DefaultPrompt, prompt_char = DefaultPromptChar, opts = {
250
227
end
251
228
end
252
229
253
- #
254
- # Configure a default output path for jUnit XML output
255
- #
256
- def junit_setup ( output_path )
257
- output_path = ::File . expand_path ( output_path )
258
-
259
- ::FileUtils . mkdir_p ( output_path )
260
- @junit_output_path = output_path
261
- @junit_error_count = 0
262
- print_status ( "Test Output: #{ output_path } " )
263
-
264
- # We need at least one test success in order to pass
265
- junit_pass ( "framework_loaded" )
266
- end
267
-
268
- #
269
- # Emit a new jUnit XML output file representing an error
270
- #
271
- def junit_error ( tname , ftype , data = nil )
272
-
273
- if not @junit_output_path
274
- raise RuntimeError , "No output path, call junit_setup() first"
275
- end
276
-
277
- data ||= framework . inspect . to_s
278
-
279
- e = REXML ::Element . new ( "testsuite" )
280
-
281
- c = REXML ::Element . new ( "testcase" )
282
- c . attributes [ "classname" ] = "msfrc"
283
- c . attributes [ "name" ] = tname
284
-
285
- f = REXML ::Element . new ( "failure" )
286
- f . attributes [ "type" ] = ftype
287
-
288
- f . text = data
289
- c << f
290
- e << c
291
-
292
- bname = ( "msfrpc_#{ tname } " ) . gsub ( /[^A-Za-z0-9\. \_ ]/ , '' )
293
- bname << "_" + Digest ::MD5 . hexdigest ( tname )
294
-
295
- fname = ::File . join ( @junit_output_path , "#{ bname } .xml" )
296
- cnt = 0
297
- while ::File . exist? ( fname )
298
- cnt += 1
299
- fname = ::File . join ( @junit_output_path , "#{ bname } _#{ cnt } .xml" )
300
- end
301
-
302
- ::File . open ( fname , "w" ) do |fd |
303
- fd . write ( e . to_s )
304
- end
305
-
306
- print_error ( "Test Error: #{ tname } - #{ ftype } - #{ data } " )
307
- end
308
-
309
- #
310
- # Emit a new jUnit XML output file representing a success
311
- #
312
- def junit_pass ( tname )
313
-
314
- if not @junit_output_path
315
- raise RuntimeError , "No output path, call junit_setup() first"
316
- end
317
-
318
- # Generate the structure of a test case run
319
- e = REXML ::Element . new ( "testsuite" )
320
- c = REXML ::Element . new ( "testcase" )
321
- c . attributes [ "classname" ] = "msfrc"
322
- c . attributes [ "name" ] = tname
323
- e << c
324
-
325
- # Generate a unique name
326
- bname = ( "msfrpc_#{ tname } " ) . gsub ( /[^A-Za-z0-9\. \_ ]/ , '' )
327
- bname << "_" + Digest ::MD5 . hexdigest ( tname )
328
-
329
- # Generate the output path, allow multiple test with the same name
330
- fname = ::File . join ( @junit_output_path , "#{ bname } .xml" )
331
- cnt = 0
332
- while ::File . exist? ( fname )
333
- cnt += 1
334
- fname = ::File . join ( @junit_output_path , "#{ bname } _#{ cnt } .xml" )
335
- end
336
-
337
- # Write to our test output location, as specified with junit_setup
338
- ::File . open ( fname , "w" ) do |fd |
339
- fd . write ( e . to_s )
340
- end
341
-
342
- print_good ( "Test Pass: #{ tname } " )
343
- end
344
-
345
-
346
- #
347
- # Emit a jUnit XML output file and throw a fatal exception
348
- #
349
- def junit_fatal_error ( tname , ftype , data )
350
- junit_error ( tname , ftype , data )
351
- print_error ( "Exiting" )
352
- run_single ( "exit -y" )
353
- end
354
-
355
230
#
356
231
# Loads configuration that needs to be analyzed before the framework
357
232
# instance is created.
0 commit comments