403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/zmq/auth/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/zmq/auth/__pycache__/base.cpython-311.pyc
�

mc�c�?���dZddlZddlZddlmZmZmZmZmZm	Z	m
Z
ddlZddlm
Z
ddlmZddlmZdZd	ZGd
�d��ZddgZdS)
z*Base implementation of 0MQ authentication.�N)�Any�Dict�List�Optional�Set�Tuple�Union)�_check_version)�z85�)�load_certificates�*s1.0c��eZdZUdZded<eed<eed<eeefed<ded<e	eed	<e	eed
<eeeeeffed<eeee
effed<eed
<			d1dedded
efd�Zd2d�Z
d2d�Zdeddfd�Zdeddfd�Z	d3dedeeefddfd�Z	d4dedeeejfddfd�Z	d3dededdfd�Zde
defd �Z	d3dedeeddfd!�Zd"ee
fd#�Zded$ed%edeee
ffd&�Zded'e
deee
ffd(�Zded)e
deee
ffd*�Z	d5d,e
d-e
d.e
d/eddf
d0�ZdS)6�
Authenticatora�Implementation of ZAP authentication for zmq connections.

    This authenticator class does not register with an event loop. As a result,
    you will need to manually call `handle_zap_message`::

        auth = zmq.Authenticator()
        auth.allow("127.0.0.1")
        auth.start()
        while True:
            auth.handle_zap_msg(auth.zap_socket.recv_multipart())

    Alternatively, you can register `auth.zap_socket` with a poller.

    Since many users will want to run ZAP in a way that does not block the
    main thread, other authentication classes (such as :mod:`zmq.auth.thread`)
    are provided.

    Note:

    - libzmq provides four levels of security: default NULL (which the Authenticator does
      not see), and authenticated NULL, PLAIN, CURVE, and GSSAPI, which the Authenticator can see.
    - until you add policies, all incoming NULL connections are allowed.
      (classic ZeroMQ behavior), and all PLAIN and CURVE connections are denied.
    - GSSAPI requires no configuration.
    zzmq.Context�context�encoding�	allow_any�credentials_providersz
zmq.Socket�
zap_socket�	whitelist�	blacklist�	passwords�certs�logN�utf-8c�F�tdd��|ptj���|_||_d|_i|_d|_t��|_
t��|_i|_i|_
|ptjd��|_dS)N)�r�securityFzzmq.auth)r
�zmq�Context�instancerrrrr�setrrrr�logging�	getLoggerr)�selfrrrs    �//usr/lib/python3/dist-packages/zmq/auth/base.py�__init__zAuthenticator.__init__:s���	�v�z�*�*�*��8�#�+�"6�"6�"8�"8��� ��
����%'��"�������������������
��7�'�+�J�7�7������returnc���|j�tj��|_d|j_|j�d��|j�d��dS)zCreate and bind the ZAP socketrzinproc://zeromq.zap.01�StartingN)	r�socketr�REPr�linger�bindr�debug�r%s r&�startzAuthenticator.startPsV���,�-�-�c�g�6�6���!"��������5�6�6�6�����z�"�"�"�"�"r(c�T�|jr|j���d|_dS)zClose the ZAP socketN)r�closer1s r&�stopzAuthenticator.stopWs+���?�	$��O�!�!�#�#�#�����r(�	addressesc���|jrtd���|j�dd�|����|j�|��dS)aIAllow (whitelist) IP address(es).

        Connections from addresses not in the whitelist will be rejected.

        - For NULL, all clients from this address will be accepted.
        - For real auth setups, they will be allowed to continue with authentication.

        whitelist is mutually exclusive with blacklist.
        �-Only use a whitelist or a blacklist, not bothzAllowing %s�,N)r�
