@@ -392,10 +392,21 @@ def send_request(req, t = -1)
392
392
conn . put ( req . to_s )
393
393
end
394
394
395
+ # Validates that the client has creds
395
396
def have_creds?
396
397
!( self . username . nil? ) && self . username != ''
397
398
end
398
399
400
+ #
401
+ # Params -
402
+ # res = The 401 response we need to auth from
403
+ # opts = the opts used to generate the request that created this response
404
+ # t = the timeout for the http requests
405
+ # persist = whether to persist the tcp connection for HTTP Pipelining
406
+ #
407
+ # Parses the response for what Authentication methods are supported.
408
+ # Sets the corect authorization options and passes them on to the correct
409
+ # method for sending the next request.
399
410
def send_auth ( res , opts , t , persist )
400
411
supported_auths = res . headers [ 'WWW-Authenticate' ]
401
412
if supported_auths . include? 'Basic'
@@ -434,11 +445,28 @@ def send_auth(res, opts, t, persist)
434
445
return res
435
446
end
436
447
448
+ # Converts username and password into the HTTP Basic
449
+ # authorization string.
437
450
def basic_auth_header ( username , password )
438
451
auth_str = username . to_s + ":" + password . to_s
439
452
auth_str = "Basic " + Rex ::Text . encode_base64 ( auth_str )
440
453
end
441
454
455
+
456
+ #
457
+ # Opts -
458
+ # Inherits all the same options as send_request_cgi
459
+ # Also expects some specific opts
460
+ # DigestAuthUser - The username for DigestAuth
461
+ # DigestAuthPass - The password for DigestAuth
462
+ # DigestAuthIIS - IIS uses a slighlty different implementation, set this for IIS support
463
+ #
464
+ # This method builds new request to complete a Digest Authentication cycle.
465
+ # We do not persist the original connection , to clear state in preparation for our auth
466
+ # We do persist the rest of the connection stream because Digest is a tcp session
467
+ # based authentication method.
468
+ #
469
+
442
470
def digest_auth ( opts = { } )
443
471
@nonce_count = 0
444
472
@@ -572,6 +600,15 @@ def digest_auth(opts={})
572
600
end
573
601
end
574
602
603
+ #
604
+ # Opts -
605
+ # Inherits all the same options as send_request_cgi
606
+ # provider - What Negotiate Provider to use (supports NTLM and Negotiate)
607
+ #
608
+ # Builds a series of requests to complete Negotiate Auth. Works essentially
609
+ # the same way as Digest auth. Same pipelining concerns exist.
610
+ #
611
+
575
612
def negotiate_auth ( opts = { } )
576
613
ntlm_options = {
577
614
:signing => false ,
0 commit comments