%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__/telnet.cpython-312.pyc

�

Ϫ�f����D�dZddlZddlmZddlmZmZmZddl	m
Z
ddlmZde
defd	�Zed
�Zd
ZdZdZd
ZdZed�Zed�Zed
�Zed�Zed�Zed�Zed�Zed�Zed
�Zed�Zed�Z ed�Z!ed�Z"ed�Z#ed�Z$ed�Z%ed�Z&ed�Z'ed�Z(ed�Z)ed �Z*ed!�Z+ed"�Z,ed#�Z-ed$�Z.ed%�Z/ed&�Z0ed'�Z1ed(�Z2ed
�Z3ed
�Z4ed�Z5ed�Z6ed
�Z7ed�Z8ed�Z9ed�Z:ed
�Z;ed�Z<ed�Z=ed�Z>ed)�Z?ed*�Z@ed�ZAed
�ZBed�ZCed�ZDed�ZEed�ZFed�ZGed+�ZHed,�ZIed�ZJed-�ZKed.�ZLed/�ZMed0�ZNed1�ZOed2�ZPed3�ZQed4�ZRed5�ZSed6�ZTed7�ZUed8�ZVed9�ZWed:�ZXed�ZYed�ZZed
�Z[ed�Z\ed�Z]ed;�Z^ed<�Z_ed=�Z`ed>�Zaed?�Zbed@�ZcGdA�dBej��ZeGdC�dDej��ZgGdE�dFeh�ZiGdG�dHei�ZjGdI�dJej�ZkGdK�dLej�ZlGdM�dNej�ZmGdO�dPej�Zneee�GdQ�dRej���ZpGdS�dTej��ZqGdU�dV�ZrGdW�dXeqer�ZsGdY�dZeper�Ztdd[lumvZvGd\�d]evj�ep�Zxdd^lymzZzGd_�d`ex�Z{gda�Z|y)bz?
Telnet protocol implementation.

@author: Jean-Paul Calderone
�N)�implementer)�defer�
interfaces�protocol)�Logger)�	iterbytes�i�returnc��t|f�S)a(Create a byte sequence of length 1.

    U{RFC 854<https://tools.ietf.org/html/rfc854>} specifies codes in decimal,
    but Python can only handle L{bytes} literals in octal or hexadecimal.
    This helper function bridges that gap.

    @param i: The value of the only byte in the sequence.
    )�bytes)r	s �6/usr/lib/python3/dist-packages/twisted/conch/telnet.py�_chrrs���!��;���������	�
���
���"�������������������������������������������@� ������c�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�ITelnetProtocolc��y)ae
        A command was received but not understood.

        @param command: the command received.
        @type command: L{str}, a single character.
        @param argument: the argument to the received command.
        @type argument: L{str}, a single character, or None if the command that
            was unhandled does not provide an argument.
        N�)�command�arguments  r
�unhandledCommandz ITelnetProtocol.unhandledCommand���rc��y)a�
        A subnegotiation command was received but not understood.

        @param command: the command being subnegotiated. That is, the first
            byte after the SB command.
        @type command: L{str}, a single character.
        @param data: all other bytes of the subneogation. That is, all but the
            first bytes between SB and SE, with IAC un-escaping applied.
        @type data: L{bytes}, each a single character
        NrJ)rK�datas  r
�unhandledSubnegotiationz'ITelnetProtocol.unhandledSubnegotiation�rNrc��y)aw
        Enable the given option locally.

        This should enable the given option on this side of the
        telnet connection and return True.  If False is returned,
        the option will be treated as still disabled and the peer
        will be notified.

        @param option: the option to be enabled.
        @type option: L{bytes}, a single character.
        NrJ��options r
�enableLocalzITelnetProtocol.enableLocal�rNrc��y)a
        Indicate whether the peer should be allowed to enable this option.

        Returns True if the peer should be allowed to enable this option,
        False otherwise.

        @param option: the option to be enabled.
        @type option: L{bytes}, a single character.
        NrJrSs r
�enableRemotezITelnetProtocol.enableRemote�rNrc��y)z�
        Disable the given option locally.

        Unlike enableLocal, this method cannot fail.  The option must be
        disabled.

        @param option: the option to be disabled.
        @type option: L{bytes}, a single character.
        NrJrSs r
�disableLocalzITelnetProtocol.disableLocal�rNrc��y)z�
        Indicate that the peer has disabled this option.

        @param option: the option to be disabled.
        @type option: L{bytes}, a single character.
        NrJrSs r
�
disableRemotezITelnetProtocol.disableRemote�rNrN)	�__name__�
__module__�__qualname__rMrQrUrWrYr[rJrr
rHrH�s ��	�
��	�	�rrHc�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�ITelnetTransportc��y)a�
        Indicate a desire for the peer to begin performing the given option.

        Returns a Deferred that fires with True when the peer begins performing
        the option, or fails with L{OptionRefused} when the peer refuses to
        perform it.  If the peer is already performing the given option, the
        Deferred will fail with L{AlreadyEnabled}.  If a negotiation regarding
        this option is already in progress, the Deferred will fail with
        L{AlreadyNegotiating}.

        Note: It is currently possible that this Deferred will never fire,
        if the peer never responds, or if the peer believes the option to
        already be enabled.
        NrJrSs r