ValueErrorrr0�joinr�update�r%r6s  r&�allowzAuthenticator.allow]s\���>�	N��L�M�M�M�����}�c�h�h�y�&9�&9�:�:�:�����i�(�(�(�(�(r(c���|jrtd���|j�dd�|����|j�|��dS)z�Deny (blacklist) IP address(es).

        Addresses not in the blacklist will be allowed to continue with authentication.

        Blacklist is mutually exclusive with whitelist.
        r8z
Denying %sr9N)rr:rr0r;rr<r=s  r&�denyzAuthenticator.denyls\���>�	N��L�M�M�M�����|�S�X�X�i�%8�%8�9�9�9�����i�(�(�(�(�(r(r�domainc�T�|r
||j|<|j�d|��dS)z�Configure PLAIN authentication for a given domain.

        PLAIN authentication uses a plain-text password file.
        To cover all domains, use "*".
        You can modify the password file at any time; it is reloaded automatically.
        zConfigure plain: %sN�rrr0)r%rArs   r&�configure_plainzAuthenticator.configure_plainxs5���	/�%.�D�N�6�"�����,�f�5�5�5�5�5r(�.�locationc��|j�d||��|tkr	d|_dSd|_	t	|��|j|<dS#t$r'}|j�d||��Yd}~dSd}~wwxYw)a	Configure CURVE authentication for a given domain.

        CURVE authentication uses a directory that holds all public client certificates,
        i.e. their public keys.

        To cover all domains, use "*".

        You can add and remove certificates in that directory at any time. configure_curve must be called
        every time certificates are added or removed, in order to update the Authenticator's state

        To allow all client keys without checking, specify CURVE_ALLOW_ANY for the location.
        zConfigure curve: %s[%s]TFz&Failed to load CURVE certs from %s: %sN)rr0�CURVE_ALLOW_ANYrr
r�	Exception�error)r%rArF�es    r&�configure_curvezAuthenticator.configure_curve�s���"	
����0�&�(�C�C�C���&�&�!�D�N�N�N�"�D�N�
V�%6�x�%@�%@��
�6�"�"�"���
V�
V�
V�����G��ST�U�U�U�U�U�U�U�U�U�����
V���s�A�
B�A>�>B�credentials_providerc�f�d|_|�||j|<dS|j�d|��dS)aConfigure CURVE authentication for a given domain.

        CURVE authentication using a callback function validating
        the client public key according to a custom mechanism, e.g. checking the
        key against records in a db. credentials_provider is an object of a class which
        implements a callback method accepting two parameters (domain and key), e.g.::

            class CredentialsProvider(object):

                def __init__(self):
                    ...e.g. db connection

                def callback(self, domain, key):
                    valid = ...lookup key and/or domain in db
                    if valid:
                        logging.info('Authorizing: {0}, {1}'.format(domain, key))
                        return True
                    else:
                        logging.warning('NOT Authorizing: {0}, {1}'.format(domain, key))
                        return False

        To cover all domains, use "*".

        To allow all client keys without checking, specify CURVE_ALLOW_ANY for the location.
        FNz0None credentials_provider provided for domain:%s)rrrrJ)r%rArMs   r&�configure_curve_callbackz&Authenticator.configure_curve_callback�sA��:����+�1E�D�&�v�.�.�.��H�N�N�M�v�V�V�V�V�Vr(�client_public_keyc�P�tj|���d��S)a�Return the User-Id corresponding to a CURVE client's public key

        Default implementation uses the z85-encoding of the public key.

        Override to define a custom mapping of public key : user-id

        This is only called on successful authentication.

        Parameters
        ----------
        client_public_key: bytes
            The client public key used for the given message

        Returns
        -------
        user_id: unicode
            The user ID as text
        �ascii)r�encode�decode)r%rPs  r&�
curve_user_idzAuthenticator.curve_user_id�s#��&�z�+�,�,�3�3�G�<�<�<r(c��dS)z~Configure GSSAPI authentication

        Currently this is a no-op because there is nothing to configure with GSSAPI.
        N�)r%rArFs   r&�configure_gssapizAuthenticator.configure_gssapi�s���r(�msgc	�b��t|��dkrh�j�d|��t|��dkr�j�d��n��|ddd��dS|dd�\}}}}}}|dd�}|��jd	��}|��jd	��}|tkr4�j�d
