403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /usr/lib64/python3.9/site-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /usr/lib64/python3.9/site-packages/mercurial/__pycache__/sslutil.cpython-39.pyc
a

�+�b��@sRddlmZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZddlm
Z
mZmZmZddlmZmZmZhd	�Ze	ed
d�Ze�Ze	ede�ed
��r�e�d�e	ede�ed��r�e�d�e	ede�ed��r�e�d�dd�Zdd�Zd)dd�Zd*dd�ZGdd�de�Zd+dd �Z d!d"�Z!d#d$�Z"d%d&�Z#d'd(�Z$dS),�)�absolute_importN�)�_)�getattr)�hex)�encoding�error�pycompat�util)�hashutil�resourceutil�
stringutil>�tls1.2�tls1.0�tls1.1ZHAS_SNIFZ	HAS_TLSv1�PROTOCOL_TLSv1rZHAS_TLSv1_1�PROTOCOL_TLSv1_1rZHAS_TLSv1_2�PROTOCOL_TLSv1_2rc
	Cs�t�|�}dgddddddd�}dd�}tdhs6J�d}d	}|�d
||�}|||�d|}|�d
||�}|||�|jr�d}||d	<|�d
d�}|�d
d
||�}||d<|�d
d|�}	|	D]^}
|
�d�s�tjt	d�||
ft	d�d��|
�
dd�\}}
|
�dd���}
|d�
||
f�q�|�d|�D]0}
|
�dd���}
|d�
d|
f�d|d<�q.|d�r~tj|d<d|d<n"|j�r�d|d<tj|d<d|d<|�dd��r�d|d<|�d
d|�}|d�r�|�r�|�t	d �|�|ddu�r�|�r:t�|�}tj�|��s0t�t	d!�d"|f|f��||d#<nl|�d$d%�}|�rxt�|�}tj�|��s�t�t	d&�|��n&|d�r�t|�}|�r�|�d'|�||d#<|�s�|d�r�tj|d<n
tj|d<|ddu�s�J�|S)(zhObtain security settings for a hostname.

    Returns a dict of settings relevant to that hostname.
    TNF)�allowloaddefaultcerts�certfingerprints�cafile�disablecertverification�legacyfingerprint�minimumprotocol�
verifymode�cipherscSs8|tvr4tjtd�||ftd�d�tt��d��dS)Ns-unsupported protocol from hostsecurity.%s: %ssvalid protocols: %s� ��hint)�configprotocolsr�Abortr�join�sorted)�protocol�key�r%�7/usr/lib64/python3.9/site-packages/mercurial/sslutil.py�validateprotocolZs���z'_hostsettings.<locals>.validateprotocolrrr�hostsecuritys%s:minimumprotocolrs
%s:cipherss%s:fingerprints)ssha1:ssha256:ssha512:sinvalid fingerprint for %s: %ss0must begin with "sha1:", "sha256:", or "sha512:"r�:r�rshostfingerprints�sha1rrrr�develsdisableloaddefaultcertss%s:verifycertsfiless(hostsecurity.%s:verifycertsfile ignored when host fingerprints defined; using host fingerprints for verification)
s'path specified by %s does not exist: %sshostsecurity.%s:verifycertsfilerswebscacertsscould not find web.cacerts: %ssusing %s for CA file
)r	�bytesurl�supportedprotocols�configZinsecureconnectionsZ
configlist�
startswithrr r�split�replace�lower�append�ssl�	CERT_NONEZ
configbool�warnr
Z
expandpath�os�path�exists�_defaultcacerts�debug�
CERT_REQUIRED)
�ui�hostnameZ	bhostname�sr'Zdefaultminimumprotocolr$�minimumprotocolZciphersZfingerprints�fingerprintZalg�cafiler%r%r&�
_hostsettings=s�
�

�
�



���
���


�

