<?xml version="1.0" encoding="ascii"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>paramiko.Transport</title> <link rel="stylesheet" href="epydoc.css" type="text/css" /> <script type="text/javascript" src="epydoc.js"></script> </head> <body bgcolor="white" text="black" link="blue" vlink="#204080" alink="#204080"> <!-- ==================== NAVIGATION BAR ==================== --> <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> <tr valign="middle"> <!-- Home link --> <th> <a href="paramiko-module.html">Home</a> </th> <!-- Tree link --> <th> <a href="module-tree.html">Trees</a> </th> <!-- Index link --> <th> <a href="identifier-index.html">Indices</a> </th> <!-- Help link --> <th> <a href="help.html">Help</a> </th> <th class="navbar" width="100%"></th> </tr> </table> <table width="100%" cellpadding="0" cellspacing="0"> <tr valign="top"> <td width="100%"> <span class="breadcrumbs"> <a href="paramiko-module.html">Package paramiko</a> :: Class Transport </span> </td> <td> <table cellpadding="0" cellspacing="0"> <!-- hide/show private --> <tr><td align="right"><span class="options" >[<a href="frames.html" target="_top">frames</a >] | <a href="paramiko.Transport-class.html" target="_top">no frames</a>]</span></td></tr> </table> </td> </tr> </table> <!-- ==================== CLASS DESCRIPTION ==================== --> <h1 class="epydoc">Class Transport</h1><p class="nomargin-top"><span class="codelink"><a href="paramiko-pysrc.html#Transport">source code</a></span></p> <pre class="base-tree"> object --+ | threading._Verbose --+ | threading.Thread --+ | <strong class="uidshort">Transport</strong> </pre> <hr /> <p>An SSH Transport attaches to a stream (usually a socket), negotiates an encrypted session, authenticates, and then creates stream tunnels, called <a href="paramiko.Channel-class.html" class="link">Channel</a>s, across the session. Multiple channels can be multiplexed across a single session (and often are, in the case of port forwardings).</p> <!-- ==================== INSTANCE METHODS ==================== --> <a name="section-InstanceMethods"></a> <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td align="left" colspan="2" class="table-header"> <span class="table-header">Instance Methods</span></td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">sock</span>)</span><br /> Create a new SSH session over an existing socket, or socket-like object.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">str</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#__repr__" class="summary-sig-name">__repr__</a>(<span class="summary-sig-arg">self</span>)</span><br /> Returns a string representation of this object, for debugging.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"><a href="paramiko.Channel-class.html" class="link">Channel</a></span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#accept" class="summary-sig-name">accept</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">timeout</span>=<span class="summary-sig-default">None</span>)</span><br /> Return the next channel opened by the client over this transport, in server mode.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#add_server_key" class="summary-sig-name">add_server_key</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">key</span>)</span><br /> Add a host key to the list of keys used for server mode.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#atfork" class="summary-sig-name">atfork</a>(<span class="summary-sig-arg">self</span>)</span><br /> Terminate this Transport without closing the session.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">list</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#auth_interactive" class="summary-sig-name">auth_interactive</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">username</span>, <span class="summary-sig-arg">handler</span>, <span class="summary-sig-arg">submethods</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>)</span><br /> Authenticate to the server interactively.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">list</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#auth_none" class="summary-sig-name">auth_none</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">username</span>)</span><br /> Try to authenticate to the server using no authentication at all.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">list</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#auth_password" class="summary-sig-name">auth_password</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">username</span>, <span class="summary-sig-arg">password</span>, <span class="summary-sig-arg">event</span>=<span class="summary-sig-default">None</span>, <span class="summary-sig-arg">fallback</span>=<span class="summary-sig-default">True</span>)</span><br /> Authenticate to the server using a password.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">list</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#auth_publickey" class="summary-sig-name">auth_publickey</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">username</span>, <span class="summary-sig-arg">key</span>, <span class="summary-sig-arg">event</span>=<span class="summary-sig-default">None</span>)</span><br /> Authenticate to the server using a private key.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#cancel_port_forward" class="summary-sig-name">cancel_port_forward</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">address</span>, <span class="summary-sig-arg">port</span>)</span><br /> Ask the server to cancel a previous port-forwarding request.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="close"></a><span class="summary-sig-name">close</span>(<span class="summary-sig-arg">self</span>)</span><br /> Close this session, and any open channels that are tied to it.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#connect" class="summary-sig-name">connect</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">hostkey</span>=<span class="summary-sig-default">None</span>, <span class="summary-sig-arg">username</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>, <span class="summary-sig-arg">password</span>=<span class="summary-sig-default">None</span>, <span class="summary-sig-arg">pkey</span>=<span class="summary-sig-default">None</span>)</span><br /> Negotiate an SSH2 session, and optionally verify the server's host key and authenticate using a password or private key.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">Exception</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#get_exception" class="summary-sig-name">get_exception</a>(<span class="summary-sig-arg">self</span>)</span><br /> Return any exception that happened during the last server request.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">bool</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#get_hexdump" class="summary-sig-name">get_hexdump</a>(<span class="summary-sig-arg">self</span>)</span><br /> Return <code>True</code> if the transport is currently logging hex dumps of protocol traffic.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">str</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#get_log_channel" class="summary-sig-name">get_log_channel</a>(<span class="summary-sig-arg">self</span>)</span><br /> Return the channel name used for this transport's logging.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"><a href="paramiko.PKey-class.html" class="link">PKey</a></span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#get_remote_server_key" class="summary-sig-name">get_remote_server_key</a>(<span class="summary-sig-arg">self</span>)</span><br /> Return the host key of the server (in client mode).</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"><a href="paramiko.SecurityOptions-class.html" class="link">SecurityOptions</a></span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#get_security_options" class="summary-sig-name">get_security_options</a>(<span class="summary-sig-arg">self</span>)</span><br /> Return a <a href="paramiko.SecurityOptions-class.html" class="link">SecurityOptions</a> object which can be used to tweak the encryption algorithms this transport will permit, and the order of preference for them.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"><a href="paramiko.PKey-class.html" class="link">PKey</a></span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#get_server_key" class="summary-sig-name">get_server_key</a>(<span class="summary-sig-arg">self</span>)</span><br /> Return the active host key, in server mode.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">string</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#get_username" class="summary-sig-name">get_username</a>(<span class="summary-sig-arg">self</span>)</span><br /> Return the username this connection is authenticated for.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">tuple(str, int)</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#getpeername" class="summary-sig-name">getpeername</a>(<span class="summary-sig-arg">self</span>)</span><br /> Return the address of the remote side of this Transport, if possible.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"><a href="paramiko.Message-class.html" class="link">Message</a></span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#global_request" class="summary-sig-name">global_request</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">kind</span>, <span class="summary-sig-arg">data</span>=<span class="summary-sig-default">None</span>, <span class="summary-sig-arg">wait</span>=<span class="summary-sig-default">True</span>)</span><br /> Make a global request to the remote host.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">bool</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#is_active" class="summary-sig-name">is_active</a>(<span class="summary-sig-arg">self</span>)</span><br /> Return true if this session is active (open).</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">bool</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#is_authenticated" class="summary-sig-name">is_authenticated</a>(<span class="summary-sig-arg">self</span>)</span><br /> Return true if this session is active and authenticated.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"><a href="paramiko.Channel-class.html" class="link">Channel</a></span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#open_channel" class="summary-sig-name">open_channel</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">kind</span>, <span class="summary-sig-arg">dest_addr</span>=<span class="summary-sig-default">None</span>, <span class="summary-sig-arg">src_addr</span>=<span class="summary-sig-default">None</span>)</span><br /> Request a new channel to the server.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#open_forwarded_tcpip_channel" class="summary-sig-name">open_forwarded_tcpip_channel</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">(src_addr, src_port)</span>, <span class="summary-sig-arg">(dest_addr, dest_port)</span>)</span><br /> Request a new channel back to the client, of type <code>"forwarded-tcpip"</code>.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"><a href="paramiko.Channel-class.html" class="link">Channel</a></span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#open_session" class="summary-sig-name">open_session</a>(<span class="summary-sig-arg">self</span>)</span><br /> Request a new channel to the server, of type <code>"session"</code>.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"><a href="paramiko.SFTPClient-class.html" class="link">SFTPClient</a></span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#open_sftp_client" class="summary-sig-name">open_sftp_client</a>(<span class="summary-sig-arg">self</span>)</span><br /> Create an SFTP client channel from an open transport.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"><a href="paramiko.Channel-class.html" class="link">Channel</a></span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#open_x11_channel" class="summary-sig-name">open_x11_channel</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">src_addr</span>=<span class="summary-sig-default">None</span>)</span><br /> Request a new channel to the client, of type <code>"x11"</code>.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#renegotiate_keys" class="summary-sig-name">renegotiate_keys</a>(<span class="summary-sig-arg">self</span>)</span><br /> Force this session to switch to new keys.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">int</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#request_port_forward" class="summary-sig-name">request_port_forward</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">address</span>, <span class="summary-sig-arg">port</span>, <span class="summary-sig-arg">handler</span>=<span class="summary-sig-default">None</span>)</span><br /> Ask the server to forward TCP connections from a listening port on the server, across this SSH session.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#run" class="summary-sig-name">run</a>(<span class="summary-sig-arg">self</span>)</span></td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#send_ignore" class="summary-sig-name">send_ignore</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">bytes</span>=<span class="summary-sig-default">None</span>)</span><br /> Send a junk packet across the encrypted link.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#set_hexdump" class="summary-sig-name">set_hexdump</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">hexdump</span>)</span><br /> Turn on/off logging a hex dump of protocol traffic at DEBUG level in the logs.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#set_keepalive" class="summary-sig-name">set_keepalive</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">interval</span>)</span><br /> Turn on/off keepalive packets (default is off).</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#set_log_channel" class="summary-sig-name">set_log_channel</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">name</span>)</span><br /> Set the channel for this transport's logging.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#set_subsystem_handler" class="summary-sig-name">set_subsystem_handler</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">name</span>, <span class="summary-sig-arg">handler</span>, <span class="summary-sig-arg">*larg</span>, <span class="summary-sig-arg">**kwarg</span>)</span><br /> Set the handler class for a subsystem in server mode.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#start_client" class="summary-sig-name">start_client</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">event</span>=<span class="summary-sig-default">None</span>)</span><br /> Negotiate a new SSH2 session as a client.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#start_server" class="summary-sig-name">start_server</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">event</span>=<span class="summary-sig-default">None</span>, <span class="summary-sig-arg">server</span>=<span class="summary-sig-default">None</span>)</span><br /> Negotiate a new SSH2 session as a server.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="stop_thread"></a><span class="summary-sig-name">stop_thread</span>(<span class="summary-sig-arg">self</span>)</span></td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#use_compression" class="summary-sig-name">use_compression</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">compress</span>=<span class="summary-sig-default">True</span>)</span><br /> Turn on/off compression.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td colspan="2" class="summary"> <p class="indent-wrapped-lines"><b>Inherited from <code>threading.Thread</code></b>: <code>getName</code>, <code>isAlive</code>, <code>isDaemon</code>, <code>is_alive</code>, <code>join</code>, <code>setDaemon</code>, <code>setName</code>, <code>start</code> </p> <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: <code>__delattr__</code>, <code>__format__</code>, <code>__getattribute__</code>, <code>__hash__</code>, <code>__new__</code>, <code>__reduce__</code>, <code>__reduce_ex__</code>, <code>__setattr__</code>, <code>__sizeof__</code>, <code>__str__</code>, <code>__subclasshook__</code> </p> </td> </tr> </table> <!-- ==================== STATIC METHODS ==================== --> <a name="section-StaticMethods"></a> <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td align="left" colspan="2" class="table-header"> <span class="table-header">Static Methods</span></td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">bool</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.Transport-class.html#load_server_moduli" class="summary-sig-name">load_server_moduli</a>(<span class="summary-sig-arg">filename</span>=<span class="summary-sig-default">None</span>)</span><br /> <i>(optional)</i> Load a file of prime moduli for use in doing group-exchange key negotiation in server mode.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko-pysrc.html#Transport.load_server_moduli">source code</a></span> </td> </tr> </table> </td> </tr> </table> <!-- ==================== PROPERTIES ==================== --> <a name="section-Properties"></a> <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td align="left" colspan="2" class="table-header"> <span class="table-header">Properties</span></td> </tr> <tr> <td colspan="2" class="summary"> <p class="indent-wrapped-lines"><b>Inherited from <code>threading.Thread</code></b>: <code>daemon</code>, <code>ident</code>, <code>name</code> </p> <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: <code>__class__</code> </p> </td> </tr> </table> <!-- ==================== METHOD DETAILS ==================== --> <a name="section-MethodDetails"></a> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td align="left" colspan="2" class="table-header"> <span class="table-header">Method Details</span></td> </tr> </table> <a name="__init__"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>, <span class="sig-arg">sock</span>)</span> <br /><em class="fname">(Constructor)</em> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Create a new SSH session over an existing socket, or socket-like object. This only creates the Transport object; it doesn't begin the SSH session yet. Use <a href="paramiko.Transport-class.html#connect" class="link">connect</a> or <a href="paramiko.Transport-class.html#start_client" class="link">start_client</a> to begin a client session, or <a href="paramiko.Transport-class.html#start_server" class="link">start_server</a> to begin a server session.</p> <p>If the object is not actually a socket, it must have the following methods:</p> <ul> <li> <code>send(str)</code>: Writes from 1 to <code>len(str)</code> bytes, and returns an int representing the number of bytes written. Returns 0 or raises <code>EOFError</code> if the stream has been closed. </li> <li> <code>recv(int)</code>: Reads from 1 to <code>int</code> bytes and returns them as a string. Returns 0 or raises <code>EOFError</code> if the stream has been closed. </li> <li> <code>close()</code>: Closes the socket. </li> <li> <code>settimeout(n)</code>: Sets a (float) timeout on I/O operations. </li> </ul> <p>For ease of use, you may also pass in an address (as a tuple) or a host string as the <code>sock</code> argument. (A host string is a hostname with an optional port (separated by <code>":"</code>) which will be converted into a tuple of <code>(hostname, port)</code>.) A socket will be connected to this address and used for communication. Exceptions from the <code>socket</code> call may be thrown in this case.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>sock</code></strong> (socket) - a socket or socket-like object to create the session over.</li> </ul></dd> <dt>Overrides: object.__init__ </dt> </dl> </td></tr></table> </div> <a name="__repr__"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">__repr__</span>(<span class="sig-arg">self</span>)</span> <br /><em class="fname">(Representation operator)</em> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Returns a string representation of this object, for debugging.</p> <dl class="fields"> <dt>Returns: str</dt> <dt>Overrides: object.__repr__ </dt> </dl> </td></tr></table> </div> <a name="accept"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">accept</span>(<span class="sig-arg">self</span>, <span class="sig-arg">timeout</span>=<span class="sig-default">None</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Return the next channel opened by the client over this transport, in server mode. If no channel is opened before the given timeout, <code>None</code> is returned.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>timeout</code></strong> (int) - seconds to wait for a channel, or <code>None</code> to wait forever</li> </ul></dd> <dt>Returns: <a href="paramiko.Channel-class.html" class="link">Channel</a></dt> <dd>a new Channel opened by the client</dd> </dl> </td></tr></table> </div> <a name="add_server_key"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">add_server_key</span>(<span class="sig-arg">self</span>, <span class="sig-arg">key</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>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. Only one key of each type (RSA or DSS) is kept.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>key</code></strong> (<a href="paramiko.PKey-class.html" class="link">PKey</a>) - the host key to add, usually an <a href="paramiko.RSAKey-class.html" class="link">RSAKey</a> or <a href="paramiko.DSSKey-class.html" class="link">DSSKey</a>.</li> </ul></dd> </dl> </td></tr></table> </div> <a name="atfork"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">atfork</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Terminate this Transport without closing the session. On posix systems, if a Transport is open during process forking, both parent and child will share the underlying socket, but only one process can use the connection (without corrupting the session). Use this method to clean up a Transport object without disrupting the other process.</p> <dl class="fields"> </dl> <div class="fields"> <p><strong>Since:</strong> 1.5.3 </p> </div></td></tr></table> </div> <a name="auth_interactive"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">auth_interactive</span>(<span class="sig-arg">self</span>, <span class="sig-arg">username</span>, <span class="sig-arg">handler</span>, <span class="sig-arg">submethods</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Authenticate to the server interactively. A handler is used to answer arbitrary questions from the server. On many servers, this is just a dumb wrapper around PAM.</p> <p>This method will block until the authentication succeeds or fails, peroidically calling the handler asynchronously to get answers to authentication questions. The handler may be called more than once if the server continues to ask questions.</p> <p>The handler is expected to be a callable that will handle calls of the form: <code>handler(title, instructions, prompt_list)</code>. The <code>title</code> is meant to be a dialog-window title, and the <code>instructions</code> are user instructions (both are strings). <code>prompt_list</code> will be a list of prompts, each prompt being a tuple of <code>(str, bool)</code>. The string is the prompt and the boolean indicates whether the user text should be echoed.</p> <p>A sample call would thus be: <code>handler('title', 'instructions', [('Password:', False)])</code>.</p> <p>The handler should return a list or tuple of answers to the server's questions.</p> <p>If the server requires multi-step authentication (which is very rare), this method will return a list of auth types permissible for the next step. Otherwise, in the normal case, an empty list is returned.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>username</code></strong> (string) - the username to authenticate as</li> <li><strong class="pname"><code>handler</code></strong> (callable) - a handler for responding to server questions</li> <li><strong class="pname"><code>submethods</code></strong> (str) - a string list of desired submethods (optional)</li> </ul></dd> <dt>Returns: list</dt> <dd>list of auth types permissible for the next stage of authentication (normally empty).</dd> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'><a href="paramiko.BadAuthenticationType-class.html">BadAuthenticationType</a></strong></code> - if public-key authentication isn't allowed by the server for this user</li> <li><code><strong class='fraise'><a href="paramiko.AuthenticationException-class.html">AuthenticationException</a></strong></code> - if the authentication failed</li> <li><code><strong class='fraise'><a href="paramiko.SSHException-class.html">SSHException</a></strong></code> - if there was a network error</li> </ul></dd> </dl> <div class="fields"> <p><strong>Since:</strong> 1.5 </p> </div></td></tr></table> </div> <a name="auth_none"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">auth_none</span>(<span class="sig-arg">self</span>, <span class="sig-arg">username</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Try to authenticate to the server using no authentication at all. This will almost always fail. It may be useful for determining the list of authentication types supported by the server, by catching the <a href="paramiko.BadAuthenticationType-class.html" class="link">BadAuthenticationType</a> exception raised.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>username</code></strong> (string) - the username to authenticate as</li> </ul></dd> <dt>Returns: list</dt> <dd>list of auth types permissible for the next stage of authentication (normally empty)</dd> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'><a href="paramiko.BadAuthenticationType-class.html">BadAuthenticationType</a></strong></code> - if "none" authentication isn't allowed by the server for this user</li> <li><code><strong class='fraise'><a href="paramiko.SSHException-class.html">SSHException</a></strong></code> - if the authentication failed due to a network error</li> </ul></dd> </dl> <div class="fields"> <p><strong>Since:</strong> 1.5 </p> </div></td></tr></table> </div> <a name="auth_password"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">auth_password</span>(<span class="sig-arg">self</span>, <span class="sig-arg">username</span>, <span class="sig-arg">password</span>, <span class="sig-arg">event</span>=<span class="sig-default">None</span>, <span class="sig-arg">fallback</span>=<span class="sig-default">True</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Authenticate to the server using a password. The username and password are sent over an encrypted link.</p> <p>If an <code>event</code> is passed in, this method will return immediately, and the event will be triggered once authentication succeeds or fails. On success, <a href="paramiko.Transport-class.html#is_authenticated" class="link">is_authenticated</a> will return <code>True</code>. On failure, you may use <a href="paramiko.Transport-class.html#get_exception" class="link">get_exception</a> to get more detailed error information.</p> <p>Since 1.1, if no event is passed, this method will block until the authentication succeeds or fails. On failure, an exception is raised. Otherwise, the method simply returns.</p> <p>Since 1.5, if no event is passed and <code>fallback</code> is <code>True</code> (the default), if the server doesn't support plain password authentication but does support so-called "keyboard-interactive" mode, an attempt will be made to authenticate using this interactive mode. If it fails, the normal exception will be thrown as if the attempt had never been made. This is useful for some recent Gentoo and Debian distributions, which turn off plain password authentication in a misguided belief that interactive authentication is "more secure". (It's not.)</p> <p>If the server requires multi-step authentication (which is very rare), this method will return a list of auth types permissible for the next step. Otherwise, in the normal case, an empty list is returned.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>username</code></strong> (str) - the username to authenticate as</li> <li><strong class="pname"><code>password</code></strong> (str or unicode) - the password to authenticate with</li> <li><strong class="pname"><code>event</code></strong> (threading.Event) - an event to trigger when the authentication attempt is complete (whether it was successful or not)</li> <li><strong class="pname"><code>fallback</code></strong> (bool) - <code>True</code> if an attempt at an automated "interactive" password auth should be made if the server doesn't support normal password auth</li> </ul></dd> <dt>Returns: list</dt> <dd>list of auth types permissible for the next stage of authentication (normally empty)</dd> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'><a href="paramiko.BadAuthenticationType-class.html">BadAuthenticationType</a></strong></code> - if password authentication isn't allowed by the server for this user (and no event was passed in)</li> <li><code><strong class='fraise'><a href="paramiko.AuthenticationException-class.html">AuthenticationException</a></strong></code> - if the authentication failed (and no event was passed in)</li> <li><code><strong class='fraise'><a href="paramiko.SSHException-class.html">SSHException</a></strong></code> - if there was a network error</li> </ul></dd> </dl> </td></tr></table> </div> <a name="auth_publickey"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">auth_publickey</span>(<span class="sig-arg">self</span>, <span class="sig-arg">username</span>, <span class="sig-arg">key</span>, <span class="sig-arg">event</span>=<span class="sig-default">None</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Authenticate to the server using a private key. The key is used to sign data from the server, so it must include the private part.</p> <p>If an <code>event</code> is passed in, this method will return immediately, and the event will be triggered once authentication succeeds or fails. On success, <a href="paramiko.Transport-class.html#is_authenticated" class="link">is_authenticated</a> will return <code>True</code>. On failure, you may use <a href="paramiko.Transport-class.html#get_exception" class="link">get_exception</a> to get more detailed error information.</p> <p>Since 1.1, if no event is passed, this method will block until the authentication succeeds or fails. On failure, an exception is raised. Otherwise, the method simply returns.</p> <p>If the server requires multi-step authentication (which is very rare), this method will return a list of auth types permissible for the next step. Otherwise, in the normal case, an empty list is returned.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>username</code></strong> (string) - the username to authenticate as</li> <li><strong class="pname"><code>key</code></strong> (<a href="paramiko.PKey-class.html" class="link">PKey</a>) - the private key to authenticate with</li> <li><strong class="pname"><code>event</code></strong> (threading.Event) - an event to trigger when the authentication attempt is complete (whether it was successful or not)</li> </ul></dd> <dt>Returns: list</dt> <dd>list of auth types permissible for the next stage of authentication (normally empty)</dd> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'><a href="paramiko.BadAuthenticationType-class.html">BadAuthenticationType</a></strong></code> - if public-key authentication isn't allowed by the server for this user (and no event was passed in)</li> <li><code><strong class='fraise'><a href="paramiko.AuthenticationException-class.html">AuthenticationException</a></strong></code> - if the authentication failed (and no event was passed in)</li> <li><code><strong class='fraise'><a href="paramiko.SSHException-class.html">SSHException</a></strong></code> - if there was a network error</li> </ul></dd> </dl> </td></tr></table> </div> <a name="cancel_port_forward"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">cancel_port_forward</span>(<span class="sig-arg">self</span>, <span class="sig-arg">address</span>, <span class="sig-arg">port</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Ask the server to cancel a previous port-forwarding request. No more connections to the given address & port will be forwarded across this ssh connection.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>address</code></strong> (str) - the address to stop forwarding</li> <li><strong class="pname"><code>port</code></strong> (int) - the port to stop forwarding</li> </ul></dd> </dl> </td></tr></table> </div> <a name="connect"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">connect</span>(<span class="sig-arg">self</span>, <span class="sig-arg">hostkey</span>=<span class="sig-default">None</span>, <span class="sig-arg">username</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>, <span class="sig-arg">password</span>=<span class="sig-default">None</span>, <span class="sig-arg">pkey</span>=<span class="sig-default">None</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>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 <a href="paramiko.Transport-class.html#start_client" class="link">start_client</a>, <a href="paramiko.Transport-class.html#get_remote_server_key" class="link">get_remote_server_key</a>, and <a href="paramiko.Transport-class.html#auth_password" class="link">Transport.auth_password</a> or <a href="paramiko.Transport-class.html#auth_publickey" class="link">Transport.auth_publickey</a>. Use those methods if you want more control.</p> <p>You can use this method immediately after creating a Transport to negotiate encryption with a server. If it fails, an exception will be thrown. On success, the method will return cleanly, and an encrypted session exists. You may immediately call <a href="paramiko.Transport-class.html#open_channel" class="link">open_channel</a> or <a href="paramiko.Transport-class.html#open_session" class="link">open_session</a> to get a <a href="paramiko.Channel-class.html" class="link">Channel</a> object, which is used for data transfer.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>hostkey</code></strong> (<a href="paramiko.PKey-class.html" class="link">PKey</a>) - the host key expected from the server, or <code>None</code> if you don't want to do host key verification.</li> <li><strong class="pname"><code>username</code></strong> (str) - the username to authenticate as.</li> <li><strong class="pname"><code>password</code></strong> (str) - a password to use for authentication, if you want to use password authentication; otherwise <code>None</code>.</li> <li><strong class="pname"><code>pkey</code></strong> (<a href="paramiko.PKey-class.html" class="link">PKey</a>) - a private key to use for authentication, if you want to use private key authentication; otherwise <code>None</code>.</li> </ul></dd> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'><a href="paramiko.SSHException-class.html">SSHException</a></strong></code> - if the SSH2 negotiation fails, the host key supplied by the server is incorrect, or authentication fails.</li> </ul></dd> </dl> <div class="fields"> <p><strong>Note:</strong> If you fail to supply a password or private key, this method may succeed, but a subsequent <a href="paramiko.Transport-class.html#open_channel" class="link">open_channel</a> or <a href="paramiko.Transport-class.html#open_session" class="link">open_session</a> call may fail because you haven't authenticated yet. </p> </div></td></tr></table> </div> <a name="get_exception"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">get_exception</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Return any exception that happened during the last server request. This can be used to fetch more specific error information after using calls like <a href="paramiko.Transport-class.html#start_client" class="link">start_client</a>. The exception (if any) is cleared after this call.</p> <dl class="fields"> <dt>Returns: Exception</dt> <dd>an exception, or <code>None</code> if there is no stored exception.</dd> </dl> <div class="fields"> <p><strong>Since:</strong> 1.1 </p> </div></td></tr></table> </div> <a name="get_hexdump"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">get_hexdump</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Return <code>True</code> if the transport is currently logging hex dumps of protocol traffic.</p> <dl class="fields"> <dt>Returns: bool</dt> <dd><code>True</code> if hex dumps are being logged</dd> </dl> <div class="fields"> <p><strong>Since:</strong> 1.4 </p> </div></td></tr></table> </div> <a name="get_log_channel"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">get_log_channel</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Return the channel name used for this transport's logging.</p> <dl class="fields"> <dt>Returns: str</dt> <dd>channel name.</dd> </dl> <div class="fields"> <p><strong>Since:</strong> 1.2 </p> </div></td></tr></table> </div> <a name="get_remote_server_key"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">get_remote_server_key</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Return the host key of the server (in client mode).</p> <dl class="fields"> <dt>Returns: <a href="paramiko.PKey-class.html" class="link">PKey</a></dt> <dd>public key of the remote server</dd> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'><a href="paramiko.SSHException-class.html">SSHException</a></strong></code> - if no session is currently active.</li> </ul></dd> </dl> <div class="fields"> <p><strong>Note:</strong> Previously this call returned a tuple of (key type, key string). You can get the same effect by calling <a href="paramiko.PKey-class.html#get_name" class="link">PKey.get_name</a> for the key type, and <code>str(key)</code> for the key string. </p> </div></td></tr></table> </div> <a name="get_security_options"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">get_security_options</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Return a <a href="paramiko.SecurityOptions-class.html" class="link">SecurityOptions</a> object which can be used to tweak the encryption algorithms this transport will permit, and the order of preference for them.</p> <dl class="fields"> <dt>Returns: <a href="paramiko.SecurityOptions-class.html" class="link">SecurityOptions</a></dt> <dd>an object that can be used to change the preferred algorithms for encryption, digest (hash), public key, and key exchange.</dd> </dl> </td></tr></table> </div> <a name="get_server_key"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">get_server_key</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>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 with <a href="paramiko.Transport-class.html#add_server_key" class="link">add_server_key</a>, 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, <code>None</code> is returned. In client mode, the behavior is undefined.</p> <dl class="fields"> <dt>Returns: <a href="paramiko.PKey-class.html" class="link">PKey</a></dt> <dd>host key of the type negotiated by the client, or <code>None</code>.</dd> </dl> </td></tr></table> </div> <a name="get_username"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">get_username</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Return the username this connection is authenticated for. If the session is not authenticated (or authentication failed), this method returns <code>None</code>.</p> <dl class="fields"> <dt>Returns: string</dt> <dd>username that was authenticated, or <code>None</code>.</dd> </dl> </td></tr></table> </div> <a name="getpeername"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">getpeername</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Return the address of the remote side of this Transport, if possible. This is effectively a wrapper around <code>'getpeername'</code> on the underlying socket. If the socket-like object has no <code>'getpeername'</code> method, then <code>("unknown", 0)</code> is returned.</p> <dl class="fields"> <dt>Returns: tuple(str, int)</dt> <dd>the address if the remote host, if known</dd> </dl> </td></tr></table> </div> <a name="global_request"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">global_request</span>(<span class="sig-arg">self</span>, <span class="sig-arg">kind</span>, <span class="sig-arg">data</span>=<span class="sig-default">None</span>, <span class="sig-arg">wait</span>=<span class="sig-default">True</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Make a global request to the remote host. These are normally extensions to the SSH2 protocol.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>kind</code></strong> (str) - name of the request.</li> <li><strong class="pname"><code>data</code></strong> (tuple) - an optional tuple containing additional data to attach to the request.</li> <li><strong class="pname"><code>wait</code></strong> (bool) - <code>True</code> if this method should not return until a response is received; <code>False</code> otherwise.</li> </ul></dd> <dt>Returns: <a href="paramiko.Message-class.html" class="link">Message</a></dt> <dd>a <a href="paramiko.Message-class.html" class="link">Message</a> containing possible additional data if the request was successful (or an empty <a href="paramiko.Message-class.html" class="link">Message</a> if <code>wait</code> was <code>False</code>); <code>None</code> if the request was denied.</dd> </dl> </td></tr></table> </div> <a name="is_active"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">is_active</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Return true if this session is active (open).</p> <dl class="fields"> <dt>Returns: bool</dt> <dd>True if the session is still active (open); False if the session is closed</dd> </dl> </td></tr></table> </div> <a name="is_authenticated"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">is_authenticated</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Return true if this session is active and authenticated.</p> <dl class="fields"> <dt>Returns: bool</dt> <dd>True if the session is still open and has been authenticated successfully; False if authentication failed and/or the session is closed.</dd> </dl> </td></tr></table> </div> <a name="load_server_moduli"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">load_server_moduli</span>(<span class="sig-arg">filename</span>=<span class="sig-default">None</span>)</span> <br /><em class="fname">Static Method</em> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko-pysrc.html#Transport.load_server_moduli">source code</a></span> </td> </tr></table> <p><i>(optional)</i> 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.</p> <p>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 <code>/etc/ssh/moduli</code>). If you call <code>load_server_moduli</code> and it returns <code>True</code>, 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.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>filename</code></strong> (str) - optional path to the moduli file, if you happen to know that it's not in a standard location.</li> </ul></dd> <dt>Returns: bool</dt> <dd>True if a moduli file was successfully loaded; False otherwise.</dd> </dl> <div class="fields"> <p><strong>Note:</strong> This has no effect when used in client mode. </p> </div></td></tr></table> </div> <a name="open_channel"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">open_channel</span>(<span class="sig-arg">self</span>, <span class="sig-arg">kind</span>, <span class="sig-arg">dest_addr</span>=<span class="sig-default">None</span>, <span class="sig-arg">src_addr</span>=<span class="sig-default">None</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Request a new channel to the server. <a href="paramiko.Channel-class.html" class="link">Channel</a>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 <a href="paramiko.Transport-class.html#connect" class="link">connect</a> or <a href="paramiko.Transport-class.html#start_client" class="link">start_client</a>) and authenticating.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>kind</code></strong> (str) - the kind of channel requested (usually <code>"session"</code>, <code>"forwarded-tcpip"</code>, <code>"direct-tcpip"</code>, or <code>"x11"</code>)</li> <li><strong class="pname"><code>dest_addr</code></strong> ((str, int)) - the destination address of this port forwarding, if <code>kind</code> is <code>"forwarded-tcpip"</code> or <code>"direct-tcpip"</code> (ignored for other channel types)</li> <li><strong class="pname"><code>src_addr</code></strong> ((str, int)) - the source address of this port forwarding, if <code>kind</code> is <code>"forwarded-tcpip"</code>, <code>"direct-tcpip"</code>, or <code>"x11"</code></li> </ul></dd> <dt>Returns: <a href="paramiko.Channel-class.html" class="link">Channel</a></dt> <dd>a new <a href="paramiko.Channel-class.html" class="link">Channel</a> on success</dd> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'><a href="paramiko.SSHException-class.html">SSHException</a></strong></code> - if the request is rejected or the session ends prematurely</li> </ul></dd> </dl> </td></tr></table> </div> <a name="open_forwarded_tcpip_channel"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">open_forwarded_tcpip_channel</span>(<span class="sig-arg">self</span>, <span class="sig-arg">(src_addr, src_port)</span>, <span class="sig-arg">(dest_addr, dest_port)</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Request a new channel back to the client, of type <code>"forwarded-tcpip"</code>. This is used after a client has requested port forwarding, for sending incoming connections back to the client.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>src_addr</code></strong> - originator's address</li> <li><strong class="pname"><code>src_port</code></strong> - originator's port</li> <li><strong class="pname"><code>dest_addr</code></strong> - local (server) connected address</li> <li><strong class="pname"><code>dest_port</code></strong> - local (server) connected port</li> </ul></dd> </dl> </td></tr></table> </div> <a name="open_session"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">open_session</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Request a new channel to the server, of type <code>"session"</code>. This is just an alias for <code>open_channel('session')</code>.</p> <dl class="fields"> <dt>Returns: <a href="paramiko.Channel-class.html" class="link">Channel</a></dt> <dd>a new <a href="paramiko.Channel-class.html" class="link">Channel</a></dd> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'><a href="paramiko.SSHException-class.html">SSHException</a></strong></code> - if the request is rejected or the session ends prematurely</li> </ul></dd> </dl> </td></tr></table> </div> <a name="open_sftp_client"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">open_sftp_client</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Create an SFTP client channel from an open transport. On success, an SFTP session will be opened with the remote host, and a new SFTPClient object will be returned.</p> <dl class="fields"> <dt>Returns: <a href="paramiko.SFTPClient-class.html" class="link">SFTPClient</a></dt> <dd>a new <a href="paramiko.SFTPClient-class.html" class="link">SFTPClient</a> object, referring to an sftp session (channel) across this transport</dd> </dl> </td></tr></table> </div> <a name="open_x11_channel"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">open_x11_channel</span>(<span class="sig-arg">self</span>, <span class="sig-arg">src_addr</span>=<span class="sig-default">None</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Request a new channel to the client, of type <code>"x11"</code>. This is just an alias for <code>open_channel('x11', src_addr=src_addr)</code>.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>src_addr</code></strong> ((str, int)) - the source address of the x11 server (port is the x11 port, ie. 6010)</li> </ul></dd> <dt>Returns: <a href="paramiko.Channel-class.html" class="link">Channel</a></dt> <dd>a new <a href="paramiko.Channel-class.html" class="link">Channel</a></dd> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'><a href="paramiko.SSHException-class.html">SSHException</a></strong></code> - if the request is rejected or the session ends prematurely</li> </ul></dd> </dl> </td></tr></table> </div> <a name="renegotiate_keys"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">renegotiate_keys</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>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.</p> <dl class="fields"> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'><a href="paramiko.SSHException-class.html">SSHException</a></strong></code> - if the key renegotiation failed (which causes the session to end)</li> </ul></dd> </dl> </td></tr></table> </div> <a name="request_port_forward"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">request_port_forward</span>(<span class="sig-arg">self</span>, <span class="sig-arg">address</span>, <span class="sig-arg">port</span>, <span class="sig-arg">handler</span>=<span class="sig-default">None</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Ask the server to forward TCP connections from a listening port on the server, across this SSH session.</p> <p>If a handler is given, that handler is called from a different thread whenever a forwarded connection arrives. The handler parameters are:</p> <pre class="literalblock"> handler(channel, (origin_addr, origin_port), (server_addr, server_port)) </pre> <p>where <code>server_addr</code> and <code>server_port</code> are the address and port that the server was listening on.</p> <p>If no handler is set, the default behavior is to send new incoming forwarded connections into the accept queue, to be picked up via <a href="paramiko.Transport-class.html#accept" class="link">accept</a>.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>address</code></strong> (str) - the address to bind when forwarding</li> <li><strong class="pname"><code>port</code></strong> (int) - the port to forward, or 0 to ask the server to allocate any port</li> <li><strong class="pname"><code>handler</code></strong> (function(Channel, (str, int), (str, int))) - optional handler for incoming forwarded connections</li> </ul></dd> <dt>Returns: int</dt> <dd>the port # allocated by the server</dd> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'><a href="paramiko.SSHException-class.html">SSHException</a></strong></code> - if the server refused the TCP forward request</li> </ul></dd> </dl> </td></tr></table> </div> <a name="run"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">run</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <dl class="fields"> <dt>Overrides: threading.Thread.run </dt> </dl> </td></tr></table> </div> <a name="send_ignore"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">send_ignore</span>(<span class="sig-arg">self</span>, <span class="sig-arg">bytes</span>=<span class="sig-default">None</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>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.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>bytes</code></strong> (int) - the number of random bytes to send in the payload of the ignored packet -- defaults to a random number from 10 to 41.</li> </ul></dd> </dl> </td></tr></table> </div> <a name="set_hexdump"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">set_hexdump</span>(<span class="sig-arg">self</span>, <span class="sig-arg">hexdump</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Turn on/off logging a hex dump of protocol traffic at DEBUG level in the logs. Normally you would want this off (which is the default), but if you are debugging something, it may be useful.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>hexdump</code></strong> (bool) - <code>True</code> to log protocol traffix (in hex) to the log; <code>False</code> otherwise.</li> </ul></dd> </dl> </td></tr></table> </div> <a name="set_keepalive"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">set_keepalive</span>(<span class="sig-arg">self</span>, <span class="sig-arg">interval</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Turn on/off keepalive packets (default is off). If this is set, after <code>interval</code> 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.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>interval</code></strong> (int) - seconds to wait before sending a keepalive packet (or 0 to disable keepalives).</li> </ul></dd> </dl> </td></tr></table> </div> <a name="set_log_channel"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">set_log_channel</span>(<span class="sig-arg">self</span>, <span class="sig-arg">name</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Set the channel for this transport's logging. The default is <code>"paramiko.transport"</code> but it can be set to anything you want. (See the <code>logging</code> module for more info.) SSH Channels will log to a sub-channel of the one specified.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>name</code></strong> (str) - new channel name for logging</li> </ul></dd> </dl> <div class="fields"> <p><strong>Since:</strong> 1.1 </p> </div></td></tr></table> </div> <a name="set_subsystem_handler"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">set_subsystem_handler</span>(<span class="sig-arg">self</span>, <span class="sig-arg">name</span>, <span class="sig-arg">handler</span>, <span class="sig-arg">*larg</span>, <span class="sig-arg">**kwarg</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Set the handler class for a subsystem in server mode. If a request for this subsystem is made on an open ssh channel later, this handler will be constructed and called -- see <a href="paramiko.SubsystemHandler-class.html" class="link">SubsystemHandler</a> for more detailed documentation.</p> <p>Any extra parameters (including keyword arguments) are saved and passed to the <a href="paramiko.SubsystemHandler-class.html" class="link">SubsystemHandler</a> constructor later.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>name</code></strong> (str) - name of the subsystem.</li> <li><strong class="pname"><code>handler</code></strong> (class) - subclass of <a href="paramiko.SubsystemHandler-class.html" class="link">SubsystemHandler</a> that handles this subsystem.</li> </ul></dd> </dl> </td></tr></table> </div> <a name="start_client"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">start_client</span>(<span class="sig-arg">self</span>, <span class="sig-arg">event</span>=<span class="sig-default">None</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Negotiate a new SSH2 session as a client. This is the first step after creating a new <a href="paramiko.Transport-class.html" class="link">Transport</a>. A separate thread is created for protocol negotiation.</p> <p>If an event is passed in, this method returns immediately. When negotiation is done (successful or not), the given <code>Event</code> will be triggered. On failure, <a href="paramiko.Transport-class.html#is_active" class="link">is_active</a> will return <code>False</code>.</p> <p>(Since 1.4) If <code>event</code> is <code>None</code>, this method will not return until negotation is done. On success, the method returns normally. Otherwise an SSHException is raised.</p> <p>After a successful negotiation, you will usually want to authenticate, calling <a href="paramiko.Transport-class.html#auth_password" class="link">auth_password</a> or <a href="paramiko.Transport-class.html#auth_publickey" class="link">auth_publickey</a>.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>event</code></strong> (threading.Event) - an event to trigger when negotiation is complete (optional)</li> </ul></dd> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'><a href="paramiko.SSHException-class.html">SSHException</a></strong></code> - if negotiation fails (and no <code>event</code> was passed in)</li> </ul></dd> </dl> <div class="fields"> <strong>Notes:</strong> <ul class="nomargin-top"> <li> <a href="paramiko.Transport-class.html#connect" class="link">connect</a> is a simpler method for connecting as a client. </li> <li> After calling this method (or <a href="paramiko.Transport-class.html#start_server" class="link">start_server</a> or <a href="paramiko.Transport-class.html#connect" class="link">connect</a>), you should no longer directly read from or write to the original socket object. </li> </ul> </div></td></tr></table> </div> <a name="start_server"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">start_server</span>(<span class="sig-arg">self</span>, <span class="sig-arg">event</span>=<span class="sig-default">None</span>, <span class="sig-arg">server</span>=<span class="sig-default">None</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Negotiate a new SSH2 session as a server. This is the first step after creating a new <a href="paramiko.Transport-class.html" class="link">Transport</a> and setting up your server host key(s). A separate thread is created for protocol negotiation.</p> <p>If an event is passed in, this method returns immediately. When negotiation is done (successful or not), the given <code>Event</code> will be triggered. On failure, <a href="paramiko.Transport-class.html#is_active" class="link">is_active</a> will return <code>False</code>.</p> <p>(Since 1.4) If <code>event</code> is <code>None</code>, this method will not return until negotation is done. On success, the method returns normally. Otherwise an SSHException is raised.</p> <p>After a successful negotiation, the client will need to authenticate. Override the methods <a href="paramiko.ServerInterface-class.html#get_allowed_auths" class="link">get_allowed_auths</a>, <a href="paramiko.ServerInterface-class.html#check_auth_none" class="link">check_auth_none</a>, <a href="paramiko.ServerInterface-class.html#check_auth_password" class="link">check_auth_password</a>, and <a href="paramiko.ServerInterface-class.html#check_auth_publickey" class="link">check_auth_publickey</a> in the given <code>server</code> object to control the authentication process.</p> <p>After a successful authentication, the client should request to open a channel. Override <a href="paramiko.ServerInterface-class.html#check_channel_request" class="link">check_channel_request</a> in the given <code>server</code> object to allow channels to be opened.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>event</code></strong> (threading.Event) - an event to trigger when negotiation is complete.</li> <li><strong class="pname"><code>server</code></strong> (<a href="paramiko.ServerInterface-class.html" class="link">server.ServerInterface</a>) - an object used to perform authentication and create <a href="paramiko.Channel-class.html" class="link">Channel</a>s.</li> </ul></dd> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'><a href="paramiko.SSHException-class.html">SSHException</a></strong></code> - if negotiation fails (and no <code>event</code> was passed in)</li> </ul></dd> </dl> <div class="fields"> <p><strong>Note:</strong> After calling this method (or <a href="paramiko.Transport-class.html#start_client" class="link">start_client</a> or <a href="paramiko.Transport-class.html#connect" class="link">connect</a>), you should no longer directly read from or write to the original socket object. </p> </div></td></tr></table> </div> <a name="use_compression"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">use_compression</span>(<span class="sig-arg">self</span>, <span class="sig-arg">compress</span>=<span class="sig-default">True</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.transport-pysrc.html">source code</a></span> </td> </tr></table> <p>Turn on/off compression. This will only have an affect before starting the transport (ie before calling <a href="paramiko.Transport-class.html#connect" class="link">connect</a>, etc). By default, compression is off since it negatively affects interactive sessions.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>compress</code></strong> (bool) - <code>True</code> to ask the remote client/server to compress traffic; <code>False</code> to refuse compression</li> </ul></dd> </dl> <div class="fields"> <p><strong>Since:</strong> 1.5.2 </p> </div></td></tr></table> </div> <br /> <!-- ==================== NAVIGATION BAR ==================== --> <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> <tr valign="middle"> <!-- Home link --> <th> <a href="paramiko-module.html">Home</a> </th> <!-- Tree link --> <th> <a href="module-tree.html">Trees</a> </th> <!-- Index link --> <th> <a href="identifier-index.html">Indices</a> </th> <!-- Help link --> <th> <a href="help.html">Help</a> </th> <th class="navbar" width="100%"></th> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" width="100%%"> <tr> <td align="left" class="footer"> Generated by Epydoc 3.0.1 on Mon May 23 13:50:03 2011 </td> <td align="right" class="footer"> <a target="mainFrame" href="http://epydoc.sourceforge.net" >http://epydoc.sourceforge.net</a> </td> </tr> </table> <script type="text/javascript"> <!-- // Private objects are initially displayed (because if // javascript is turned off then we want them to be // visible); but by default, we want to hide them. So hide // them unless we have a cookie that says to show them. checkCookie(); // --> </script> </body> </html>