|����|dd��dS�j�d||||||��d
}	d
}
d}�jrG|�jvrd}	�j�d|��nmd}
d}�j�d|��nM�j	rF|�j	vr d}
d}�j�d|��nd}	�j�d|��d}|
�s�|dkr |	s�j�d��d}	�n�|dkrtt|��dkr4�j�d|����|dd��dS�fd�|D��\}}
��
|||
��\}	}�n	|dkr�t|��dkr4�j�d|����|dd��dS|d}��||��\}	}|	r��|��}n�|d kr}t|��dkr4�j�d!|����|dd��dS|d}|�d"��}��
||��\}	}|	r��|d#d$|��dS��|d|��dS)%zPerform ZAP authentication�z*Invalid ZAP message, not enough frames: %r�zNot enough information to replyrs400sNot enough framesN�replacezInvalid ZAP version: %rsInvalid versionzQversion: %r, request_id: %r, domain: %r, address: %r, identity: %r, mechanism: %rFs	NO ACCESSTzPASSED (whitelist) address=%ssAddress not in whitelistz$DENIED (not in whitelist) address=%ssAddress is blacklistedzDENIED (blacklist) address=%sz$PASSED (not in blacklist) address=%s�	anonymoussNULLzALLOWED (NULL)sPLAINzInvalid PLAIN credentials: %rsInvalid credentialsc3�N�K�|]}|��jd��V�� dS)r]N)rTr)�.0�cr%s  �r&�	<genexpr>z3Authenticator.handle_zap_message.<locals>.<genexpr>'sD�����&�&�;<�A�H�H�T�]�I�6�6�&�&�&�&�&�&r(sCURVEzInvalid CURVE credentials: %rrsGSSAPIzInvalid GSSAPI credentials: %r�utf8�200�OK)�lenrrJ�_send_zap_replyrTr�VERSIONr0rr�_authenticate_plain�_authenticate_curverU�_authenticate_gssapi)r%rY�version�
request_idrA�address�identity�	mechanism�credentials�allowed�denied�reason�username�password�key�	principals`               r&�handle_zap_messagez Authenticator.handle_zap_message�s0����s�8�8�a�<�<��H�N�N�G��M�M�M��3�x�x�!�|�|�����@�A�A�A�A��$�$�S��V�V�5I�J�J�J��F�DG����G�A���V�W�h�	��!�"�"�g�����t�}�i�8�8���.�.���	�:�:���g����H�N�N�4�c�:�:�:�� � ��V�5G�H�H�H��F�����
8�������		
�		
�		
��������>�	P��$�.�(�(�������>��H�H�H�H���4������E�w�O�O�O�O�
�^�	P��$�.�(�(���2������>��H�H�H�H�������E�w�O�O�O����%	O��G�#�#�G�#�����/�0�0�0�����h�&�&��{�#�#�q�(�(��H�N�N�#B�K�P�P�P��(�(��V�=S�T�T�T��F�&�&�&�&�@K�&�&�&�"��(�#'�":�":�6�8�X�"V�"V������h�&�&��{�#�#�q�(�(��H�N�N�#B�K�P�P�P��(�(��V�=S�T�T�T��F�!�!�n��"&�":�":�6�3�"G�"G�����7�#�1�1�#�6�6�H���i�'�'��{�#�#�q�(�(��H�N�N�#C�[�Q�Q�Q��(�(��V�=S�T�T�T��F�'��N�	�$�+�+�F�3�3��"&�";�";�F�I�"N�"N�����	=�� � ��V�U�H�E�E�E�E�E�� � ��V�V�<�<�<�<�<r(rurvc�N�d}d}|jrz|sd}||jvr/||j|vr||j||krd}nd}nd}nd}|r|j�d|||��n9|j�d	|��nd
}|j�d|��||fS)zPLAIN ZAP authenticationFr(rTsInvalid passwordsInvalid usernamesInvalid domainz1ALLOWED (PLAIN) domain=%s username=%s password=%sz	DENIED %ssNo passwords definedzDENIED (PLAIN) %srC)r%rArurvrrrts      r&riz!Authenticator._authenticate_plainFs��������>�	8��
������'�'��t�~�f�5�5�5��4�>�&�#9�(�#C�C�C�"&���!4���0�F�F�*���
4�����G����	��������{�F�3�3�3�3�-�F��H�N�N�.��7�7�7����r(�
client_keyc�0�d}d}|jrd}d}|j�d��n�|jikrp|sd}||jvr`t	j|��}|j|�||��rd}d}nd}|rdnd	}|j�d
|||��nqd}nn|sd}||jvr_t	j|��}|j|�|��rd}d}nd}|rdnd	}|j�d|||��nd}||fS)
zCURVE ZAP authenticationFr(Trez ALLOWED (CURVE allow any client)rsUnknown key�ALLOWED�DENIEDz0%s (CURVE auth_callback) domain=%s client_key=%ssUnknown domainz"%s (CURVE) domain=%s client_key=%s)	rrr0rrrS�callbackr�get)r%rAr{rrrt�z85_client_key�statuss       r&rjz!Authenticator._authenticate_curvels��������>�1	+��G��F��H�N�N�=�>�>�>�>�
�
'�2�
-�
-��
�����3�3�3�!$��J�!7�!7���-�f�5�>�>�v�~�V�V�,�"�G�"�F�F�+�F�&-�;���8������F���"�	����+����
������#�#�!$��J�!7�!7���:�f�%�)�)�.�9�9�,�"�G�"�F�F�+�F�&-�;���8������8���"�	����+�����r(rxc�>�|j�d||��dS)zPNothing to do for GSSAPI, which has already been handled by an external service.z'ALLOWED (GSSAPI) domain=%s principal=%s)Tre)rr0)r%rArxs   r&rkz"Authenticator._authenticate_gssapi�s ������@�&�)�T�T�T��{r(r^rm�status_code�status_text�user_idc��|dkr|nd}t|t��r|�|jd��}d}|j�d||��t|||||g}|j�|��dS)z.Send a ZAP reply to finish the authentication.rdr(r]zZAP reply code=%s text=%sN)	�
isinstance�strrSrrr0rhr�send_multipart)r%rmr�r�r��metadata�replys       r&rgzAuthenticator._send_zap_reply�s���)�F�2�2�'�'����g�s�#�#�	?��n�n�T�]�I�>�>�G�������2�K��M�M�M��*�k�;���R����&�&�u�-�-�-�-�-r()NrN)r)N)rN)rrE)r^) �__name__�
__module__�__qualname__�__doc__�__annotations__r��boolrrr�bytesrr'r2r5r>r@rDr	�os�PathLikerLrOrUrXrryrrirjrkrgrWr(r&rrs����������4�����M�M�M��O�O�O���S��>�)�)�)������3�x�����3�x�����C��c�3�h��'�(�(�(�(���T�%��*�%�%�&�&�&�&�	�H�H�H�,0���	8�8��-�(�8��8��	8�8�8�8�,#�#�#�#�����
)��
)��
)�
)�
)�
)�
)�s�
)�t�
)�
)�
)�
)�>B�6�6��6�,0��c��N�6�	
�6�6�6�6�FI�V�V��V�+0��b�k�1A�+B�V�	
�V�V�V�V�8>B�"W�"W��"W�7:�"W�	
�"W�"W�"W�"W�H=�u�=��=�=�=�=�,<@�����+3�C�=��	
�����c=�d�5�k�c=�c=�c=�c=�J$��$�%(�$�47�$�	�t�U�{�	�$�$�$�$�L7�#�7�5�7�U�4�QV�;�EW�7�7�7�7�r�3��5��U�4�QV�;�EW�����#�.�.��.��.��	.�
�.�
�
.�.�.�.�.�.r(rrH)r�r#r��typingrrrrrrr	r�	zmq.errorr
�	zmq.utilsrrr
rHrhr�__all__rWr(r&�<module>r�s���0�0�
����	�	�	�	�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�
�
�
�
�$�$�$�$�$�$�������$�$�$�$�$�$���
��d.�d.�d.�d.�d.�d.�d.�d.�N
�-�
.���r(

Youez - 2016 - github.com/yon3zu
LinuXploit