← Back
Editing: forward.cpython-311.pyc
� mc�c � � � d Z ddlZddlZddlZ ej d� � Z G d� dej � � Z G d� dej � � Z d� Z d gZdS ) a Sample script showing how to do local port forwarding over paramiko. This script connects to the requested SSH server and sets up local port forwarding (the openssh -L option) from a local port through a tunneled connection to a destination reachable from the SSH server machine. � N�sshc � � e Zd ZdZdZdS )� ForwardServerTN)�__name__� __module__�__qualname__�daemon_threads�allow_reuse_address� � �1/usr/lib/python3/dist-packages/zmq/ssh/forward.pyr r $ s � � � � � ��N����r r c � � e Zd Zd� ZdS )�Handlerc �* � | j � d| j | j f| j � � � � � }nO# t $ rB}t � d| j | j t |� � fz � � Y d }~d S d }~ww xY w|�+t � d| j | j fz � � d S t � d| j � � � �d|� � � �d| j | j f��� � t j | j |gg g � � \ }}}| j |v rC| j � d� � }t |� � dk rn]|� |� � ||v rC|� d� � }t |� � dk rn| j � |� � ��|� � � | j � � � t � d � � d S ) Nzdirect-tcpipz$Incoming request to %s:%d failed: %sz9Incoming request to %s:%d was rejected by the SSH server.zConnected! Tunnel open z -> Ti r zTunnel closed )� ssh_transport�open_channel� chain_host� chain_port�request�getpeername� Exception�logger�debug�repr�select�recv�len�send�close)�self�chan�e�r�w�x�datas r �handlezHandler.handle* s � � ��%�2�2����$�/�2���(�(�*�*�� �D�D�� � � � ��L�L�6��?�D�O�T�!�W�W�=�>� � � � �F�F�F�F�F����� ���� �<��L�L�K��?�D�O�4�5� � � � �F����� ��(�(�*�*�*�*�� � �"�"�"�"���$�/�2�2� � � � � (��m�T�\�4�$8�"�b�A�A�G�A�q�!��|�q� � ��|�(�(��.�.���t�9�9��>�>��� � �$�����q�y�y��y�y������t�9�9��>�>����!�!�$�'�'�'� (� � � ��������������%�&�&�&�&�&s �?A � B�7B � BN)r r r r'