예제 #1
0
    def __init__(self,
                 host,
                 username,
                 password,
                 port=None,
                 on_session_start=None,
                 pkey=None,
                 *args,
                 **kwargs):
        ConnectionParams.__init__(self,
                                  host,
                                  port=port,
                                  on_session_start=on_session_start,
                                  pkey=pkey)
        ExpectSession.__init__(self, *args, **kwargs)

        if hasattr(self, 'port') and self.port is None:
            self.port = 22

        self.username = username
        self.password = password
        self.pkey = pkey

        self._handler = None
        self._current_channel = None
        self._buffer_size = self.BUFFER_SIZE
예제 #2
0
    def __init__(self, host, port, on_session_start=None, *args, **kwargs):
        ConnectionParams.__init__(
            self, host=host, port=port, on_session_start=on_session_start
        )
        ExpectSession.__init__(self, *args, **kwargs)

        self._buffer_size = self.BUFFER_SIZE
        self._handler = None
예제 #3
0
    def __init__(self, *args, **kwargs):
        ExpectSession.__init__(self, socket.socket(socket.AF_INET, socket.SOCK_STREAM), *args, **kwargs)

        self.session_type = 'TCP'
        self._buffer_size = 1024
        if 'buffer_size' in kwargs:
            self._buffer_size = kwargs['buffer_size']

        if self._port is not None:
            self._port = int(self._port)
예제 #4
0
    def __init__(self, *args, **kwargs):
        ExpectSession.__init__(self, paramiko.SSHClient(), *args, **kwargs)
        self.session_type = 'SSH'

        self._handler.load_system_host_keys()
        self._handler.set_missing_host_key_policy(paramiko.AutoAddPolicy())

        if self._port is None:
            self._port = 22

        self._current_channel = None

        self._buffer_size = 512
        if 'buffer_size' in kwargs:
            self._buffer_size = kwargs['buffer_size']
    def __init__(self, *args, **kwargs):
        """Initiate console connection, by default open ssh to 22 port and login to console server

        :param args:
        :param kwargs: 'console_server_ip', 'console_server_user', 'console_server_password', 'console_port' mandatory'
        :return:
        """

        ExpectSession.__init__(self, None, *args, **kwargs)

        self._console_username = kwargs['console_server_user']
        self._console_password = kwargs['console_server_password']
        self._console_host = kwargs['console_server_ip']

        self._session_handler = SSHSession(self._console_username, self._console_password, self._console_host,
                                           port=22, logger=self.logger)

        self._console_port = kwargs['console_port']
예제 #6
0
    def __init__(self, *args, **kwargs):
        """Initiate console connection, by default open ssh to 22 port and login to console server

        :param args:
        :param kwargs: 'console_server_ip', 'console_server_user', 'console_server_password', 'console_port' mandatory'
        :return:
        """

        ExpectSession.__init__(self, None, *args, **kwargs)

        self._console_username = kwargs['console_server_user']
        self._console_password = kwargs['console_server_password']
        self._console_host = kwargs['console_server_ip']

        self._session_handler = SSHSession(self._console_username,
                                           self._console_password,
                                           self._console_host,
                                           port=22,
                                           logger=self.logger)

        self._console_port = kwargs['console_port']
예제 #7
0
    def __init__(self,
                 host,
                 username,
                 password,
                 port=None,
                 on_session_start=None,
                 *args,
                 **kwargs):
        ConnectionParams.__init__(self,
                                  host,
                                  port=port,
                                  on_session_start=on_session_start)
        ExpectSession.__init__(self, *args, **kwargs)

        if hasattr(self, 'port') and self.port is None:
            self.port = 23

        self.username = username
        self.password = password

        self._handler = None
예제 #8
0
    def __init__(self, *args, **kwargs):
        ExpectSession.__init__(self, telnetlib.Telnet(), *args, **kwargs)

        self.session_type = 'TELNET'
        if self._port is None:
            self._port = 23