�dozITelnetTransport.do�rNrc��y)aX
        Indicate a desire for the peer to cease performing the given option.

        Returns a Deferred that fires with True when the peer ceases performing
        the option.  If the peer is not performing the given option, the
        Deferred will fail with L{AlreadyDisabled}.  If negotiation regarding
        this option is already in progress, the Deferred will fail with
        L{AlreadyNegotiating}.

        Note: It is currently possible that this Deferred will never fire,
        if the peer never responds, or if the peer believes the option to
        already be disabled.
        NrJrSs r
�dontzITelnetTransport.dont�rNrc��y)a�
        Indicate our willingness to begin performing this option locally.

        Returns a Deferred that fires with True when the peer agrees to allow us
        to begin performing this option, or fails with L{OptionRefused} if the
        peer refuses to allow us to begin performing it.  If the option is
        already enabled locally, the Deferred will fail with L{AlreadyEnabled}.
        If negotiation regarding this option is already in progress, the
        Deferred will fail with L{AlreadyNegotiating}.

        Note: It is currently possible that this Deferred will never fire,
        if the peer never responds, or if the peer believes the option to
        already be enabled.
        NrJrSs r
�willzITelnetTransport.will�rNrc��y)a\
        Indicate that we will stop performing the given option.

        Returns a Deferred that fires with True when the peer acknowledges
        we have stopped performing this option.  If the option is already
        disabled locally, the Deferred will fail with L{AlreadyDisabled}.
        If negotiation regarding this option is already in progress,
        the Deferred will fail with L{AlreadyNegotiating}.

        Note: It is currently possible that this Deferred will never fire,
        if the peer never responds, or if the peer believes the option to
        already be disabled.
        NrJrSs r
�wontzITelnetTransport.wontrNrc��y)aj
        Send a subnegotiation request.

        @param about: A byte indicating the feature being negotiated.
        @param data: Any number of L{bytes} containing specific information
        about the negotiation being requested.  No values in this string
        need to be escaped, as this function will escape any value which
        requires it.
        NrJ)�aboutrPs  r
