%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/conch/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/conch/__pycache__/manhole_tap.cpython-312.pyc

�

Ϫ�fl���dZddlmZddlmZmZddlmZmZm	Z	ddl
mZddlm
Z
ddlmZmZddlmZdd	lmZmZGd
�d�ZGd�d
�Zeej0�Gd�d��ZGd�dej4�Zd�Zy)z\
TAP plugin for creating telnet- and ssh-accessible manhole servers.

@author: Jp Calderone
�)�implementer)�service�strports)�manhole�manhole_ssh�telnet)�insults)�keys)�checkers�portal)�protocol)�filepath�usagec��eZdZd�Zd�Zy)�makeTelnetProtocolc��||_y�N)r)�selfrs  �;/usr/lib/python3/dist-packages/twisted/conch/manhole_tap.py�__init__zmakeTelnetProtocol.__init__s	�����c�h�tj}|jf}tj|g|���Sr)r�AuthenticatingTelnetProtocolr�TelnetTransport)r�auth�argss   r�__call__zmakeTelnetProtocol.__call__s.���2�2�����~���%�%�d�2�T�2�2rN��__name__�
__module__�__qualname__rr�rrrrs���3rrc��eZdZd�Zd�Zy)�chainedProtocolFactoryc��||_yr)�	namespace)rr&s  rrzchainedProtocolFactory.__init__ s	��"��rc�^�tjtj|j�Sr)r	�ServerProtocolr�ColoredManholer&�rs rrzchainedProtocolFactory.__call__#s���%�%�g�&<�&<�d�n�n�M�MrNrr"rrr$r$s
��#�Nrr$c��eZdZd�Zd�Zy)�_StupidRealmc�.�||_||_||_yr)�protocolFactory�protocolArgs�protocolKwArgs)r�proto�a�kws    rrz_StupidRealm.__init__)s��$������ ��rc��tj|vr8tj|j|ji|j��d�fSt��)Nc��yrr"r"rr�<lambda>z,_StupidRealm.requestAvatar.<locals>.<lambda>3s�r)r�ITelnetProtocolr.r/r0�NotImplementedError)r�avatarId�
interfacess   r�
requestAvatarz_StupidRealm.requestAvatar.sR���!�!�Z�/��&�&�$��$�$�d�&7�&7�O�4�;N�;N�O���
�
"�#�#rN)rr r!rr;r"rrr,r,'s��!�
$rr,c�@�eZdZgd�gd�gd�gd�gd�gd�gZd�Zd�Zy	)
�Options)�
telnetPort�tNzMstrports description of the address on which to listen for telnet connections)�sshPort�sNzJstrports description of the address on which to listen for ssh connections)�passwd�pz/etc/passwdz1name of a passwd(5)-format username/password file)�	sshKeyDirN�<USER DATA DIR>z2Directory where the autogenerated SSH key is kept.)�
sshKeyNameNz
server.keyz&Filename of the autogenerated SSH key.)�
sshKeySizeNiz,Size of the automatically generated SSH key.c�L�tjj|�d|d<y)Nr&)rr=rr*s rrzOptions.__init__\s��
�
�
���t�$� ��[�rc�D�|d�|d�tjd��yy)Nr>r@z<At least one of --telnetPort and --sshPort must be specified)r�
UsageErrorr*s r�postOptionszOptions.postOptions`s5�����%�$�y�/�*A��"�"�N��
�+B�%rN)rr r!�
optParametersrrKr"rrr=r=8s2��	
�	
�	
�	
�	U�R�A!�M�F!�rr=c��tj�}|d}|�i}tj|d�}|dr�t	t
jtjtj|�}tj||g�}tj�}t|�|_
t!j|d|�}|j#|�|dr�t%j&�}t)|�|_tj||g�}	t%j*|	�}
|ddk7r|d}n
ddlm}|�}t1j2|�j5|d	�}
t7j8|
t;|d
��}||
j<d<||
j>d<t!j|d|
�}|j#|�|S)a;
    Create a manhole server service.

    @type options: L{dict}
    @param options: A mapping describing the configuration of
    the desired service.  Recognized key/value pairs are::

        "telnetPort": strports description of the address on which
                      to listen for telnet connections.  If None,
                      no telnet service will be started.

        "sshPort": strports description of the address on which to
                   listen for ssh connections.  If None, no ssh
                   service will be started.

        "namespace": dictionary containing desired initial locals
                     for manhole connections.  If None, an empty
                     dictionary will be used.

        "passwd": Name of a passwd(5)-format username/password file.

        "sshKeyDir": The folder that the SSH server key will be kept in.

        "sshKeyName": The filename of the key.

        "sshKeySize": The size of the key, in bits. Default is 4096.

    @rtype: L{twisted.application.service.IService}
    @return: A manhole service.
    r&rBr>r@rDrEr)�getDataDirectoryrFrGsssh-rsa) r�MultiServicer�FilePasswordDBr,r�TelnetBootstrapProtocolr	r(rr)r�Portalr
�
ServerFactoryrr�setServiceParentr�
TerminalRealmr$�ConchFactory�twisted.python._appdirsrNr�FilePath�childr
�_getPersistentRSAKey�int�
publicKeys�privateKeys)�options�svcr&�checker�telnetRealm�telnetPortal�
telnetFactory�
telnetService�sshRealm�	sshPortal�
sshFactory�keyDirrN�keyLocation�sshKey�
sshServices                r�makeServicerlgs���>�
�
�
 �C���$�I����	��%�%�g�h�&7�8�G��|��"��*�*��"�"��"�"��	
���}�}�[�7�)�<�� �.�.�0�
�!3�L�!A�
�� �(�(���)>�
�N�
��&�&�s�+��y���,�,�.��*@��*K��'��M�M�(�W�I�6�	� �-�-�i�8�
��;��#4�4��[�)�F�@�%�'�F��'�'��/�5�5�g�l�6K�L���*�*�;��G�L�<Q�8R�S��,2�
���j�)�-3�
���z�*��%�%�g�i�&8�*�E�
��#�#�C�(��JrN)�__doc__�zope.interfacer�twisted.applicationrr�
twisted.conchrrr�twisted.conch.insultsr	�twisted.conch.sshr
�twisted.credrr�twisted.internetr
�twisted.pythonrrrr$�IRealmr,r=rlr"rr�<module>rwsv���'�1�6�6�)�"�)�%�*�3�3�N�N�
�V�]�]��
$�
$��
$� ,�e�m�m�,�^Mr

Zerion Mini Shell 1.0