Browse Source

Make the debug output more readable

wchen-r7 3 years ago
parent
commit
d59b6d99ee
1 changed files with 34 additions and 4 deletions
  1. 34
    4
      lib/msf/core/exploit/http/client.rb

+ 34
- 4
lib/msf/core/exploit/http/client.rb View File

@@ -325,9 +325,23 @@ module Exploit::Remote::HttpClient
325 325
     begin
326 326
       c = connect(opts)
327 327
       r = c.request_raw(opts)
328
-      print_line(r.to_s) if datastore['HttpTrace']
328
+
329
+      if datastore['HttpTrace']
330
+        print_line('#' * 20)
331
+        print_line('# Request:')
332
+        print_line('#' * 20)
333
+        print_line(r.to_s)
334
+      end
335
+
329 336
       res = c.send_recv(r, actual_timeout)
330
-      print_line(res.to_s) if datastore['HttpTrace']
337
+
338
+      if datastore['HttpTrace']
339
+        print_line('#' * 20)
340
+        print_line('# Response:')
341
+        print_line('#' * 20)
342
+        print_line(res.to_s)
343
+      end
344
+
331 345
       res
332 346
     rescue ::Errno::EPIPE, ::Timeout::Error => e
333 347
       print_line(e.message) if datastore['HttpTrace']
@@ -351,12 +365,28 @@ module Exploit::Remote::HttpClient
351 365
       actual_timeout =  opts[:timeout] || timeout
352 366
     end
353 367
 
368
+    print_line("*" * 20) if datastore['HttpTrace']
369
+
354 370
     begin
355 371
       c = connect(opts)
356 372
       r = c.request_cgi(opts)
357
-      print_line(r.to_s) if datastore['HttpTrace']
373
+
374
+      if datastore['HttpTrace']
375
+        print_line('#' * 20)
376
+        print_line('# Request:')
377
+        print_line('#' * 20)
378
+        print_line(r.to_s)
379
+      end
380
+
358 381
       res = c.send_recv(r, actual_timeout)
359
-      print_line(res.to_s) if datastore['HttpTrace']
382
+
383
+      if datastore['HttpTrace']
384
+        print_line('#' * 20)
385
+        print_line('# Response:')
386
+        print_line('#' * 20)
387
+        print_line(res.to_s)
388
+      end
389
+
360 390
       res
361 391
     rescue ::Errno::EPIPE, ::Timeout::Error => e
362 392
       print_line(e.message) if datastore['HttpTrace']

Loading…
Cancel
Save