�requestNegotiationz#ITelnetTransport.requestNegotiationrNrN)r\r]r^rbrdrfrhrkrJrr
r`r`�s��� 
�� 
�	rr`c��eZdZy)�TelnetErrorN�r\r]r^rJrr
rmrm#���rrmc��eZdZdefd�Zy)�NegotiationErrorr
c��|jjdz|jjzdzt|jd�zS)N�.�:r)�	__class__r]r\�repr�args��selfs r
�__str__zNegotiationError.__str__(sO���N�N�%�%��
��n�n�%�%�
&��
��4�9�9�Q�<� �	
!�	
rN)r\r]r^�strrzrJrr
rqrq's��
��
rrqc��eZdZy)�
OptionRefusedNrnrJrr
r}r}2rorr}c��eZdZy)�AlreadyEnabledNrnrJrr
rr6rorrc��eZdZy)�AlreadyDisabledNrnrJrr
r�r�:rorr�c��eZdZy)�AlreadyNegotiatingNrnrJrr
r�r�>rorr�c�>�eZdZe�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y)�TelnetProtocolc��y�NrJ�ryrKrLs   r
rMzTelnetProtocol.unhandledCommandF���rc��yr�rJ�ryrKrPs   r
rQz&TelnetProtocol.unhandledSubnegotiationIr�rc��yr�rJ�ryrTs  r
rUzTelnetProtocol.enableLocalLr�rc��yr�rJr�s  r
rWzTelnetProtocol.enableRemoteOr�rc��yr�rJr�s  r
rYzTelnetProtocol.disableLocalRr�rc��yr�rJr�s  r
r[zTelnetProtocol.disableRemoteUr�rN)r\r]r^r�_logrMrQrUrWrYr[rJrr
r�r�Bs'���8�D�
�
�
�
�
�
rr�c�b�eZdZdZdZd�Zd�ZGd�d�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zeeeed�Zd�Zd�Z d �Z!d!�Z"d"�Z#e e!e"e#d�Z$d#�Z%d$�Z&d%�Z'd&�Z(d'�Z)e&e'e(e)d�Z*d(�Z+d)�Z,d*�Z-d+�Z.d,�Z/e,e-e.e/d�Z0d-�Z1d.�Z2d/�Z3d0�Z4y1)2�Telneta�
    @ivar commandMap: A mapping of bytes to callables.  When a
    telnet command is received, the command byte (the first byte
    after IAC) is looked up in this dictionary.  If a callable is
    found, it is invoked with the argument of the command, or None
    if the command takes no argument.  Values should be added to
    this dictionary if commands wish to be handled.  By default,
    only WILL, WONT, DO, and DONT are handled.  These should not
    be overridden, as this class handles them correctly and
    provides an API for interacting with them.

    @ivar negotiationMap: A mapping of bytes to callables.  When
    a subnegotiation command is received, the command byte (the
    first byte after SB) is looked up in this dictionary.  If
    a callable is found, it is invoked with the argument of the
    subnegotiation.  Values should be added to this dictionary if
    subnegotiations are to be handled.  By default, no values are
    handled.

    @ivar options: A mapping of option bytes to their current
    state.  This state is likely of little use to user code.
    Changes should not be made to it.

    @ivar state: A string indicating the current parse state.  It
    can take on the values "data", "escaped", "command", "newline",
    "subnegotiation", and "subnegotiation-escaped".  Changes
    should not be made to it.

    @ivar transport: This protocol's transport object.
    rPc��i|_i|_t|jt|j
t|jt|ji|_
yr�)�options�negotiationMap�WILL�telnet_WILL�WONT�telnet_WONT�DO�	telnet_DO�DONT�telnet_DONT�
commandMaprxs r
�__init__zTelnet.__init__|sD����� ����$�"�"��$�"�"������$�"�"�	
��rc�:�|jj|�yr���	transport�write�ryrPs  r
�_writez
Telnet._write�s�������T�"rc�6�eZdZdZGd�d�Zd�Zdefd�Zy)�Telnet._OptionStatea	
        Represents the state of an option on both sides of a telnet
        connection.

        @ivar us: The state of the option on this side of the connection.

        @ivar him: The state of the option on the other side of the
            connection.
        c�(�eZdZdZdZdZdZdefd�Zy)� Telnet._OptionState._Perspectivea�
            Represents the state of an option on side of the telnet
            connection.  Some options can be enabled on a particular side of
            the connection (RFC 1073 for example: only the client can have
            NAWS enabled).  Other options can be enabled on either or both
            sides (such as RFC 1372: each side can have its own flow control
            state).

            @ivar state: C{'yes'} or C{'no'} indicating whether or not this
                option is enabled on one side of the connection.

            @ivar negotiating: A boolean tracking whether negotiation about
                this option is in progress.

            @ivar onResult: When negotiation about this option has been
                initiated by this side of the connection, a L{Deferred}
                which will fire with the result of the negotiation.  L{None}
                at other times.
            �noFNr
c�:�|jd|jzzS)N�*)�state�negotiatingrxs r
rzz(Telnet._OptionState._Perspective.__str__�s���z�z�S�4�+;�+;�%;�<�<r)	r\r]r^�__doc__r�r��onResultr{rzrJrr
�_Perspectiver��s$��
�(�E��K��H�
=��
=rr�c�X�|j�|_|j�|_yr�)r��us�himrxs r
r�zTelnet._OptionState.__init__�s"���'�'�)�D�G��(�(�*�D�Hrr
c�<�d|j�d|j�d�S)Nz<_OptionState us=z him=�>)r�r�rxs r
�__repr__zTelnet._OptionState.__repr__�s��&�t�w�w�i�u�T�X�X�J�a�@�@rN)r\r]r^r�r�r�r{r�rJrr
�_OptionStater��s$��	�	=�	=�8	+�	A�c�	Arr�c�V�|jj||j��Sr�)r��
setdefaultr��ry�opts  r
�getOptionStatezTelnet.getOptionState�s"���|�|�&�&�s�D�,=�,=�,?�@�@rc�B�|jttz|z�yr�)r��IACr�r�s  r
�_doz
Telnet._do�s�����C�"�H�v�%�&rc�B�|jttz|z�yr�)r�r�r�r�s  r
�_dontzTelnet._dont�������C�$�J��'�(rc�B�|jttz|z�yr�)r�r�r�r�s  r
�_willzTelnet._will�r�rc�B�|jttz|z�yr�)r�r�r�r�s  r
�_wontzTelnet._wont�r�rc��|j|�}|jjs|jjrt	j
t
|��S|jjdk(rt	j
t|��Sd|j_t	j�x|j_
}|j|�|S)z?
        Indicate our willingness to enable an option.
        �yesT)r�r�r�r�r�failr�r�r�Deferredr�r��ryrT�s�ds    r
rfzTelnet.will�s���
����'���4�4���q�u�u�0�0��:�:�0��8�9�9�
�T�T�Z�Z�5�
 ��:�:�n�V�4�5�5�#�A�D�D�� %��� 0�0�A�D�D�M�A��J�J�v���Hrc��|j|�}|jjs|jjrt	j
t
|��S|jjdk(rt	j
t|��Sd|j_t	j�x|j_
}|j|�|S)zB
        Indicate we are not willing to enable an option.
        r�T)r�r�r�r�rr�r�r�r�r�r�r�r�s    r
rhzTelnet.wont�s���
����'���4�4���q�u�u�0�0��:�:�0��8�9�9�
�T�T�Z�Z�4�
��:�:�o�f�5�6�6�#�A�D�D�� %��� 0�0�A�D�D�M�A��J�J�v���Hrc��|j|�}|jjs|jjrt	j
t
|��S|jjdk(rt	j
t|��Sd|j_t	j�x|j_
}|j|�|S)Nr�T)r�r�r�r�rr�r�r�rr�r�r�r�s    r
rbz	Telnet.do�s�������'���4�4���q�u�u�0�0��:�:�0��8�9�9�
�U�U�[�[�E�
!��:�:�n�V�4�5�5� $�A�E�E��!&���!1�1�A�E�E�N�Q��H�H�V���Hrc��|j|�}|jjs|jjrt	j
t
|��S|jjdk(rt	j
t|��Sd|j_t	j�x|j_
}|j|�|S)Nr�T)r�r�r�r�rr�r�r�r�r�r�r�r�s    r
rdzTelnet.dont�s�������'���4�4���q�u�u�0�0��:�:�0��8�9�9�
�U�U�[�[�D�
 ��:�:�o�f�5�6�6� $�A�E�E��!&���!1�1�A�E�E�N�Q��J�J�v���Hrc��|jttdz�}|jttz|z|ztztz�y)z�
        Send a negotiation message for the option C{about} with C{data} as the
        payload.

        @param data: the payload
        @type data: L{bytes}
        @see: L{ITelnetTransport.requestNegotiation}
        rN)�replacer�r��SB�SE)ryrjrPs   r
rkzTelnet.requestNegotiation�s<���|�|�C��q��)�����C�"�H�u�$�t�+�c�1�B�6�7rc�:�g}t|�D�]�}|jdk(r0|tk(rd|_�$|dk(rd|_�1|j|��C|jdk(r�|tk(r|j|�d|_�t|tk(rd|_g|_��|ttttttttttf
vrBd|_|r%|j!dj#|��|dd�=|j%|d���|t&t(t*t,fvrd|_||_��,t1d|��|jdk(rPd|_|j.}|`|r%|j!dj#|��|dd�=|j%||����|jdk(rpd|_|d	k(r|jd	����|d
k(r|jd����|tk(r|jd�d|_��|jd|z���|jdk(r/|tk(r	d|_��7|j
j|���T|jdk(r||t2k(rOd|_|j
}|`|r%|j!dj#|��|dd�=|j5|����d|_|j
j|����t1d��|r!|j!dj#|��yy)
NrP�escaped�
�newline�subnegotiationrrK�Stumped�
�zsubnegotiation-escapedzHow'd you do this?)rr�r��appendr��commands�EOR�NOP�DM�BRK�IP�AO�AYT�EC�EL�GA�applicationDataReceived�join�commandReceivedr�r�r�r�rK�
ValueErrorr��	negotiate)ryrP�
appDataBuffer�brKr�s      r
�dataReceivedzTelnet.dataReceiveds����
��4��I	7�A��z�z�V�#���8�!*�D�J��%�Z�!*�D�J�!�(�(��+����y�(���8�!�(�(��+�!'�D�J��"�W�!1�D�J�$&�D�M��3��R��b�"�c�2�r�2�F�F�!'�D�J�$��4�4�S�X�X�m�5L�M�)�!�,��(�(��D�1��4��r�4�0�0�!*�D�J�#$�D�L�$�Y��2�2����y�(�#��
��,�,���L� ��0�0����-�1H�I�%�a�(��$�$�W�a�0����y�(�#��
���:�!�(�(��/��%�Z�!�(�(��/��#�X�"�(�(��/�!*�D�J�!�(�(����3����/�/���8�!9�D�J��M�M�(�(��+����7�7���7�!'�D�J�#�}�}�H��
�$��4�4�S�X�X�m�5L�M�)�!�,��N�N�8�,�!1�D�J��M�M�(�(��+� �!5�6�6�SI	7�V��(�(����-�)@�A�rc�|�|jj�D]�}|jj�8|jj}d|j_|j	|�|j
j��h|j
j}d|j
_|j	|���yr�)r��valuesr�r��errbackr�)ry�reasonr�r�s    r
�connectionLostzTelnet.connectionLostYs����\�\�(�(�*�	"�E��x�x� � �,��H�H�%�%��$(����!��	�	�&�!��y�y�!�!�-��I�I�&�&��%)��	�	�"��	�	�&�!�	"rc��y)z5
        Called with application-level data.
        NrJr�s  r
r�zTelnet.applicationDataReceiveddrNrc��y)zH
        Called for commands for which no handler is installed.
        NrJr�s   r
rMzTelnet.unhandledCommandirNrc�t�|jj|�}|�|j||�y||�yr�)r��getrM)ryrKrL�cmdFuncs    r
r�zTelnet.commandReceivedns3���/�/�%�%�g�.���?��!�!�'�8�4��H�rc��y)zO
        Called for subnegotiations for which no handler is installed.
        NrJr�s   r
rQzTelnet.unhandledSubnegotiationurNrc��|d|dd}}|jj|�}|�|j||�y||�y)Nrr)r�r�rQ)ryrPrKr�s    r
r�zTelnet.negotiatezsG���Q���a�b�����%�%�)�)�'�2���?��(�(��$�7��D�Mrc��|j|�}|j|jj|jjf|||�yr�)r��willMapr�r�r��ryrTr�s   r
r�zTelnet.telnet_WILL��@������'��4����Q�U�U�[�[�!�%�%�"3�"3�3�4�T�1�f�Erc��|j|�r#d|j_|j|�y|j	|�y�Nr�)rWr�r�r�r��ryr�rTs   r
�
will_no_falsezTelnet.will_no_false�s3�����V�$�#�E�I�I�O��H�H�V���J�J�v�rc��d|j_d|j_|jj}d|j_|j	d�|j|�sJdj
|���y)Nr�FTz?enableRemote must return True in this context (for option {!r}))r�r�r�r��callbackrW�format�ryr�rTr�s    r
�will_no_truezTelnet.will_no_true�sq����	�	�� %��	�	���I�I����!��	�	��	�
�
�4��� � ��
�	
�L�S�S��
�	
�
rc��yr�rJrs   r
�will_yes_falsezTelnet.will_yes_false����	
rc�2�	Jdj||���)NzBwill_yes_true can never be entered, but was called with {!r}, {!r}�r	rs   r
�
will_yes_truezTelnet.will_yes_true�s(��
�	
�O�V�V���
�	
�r))r�F)r�T)r�F)r�Tc��|j|�}|j|jj|jjf|||�yr�)r��wontMapr�r�r�rs   r
r�zTelnet.telnet_WONT�rrc��yr�rJrs   r
�
wont_no_falsezTelnet.wont_no_false�s��	
rc��d|j_|jj}d|j_|jt	|��y�NF)r�r�r�r�r}r
s    r
�wont_no_truezTelnet.wont_no_true�s:�� %��	�	���I�I����!��	�	��	�	�	�-��'�(rc�j�d|j_|j|�|j|�y�Nr�)r�r�r[r�rs   r
�wont_yes_falsezTelnet.wont_yes_false�s'����	�	�����6�"��
�
�6�rc���d|j_d|j_|jj}d|j_|j	d�|j|�y�Nr�FT)r�r�r�r�rr[r
s    r
�
wont_yes_truezTelnet.wont_yes_true�sN����	�	�� %��	�	���I�I����!��	�	��	�
�
�4�����6�"rc��|j|�}|j|jj|jjf|||�yr�)r��doMapr�r�r�rs   r
r�zTelnet.telnet_DO�s@������'��0��
�
�1�4�4�:�:�q�t�t�/�/�/�0��q�&�Arc��|j|�r#d|j_|j|�y|j	|�yr)rUr�r�r�r�rs   r
�do_no_falsezTelnet.do_no_false�s3�����F�#�"�E�H�H�N��J�J�v���J�J�v�rc���d|j_d|j_|jj}d|j_|j	d�|j|�y)Nr�FT)r�r�r�r�rrUr
s    r
�
do_no_truezTelnet.do_no_true�sN�������$������H�H���� �����	�
�
�4������ rc��yr�rJrs   r
�do_yes_falsezTelnet.do_yes_false�rrc�2�	Jdj||���)Nz@do_yes_true can never be entered, but was called with {!r}, {!r}rrs   r
�do_yes_truezTelnet.do_yes_true�s(��
�	
�M�T�T���
�	
�rc��|j|�}|j|jj|jjf|||�yr�)r��dontMapr�r�r�rs   r
r�zTelnet.telnet_DONTs@������'��2����Q�T�T�Z�Z����!1�!1�1�2�4��F�Crc��yr�rJrs   r
�
dont_no_falsezTelnet.dont_no_falserrc��d|j_|jj}d|j_|jt	|��yr)r�r�r�r�r}r
s    r
�dont_no_truezTelnet.dont_no_trues<�� %������H�H���� �����	�	�	�-��'�(rc�j�d|j_|j|�|j|�yr)r�r�rYr�rs   r
�dont_yes_falsezTelnet.dont_yes_falses'����������&�!��
�
�6�rc���d|j_d|j_|jj}d|j_|j	d�|j|�yr)r�r�r�r�rrYr
s    r
�
dont_yes_truezTelnet.dont_yes_truesN�������$������H�H���� �����	�
�
�4�����&�!rc��y�z8
        Reject all attempts to enable options.
        FrJr�s  r
rUzTelnet.enableLocal*���rc��yr4rJr�s  r
rWzTelnet.enableRemote0r5rc��td|����)a�
        Signal a programming error by raising an exception.

        L{enableLocal} must return true for the given value of C{option} in
        order for this method to be called.  If a subclass of L{Telnet}
        overrides enableLocal to allow certain options to be enabled, it must
        also override disableLocal to disable those options.

        @raise NotImplementedError: Always raised.
        z.Don't know how to disable local telnet option ��NotImplementedErrorr�s  r
rYzTelnet.disableLocal6s��"�<�V�J�G�
�	
rc��td|����)a�
        Signal a programming error by raising an exception.

        L{enableRemote} must return true for the given value of C{option} in
        order for this method to be called.  If a subclass of L{Telnet}
        overrides enableRemote to allow certain options to be enabled, it must
        also override disableRemote tto disable those options.

        @raise NotImplementedError: Always raised.
        z/Don't know how to disable remote telnet option r8r�s  r
r[zTelnet.disableRemoteEs��"�=�f�Z�H�
�	
rN)5r\r]r^r�r�r�r�r�r�r�r�r�r�rfrhrbrdrkr�r�r�rMr�rQr�r�rrr
rrr�rrrrrr�r"r$r&r(r r�r,r.r0r2r*rUrWrYr[rJrr
r�r�YsO���@
�E�
�#�,A�,A�\A�'�)�)�)�
�
�
�
�
8�OB�b	"��
�
��
�F��
�
�

�%�"�&�$�	�G�F�
�)��#�%�"�&�$�	�G�B��!�
�

�#� �$�"�	
�E�D�
�
)��"�%�"�&�$�	�G���

�

rr�c�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�ProtocolTransportMixinc�Z�|jj|jdd��y)Nr�s
)r�r�r�r�s  r
r�zProtocolTransportMixin.writeVs�������T�\�\�%��9�:rc�:�|jj|�yr�)r��
writeSequence)ry�seqs  r
r?z$ProtocolTransportMixin.writeSequenceYs�����$�$�S�)rc�8�|jj�yr�)r��loseConnectionrxs r
rBz%ProtocolTransportMixin.loseConnection\s�����%�%�'rc�6�|jj�Sr�)r��getHostrxs r
rDzProtocolTransportMixin.getHost_����~�~�%�%�'�'rc�6�|jj�Sr�)r��getPeerrxs r
rGzProtocolTransportMixin.getPeerbrErN)r\r]r^r�r?rBrDrGrJrr
r<r<Us��;�*�(�(�(rr<c�`�eZdZdZdZdZdZdd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zy)�TelnetTransporta?
    @ivar protocol: An instance of the protocol to which this
    transport is connected, or None before the connection is
    established and after it is lost.

    @ivar protocolFactory: A callable which returns protocol instances
    which provide L{ITelnetProtocol}.  This will be invoked when a
    connection is established.  It is passed *protocolArgs and
    **protocolKwArgs.

    @ivar protocolArgs: A tuple of additional arguments to
    pass to protocolFactory.

    @ivar protocolKwArgs: A dictionary of additional arguments
    to pass to protocolFactory.
    FNc�^�tj|�|�||_||_||_yyr�)r�r��protocolFactory�protocolArgs�protocolKwArgs)ryrK�a�kws    r
r�zTelnetTransport.__init__}s1��������&�#2�D� � !�D��"$�D��'rc�F�|j��|j|ji|j��|_tj|j�sJ�	|j}||j_|jj|�yy#t$rY�(wxYwr�)	rKrLrMrrH�
providedBy�factory�AttributeError�makeConnection)ryrRs  r
�connectionMadezTelnetTransport.connectionMade�s������+�0�D�0�0��"�"��&*�&9�&9��D�M�#�-�-�d�m�m�<�<�<�
0��,�,��)0��
�
�%��M�M�(�(��.�,��"�
��
�s�B�	B �B c��tj||�|j�	|jj|�|`yy#|`wxYwr�)r�r�r�ryr�s  r
r�zTelnetTransport.connectionLost�sF�����d�F�+��=�=�$�
"��
�
�,�,�V�4��M�	%���M�s�A�Ac�8�|jj|�Sr�)rrUr�s  r
rUzTelnetTransport.enableLocal�s���}�}�(�(��0�0rc�8�|jj|�Sr�)rrWr�s  r
rWzTelnetTransport.enableRemote�����}�}�)�)�&�1�1rc�8�|jj|�Sr�)rrYr�s  r
rYzTelnetTransport.disableLocal�rZrc�8�|jj|�Sr�)rr[r�s  r
r[zTelnetTransport.disableRemote�s���}�}�*�*�6�2�2rc�<�|jj||�yr�)rrQr�s   r
rQz'TelnetTransport.unhandledSubnegotiation�s���
�
�-�-�g�t�<rc�<�|jj||�yr�)rrMr�s   r
rMz TelnetTransport.unhandledCommand�s���
�
�&�&�w��9rc�:�|jj|�yr��rr�r�s  r
r�z'TelnetTransport.applicationDataReceived�����
�
�"�"�4�(rc�P�tj||jdd��y)N��s��)r<r�r�r�s  r
r�zTelnetTransport.write�s���$�$�T�4�<�<���+M�Nrr�)r\r]r^r��
disconnectingrKrr�rUr�rUrWrYr[rQrMr�r�rJrr
rIrIfsP���"�M��O��H�%�/�"�1�2�2�3�=�:�)�OrrIc�N�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
ed	iZd
�Z
d�Zy)�TelnetBootstrapProtocolNc�.�||_||_||_yr�)rKrLrM)ryrKrwrOs    r
r�z TelnetBootstrapProtocol.__init__�s��.��� ��� ��rc�����j�jjt<�j�jjt
<t
ttfD]0��jj��j��fd���2tfD]0��jj��j��fd���2�j�ji�j���_	�j}|�j_�jj#��y#t $rY�'wxYw)Nc�@���jjd|���S)NzError do {opt!r}�r��r��failure��fr�rys ��r
�<lambda>z8TelnetBootstrapProtocol.connectionMade.<locals>.<lambda>�s���$�)�)�+�+�,>��s�+�K�rc�@���jjd|���S)NzError setting will {opt!r}rjrkrms ��r
roz8TelnetBootstrapProtocol.connectionMade.<locals>.<lambda>�s���$�)�)�+�+�,H�!�QT�+�U�r)�telnet_NAWSr�r��NAWS�telnet_LINEMODE�LINEMODE�SGArb�
addErrback�ECHOrfrKrLrMrrRrSrT)ryrRr�s` @r
rUz&TelnetBootstrapProtocol.connectionMade�s	���.2�.>�.>����%�%�d�+�26�2F�2F����%�%�h�/��d�C�(�	�C��N�N���c�"�-�-�K�
�	��7�	�C��N�N����$�/�/�U�
�	�
-��,�,�d�.?�.?�W�4�CV�CV�W��
�	,��l�l�G�%,�D�M�M�!��
�
�$�$�T�*���	��	�s�;D4�4	E�?Ec�h�|j�	|jj|�|`yy#|`wxYwr�)rr�rWs  r
r�z&TelnetBootstrapProtocol.connectionLost�s6���=�=�$�
"��
�
�,�,�V�4��M�	%���M�s�-�1c�:�|jj|�yr�r`r�s  r
r�z$TelnetBootstrapProtocol.dataReceived�rarc�,�|tk(ry|tk(ryy�NTF)rwrur�s  r
rUz#TelnetBootstrapProtocol.enableLocal�s���$�;��
�C�Z��rc��|tk(r,|jjtttz�y|t
k(ry|tk(ryyr{)rtr�rk�MODE�LINEMODE_TRAPSIGrrrur�s  r
rWz$TelnetBootstrapProtocol.enableRemote�s=���(�?��N�N�-�-�h��?O�8O�P��
�D�[��
�C�Z��rc�
�t|�dk(rOtjddj|��\}}|jj
j
||�y|jjdt|���y)Nrz!HHrz$Wrong number of NAWS bytes: {nbytes})�nbytes)	�len�struct�unpackr�r�terminalProtocol�terminalSizer��error)ryrP�width�heights    r
rqz#TelnetBootstrapProtocol.telnet_NAWS�s^��
�t�9��>�"�M�M�%����$��@�M�E�6��M�M�*�*�7�7��v�F��I�I�O�O�B�3�t�9�O�Ur�SLCc��yr�rJr�s  r
rsz'TelnetBootstrapProtocol.telnet_LINEMODE�s��	
rc��tt|�gdz�}|D]'\}}}dt|�t|�t|�f�)y)Nrr�)�zip�iter�ord)ryrP�chunks�slcFunction�slcValue�slcWhats      r
�linemode_SLCz$TelnetBootstrapProtocol.linemode_SLCsH���t�D�z�l�Q�&�'��.4�	A�*�K��7��3�{�#�S��]�C��L�@�	Ar)r\r]r^rr�rUr�r�rUrWrq�LINEMODE_SLC�linemodeSubcommandsrsr�rJrr
rfrf�sC���H�!�
+�0"�)��	�	V�(��/��
�Arrf)�basicc�&�eZdZdZdZd�Zd�Zd�Zy)�StatefulTelnetProtocolr��Discardc�p�tjj||�tj||�yr�)r��LineReceiverr�r�rWs  r
r�z%StatefulTelnetProtocol.connectionLosts(��
���)�)�$��7��%�%�d�F�3rc��|j}t|d|z�|�}|�3|j|k(r||_y|jjd�yy)N�telnet_z$state changed and new state returned)r��getattrr��warn)ry�line�oldState�newStates    r
�lineReceivedz#StatefulTelnetProtocol.lineReceivedsR���:�:��6�7�4��X�!5�6�t�<�����z�z�X�%�%��
��	�	���E�F�	 rc��yr�rJ�ryr�s  r
�telnet_Discardz%StatefulTelnetProtocol.telnet_Discard!r�rN)r\r]r^�	delimiterr�r�r�r�rJrr
r�r�s���I��E�4�G�
rr�)�credentialsc�B�eZdZdZdZdZd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zy)�AuthenticatingTelnetProtocola�
    A protocol which prompts for credentials and attempts to authenticate them.

    Username and password prompts are given (the password is obscured).  When the
    information is collected, it is passed to a portal and an avatar implementing
    L{ITelnetProtocol} is requested.  If an avatar is returned, it connected to this
    protocol's transport, and this protocol's transport is connected to it.
    Otherwise, the user is re-prompted for credentials.
    �UserNc��||_yr�)�portal)ryr�s  r
r�z%AuthenticatingTelnetProtocol.__init__6s	����rc�:�|jjd�y)N�
Username: r�rxs r
rUz+AuthenticatingTelnetProtocol.connectionMade9s�������]�+rc��tj||�|j�1	|jj|�|j�|`|`yy#|`|`wxYwr�)r�r�r�logoutrWs  r
r�z+AuthenticatingTelnetProtocol.connectionLost<sW���-�-�d�F�;��=�=�$�
/��
�
�,�,�V�4����
��M�4�;�%��
�M�4�;�s�+A�Ac��||_|jjt�|jj	d�y)Ns
Password: �Password)�usernamer�rfrwr�r�s  r
�telnet_Userz(AuthenticatingTelnetProtocol.telnet_UserEs0����
������D�!������]�+�rc������j|c���`���fd�}�jjt�j	|�y)Nc����tj���}�jj|dt�}|j�j�|j�j�yr�)	r��UsernamePasswordr��loginrH�addCallback�_cbLoginrv�_ebLogin)�ignored�credsr��passwordryr�s   ���r
r�z;AuthenticatingTelnetProtocol.telnet_Password.<locals>.loginOsM����0�0��8�D�E����!�!�%���?�A�
�M�M�$�-�-�(�
�L�L����'rr�)r�r�rhrwr�)ryr�r�r�r�s`  @@r
�telnet_Passwordz,AuthenticatingTelnetProtocol.telnet_PasswordKs?���!�]�]�D���(��M�	(�	
�����D�!�-�-�e�4�rc��|\}}}|tusJ�||_||_d|_|j|j
�||j
_y)N�Command)rHrr�r�rTr�)ry�ial�	interfacerr�s     r
r�z%AuthenticatingTelnetProtocol._cbLoginXsQ��&)�#�	�8�V��O�+�+�+� ��
������
��������/�"*����rc�~�|jjd�|jjd�d|_y)Ns
Authentication failed
r�r�)r�r�r�)ryrls  r
r�z%AuthenticatingTelnetProtocol._ebLoginbs.�������9�:������]�+���
r)
r\r]r^r�r�rr�rUr�r�r�r�r�rJrr
r�r�(s6���
�E��H��,�/���+�rr�)rmrqr}r�rr�rHr`r�r�rIrf)}r�r��zope.interfacer�twisted.internetrr�	iinternetr�twisted.loggerr�twisted.python.compatr�intrrr}�EDIT�TRAPSIG�MODE_ACK�SOFT_TAB�LIT_ECHO�NULL�BEL�BS�HT�LF�VT�FF�CRrwrurrrtr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��
LINEMODE_MODE�
LINEMODE_EDITr~�LINEMODE_MODE_ACK�LINEMODE_SOFT_TAB�LINEMODE_LIT_ECHO�LINEMODE_FORWARDMASKr��LINEMODE_SLC_SYNCH�LINEMODE_SLC_BRK�LINEMODE_SLC_IP�LINEMODE_SLC_AO�LINEMODE_SLC_AYT�LINEMODE_SLC_EOR�LINEMODE_SLC_ABORT�LINEMODE_SLC_EOF�LINEMODE_SLC_SUSP�LINEMODE_SLC_EC�LINEMODE_SLC_EL�LINEMODE_SLC_EW�LINEMODE_SLC_RP�LINEMODE_SLC_LNEXT�LINEMODE_SLC_XON�LINEMODE_SLC_XOFF�LINEMODE_SLC_FORW1�LINEMODE_SLC_FORW2�LINEMODE_SLC_MCL�LINEMODE_SLC_MCR�LINEMODE_SLC_MCWL�LINEMODE_SLC_MCWR�LINEMODE_SLC_MCBOL�LINEMODE_SLC_MCEOL�LINEMODE_SLC_INSRT�LINEMODE_SLC_OVER�LINEMODE_SLC_ECR�LINEMODE_SLC_EWR�LINEMODE_SLC_EBOL�LINEMODE_SLC_EEOL�LINEMODE_SLC_DEFAULT�LINEMODE_SLC_VALUE�LINEMODE_SLC_CANTCHANGE�LINEMODE_SLC_NOSUPPORT�LINEMODE_SLC_LEVELBITS�LINEMODE_SLC_ACK�LINEMODE_SLC_FLUSHIN�LINEMODE_SLC_FLUSHOUT�LINEMODE_EOF�
LINEMODE_SUSP�LINEMODE_ABORT�	IProtocolrH�
ITransportr`�	Exceptionrmrqr}rr�r��Protocolr�r�r<rIrf�twisted.protocolsr�r�r��twisted.credr�r��__all__rJrr
�<module>rsX��
��&�E�E�!�+�	�C�	�E�	��A�w����
������
��
�A�w��
�1�g��	�!�W��	�!�W��
�"�X��	�"�X��
�"�X��	�"�X���A�w��
�1�g���B�x����8��
�3�i��	�#�Y��
�3�i��	�#�Y��
�3�i��	�#�Y��	�#�Y��
�3�i��	�#�Y��	�#�Y��	�#�Y��	�#�Y���C�y���C�y��	�#�Y���C�y���3�i���Q��
��Q��
���7����G����G����H���A�w���A�w���!�W����7���q�'���q�'����7����7���!�W����7����G���r�(���r�(���r�(���r�(���"�X����8����H���"�X���"�X����8����8����H����H���"�X���"�X���"�X����H����8����8����H����H���A�w���!�W���q�'���a����a�����9���B�x���R����C�y���S�	�
��c���A�i�)�)�A�HH�y�+�+�H�V	�)�	�
�{�
�	�$�	�	�%�	�	�&�	�	�)�	�
�_��
�X�&�&�
��
�,y
�X�
�
�y
�x(�(�"JO�f�4�JO�ZVA�n�.D�VA�r$�
�U�/�/��
�,%�=�#9�=�@�r

Zerion Mini Shell 1.0