rDcCsz|tvrtd|��tjtjB}|dkr*n<|dkr>|tjO}n(|dkrX|tjtjBO}nt�t	d���|t
tdd�O}|S)z8Return SSLContext options common to servers and clients.s protocol value not supported: %srrrsthis should not happenZOP_NO_COMPRESSIONr)r�
ValueErrorr5ZOP_NO_SSLv2ZOP_NO_SSLv3ZOP_NO_TLSv1Z
OP_NO_TLSv1_1rr rr)rA�optionsr%r%r&�commonssloptions�srGcs�|st�td���dtjvrfz,ddl}|�t�tjd����	d�Wnt
yd��	d�Yn0��fD]8}|rntj�
|�sntjtd�|t�|�ftd�d	��qnt�|�}t�tj�}|jt|d
�O_|d|_|d�rXz|�t�|d��WnVtj�yV}	z:tjtd
�t�|	jd�td�|dd	��WYd}	~	n
d}	~	00�du�r����fdd�}
|���|
�|ddu�r z|j|dd�Wnvtj�y}	zZt|	j�dk�r�|	jd}n
|	jd}tjtd�|dt�|�ftd�d	��WYd}	~	n
d}	~	00d}n|d�r8|��d}nd}z|j ||d�}
W�nVtj�y�}	�z8z2|�r�|dtj!k�r�|�"��s���#td��Wntj�y�Yn0t$�%|	d��r�|	j&dk�rn|d
dk�r&t'dhk�r��#td�t�|�d�(t)t'��f�n��#td �t�|��nF��#td!�|d
t�|�f���#td"�t�|����#td#��n"|	j&d$k�r�tj*�r���#td%���WYd}	~	n
d}	~	00|
�+��s�t�,td&���|||�d'�|
_-|
S)(a�Add SSL/TLS to a socket.

    This is a glorified wrapper for ``ssl.wrap_socket()``. It makes sane
    choices based on what security options are available.

    In addition to the arguments supported by ``ssl.wrap_socket``, we allow
    the following additional arguments:

    * serverhostname - The expected hostname of the remote server. If the
      server (and client) support SNI, this tells the server which certificate
      to use.
    s#serverhostname argument is requireds
SSLKEYLOGFILErNs8sslkeylog enabled by SSLKEYLOGFILE environment variable
s?sslkeylog module missing, but SSLKEYLOGFILE set in environment
s:certificate file (%s) does not exist; cannot connect to %ss:restore missing file or fix references in Mercurial configrrrrscould not set ciphers: %ss#change cipher string (%s) in configcs�p�}��td�|d�S)Nspassphrase for %s: r*)Zgetpassr)�f��certfile�keyfiler>r%r&�passwordMszwrapsocket.<locals>.passwordr�rCrserror loading CA file %s: %ssfile is empty or malformed?TrF)Zserver_hostnames�(an attempt was made to load CA certificates but none were loaded; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error)
sreasonZUNSUPPORTED_PROTOCOLrs�(could not communicate with %s using security protocols %s; if you are using a modern Mercurial version, consider contacting the operator of this server; see https://mercurial-scm.org/wiki/SecureConnections for more info)
�, s�(could not communicate with %s using TLS 1.0; the likely cause of this is the server no longer supports TLS 1.0 because it has known security vulnerabilities; see https://mercurial-scm.org/wiki/SecureConnections for more info)
s�(could not negotiate a common security protocol (%s+) with %s; the likely cause is Mercurial is configured to be more secure than the server can support)
s�(consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.%s:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
sE(see https://mercurial-scm.org/wiki/SecureConnections for more info)
ZCERTIFICATE_VERIFY_FAILEDsR(the full certificate chain may not be available locally; see "hg help debugssl")
sssl connection failed)�caloaded�hostname�settings�ui).rr rr�environ�	sslkeylogZ
set_keylogr	�fsdecodeZ
warnnoi18n�ImportErrorr8r9r:r-rDr5�
SSLContext�PROTOCOL_SSLv23rFrG�verify_mode�set_ciphersZsysstrZSSLErrorr
�forcebytestr�args�load_cert_chain�load_verify_locations�lenZload_default_certs�wrap_socketr=Zget_ca_certsr7r
�safehasattr�reasonr.r!r"Z	iswindowsZcipher�
SecurityError�_hgstate)�sockrKrJr>ZserverhostnamerTrH�settings�
sslcontext�erL�msgZcaloadedZ	sslsocketr%rIr&�
wrapsockets

���
���	



���

��
�����	�	�����������������
�rjcCs�|||fD]&}|r
tj�|�s
t�td�|��q
tj}td�}|�	dd�}	|	dkrrdt
vrjt�td���tj}nb|	dkr�dt
vr�t�td���tj}n<|	dkr�dt
vr�t�td	���tj
}n|	r�t�td
�|	��t�|�}
|
j|O_|
jttdd�O_|
jttd
d�O_t�td��rH|
jttdd�O_|
�tj�|�rXtj|
_ntj|
_|�sl|�rz|
j||d�|�r�|
j|d�|
j|dd�S)a�Wrap a socket for use by servers.

    ``certfile`` and ``keyfile`` specify the files containing the certificate's
    public and private keys, respectively. Both keys can be defined in the same
    file via ``certfile`` (the private key must come first in the file).

    ``cafile`` defines the path to certificate authorities.

    ``requireclientcert`` specifies whether to require client certificates.

    Typically ``cafile`` is only defined if ``requireclientcert`` is true.
    s/referenced certificate file (%s) does not existrr,sserverexactprotocols$TLS 1.0 not supported by this Pythonrs$TLS 1.1 not supported by this Pythonrs$TLS 1.2 not supported by this Pythons)invalid value for serverexactprotocol: %sZOP_SINGLE_DH_USErZOP_SINGLE_ECDH_USEs_RESTRICTED_SERVER_CIPHERSZOP_CIPHER_SERVER_PREFERENCE)rJrKrMT)Zserver_side)r8r9r:rr rr5rXrGr/r.rrrrWrFrr
