ROOTPLOIT
Server: LiteSpeed
System: Linux server71.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User: niphet (1079)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/requests/__pycache__/auth.cpython-36.opt-1.pyc
3

['@sdZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
mZmZddl
mZddlmZddlmZd	Zd
ZddZGd
ddeZGdddeZGdddeZGdddeZdS)z]
requests.auth
~~~~~~~~~~~~~

This module contains the authentication handlers for Requests.
N)	b64encode)urlparsestr
basestring)extract_cookies_to_jar)to_native_string)parse_dict_headerz!application/x-www-form-urlencodedzmultipart/form-datacCst|ts&tjdj|tdt|}t|tsLtjdj|tdt|}t|tr`|jd}t|trt|jd}dtt	dj
||fj}|S)zReturns a Basic Auth string.zNon-string usernames will no longer be supported in Requests 3.0.0. Please convert the object you've passed in ({!r}) to a string or bytes object in the near future to avoid problems.)categoryzNon-string passwords will no longer be supported in Requests 3.0.0. Please convert the object you've passed in ({!r}) to a string or bytes object in the near future to avoid problems.latin1zBasic :)
isinstancerwarningswarnformatDeprecationWarningrencoderrjoinstrip)usernamepasswordZauthstrr/usr/lib/python3.6/auth.py_basic_auth_strs&






rc@seZdZdZddZdS)AuthBasez4Base class that all auth implementations derive fromcCstddS)NzAuth hooks must be callable.)NotImplementedError)selfrrrr__call__KszAuthBase.__call__N)__name__
__module____qualname____doc__rrrrrrHsrc@s0eZdZdZddZddZddZdd	Zd
S)
HTTPBasicAuthz?Attaches HTTP Basic Authentication to the given Request object.cCs||_||_dS)N)rr)rrrrrr__init__RszHTTPBasicAuth.__init__cCs(t|jt|ddk|jt|ddkgS)Nrr)allrgetattrr)rotherrrr__eq__VszHTTPBasicAuth.__eq__cCs
||kS)Nr)rr'rrr__ne__\szHTTPBasicAuth.__ne__cCst|j|j|jd<|S)N
Authorization)rrrheaders)rrrrrr_szHTTPBasicAuth.__call__N)rr r!r"r$r(r)rrrrrr#Os
r#c@seZdZdZddZdS)
HTTPProxyAuthz=Attaches HTTP Proxy Authentication to a given Request object.cCst|j|j|jd<|S)NzProxy-Authorization)rrrr+)rrrrrrgszHTTPProxyAuth.__call__N)rr r!r"rrrrrr,dsr,c@sPeZdZdZddZddZddZdd	Zd
dZdd
Z	ddZ
ddZdS)HTTPDigestAuthz@Attaches HTTP Digest Authentication to the given Request object.cCs||_||_tj|_dS)N)rr	threadingZlocal
_thread_local)rrrrrrr$oszHTTPDigestAuth.__init__cCs@t|jds<d|j_d|j_d|j_i|j_d|j_d|j_dS)NinitTr)hasattrr/r0
last_noncenonce_countchalpos
num_401_calls)rrrrinit_per_thread_stateusz$HTTPDigestAuth.init_per_thread_statecs|jjd}|jjd}|jjjd}|jjjd}|jjjd}d|dkrTd}n|j}|dksl|dkrzd	d
}	|	n@|dkrdd
}
|
n*|dkrdd}|n|dkrdd}|fdd}
dkrdSd}t|}|jpd}|jr|d|j7}d|j||jf}d||f}|}|}||jj	krJ|jj
d7_
nd|j_
d|jj
}t|jj
jd}||jd7}|t
jjd7}|tjd7}tj|jdd}|dkrЈd|||f}|s|
|d||f}n<|dksd|jd kr"d!|||d|f}|
||}ndS||j_	d"|j||||f}|rT|d#|7}|rf|d$|7}|rx|d%|7}|r|d&||f7}d'|S)(z
        :rtype: str
        realmnonceqop	algorithmopaqueNZMD5zMD5-SESScSs"t|tr|jd}tj|jS)Nzutf-8)r
rrhashlibZmd5	hexdigest)xrrrmd5_utf8s

z4HTTPDigestAuth.build_digest_header.<locals>.md5_utf8ZSHAcSs"t|tr|jd}tj|jS)Nzutf-8)r
rrr>sha1r?)r@rrrsha_utf8s

z4HTTPDigestAuth.build_digest_header.<locals>.sha_utf8zSHA-256cSs"t|tr|jd}tj|jS)Nzutf-8)r
rrr>Zsha256r?)r@rrrsha256_utf8s

z7HTTPDigestAuth.build_digest_header.<locals>.sha256_utf8zSHA-512cSs"t|tr|jd}tj|jS)Nzutf-8)r
rrr>Zsha512r?)r@rrrsha512_utf8s

z7HTTPDigestAuth.build_digest_header.<locals>.sha512_utf8csd||fS)Nz%s:%sr)sd)	hash_utf8rr<lambda>sz4HTTPDigestAuth.build_digest_header.<locals>.<lambda>/?z%s:%s:%sz%s:%srz%08xzutf-8Zauth,z%s:%s:%s:%s:%sz>username="%s", realm="%s", nonce="%s", uri="%s", response="%s"z
, opaque="%s"z, algorithm="%s"z
, digest="%s"z , qop="auth", nc=%s, cnonce="%s"z	Digest %s)r/r5getupperrpathZqueryrrr3r4rrtimeZctimeosurandomr>rBr?split)rmethodurlr9r:r;r<r=Z
_algorithmrArCrDrEZKDZentdigZp_parsedrQZA1ZA2ZHA1ZHA2ZncvaluerFZcnonceZrespdigZnoncebitbaser)rHrbuild_digest_headers~

z"HTTPDigestAuth.build_digest_headercKs|jrd|j_dS)z)Reset num_401_calls counter on redirects.rN)Zis_redirectr/r7)rrkwargsrrrhandle_redirectszHTTPDigestAuth.handle_redirectcKs"d|jkodkns&d|j_|S|jjdk	rD|jjj|jj|jjdd}d|j	koh|jjdkr|jjd7_t
jd	t
jd
}t
|jd|dd|j_|j|j|jj}t|j|j|j|j|j|j|j|j|jd<|jj|f|}|jj|||_|Sd|j_|S)
zo
        Takes the given response and tries digest-auth, if needed.

        :rtype: requests.Response
        iirNzwww-authenticater1Zdigestzdigest )flags)countr*)Zstatus_coder/r7r6Zrequestbodyseekr+rOlowerrecompile
IGNORECASEr	subr5ZcontentclosecopyrZ_cookiesrawZprepare_cookiesrYrVrWZ
connectionsendhistoryappend)rrrZZs_authZpatZprepZ_rrrr
handle_401s.	
zHTTPDigestAuth.handle_401cCs~|j|jjr&|j|j|j|jd<y|jj|j_	Wnt
k
rTd|j_	YnX|jd|j|jd|j
d|j_|S)Nr*Zresponser)r8r/r3rYrVrWr+r_tellr6AttributeErrorZ
register_hookrlr[r7)rrrrrrszHTTPDigestAuth.__call__cCs(t|jt|ddk|jt|ddkgS)Nrr)r%rr&r)rr'rrrr(*szHTTPDigestAuth.__eq__cCs
||kS)Nr)rr'rrrr)0szHTTPDigestAuth.__ne__N)rr r!r"r$r8rYr[rlrr(r)rrrrr-ls
f,r-)r"rSrbrRr>r.rbase64rcompatrrrZcookiesrZ_internal_utilsrZutilsr	ZCONTENT_TYPE_FORM_URLENCODEDZCONTENT_TYPE_MULTI_PARTrobjectrr#r,r-rrrr<module>s$,