Package paramiko :: Module packet :: Class Packetizer
[frames] | no frames]

Class Packetizer

source code

object --+
         |
        Packetizer

Implementation of the base SSH packet protocol.

Instance Methods
 
__init__(self, socket)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
set_log(self, log)
Set the Python log object to use for logging.
source code
 
set_outbound_cipher(self, block_engine, block_size, mac_engine, mac_size, mac_key, sdctr=False)
Switch outbound data cipher.
source code
 
set_inbound_cipher(self, block_engine, block_size, mac_engine, mac_size, mac_key)
Switch inbound data cipher.
source code
 
set_outbound_compressor(self, compressor) source code
 
set_inbound_compressor(self, compressor) source code
 
close(self) source code
 
set_hexdump(self, hexdump) source code
 
get_hexdump(self) source code
 
get_mac_size_in(self) source code
 
get_mac_size_out(self) source code
 
need_rekey(self)
Returns ``True`` if a new set of keys needs to be negotiated.
source code
 
set_keepalive(self, interval, callback)
Turn on/off the callback keepalive.
source code
 
read_all(self, n, check_rekey=False)
Read as close to N bytes as possible, blocking as long as necessary.
source code
 
write_all(self, out) source code
 
readline(self, timeout)
Read a line from the socket.
source code
 
send_message(self, data)
Write a block of data using the current cipher, as an SSH block.
source code
 
read_message(self)
Only one thread should ever be in this function (no other locking is done).
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  REKEY_PACKETS = 536870912
  REKEY_BYTES = 536870912
  REKEY_PACKETS_OVERFLOW_MAX = 536870912
  REKEY_BYTES_OVERFLOW_MAX = 536870912
Properties

Inherited from object: __class__

Method Details

__init__(self, socket)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

need_rekey(self)

source code 

Returns ``True`` if a new set of keys needs to be negotiated. This will be triggered during a packet read or write, so it should be checked after every read or write, or at least after every few.

set_keepalive(self, interval, callback)

source code 

Turn on/off the callback keepalive. If ``interval`` seconds pass with no data read from or written to the socket, the callback will be executed and the timer will be reset.

read_all(self, n, check_rekey=False)

source code 

Read as close to N bytes as possible, blocking as long as necessary.

:param int n: number of bytes to read
:return: the data read, as a `str`

:raises EOFError:
    if the socket was closed before all the bytes could be read

readline(self, timeout)

source code 

Read a line from the socket. We assume no data is pending after the line, so it's okay to attempt large reads.

read_message(self)

source code 

Only one thread should ever be in this function (no other locking is done).

:raises SSHException: if the packet is mangled :raises NeedRekeyException: if the transport should rekey