MMCT TEAM
Server IP : 111.118.215.189  /  Your IP : 18.117.171.149
Web Server : Apache
System : Linux md-in-83.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : a1673wkz ( 2475)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.pyo
�
r2Wc
@@sdZddlmZy$ddlmZddlmZWnek
r[Z	e
e	��nXddlZddl
mZddlmZmZddlmZmZydd	lmZWn'e
k
r�dZdd
lmZnXddlZddlZddlZddlmZdd
lm Z ddgZ!eZ"iej#j$ej%6ej#j&ej'6Z(e)ed�r�e)ej#d�r�ej#j*e(ej+<ne)ed�r�e)ej#d�r�ej#j,e(ej-<ny!e(j.iej#j/ej06�Wne1k
rnXiej#j2ej36ej#j4ej56ej#j4ej#j6ej76Z8e j9j:j;d�Z<dZ=e j"Z>ej?Z@d�ZAd�ZBdefd��YZd�ZCdeDfd��YZEer�dd�ZFneZFeFeE_Fd�ZGdddddddd �Z?dS(!s!SSL with SNI_-support for Python 2. Follow these instructions if you would
like to verify SSL certificates in Python 2. Note, the default libraries do
*not* do certificate checking; you need to do additional work to validate
certificates yourself.

This needs the following packages installed:

* pyOpenSSL (tested with 0.13)
* ndg-httpsclient (tested with 0.3.2)
* pyasn1 (tested with 0.1.6)

You can install them with the following command:

    pip install pyopenssl ndg-httpsclient pyasn1

To activate certificate checking, call
:func:`~urllib3.contrib.pyopenssl.inject_into_urllib3` from your Python code
before you begin making HTTP requests. This can be done in a ``sitecustomize``
module, or at any other time before your application begins using ``urllib3``,
like this::

    try:
        import urllib3.contrib.pyopenssl
        urllib3.contrib.pyopenssl.inject_into_urllib3()
    except ImportError:
        pass

Now you can use :mod:`urllib3` as you normally would, and it will support SNI
when the required modules are installed.

Activating this module also has the positive side effect of disabling SSL/TLS
compression in Python 2 (see `CRIME attack`_).

If you want to configure the default list of supported cipher suites, you can
set the ``urllib3.contrib.pyopenssl.DEFAULT_SSL_CIPHER_LIST`` variable.

Module Variables
----------------

:var DEFAULT_SSL_CIPHER_LIST: The list of supported SSL/TLS cipher suites.

.. _sni: https://en.wikipedia.org/wiki/Server_Name_Indication
.. _crime attack: https://en.wikipedia.org/wiki/CRIME_(security_exploit)

i(tabsolute_import(tSUBJ_ALT_NAME_SUPPORT(tSubjectAltNameN(tdecoder(tunivt
constraint(ttimeoutterror(t_fileobject(tbackport_makefilei(t
connection(tutiltinject_into_urllib3textract_from_urllib3tPROTOCOL_TLSv1_1tTLSv1_1_METHODtPROTOCOL_TLSv1_2tTLSv1_2_METHODtasciii@cC@stt_tt_tt_dS(s7Monkey-patch urllib3 with PyOpenSSL-backed SSL-support.N(tssl_wrap_socketR
tHAS_SNIRtTruetIS_PYOPENSSL(((s[/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.pyRns		cC@stt_tt_tt_dS(s4Undo monkey-patching by :func:`inject_into_urllib3`.N(torig_connection_ssl_wrap_socketR
Rtorig_util_HAS_SNIRRtFalseR(((s[/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.pyR
vs		RcB@s*eZdZejjejdd�ZRS(s0ASN.1 implementation for subjectAltNames supportii(t__name__t
__module__t__doc__Rt
SequenceOftsizeSpecRtValueSizeConstraint(((s[/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.pyRs	cC@sg}ts|St�}x�t|j��D]�}|j|�}|j�}|dkr_q,n|j�}tj|d|�}x�|D]x}t	|t�s�q�nxZtt
|��D]F}	|j|	�}
|
j�dkr�q�n|j
t|
j���q�Wq�Wq,W|S(NtsubjectAltNametasn1SpectdNSName(RRtrangetget_extension_countt
get_extensiontget_short_nametget_datatder_decodertdecodet
isinstancetlentgetComponentByPositiontgetNametappendtstrtgetComponent(t	peer_certtdns_namet
general_namestitexttext_nametext_dattdecoded_dattnametentryt	component((s[/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.pytget_subj_alt_name�s*		
%t
WrappedSocketcB@s�eZdZed�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
ed�Zd�Zd
�ZRS(s�API-compatibility wrapper for Python OpenSSL's Connection-class.

    Note: _makefile_refs, _drop() and _reuse() are needed for the garbage
    collector of pypy.
    cC@s1||_||_||_d|_t|_dS(Ni(R
tsockettsuppress_ragged_eofst_makefile_refsRt_closed(tselfR
R>R?((s[/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.pyt__init__�s
				cC@s
|jj�S(N(R>tfileno(RB((s[/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.pyRD�scC@s;|jdkr!|jd8_n|jr7|j�ndS(Nii(R@RAtclose(RB((s[/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.pyt_decref_socketios�s	cO@sy|jj||�}Wn�tjjk
rb}|jrM|jdkrMdStt|���n�tjj	k
r�}|jj
�tjjkr�dS�nptjjk
rt
j
|jggg|jj��\}}}|s�td��q|j||�SnX|SdS(Ni����sUnexpected EOFtsThe read operation timed out(i����sUnexpected EOF(R
trecvtOpenSSLtSSLtSysCallErrorR?targstSocketErrorR/tZeroReturnErrortget_shutdowntRECEIVED_SHUTDOWNt
WantReadErrortselectR>t
gettimeoutR(RBRLtkwargstdatatetrdtwdted((s[/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.pyRH�s"*cO@s
y|jj||�SWn�tjjk
r`}|jrK|jdkrKdStt|���n�tjj	k
r�}|jj
�tjjkr�dS�nltjjk
rt
j
|jggg|jj��\}}}|s�td��q|j||�SnXdS(Ni����sUnexpected EOFisThe read operation timed out(i����sUnexpected EOF(R
t	recv_intoRIRJRKR?RLRMR/RNRORPRQRRR>RSR(RBRLRTRVRWRXRY((s[/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.pyRZ�s *cC@s|jj|�S(N(R>t
settimeout(RBR((s[/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.pyR[�scC@s�x}try|jj|�SWqtjjk
r{tjg|jgg|jj��\}}}|st	��qqqXqWdS(N(
RR
tsendRIRJtWantWriteErrorRRR>RSR(RBRUt_twlist((s[/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.pyt_send_until_done�s	cC@sGd}x:|t|�krB|j|||t!�}||7}q	WdS(Ni(R+R`tSSL_WRITE_BLOCKSIZE(RBRUt
total_senttsent((s[/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.pytsendall�scC@s|jj�dS(N(R
tshutdown(RB((s[/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.pyRescC@sZ|jdkrGyt|_|jj�SWqVtjjk
rCdSXn|jd8_dS(Ni(R@RRAR
RERIRJtError(RB((s[/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.pyREs	cC@s~|jj�}|s|S|r8tjjtjj|�Sid|j�jfffd6gt|�D]}d|f^qdd6S(Nt
commonNametsubjecttDNSR (	R
tget_peer_certificateRItcryptotdump_certificatet
FILETYPE_ASN1tget_subjecttCNR<(RBtbinary_formtx509tvalue((s[/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.pytgetpeercerts		cC@s|jd7_dS(Ni(R@(RB((s[/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.pyt_reuse#scC@s/|jdkr|j�n|jd8_dS(Ni(R@RE(RB((s[/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.pyt_drop&s
(RRRRRCRDRFRHRZR[R`RdReRERRsRtRu(((s[/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.pyR=�s									
	i����cC@s%|jd7_t|||dt�S(NiRE(R@RR(RBtmodetbufsize((s[/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.pytmakefile.scC@s
|dkS(Ni((tcnxRqterr_not	err_depthtreturn_code((s[/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.pyt_verify_callback7scC@s�tjjt|�}|r8|p%|}|j|�n|rN|j|�n|tjkrt|jt	|t
�n|s�|r�y|j||�Wq�tjjk
r�}	tj
d||	��q�Xn
|j�d}
|j|
�|jt�tjj||�}t|tj�r,|jd�}n|j|�|j�x�tr�y|j�Wn�tjjk
r�tj|ggg|j��\}}
}
|sFtd��qFqFn,tjjk
r�}	tj
d|	��nXPqFWt||�S(Nsbad ca_certs: %risutf-8sselect timed outsbad handshake: %r( RIRJtContextt_openssl_versionstuse_certificate_filetuse_privatekey_filetsslt	CERT_NONEt
set_verifyt_openssl_verifyR}tload_verify_locationsRftSSLErrortset_default_verify_pathstset_optionstset_cipher_listtDEFAULT_SSL_CIPHER_LISTt
ConnectionR*tsixt	text_typetencodetset_tlsext_host_nametset_connect_stateRtdo_handshakeRQRRRSRR=(tsocktkeyfiletcertfilet	cert_reqstca_certstserver_hostnametssl_versiontca_cert_dirtctxRVtOP_NO_COMPRESSIONRyRWR^((s[/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.pyR;sD




	*(HRt
__future__Rt%ndg.httpsclient.ssl_peer_verificationRtndg.httpsclient.subj_alt_nameRtBaseSubjectAltNametSyntaxErrorRVtImportErrortOpenSSL.SSLRItpyasn1.codec.derRR(tpyasn1.typeRRR>RRRMRtNonet#urllib3.packages.backports.makefileR	R�RRR�RGR
Rt__all__RRJt
SSLv23_METHODtPROTOCOL_SSLv23tTLSv1_METHODtPROTOCOL_TLSv1RthasattrRRRRtupdatetSSLv3_METHODtPROTOCOL_SSLv3tAttributeErrortVERIFY_NONER�tVERIFY_PEERt
CERT_OPTIONALtVERIFY_FAIL_IF_NO_PEER_CERTt
CERT_REQUIREDR�tssl_tDEFAULT_CIPHERSR�R�RaRRRRR
R<tobjectR=RxR}(((s[/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.pyt<module>-sl
!!!
						�			

MMCT - 2023