rarZZ_RESTRICTED_SERVER_CIPHERSr=rYr6r]r^r`)rer>rJrKrCZrequireclientcertrHr#rFZ
exactprotocolrgr%r%r&�wrapserversocket�sN
�
�

rkc@seZdZdZdS)�
wildcarderrorz2Represents an error parsing wildcards in DNS name.N)�__name__�
__module__�__qualname__�__doc__r%r%r%r&rl:srlc
Cs
g}|sdSt�|�}t�|�}|�d�}|d}|dd�}|�d�}||kr`ttd�|��|st|��|��kS|dkr�|�d�n>|�d	�s�|�d	�r�|�t	�
|��n|�t	�
|��d
d��|D]}|�t	�
|��q�t�
dd
�|�dtj�}	|	�|�duS)z�Match DNS names according RFC 6125 section 6.4.3.

    This code is effectively copied from CPython's ssl._dnsname_match.

    Returns a bool indicating whether the expected hostname matches
    the value in ``dn``.
    F�.rrN�*s.too many wildcards in certificate DNS name: %ss[^.]+sxn--s\*s[^.]*s\As\.s\Z)r	r-r1�countrlrr3r4r0r
Zreescaper2�re�compiler!�
IGNORECASE�match)
Zdnr?ZmaxwildcardsZpats�piecesZleftmostZ	remainderZ	wildcards�frag�patr%r%r&�
_dnsnamematch>s0




�r{cCs�|std�Sg}|�dg�}|D]j\}}|dkr zt||�rDWdSWn8ty~}z t�|jd�WYd}~Sd}~00|�|�q |�sP|�dg�D]�}|D]�\}}|dkr�z|�d�}Wn"t	y�td	�YS0zt||��rWdSWn>t�y@}z$t�|jd�WYd}~Sd}~00|�|�q�q�d
d�|D�}t
|�dk�r~td
�d�|�St
|�dk�r�td
�|dStd�SdS)z�Verify that cert (in socket.getpeercert() format) matches hostname.
    CRLs is not handled.

    Returns error message if any problems are found and None on success.
    sno certificate receivedZsubjectAltNameZDNSNrZsubjectZ
