Skip to content

Commit 7538b3d

Browse files
committed
Fix rapid7#7170, Add HttpTrace option for HttpClient
Fix rapid7#7170
1 parent 14a387e commit 7538b3d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/msf/core/exploit/http/client.rb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ def initialize(info = {})
5454
Opt::SSLVersion,
5555
OptBool.new('FingerprintCheck', [ false, 'Conduct a pre-exploit fingerprint verification', true]),
5656
OptString.new('DOMAIN', [ true, 'The domain to use for windows authentification', 'WORKSTATION']),
57-
OptInt.new('HttpClientTimeout', [false, 'HTTP connection and receive timeout'])
57+
OptInt.new('HttpClientTimeout', [false, 'HTTP connection and receive timeout']),
58+
OptBool.new('HttpTrace', [false, 'Show the raw HTTP requests and responses', false])
5859
], self.class
5960
)
6061

@@ -324,7 +325,10 @@ def send_request_raw(opts={}, timeout = 20)
324325
begin
325326
c = connect(opts)
326327
r = c.request_raw(opts)
327-
c.send_recv(r, actual_timeout)
328+
print_line(r.to_s) if datastore['HttpTrace']
329+
res = c.send_recv(r, actual_timeout)
330+
print_line(res.to_s) if datastore['HttpTrace']
331+
res
328332
rescue ::Errno::EPIPE, ::Timeout::Error
329333
nil
330334
end
@@ -346,7 +350,10 @@ def send_request_cgi(opts={}, timeout = 20)
346350
begin
347351
c = connect(opts)
348352
r = c.request_cgi(opts)
349-
c.send_recv(r, actual_timeout)
353+
print_line(r.to_s) if datastore['HttpTrace']
354+
res = c.send_recv(r, actual_timeout)
355+
print_line(res.to_s) if datastore['HttpTrace']
356+
res
350357
rescue ::Errno::EPIPE, ::Timeout::Error
351358
nil
352359
end

0 commit comments

Comments
 (0)