@@ -52,7 +52,8 @@ def initialize(info = {})
52
52
OptBool . new ( 'SSL' , [ false , 'Negotiate SSL for outgoing connections' , false ] ) ,
53
53
OptEnum . new ( 'SSLVersion' , [ false , 'Specify the version of SSL that should be used' , 'Auto' , [ 'Auto' , 'SSL2' , 'SSL3' , 'TLS1' ] ] ) ,
54
54
OptBool . new ( 'FingerprintCheck' , [ false , 'Conduct a pre-exploit fingerprint verification' , true ] ) ,
55
- OptString . new ( 'DOMAIN' , [ true , 'The domain to use for windows authentification' , 'WORKSTATION' ] )
55
+ OptString . new ( 'DOMAIN' , [ true , 'The domain to use for windows authentification' , 'WORKSTATION' ] ) ,
56
+ OptInt . new ( 'HttpClientTimeout' , [ false , 'HTTP connection and receive timeout' , 20 ] )
56
57
] , self . class
57
58
)
58
59
@@ -307,10 +308,11 @@ def cleanup
307
308
# Passes +opts+ through directly to Rex::Proto::Http::Client#request_raw.
308
309
#
309
310
def send_request_raw ( opts = { } , timeout = 20 )
311
+ actual_timeout = datastore [ 'HttpClientTimeout' ] || opts [ :timeout ] || timeout
310
312
begin
311
313
c = connect ( opts )
312
314
r = c . request_raw ( opts )
313
- c . send_recv ( r , opts [ :timeout ] ? opts [ :timeout ] : timeout )
315
+ c . send_recv ( r , actual_timeout )
314
316
rescue ::Errno ::EPIPE , ::Timeout ::Error
315
317
nil
316
318
end
@@ -323,10 +325,11 @@ def send_request_raw(opts={}, timeout = 20)
323
325
# Passes +opts+ through directly to Rex::Proto::Http::Client#request_cgi.
324
326
#
325
327
def send_request_cgi ( opts = { } , timeout = 20 )
328
+ actual_timeout = datastore [ 'HttpClientTimeout' ] || opts [ :timeout ] || timeout
326
329
begin
327
330
c = connect ( opts )
328
331
r = c . request_cgi ( opts )
329
- c . send_recv ( r , opts [ :timeout ] ? opts [ :timeout ] : timeout )
332
+ c . send_recv ( r , actual_timeout )
330
333
rescue ::Errno ::EPIPE , ::Timeout ::Error
331
334
nil
332
335
end
@@ -341,7 +344,8 @@ def send_request_cgi(opts={}, timeout = 20)
341
344
# will contain the full URI.
342
345
#
343
346
def send_request_cgi! ( opts = { } , timeout = 20 , redirect_depth = 1 )
344
- res = send_request_cgi ( opts , timeout )
347
+ actual_timeout = datastore [ 'HttpClientTimeout' ] || opts [ :timeout ] || timeout
348
+ res = send_request_cgi ( opts , actual_timeout )
345
349
return res unless res && res . redirect? && redirect_depth > 0
346
350
347
351
redirect_depth -= 1
@@ -360,7 +364,7 @@ def send_request_cgi!(opts={}, timeout = 20, redirect_depth = 1)
360
364
opts [ 'ssl' ] = false
361
365
end
362
366
363
- send_request_cgi! ( opts , timeout , redirect_depth )
367
+ send_request_cgi! ( opts , actual_timeout , redirect_depth )
364
368
end
365
369
366
370
#
0 commit comments