commonName�asciis IDN in certificate not supportedcSsg|]}t�|��qSr%)r	r-)�.0�dr%r%r&�
<listcomp>�r*z_verifycert.<locals>.<listcomp>rscertificate is for %srNs4no commonName or subjectAltName found in certificate)r�getr{rlr
r[r\r4�encode�UnicodeEncodeErrorr_r!)Zcertr?ZdnsnamesZsanr$�valuerh�subr%r%r&�_verifycertrs@
*.r�cCs>tjrt��stjsdStj�tj���}|�	d�p<|�	d�S)a@return true if this seems to be a pure Apple Python that
    * is unfrozen and presumably has the whole mercurial module in the file
      system
    * presumably is an Apple Python that uses Apple OpenSSL which has patches
      for using system certificate store CAs in addition to the provided
      cacerts file
    Fs/usr/bin/pythons,/system/library/frameworks/python.framework/)
r	ZisdarwinrZ
mainfrozenZ
sysexecutabler8r9�realpathr3r0)Zexer%r%r&�_plainapplepython�s	����r�c	Cs�z6ddl}|��}tj�|�r4|�d�t�|�WSWntt	fyLYn0t
�r�tj�tj�t�t
��d�}tj�|�r�|SdS)a�return path to default CA certificates or None.

    It is assumed this function is called when the returned certificates
    file will actually be used to validate connections. Therefore this
    function may print warnings or debug messages assuming this usage.

    We don't print a message when the Python is able to load default
    CA certs because this scenario is detected at socket connect time.
    rNs#using ca certificates from certifi
s
dummycert.pem)�certifi�wherer8r9r:r<r	�fsencoderV�AttributeErrorr�r!�dirname�__file__)r>r�ZcertsZ	dummycertr%r%r&r;�s
�r;cCs|jd}t�|�}|jd}|jd}z|�d�}|��}Wn$tybt�td�|��Yn0|szt�td�|��|dr�|�td�|�d	St	t
�|����t	t
�|����t	t
�|����d
�}dd�}d
||d�}	|d�r�|dD]X\}
}||
��|kr�|�d||
||�f�|d�rJ|�td�|||	f�d	Sq�|d�rnd}||d�}
nd}d|
|||
�f}
tjtd�||
ftd�|d��|jd�s�tjtd�|td�||	fd��t||�}|�rtjtd�||ftd�||	fd��d	S)zxValidate a socket meets security requirements.

    The passed socket must have been created with ``wrapsocket()``.
    rPrRrQTs%s ssl connection errors-%s certificate error: no certificate receivedrs�warning: connection security to %s is disabled per current settings; communication is susceptible to eavesdropping and tampering
N)r+�sha256ssha512cs$d��fdd�tdt��d�D��S)Nr)csg|]}�||d��qS)�r%)r}�x�r@r%r&rr*z:validatesocket.<locals>.fmtfingerprint.<locals>.<listcomp>rr�)r!�ranger_r�r%r�r&�fmtfingerprint
sz&validatesocket.<locals>.fmtfingerprints	sha256:%sr�rs)%s certificate matched fingerprint %s:%s
rs�(SHA-1 fingerprint for %s found in legacy [hostfingerprints] section; if you trust this fingerprint, remove the old SHA-1 fingerprint from [hostfingerprints] and add the following entry to the new [hostsecurity] section: %s:fingerprints=%s)
shostfingerprintr+r(s%s:%ss0certificate for %s has unexpected fingerprint %sscheck %s configurationrrOsPunable to verify security of %s (no loaded CA certificates); refusing to connects�see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error or set hostsecurity.%s:fingerprints=%s to trust this servers%s certificate error: %ss^set hostsecurity.%s:certfingerprints=%s config setting or use --insecure to connect insecurely)rdr	r-Zgetpeercertr�rrcrr7rrZsha1�digest�hashlibZsha256Zsha512r3r<r�)reZshost�hostr>rfZpeercertZ	peercert2Zpeerfingerprintsr�Znicefingerprint�hashrB�section�nicerir%r%r&�validatesocket�s�





�����
��
���
�
������
���r�)N)NNNF)r)%Z
__future__rr�r8rtr5Zi18nrr	rZnoder�rrr
Zutilsrrr
rZhassni�setr.ra�addrDrGrjrk�	Exceptionrlr{r�r�r;r�r%r%r%r&�<module>
s>



/
h�
P
43#

Youez - 2016 - github.com/yon3zu
LinuXploit