File: //usr/lib/python3/dist-packages/twisted/conch/ssh/__pycache__/session.cpython-38.pyc
U
��W[�+ �
@ s> d Z ddlmZmZ ddlZddlZddlZddlZddlm Z ddl
mZmZ ddl
mZ ddlmZmZ ddlmZ dd lmZmZmZ G d
d� dej�ZG dd
� d
ej�ZG dd� d�Zdd� Zdd� Zddddddddddddd g
Z e ej!�G d!d"� d"ej��Z"G d#d$� d$ej#�Z$d%d&� Z%d'd(� Z&d)d*� Z'd+d,� Z(dS )-z�
This module contains the implementation of SSHSession, which (by default)
allows access to a shell and a python interpreter over SSH.
Maintainer: Paul Swartz
� )�division�absolute_importN)�implementer)�
interfaces�protocol)�log)� _bytesChr�
networkString)�ISession)�common�channel�
connectionc @ sh e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� Zdd
� Z dd� Z
dd� Zdd� Zdd� Z
dd� ZdS )�
SSHSessions sessionc O s* t jj| f|�|� d| _d | _d | _d S �N� )r �
SSHChannel�__init__�buf�client�session)�self�args�kw� r �;/usr/lib/python3/dist-packages/twisted/conch/ssh/session.pyr s zSSHSession.__init__c C sr t �|�\}}t�d| � | j�||�}|r`t| �}t|�}|�|� |�t |�� || _
dS t�d� dS d S )Nzasking for subsystem "%s"� zfailed to get subsystemr )r �getNSr �msg�avatarZlookupSubsystem�SSHSessionProcessProtocol�wrapProcessProtocolZmakeConnection�wrapProtocolr )r �dataZ subsystem�ignoredr �pp�protor r r �request_subsystem% s
zSSHSession.request_subsystemc C sZ t �d� | jst| j�| _zt| �}| j�|� W n t �� Y dS X || _dS d S )Nz
getting shellr r ) r r r r
r r Z openShell�deferrr )r r"