diff options
author | Jeremy T. Bouse <jbouse@debian.org> | 2009-11-27 16:20:09 -0500 |
---|---|---|
committer | Jeremy T. Bouse <jbouse@debian.org> | 2009-11-27 16:20:09 -0500 |
commit | 176c6caf4ea7918e1698438634b237fab8456471 (patch) | |
tree | 6e2a8e5be1af2a6ec324fdbf99589aa099f1ec2a /docs/public/paramiko.util-module.html | |
download | python-paramiko-176c6caf4ea7918e1698438634b237fab8456471.tar python-paramiko-176c6caf4ea7918e1698438634b237fab8456471.tar.gz |
Imported Upstream version 1.5.2upstream/1.5.2
Diffstat (limited to 'docs/public/paramiko.util-module.html')
-rw-r--r-- | docs/public/paramiko.util-module.html | 369 |
1 files changed, 369 insertions, 0 deletions
diff --git a/docs/public/paramiko.util-module.html b/docs/public/paramiko.util-module.html new file mode 100644 index 0000000..a7ad4cd --- /dev/null +++ b/docs/public/paramiko.util-module.html @@ -0,0 +1,369 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!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.util</title> + <link rel="stylesheet" href="epydoc.css" type="text/css"></link> +</head> +<body bgcolor="white" text="black" link="blue" vlink="#204080" + alink="#204080"> + +<!-- =========== START OF NAVBAR =========== --> +<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> + <tr valign="center"> + <th class="navbar"> <a class="navbar" href="paramiko-module.html">Home</a> </th> + <th class="navbar"> <a class="navbar" href="trees.html">Trees</a> </th> + <th class="navbar"> <a class="navbar" href="indices.html">Index</a> </th> + <th class="navbar"> <a class="navbar" 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%"> + <font size="-1"><b class="breadcrumbs"> + <a href="paramiko-module.html">Package paramiko</a> :: + Module util + </b></font></br> + </td> + <td><table cellpadding="0" cellspacing="0"> + <tr><td align="right"><font size="-2">[<a href="../private/paramiko.util-module.html">show private</a> | hide private]</font></td></tr> + <tr><td align="right"><font size="-2">[<a href="frames.html"target="_top">frames</a> | <a href="paramiko.util-module.html" target="_top">no frames</a>]</font></td></tr> + </table></td> +</tr></table> + +<!-- =========== START OF MODULE DESCRIPTION =========== --> +<h2 class="module">Module paramiko.util</h2> + +Useful functions used by the rest of paramiko. +<hr/> + +<!-- =========== START OF CLASSES =========== --> +<table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> +<tr bgcolor="#70b0f0" class="summary"> + <th colspan="2">Classes</th></tr> +<tr><td width="15%"> + <b><a href="paramiko.util.PFilter-class.html"><code>PFilter</code></a></b></td> + <td> </td></tr> +</table><br /> + + +<!-- =========== START OF FUNCTION SUMMARY =========== --> +<table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> +<tr bgcolor="#70b0f0" class="summary"> + <th colspan="2">Function Summary</th></tr> +<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td> + <td><code><a name="bit_length"></a><span class="summary-sig"><span class="summary-sig-name">bit_length</span>(<span class=summary-sig-arg>n</span>)</span></code> +</td></tr> +<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td> + <td><code><span class="summary-sig"><a href="paramiko.util-module.html#deflate_long" class="summary-sig-name"><code>deflate_long</code></a>(<span class=summary-sig-arg>n</span>, + <span class=summary-sig-arg>add_sign_padding</span>)</span></code> +<br /> +turns a long-int into a normalized byte string (adapted from +Crypto.Util.number)</td></tr> +<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td> + <td><code><a name="format_binary"></a><span class="summary-sig"><span class="summary-sig-name">format_binary</span>(<span class=summary-sig-arg>data</span>, + <span class=summary-sig-arg>prefix</span>)</span></code> +</td></tr> +<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td> + <td><code><a name="format_binary_line"></a><span class="summary-sig"><span class="summary-sig-name">format_binary_line</span>(<span class=summary-sig-arg>data</span>)</span></code> +</td></tr> +<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td> + <td><code><a name="format_binary_weird"></a><span class="summary-sig"><span class="summary-sig-name">format_binary_weird</span>(<span class=summary-sig-arg>data</span>)</span></code> +</td></tr> +<tr><td align="right" valign="top" width="15%"><font size="-1"> string +</font></td> + <td><code><span class="summary-sig"><a href="paramiko.util-module.html#generate_key_bytes" class="summary-sig-name"><code>generate_key_bytes</code></a>(<span class=summary-sig-arg>hashclass</span>, + <span class=summary-sig-arg>salt</span>, + <span class=summary-sig-arg>key</span>, + <span class=summary-sig-arg>nbytes</span>)</span></code> +<br /> +Given a password, passphrase, or other human-source key, scramble it +through a secure hash into some keyworthy bytes.</td></tr> +<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td> + <td><code><a name="get_logger"></a><span class="summary-sig"><span class="summary-sig-name">get_logger</span>(<span class=summary-sig-arg>name</span>)</span></code> +</td></tr> +<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td> + <td><code><a name="get_thread_id"></a><span class="summary-sig"><span class="summary-sig-name">get_thread_id</span>()</span></code> +</td></tr> +<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td> + <td><code><span class="summary-sig"><a href="paramiko.util-module.html#hexify" class="summary-sig-name"><code>hexify</code></a>(<span class=summary-sig-arg>s</span>)</span></code> +<br /> +turn a string into a hex sequence</td></tr> +<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td> + <td><code><span class="summary-sig"><a href="paramiko.util-module.html#inflate_long" class="summary-sig-name"><code>inflate_long</code></a>(<span class=summary-sig-arg>s</span>, + <span class=summary-sig-arg>always_positive</span>)</span></code> +<br /> +turns a normalized byte string into a long-int (adapted from +Crypto.Util.number)</td></tr> +<tr><td align="right" valign="top" width="15%"><font size="-1"> dict(hostname, dict(keytype, <a + href="../private/paramiko.PKey-class.html" + class="link"><code>PKey</code></a>)) +</font></td> + <td><code><span class="summary-sig"><a href="paramiko.util-module.html#load_host_keys" class="summary-sig-name"><code>load_host_keys</code></a>(<span class=summary-sig-arg>filename</span>)</span></code> +<br /> +Read a file of known SSH host keys, in the format used by openssh, and +return a compound dict of <code>hostname -> keytype -></code> <a +href="../private/paramiko.PKey-class.html" +class="link"><code>PKey</code></a>.</td></tr> +<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td> + <td><code><span class="summary-sig"><a href="paramiko.util-module.html#log_to_file" class="summary-sig-name"><code>log_to_file</code></a>(<span class=summary-sig-arg>filename</span>, + <span class=summary-sig-arg>level</span>)</span></code> +<br /> +send paramiko logs to a logfile, if they're not already going +somewhere</td></tr> +<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td> + <td><code><span class="summary-sig"><a href="paramiko.util-module.html#lookup_ssh_host_config" class="summary-sig-name"><code>lookup_ssh_host_config</code></a>(<span class=summary-sig-arg>hostname</span>, + <span class=summary-sig-arg>config</span>)</span></code> +<br /> +Return a dict of config options for a given hostname.</td></tr> +<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td> + <td><code><a name="mod_inverse"></a><span class="summary-sig"><span class="summary-sig-name">mod_inverse</span>(<span class=summary-sig-arg>x</span>, + <span class=summary-sig-arg>m</span>)</span></code> +</td></tr> +<tr><td align="right" valign="top" width="15%"><font size="-1"> object +</font></td> + <td><code><span class="summary-sig"><a href="paramiko.util-module.html#parse_ssh_config" class="summary-sig-name"><code>parse_ssh_config</code></a>(<span class=summary-sig-arg>file_obj</span>)</span></code> +<br /> +Parse a config file of the format used by OpenSSH, and return an +object that can be used to make queries to <a +href="paramiko.util-module.html#lookup_ssh_host_config" +class="link"><code>lookup_ssh_host_config</code></a>.</td></tr> +<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td> + <td><code><a name="safe_string"></a><span class="summary-sig"><span class="summary-sig-name">safe_string</span>(<span class=summary-sig-arg>s</span>)</span></code> +</td></tr> +<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td> + <td><code><a name="tb_strings"></a><span class="summary-sig"><span class="summary-sig-name">tb_strings</span>()</span></code> +</td></tr> +<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td> + <td><code><span class="summary-sig"><a href="paramiko.util-module.html#unhexify" class="summary-sig-name"><code>unhexify</code></a>(<span class=summary-sig-arg>s</span>)</span></code> +<br /> +turn a hex sequence back into a string</td></tr> +</table><br /> + + +<!-- =========== START OF FUNCTION DETAILS =========== --> +<table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> +<tr bgcolor="#70b0f0" class="details"> + <th colspan="2">Function Details</th></tr> +</table> + +<a name="deflate_long"></a> +<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td> + <h3><span class="sig"><span class="sig-name">deflate_long</span>(<span class=sig-arg>n</span>, + <span class=sig-arg>add_sign_padding</span>=<span class=sig-default>True</span>)</span> + </h3> + turns a long-int into a normalized byte string (adapted from + Crypto.Util.number) + <dl><dt></dt><dd> + </dd></dl> +</td></tr></table> + +<a name="generate_key_bytes"></a> +<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td> + <h3><span class="sig"><span class="sig-name">generate_key_bytes</span>(<span class=sig-arg>hashclass</span>, + <span class=sig-arg>salt</span>, + <span class=sig-arg>key</span>, + <span class=sig-arg>nbytes</span>)</span> + </h3> + Given a password, passphrase, or other human-source key, scramble it + through a secure hash into some keyworthy bytes. This specific + algorithm is used for encrypting/decrypting private key files. + <dl><dt></dt><dd> + <dl><dt><b>Parameters:</b></dt> + <dd><code><b>hashclass</b></code> - + class from <code>Crypto.Hash</code> that can be used as a + secure hashing function (like <code>MD5</code> or + <code>SHA</code>). + <br /><i> + (type=<code>Crypto.Hash</code>)</i> + <dd><code><b>salt</b></code> - + data to salt the hash with. + <br /><i> + (type=string)</i> + <dd><code><b>key</b></code> - + human-entered password or passphrase. + <br /><i> + (type=string)</i> + <dd><code><b>nbytes</b></code> - + number of bytes to generate. + <br /><i> + (type=int)</i> + </dd> + </dl> + <dl><dt><b>Returns:</b></dt> + <dd> + key data + <br /><i> + (type=string)</i> + </dd> + </dl> + </dd></dl> +</td></tr></table> + +<a name="hexify"></a> +<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td> + <h3><span class="sig"><span class="sig-name">hexify</span>(<span class=sig-arg>s</span>)</span> + </h3> + turn a string into a hex sequence + <dl><dt></dt><dd> + </dd></dl> +</td></tr></table> + +<a name="inflate_long"></a> +<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td> + <h3><span class="sig"><span class="sig-name">inflate_long</span>(<span class=sig-arg>s</span>, + <span class=sig-arg>always_positive</span>=<span class=sig-default>False</span>)</span> + </h3> + turns a normalized byte string into a long-int (adapted from + Crypto.Util.number) + <dl><dt></dt><dd> + </dd></dl> +</td></tr></table> + +<a name="load_host_keys"></a> +<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td> + <h3><span class="sig"><span class="sig-name">load_host_keys</span>(<span class=sig-arg>filename</span>)</span> + </h3> + <p>Read a file of known SSH host keys, in the format used by openssh, + and return a compound dict of <code>hostname -> keytype -></code> + <a href="../private/paramiko.PKey-class.html" + class="link"><code>PKey</code></a>. The hostname may be an IP address + or DNS name. The keytype will be either + <code>"ssh-rsa"</code> or + <code>"ssh-dss"</code>.</p> + This type of file unfortunately doesn't exist on Windows, but on + posix, it will usually be stored in + <code>os.path.expanduser("~/.ssh/known_hosts")</code>. + <dl><dt></dt><dd> + <dl><dt><b>Parameters:</b></dt> + <dd><code><b>filename</b></code> - + name of the file to read host keys from + <br /><i> + (type=str)</i> + </dd> + </dl> + <dl><dt><b>Returns:</b></dt> + <dd> + dict of host keys, indexed by hostname and then keytype + <br /><i> + (type=dict(hostname, dict(keytype, <a + href="../private/paramiko.PKey-class.html" + class="link"><code>PKey</code></a>)))</i> + </dd> + </dl> + </dd></dl> +</td></tr></table> + +<a name="log_to_file"></a> +<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td> + <h3><span class="sig"><span class="sig-name">log_to_file</span>(<span class=sig-arg>filename</span>, + <span class=sig-arg>level</span>=<span class=sig-default>10</span>)</span> + </h3> + send paramiko logs to a logfile, if they're not already going + somewhere + <dl><dt></dt><dd> + </dd></dl> +</td></tr></table> + +<a name="lookup_ssh_host_config"></a> +<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td> + <h3><span class="sig"><span class="sig-name">lookup_ssh_host_config</span>(<span class=sig-arg>hostname</span>, + <span class=sig-arg>config</span>)</span> + </h3> + <p>Return a dict of config options for a given hostname. The + <code>config</code> object must come from <a + href="paramiko.util-module.html#parse_ssh_config" + class="link"><code>parse_ssh_config</code></a>.</p> + <p>The host-matching rules of OpenSSH's <code>ssh_config</code> man + page are used, which means that all configuration options from matching + host specifications are merged, with more specific hostmasks taking + precedence. In other words, if <code>"Port"</code> is set + under <code>"Host *"</code> and also <code>"Host + *.example.com"</code>, and the lookup is for + <code>"ssh.example.com"</code>, then the port entry for + <code>"Host *.example.com"</code> will win out.</p> + The keys in the returned dict are all normalized to lowercase (look + for <code>"port"</code>, not <code>"Port"</code>. + No other processing is done to the keys or values. + <dl><dt></dt><dd> + <dl><dt><b>Parameters:</b></dt> + <dd><code><b>hostname</b></code> - + the hostname to lookup + <br /><i> + (type=str)</i> + <dd><code><b>config</b></code> - + the config object to search + <br /><i> + (type=object)</i> + </dd> + </dl> + </dd></dl> +</td></tr></table> + +<a name="parse_ssh_config"></a> +<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td> + <h3><span class="sig"><span class="sig-name">parse_ssh_config</span>(<span class=sig-arg>file_obj</span>)</span> + </h3> + <p>Parse a config file of the format used by OpenSSH, and return an + object that can be used to make queries to <a + href="paramiko.util-module.html#lookup_ssh_host_config" + class="link"><code>lookup_ssh_host_config</code></a>. The format is + described in OpenSSH's <code>ssh_config</code> man page. This method is + provided primarily as a convenience to posix users (since the OpenSSH + format is a de-facto standard on posix) but should work fine on Windows + too.</p> + The return value is currently a list of dictionaries, each + containing host-specific configuration, but this is considered an + implementation detail and may be subject to change in later + versions. + <dl><dt></dt><dd> + <dl><dt><b>Parameters:</b></dt> + <dd><code><b>file_obj</b></code> - + a file-like object to read the config file from + <br /><i> + (type=file)</i> + </dd> + </dl> + <dl><dt><b>Returns:</b></dt> + <dd> + opaque configuration object + <br /><i> + (type=object)</i> + </dd> + </dl> + </dd></dl> +</td></tr></table> + +<a name="unhexify"></a> +<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td> + <h3><span class="sig"><span class="sig-name">unhexify</span>(<span class=sig-arg>s</span>)</span> + </h3> + turn a hex sequence back into a string + <dl><dt></dt><dd> + </dd></dl> +</td></tr></table> +<br /> + + +<!-- =========== START OF NAVBAR =========== --> +<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> + <tr valign="center"> + <th class="navbar"> <a class="navbar" href="paramiko-module.html">Home</a> </th> + <th class="navbar"> <a class="navbar" href="trees.html">Trees</a> </th> + <th class="navbar"> <a class="navbar" href="indices.html">Index</a> </th> + <th class="navbar"> <a class="navbar" 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"><font size="-2">Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005</font></td> + <td align="right"><a href="http://epydoc.sourceforge.net" + ><font size="-2">http://epydoc.sf.net</font></a></td> + </tr> +</table> +</body> +</html> |