Home | Trees | Index | Help |
---|
Package paramiko :: Module transport :: Class BaseTransport |
|
object
--+ |_Verbose
--+ |Thread
--+ | BaseTransport
Transport
Method Summary | |
---|---|
Create a new SSH session over an existing socket, or socket-like object. | |
string |
Returns a string representation of this object, for debugging. |
accept(self,
timeout)
| |
Add a host key to the list of keys used for server mode. | |
Channel
|
(subclass override) Determine if a channel request of a given type will be granted, and return a suitable Channel object. |
bool |
(subclass override) Handle a global request of the given kind . |
Close this session, and any open channels that are tied to it. | |
Negotiate an SSH2 session, and optionally verify the server's host key and authenticate using a password or private key. | |
PKey
|
Return the host key of the server (in client mode). |
PKey
|
Return the active host key, in server mode. |
Message
|
Make a global request to the remote host. |
bool |
Return true if this session is active (open). |
bool |
(optional) Load a file of prime moduli for use in doing group-exchange key negotiation in server mode. (Static method) |
Channel
|
Request a new channel to the server. |
Channel
|
Request a new channel to the server, of type "session" . |
bool |
Force this session to switch to new keys. |
Send a junk packet across the encrypted link. | |
Turn on/off keepalive packets (default is off). | |
Negotiate a new SSH2 session as a client. | |
Negotiate a new SSH2 session as a server. | |
switch on newly negotiated encryption parameters for inbound traffic | |
switch on newly negotiated encryption parameters for outbound traffic | |
_build_packet(self,
payload)
| |
_check_banner(self)
| |
_check_keepalive(self)
| |
id is 'A' - 'F' for the various keys used by ssh | |
used by a kex object to register the next packet type it expects to see | |
_get_cipher(self,
name,
key,
iv)
| |
used by KexGex to find primes for group exchange | |
_key_from_blob(self,
keytype,
keyblob)
| |
_log(self,
level,
msg)
| |
_negotiate_keys(self,
m)
| |
_parse_channel_open(self,
m)
| |
_parse_channel_open_failure(self,
m)
| |
_parse_channel_open_success(self,
m)
| |
_parse_debug(self,
m)
| |
_parse_disconnect(self,
m)
| |
_parse_global_request(self,
m)
| |
_parse_kex_init(self,
m)
| |
_parse_newkeys(self,
m)
| |
_parse_request_failure(self,
m)
| |
_parse_request_success(self,
m)
| |
_py22_read_all(self,
n)
| |
_read_all(self,
n)
| |
only one thread will ever be in this function | |
_run(self)
| |
announce to the other side that we'd like to negotiate keys, and what kind of key negotiation we support. | |
_send_message(self,
data)
| |
used by a kex object to set the K (root key) and H (exchange hash) | |
used by a Channel to remove itself from the active channel list | |
_verify_key(self,
host_key,
sig)
| |
_write_all(self,
out)
| |
Inherited from Thread | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
Inherited from _Verbose | |
| |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
helper for pickle | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) | |
Inherited from type | |
T.__new__(S, ...) -> a new object with type S, a subtype of T |
Class Variable Summary | |
---|---|
int |
OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED = 1 |
int |
OPEN_FAILED_CONNECT_FAILED = 2 |
int |
OPEN_FAILED_RESOURCE_SHORTAGE = 4 |
int |
OPEN_FAILED_UNKNOWN_CHANNEL_TYPE = 3 |
list |
preferred_ciphers = ['aes128-cbc', 'blowfish-cbc', 'aes2...
|
list |
preferred_kex = ['diffie-hellman-group1-sha1', 'diffie-h...
|
list |
preferred_keys = ['ssh-rsa', 'ssh-dss']
|
list |
preferred_macs = ['hmac-sha1', 'hmac-md5', 'hmac-sha1-96...
|
int |
REKEY_BYTES = 1073741824 |
int |
REKEY_PACKETS = 1073741824 |
dict |
_channel_handler_table = {96: <unbound method Channel._h...
|
dict |
_cipher_info = {'blowfish-cbc': {'block-size': 8, 'key-s...
|
str |
_CLIENT_ID = 'pyssh_1.1'
|
dict |
_handler_table = {80: <function _parse_global_request at...
|
dict |
_kex_info = {'diffie-hellman-group1-sha1': <class 'param...
|
dict |
_mac_info = {'hmac-sha1': {'class': <module 'Crypto.Hash...
|
NoneType |
_modulus_pack = None |
str |
_PROTO_ID = '2.0'
|
Inherited from Thread | |
bool |
_Thread__initialized = False
|
Instance Method Details |
---|
__init__(self,
sock)
|
__repr__(self)
Returns a string representation of this object, for debugging.
|
add_server_key(self, key)Add a host key to the list of keys used for server mode. When behaving as a server, the host key is used to sign certain packets during the SSH2 negotiation, so that the client can trust that we are who we say we are. Because this is used for signing, the key must contain private key info, not just the public half. |
check_channel_request(self, kind, chanid)(subclass override) Determine if a channel request of a given
type will be granted, and return a suitable In server mode, you will generally want to subclass None ,
rejecting any channel requests. A useful server must override this
method.
|
check_global_request(self, kind, msg)(subclass override) Handle a global request of the given
There aren't any useful global requests defined, aside from port forwarding, so usually this type of request is an extension to the protocol. If the request was successful and you would like to return contextual data to the remote host, return a tuple. Items in the tuple will be sent back with the successful result. (Note that the items in the tuple can only be strings, ints, longs, or bools.) The default implementation always returnsFalse ,
indicating that it does not support any global requests.
|
close(self)Close this session, and any open channels that are tied to it. |
connect(self, hostkeytype=None, hostkey=None, username='', password=None, pkey=None)Negotiate an SSH2 session, and optionally verify the server's host
key and authenticate using a password or private key. This is a
shortcut for open_channel or open_session to get a Channel object, which is used for data
transfer.
|
get_remote_server_key(self)Return the host key of the server (in client mode).
|
get_server_key(self)Return the active host key, in server mode. After negotiating with the client, this method will return the negotiated host key. If only one type of host key was set withadd_server_key , that's the only key that
will ever be returned. But in cases where you have set more than one
type of host key (for example, an RSA key and a DSS key), the key type
will be negotiated by the client, and this method will return the key
of the type agreed on. If the host key has not been negotiated yet,
None is returned. In client mode, the behavior is
undefined.
|
global_request(self, kind, data=None, wait=True)Make a global request to the remote host. These are normally extensions to the SSH2 protocol.
|
is_active(self)Return true if this session is active (open).
|
open_channel(self, kind, dest_addr=None, src_addr=None)Request a new channel to the server.Channel s are socket-like objects used for
the actual transfer of data across the session. You may only request a
channel after negotiating encryption (using connect or start_client and authenticating.
|
open_session(self)Request a new channel to the server, of type"session" . This is just an alias for
open_channel('session') .
|
renegotiate_keys(self)Force this session to switch to new keys. Normally this is done automatically after the session hits a certain number of packets or bytes sent or received, but this method gives you the option of forcing new keys whenever you want. Negotiating new keys causes a pause in traffic both ways as the two sides swap keys and do computations. This method returns when the session has switched to new keys, or the session has died mid-negotiation.
|
send_ignore(self, bytes=None)Send a junk packet across the encrypted link. This is sometimes used to add "noise" to a connection to confuse would-be attackers. It can also be used as a keep-alive for long lived connections traversing firewalls.
|
set_keepalive(self, interval)Turn on/off keepalive packets (default is off). If this is set, afterinterval seconds without sending any data over the
connection, a "keepalive" packet will be sent (and ignored by
the remote host). This can be useful to keep connections alive over a
NAT, for example.
|
start_client(self, event=None)Negotiate a new SSH2 session as a client. This is the first step
after creating a new When negotiation is done (successful or not), the given
auth_password or auth_publickey .
|
start_server(self, event=None)Negotiate a new SSH2 session as a server. This is the first step
after creating a new When negotiation is done (successful or not), the given
After a successful negotiation, the client will need to
authenticate. Override the methods check_channel_request to allow channels
to be opened.
|
_activate_inbound(self)switch on newly negotiated encryption parameters for inbound traffic |
_activate_outbound(self)switch on newly negotiated encryption parameters for outbound traffic |
_compute_key(self, id, nbytes)id is 'A' - 'F' for the various keys used by ssh |
_expect_packet(self, type)used by a kex object to register the next packet type it expects to see |
_get_modulus_pack(self)used by KexGex to find primes for group exchange |
_read_message(self)only one thread will ever be in this function |
_send_kex_init(self)announce to the other side that we'd like to negotiate keys, and what kind of key negotiation we support. |
_set_K_H(self, k, h)used by a kex object to set the K (root key) and H (exchange hash) |
_unlink_channel(self, chanid)used by a Channel to remove itself from the active channel list |
Static Method Details |
---|
load_server_moduli(filename=None)(optional) Load a file of prime moduli for use in doing group-exchange key negotiation in server mode. It's a rather obscure option and can be safely ignored. In server mode, the remote client may request "group-exchange" key negotiation, which asks the server to send a random prime number that fits certain criteria. These primes are pretty difficult to compute, so they can't be generated on demand. But many systems contain a file of suitable primes (usually named something like/etc/ssh/moduli ). If you call
load_server_moduli and it returns True , then
this file of primes has been loaded and we will support
"group-exchange" in server mode. Otherwise server mode will
just claim that it doesn't support that method of key negotiation.
|
Class Variable Details |
---|
OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED
|
OPEN_FAILED_CONNECT_FAILED
|
OPEN_FAILED_RESOURCE_SHORTAGE
|
OPEN_FAILED_UNKNOWN_CHANNEL_TYPE
|
preferred_ciphers
|
preferred_kex
|
preferred_keys
|
preferred_macs
|
REKEY_BYTES
|
REKEY_PACKETS
|
_cipher_info
|
_CLIENT_ID
|
_handler_table
|
_kex_info
|
_mac_info
|
_modulus_pack
|
_PROTO_ID
|
Home | Trees | Index | Help |
---|
Generated by Epydoc 2.0 on Sun Jun 27 13:06:22 2004 | http://epydoc.sf.net |