From 1a716ed46d1d556d4ba6798608ab498320acd886 Mon Sep 17 00:00:00 2001 From: "Jeremy T. Bouse" Date: Sat, 25 May 2013 00:04:32 -0400 Subject: Imported Upstream version 1.10.1 --- .bzrignore | 7 + .gitignore | 7 + .travis.yml | 14 + ChangeLog.0 | 42 + ChangeLog.1 | 2928 +++++++++++ LICENSE | 4 +- Makefile | 15 + NEWS | 473 ++ NOTES | 13 + PKG-INFO | 24 - README | 40 +- TODO | 3 + demos/demo_keygen.py | 127 + docs/api-objects.txt | 2202 -------- docs/bug-index.html | 107 - docs/class-tree.html | 364 -- docs/crarr.png | Bin 340 -> 0 bytes docs/epydoc.css | 322 -- docs/epydoc.js | 293 -- docs/frames.html | 17 - docs/help.html | 266 - docs/identifier-index.html | 5475 -------------------- docs/index.html | 17 - docs/module-tree.html | 155 - docs/paramiko-module.html | 513 -- docs/paramiko-pysrc.html | 465 -- docs/paramiko.Agent-class.html | 233 - docs/paramiko.AgentKey-class.html | 399 -- docs/paramiko.AuthenticationException-class.html | 185 - docs/paramiko.AutoAddPolicy-class.html | 224 - docs/paramiko.BadAuthenticationType-class.html | 296 -- docs/paramiko.BadHostKeyException-class.html | 268 - docs/paramiko.BufferedFile-class.html | 856 --- docs/paramiko.Channel-class.html | 1998 ------- docs/paramiko.ChannelException-class.html | 250 - docs/paramiko.DSSKey-class.html | 750 --- docs/paramiko.HostKeys-class.html | 643 --- docs/paramiko.Message-class.html | 1101 ---- docs/paramiko.MissingHostKeyPolicy-class.html | 232 - docs/paramiko.PKey-class.html | 857 --- docs/paramiko.PasswordRequiredException-class.html | 176 - docs/paramiko.RSAKey-class.html | 750 --- docs/paramiko.RejectPolicy-class.html | 223 - docs/paramiko.SFTP-class.html | 202 - docs/paramiko.SFTPAttributes-class.html | 418 -- docs/paramiko.SFTPClient-class.html | 1536 ------ docs/paramiko.SFTPError-class.html | 169 - docs/paramiko.SFTPFile-class.html | 1011 ---- docs/paramiko.SFTPHandle-class.html | 476 -- docs/paramiko.SFTPServer-class.html | 477 -- docs/paramiko.SFTPServerInterface-class.html | 979 ---- docs/paramiko.SSHClient-class.html | 845 --- docs/paramiko.SSHConfig-class.html | 309 -- docs/paramiko.SSHException-class.html | 178 - docs/paramiko.SecurityOptions-class.html | 397 -- docs/paramiko.ServerInterface-class.html | 1247 ----- docs/paramiko.SubsystemHandler-class.html | 393 -- docs/paramiko.Transport-class.html | 2352 --------- docs/paramiko.WarningPolicy-class.html | 223 - docs/paramiko.agent-module.html | 148 - docs/paramiko.agent-pysrc.html | 279 - docs/paramiko.auth_handler-module.html | 531 -- docs/paramiko.auth_handler-pysrc.html | 1514 ------ docs/paramiko.ber-module.html | 142 - docs/paramiko.ber-pysrc.html | 238 - docs/paramiko.ber.BER-class.html | 397 -- docs/paramiko.ber.BERException-class.html | 170 - docs/paramiko.buffered_pipe-module.html | 152 - docs/paramiko.buffered_pipe-pysrc.html | 323 -- .../paramiko.buffered_pipe.BufferedPipe-class.html | 516 -- docs/paramiko.buffered_pipe.PipeTimeout-class.html | 187 - docs/paramiko.channel-module.html | 554 -- docs/paramiko.channel-pysrc.html | 2076 -------- docs/paramiko.channel.ChannelStderrFile-class.html | 257 - docs/paramiko.client-module.html | 539 -- docs/paramiko.client-pysrc.html | 801 --- docs/paramiko.common-module.html | 531 -- docs/paramiko.common-pysrc.html | 1905 ------- docs/paramiko.compress-module.html | 143 - docs/paramiko.compress-pysrc.html | 148 - docs/paramiko.compress.ZlibCompressor-class.html | 222 - docs/paramiko.compress.ZlibDecompressor-class.html | 222 - docs/paramiko.config-module.html | 121 - docs/paramiko.config-pysrc.html | 219 - docs/paramiko.dsskey-module.html | 531 -- docs/paramiko.dsskey-pysrc.html | 356 -- docs/paramiko.file-module.html | 120 - docs/paramiko.file-pysrc.html | 579 --- docs/paramiko.hostkeys-module.html | 549 -- docs/paramiko.hostkeys-pysrc.html | 501 -- docs/paramiko.hostkeys.HostKeyEntry-class.html | 255 - docs/paramiko.kex_gex-module.html | 550 -- docs/paramiko.kex_gex-pysrc.html | 463 -- docs/paramiko.kex_gex.KexGex-class.html | 279 - docs/paramiko.kex_group1-module.html | 589 --- docs/paramiko.kex_group1-pysrc.html | 292 -- docs/paramiko.kex_group1.KexGroup1-class.html | 257 - docs/paramiko.logging22-module.html | 210 - docs/paramiko.logging22-pysrc.html | 302 -- docs/paramiko.logging22.Formatter-class.html | 209 - docs/paramiko.logging22.StreamHandler-class.html | 224 - docs/paramiko.logging22.logger-class.html | 274 - docs/paramiko.message-module.html | 120 - docs/paramiko.message-pysrc.html | 423 -- docs/paramiko.packet-module.html | 581 --- docs/paramiko.packet-pysrc.html | 920 ---- docs/paramiko.packet.NeedRekeyException-class.html | 170 - docs/paramiko.pipe-module.html | 231 - docs/paramiko.pipe-pysrc.html | 327 -- docs/paramiko.pipe.OrPipe-class.html | 239 - docs/paramiko.pipe.PosixPipe-class.html | 285 - docs/paramiko.pipe.WindowsPipe-class.html | 288 - docs/paramiko.pkey-module.html | 531 -- docs/paramiko.pkey-pysrc.html | 542 -- docs/paramiko.primes-module.html | 138 - docs/paramiko.primes-pysrc.html | 355 -- docs/paramiko.primes.ModulusPack-class.html | 270 - docs/paramiko.resource-module.html | 127 - docs/paramiko.resource-pysrc.html | 192 - docs/paramiko.rsakey-module.html | 531 -- docs/paramiko.rsakey-pysrc.html | 323 -- docs/paramiko.server-module.html | 533 -- docs/paramiko.server-pysrc.html | 1006 ---- docs/paramiko.sftp-module.html | 905 ---- docs/paramiko.sftp-pysrc.html | 798 --- docs/paramiko.sftp_attr-module.html | 905 ---- docs/paramiko.sftp_attr-pysrc.html | 367 -- docs/paramiko.sftp_client-module.html | 907 ---- docs/paramiko.sftp_client-pysrc.html | 1602 ------ docs/paramiko.sftp_file-module.html | 907 ---- docs/paramiko.sftp_file-pysrc.html | 873 ---- docs/paramiko.sftp_handle-module.html | 907 ---- docs/paramiko.sftp_handle-pysrc.html | 369 -- docs/paramiko.sftp_server-module.html | 907 ---- docs/paramiko.sftp_server-pysrc.html | 1196 ----- docs/paramiko.sftp_si-module.html | 909 ---- docs/paramiko.sftp_si-pysrc.html | 527 -- docs/paramiko.ssh_exception-module.html | 137 - docs/paramiko.ssh_exception-pysrc.html | 403 -- ....ssh_exception.PartialAuthentication-class.html | 246 - docs/paramiko.transport-module.html | 548 -- docs/paramiko.transport-pysrc.html | 4153 --------------- docs/paramiko.transport.ChannelMap-class.html | 289 -- docs/paramiko.util-module.html | 965 ---- docs/paramiko.util-pysrc.html | 434 -- docs/paramiko.util.Counter-class.html | 258 - docs/paramiko.util.PFilter-class.html | 171 - docs/paramiko.util.enumerate-class.html | 145 - docs/paramiko.win_pageant-module.html | 204 - docs/paramiko.win_pageant-pysrc.html | 287 - ...ramiko.win_pageant.PageantConnection-class.html | 260 - docs/redirect.html | 38 - docs/since-index.html | 302 -- docs/toc-everything.html | 148 - docs/toc-paramiko-module.html | 61 - docs/toc-paramiko.agent-module.html | 28 - docs/toc-paramiko.auth_handler-module.html | 28 - docs/toc-paramiko.ber-module.html | 29 - docs/toc-paramiko.buffered_pipe-module.html | 29 - docs/toc-paramiko.channel-module.html | 29 - docs/toc-paramiko.client-module.html | 28 - docs/toc-paramiko.common-module.html | 28 - docs/toc-paramiko.compress-module.html | 29 - docs/toc-paramiko.config-module.html | 28 - docs/toc-paramiko.dsskey-module.html | 28 - docs/toc-paramiko.file-module.html | 28 - docs/toc-paramiko.hostkeys-module.html | 29 - docs/toc-paramiko.kex_gex-module.html | 29 - docs/toc-paramiko.kex_group1-module.html | 29 - docs/toc-paramiko.logging22-module.html | 40 - docs/toc-paramiko.message-module.html | 28 - docs/toc-paramiko.packet-module.html | 30 - docs/toc-paramiko.pipe-module.html | 30 - docs/toc-paramiko.pkey-module.html | 28 - docs/toc-paramiko.primes-module.html | 29 - docs/toc-paramiko.resource-module.html | 28 - docs/toc-paramiko.rsakey-module.html | 28 - docs/toc-paramiko.server-module.html | 28 - docs/toc-paramiko.sftp-module.html | 28 - docs/toc-paramiko.sftp_attr-module.html | 28 - docs/toc-paramiko.sftp_client-module.html | 28 - docs/toc-paramiko.sftp_file-module.html | 28 - docs/toc-paramiko.sftp_handle-module.html | 28 - docs/toc-paramiko.sftp_server-module.html | 28 - docs/toc-paramiko.sftp_si-module.html | 28 - docs/toc-paramiko.ssh_exception-module.html | 29 - docs/toc-paramiko.transport-module.html | 29 - docs/toc-paramiko.util-module.html | 101 - docs/toc-paramiko.win_pageant-module.html | 34 - docs/toc.html | 34 - fabfile.py | 13 + images/paramiko-banner.png | Bin 0 -> 2885 bytes images/paramiko-banner.psd | Bin 0 -> 52177 bytes images/paramiko.png | Bin 0 -> 2016 bytes paramiko.egg-info/PKG-INFO | 24 - paramiko.egg-info/SOURCES.txt | 252 - paramiko.egg-info/dependency_links.txt | 1 - paramiko.egg-info/requires.txt | 1 - paramiko.egg-info/top_level.txt | 1 - paramiko/__init__.py | 29 +- paramiko/agent.py | 333 +- paramiko/channel.py | 54 +- paramiko/client.py | 165 +- paramiko/common.py | 3 + paramiko/config.py | 198 +- paramiko/file.py | 4 + paramiko/hostkeys.py | 24 +- paramiko/message.py | 3 +- paramiko/packet.py | 52 +- paramiko/proxy.py | 91 + paramiko/server.py | 18 +- paramiko/sftp_client.py | 138 +- paramiko/sftp_file.py | 25 +- paramiko/ssh_exception.py | 17 + paramiko/transport.py | 238 +- paramiko/util.py | 9 + paramiko/win_pageant.py | 28 +- requirements.txt | 2 + setup.cfg | 5 - setup.py | 20 +- test.py | 11 +- tests/loop.py | 8 +- tests/test_buffered_pipe.py | 8 +- tests/test_client.py | 8 +- tests/test_sftp.py | 45 +- tests/test_transport.py | 7 +- tests/test_util.py | 221 +- tests/util.py | 10 + tox.ini | 6 + 229 files changed, 5025 insertions(+), 80819 deletions(-) create mode 100644 .bzrignore create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 ChangeLog.0 create mode 100644 ChangeLog.1 create mode 100644 Makefile create mode 100644 NEWS create mode 100644 NOTES delete mode 100644 PKG-INFO create mode 100644 TODO create mode 100755 demos/demo_keygen.py delete mode 100644 docs/api-objects.txt delete mode 100644 docs/bug-index.html delete mode 100644 docs/class-tree.html delete mode 100644 docs/crarr.png delete mode 100644 docs/epydoc.css delete mode 100644 docs/epydoc.js delete mode 100644 docs/frames.html delete mode 100644 docs/help.html delete mode 100644 docs/identifier-index.html delete mode 100644 docs/index.html delete mode 100644 docs/module-tree.html delete mode 100644 docs/paramiko-module.html delete mode 100644 docs/paramiko-pysrc.html delete mode 100644 docs/paramiko.Agent-class.html delete mode 100644 docs/paramiko.AgentKey-class.html delete mode 100644 docs/paramiko.AuthenticationException-class.html delete mode 100644 docs/paramiko.AutoAddPolicy-class.html delete mode 100644 docs/paramiko.BadAuthenticationType-class.html delete mode 100644 docs/paramiko.BadHostKeyException-class.html delete mode 100644 docs/paramiko.BufferedFile-class.html delete mode 100644 docs/paramiko.Channel-class.html delete mode 100644 docs/paramiko.ChannelException-class.html delete mode 100644 docs/paramiko.DSSKey-class.html delete mode 100644 docs/paramiko.HostKeys-class.html delete mode 100644 docs/paramiko.Message-class.html delete mode 100644 docs/paramiko.MissingHostKeyPolicy-class.html delete mode 100644 docs/paramiko.PKey-class.html delete mode 100644 docs/paramiko.PasswordRequiredException-class.html delete mode 100644 docs/paramiko.RSAKey-class.html delete mode 100644 docs/paramiko.RejectPolicy-class.html delete mode 100644 docs/paramiko.SFTP-class.html delete mode 100644 docs/paramiko.SFTPAttributes-class.html delete mode 100644 docs/paramiko.SFTPClient-class.html delete mode 100644 docs/paramiko.SFTPError-class.html delete mode 100644 docs/paramiko.SFTPFile-class.html delete mode 100644 docs/paramiko.SFTPHandle-class.html delete mode 100644 docs/paramiko.SFTPServer-class.html delete mode 100644 docs/paramiko.SFTPServerInterface-class.html delete mode 100644 docs/paramiko.SSHClient-class.html delete mode 100644 docs/paramiko.SSHConfig-class.html delete mode 100644 docs/paramiko.SSHException-class.html delete mode 100644 docs/paramiko.SecurityOptions-class.html delete mode 100644 docs/paramiko.ServerInterface-class.html delete mode 100644 docs/paramiko.SubsystemHandler-class.html delete mode 100644 docs/paramiko.Transport-class.html delete mode 100644 docs/paramiko.WarningPolicy-class.html delete mode 100644 docs/paramiko.agent-module.html delete mode 100644 docs/paramiko.agent-pysrc.html delete mode 100644 docs/paramiko.auth_handler-module.html delete mode 100644 docs/paramiko.auth_handler-pysrc.html delete mode 100644 docs/paramiko.ber-module.html delete mode 100644 docs/paramiko.ber-pysrc.html delete mode 100644 docs/paramiko.ber.BER-class.html delete mode 100644 docs/paramiko.ber.BERException-class.html delete mode 100644 docs/paramiko.buffered_pipe-module.html delete mode 100644 docs/paramiko.buffered_pipe-pysrc.html delete mode 100644 docs/paramiko.buffered_pipe.BufferedPipe-class.html delete mode 100644 docs/paramiko.buffered_pipe.PipeTimeout-class.html delete mode 100644 docs/paramiko.channel-module.html delete mode 100644 docs/paramiko.channel-pysrc.html delete mode 100644 docs/paramiko.channel.ChannelStderrFile-class.html delete mode 100644 docs/paramiko.client-module.html delete mode 100644 docs/paramiko.client-pysrc.html delete mode 100644 docs/paramiko.common-module.html delete mode 100644 docs/paramiko.common-pysrc.html delete mode 100644 docs/paramiko.compress-module.html delete mode 100644 docs/paramiko.compress-pysrc.html delete mode 100644 docs/paramiko.compress.ZlibCompressor-class.html delete mode 100644 docs/paramiko.compress.ZlibDecompressor-class.html delete mode 100644 docs/paramiko.config-module.html delete mode 100644 docs/paramiko.config-pysrc.html delete mode 100644 docs/paramiko.dsskey-module.html delete mode 100644 docs/paramiko.dsskey-pysrc.html delete mode 100644 docs/paramiko.file-module.html delete mode 100644 docs/paramiko.file-pysrc.html delete mode 100644 docs/paramiko.hostkeys-module.html delete mode 100644 docs/paramiko.hostkeys-pysrc.html delete mode 100644 docs/paramiko.hostkeys.HostKeyEntry-class.html delete mode 100644 docs/paramiko.kex_gex-module.html delete mode 100644 docs/paramiko.kex_gex-pysrc.html delete mode 100644 docs/paramiko.kex_gex.KexGex-class.html delete mode 100644 docs/paramiko.kex_group1-module.html delete mode 100644 docs/paramiko.kex_group1-pysrc.html delete mode 100644 docs/paramiko.kex_group1.KexGroup1-class.html delete mode 100644 docs/paramiko.logging22-module.html delete mode 100644 docs/paramiko.logging22-pysrc.html delete mode 100644 docs/paramiko.logging22.Formatter-class.html delete mode 100644 docs/paramiko.logging22.StreamHandler-class.html delete mode 100644 docs/paramiko.logging22.logger-class.html delete mode 100644 docs/paramiko.message-module.html delete mode 100644 docs/paramiko.message-pysrc.html delete mode 100644 docs/paramiko.packet-module.html delete mode 100644 docs/paramiko.packet-pysrc.html delete mode 100644 docs/paramiko.packet.NeedRekeyException-class.html delete mode 100644 docs/paramiko.pipe-module.html delete mode 100644 docs/paramiko.pipe-pysrc.html delete mode 100644 docs/paramiko.pipe.OrPipe-class.html delete mode 100644 docs/paramiko.pipe.PosixPipe-class.html delete mode 100644 docs/paramiko.pipe.WindowsPipe-class.html delete mode 100644 docs/paramiko.pkey-module.html delete mode 100644 docs/paramiko.pkey-pysrc.html delete mode 100644 docs/paramiko.primes-module.html delete mode 100644 docs/paramiko.primes-pysrc.html delete mode 100644 docs/paramiko.primes.ModulusPack-class.html delete mode 100644 docs/paramiko.resource-module.html delete mode 100644 docs/paramiko.resource-pysrc.html delete mode 100644 docs/paramiko.rsakey-module.html delete mode 100644 docs/paramiko.rsakey-pysrc.html delete mode 100644 docs/paramiko.server-module.html delete mode 100644 docs/paramiko.server-pysrc.html delete mode 100644 docs/paramiko.sftp-module.html delete mode 100644 docs/paramiko.sftp-pysrc.html delete mode 100644 docs/paramiko.sftp_attr-module.html delete mode 100644 docs/paramiko.sftp_attr-pysrc.html delete mode 100644 docs/paramiko.sftp_client-module.html delete mode 100644 docs/paramiko.sftp_client-pysrc.html delete mode 100644 docs/paramiko.sftp_file-module.html delete mode 100644 docs/paramiko.sftp_file-pysrc.html delete mode 100644 docs/paramiko.sftp_handle-module.html delete mode 100644 docs/paramiko.sftp_handle-pysrc.html delete mode 100644 docs/paramiko.sftp_server-module.html delete mode 100644 docs/paramiko.sftp_server-pysrc.html delete mode 100644 docs/paramiko.sftp_si-module.html delete mode 100644 docs/paramiko.sftp_si-pysrc.html delete mode 100644 docs/paramiko.ssh_exception-module.html delete mode 100644 docs/paramiko.ssh_exception-pysrc.html delete mode 100644 docs/paramiko.ssh_exception.PartialAuthentication-class.html delete mode 100644 docs/paramiko.transport-module.html delete mode 100644 docs/paramiko.transport-pysrc.html delete mode 100644 docs/paramiko.transport.ChannelMap-class.html delete mode 100644 docs/paramiko.util-module.html delete mode 100644 docs/paramiko.util-pysrc.html delete mode 100644 docs/paramiko.util.Counter-class.html delete mode 100644 docs/paramiko.util.PFilter-class.html delete mode 100644 docs/paramiko.util.enumerate-class.html delete mode 100644 docs/paramiko.win_pageant-module.html delete mode 100644 docs/paramiko.win_pageant-pysrc.html delete mode 100644 docs/paramiko.win_pageant.PageantConnection-class.html delete mode 100644 docs/redirect.html delete mode 100644 docs/since-index.html delete mode 100644 docs/toc-everything.html delete mode 100644 docs/toc-paramiko-module.html delete mode 100644 docs/toc-paramiko.agent-module.html delete mode 100644 docs/toc-paramiko.auth_handler-module.html delete mode 100644 docs/toc-paramiko.ber-module.html delete mode 100644 docs/toc-paramiko.buffered_pipe-module.html delete mode 100644 docs/toc-paramiko.channel-module.html delete mode 100644 docs/toc-paramiko.client-module.html delete mode 100644 docs/toc-paramiko.common-module.html delete mode 100644 docs/toc-paramiko.compress-module.html delete mode 100644 docs/toc-paramiko.config-module.html delete mode 100644 docs/toc-paramiko.dsskey-module.html delete mode 100644 docs/toc-paramiko.file-module.html delete mode 100644 docs/toc-paramiko.hostkeys-module.html delete mode 100644 docs/toc-paramiko.kex_gex-module.html delete mode 100644 docs/toc-paramiko.kex_group1-module.html delete mode 100644 docs/toc-paramiko.logging22-module.html delete mode 100644 docs/toc-paramiko.message-module.html delete mode 100644 docs/toc-paramiko.packet-module.html delete mode 100644 docs/toc-paramiko.pipe-module.html delete mode 100644 docs/toc-paramiko.pkey-module.html delete mode 100644 docs/toc-paramiko.primes-module.html delete mode 100644 docs/toc-paramiko.resource-module.html delete mode 100644 docs/toc-paramiko.rsakey-module.html delete mode 100644 docs/toc-paramiko.server-module.html delete mode 100644 docs/toc-paramiko.sftp-module.html delete mode 100644 docs/toc-paramiko.sftp_attr-module.html delete mode 100644 docs/toc-paramiko.sftp_client-module.html delete mode 100644 docs/toc-paramiko.sftp_file-module.html delete mode 100644 docs/toc-paramiko.sftp_handle-module.html delete mode 100644 docs/toc-paramiko.sftp_server-module.html delete mode 100644 docs/toc-paramiko.sftp_si-module.html delete mode 100644 docs/toc-paramiko.ssh_exception-module.html delete mode 100644 docs/toc-paramiko.transport-module.html delete mode 100644 docs/toc-paramiko.util-module.html delete mode 100644 docs/toc-paramiko.win_pageant-module.html delete mode 100644 docs/toc.html create mode 100644 fabfile.py create mode 100644 images/paramiko-banner.png create mode 100644 images/paramiko-banner.psd create mode 100644 images/paramiko.png delete mode 100644 paramiko.egg-info/PKG-INFO delete mode 100644 paramiko.egg-info/SOURCES.txt delete mode 100644 paramiko.egg-info/dependency_links.txt delete mode 100644 paramiko.egg-info/requires.txt delete mode 100644 paramiko.egg-info/top_level.txt create mode 100644 paramiko/proxy.py create mode 100644 requirements.txt delete mode 100644 setup.cfg create mode 100644 tests/util.py create mode 100644 tox.ini diff --git a/.bzrignore b/.bzrignore new file mode 100644 index 0000000..6ce9d80 --- /dev/null +++ b/.bzrignore @@ -0,0 +1,7 @@ +*.pyc +./build +./paramiko.egg-info +./dist +./.project +./paramiko.tmproj +./test.log diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4b57895 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +*.pyc +build/ +dist/ +.tox/ +paramiko.egg-info/ +test.log +docs/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..6896b89 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +language: python +python: + - "2.5" + - "2.6" + - "2.7" +install: + # Self-install for setup.py-driven deps + - pip install -e . +script: python test.py +notifications: + irc: + channels: "irc.freenode.org#paramiko" + on_success: change + on_failure: change diff --git a/ChangeLog.0 b/ChangeLog.0 new file mode 100644 index 0000000..c151d25 --- /dev/null +++ b/ChangeLog.0 @@ -0,0 +1,42 @@ + +2003-08-24: + * implemented the other hashes: all 4 from the draft are working now + * added 'aes128-cbc' and '3des-cbc' cipher support + * fixed channel eof/close semantics +2003-09-12: version "aerodactyl" + * implemented group-exchange kex ("kex-gex") + * implemented RSA/DSA private key auth +2003-09-13: + * fixed inflate_long and deflate_long to handle negatives, even though + they're never used in the current ssh protocol +2003-09-14: + * fixed session_id handling: re-keying works now + * added the ability for a Channel to have a fileno() for select/poll + purposes, although this will cause worse window performance if the + client app isn't careful +2003-09-16: version "bulbasaur" + * fixed pipe (fileno) method to be nonblocking and it seems to work now + * fixed silly bug that caused large blocks to be truncated +2003-10-08: + * patch to fix Channel.invoke_subsystem and add Channel.exec_command + [vaclav dvorak] + * patch to add Channel.sendall [vaclav dvorak] + * patch to add Channel.shutdown [vaclav dvorak] + * patch to add Channel.makefile and a ChannelFile class which emulates + a python file object [vaclav dvorak] +2003-10-26: + * thread creation no longer happens during construction -- use the new + method "start_client(event)" to get things rolling + * re-keying now takes place after 1GB of data or 1 billion packets + (these limits can be easily changed per-session if needed) +2003-11-06: + * added a demo server and host key +2003-11-09: + * lots of changes to server mode + * ChannelFile supports universal newline mode; fixed readline + * fixed a bug with parsing the remote banner +2003-11-10: version "charmander" + * renamed SSHException -> SecshException + * cleaned up server mode and the demo server + +*** for all subsequent changes, please see 'tla changelog'. diff --git a/ChangeLog.1 b/ChangeLog.1 new file mode 100644 index 0000000..2fdae5a --- /dev/null +++ b/ChangeLog.1 @@ -0,0 +1,2928 @@ +# do not edit -- automatically generated by arch changelog +# arch-tag: automatic-ChangeLog--robey@lag.net--2003-public/secsh--dev--1.0 +# + +2005-04-18 00:53:57 GMT Robey Pointer patch-164 + + Summary: + fix some docs + Revision: + secsh--dev--1.0--patch-164 + + remove some epydoc comments about fileno() being non-portable. + + modified files: + paramiko/channel.py + + +2005-04-18 00:30:52 GMT Robey Pointer patch-163 + + Summary: + add SFTPClient.close() + Revision: + secsh--dev--1.0--patch-163 + + add SFTPClient.close() and add a simple little unit test for it. + + + modified files: + paramiko/sftp_client.py tests/test_sftp.py + + +2005-04-18 00:11:34 GMT Robey Pointer patch-162 + + Summary: + avoid os.environ['HOME'] in the demos + Revision: + secsh--dev--1.0--patch-162 + + avoid using os.environ['HOME'], which will never work on windows, and + use os.path.expanduser() instead. it's semi-moot because windows doesn't + have a standard location for ssh files, but i think paramiko should set a + good example anyway. + + modified files: + demo.py demo_simple.py + + +2005-04-16 23:38:22 GMT Robey Pointer patch-161 + + Summary: + integrated laptop work (test commit) + Revision: + secsh--dev--1.0--patch-161 + + Patches applied: + + * robey@lag.net--2003-public-master-shake/secsh--dev--1.0--base-0 + tag of robey@lag.net--2003-public/secsh--dev--1.0--patch-160 + + * robey@lag.net--2003-public-master-shake/secsh--dev--1.0--patch-1 + test commit + + * robey@lag.net--2003-public/secsh--dev--1.0--base-0 + initial import + + * robey@lag.net--2003-public/secsh--dev--1.0--patch-1 + no changes + + + modified files: + README paramiko/server.py + + new patches: + robey@lag.net--2003-public-master-shake/secsh--dev--1.0--base-0 + robey@lag.net--2003-public-master-shake/secsh--dev--1.0--patch-1 + + +2005-04-10 00:46:41 GMT Robey Pointer patch-160 + + Summary: + 1.3 marowak + Revision: + secsh--dev--1.0--patch-160 + + bump version to 1.3 / marowak + + modified files: + Makefile README paramiko/__init__.py paramiko/transport.py + setup.py + + +2005-04-10 00:39:18 GMT Robey Pointer patch-159 + + Summary: + clean up SFTPAttributes.__repr__ + Revision: + secsh--dev--1.0--patch-159 + + clean up SFTPAttributes repr() a bit. + + modified files: + paramiko/sftp_attr.py + + +2005-04-10 00:13:54 GMT Robey Pointer patch-158 + + Summary: + remove ChangeLog from MANIFEST.in + Revision: + secsh--dev--1.0--patch-158 + + remove ChangeLog from the dist list. + + modified files: + MANIFEST.in + + +2005-04-06 07:24:28 GMT Robey Pointer patch-157 + + Summary: + change SubsystemHandler/SFTPServerInterface API + Revision: + secsh--dev--1.0--patch-157 + + change the API of SubsystemHandler to accept a reference to the + ServerInstance object during construction. this will break all code + that currently creates subsystem handlers (like sftp servers) -- sorry! + + lots of little doc fixups (mostly indenting). + + modified files: + paramiko/server.py paramiko/sftp_server.py paramiko/sftp_si.py + paramiko/transport.py tests/stub_sftp.py + + +2005-03-26 05:53:00 GMT Robey Pointer patch-156 + + Summary: + rewrite channel pipes to work on windows + Revision: + secsh--dev--1.0--patch-156 + + the pipe system i was using for simulating an os-level FD (for select) was + retarded. i realized this week that i could just use a single byte in the + pipe to signal "data is ready" and not try to feed all incoming data thru + the pipe -- and then i don't have to try to make the pipe non-blocking (which + should make it work on windows). a lot of duplicate code got removed and now + it's all going thru the same code-path on read. + + there's still a slight penalty on incoming feeds and calling 'recv' when a + pipe has been opened (by calling 'fileno'), but it's tiny. + + removed a bunch of documentation and comments about things not working on + windows, since i think they probably do now. + + + removed files: + .arch-ids/demo_windows.py.id demo_windows.py + + modified files: + MANIFEST.in README paramiko/channel.py + + +2005-03-25 20:06:56 GMT Robey Pointer patch-155 + + Summary: + fix sending of large sftp packet sizes + Revision: + secsh--dev--1.0--patch-155 + + fix a bug where packets larger than about 12KB would cause the session to + die on platforms other than osx. turns out that on most platforms, setting a + socket timeout also causes timeouts to occur on writes (but not on osx). so + on a huge write, once the os buffers were full, paramiko would get a + socket.timeout exception when writing, and bail. + + since the timeout is primarily so we can periodically poll to see if the + session has been killed from elsewhere, do that on a timeout but otherwise + continue trying to write. large packet sizes (in sftp) should now work. + + modified files: + paramiko/transport.py + + +2005-02-28 08:06:08 GMT Robey Pointer patch-154 + + Summary: + even better 1.2 lapras + Revision: + secsh--dev--1.0--patch-154 + + re-bump the version # to 1.2 (with a new date since i added more stuff). + add 2005 to the copyright date in a bunch of files. + + + modified files: + Makefile README demo.py demo_server.py demo_simple.py + demo_windows.py forward.py paramiko/__init__.py + paramiko/auth_transport.py paramiko/ber.py paramiko/channel.py + paramiko/common.py paramiko/dsskey.py paramiko/file.py + paramiko/kex_gex.py paramiko/kex_group1.py + paramiko/logging22.py paramiko/message.py paramiko/pkey.py + paramiko/primes.py paramiko/rsakey.py paramiko/server.py + paramiko/sftp.py paramiko/sftp_attr.py paramiko/sftp_client.py + paramiko/sftp_handle.py paramiko/sftp_server.py + paramiko/sftp_si.py paramiko/ssh_exception.py + paramiko/transport.py paramiko/util.py setup.py test.py + tests/loop.py tests/stub_sftp.py tests/test_file.py + tests/test_kex.py tests/test_message.py tests/test_pkey.py + tests/test_sftp.py tests/test_transport.py + + +2005-02-28 07:49:56 GMT Robey Pointer patch-153 + + Summary: + tweak sftp_file write behavior on large blocks of data + Revision: + secsh--dev--1.0--patch-153 + + BufferedFile.write() wasn't correctly dealing with the possibility that the + underlying write might not write the entire data block at once (even though + the docs said it would). now that it's working, make sftp_file take + advantage of it in order to chop up blocks larger than 32kB (the max allowed + on sftp) and add a unit test for it. + + + modified files: + paramiko/file.py paramiko/sftp_file.py tests/test_sftp.py + + +2005-02-28 07:17:21 GMT Robey Pointer patch-152 + + Summary: + little doc fixes + Revision: + secsh--dev--1.0--patch-152 + + stupid little doc fixups that didn't fit with the other patches. + + modified files: + paramiko/auth_transport.py tests/loop.py + + +2005-02-28 07:16:22 GMT Robey Pointer patch-151 + + Summary: + fix race in transport thread startup + Revision: + secsh--dev--1.0--patch-151 + + set active=True from the methods that start the main transport thread, right + before actually starting the thread. this avoids a race where the main + thread could be started, but the original thread could wake up from the + event.wait(0.1) before the new thread actually set the transport active. + impossible, you say? no machines so slow exist? au contraire, my sad + little linux box faced this problem earlier today. + + + modified files: + paramiko/transport.py + + +2005-02-28 07:14:11 GMT Robey Pointer patch-150 + + Summary: + when combining stderr with stdout on a channel, merge the buffers too + Revision: + secsh--dev--1.0--patch-150 + + when turning on combine-stderr mode on a channel, grab the channel lock and + feed any existing stderr buffer into the normal buffer. this should help + applications (and my unit tests) avoid races between data coming in over + stderr and setting combine-stderr. + + _send_eof is now slightly safer too, although i don't think that really fixed + anything. it just makes me feel better. + + modified files: + paramiko/channel.py + + +2005-02-28 07:09:02 GMT Robey Pointer patch-149 + + Summary: + add thread ids to logs + Revision: + secsh--dev--1.0--patch-149 + + add a logging filter that reports the thread-id of the logger, and use + that for all paramiko logging. since thread-local stuff didn't appear + until python 2.4, i hacked up my own little version to assign incrementing + numbers to threads as they log. + + + modified files: + paramiko/channel.py paramiko/sftp.py paramiko/sftp_client.py + paramiko/sftp_server.py paramiko/transport.py paramiko/util.py + + +2005-02-26 21:12:43 GMT Robey Pointer patch-148 + + Summary: + forgot to check in stub_sftp + Revision: + secsh--dev--1.0--patch-148 + + yikes! don't forget to check this in: needed for unit tests. + + new files: + tests/.arch-ids/stub_sftp.py.id tests/stub_sftp.py + + +2005-02-26 21:11:04 GMT Robey Pointer patch-147 + + Summary: + 1.2 (lapras) + Revision: + secsh--dev--1.0--patch-147 + + bump version stuff to 1.2 / lapras. + + modified files: + Makefile README paramiko/__init__.py paramiko/transport.py + setup.py + + +2005-02-15 15:48:47 GMT Robey Pointer patch-146 + + Summary: + raise better exception on empty key + Revision: + secsh--dev--1.0--patch-146 + + raise a clearer exception when trying to create an empty key. + + + modified files: + README paramiko/dsskey.py paramiko/rsakey.py + tests/test_transport.py + + +2005-02-15 15:47:02 GMT Robey Pointer patch-145 + + Summary: + add methods for sending/receiving a channel's exit status + Revision: + secsh--dev--1.0--patch-145 + + track a channel's exit status and provide a method (recv_exit_status) to + block waiting for it to arrive. also provide a convenience method for + servers to send it (send_exit_status). add shutdown_read and shutdown_write. + fix a bug in sending window change requests. + + + modified files: + README paramiko/channel.py paramiko/transport.py + + +2005-02-06 23:32:22 GMT Robey Pointer patch-144 + + Summary: + fix docs + Revision: + secsh--dev--1.0--patch-144 + + clean up some of the docs. + + + modified files: + README paramiko/pkey.py paramiko/sftp_attr.py + + +2005-02-06 23:30:40 GMT Robey Pointer patch-143 + + Summary: + fix an sftp unit test + Revision: + secsh--dev--1.0--patch-143 + + fix one of the sftp unit tests to actually work. + + + modified files: + tests/test_sftp.py + + +2005-02-05 07:45:20 GMT Robey Pointer patch-142 + + Summary: + fix windows sample script's HOME + Revision: + secsh--dev--1.0--patch-142 + + fix the HOME environ var to work on windows too. + + modified files: + demo_windows.py + + +2005-01-25 05:17:55 GMT Robey Pointer patch-141 + + Summary: + misc logging fixes + Revision: + secsh--dev--1.0--patch-141 + + change the level of some log messages so interesting stuff gets logged at + info instead of debug. fix an oops where channels defaulted to being in + ultra debug mode, and make this mode depend on a new Transport method: + "set_hexdump". + + + modified files: + paramiko/auth_transport.py paramiko/channel.py + paramiko/sftp.py paramiko/sftp_client.py + paramiko/sftp_server.py paramiko/transport.py + + +2005-01-17 10:09:09 GMT Robey Pointer patch-140 + + Summary: + more flexible logging + Revision: + secsh--dev--1.0--patch-140 + + some tweaks to make channels etc follow the logger setting of their parent + transport, so that setting the log channel for a paramiko transport will + cause all sub-logging to branch out from that channel. + + also, close all open file handles when the sftp server ends. + + + modified files: + paramiko/channel.py paramiko/sftp_attr.py + paramiko/sftp_client.py paramiko/sftp_handle.py + paramiko/sftp_server.py paramiko/transport.py + + +2005-01-16 21:03:15 GMT Robey Pointer patch-139 + + Summary: + make loopback sftp tests the default + Revision: + secsh--dev--1.0--patch-139 + + change the unit tests to default to always running the sftp tests locally, + and make a -R option to force the tests to run against a remote server. + the tests seem to work fine locally, and it helps test out server mode, + even though there's a danger that they could get isolated from reality + and only test that paramiko can talk to itself. + + + modified files: + test.py + + +2005-01-16 20:14:07 GMT Robey Pointer patch-138 + + Summary: + doc fixups + Revision: + secsh--dev--1.0--patch-138 + + little doc fixups that i did obsessively on the train one morning. + + modified files: + paramiko/file.py + + +2005-01-09 05:27:07 GMT Robey Pointer patch-137 + + Summary: + added listdir_attr() + Revision: + secsh--dev--1.0--patch-137 + + add SFTPClient.listdir_attr() to fetch a list of files & their attributes, + instead of just their filenames. artur piwko would find this useful. + + + modified files: + paramiko/sftp_attr.py paramiko/sftp_client.py + + +2004-12-19 19:56:48 GMT Robey Pointer patch-136 + + Summary: + loopback sftp test + Revision: + secsh--dev--1.0--patch-136 + + add ability to turn off more tests, and a secret (for now) -X option to do + the sftp tests via loopback socket. added another symlink sftp test to see + what happens with absolute symlinks. + + + modified files: + test.py tests/test_sftp.py + + +2004-12-19 19:50:00 GMT Robey Pointer patch-135 + + Summary: + more sftp cleanup + Revision: + secsh--dev--1.0--patch-135 + + oops, this should've been part of the last patch. + + + modified files: + paramiko/sftp_si.py + + +2004-12-19 19:43:27 GMT Robey Pointer patch-134 + + Summary: + cleanup & docs in sftp + Revision: + secsh--dev--1.0--patch-134 + + add some more docs to SFTPHandle, and give a default implementation for + close() that's usually right. add a flush() to the default implementation + of write(). document that symlink's args in the sftp protocol are out of + order (the spec is wrong). + + + modified files: + paramiko/sftp_handle.py paramiko/sftp_server.py + + +2004-12-13 07:32:14 GMT Robey Pointer patch-133 + + Summary: + unit test madness + Revision: + secsh--dev--1.0--patch-133 + + add some more testy bits and fix up some other bits. + + + modified files: + tests/test_transport.py + + +2004-12-13 07:31:01 GMT Robey Pointer patch-132 + + Summary: + oops (continued) + Revision: + secsh--dev--1.0--patch-132 + + er, part 2 of that. + + + modified files: + paramiko/server.py + + +2004-12-13 07:29:38 GMT Robey Pointer patch-131 + + Summary: + move check_global_request + Revision: + secsh--dev--1.0--patch-131 + + move check_global_request into the server interface -- i missed it during + the initial move (oops). + + + modified files: + paramiko/transport.py + + +2004-12-13 07:27:39 GMT Robey Pointer patch-130 + + Summary: + small fixups + Revision: + secsh--dev--1.0--patch-130 + + move _wait_for_send_window into the right place in Channel. remove outdated + note from auth_transport. fix download url in setup.py. + + + + modified files: + paramiko/auth_transport.py paramiko/channel.py setup.py + + +2004-12-12 09:58:40 GMT Robey Pointer patch-129 + + Summary: + 1.1 (kabuto) + Revision: + secsh--dev--1.0--patch-129 + + edit various files to bump the version to 1.1. + also fix to point to the new url. + + + modified files: + Makefile README paramiko/__init__.py paramiko/transport.py + setup.py + + +2004-12-12 09:38:24 GMT Robey Pointer patch-128 + + Summary: + more unit tests + Revision: + secsh--dev--1.0--patch-128 + + added unit tests for multi-part auth, exec_command, and invoke_shell. + + + modified files: + tests/test_transport.py + + +2004-12-12 09:32:17 GMT Robey Pointer patch-127 + + Summary: + doc fixups + Revision: + secsh--dev--1.0--patch-127 + + fix some typos in sftp_client docs + + + modified files: + paramiko/sftp_client.py + + +2004-12-12 09:25:15 GMT Robey Pointer patch-126 + + Summary: + server support for stderr & exec_command + Revision: + secsh--dev--1.0--patch-126 + + for the server side of my stderr blunder, add send_stderr & sendall_stderr, + and make the sending side of makefile_stderr work correctly. + + also, call check_channel_exec_request on a server object for exec requests + on a channel. + + + modified files: + paramiko/channel.py paramiko/server.py + + +2004-12-12 09:16:03 GMT Robey Pointer patch-125 + + Summary: + add client-side multi-part auth support + Revision: + secsh--dev--1.0--patch-125 + + added support for multi-part authentication (even though nobody supports it + that i've seen). on a successful "partial" auth, the auth_* method will + return a list of acceptable means to continue authenticating. + + + modified files: + paramiko/auth_transport.py paramiko/ssh_exception.py + + +2004-12-11 03:44:33 GMT Robey Pointer patch-124 + + Summary: + docs fixup + Revision: + secsh--dev--1.0--patch-124 + + fix a comment typo, and add @since designators to a couple of new methods. + + + modified files: + paramiko/channel.py paramiko/sftp_server.py + + +2004-12-11 03:43:18 GMT Robey Pointer patch-123 + + Summary: + clean up authentication + Revision: + secsh--dev--1.0--patch-123 + + add new exception "BadAuthenticationType", which is raised when auth fails + because your auth type (password or public-key) isn't valid on the server. + + used this as an excuse to clean up auth_password and auth_publickey so their + 'event' arg is optional, and if missing, they block until auth is finished, + raising an exception on error. + + also, don't close the session on failed auth -- the server may let you try + again. + + added some test cases for failed auth. + + + modified files: + paramiko/__init__.py paramiko/auth_transport.py + paramiko/ssh_exception.py paramiko/transport.py + tests/test_transport.py + + +2004-12-10 08:30:44 GMT Robey Pointer patch-122 + + Summary: + symlink, readlink + Revision: + secsh--dev--1.0--patch-122 + + add support for symlink command, and finish support for readlink. (i guess + i started readlink a while ago but forgot to add the right method to the + SFTPServerInterface class.) + + + modified files: + paramiko/sftp_server.py paramiko/sftp_si.py tests/test_sftp.py + + +2004-12-10 08:27:43 GMT Robey Pointer patch-121 + + Summary: + other part of that last patch + Revision: + secsh--dev--1.0--patch-121 + + oops, forgot this part. + + modified files: + paramiko/transport.py + + +2004-12-10 08:25:28 GMT Robey Pointer patch-120 + + Summary: + add stderr support methods + Revision: + secsh--dev--1.0--patch-120 + + big embarrassment: i didn't read the ssh2 docs close enough, and all this + time paramiko wasn't handling "extended_data" packets, which contain stderr + output. + + so now, several new functions: recv_stderr_ready() and recv_stderr() to + mirror recv_ready() and recv(), and set_combined_stderr() to force stderr + to be combined into stdout. also, makefile_stderr() to create a fake file + object to represent stderr. + + + modified files: + paramiko/channel.py + + +2004-12-10 07:55:33 GMT Robey Pointer patch-119 + + Summary: + reformat README + Revision: + secsh--dev--1.0--patch-119 + + reformatted the README to a slightly smaller margin, just because. + + + modified files: + README + + +2004-12-09 04:15:12 GMT Robey Pointer patch-118 + + Summary: + fix SFTPFile gettimeout/settimeout + Revision: + secsh--dev--1.0--patch-118 + + i don't think the gettimeout/settimeout calls on SFTPFile ever worked. + also, simplify the implementation of _get_size() since it's nearly + identical to stat(). + + + modified files: + paramiko/sftp_file.py + + +2004-12-09 02:42:36 GMT Robey Pointer patch-117 + + Summary: + readme comments + Revision: + secsh--dev--1.0--patch-117 + + add another fixme to the readme + + modified files: + README + + +2004-11-26 22:07:31 GMT Robey Pointer patch-116 + + Summary: + doc fixups + Revision: + secsh--dev--1.0--patch-116 + + explain "recv_ready" better, and add debug descriptions for the kex codes. + + + modified files: + README paramiko/channel.py paramiko/common.py + + +2004-11-25 19:39:34 GMT Robey Pointer patch-115 + + Summary: + fix CONNECTION_FAILED_CODE + Revision: + secsh--dev--1.0--patch-115 + + oops, fix typo in channel request failed. + + modified files: + paramiko/transport.py + + +2004-11-22 07:40:39 GMT Robey Pointer patch-114 + + Summary: + fix typo in channel + Revision: + secsh--dev--1.0--patch-114 + + fix typo that alain found: pipd_wfd -> pipe_wfd. + + + modified files: + paramiko/channel.py + + +2004-11-22 07:27:21 GMT Robey Pointer patch-113 + + Summary: + sftp server support! + Revision: + secsh--dev--1.0--patch-113 + + finally check in sftp_handle (file handle abstraction), sftp_si (server + interface), and sftp_server (server implementation) -- all of which make + a roughly 90% implementation of server-side sftp. + + + + new files: + paramiko/.arch-ids/sftp_handle.py.id + paramiko/.arch-ids/sftp_server.py.id + paramiko/.arch-ids/sftp_si.py.id paramiko/sftp_handle.py + paramiko/sftp_server.py paramiko/sftp_si.py + + modified files: + README demo_windows.py paramiko/__init__.py + + +2004-11-22 07:07:08 GMT Robey Pointer patch-112 + + Summary: + add finish_subsystem() + Revision: + secsh--dev--1.0--patch-112 + + when a SubsystemHandler is being decomissioned (the client has closed the + channel or transport, or the socket went away), make a callback to let the + handler do any shutdown it needs to. + + + modified files: + paramiko/server.py + + +2004-11-22 07:04:31 GMT Robey Pointer patch-111 + + Summary: + fix extremely unlikely channel counter wrapping + Revision: + secsh--dev--1.0--patch-111 + + Transport's channel counter can overflow after 4 billion some channels are + created. make it wrap back around after 16 million instead. also allow the + logging channel to be set manually. fix some comments elsewhere. + + + modified files: + paramiko/channel.py paramiko/primes.py paramiko/transport.py + + +2004-11-22 07:01:43 GMT Robey Pointer patch-110 + + Summary: + fix Transport.get_username() to work in server mode too + Revision: + secsh--dev--1.0--patch-110 + + whenever i split the 'username' field into username and auth_username, + i guess that made get_username() stop working for server mode (because the + username was stored in a different field). this should fix it. + + modified files: + paramiko/auth_transport.py + + +2004-11-07 03:10:53 GMT Robey Pointer patch-109 + + Summary: + v1.0 (jigglypuff) + Revision: + secsh--dev--1.0--patch-109 + + bump all the version numbers up to 1.0 (jigglypuff). + + modified files: + Makefile README paramiko/__init__.py paramiko/transport.py + setup.py + + +2004-11-07 02:51:42 GMT Robey Pointer patch-108 + + Summary: + add filename to SFTPAttributes + Revision: + secsh--dev--1.0--patch-108 + + add filename to the attributes stored in an SFTPAttributes object. + + modified files: + paramiko/sftp_attr.py + + +2004-11-07 02:31:48 GMT Robey Pointer patch-107 + + Summary: + fix kex_gex + Revision: + secsh--dev--1.0--patch-107 + + fix kex_gex (group-exchange key exchange) to, *cough*, work again, and also + layout kex_group1 a little more sanely. + + modified files: + paramiko/kex_gex.py paramiko/kex_group1.py + + +2004-11-07 02:29:54 GMT Robey Pointer patch-106 + + Summary: + fix chmod +x on demo_windows.py + Revision: + secsh--dev--1.0--patch-106 + + forgot to make demo_windows +x + + +2004-11-07 02:29:20 GMT Robey Pointer patch-105 + + Summary: + move ChangeLog + Revision: + secsh--dev--1.0--patch-105 + + move ChangeLog out of the way because tla can autogenerate any useful + ChangeLog. + + + renamed files: + .arch-ids/ChangeLog.id + ==> .arch-ids/ChangeLog-old.id + ChangeLog + ==> ChangeLog-old + + +2004-11-07 02:28:33 GMT Robey Pointer patch-104 + + Summary: + fix location of SFTPError + Revision: + secsh--dev--1.0--patch-104 + + fix location of SFTPError. + + modified files: + paramiko/__init__.py paramiko/sftp_client.py + + +2004-11-07 02:17:18 GMT Robey Pointer patch-103 + + Summary: + rename sftp constants + Revision: + secsh--dev--1.0--patch-103 + + replace oddly named sftp constants (FX_OK for example) with names that make + a bit more sense when sober (SFTP_OK). + + modified files: + paramiko/__init__.py paramiko/sftp.py paramiko/sftp_client.py + + +2004-11-07 02:08:11 GMT Robey Pointer patch-102 + + Summary: + add key exchange tests + 1 more sftp test + Revision: + secsh--dev--1.0--patch-102 + + add test suite for key-exchange protocols, since i apparently broke the + "gex" protocol recently and never noticed. also add an sftp unit test for + mkdir/rmdir. + + new files: + tests/.arch-ids/test_kex.py.id tests/test_kex.py + + modified files: + test.py tests/test_sftp.py + + +2004-11-07 02:00:50 GMT Robey Pointer patch-101 + + Summary: + remove old demo keys + Revision: + secsh--dev--1.0--patch-101 + + the keys are in tests/ now. + + removed files: + .arch-ids/demo_dss_key.id .arch-ids/demo_rsa_key.id + demo_dss_key demo_rsa_key + + +2004-11-06 20:32:08 GMT Robey Pointer patch-100 + + Summary: + don't forget demo_windows.py + Revision: + secsh--dev--1.0--patch-100 + + update MANIFEST.in to include demo_windows.py and not include the demo + keys (they're in tests/ now). clean up the README to explain the demo + scripts better now, since there are so many of them. then fix up the + demo scripts to look in tests/ for the keys. + + demo_windows.py doesn't need to call get_pty() (in fact, i think that's + blowing openssh's mind) and was executing the wrong command. + + + modified files: + MANIFEST.in README demo_server.py demo_simple.py + demo_windows.py + + +2004-11-01 07:07:48 GMT Robey Pointer patch-99 + + Summary: + use getpass + Revision: + secsh--dev--1.0--patch-99 + + convert raw_input to getpass as suggested many weeks ago. + + modified files: + forward.py + + +2004-11-01 03:54:01 GMT Robey Pointer patch-98 + + Summary: + don't unlink a Channel until the server closes it too + Revision: + secsh--dev--1.0--patch-98 + + when close()'ing a Channel, don't immediately unlink it from the Transport. + instead, wait for the server to send a close message. + + this should fix a bug where doing close() on an EOF'd channel would cause + the entire transport to be killed, because the server would send an + 'exit-status' and 'close' message for a channel that we no longer had a + record of. + + + modified files: + paramiko/channel.py + + +2004-11-01 03:43:28 GMT Robey Pointer patch-97 + + Summary: + better debugging, improve subsytem handler + Revision: + secsh--dev--1.0--patch-97 + + add a list of ssh packet names for debugging. improve the server-mode + subsystem handler so it can take extra parameters (list or keyword) and + pass them to the subsystem constructor. remove a misleading comment + about rekeying (which was already implemented). + + + modified files: + paramiko/common.py paramiko/server.py paramiko/transport.py + + +2004-11-01 03:37:42 GMT Robey Pointer patch-96 + + Summary: + remove key.valid check + Revision: + secsh--dev--1.0--patch-96 + + oops! 'key.valid' no longer works -- catch the SSHException instead, and log + it. + + + modified files: + paramiko/auth_transport.py + + +2004-10-23 07:36:23 GMT Robey Pointer patch-95 + + Summary: + ivysaur 0.9 + Revision: + secsh--dev--1.0--patch-95 + + update ivysaur release date, and add the list of changes to the README + file. + + + modified files: + Makefile README paramiko/__init__.py + + +2004-10-20 16:52:51 GMT Robey Pointer patch-94 + + Summary: + start testing Transport + Revision: + secsh--dev--1.0--patch-94 + + the beginnings of tests for Transport. only the bare minimum is there right + now. + + also started doc'ing things up to ivysaur. + + new files: + .arch-ids/demo_windows.py.id demo_windows.py + tests/.arch-ids/loop.py.id + tests/.arch-ids/test_transport.py.id tests/loop.py + tests/test_transport.py + + modified files: + Makefile README paramiko/__init__.py setup.py test.py + + +2004-10-18 04:54:27 GMT Robey Pointer patch-93 + + Summary: + switch Transport.connect() to using a Pkey object for the host key + Revision: + secsh--dev--1.0--patch-93 + + i suddenly realized that passing "hostkeytype" and "hostkey" as strings to + Transport.connect() was pretty silly since i went to all the effort of making + a class specifically for holding keys. so Transport.connect() now just takes + host-key argument: "hostkey" as a PKey object. + + updated the demos to use PKey objects when reading the host key file, and to + use the new "hostkey" argument. + + + modified files: + demo.py demo_simple.py paramiko/pkey.py paramiko/transport.py + + +2004-09-25 22:07:59 GMT Robey Pointer patch-92 + + Summary: + add rsa/dss key object unit tests + Revision: + secsh--dev--1.0--patch-92 + + add tests for rsa/dss key objects -- yay! + + + new files: + tests/.arch-ids/test_dss.key.id + tests/.arch-ids/test_pkey.py.id + tests/.arch-ids/test_rsa.key.id tests/test_dss.key + tests/test_pkey.py tests/test_rsa.key + + +2004-09-25 22:03:48 GMT Robey Pointer patch-91 + + Summary: + fix test.py to use options instead of env vars, sftp tests default off + Revision: + secsh--dev--1.0--patch-91 + + fix up the test framework so that the sftp unit tests aren't always run (you + have to ask for them explicitly) and they take their configuration from + command-line options. they still require a remote server. + + modified files: + test.py tests/test_sftp.py + + +2004-09-25 21:58:11 GMT Robey Pointer patch-90 + + Summary: + fix __init__ + Revision: + secsh--dev--1.0--patch-90 + + fix __init__ to export BufferedFile and randpool, and to catch up with the + changes from a week or 2 ago where sftp_attr & friends were split off. + + modified files: + paramiko/__init__.py + + +2004-09-25 21:47:19 GMT Robey Pointer patch-89 + + Summary: + fix some Transport docs + Revision: + secsh--dev--1.0--patch-89 + + document that Transport also would like close() and settimeout() to exist + on the socket-like object passed to the constructor. + + modified files: + paramiko/transport.py + + +2004-09-25 21:32:53 GMT Robey Pointer patch-88 + + Summary: + add Message.rewind() + Revision: + secsh--dev--1.0--patch-88 + + add rewind() method to Message, which just resets the pointer so you can + start reading from the beginning again. this is useful for some tests. + + modified files: + paramiko/message.py tests/test_message.py + + +2004-09-25 21:28:23 GMT Robey Pointer patch-87 + + Summary: + clean up pkey interface + Revision: + secsh--dev--1.0--patch-87 + + change the pkey interface so that it's no longer possible to have a pkey + that doesn't represent a valid key. (ie: no more "blank" key objects.) + also add "get_bits" and "can_sign" methods to determine the key bit length + and whether it can sign things (contains the "private parts") respectively. + + modified files: + paramiko/dsskey.py paramiko/pkey.py paramiko/rsakey.py + + +2004-09-11 21:01:32 GMT Robey Pointer patch-86 + + Summary: + unit tests for Message + Revision: + secsh--dev--1.0--patch-86 + + spanking new unit tests for Message. i'm trying to fix the embarrassment + of having so little of paramiko testable. next up is Transport! + + new files: + tests/.arch-ids/test_message.py.id tests/test_message.py + + +2004-09-11 20:56:01 GMT Robey Pointer patch-85 + + Summary: + move SFTPFile and SFTPAttributes into their own files + Revision: + secsh--dev--1.0--patch-85 + + move SFTPFile and SFTPAttributes into their own files. + + new files: + paramiko/.arch-ids/sftp_attr.py.id + paramiko/.arch-ids/sftp_file.py.id paramiko/sftp_attr.py + paramiko/sftp_file.py + + modified files: + paramiko/sftp.py paramiko/sftp_client.py + + +2004-09-11 20:50:39 GMT Robey Pointer patch-84 + + Summary: + add sftp.normalize + Revision: + secsh--dev--1.0--patch-84 + + kevin c. dorff pointed out that it would be nice to expose a way to + determine the server's "current working directory", so this new method + (normalize) directly maps to REALPATH. + + modified files: + paramiko/sftp_client.py + + +2004-09-11 20:43:09 GMT Robey Pointer patch-83 + + Summary: + tweak Message.add() in the key exchanges + Revision: + secsh--dev--1.0--patch-83 + + use the new Message.add() behavior to make a little code here much easier + to read. + + modified files: + paramiko/kex_gex.py paramiko/kex_group1.py + + +2004-09-11 20:40:08 GMT Robey Pointer patch-82 + + Summary: + doc fixes + Revision: + secsh--dev--1.0--patch-82 + + fix "string" -> "str" in types when documenting BufferedFile. + + modified files: + paramiko/file.py + + +2004-09-11 20:37:59 GMT Robey Pointer patch-81 + + Summary: + more unit tests + Revision: + secsh--dev--1.0--patch-81 + + add test for BufferedFile.read(-1) and sftp.normalize(). + + modified files: + tests/test_file.py tests/test_sftp.py + + +2004-09-11 20:36:49 GMT Robey Pointer patch-80 + + Summary: + move SubsystemHandler to server.py + Revision: + secsh--dev--1.0--patch-80 + + move SubsystemHandler into server.py where it makes more sense (it's part of + the server interface). + + also fix up paramiko's "version string" used in ssh2 negotiation to stop + saying "pyssh" and start saying "paramiko". :) + + modified files: + paramiko/server.py paramiko/transport.py + + +2004-09-11 20:35:19 GMT Robey Pointer patch-79 + + Summary: + Message.add() can take many args + Revision: + secsh--dev--1.0--patch-79 + + a bit of cleanup to Message: add() can now take any number of params, and + will add them all in order (using type guessing). + + modified files: + paramiko/message.py + + +2004-09-09 01:36:45 GMT Robey Pointer patch-78 + + Summary: + fix rbuffer -> _rbuffer in 3 places i missed + Revision: + secsh--dev--1.0--patch-78 + + fix 3 places where "rbuffer" hadn't been converted to "_rbuffer". thanks to + kevin c. dorff for the bug report. + + modified files: + paramiko/file.py + + +2004-09-07 06:56:49 GMT Robey Pointer patch-77 + + Summary: + docs for SubsystemHandler + Revision: + secsh--dev--1.0--patch-77 + + add documentation to constructor for SubsystemHandler. + + modified files: + paramiko/transport.py + + +2004-09-07 06:54:31 GMT Robey Pointer patch-76 + + Summary: + add sftp_client.py + Revision: + secsh--dev--1.0--patch-76 + + i retardedly forgot to import this file a few days ago: it's the split-out + client mode for sftp. it now also has some changes to adapt it to the + improved SFTPAttributes object API. + + new files: + paramiko/.arch-ids/sftp_client.py.id paramiko/sftp_client.py + + +2004-09-07 06:51:03 GMT Robey Pointer patch-75 + + Summary: + clean up SFTPAttributes + Revision: + secsh--dev--1.0--patch-75 + + add english descriptions to the FX_* error codes of sftp. clean up (and + document) SFTPAttributes since it's exported now, and make it simple to + generate one from a python os.stat object. make "_pythonize" the default -- + that is, just use the same field names as python does for os.stat. (i'm not + sure why i didn't do it that way in the first place; probably ignorance.) + also add str() method that converts the SFTPAttributes into a string suitable + for use in ls (used in an obscure way in sftp servers). + + modified files: + paramiko/sftp.py + + +2004-09-07 06:45:53 GMT Robey Pointer patch-74 + + Summary: + note pycrypto 2.0 in README + Revision: + secsh--dev--1.0--patch-74 + + update the README to note that pycrypto 2.0 works (i just tried it). also + fix the name from pyCrypt back to pycrypto -- that project is having trouble + making up its mind about naming. :) + + modified files: + README + + +2004-09-05 07:44:03 GMT Robey Pointer patch-73 + + Summary: + split sftp into sftp, sftp_client; renamed SFTP -> SFTPClient + Revision: + secsh--dev--1.0--patch-73 + + add sftp_client file, and split out the common code (sftp) from stuff specific + to client mode (sftp_client). renamed SFTP class to SFTPClient, but left an + alias so old code will still work. + + renamed a bunch of sftp constants now that they're better hidden from epydoc. + + modified files: + README paramiko/__init__.py paramiko/sftp.py + + +2004-09-05 07:41:45 GMT Robey Pointer patch-72 + + Summary: + some framework for adding subsystem handlers in server mode + Revision: + secsh--dev--1.0--patch-72 + + you can now register a subsystem with a Transport by passing in the name + (like "sftp") and a class (like a hypothetical SFTPServer). the default + ServerInterface.check_channel_request_subsystem now checks this table in + Transport, and if it finds a match, it creates a new thread for the handler + and calls into it. a new class SubsystemHandler is added for this purpose + (to be subclassed). + + modified files: + paramiko/server.py paramiko/transport.py + + +2004-09-05 07:37:40 GMT Robey Pointer patch-71 + + Summary: + remove redundant 'auth_complete' member + Revision: + secsh--dev--1.0--patch-71 + + remove the redundant 'auth_complete' field and just use 'authenticated' for + both client and server mode. this makes the repr() string look correct in + server mode instead of always claiming that the transport is un-auth'd. + + modified files: + paramiko/auth_transport.py + + +2004-09-03 22:39:20 GMT Robey Pointer patch-70 + + Summary: + clean up server interface; no longer need to subclass Channel + Revision: + secsh--dev--1.0--patch-70 + + - export AUTH_*, OPEN_FAILED_*, and the new OPEN_SUCCEEDED into the paramiko + namespace instead of making people dig into paramiko.Transport.AUTH_* etc. + - move all of the check_* methods from Channel to ServerInterface so apps + don't need to subclass Channel anymore just to run an ssh server + - ServerInterface.check_channel_request() returns an error code now, not a + new Channel object + - fix demo_server.py to follow all these changes + - fix a bunch of places where i used "string" in docstrings but meant "str" + - added Channel.get_id() + + modified files: + README demo_server.py paramiko/__init__.py + paramiko/auth_transport.py paramiko/channel.py + paramiko/common.py paramiko/server.py paramiko/sftp.py + paramiko/transport.py + + +2004-08-31 02:44:56 GMT Robey Pointer patch-69 + + Summary: + clean up SecurityOptions + Revision: + secsh--dev--1.0--patch-69 + + the preferences are now tuples in Transport, and passed as tuples out of + SecurityOptions, so that the options can't be modified without setting them + back to the options field again. the algorithm lists in Transport are used + to validate the fields. + + modified files: + paramiko/transport.py + + +2004-08-30 20:22:10 GMT Robey Pointer patch-68 + + Summary: + added Transport.get_security_options() + Revision: + secsh--dev--1.0--patch-68 + + just something i wanted to play with: + added Transport.get_security_options() which returns a SecurityOptions object. + this object is a kind of proxy for the 4 "preferred_*" fields in Transport, + and lets me avoid exposing those fields directly in case i change my mind + later about how they should be stored. + + added some docs to Channel explaining that the request methods now return + True/False, and fixed up docs in a few other places. + + modified files: + paramiko/__init__.py paramiko/channel.py paramiko/server.py + paramiko/sftp.py paramiko/transport.py + + +2004-08-28 04:21:12 GMT Robey Pointer patch-67 + + Summary: + replay patch 63 (missing channel changes) + Revision: + secsh--dev--1.0--patch-67 + + i'm still getting the hang of tla/arch, obviously. + + replay patch 63, which was meant to be part of the later mega-patch, but + apparently when i reversed it, i lost it entirely. + + modified files: + paramiko/channel.py + + +2004-08-27 00:57:40 GMT Robey Pointer patch-66 + + Summary: + new ServerInterface class, outbound rekey works, etc. + Revision: + secsh--dev--1.0--patch-66 + + a bunch of changes that i'm too lazy to split out into individual patches: + * all the server overrides from transport.py have been moved into a separate + class ServerInterface, so server code doesn't have to subclass the whole + paramiko library + * updated demo_server to subclass ServerInterface + * when re-keying during a session, block other messages until the new keys + are activated (openssh doensn't like any other traffic during a rekey) + * re-key when outbound limits are tripped too (was only counting inbound + traffic) + * don't log scary things on EOF + + + new files: + paramiko/.arch-ids/server.py.id paramiko/server.py + + modified files: + README demo_server.py paramiko/__init__.py + paramiko/auth_transport.py paramiko/transport.py + + +2004-08-27 00:28:33 GMT Robey Pointer patch-65 + + Summary: + add settimeout/gettimeout/setblocking, some bugfixes. + Revision: + secsh--dev--1.0--patch-65 + + hide the command and response codes in sftp so they aren't exported. + add settimeout/gettimeout/setblocking that just wrap calls to the underlying + socket or channel. fix _read_all to not catch timeout exceptions. + + + modified files: + paramiko/sftp.py + + +2004-08-27 00:26:35 GMT Robey Pointer patch-64 + + Summary: + reverse messed-up patch + Revision: + secsh--dev--1.0--patch-64 + + Patches applied: + + * robey@lag.net--2003-public/secsh--dev--1.0--base-0 + initial import + + * robey@lag.net--2003-public/secsh--dev--1.0--patch-1 + no changes + + + modified files: + paramiko/channel.py {arch}/=tagging-method + + +2004-08-27 00:06:42 GMT Robey Pointer patch-63 + + Summary: + add settimeout/gettimeout/setblocking, some bugfixes. + Revision: + secsh--dev--1.0--patch-63 + + hide the command and response codes in sftp so they aren't exported. + add settimeout/gettimeout/setblocking that just wrap calls to the underlying + socket or channel. fix _read_all to not catch timeout exceptions. + + modified files: + paramiko/channel.py + + +2004-06-27 20:14:15 GMT Robey Pointer patch-62 + + Summary: + version -> horsea + Revision: + secsh--dev--1.0--patch-62 + + up version to horsea. + + modified files: + Makefile README paramiko/__init__.py setup.py + {arch}/secsh/secsh--dev/secsh--dev--1.0/robey@lag.net--2003-public/patch-log/patch-1 + + +2004-06-10 18:12:00 GMT Robey Pointer patch-61 + + Summary: + no more Foobar + Revision: + secsh--dev--1.0--patch-61 + + fix "Foobar" to be "Paramiko" in the one place i missed it in all the gpl + headers. sigh. :) + + modified files: + paramiko/__init__.py paramiko/auth_transport.py + paramiko/ber.py paramiko/common.py paramiko/dsskey.py + paramiko/kex_gex.py paramiko/kex_group1.py + paramiko/logging22.py paramiko/message.py paramiko/pkey.py + paramiko/primes.py paramiko/rsakey.py + paramiko/ssh_exception.py paramiko/util.py test.py + + +2004-06-10 18:08:50 GMT Robey Pointer patch-60 + + Summary: + limit read/write requests to 32KB, advertise 32KB max packet size + Revision: + secsh--dev--1.0--patch-60 + + one of the unit tests was failing because the openssh sftp server was dropping + the connection without any error. turns out they have a maximum allowed write + size (possibly around 64KB). the sftp rfcs have a small hint that some servers + may drop read/write requests of greater than 32KB. + + so, all reads are limited to 32KB, and all writes > 32KB are now chopped up + and sent in 32KB chunks. this seems to keep openssh happy. + + also, we now advertise 32KB max packet size instead of 8KB (the speed + improves a lot), and log when we read/write a packet. and sftp files are + flushed on seek. + + modified files: + paramiko/sftp.py paramiko/transport.py + + +2004-06-10 18:02:13 GMT Robey Pointer patch-59 + + Summary: + speed up parts of BufferedFile + Revision: + secsh--dev--1.0--patch-59 + + BufferedFile uses cStringIO for the write buffer now (i don't actually notice + any speed difference so this might revert later) and the default buffer size + has been upped from 1KB to 8KB. + + when scanning for linefeeds (when writing to a line-buffered file), only scan + the newly-written bytes, since we know all the previously buffered data is + linefeed-free. this was the #1 slowdown on the 1MB-file unit test. + + also, limit the buffering on line-buffered files to whatever the default + buffer size is. there's no reason to buffer 1MB waiting for a linefeed. + + modified files: + paramiko/file.py + + +2004-06-10 17:55:17 GMT Robey Pointer patch-58 + + Summary: + some Channel fixes for max packet size & blocking on zero window + Revision: + secsh--dev--1.0--patch-58 + + some clean-ups and fixes to channels: + * when send() is blocked on a zero-width window, check that the channel is + still open. this was causing some lockups. + * set a lower bound to the "maximum packet size" we accept from the remote + host. if they tell us anything less than 1KB, assume they meant 1KB. (it's + not reasonable to fragment below that.) + * leave a little padding instead of cutting right up to the maximum packet + size: some space will be taken up by protocol overhead. + * turn off some of the debug log lines unless "ultra_debug" is on (nobody + cares about the feed info) + + + modified files: + paramiko/channel.py + + +2004-06-10 17:35:30 GMT Robey Pointer patch-57 + + Summary: + more unit tests + Revision: + secsh--dev--1.0--patch-57 + + add a unit test for sending a large (1MB) file with line buffering but no + linefeeds (this triggered several bugs and inefficiencies), and another test + to verify that the write buffer is flushed on seek. + + modified files: + tests/test_file.py tests/test_sftp.py + + +2004-05-31 23:48:10 GMT Robey Pointer patch-56 + + Summary: + add forward.py demo script; bump to gyarados + Revision: + secsh--dev--1.0--patch-56 + + add a demo script to show how to do local port forwarding. + + add gyarados to all the docs and bump the version number everywhere. + + new files: + .arch-ids/forward.py.id forward.py + + modified files: + MANIFEST.in Makefile README paramiko/__init__.py setup.py + + +2004-05-29 18:58:11 GMT Robey Pointer patch-55 + + Summary: + add an sftp unit test for making 100 files + Revision: + secsh--dev--1.0--patch-55 + + create 100 files on the remote server, set their mode with chmod, then verify + that they're all there and contain the right data. valeriy is reporting that + sometimes he's getting stuck after 20 and though i'm not seeing it, i want to + add a test to try to pin it down. + + modified files: + tests/test_sftp.py + + +2004-05-29 18:56:10 GMT Robey Pointer patch-54 + + Summary: + add direct-tcpip ability to open_channel + Revision: + secsh--dev--1.0--patch-54 + + open_channel can now be given a dest_addr and src_addr, which are filled in + if the channel type is "forwarded-tcpip" or "direct-tcpip". these channel + types are used in remote & local port forwarding, respectively. i've only + tested "direct-tcpip" but i think if one works, they both should work. + + also fixed a bug in connect where it was still assuming the old meaning for + get_remove_server_key() (oops!) and changed the sense of a send() failure + from <= 0 to < 0 since it may be possible for send() to return 0 and it not + be an EOF error. + + modified files: + paramiko/transport.py + + +2004-05-29 18:48:23 GMT Robey Pointer patch-53 + + Summary: + add note about utf8 encodings + Revision: + secsh--dev--1.0--patch-53 + + add info to the README about what to do if python complains about missing + encodings. veleriy pogrebitskiy ran into this and had advice. + + modified files: + README + + +2004-05-17 07:41:50 GMT Robey Pointer patch-52 + + Summary: + fix deadlock in closing a channel + Revision: + secsh--dev--1.0--patch-52 + + closing a channel would enter an odd codepath where the lock was grabbed, + some stuff was done, then another function was called where the lock was + grabbed again. unfortunately python locks aren't monitors so this would + deadlock. instead, make the smaller function lock-free with an explicit + notice that you must be holding the lock before calling. + + modified files: + paramiko/channel.py + + +2004-05-17 00:43:43 GMT Robey Pointer patch-51 + + Summary: + fix utf8, raise packet size, log exceptions, be more lax with sfp servers + Revision: + secsh--dev--1.0--patch-51 + + explicitly import utf8 encodings for "freezing" (and also because not all + platforms come with utf8, apparently). raise the max acceptable packet size + to 8kB, cuz 2kB was too low. log exceptions at error level instead of debug + level. and don't reject older sftp servers. + + modified files: + paramiko/auth_transport.py paramiko/sftp.py + paramiko/transport.py + + +2004-04-23 22:55:16 GMT Robey Pointer patch-50 + + Summary: + fearow date and last-minute fixes + Revision: + secsh--dev--1.0--patch-50 + + update release date of fearow to 23apr. fix channel._set_closed() to grab + the lock before notifying the in/out buffers that the channel is closed. + try roger's trick for finding the home folder on windows. + + modified files: + Makefile README paramiko/__init__.py paramiko/channel.py + paramiko/common.py + + +2004-04-08 06:31:08 GMT Robey Pointer patch-49 + + Summary: + fix doc typos + Revision: + secsh--dev--1.0--patch-49 + + + modified files: + paramiko/dsskey.py paramiko/rsakey.py paramiko/transport.py + + +2004-04-08 05:48:16 GMT Robey Pointer patch-48 + + Summary: + set version number to fearow + Revision: + secsh--dev--1.0--patch-48 + + set version number to fearow. + + modified files: + Makefile README paramiko/__init__.py setup.py + + +2004-04-08 05:12:20 GMT Robey Pointer patch-47 + + Summary: + add socket.timeout for py22 + Revision: + secsh--dev--1.0--patch-47 + + oops, forgot this vital part of the py22 patches. roger binns sent me a + code patch that included this snip. + + modified files: + paramiko/common.py + + +2004-04-07 16:05:48 GMT Robey Pointer patch-46 + + Summary: + README update notes + Revision: + secsh--dev--1.0--patch-46 + + added notes on what's new, what to watch out for in py22. added a "since: + fearow" to all the relevant API calls that are new. + + modified files: + README paramiko/auth_transport.py paramiko/dsskey.py + paramiko/pkey.py paramiko/rsakey.py paramiko/transport.py + + +2004-04-07 15:52:07 GMT Robey Pointer patch-45 + + Summary: + add set_keepalive() + Revision: + secsh--dev--1.0--patch-45 + + add set_keepalive() to set an automatic keepalive mechanism. (while waiting + for a packet on a connection, we periodically check if it's time to send a + keepalive packet.) + + modified files: + paramiko/transport.py + + +2004-04-07 06:07:29 GMT Robey Pointer patch-44 + + Summary: + add get_username() method for remembering who you auth'd as + Revision: + secsh--dev--1.0--patch-44 + + add get_username() method for remembering who you auth'd as. also, fix these + bugs: + * "continue" auth response counted as a failure (in server mode). + * try to import 'logging' in py22 before falling back to the fake logger, + in case they have a backported version of 'logger' + * raise the right exception when told to read a private key from a file that + isn't a private key file + * tell channels to close when the transport dies + + modified files: + paramiko/auth_transport.py paramiko/channel.py + paramiko/common.py paramiko/pkey.py paramiko/transport.py + + +2004-04-06 22:03:21 GMT Robey Pointer patch-43 + + Summary: + fix encrypted private key files + Revision: + secsh--dev--1.0--patch-43 + + the random byte padding on private key files' BER data was confusing openssh, + so switch to null-byte padding, which is slightly less secure but works with + crappy old openssh. also, enforce the mode when writing the private key + file. we really really want it to be 0600. (python seems to ignore the + mode normally.) + + modified files: + paramiko/pkey.py + + +2004-04-06 08:16:02 GMT Robey Pointer patch-42 + + Summary: + support py22, more or less + Revision: + secsh--dev--1.0--patch-42 + + add roger binns' patches for supporting python 2.2. i hedged a bit on the + logging stuff and just added some trickery to let logging be stubbed out for + python 2.2. this changed a lot of import statements but i managed to avoid + hacking at any of the existing logging. + + socket timeouts are required for the threads to notice when they've been + deactivated. worked around it by using the 'select' module on py22. + + also fixed the sftp unit tests to cope with a password-protected private key. + + new files: + paramiko/.arch-ids/logging22.py.id paramiko/logging22.py + + modified files: + README demo.py demo_server.py demo_simple.py + paramiko/__init__.py paramiko/auth_transport.py + paramiko/channel.py paramiko/common.py paramiko/kex_gex.py + paramiko/kex_group1.py paramiko/message.py paramiko/sftp.py + paramiko/transport.py paramiko/util.py tests/test_sftp.py + + +2004-04-05 22:32:03 GMT Robey Pointer patch-41 + + Summary: + make get_remote_server_key() return a PKey object + Revision: + secsh--dev--1.0--patch-41 + + a good suggestion from roger binns: make get_remote_server_key() just return + a pkey object instead of a tuple of strings. all the strings can be extracted + from the pkey object, as well as other potentially useful things. + + modified files: + demo.py paramiko/transport.py + + +2004-04-05 19:36:40 GMT Robey Pointer patch-40 + + Summary: + add dss key generation too, and fix some bugs + Revision: + secsh--dev--1.0--patch-40 + + added the ability to generate dss keys and write private dss key files, + similar to rsa. in the process, fixed a couple of bugs with ber encoding + and writing password-encrypted key files. the key has to be padded to the + iblock size of the cipher -- it's very difficult to determine how the others + do this, so i just add random bytes to the end. + + fixed the simple demo to use Transport's (host, port) constructor for + simplicity, and fixed a bug where the standard demo's DSS login wouldn't + work. + + also, move the common logfile setup crap into util so all the demos can just + call that one. + + modified files: + demo.py demo_simple.py paramiko/ber.py paramiko/dsskey.py + paramiko/pkey.py paramiko/rsakey.py paramiko/util.py + + +2004-04-05 10:37:18 GMT Robey Pointer patch-39 + + Summary: + add global request mechanism + Revision: + secsh--dev--1.0--patch-39 + + add transport.global_request() to make a global-style request (usually an + extension to the protocol -- like keepalives) and handle requests from the + remote host. incoming requests are now handled and responded to correctly, + which should make openssh-style keepalives work. (before, we would silently + ignore them, which was wrong.) + + modified files: + paramiko/common.py paramiko/message.py paramiko/transport.py + + +2004-04-05 10:24:33 GMT Robey Pointer patch-38 + + Summary: + add common.py file + Revision: + secsh--dev--1.0--patch-38 + + missing from previous change because tla doesn't like to add files in some + situations. (frown) + + + new files: + paramiko/.arch-ids/common.py.id paramiko/common.py + + +2004-04-05 10:16:31 GMT Robey Pointer patch-37 + + Summary: + can now generate rsa keys (not dss yet) + Revision: + secsh--dev--1.0--patch-37 + + added functionality to ber to create ber streams. added some common methods + to PKey to allow dumping the key to base64 (the format used by openssh for + public key files and host key lists), and a factory for creating a key from + a private key file, and a common way to save private keys. RSAKey luckily + didn't have to change that much. + + also added a factory method to RSAKey to generate a new key. + + + modified files: + paramiko/ber.py paramiko/pkey.py paramiko/rsakey.py + + +2004-04-05 10:12:59 GMT Robey Pointer patch-36 + + Summary: + add common.py for commonly used constants and globals + Revision: + secsh--dev--1.0--patch-36 + + common.py now stores the constants and globals. + lots of renaming because of this. + + modified files: + paramiko/auth_transport.py paramiko/channel.py + paramiko/kex_gex.py paramiko/kex_group1.py + paramiko/transport.py paramiko/util.py + + +2004-04-02 02:41:43 GMT Robey Pointer patch-35 + + Summary: + add send_ignore + Revision: + secsh--dev--1.0--patch-35 + + add send_ignore() call to allow for sending garbage ignored packets to the + remote side. + + modified files: + paramiko/transport.py + + +2004-03-16 07:33:09 GMT Robey Pointer patch-34 + + Summary: + fix some arcana in unpacking private keys + Revision: + secsh--dev--1.0--patch-34 + + "!= type([])" is a pretty obscure way to say it. let's try "is not list" + which is a lot more readable. + + (mostly this is a test to make sure tla is working okay on my laptop.) + + modified files: + paramiko/dsskey.py paramiko/rsakey.py + + +2004-03-09 01:09:17 GMT Robey Pointer patch-33 + + Summary: + include tests in manifest + Revision: + secsh--dev--1.0--patch-33 + + include the tests in the manifest for dist, and remove some outdated notes in + NOTES about the exported API (this is doc'd wayyy better in epydoc now). + + modified files: + MANIFEST.in NOTES + + +2004-03-08 17:54:19 GMT Robey Pointer patch-32 + + Summary: + add unit tests + Revision: + secsh--dev--1.0--patch-32 + + add unit tests for BufferedFile and SFTP (it's a start). remove the demo sftp + client because it was 99% copied from the other demos, which makes it kinda + confusing. the unit tests are a much better example. + + new files: + .arch-ids/test.py.id test.py tests/.arch-ids/=id + tests/.arch-ids/test_file.py.id + tests/.arch-ids/test_sftp.py.id tests/test_file.py + tests/test_sftp.py + + removed files: + .arch-ids/demo_sftp.py.id demo_sftp.py + + new directories: + tests tests/.arch-ids + + +2004-03-08 17:52:25 GMT Robey Pointer patch-31 + + Summary: + bump version number to eevee + Revision: + secsh--dev--1.0--patch-31 + + bump the version number to eevee in a few places and talk about the unit + tests. + + modified files: + Makefile README paramiko/__init__.py setup.py + + +2004-03-08 17:50:49 GMT Robey Pointer patch-30 + + Summary: + finish up client sftp support + Revision: + secsh--dev--1.0--patch-30 + + added 'stat' to SFTPFile and SFTP, documented 'open' and 'listdir', and added + 'rmdir', 'lstat', 'symlink', 'chmod', 'chown', 'utime', 'readlink'. + + turned off ultra debugging now that the unit tests are all working. + + modified files: + paramiko/sftp.py + + +2004-03-08 17:45:44 GMT Robey Pointer patch-29 + + Summary: + fix some docs and BufferedFile.readline + Revision: + secsh--dev--1.0--patch-29 + + fix some documentation and fix readline()'s universal newline support to + always return strings ending with '\n', regardless of how they were in the + original file. (this is an obvious feature of python's universal newline + support that i somehow missed before.) + + modified files: + paramiko/file.py paramiko/message.py + + +2004-03-08 09:47:47 GMT Robey Pointer patch-28 + + Summary: + fix lingering thread bug + Revision: + secsh--dev--1.0--patch-28 + + this bug has been in there forever and i could never figure out a workaround + till now. + + when the python interpreter exits, it doesn't necessarily destroy the + remaining objects or call __del__ on anything, and it will lock up until all + threads finish running. how the threads are supposed to notice the exiting + interpreter has always been sort of a mystery to me. + + tonight i figured out how to use the 'atexit' module to register a handler + that runs when the interpreter exits. now we keep a list of active threads + and ask them all to exit on shutdown. no more going to another shell to + kill -9 python! yeah!! + + modified files: + paramiko/transport.py + + +2004-03-04 08:21:45 GMT Robey Pointer patch-27 + + Summary: + add BufferedFile abstraction + Revision: + secsh--dev--1.0--patch-27 + + SFTP client mode is mostly functional. there are probably still some bugs + but most of the operations on "file" objects have survived my simple tests. + + BufferedFile wraps a simpler stream in something that looks like a python + file (and can even handle seeking if the stream underneath supports it). + it's meant to be subclassed. most of it is ripped out of what used to be + ChannelFile so i can reuse it for sftp -- ChannelFile is now tiny. + + SFTP and Message are now exported. + + fixed util.format_binary_line to not quote spaces. + + new files: + .arch-ids/demo_sftp.py.id demo_sftp.py + paramiko/.arch-ids/file.py.id paramiko/.arch-ids/sftp.py.id + paramiko/file.py paramiko/sftp.py + + modified files: + paramiko/__init__.py paramiko/channel.py paramiko/message.py + paramiko/util.py + + +2004-01-27 02:04:59 GMT Robey Pointer patch-26 + + Summary: + Transport constructor can take hostname or address tuple + Revision: + secsh--dev--1.0--patch-26 + + part of an ongoing attempt to make "simple" versions of some of the API calls, + so you can do common-case operations with just a few calls: + + Transport's constructor will now let you pass in a string or tuple instead + of a socket-like object. if you pass in a string, it assumes the string is + a hostname (with optional ":port" segment) and turns that into an address + tuple. if you pass in a tuple, it assumes it's an address tuple. in both + cases, it then creates a socket, connects to the given address, and then + continues as if that was the socket passed in. + + the idea being that you can call Transport('example.com') and it will do + the right thing. + + modified files: + paramiko/transport.py + + +2004-01-27 02:00:19 GMT Robey Pointer patch-25 + + Summary: + pkey no longer raises binascii.Error + Revision: + secsh--dev--1.0--patch-25 + + catch binascii.Error in the private key decoder and convert it into an + SSHException. there's no reason people should have to care that it was a + decoding error vs. any of the other million things that could be wrong in + a corrupt key file. + + modified files: + paramiko/pkey.py + + +2004-01-27 01:45:44 GMT Robey Pointer patch-24 + + Summary: + document more of Message; add get_int64 + Revision: + secsh--dev--1.0--patch-24 + + all of the get_* methods are now documented, but there's a bit more to do. + get_int64 added for eventual sftp support. + + modified files: + paramiko/message.py + + +2004-01-04 10:33:05 GMT Robey Pointer patch-23 + + Summary: + quick doc fix. + Revision: + secsh--dev--1.0--patch-23 + + fix broken cross-link in kex_gex docs. + + modified files: + paramiko/kex_gex.py + + +2004-01-04 10:26:00 GMT Robey Pointer patch-22 + + Summary: + fix MANIFEST.in, change version numbers to 0.9-doduo, fix LPGL notices + Revision: + secsh--dev--1.0--patch-22 + + fixed MANIFEST.in to include the demo scripts, LICENSE, and ChangeLog. + upped everything to version 0.9-doduo. + + fixed the copyright notice, and added the LGPL banner to the top of every + python file. + + modified files: + MANIFEST.in Makefile NOTES README paramiko/__init__.py + paramiko/auth_transport.py paramiko/ber.py paramiko/channel.py + paramiko/dsskey.py paramiko/kex_gex.py paramiko/kex_group1.py + paramiko/message.py paramiko/pkey.py paramiko/primes.py + paramiko/rsakey.py paramiko/ssh_exception.py + paramiko/transport.py paramiko/util.py setup.py + + +2004-01-04 10:07:35 GMT Robey Pointer patch-21 + + Summary: + MANIFEST -> MANIFEST.in, fix setup.py. + Revision: + secsh--dev--1.0--patch-21 + + out with MANIFEST, in with MANIFEST.in. + + new files: + .arch-ids/MANIFEST.in.id MANIFEST.in + + removed files: + .arch-ids/MANIFEST.id MANIFEST + + modified files: + setup.py + + +2004-01-04 09:29:13 GMT Robey Pointer patch-20 + + Summary: + more docs, and password-protected key files can now be read + Revision: + secsh--dev--1.0--patch-20 + + lots more documentation, some of it moved out of the README file, which is + now much smaller and less rambling. + + repr(Transport) now reports the number of bits used in the cipher. + + cleaned up BER to use util functions, and throw a proper exception (the new + BERException) on error. it doesn't ever have to be a full BER decoder, but + it can at least comb its hair and tuck in its shirt. + + lots of stuff added to PKey.read_private_key_file so it can try to decode + password-protected key files. right now it only understands "DES-EDE3-CBC" + format, but this is the only format i've seen openssh make so far. if the + key is password-protected, but no password was given, a new exception + (PasswordRequiredException) is raised so an outer layer can ask for a password + and try again. + + modified files: + README demo.py demo_server.py paramiko/__init__.py + paramiko/auth_transport.py paramiko/ber.py paramiko/channel.py + paramiko/dsskey.py paramiko/pkey.py paramiko/primes.py + paramiko/rsakey.py paramiko/ssh_exception.py + paramiko/transport.py paramiko/util.py + + +2003-12-31 06:31:43 GMT Robey Pointer patch-19 + + Summary: + renamed auth_key -> auth_publickey; more docs. + Revision: + secsh--dev--1.0--patch-19 + + renamed Transport.auth_key to auth_publickey for consistency. and lots more + documentation. + + modified files: + README demo.py demo_server.py paramiko/__init__.py + paramiko/auth_transport.py paramiko/transport.py + + +2003-12-30 22:24:21 GMT Robey Pointer patch-18 + + Summary: + added public-key support to server mode, more docs + Revision: + secsh--dev--1.0--patch-18 + + added public-key support to server mode (it can now verify a client signature) + and added a demo of that to the demo_server.py script (user_rsa_key). in the + process, cleaned up the API of PKey so that now it only has to know about + signing and verifying ssh2 blobs, and can be hashed and compared with other + keys (comparing & hashing only the public parts of the key). keys can also + be created from strings now too. + + some more documentation and hiding private methods. + + new files: + .arch-ids/user_rsa_key.id .arch-ids/user_rsa_key.pub.id + user_rsa_key user_rsa_key.pub + + modified files: + Makefile demo_server.py paramiko/__init__.py + paramiko/auth_transport.py paramiko/dsskey.py + paramiko/kex_gex.py paramiko/kex_group1.py paramiko/pkey.py + paramiko/rsakey.py paramiko/transport.py + + +2003-12-30 07:18:20 GMT Robey Pointer patch-17 + + Summary: + lots more documentation, and added Transport.connect() + Revision: + secsh--dev--1.0--patch-17 + + renamed demo_host_key to demo_rsa_key. moved changelog to a separate file, + and indicated that future changelog entries should be fetched from tla. + tried to clean up "__all__" in a way that makes epydoc still work. + + added lots more documentation, and renamed many methods and vars to hide + them as private non-exported API. + + Transport's ModulusPack is now a static member, so it only has to be loaded + once, and can then be used by any future Transport object. + + added Transport.connect(), which tries to wrap all the SSH2 negotiation and + authentication into one method. you should be able to create a Transport, + call connect(), and then create channels. + + new files: + .arch-ids/ChangeLog.id .arch-ids/demo_simple.py.id ChangeLog + demo_simple.py paramiko/.arch-ids/pkey.py.id paramiko/pkey.py + + removed files: + .arch-ids/paramiko.py.id paramiko.py + + modified files: + Makefile NOTES README demo.py demo_server.py + paramiko/__init__.py paramiko/auth_transport.py + paramiko/channel.py paramiko/dsskey.py paramiko/kex_gex.py + paramiko/kex_group1.py paramiko/rsakey.py + paramiko/transport.py setup.py {arch}/=tagging-method + + renamed files: + .arch-ids/demo_host_key.id + ==> .arch-ids/demo_rsa_key.id + demo_host_key + ==> demo_rsa_key + + +2003-12-28 03:20:42 GMT Robey Pointer patch-16 + + Summary: + hook up server-side kex-gex; add more documentation + Revision: + secsh--dev--1.0--patch-16 + + group-exchange kex should work now on the server side. it will only be + advertised if a "moduli" file has been loaded (see the -gasp- docs) so we + don't spend hours (literally. hours.) computing primes. some of the logic + was previously wrong, too, since it had never been tested. + + fixed repr() string for Transport/BaseTransport. moved is_authenticated to + Transport where it belongs. + + added lots of documentation (but still only about 10% documented). lots of + methods were made private finally. + + new files: + paramiko/.arch-ids/primes.py.id paramiko/primes.py + + modified files: + NOTES demo.py demo_server.py paramiko/__init__.py + paramiko/auth_transport.py paramiko/channel.py + paramiko/kex_gex.py paramiko/kex_group1.py + paramiko/transport.py paramiko/util.py + + +2003-12-27 02:03:44 GMT Robey Pointer patch-15 + + Summary: + fix up new paramiko/ folder. + Revision: + secsh--dev--1.0--patch-15 + + moved SSHException to a new file (ssh_exception.py) and turned paramiko.py + into an __init__.py file. i'm still not entirely sure how this normally + works, so i may have done something wrong, but it's supposed to work the + same as before. + + new files: + paramiko/.arch-ids/__init__.py.id + paramiko/.arch-ids/ssh_exception.py.id paramiko/__init__.py + paramiko/ssh_exception.py + + modified files: + paramiko/auth_transport.py paramiko/channel.py + paramiko/dsskey.py paramiko/kex_gex.py paramiko/kex_group1.py + paramiko/transport.py + + +2003-12-27 01:49:19 GMT Robey Pointer patch-14 + + Summary: + move the paramiko files into a paramiko/ folder. + Revision: + secsh--dev--1.0--patch-14 + + just moving the files into a folder. it won't build this way yet. + + new files: + paramiko/.arch-ids/=id + + renamed files: + .arch-ids/auth_transport.py.id + ==> paramiko/.arch-ids/auth_transport.py.id + .arch-ids/ber.py.id + ==> paramiko/.arch-ids/ber.py.id + .arch-ids/channel.py.id + ==> paramiko/.arch-ids/channel.py.id + .arch-ids/dsskey.py.id + ==> paramiko/.arch-ids/dsskey.py.id + .arch-ids/kex_gex.py.id + ==> paramiko/.arch-ids/kex_gex.py.id + .arch-ids/kex_group1.py.id + ==> paramiko/.arch-ids/kex_group1.py.id + .arch-ids/message.py.id + ==> paramiko/.arch-ids/message.py.id + .arch-ids/rsakey.py.id + ==> paramiko/.arch-ids/rsakey.py.id + .arch-ids/transport.py.id + ==> paramiko/.arch-ids/transport.py.id + .arch-ids/util.py.id + ==> paramiko/.arch-ids/util.py.id + auth_transport.py + ==> paramiko/auth_transport.py + ber.py + ==> paramiko/ber.py + channel.py + ==> paramiko/channel.py + dsskey.py + ==> paramiko/dsskey.py + kex_gex.py + ==> paramiko/kex_gex.py + kex_group1.py + ==> paramiko/kex_group1.py + message.py + ==> paramiko/message.py + rsakey.py + ==> paramiko/rsakey.py + transport.py + ==> paramiko/transport.py + util.py + ==> paramiko/util.py + + new directories: + paramiko paramiko/.arch-ids + + +2003-12-24 22:09:43 GMT Robey Pointer patch-13 + + Summary: + fix a deadlock/race in handle_eof & close + Revision: + secsh--dev--1.0--patch-13 + + (patch from fred gansevles) + add locking around the eof handler and the close() call, so we can't be in + both simultaneously. + + modified files: + channel.py + + +2003-12-24 20:49:38 GMT Robey Pointer patch-12 + + Summary: + fix dss key signing + Revision: + secsh--dev--1.0--patch-12 + + (expanded on a patch from fred gansevles) + add a demo dss key for server mode, and fix some bugs that had caused the dss + signing stuff to never work before. the demo_server is a bit more verbose + now, too. both key types (RSAKey & DSSKey) now have a function to return the + fingerprint of the key, and both versions of read_private_key_file() now raise + exceptions on failure, instead of just silently setting "valid" to false. + + new files: + .arch-ids/demo_dss_key.id demo_dss_key + + modified files: + demo_server.py dsskey.py kex_gex.py kex_group1.py paramiko.py + rsakey.py transport.py + + +2003-12-23 06:44:56 GMT Robey Pointer patch-11 + + Summary: + in server mode, don't offer keys we don't have + Revision: + secsh--dev--1.0--patch-11 + + (from Paolo Losi) in server mode, when advertising which key methods we + support, don't list methods that we don't have any existing keys for. + + modified files: + transport.py + + +2003-12-23 06:36:27 GMT Robey Pointer patch-10 + + Summary: + add logfiles and .pyc files to the "junk" list + Revision: + secsh--dev--1.0--patch-10 + + add *.log and *.pyc to the explicit junk list. + + modified files: + {arch}/=tagging-method + + +2003-11-10 08:49:50 GMT Robey Pointer patch-9 + + Summary: + rename secsh -> paramiko + Revision: + secsh--dev--1.0--patch-9 + + also, rename SecshException back to SSHException. sigh. :) + + modified files: + ./MANIFEST ./Makefile ./NOTES ./README ./auth_transport.py + ./channel.py ./demo.py ./demo_server.py ./kex_gex.py + ./kex_group1.py ./message.py ./paramiko.py ./setup.py + ./transport.py + + renamed files: + ./.arch-ids/secsh.py.id + ==> ./.arch-ids/paramiko.py.id + ./secsh.py + ==> ./paramiko.py + + +2003-11-10 06:52:35 GMT Robey Pointer patch-8 + + Summary: + doc changes + Revision: + secsh--dev--1.0--patch-8 + + + modified files: + ./README ./demo_server.py ./secsh.py + + +2003-11-10 04:54:02 GMT Robey Pointer patch-7 + + Summary: + cleaned up server code, renamed some files & classes + Revision: + secsh--dev--1.0--patch-7 + + renamed demo-server.py and demo-host-key to demo_server.py and + demo_host_key, just to be consistent. + + renamed SSHException -> SecshException. + + generalized the mechanism where Channel decides whether to allow + different channel requests: 4 of the main ones (pty, window-change, + shell, and subsystem) go through easily override-able methods now. + you could probably make an actual ssh shell server. + + gave ChannelFile a repr(). + + turned off ultra debugging in the demos. demo_server creates a + subclass of Channel to allow pty/shell and sets an event when the + shell request is made, so that it knows when it can start sending + the fake bbs. + + renamed to charmander and updated some of the distutils files. + + modified files: + ./MANIFEST ./NOTES ./auth_transport.py ./channel.py ./demo.py + ./demo_server.py ./kex_gex.py ./kex_group1.py ./secsh.py + ./setup.py ./transport.py + + renamed files: + ./.arch-ids/demo-host-key.id + ==> ./.arch-ids/demo_host_key.id + ./.arch-ids/demo-server.py.id + ==> ./.arch-ids/demo_server.py.id + ./demo-host-key + ==> ./demo_host_key + ./demo-server.py + ==> ./demo_server.py + + +2003-11-09 21:16:35 GMT Robey Pointer patch-6 + + Summary: + notes about the exported api + Revision: + secsh--dev--1.0--patch-6 + + just wrote some quick notes (for a few of the classes) about which + methods are intended to be the exported API. python has no decent + way of distinguishing private vs public. + + + modified files: + ./NOTES + + +2003-11-09 21:14:21 GMT Robey Pointer patch-5 + + Summary: + big chunk of work which makes server code 95% done + Revision: + secsh--dev--1.0--patch-5 + + fixed auth check methods to return just a result (failed, succeeded, + partially succeeded) and always use get_allowed_auths to determine the + list of allowed auth methods to return. + + channel's internal API changed a bit to allow for client-side vs. + server-side channels. we now honor the "want-reply" bit from channel + requests. in server mode (for now), we automatically allow pty-req + and shell requests without doing anything. + + ChannelFile was fixed up a bit to support universal newlines. readline + got rewritten: the old way used the "greedy" read call from ChannelFile, + which won't work if the socket doesn't have that much data buffered and + ready. now it uses recv directly, and tracks the different newlines. + + demo-server.py now answers to a single shell request (like a CLI ssh + tool will make) and does a very simple demo pretending to be a BBS. + + transport: fixed a bug with parsing the remote side's banner. channel + requests are passed to another method in server mode, to determine if + we should allow it. new allowed channels are added to an accept queue, + and a new method 'accept' (with timeout) will block until the next + incoming channel is ready. + + + modified files: + ./auth_transport.py ./channel.py ./demo-server.py ./demo.py + ./transport.py + + +2003-11-09 20:59:51 GMT Robey Pointer patch-4 + + Summary: + change kex-gex server code to generate primes by hand + Revision: + secsh--dev--1.0--patch-4 + + added a util function "generate_prime" to compare to the incredibly slow C + version, but it's no faster of course. i think kex-gex from the server is + just not going to be feasible without having a separate thread generate some + primes in the background to have handy when a request comes in. so in short, + this still doesn't work. + + also i put bit_length into util and a tb_strings function which gets stack + traceback info and splits it into a list of strings. + + + modified files: + ./kex_gex.py ./util.py + + +2003-11-07 10:36:42 GMT Robey Pointer patch-3 + + Summary: + remove some leftover garbage from dsskey + Revision: + secsh--dev--1.0--patch-3 + + leftover from a cut & paste i was doing a few days ago. bad robey. + + modified files: + ./dsskey.py + + +2003-11-06 07:34:27 GMT Robey Pointer patch-2 + + Summary: + add a demo host key and point demo-server at it. + Revision: + secsh--dev--1.0--patch-2 + + also, temporarily comment out the nonfunctional kex-gex method. + + new files: + ./.arch-ids/demo-host-key.id ./demo-host-key + + modified files: + ./demo-server.py ./transport.py + + +2003-11-04 08:50:22 GMT Robey Pointer patch-1 + + Summary: + no changes + Revision: + secsh--dev--1.0--patch-1 + + why aren't my log messages kept? + + modified files: + ./kex_gex.py + + new patches: + robey@lag.net--2003/secsh--dev--1.0--patch-1 + + +2003-11-04 08:34:24 GMT Robey Pointer base-0 + + Summary: + initial import + Revision: + secsh--dev--1.0--base-0 + + + (automatically generated log message) + + new files: + ./LICENSE ./MANIFEST ./Makefile ./NOTES ./README + ./auth_transport.py ./ber.py ./channel.py ./demo-server.py + ./demo.py ./dsskey.py ./kex_gex.py ./kex_group1.py + ./message.py ./rsakey.py ./secsh.py ./setup.py ./transport.py + ./util.py + + new patches: + robey@lag.net--2003/secsh--dev--1.0--base-0 + + diff --git a/LICENSE b/LICENSE index b1e3f5a..d12bef0 100644 --- a/LICENSE +++ b/LICENSE @@ -2,7 +2,7 @@ Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -485,7 +485,7 @@ convey the exclusion of warranty; and each file should have at least the You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA Also add information on how to contact you by electronic and paper mail. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..572f867 --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ +release: docs + python setup.py sdist register upload + +docs: paramiko/* + epydoc --no-private -o docs/ paramiko + +clean: + rm -rf build dist docs + rm -f MANIFEST *.log demos/*.log + rm -f paramiko/*.pyc + rm -f test.log + rm -rf paramiko.egg-info + +test: + python ./test.py diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..7a983ba --- /dev/null +++ b/NEWS @@ -0,0 +1,473 @@ + +==== +NEWS +==== + +Highlights of what's new in each release. + +Issues noted as "'ssh' #NN" can be found at https://github.com/bitprophet/ssh/. + +Issues noted as "Fabric #NN" can be found at https://github.com/fabric/fabric/. + +Releases +======== + +v1.10.1 (5th Apr 2013) +---------------------- + +* #142: (Fabric #811) SFTP put of empty file will still return the attributes + of the put file. Thanks to Jason R. Coombs for the patch. +* #154: (Fabric #876) Forwarded SSH agent connections left stale local pipes + lying around, which could cause local (and sometimes remote or network) + resource starvation when running many agent-using remote commands. Thanks to + Kevin Tegtmeier for catch & patch. + +v1.10.0 (1st Mar 2013) +-------------------- + +* #66: Batch SFTP writes to help speed up file transfers. Thanks to Olle + Lundberg for the patch. +* #133: Fix handling of window-change events to be on-spec and not + attempt to wait for a response from the remote sshd; this fixes problems with + less common targets such as some Cisco devices. Thanks to Phillip Heller for + catch & patch. +* #93: Overhaul SSH config parsing to be in line with `man ssh_config` (& the + behavior of `ssh` itself), including addition of parameter expansion within + config values. Thanks to Olle Lundberg for the patch. +* #110: Honor SSH config `AddressFamily` setting when looking up local + host's FQDN. Thanks to John Hensley for the patch. +* #128: Defer FQDN resolution until needed, when parsing SSH config files. + Thanks to Parantapa Bhattacharya for catch & patch. +* #102: Forego random padding for packets when running under `*-ctr` ciphers. + This corrects some slowdowns on platforms where random byte generation is + inefficient (e.g. Windows). Thanks to `@warthog618` for catch & patch, and + Michael van der Kolff for code/technique review. +* #127: Turn `SFTPFile` into a context manager. Thanks to Michael Williamson + for the patch. +* #116: Limit `Message.get_bytes` to an upper bound of 1MB to protect against + potential DoS vectors. Thanks to `@mvschaik` for catch & patch. +* #115: Add convenience `get_pty` kwarg to `Client.exec_command` so users not + manually controlling a channel object can still toggle PTY creation. Thanks + to Michael van der Kolff for the patch. +* #71: Add `SFTPClient.putfo` and `.getfo` methods to allow direct + uploading/downloading of file-like objects. Thanks to Eric Buehl for the + patch. +* #113: Add `timeout` parameter to `SSHClient.exec_command` for easier setting + of the command's internal channel object's timeout. Thanks to Cernov Vladimir + for the patch. +* #94: Remove duplication of SSH port constant. Thanks to Olle Lundberg for the + catch. +* #80: Expose the internal "is closed" property of the file transfer class + `BufferedFile` as `.closed`, better conforming to Python's file interface. + Thanks to `@smunaut` and James Hiscock for catch & patch. + +v1.9.0 (6th Nov 2012) +--------------------- + +* #97 (with a little #93): Improve config parsing of `ProxyCommand` directives + and provide a wrapper class to allow subprocess-driven proxy commands to be + used as `sock=` arguments for `SSHClient.connect`. +* #77: Allow `SSHClient.connect()` to take an explicit `sock` parameter + overriding creation of an internal, implicit socket object. +* Thanks in no particular order to Erwin Bolwidt, Oskari Saarenmaa, Steven + Noonan, Vladimir Lazarenko, Lincoln de Sousa, Valentino Volonghi, Olle + Lundberg, and Github user `@acrish` for the various and sundry patches + leading to the above changes. + +v1.8.1 (6th Nov 2012) +--------------------- + +* #90: Ensure that callbacks handed to `SFTPClient.get()` always fire at least + once, even for zero-length files downloaded. Thanks to Github user `@enB` for + the catch. +* #85: Paramiko's test suite overrides + `unittest.TestCase.assertTrue/assertFalse` to provide these modern assertions + to Python 2.2/2.3, which lacked them. However on newer Pythons such as 2.7, + this now causes deprecation warnings. The overrides have been patched to only + execute when necessary. Thanks to `@Arfrever` for catch & patch. + + +v1.8.0 (3rd Oct 2012) +--------------------- + +* #17 ('ssh' 28): Fix spurious `NoneType has no attribute 'error'` and similar + exceptions that crop up on interpreter exit. +* 'ssh' 32: Raise a more useful error explaining which `known_hosts` key line was + problematic, when encountering `binascii` issues decoding known host keys. + Thanks to `@thomasvs` for catch & patch. +* 'ssh' 33: Bring `ssh_config` parsing more in line with OpenSSH spec, re: order of + setting overrides by `Host` specifiers. Specifically, the overrides now go by + file order instead of automatically sorting by `Host` value length. In + addition, the first value found per config key (e.g. `Port`, `User` etc) + wins, instead of the last. Thanks to Jan Brauer for the contribution. +* 'ssh' 36: Support new server two-factor authentication option + (`RequiredAuthentications2`), at least re: combining key-based & password + auth. Thanks to Github user `bninja`. +* 'ssh' 11: When raising an exception for hosts not listed in + `known_hosts` (when `RejectPolicy` is in effect) the exception message was + confusing/vague. This has been improved somewhat. Thanks to Cal Leeming for + highlighting the issue. +* 'ssh' 40: Fixed up & expanded EINTR signal handling. Thanks to Douglas Turk. +* 'ssh' 15: Implemented parameter substitution in SSHConfig, matching the + implementation of `ssh_config(5)`. Thanks to Olle Lundberg for the patch. +* 'ssh' 24: Switch some internal type checking to use `isinstance` to help prevent + problems with client libraries using subclasses of builtin types. Thanks to + Alex Morega for the patch. +* Fabric #562: Agent forwarding would error out (with `Authentication response + too long`) or freeze, when more than one remote connection to the local agent + was active at the same time. This has been fixed. Thanks to Steven McDonald + for assisting in troubleshooting/patching, and to GitHub user `@lynxis` for + providing the final version of the patch. +* 'ssh' 5: Moved a `fcntl` import closer to where it's used to help avoid + `ImportError` problems on Windows platforms. Thanks to Jason Coombs for the + catch + suggested fix. +* 'ssh' 4: Updated implementation of WinPageant integration to work on 64-bit + Windows. Thanks again to Jason Coombs for the patch. +* Added an IO loop sleep() call to avoid needless CPU usage when agent + forwarding is in use. +* Handful of internal tweaks to version number storage. +* Updated `setup.py` with `==dev` install URL for `pip` users. +* Updated `setup.py` to account for packaging problems in PyCrypto 2.4.0 +* Added an extra `atfork()` call to help prevent spurious RNG errors when + running under high parallel (multiprocess) load. +* Merge PR #28: https://github.com/paramiko/paramiko/pull/28 which adds a + ssh-keygen like demo module. (Sofian Brabez) + +v1.7.7.2 16may12 +---------------- + * Merge pull request #63: https://github.com/paramiko/paramiko/pull/63 which + fixes exceptions that occur when re-keying over fast connections. (Dwayne + Litzenberger) + +v1.7.7.1 (George) 21may11 +------------------------- + * Make the verification phase of SFTP.put optional (Larry Wright) + * Patches to fix AIX support (anonymous) + * Patch from Michele Bertoldi to allow compression to be turned on in the + client constructor. + * Patch from Shad Sharma to raise an exception if the transport isn't active + when you try to open a new channel. + * Stop leaking file descriptors in the SSH agent (John Adams) + * More fixes for Windows address family support (Andrew Bennetts) + * Use Crypto.Random rather than Crypto.Util.RandomPool + (Gary van der Merwe, #271791) + * Support for openssl keys (tehfink) + * Fix multi-process support by calling Random.atfork (sugarc0de) + +v1.7.6 (Fanny) 1nov09 +--------------------- + * fixed bugs 411099 (sftp chdir isn't unicode-safe), 363163 & 411910 (more + IPv6 problems on windows), 413850 (race when server closes the channel), + 426925 (support port numbers in host keys) + +v1.7.5 (Ernest) 19jul09 +----------------------- + * added support for ARC4 cipher and CTR block chaining (Denis Bernard) + * made transport threads daemonize, to fix python 2.6 atexit behavior + * support unicode hostnames, and IP6 addresses (Maxime Ripard, Shikhar + Bhushan) + * various small bug fixes + +v1.7.4 (Desmond) 06jul08 +------------------------ + * more randpool fixes for windows, from Dwayne Litzenberger + (NOTE: this may require a pycrypto upgrade on windows) + * fix potential deadlock during key exchange (Dwayne Litzenberger) + * remove MFC dependency from windows (Mark Hammond) + * added some optional API improvements for SFTPClient get() and put() + +v1.7.3 (Clara) 23mar08 +---------------------- + * SSHClient can be asked not to use an SSH agent now, and not to search + for private keys + * added WarningPolicy option for SSHClient (warn, but allow, on unknown + server keys) + * added Channel.exit_status_ready to poll if a channel has received an + exit status yet + * new demo for reverse port forwarding + * (bug 177117) fix UTF-8 passwords + * (bug 189466) fix typo in osrandom.py + * (bug 191657) potentially fix a race at channel shutdown + * (bug 192749) document that SSHClient.connect may raise socket.error + * (bug 193779) translate EOFError into AuthException during authentication + * (bug 200416) don't create a new logger object for each channel + +v1.7.2 (Basil) 21jan08 +---------------------- + * (bug 137219) catch EINTR and handle correctly + * (bug 157205) fix select() to trigger on stderr for a channel too + * added SSHClient.get_transport() + * added Channel.send_ready() + * added direct-tcpip forwarding [patch from david guerizec] + * fixed the PRNG to be more secure on windows and in cases where fork() is + called [patch from dwayne litzenberger] + +v1.7.1 (Amy) 10jun07 +-------------------- + * windows SSH agent support can use the 'ctypes' module now if 'win32all' is + not available [patch from alexander belchenko] + * SFTPClient.listdir_attr() now preserves the 'longname' field [patch from + wesley augur] + * SFTPClient.get_channel() API added + * SSHClient constuctor takes an optional 'timeout' parameter [patch from + james bardin] + +v1.7 (zubat) 18feb07 +-------------------- + * added x11 channel support (patch from david guerizec) + * added reverse port forwarding support + * (bug 75370) raise an exception when contacting a broken SFTP server + * (bug 80295) SSHClient shouldn't expand the user directory twice when reading + RSA/DSS keys + * (bug 82383) typo in DSS key in SSHClient + * (bug 83523) python 2.5 warning when encoding a file's modification time + * if connecting to an SSH agent fails, silently fallback instead of raising + an exception + +v1.6.4 (yanma) 19nov06 +---------------------- + * fix setup.py on osx (oops!) + * (bug 69330) check for the existence of RSA/DSA keys before trying to open + them in SFTPClient + * (bug 69222) catch EAGAIN in socket code to workaround a bug in recent + Linux 2.6 kernels + * (bug 70398) improve dict emulation in HostKeys objects + * try harder to make sure all worker threads are joined on Transport.close() + +v1.6.3 (xatu) 14oct06 +--------------------- + * fixed bug where HostKeys.__setitem__ wouldn't always do the right thing + * fixed bug in SFTPClient.chdir and SFTPAttributes.__str__ [patch from + mike barber] + * try harder not to raise EOFError from within SFTPClient + * fixed bug where a thread waiting in accept() could block forever if the + transport dies [patch from mike looijmans] + +v1.6.2 (weedle) 16aug06 +----------------------- + * added support for "old" group-exchange server mode, for compatibility + with the windows putty client + * fixed some more interactions with SFTP file readv() and prefetch() + * when saving the known_hosts file, preserve the original order [patch from + warren young] + * fix a couple of broken lines when exporting classes (bug 55946) + +v1.6.1 (vulpix) 10jul06 +----------------------- + * more unit tests fixed for windows/cygwin (thanks to alexander belchenko) + * a couple of fixes related to exceptions leaking out of SFTPClient + * added ability to set items in HostKeys via __setitem__ + * HostKeys now retains order and has a save() method + * added PKey.write_private_key and PKey.from_private_key + +v1.6 (umbreon) 10may06 +---------------------- + * pageant support on Windows thanks to john arbash meinel and todd whiteman + * fixed unit tests to work under windows and cygwin (thanks to alexander + belchenko for debugging) + * various bugfixes/tweaks to SFTP file prefetch + * added SSHClient for a higher-level API + * SFTP readv() now yields results as it gets them + * several APIs changed to throw an exception instead of "False" on failure + +v1.5.4 (tentacool) 11mar06 +-------------------------- + * fixed HostKeys to more correctly emulate a python dict + * fixed a bug where file read buffering was too aggressive + * improved prefetching so that out-of-order reads still use the prefetch + buffer + * added experimental SFTPFile.readv() call + * more unit tests + +v1.5.3 (squirtle) 19feb06 +------------------------- + * a few performance enhancements + * added HostKeys, for dealing with openssh style "known_hosts" files, and + added support for hashed hostnames + * added Transport.atfork() for dealing with forked children + * added SFTPClient.truncate, SFTPFile.chmod, SFTPFile.chown, SFTPFile.utime, + and SFTPFile.truncate + * improved windows demos [patch from mike looijmans], added an sftp demo, and + moved demos to the demos/ folder + * fixed a few interoperability bugs + * cleaned up logging a bit + * fixed a bug where EOF on a Channel might not be detected by select [found + by thomas steinacher] + * fixed python 2.4-ism that crept in [patch by jan hudec] + * fixed a few reference loops that could have interacted badly with the python + garbage collector + * fixed a bunch of pychecker warnings, some of which were bugs + +v1.5.2 (rhydon) 04dec05 +----------------------- + * compression support (opt-in via Transport.use_compression) + * sftp files may be opened with mode flag 'x' for O_EXCL (exclusive-open) + behavior, which has no direct python equivalent + * added experimental util functions for parsing openssh config files + * fixed a few bugs (and potential deadlocks) with key renegotiation + * fixed a bug that caused SFTPFile.prefetch to occasionally lock up + * fixed an sftp bug which affected van dyke sftp servers + * fixed the behavior of select()ing on a closed channel, such that it will + always trigger as readable + +v1.5.1 (quilava) 31oct05 +------------------------ + * SFTPFile.prefetch() added to dramatically speed up downloads (automatically + turned on in SFTPClient.get()) + * fixed bug where garbage-collected Channels could trigger the Transport to + close the session (reported by gordon good) + * fixed a deadlock in rekeying (reported by wendell wood) + * fixed some windows bugs and SFTPAttributes.__str__() (reported by grzegorz + makarewicz) + * better sftp error reporting by adding fake "errno" info to IOErrors + +v1.5 (paras) 02oct05 +-------------------- + * added support for "keyboard-interactive" authentication + * added mode (on by default) where password authentication will try to + fallback to "keyboard-interactive" if it's supported + * added pipelining to SFTPFile.write and SFTPClient.put + * fixed bug with SFTPFile.close() not guarding against being called more + than once (thanks to Nathaniel Smith) + * fixed broken 'a' flag in SFTPClient.file() (thanks to Nathaniel Smith) + * fixed up epydocs to look nicer + * reorganized auth_transport into auth_handler, which seems to be a cleaner + separation + * demo scripts fixed to have a better chance of loading the host keys + correctly on windows/cygwin + +v1.4 (oddish) 17jul05 +--------------------- + * added SSH-agent support (for posix) from john rochester + * added chdir() and getcwd() to SFTPClient, to emulate a "working directory" + * added get() and put() to SFTPClient, to emulate ftp whole-file transfers + * added check() to SFTPFile (a file hashing protocol extension) + * fixed Channels and SFTPFiles (among others) to auto-close when GC'd + * fixed Channel.fileno() for Windows, this time really + * don't log socket errors as "unknown exception" + * some misc. backward-compatible API improvements (like allowing + Transport.start_client() and start_server() to be called in a blocking way) + +v1.3.1 (nidoran) 28jun05 +------------------------ + * added SFTPClient.close() + * fixed up some outdated documentation + * made SFTPClient.file() an alias for open() + * added Transport.open_sftp_client() for convenience + * refactored packetizing out of Transport + * fixed bug (reported by alain s.) where connecting to a non-SSH host could + cause paramiko to freeze up + * fixed Channel.fileno() for Windows (again) + * some more unit tests + +v1.3 (marowak) 09apr05 +---------------------- + * fixed a bug where packets larger than about 12KB would cause the session + to die on all platforms except osx + * added a potential workaround for windows to let Channel.fileno() (and + therefore the select module) work! + * changed API for subsystem handlers (sorry!) to pass more info and make it + easier to write a functional SFTP server + +v1.2 (lapras) 28feb05 +--------------------- + * added SFTPClient.listdir_attr() for fetching a list of files and their + attributes in one call + * added Channel.recv_exit_status() and Channel.send_exit_status() for + manipulating the exit status of a command from either client or server + mode + * moved check_global_request into ServerInterface, where it should've been + all along (oops) + * SFTPHandle's default implementations are fleshed out more + * made logging a bit more consistent, and started logging thread ids + * fixed a few race conditions, one of which would sometimes cause a Transport + to fail to start on slow machines + * more unit tests + +v1.1 (kabuto) 12dec04 +--------------------- + * server-side SFTP support + * added support for stderr streams on client & server channels + * added a new distinct exception for failed client authentication + when caused by the server rejecting that *type* of auth + * added support for multi-part authentication + * fixed bug where get_username() wasn't working in server mode + +v1.0 (jigglypuff) 06nov04 +------------------------- + * fixed bug that broke server-mode authentication by private key + * fixed bug where closing a Channel could end up killing the entire + Transport + * actually include demo_windows.py this time (oops!) + * fixed recently-introduced bug in group-exchange key negotiation that + would generate the wrong hash (and therefore fail the initial handshake) + * server-mode subsystem handler is a bit more flexible + +v0.9 (ivysaur) 22oct04 +---------------------- + * new ServerInterface class for implementing server policy, so it's no + longer necessary to subclass Transport or Channel -- server code will + need to be updated to follow this new API! (see demo_server.py) + * some bugfixes for re-keying an active session + * Transport.get_security_options() allows fine-tuned control over the + crypto negotiation on a new session + * Transport.connect() takes a single hostkey object now instead of two + string parameters + * the Channel request methods (like 'exec_command') now return True on + success or False on failure + * added a mechanism for providing subsystems in server mode (and a new + class to be subclassed: SubsystemHandler) + * renamed SFTP -> SFTPClient (but left an alias for existing code) + * added SFTPClient.normalize() to resolve paths on the server + * fleshed out the API a bit more for SFTPClient and private keys + * a bunch of new unit tests! + +v0.9 (horsea) 27jun04 +--------------------- + * fixed a lockup that could happen if the channel was closed while the + send window was full + * better checking of maximum packet sizes + * better line buffering for file objects + * now chops sftp requests into smaller packets for some older servers + * more sftp unit tests + +v0.9 (gyarados) 31may04 +----------------------- + * Transport.open_channel() -- supports local & remote port forwarding now + * now imports UTF-8 encodings explicitly as a hint to "freeze" utilities + * no longer rejects older SFTP servers + * default packet size bumped to 8kB + * fixed deadlock in closing a channel + * Transport.connect() -- fixed bug where it would always fail when given a + host key to verify + +v0.9 (fearow) 23apr04 +--------------------- + * Transport.send_ignore() -- send random ignored bytes + * RSAKey/DSSKey added from_private_key_file() as a factory constructor; + write_private_key_file() & generate() to create and save ssh2 keys; + get_base64() to retrieve the exported public key + * Transport added global_request() [client] and check_global_request() + [server] + * Transport.get_remove_server_key() now returns a PKey object instead of a + tuple of strings + * Transport.get_username() -- return the username you auth'd as [client] + * Transport.set_keepalive() -- makes paramiko send periodic junk packets + to the remote host, to keep the session active + * python 2.2 support (thanks to Roger Binns) + * misc. bug fixes + +v0.9 (eevee) 08mar04 +-------------------- + +v0.9 (doduo) 04jan04 +-------------------- + +v0.1 (charmander) 10nov03 +------------------------- + +v0.1 (bulbasaur) 18sep03 +------------------------ + +v0.1 (aerodactyl) 13sep03 +------------------------- diff --git a/NOTES b/NOTES new file mode 100644 index 0000000..e84f99c --- /dev/null +++ b/NOTES @@ -0,0 +1,13 @@ + + +-------------------+ +-----------------+ +(Socket)InputStream ---> | ssh2 transport | <===> | ssh2 channel | +(Socket)OutputStream --> | (auth, pipe) | N | (buffer) | + +-------------------+ +-----------------+ + @ feeder thread | | + - read InputStream | +-> InputStream + - feed into channel +---> OutputStream + buffers + +SIS <-- @ --> (parse, find chan) --> ssh2 chan: buffer <-- SSHInputStream +SSHOutputStream --> ssh2 chan --> ssh2 transport --> SOS [no thread] + diff --git a/PKG-INFO b/PKG-INFO deleted file mode 100644 index 319f1c5..0000000 --- a/PKG-INFO +++ /dev/null @@ -1,24 +0,0 @@ -Metadata-Version: 1.0 -Name: paramiko -Version: 1.7.7.1 -Summary: SSH2 protocol library -Home-page: http://www.lag.net/paramiko/ -Author: Robey Pointer -Author-email: robeypointer@gmail.com -License: LGPL -Description: - This is a library for making SSH2 connections (client or server). - Emphasis is on using SSH2 as an alternative to SSL for making secure - connections between python scripts. All major ciphers and hash methods - are supported. SFTP client and server mode are both supported too. - - Required packages: - pyCrypto - -Platform: Posix; MacOS X; Windows -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL) -Classifier: Operating System :: OS Independent -Classifier: Topic :: Internet -Classifier: Topic :: Security :: Cryptography diff --git a/README b/README index f977c6d..68e7434 100644 --- a/README +++ b/README @@ -5,21 +5,16 @@ paramiko :Paramiko: Python SSH module :Copyright: Copyright (c) 2003-2009 Robey Pointer +:Copyright: Copyright (c) 2013 Jeff Forcier :License: LGPL -:Homepage: http://www.lag.net/paramiko/ - - -paramiko 1.7.7.1 -================ - -"George" release, 21 may 2011 +:Homepage: https://github.com/paramiko/paramiko/ What ---- "paramiko" is a combination of the esperanto words for "paranoid" and -"friend". it's a module for python 2.2+ that implements the SSH2 protocol +"friend". it's a module for python 2.5+ that implements the SSH2 protocol for secure (encrypted and authenticated) connections to remote machines. unlike SSL (aka TLS), SSH2 protocol does not require hierarchical certificates signed by a powerful central authority. you may know SSH2 as @@ -38,8 +33,7 @@ that should have come with this archive. Requirements ------------ - - python 2.3 or better - (python 2.2 is also supported, but not recommended) + - python 2.5 or better - pycrypto 2.1 or better If you have setuptools, you can build and install paramiko and all its @@ -57,19 +51,6 @@ should also work on Windows, though i don't test it as frequently there. if you run into Windows problems, send me a patch: portability is important to me. -python 2.2 may work, thanks to some patches from Roger Binns. things to -watch out for: - - * sockets in 2.2 don't support timeouts, so the 'select' module is - imported to do polling. - * logging is mostly stubbed out. it works just enough to let paramiko - create log files for debugging, if you want them. to get real logging, - you can backport python 2.3's logging package. Roger has done that - already: - http://sourceforge.net/project/showfiles.php?group_id=75211&package_id=113804 - -you really should upgrade to python 2.3. laziness is no excuse! :) - some python distributions don't include the utf-8 string encodings, for reasons of space (misdirected as that is). if your distribution is missing encodings, you'll see an error like this:: @@ -85,15 +66,7 @@ installs.) Valeriy Pogrebitskiy says the best place to look is Bugs & Support -------------- -there's a launchpage page for paramiko, with a bug tracker: - - https://launchpad.net/paramiko/ - -this is the primary place to file and browse bug reports. - -there's also a low-traffic mailing list for support and discussions: - - http://www.lag.net/mailman/listinfo/paramiko +Please file bug reports at https://github.com/paramiko/paramiko/. There is currently no mailing list but we plan to create a new one ASAP. Demo @@ -141,6 +114,9 @@ the following example scripts (in demos/) get progressively more detailed: 'robey' (password 'foo'), and pretends to be a BBS. meant to be a very simple demo of writing an ssh server. +:demo_keygen.py: + an key generator similar to openssh ssh-keygen(1) program with + paramiko keys generation and progress functions. Use --- diff --git a/TODO b/TODO new file mode 100644 index 0000000..4bda14a --- /dev/null +++ b/TODO @@ -0,0 +1,3 @@ +* Change license to BSD for v1.8 (obtain permission from Robey) +* Pending that, remove preamble from all files, ensure LICENSE is still correct +* Update version stuff: use an execfile'd paramiko/_version.py diff --git a/demos/demo_keygen.py b/demos/demo_keygen.py new file mode 100755 index 0000000..b4ce5b8 --- /dev/null +++ b/demos/demo_keygen.py @@ -0,0 +1,127 @@ +#!/usr/bin/env python + +# Copyright (C) 2010 Sofian Brabez +# +# This file is part of paramiko. +# +# Paramiko is free software; you can redistribute it and/or modify it under the +# terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; either version 2.1 of the License, or (at your option) +# any later version. +# +# Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +# details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with Paramiko; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +from __future__ import with_statement + +import string +import sys + +from binascii import hexlify +from optparse import OptionParser + +from paramiko import DSSKey +from paramiko import RSAKey +from paramiko.ssh_exception import SSHException + +usage=""" +%prog [-v] [-b bits] -t type [-N new_passphrase] [-f output_keyfile]""" + +default_values = { + "ktype": "dsa", + "bits": 1024, + "filename": "output", + "comment": "" +} + +key_dispatch_table = { + 'dsa': DSSKey, + 'rsa': RSAKey, +} + +def progress(arg=None): + + if not arg: + print '0%\x08\x08\x08', + sys.stdout.flush() + elif arg[0] == 'p': + print '25%\x08\x08\x08\x08', + sys.stdout.flush() + elif arg[0] == 'h': + print '50%\x08\x08\x08\x08', + sys.stdout.flush() + elif arg[0] == 'x': + print '75%\x08\x08\x08\x08', + sys.stdout.flush() + +if __name__ == '__main__': + + phrase=None + pfunc=None + + parser = OptionParser(usage=usage) + parser.add_option("-t", "--type", type="string", dest="ktype", + help="Specify type of key to create (dsa or rsa)", + metavar="ktype", default=default_values["ktype"]) + parser.add_option("-b", "--bits", type="int", dest="bits", + help="Number of bits in the key to create", metavar="bits", + default=default_values["bits"]) + parser.add_option("-N", "--new-passphrase", dest="newphrase", + help="Provide new passphrase", metavar="phrase") + parser.add_option("-P", "--old-passphrase", dest="oldphrase", + help="Provide old passphrase", metavar="phrase") + parser.add_option("-f", "--filename", type="string", dest="filename", + help="Filename of the key file", metavar="filename", + default=default_values["filename"]) + parser.add_option("-q", "--quiet", default=False, action="store_false", + help="Quiet") + parser.add_option("-v", "--verbose", default=False, action="store_true", + help="Verbose") + parser.add_option("-C", "--comment", type="string", dest="comment", + help="Provide a new comment", metavar="comment", + default=default_values["comment"]) + + (options, args) = parser.parse_args() + + if len(sys.argv) == 1: + parser.print_help() + sys.exit(0) + + for o in default_values.keys(): + globals()[o] = getattr(options, o, default_values[string.lower(o)]) + + if options.newphrase: + phrase = getattr(options, 'newphrase') + + if options.verbose: + pfunc = progress + sys.stdout.write("Generating priv/pub %s %d bits key pair (%s/%s.pub)..." % (ktype, bits, filename, filename)) + sys.stdout.flush() + + if ktype == 'dsa' and bits > 1024: + raise SSHException("DSA Keys must be 1024 bits") + + if not key_dispatch_table.has_key(ktype): + raise SSHException("Unknown %s algorithm to generate keys pair" % ktype) + + # generating private key + prv = key_dispatch_table[ktype].generate(bits=bits, progress_func=pfunc) + prv.write_private_key_file(filename, password=phrase) + + # generating public key + pub = key_dispatch_table[ktype](filename=filename, password=phrase) + with open("%s.pub" % filename, 'w') as f: + f.write("%s %s" % (pub.get_name(), pub.get_base64())) + if options.comment: + f.write(" %s" % comment) + + if options.verbose: + print "done." + + hash = hexlify(pub.get_fingerprint()) + print "Fingerprint: %d %s %s.pub (%s)" % (bits, ":".join([ hash[i:2+i] for i in range(0, len(hash), 2)]), filename, string.upper(ktype)) diff --git a/docs/api-objects.txt b/docs/api-objects.txt deleted file mode 100644 index 8b62260..0000000 --- a/docs/api-objects.txt +++ /dev/null @@ -1,2202 +0,0 @@ -paramiko paramiko-module.html -paramiko.__package__ paramiko-module.html#__package__ -paramiko.__license__ paramiko-module.html#__license__ -paramiko.__version_info__ paramiko-module.html#__version_info__ -paramiko.__author__ paramiko-module.html#__author__ -paramiko.__version__ paramiko-module.html#__version__ -paramiko.agent paramiko.agent-module.html -paramiko.agent.SSH2_AGENT_IDENTITIES_ANSWER paramiko.agent-module.html#SSH2_AGENT_IDENTITIES_ANSWER -paramiko.agent.SSH2_AGENTC_REQUEST_IDENTITIES paramiko.agent-module.html#SSH2_AGENTC_REQUEST_IDENTITIES -paramiko.agent.SSH2_AGENTC_SIGN_REQUEST paramiko.agent-module.html#SSH2_AGENTC_SIGN_REQUEST -paramiko.agent.__package__ paramiko.agent-module.html#__package__ -paramiko.agent.SSH2_AGENT_SIGN_RESPONSE paramiko.agent-module.html#SSH2_AGENT_SIGN_RESPONSE -paramiko.auth_handler paramiko.auth_handler-module.html -paramiko.auth_handler.AUTH_SUCCESSFUL paramiko.auth_handler-module.html#AUTH_SUCCESSFUL -paramiko.auth_handler.MSG_KEXINIT paramiko.auth_handler-module.html#MSG_KEXINIT -paramiko.auth_handler.MSG_CHANNEL_WINDOW_ADJUST paramiko.auth_handler-module.html#MSG_CHANNEL_WINDOW_ADJUST -paramiko.auth_handler.MSG_CHANNEL_REQUEST paramiko.auth_handler-module.html#MSG_CHANNEL_REQUEST -paramiko.auth_handler.MSG_NAMES paramiko.auth_handler-module.html#MSG_NAMES -paramiko.auth_handler.MSG_CHANNEL_OPEN paramiko.auth_handler-module.html#MSG_CHANNEL_OPEN -paramiko.auth_handler.MSG_DISCONNECT paramiko.auth_handler-module.html#MSG_DISCONNECT -paramiko.auth_handler.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE paramiko.auth_handler-module.html#DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE -paramiko.auth_handler.MSG_SERVICE_ACCEPT paramiko.auth_handler-module.html#MSG_SERVICE_ACCEPT -paramiko.auth_handler.MSG_IGNORE paramiko.auth_handler-module.html#MSG_IGNORE -paramiko.auth_handler.WARNING paramiko.auth_handler-module.html#WARNING -paramiko.auth_handler.MSG_GLOBAL_REQUEST paramiko.auth_handler-module.html#MSG_GLOBAL_REQUEST -paramiko.auth_handler.MSG_USERAUTH_INFO_RESPONSE paramiko.auth_handler-module.html#MSG_USERAUTH_INFO_RESPONSE -paramiko.auth_handler.AUTH_FAILED paramiko.auth_handler-module.html#AUTH_FAILED -paramiko.auth_handler.MSG_CHANNEL_SUCCESS paramiko.auth_handler-module.html#MSG_CHANNEL_SUCCESS -paramiko.auth_handler.MSG_USERAUTH_FAILURE paramiko.auth_handler-module.html#MSG_USERAUTH_FAILURE -paramiko.auth_handler.MSG_REQUEST_FAILURE paramiko.auth_handler-module.html#MSG_REQUEST_FAILURE -paramiko.auth_handler.__package__ paramiko.auth_handler-module.html#__package__ -paramiko.auth_handler.MSG_CHANNEL_DATA paramiko.auth_handler-module.html#MSG_CHANNEL_DATA -paramiko.auth_handler.AUTH_PARTIALLY_SUCCESSFUL paramiko.auth_handler-module.html#AUTH_PARTIALLY_SUCCESSFUL -paramiko.auth_handler.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED paramiko.auth_handler-module.html#OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -paramiko.auth_handler.MSG_UNIMPLEMENTED paramiko.auth_handler-module.html#MSG_UNIMPLEMENTED -paramiko.auth_handler.CRITICAL paramiko.auth_handler-module.html#CRITICAL -paramiko.auth_handler.MSG_CHANNEL_OPEN_FAILURE paramiko.auth_handler-module.html#MSG_CHANNEL_OPEN_FAILURE -paramiko.auth_handler.MSG_USERAUTH_INFO_REQUEST paramiko.auth_handler-module.html#MSG_USERAUTH_INFO_REQUEST -paramiko.auth_handler.MSG_DEBUG paramiko.auth_handler-module.html#MSG_DEBUG -paramiko.auth_handler.MSG_CHANNEL_FAILURE paramiko.auth_handler-module.html#MSG_CHANNEL_FAILURE -paramiko.auth_handler.OPEN_SUCCEEDED paramiko.auth_handler-module.html#OPEN_SUCCEEDED -paramiko.auth_handler.rng paramiko.auth_handler-module.html#rng -paramiko.auth_handler.OPEN_FAILED_UNKNOWN_CHANNEL_TYPE paramiko.auth_handler-module.html#OPEN_FAILED_UNKNOWN_CHANNEL_TYPE -paramiko.auth_handler.OPEN_FAILED_RESOURCE_SHORTAGE paramiko.auth_handler-module.html#OPEN_FAILED_RESOURCE_SHORTAGE -paramiko.auth_handler.ERROR paramiko.auth_handler-module.html#ERROR -paramiko.auth_handler.DEBUG paramiko.auth_handler-module.html#DEBUG -paramiko.auth_handler.MSG_REQUEST_SUCCESS paramiko.auth_handler-module.html#MSG_REQUEST_SUCCESS -paramiko.auth_handler.OPEN_FAILED_CONNECT_FAILED paramiko.auth_handler-module.html#OPEN_FAILED_CONNECT_FAILED -paramiko.auth_handler.INFO paramiko.auth_handler-module.html#INFO -paramiko.auth_handler.MSG_USERAUTH_BANNER paramiko.auth_handler-module.html#MSG_USERAUTH_BANNER -paramiko.auth_handler.MSG_NEWKEYS paramiko.auth_handler-module.html#MSG_NEWKEYS -paramiko.auth_handler.MSG_USERAUTH_PK_OK paramiko.auth_handler-module.html#MSG_USERAUTH_PK_OK -paramiko.auth_handler.MSG_USERAUTH_REQUEST paramiko.auth_handler-module.html#MSG_USERAUTH_REQUEST -paramiko.auth_handler.DISCONNECT_SERVICE_NOT_AVAILABLE paramiko.auth_handler-module.html#DISCONNECT_SERVICE_NOT_AVAILABLE -paramiko.auth_handler.PY22 paramiko.auth_handler-module.html#PY22 -paramiko.auth_handler.MSG_SERVICE_REQUEST paramiko.auth_handler-module.html#MSG_SERVICE_REQUEST -paramiko.auth_handler.MSG_CHANNEL_EXTENDED_DATA paramiko.auth_handler-module.html#MSG_CHANNEL_EXTENDED_DATA -paramiko.auth_handler.MSG_CHANNEL_CLOSE paramiko.auth_handler-module.html#MSG_CHANNEL_CLOSE -paramiko.auth_handler.DISCONNECT_AUTH_CANCELLED_BY_USER paramiko.auth_handler-module.html#DISCONNECT_AUTH_CANCELLED_BY_USER -paramiko.auth_handler.MSG_CHANNEL_OPEN_SUCCESS paramiko.auth_handler-module.html#MSG_CHANNEL_OPEN_SUCCESS -paramiko.auth_handler.MSG_CHANNEL_EOF paramiko.auth_handler-module.html#MSG_CHANNEL_EOF -paramiko.auth_handler.MSG_USERAUTH_SUCCESS paramiko.auth_handler-module.html#MSG_USERAUTH_SUCCESS -paramiko.auth_handler.CONNECTION_FAILED_CODE paramiko.auth_handler-module.html#CONNECTION_FAILED_CODE -paramiko.ber paramiko.ber-module.html -paramiko.ber.__package__ paramiko.ber-module.html#__package__ -paramiko.buffered_pipe paramiko.buffered_pipe-module.html -paramiko.buffered_pipe.__package__ paramiko.buffered_pipe-module.html#__package__ -paramiko.channel paramiko.channel-module.html -paramiko.channel.AUTH_SUCCESSFUL paramiko.channel-module.html#AUTH_SUCCESSFUL -paramiko.channel.MSG_KEXINIT paramiko.channel-module.html#MSG_KEXINIT -paramiko.channel.MSG_CHANNEL_WINDOW_ADJUST paramiko.channel-module.html#MSG_CHANNEL_WINDOW_ADJUST -paramiko.channel.MSG_NAMES paramiko.channel-module.html#MSG_NAMES -paramiko.channel.MSG_CHANNEL_OPEN paramiko.channel-module.html#MSG_CHANNEL_OPEN -paramiko.channel.MSG_REQUEST_SUCCESS paramiko.channel-module.html#MSG_REQUEST_SUCCESS -paramiko.channel.MSG_DISCONNECT paramiko.channel-module.html#MSG_DISCONNECT -paramiko.channel.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE paramiko.channel-module.html#DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE -paramiko.channel.MSG_SERVICE_ACCEPT paramiko.channel-module.html#MSG_SERVICE_ACCEPT -paramiko.channel.WARNING paramiko.channel-module.html#WARNING -paramiko.channel.MSG_GLOBAL_REQUEST paramiko.channel-module.html#MSG_GLOBAL_REQUEST -paramiko.channel.MSG_USERAUTH_INFO_RESPONSE paramiko.channel-module.html#MSG_USERAUTH_INFO_RESPONSE -paramiko.channel.AUTH_FAILED paramiko.channel-module.html#AUTH_FAILED -paramiko.channel.MSG_CHANNEL_SUCCESS paramiko.channel-module.html#MSG_CHANNEL_SUCCESS -paramiko.channel.MSG_USERAUTH_FAILURE paramiko.channel-module.html#MSG_USERAUTH_FAILURE -paramiko.channel.MSG_REQUEST_FAILURE paramiko.channel-module.html#MSG_REQUEST_FAILURE -paramiko.channel.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED paramiko.channel-module.html#OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -paramiko.channel.__package__ paramiko.channel-module.html#__package__ -paramiko.channel.MSG_CHANNEL_DATA paramiko.channel-module.html#MSG_CHANNEL_DATA -paramiko.channel.CRITICAL paramiko.channel-module.html#CRITICAL -paramiko.channel.MSG_IGNORE paramiko.channel-module.html#MSG_IGNORE -paramiko.channel.MSG_UNIMPLEMENTED paramiko.channel-module.html#MSG_UNIMPLEMENTED -paramiko.channel.MSG_CHANNEL_REQUEST paramiko.channel-module.html#MSG_CHANNEL_REQUEST -paramiko.channel.MSG_CHANNEL_OPEN_FAILURE paramiko.channel-module.html#MSG_CHANNEL_OPEN_FAILURE -paramiko.channel.MSG_USERAUTH_INFO_REQUEST paramiko.channel-module.html#MSG_USERAUTH_INFO_REQUEST -paramiko.channel.MSG_DEBUG paramiko.channel-module.html#MSG_DEBUG -paramiko.channel.MSG_CHANNEL_FAILURE paramiko.channel-module.html#MSG_CHANNEL_FAILURE -paramiko.channel.OPEN_SUCCEEDED paramiko.channel-module.html#OPEN_SUCCEEDED -paramiko.channel.rng paramiko.channel-module.html#rng -paramiko.channel.OPEN_FAILED_UNKNOWN_CHANNEL_TYPE paramiko.channel-module.html#OPEN_FAILED_UNKNOWN_CHANNEL_TYPE -paramiko.channel.OPEN_FAILED_RESOURCE_SHORTAGE paramiko.channel-module.html#OPEN_FAILED_RESOURCE_SHORTAGE -paramiko.channel.ERROR paramiko.channel-module.html#ERROR -paramiko.channel.DEBUG paramiko.channel-module.html#DEBUG -paramiko.channel.AUTH_PARTIALLY_SUCCESSFUL paramiko.channel-module.html#AUTH_PARTIALLY_SUCCESSFUL -paramiko.channel.OPEN_FAILED_CONNECT_FAILED paramiko.channel-module.html#OPEN_FAILED_CONNECT_FAILED -paramiko.channel.INFO paramiko.channel-module.html#INFO -paramiko.channel.MSG_USERAUTH_BANNER paramiko.channel-module.html#MSG_USERAUTH_BANNER -paramiko.channel.MSG_NEWKEYS paramiko.channel-module.html#MSG_NEWKEYS -paramiko.channel.MSG_USERAUTH_PK_OK paramiko.channel-module.html#MSG_USERAUTH_PK_OK -paramiko.channel.MSG_USERAUTH_REQUEST paramiko.channel-module.html#MSG_USERAUTH_REQUEST -paramiko.channel.DISCONNECT_SERVICE_NOT_AVAILABLE paramiko.channel-module.html#DISCONNECT_SERVICE_NOT_AVAILABLE -paramiko.channel.MIN_PACKET_SIZE paramiko.channel-module.html#MIN_PACKET_SIZE -paramiko.channel.PY22 paramiko.channel-module.html#PY22 -paramiko.channel.MSG_SERVICE_REQUEST paramiko.channel-module.html#MSG_SERVICE_REQUEST -paramiko.channel.MSG_CHANNEL_EXTENDED_DATA paramiko.channel-module.html#MSG_CHANNEL_EXTENDED_DATA -paramiko.channel.MSG_CHANNEL_CLOSE paramiko.channel-module.html#MSG_CHANNEL_CLOSE -paramiko.channel.DISCONNECT_AUTH_CANCELLED_BY_USER paramiko.channel-module.html#DISCONNECT_AUTH_CANCELLED_BY_USER -paramiko.channel.MSG_CHANNEL_OPEN_SUCCESS paramiko.channel-module.html#MSG_CHANNEL_OPEN_SUCCESS -paramiko.channel.MSG_CHANNEL_EOF paramiko.channel-module.html#MSG_CHANNEL_EOF -paramiko.channel.MSG_USERAUTH_SUCCESS paramiko.channel-module.html#MSG_USERAUTH_SUCCESS -paramiko.channel.CONNECTION_FAILED_CODE paramiko.channel-module.html#CONNECTION_FAILED_CODE -paramiko.client paramiko.client-module.html -paramiko.client.AUTH_SUCCESSFUL paramiko.client-module.html#AUTH_SUCCESSFUL -paramiko.client.MSG_CHANNEL_OPEN_FAILURE paramiko.client-module.html#MSG_CHANNEL_OPEN_FAILURE -paramiko.client.MSG_CHANNEL_WINDOW_ADJUST paramiko.client-module.html#MSG_CHANNEL_WINDOW_ADJUST -paramiko.client.MSG_CHANNEL_REQUEST paramiko.client-module.html#MSG_CHANNEL_REQUEST -paramiko.client.MSG_NAMES paramiko.client-module.html#MSG_NAMES -paramiko.client.MSG_REQUEST_FAILURE paramiko.client-module.html#MSG_REQUEST_FAILURE -paramiko.client.MSG_CHANNEL_OPEN paramiko.client-module.html#MSG_CHANNEL_OPEN -paramiko.client.MSG_SERVICE_REQUEST paramiko.client-module.html#MSG_SERVICE_REQUEST -paramiko.client.__package__ paramiko.client-module.html#__package__ -paramiko.client.MSG_DISCONNECT paramiko.client-module.html#MSG_DISCONNECT -paramiko.client.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE paramiko.client-module.html#DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE -paramiko.client.MSG_SERVICE_ACCEPT paramiko.client-module.html#MSG_SERVICE_ACCEPT -paramiko.client.SSH_PORT paramiko.client-module.html#SSH_PORT -paramiko.client.MSG_IGNORE paramiko.client-module.html#MSG_IGNORE -paramiko.client.WARNING paramiko.client-module.html#WARNING -paramiko.client.MSG_GLOBAL_REQUEST paramiko.client-module.html#MSG_GLOBAL_REQUEST -paramiko.client.MSG_CHANNEL_SUCCESS paramiko.client-module.html#MSG_CHANNEL_SUCCESS -paramiko.client.MSG_USERAUTH_FAILURE paramiko.client-module.html#MSG_USERAUTH_FAILURE -paramiko.client.MSG_KEXINIT paramiko.client-module.html#MSG_KEXINIT -paramiko.client.MSG_CHANNEL_DATA paramiko.client-module.html#MSG_CHANNEL_DATA -paramiko.client.AUTH_PARTIALLY_SUCCESSFUL paramiko.client-module.html#AUTH_PARTIALLY_SUCCESSFUL -paramiko.client.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED paramiko.client-module.html#OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -paramiko.client.MSG_UNIMPLEMENTED paramiko.client-module.html#MSG_UNIMPLEMENTED -paramiko.client.CRITICAL paramiko.client-module.html#CRITICAL -paramiko.client.MSG_USERAUTH_INFO_REQUEST paramiko.client-module.html#MSG_USERAUTH_INFO_REQUEST -paramiko.client.MSG_DEBUG paramiko.client-module.html#MSG_DEBUG -paramiko.client.MSG_CHANNEL_FAILURE paramiko.client-module.html#MSG_CHANNEL_FAILURE -paramiko.client.OPEN_SUCCEEDED paramiko.client-module.html#OPEN_SUCCEEDED -paramiko.client.rng paramiko.client-module.html#rng -paramiko.client.OPEN_FAILED_UNKNOWN_CHANNEL_TYPE paramiko.client-module.html#OPEN_FAILED_UNKNOWN_CHANNEL_TYPE -paramiko.client.OPEN_FAILED_RESOURCE_SHORTAGE paramiko.client-module.html#OPEN_FAILED_RESOURCE_SHORTAGE -paramiko.client.ERROR paramiko.client-module.html#ERROR -paramiko.client.DEBUG paramiko.client-module.html#DEBUG -paramiko.client.MSG_USERAUTH_INFO_RESPONSE paramiko.client-module.html#MSG_USERAUTH_INFO_RESPONSE -paramiko.client.MSG_REQUEST_SUCCESS paramiko.client-module.html#MSG_REQUEST_SUCCESS -paramiko.client.OPEN_FAILED_CONNECT_FAILED paramiko.client-module.html#OPEN_FAILED_CONNECT_FAILED -paramiko.client.INFO paramiko.client-module.html#INFO -paramiko.client.MSG_USERAUTH_BANNER paramiko.client-module.html#MSG_USERAUTH_BANNER -paramiko.client.MSG_NEWKEYS paramiko.client-module.html#MSG_NEWKEYS -paramiko.client.MSG_USERAUTH_PK_OK paramiko.client-module.html#MSG_USERAUTH_PK_OK -paramiko.client.MSG_USERAUTH_REQUEST paramiko.client-module.html#MSG_USERAUTH_REQUEST -paramiko.client.DISCONNECT_SERVICE_NOT_AVAILABLE paramiko.client-module.html#DISCONNECT_SERVICE_NOT_AVAILABLE -paramiko.client.PY22 paramiko.client-module.html#PY22 -paramiko.client.AUTH_FAILED paramiko.client-module.html#AUTH_FAILED -paramiko.client.MSG_CHANNEL_EXTENDED_DATA paramiko.client-module.html#MSG_CHANNEL_EXTENDED_DATA -paramiko.client.MSG_CHANNEL_CLOSE paramiko.client-module.html#MSG_CHANNEL_CLOSE -paramiko.client.DISCONNECT_AUTH_CANCELLED_BY_USER paramiko.client-module.html#DISCONNECT_AUTH_CANCELLED_BY_USER -paramiko.client.MSG_CHANNEL_OPEN_SUCCESS paramiko.client-module.html#MSG_CHANNEL_OPEN_SUCCESS -paramiko.client.MSG_CHANNEL_EOF paramiko.client-module.html#MSG_CHANNEL_EOF -paramiko.client.MSG_USERAUTH_SUCCESS paramiko.client-module.html#MSG_USERAUTH_SUCCESS -paramiko.client.CONNECTION_FAILED_CODE paramiko.client-module.html#CONNECTION_FAILED_CODE -paramiko.common paramiko.common-module.html -paramiko.common.AUTH_SUCCESSFUL paramiko.common-module.html#AUTH_SUCCESSFUL -paramiko.common.MSG_KEXINIT paramiko.common-module.html#MSG_KEXINIT -paramiko.common.MSG_CHANNEL_WINDOW_ADJUST paramiko.common-module.html#MSG_CHANNEL_WINDOW_ADJUST -paramiko.common.MSG_CHANNEL_REQUEST paramiko.common-module.html#MSG_CHANNEL_REQUEST -paramiko.common.MSG_NAMES paramiko.common-module.html#MSG_NAMES -paramiko.common.MSG_CHANNEL_OPEN paramiko.common-module.html#MSG_CHANNEL_OPEN -paramiko.common.MSG_REQUEST_SUCCESS paramiko.common-module.html#MSG_REQUEST_SUCCESS -paramiko.common.MSG_DISCONNECT paramiko.common-module.html#MSG_DISCONNECT -paramiko.common.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE paramiko.common-module.html#DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE -paramiko.common.MSG_SERVICE_ACCEPT paramiko.common-module.html#MSG_SERVICE_ACCEPT -paramiko.common.MSG_IGNORE paramiko.common-module.html#MSG_IGNORE -paramiko.common.MSG_GLOBAL_REQUEST paramiko.common-module.html#MSG_GLOBAL_REQUEST -paramiko.common.MSG_USERAUTH_INFO_RESPONSE paramiko.common-module.html#MSG_USERAUTH_INFO_RESPONSE -paramiko.common.MSG_CHANNEL_SUCCESS paramiko.common-module.html#MSG_CHANNEL_SUCCESS -paramiko.common.MSG_USERAUTH_FAILURE paramiko.common-module.html#MSG_USERAUTH_FAILURE -paramiko.common.MSG_REQUEST_FAILURE paramiko.common-module.html#MSG_REQUEST_FAILURE -paramiko.common.__package__ paramiko.common-module.html#__package__ -paramiko.common.MSG_CHANNEL_DATA paramiko.common-module.html#MSG_CHANNEL_DATA -paramiko.common.CRITICAL paramiko.common-module.html#CRITICAL -paramiko.common.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED paramiko.common-module.html#OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -paramiko.common.MSG_UNIMPLEMENTED paramiko.common-module.html#MSG_UNIMPLEMENTED -paramiko.common.MSG_CHANNEL_OPEN_FAILURE paramiko.common-module.html#MSG_CHANNEL_OPEN_FAILURE -paramiko.common.MSG_USERAUTH_INFO_REQUEST paramiko.common-module.html#MSG_USERAUTH_INFO_REQUEST -paramiko.common.MSG_DEBUG paramiko.common-module.html#MSG_DEBUG -paramiko.common.MSG_CHANNEL_FAILURE paramiko.common-module.html#MSG_CHANNEL_FAILURE -paramiko.common.OPEN_SUCCEEDED paramiko.common-module.html#OPEN_SUCCEEDED -paramiko.common.rng paramiko.common-module.html#rng -paramiko.common.OPEN_FAILED_UNKNOWN_CHANNEL_TYPE paramiko.common-module.html#OPEN_FAILED_UNKNOWN_CHANNEL_TYPE -paramiko.common.OPEN_FAILED_RESOURCE_SHORTAGE paramiko.common-module.html#OPEN_FAILED_RESOURCE_SHORTAGE -paramiko.common.ERROR paramiko.common-module.html#ERROR -paramiko.common.DEBUG paramiko.common-module.html#DEBUG -paramiko.common.AUTH_PARTIALLY_SUCCESSFUL paramiko.common-module.html#AUTH_PARTIALLY_SUCCESSFUL -paramiko.common.OPEN_FAILED_CONNECT_FAILED paramiko.common-module.html#OPEN_FAILED_CONNECT_FAILED -paramiko.common.INFO paramiko.common-module.html#INFO -paramiko.common.MSG_USERAUTH_BANNER paramiko.common-module.html#MSG_USERAUTH_BANNER -paramiko.common.MSG_NEWKEYS paramiko.common-module.html#MSG_NEWKEYS -paramiko.common.MSG_USERAUTH_PK_OK paramiko.common-module.html#MSG_USERAUTH_PK_OK -paramiko.common.WARNING paramiko.common-module.html#WARNING -paramiko.common.MSG_USERAUTH_REQUEST paramiko.common-module.html#MSG_USERAUTH_REQUEST -paramiko.common.DISCONNECT_SERVICE_NOT_AVAILABLE paramiko.common-module.html#DISCONNECT_SERVICE_NOT_AVAILABLE -paramiko.common.PY22 paramiko.common-module.html#PY22 -paramiko.common.MSG_SERVICE_REQUEST paramiko.common-module.html#MSG_SERVICE_REQUEST -paramiko.common.AUTH_FAILED paramiko.common-module.html#AUTH_FAILED -paramiko.common.MSG_CHANNEL_EXTENDED_DATA paramiko.common-module.html#MSG_CHANNEL_EXTENDED_DATA -paramiko.common.MSG_CHANNEL_CLOSE paramiko.common-module.html#MSG_CHANNEL_CLOSE -paramiko.common.DISCONNECT_AUTH_CANCELLED_BY_USER paramiko.common-module.html#DISCONNECT_AUTH_CANCELLED_BY_USER -paramiko.common.MSG_CHANNEL_OPEN_SUCCESS paramiko.common-module.html#MSG_CHANNEL_OPEN_SUCCESS -paramiko.common.MSG_CHANNEL_EOF paramiko.common-module.html#MSG_CHANNEL_EOF -paramiko.common.MSG_USERAUTH_SUCCESS paramiko.common-module.html#MSG_USERAUTH_SUCCESS -paramiko.common.CONNECTION_FAILED_CODE paramiko.common-module.html#CONNECTION_FAILED_CODE -paramiko.compress paramiko.compress-module.html -paramiko.compress.__package__ paramiko.compress-module.html#__package__ -paramiko.config paramiko.config-module.html -paramiko.config.__package__ paramiko.config-module.html#__package__ -paramiko.dsskey paramiko.dsskey-module.html -paramiko.dsskey.AUTH_SUCCESSFUL paramiko.dsskey-module.html#AUTH_SUCCESSFUL -paramiko.dsskey.MSG_KEXINIT paramiko.dsskey-module.html#MSG_KEXINIT -paramiko.dsskey.MSG_CHANNEL_WINDOW_ADJUST paramiko.dsskey-module.html#MSG_CHANNEL_WINDOW_ADJUST -paramiko.dsskey.MSG_CHANNEL_REQUEST paramiko.dsskey-module.html#MSG_CHANNEL_REQUEST -paramiko.dsskey.MSG_NAMES paramiko.dsskey-module.html#MSG_NAMES -paramiko.dsskey.MSG_REQUEST_FAILURE paramiko.dsskey-module.html#MSG_REQUEST_FAILURE -paramiko.dsskey.MSG_CHANNEL_OPEN paramiko.dsskey-module.html#MSG_CHANNEL_OPEN -paramiko.dsskey.MSG_REQUEST_SUCCESS paramiko.dsskey-module.html#MSG_REQUEST_SUCCESS -paramiko.dsskey.MSG_DISCONNECT paramiko.dsskey-module.html#MSG_DISCONNECT -paramiko.dsskey.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE paramiko.dsskey-module.html#DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE -paramiko.dsskey.MSG_SERVICE_ACCEPT paramiko.dsskey-module.html#MSG_SERVICE_ACCEPT -paramiko.dsskey.MSG_IGNORE paramiko.dsskey-module.html#MSG_IGNORE -paramiko.dsskey.WARNING paramiko.dsskey-module.html#WARNING -paramiko.dsskey.MSG_GLOBAL_REQUEST paramiko.dsskey-module.html#MSG_GLOBAL_REQUEST -paramiko.dsskey.MSG_USERAUTH_INFO_RESPONSE paramiko.dsskey-module.html#MSG_USERAUTH_INFO_RESPONSE -paramiko.dsskey.MSG_CHANNEL_SUCCESS paramiko.dsskey-module.html#MSG_CHANNEL_SUCCESS -paramiko.dsskey.MSG_USERAUTH_FAILURE paramiko.dsskey-module.html#MSG_USERAUTH_FAILURE -paramiko.dsskey.__package__ paramiko.dsskey-module.html#__package__ -paramiko.dsskey.MSG_CHANNEL_DATA paramiko.dsskey-module.html#MSG_CHANNEL_DATA -paramiko.dsskey.CRITICAL paramiko.dsskey-module.html#CRITICAL -paramiko.dsskey.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED paramiko.dsskey-module.html#OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -paramiko.dsskey.MSG_UNIMPLEMENTED paramiko.dsskey-module.html#MSG_UNIMPLEMENTED -paramiko.dsskey.OPEN_FAILED_CONNECT_FAILED paramiko.dsskey-module.html#OPEN_FAILED_CONNECT_FAILED -paramiko.dsskey.MSG_CHANNEL_OPEN_FAILURE paramiko.dsskey-module.html#MSG_CHANNEL_OPEN_FAILURE -paramiko.dsskey.MSG_USERAUTH_INFO_REQUEST paramiko.dsskey-module.html#MSG_USERAUTH_INFO_REQUEST -paramiko.dsskey.MSG_DEBUG paramiko.dsskey-module.html#MSG_DEBUG -paramiko.dsskey.MSG_CHANNEL_FAILURE paramiko.dsskey-module.html#MSG_CHANNEL_FAILURE -paramiko.dsskey.OPEN_SUCCEEDED paramiko.dsskey-module.html#OPEN_SUCCEEDED -paramiko.dsskey.rng paramiko.dsskey-module.html#rng -paramiko.dsskey.OPEN_FAILED_UNKNOWN_CHANNEL_TYPE paramiko.dsskey-module.html#OPEN_FAILED_UNKNOWN_CHANNEL_TYPE -paramiko.dsskey.OPEN_FAILED_RESOURCE_SHORTAGE paramiko.dsskey-module.html#OPEN_FAILED_RESOURCE_SHORTAGE -paramiko.dsskey.ERROR paramiko.dsskey-module.html#ERROR -paramiko.dsskey.DEBUG paramiko.dsskey-module.html#DEBUG -paramiko.dsskey.AUTH_PARTIALLY_SUCCESSFUL paramiko.dsskey-module.html#AUTH_PARTIALLY_SUCCESSFUL -paramiko.dsskey.INFO paramiko.dsskey-module.html#INFO -paramiko.dsskey.MSG_USERAUTH_BANNER paramiko.dsskey-module.html#MSG_USERAUTH_BANNER -paramiko.dsskey.MSG_NEWKEYS paramiko.dsskey-module.html#MSG_NEWKEYS -paramiko.dsskey.MSG_USERAUTH_PK_OK paramiko.dsskey-module.html#MSG_USERAUTH_PK_OK -paramiko.dsskey.MSG_USERAUTH_REQUEST paramiko.dsskey-module.html#MSG_USERAUTH_REQUEST -paramiko.dsskey.DISCONNECT_SERVICE_NOT_AVAILABLE paramiko.dsskey-module.html#DISCONNECT_SERVICE_NOT_AVAILABLE -paramiko.dsskey.PY22 paramiko.dsskey-module.html#PY22 -paramiko.dsskey.MSG_SERVICE_REQUEST paramiko.dsskey-module.html#MSG_SERVICE_REQUEST -paramiko.dsskey.AUTH_FAILED paramiko.dsskey-module.html#AUTH_FAILED -paramiko.dsskey.MSG_CHANNEL_EXTENDED_DATA paramiko.dsskey-module.html#MSG_CHANNEL_EXTENDED_DATA -paramiko.dsskey.MSG_CHANNEL_CLOSE paramiko.dsskey-module.html#MSG_CHANNEL_CLOSE -paramiko.dsskey.DISCONNECT_AUTH_CANCELLED_BY_USER paramiko.dsskey-module.html#DISCONNECT_AUTH_CANCELLED_BY_USER -paramiko.dsskey.MSG_CHANNEL_OPEN_SUCCESS paramiko.dsskey-module.html#MSG_CHANNEL_OPEN_SUCCESS -paramiko.dsskey.MSG_CHANNEL_EOF paramiko.dsskey-module.html#MSG_CHANNEL_EOF -paramiko.dsskey.MSG_USERAUTH_SUCCESS paramiko.dsskey-module.html#MSG_USERAUTH_SUCCESS -paramiko.dsskey.CONNECTION_FAILED_CODE paramiko.dsskey-module.html#CONNECTION_FAILED_CODE -paramiko.file paramiko.file-module.html -paramiko.file.__package__ paramiko.file-module.html#__package__ -paramiko.hostkeys paramiko.hostkeys-module.html -paramiko.hostkeys.AUTH_SUCCESSFUL paramiko.hostkeys-module.html#AUTH_SUCCESSFUL -paramiko.hostkeys.MSG_KEXINIT paramiko.hostkeys-module.html#MSG_KEXINIT -paramiko.hostkeys.MSG_CHANNEL_WINDOW_ADJUST paramiko.hostkeys-module.html#MSG_CHANNEL_WINDOW_ADJUST -paramiko.hostkeys.MSG_CHANNEL_REQUEST paramiko.hostkeys-module.html#MSG_CHANNEL_REQUEST -paramiko.hostkeys.MSG_NAMES paramiko.hostkeys-module.html#MSG_NAMES -paramiko.hostkeys.MSG_REQUEST_FAILURE paramiko.hostkeys-module.html#MSG_REQUEST_FAILURE -paramiko.hostkeys.MSG_CHANNEL_OPEN paramiko.hostkeys-module.html#MSG_CHANNEL_OPEN -paramiko.hostkeys.MSG_REQUEST_SUCCESS paramiko.hostkeys-module.html#MSG_REQUEST_SUCCESS -paramiko.hostkeys.MSG_DISCONNECT paramiko.hostkeys-module.html#MSG_DISCONNECT -paramiko.hostkeys.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE paramiko.hostkeys-module.html#DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE -paramiko.hostkeys.MSG_SERVICE_ACCEPT paramiko.hostkeys-module.html#MSG_SERVICE_ACCEPT -paramiko.hostkeys.MSG_IGNORE paramiko.hostkeys-module.html#MSG_IGNORE -paramiko.hostkeys.MSG_GLOBAL_REQUEST paramiko.hostkeys-module.html#MSG_GLOBAL_REQUEST -paramiko.hostkeys.MSG_USERAUTH_INFO_RESPONSE paramiko.hostkeys-module.html#MSG_USERAUTH_INFO_RESPONSE -paramiko.hostkeys.MSG_CHANNEL_SUCCESS paramiko.hostkeys-module.html#MSG_CHANNEL_SUCCESS -paramiko.hostkeys.MSG_USERAUTH_FAILURE paramiko.hostkeys-module.html#MSG_USERAUTH_FAILURE -paramiko.hostkeys.__package__ paramiko.hostkeys-module.html#__package__ -paramiko.hostkeys.MSG_CHANNEL_DATA paramiko.hostkeys-module.html#MSG_CHANNEL_DATA -paramiko.hostkeys.CRITICAL paramiko.hostkeys-module.html#CRITICAL -paramiko.hostkeys.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED paramiko.hostkeys-module.html#OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -paramiko.hostkeys.MSG_UNIMPLEMENTED paramiko.hostkeys-module.html#MSG_UNIMPLEMENTED -paramiko.hostkeys.MSG_CHANNEL_OPEN_FAILURE paramiko.hostkeys-module.html#MSG_CHANNEL_OPEN_FAILURE -paramiko.hostkeys.MSG_USERAUTH_INFO_REQUEST paramiko.hostkeys-module.html#MSG_USERAUTH_INFO_REQUEST -paramiko.hostkeys.MSG_DEBUG paramiko.hostkeys-module.html#MSG_DEBUG -paramiko.hostkeys.MSG_CHANNEL_FAILURE paramiko.hostkeys-module.html#MSG_CHANNEL_FAILURE -paramiko.hostkeys.OPEN_SUCCEEDED paramiko.hostkeys-module.html#OPEN_SUCCEEDED -paramiko.hostkeys.rng paramiko.hostkeys-module.html#rng -paramiko.hostkeys.OPEN_FAILED_UNKNOWN_CHANNEL_TYPE paramiko.hostkeys-module.html#OPEN_FAILED_UNKNOWN_CHANNEL_TYPE -paramiko.hostkeys.OPEN_FAILED_RESOURCE_SHORTAGE paramiko.hostkeys-module.html#OPEN_FAILED_RESOURCE_SHORTAGE -paramiko.hostkeys.ERROR paramiko.hostkeys-module.html#ERROR -paramiko.hostkeys.DEBUG paramiko.hostkeys-module.html#DEBUG -paramiko.hostkeys.AUTH_PARTIALLY_SUCCESSFUL paramiko.hostkeys-module.html#AUTH_PARTIALLY_SUCCESSFUL -paramiko.hostkeys.OPEN_FAILED_CONNECT_FAILED paramiko.hostkeys-module.html#OPEN_FAILED_CONNECT_FAILED -paramiko.hostkeys.INFO paramiko.hostkeys-module.html#INFO -paramiko.hostkeys.MSG_USERAUTH_BANNER paramiko.hostkeys-module.html#MSG_USERAUTH_BANNER -paramiko.hostkeys.MSG_NEWKEYS paramiko.hostkeys-module.html#MSG_NEWKEYS -paramiko.hostkeys.MSG_USERAUTH_PK_OK paramiko.hostkeys-module.html#MSG_USERAUTH_PK_OK -paramiko.hostkeys.WARNING paramiko.hostkeys-module.html#WARNING -paramiko.hostkeys.MSG_USERAUTH_REQUEST paramiko.hostkeys-module.html#MSG_USERAUTH_REQUEST -paramiko.hostkeys.DISCONNECT_SERVICE_NOT_AVAILABLE paramiko.hostkeys-module.html#DISCONNECT_SERVICE_NOT_AVAILABLE -paramiko.hostkeys.PY22 paramiko.hostkeys-module.html#PY22 -paramiko.hostkeys.MSG_SERVICE_REQUEST paramiko.hostkeys-module.html#MSG_SERVICE_REQUEST -paramiko.hostkeys.MSG_USERAUTH_SUCCESS paramiko.hostkeys-module.html#MSG_USERAUTH_SUCCESS -paramiko.hostkeys.AUTH_FAILED paramiko.hostkeys-module.html#AUTH_FAILED -paramiko.hostkeys.MSG_CHANNEL_EXTENDED_DATA paramiko.hostkeys-module.html#MSG_CHANNEL_EXTENDED_DATA -paramiko.hostkeys.MSG_CHANNEL_CLOSE paramiko.hostkeys-module.html#MSG_CHANNEL_CLOSE -paramiko.hostkeys.DISCONNECT_AUTH_CANCELLED_BY_USER paramiko.hostkeys-module.html#DISCONNECT_AUTH_CANCELLED_BY_USER -paramiko.hostkeys.MSG_CHANNEL_OPEN_SUCCESS paramiko.hostkeys-module.html#MSG_CHANNEL_OPEN_SUCCESS -paramiko.hostkeys.MSG_CHANNEL_EOF paramiko.hostkeys-module.html#MSG_CHANNEL_EOF -paramiko.hostkeys.CONNECTION_FAILED_CODE paramiko.hostkeys-module.html#CONNECTION_FAILED_CODE -paramiko.kex_gex paramiko.kex_gex-module.html -paramiko.kex_gex.AUTH_SUCCESSFUL paramiko.kex_gex-module.html#AUTH_SUCCESSFUL -paramiko.kex_gex.MSG_KEXINIT paramiko.kex_gex-module.html#MSG_KEXINIT -paramiko.kex_gex.MSG_CHANNEL_WINDOW_ADJUST paramiko.kex_gex-module.html#MSG_CHANNEL_WINDOW_ADJUST -paramiko.kex_gex.MSG_CHANNEL_REQUEST paramiko.kex_gex-module.html#MSG_CHANNEL_REQUEST -paramiko.kex_gex.MSG_NAMES paramiko.kex_gex-module.html#MSG_NAMES -paramiko.kex_gex.MSG_CHANNEL_OPEN paramiko.kex_gex-module.html#MSG_CHANNEL_OPEN -paramiko.kex_gex.MSG_REQUEST_SUCCESS paramiko.kex_gex-module.html#MSG_REQUEST_SUCCESS -paramiko.kex_gex.MSG_DISCONNECT paramiko.kex_gex-module.html#MSG_DISCONNECT -paramiko.kex_gex.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE paramiko.kex_gex-module.html#DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE -paramiko.kex_gex.MSG_SERVICE_ACCEPT paramiko.kex_gex-module.html#MSG_SERVICE_ACCEPT -paramiko.kex_gex.MSG_IGNORE paramiko.kex_gex-module.html#MSG_IGNORE -paramiko.kex_gex.rng paramiko.kex_gex-module.html#rng -paramiko.kex_gex.WARNING paramiko.kex_gex-module.html#WARNING -paramiko.kex_gex.MSG_GLOBAL_REQUEST paramiko.kex_gex-module.html#MSG_GLOBAL_REQUEST -paramiko.kex_gex.MSG_USERAUTH_INFO_RESPONSE paramiko.kex_gex-module.html#MSG_USERAUTH_INFO_RESPONSE -paramiko.kex_gex.MSG_CHANNEL_SUCCESS paramiko.kex_gex-module.html#MSG_CHANNEL_SUCCESS -paramiko.kex_gex.MSG_USERAUTH_FAILURE paramiko.kex_gex-module.html#MSG_USERAUTH_FAILURE -paramiko.kex_gex.MSG_REQUEST_FAILURE paramiko.kex_gex-module.html#MSG_REQUEST_FAILURE -paramiko.kex_gex.__package__ paramiko.kex_gex-module.html#__package__ -paramiko.kex_gex.MSG_CHANNEL_DATA paramiko.kex_gex-module.html#MSG_CHANNEL_DATA -paramiko.kex_gex.CRITICAL paramiko.kex_gex-module.html#CRITICAL -paramiko.kex_gex._MSG_KEXDH_GEX_REQUEST_OLD paramiko.kex_gex-module.html#_MSG_KEXDH_GEX_REQUEST_OLD -paramiko.kex_gex.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED paramiko.kex_gex-module.html#OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -paramiko.kex_gex.MSG_UNIMPLEMENTED paramiko.kex_gex-module.html#MSG_UNIMPLEMENTED -paramiko.kex_gex.MSG_CHANNEL_OPEN_FAILURE paramiko.kex_gex-module.html#MSG_CHANNEL_OPEN_FAILURE -paramiko.kex_gex.MSG_USERAUTH_INFO_REQUEST paramiko.kex_gex-module.html#MSG_USERAUTH_INFO_REQUEST -paramiko.kex_gex.MSG_DEBUG paramiko.kex_gex-module.html#MSG_DEBUG -paramiko.kex_gex.MSG_CHANNEL_FAILURE paramiko.kex_gex-module.html#MSG_CHANNEL_FAILURE -paramiko.kex_gex.OPEN_SUCCEEDED paramiko.kex_gex-module.html#OPEN_SUCCEEDED -paramiko.kex_gex._MSG_KEXDH_GEX_INIT paramiko.kex_gex-module.html#_MSG_KEXDH_GEX_INIT -paramiko.kex_gex.OPEN_FAILED_UNKNOWN_CHANNEL_TYPE paramiko.kex_gex-module.html#OPEN_FAILED_UNKNOWN_CHANNEL_TYPE -paramiko.kex_gex.OPEN_FAILED_RESOURCE_SHORTAGE paramiko.kex_gex-module.html#OPEN_FAILED_RESOURCE_SHORTAGE -paramiko.kex_gex._MSG_KEXDH_GEX_REPLY paramiko.kex_gex-module.html#_MSG_KEXDH_GEX_REPLY -paramiko.kex_gex.ERROR paramiko.kex_gex-module.html#ERROR -paramiko.kex_gex.DEBUG paramiko.kex_gex-module.html#DEBUG -paramiko.kex_gex._MSG_KEXDH_GEX_GROUP paramiko.kex_gex-module.html#_MSG_KEXDH_GEX_GROUP -paramiko.kex_gex.AUTH_PARTIALLY_SUCCESSFUL paramiko.kex_gex-module.html#AUTH_PARTIALLY_SUCCESSFUL -paramiko.kex_gex.OPEN_FAILED_CONNECT_FAILED paramiko.kex_gex-module.html#OPEN_FAILED_CONNECT_FAILED -paramiko.kex_gex.INFO paramiko.kex_gex-module.html#INFO -paramiko.kex_gex.MSG_USERAUTH_BANNER paramiko.kex_gex-module.html#MSG_USERAUTH_BANNER -paramiko.kex_gex.MSG_NEWKEYS paramiko.kex_gex-module.html#MSG_NEWKEYS -paramiko.kex_gex.MSG_USERAUTH_PK_OK paramiko.kex_gex-module.html#MSG_USERAUTH_PK_OK -paramiko.kex_gex.MSG_USERAUTH_REQUEST paramiko.kex_gex-module.html#MSG_USERAUTH_REQUEST -paramiko.kex_gex.DISCONNECT_SERVICE_NOT_AVAILABLE paramiko.kex_gex-module.html#DISCONNECT_SERVICE_NOT_AVAILABLE -paramiko.kex_gex.PY22 paramiko.kex_gex-module.html#PY22 -paramiko.kex_gex.MSG_SERVICE_REQUEST paramiko.kex_gex-module.html#MSG_SERVICE_REQUEST -paramiko.kex_gex.AUTH_FAILED paramiko.kex_gex-module.html#AUTH_FAILED -paramiko.kex_gex._MSG_KEXDH_GEX_REQUEST paramiko.kex_gex-module.html#_MSG_KEXDH_GEX_REQUEST -paramiko.kex_gex.MSG_CHANNEL_EXTENDED_DATA paramiko.kex_gex-module.html#MSG_CHANNEL_EXTENDED_DATA -paramiko.kex_gex.MSG_CHANNEL_CLOSE paramiko.kex_gex-module.html#MSG_CHANNEL_CLOSE -paramiko.kex_gex.DISCONNECT_AUTH_CANCELLED_BY_USER paramiko.kex_gex-module.html#DISCONNECT_AUTH_CANCELLED_BY_USER -paramiko.kex_gex.MSG_CHANNEL_OPEN_SUCCESS paramiko.kex_gex-module.html#MSG_CHANNEL_OPEN_SUCCESS -paramiko.kex_gex.MSG_CHANNEL_EOF paramiko.kex_gex-module.html#MSG_CHANNEL_EOF -paramiko.kex_gex.MSG_USERAUTH_SUCCESS paramiko.kex_gex-module.html#MSG_USERAUTH_SUCCESS -paramiko.kex_gex.CONNECTION_FAILED_CODE paramiko.kex_gex-module.html#CONNECTION_FAILED_CODE -paramiko.kex_group1 paramiko.kex_group1-module.html -paramiko.kex_group1.AUTH_SUCCESSFUL paramiko.kex_group1-module.html#AUTH_SUCCESSFUL -paramiko.kex_group1.MSG_KEXINIT paramiko.kex_group1-module.html#MSG_KEXINIT -paramiko.kex_group1.MSG_CHANNEL_WINDOW_ADJUST paramiko.kex_group1-module.html#MSG_CHANNEL_WINDOW_ADJUST -paramiko.kex_group1.MSG_CHANNEL_REQUEST paramiko.kex_group1-module.html#MSG_CHANNEL_REQUEST -paramiko.kex_group1.MSG_NAMES paramiko.kex_group1-module.html#MSG_NAMES -paramiko.kex_group1.MSG_CHANNEL_OPEN paramiko.kex_group1-module.html#MSG_CHANNEL_OPEN -paramiko.kex_group1.MSG_REQUEST_SUCCESS paramiko.kex_group1-module.html#MSG_REQUEST_SUCCESS -paramiko.kex_group1.MSG_DISCONNECT paramiko.kex_group1-module.html#MSG_DISCONNECT -paramiko.kex_group1.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE paramiko.kex_group1-module.html#DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE -paramiko.kex_group1.MSG_SERVICE_ACCEPT paramiko.kex_group1-module.html#MSG_SERVICE_ACCEPT -paramiko.kex_group1.MSG_IGNORE paramiko.kex_group1-module.html#MSG_IGNORE -paramiko.kex_group1.WARNING paramiko.kex_group1-module.html#WARNING -paramiko.kex_group1.MSG_GLOBAL_REQUEST paramiko.kex_group1-module.html#MSG_GLOBAL_REQUEST -paramiko.kex_group1.MSG_USERAUTH_INFO_RESPONSE paramiko.kex_group1-module.html#MSG_USERAUTH_INFO_RESPONSE -paramiko.kex_group1.MSG_DEBUG paramiko.kex_group1-module.html#MSG_DEBUG -paramiko.kex_group1.P paramiko.kex_group1-module.html#P -paramiko.kex_group1.MSG_CHANNEL_SUCCESS paramiko.kex_group1-module.html#MSG_CHANNEL_SUCCESS -paramiko.kex_group1.MSG_USERAUTH_FAILURE paramiko.kex_group1-module.html#MSG_USERAUTH_FAILURE -paramiko.kex_group1.MSG_REQUEST_FAILURE paramiko.kex_group1-module.html#MSG_REQUEST_FAILURE -paramiko.kex_group1.__package__ paramiko.kex_group1-module.html#__package__ -paramiko.kex_group1.MSG_CHANNEL_DATA paramiko.kex_group1-module.html#MSG_CHANNEL_DATA -paramiko.kex_group1.CRITICAL paramiko.kex_group1-module.html#CRITICAL -paramiko.kex_group1.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED paramiko.kex_group1-module.html#OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -paramiko.kex_group1.MSG_UNIMPLEMENTED paramiko.kex_group1-module.html#MSG_UNIMPLEMENTED -paramiko.kex_group1.MSG_CHANNEL_OPEN_FAILURE paramiko.kex_group1-module.html#MSG_CHANNEL_OPEN_FAILURE -paramiko.kex_group1.MSG_USERAUTH_INFO_REQUEST paramiko.kex_group1-module.html#MSG_USERAUTH_INFO_REQUEST -paramiko.kex_group1.G paramiko.kex_group1-module.html#G -paramiko.kex_group1.MSG_CHANNEL_FAILURE paramiko.kex_group1-module.html#MSG_CHANNEL_FAILURE -paramiko.kex_group1.OPEN_SUCCEEDED paramiko.kex_group1-module.html#OPEN_SUCCEEDED -paramiko.kex_group1.rng paramiko.kex_group1-module.html#rng -paramiko.kex_group1.OPEN_FAILED_UNKNOWN_CHANNEL_TYPE paramiko.kex_group1-module.html#OPEN_FAILED_UNKNOWN_CHANNEL_TYPE -paramiko.kex_group1.OPEN_FAILED_RESOURCE_SHORTAGE paramiko.kex_group1-module.html#OPEN_FAILED_RESOURCE_SHORTAGE -paramiko.kex_group1._MSG_KEXDH_INIT paramiko.kex_group1-module.html#_MSG_KEXDH_INIT -paramiko.kex_group1.ERROR paramiko.kex_group1-module.html#ERROR -paramiko.kex_group1.DEBUG paramiko.kex_group1-module.html#DEBUG -paramiko.kex_group1.AUTH_PARTIALLY_SUCCESSFUL paramiko.kex_group1-module.html#AUTH_PARTIALLY_SUCCESSFUL -paramiko.kex_group1._MSG_KEXDH_REPLY paramiko.kex_group1-module.html#_MSG_KEXDH_REPLY -paramiko.kex_group1.OPEN_FAILED_CONNECT_FAILED paramiko.kex_group1-module.html#OPEN_FAILED_CONNECT_FAILED -paramiko.kex_group1.INFO paramiko.kex_group1-module.html#INFO -paramiko.kex_group1.MSG_USERAUTH_BANNER paramiko.kex_group1-module.html#MSG_USERAUTH_BANNER -paramiko.kex_group1.MSG_NEWKEYS paramiko.kex_group1-module.html#MSG_NEWKEYS -paramiko.kex_group1.MSG_USERAUTH_PK_OK paramiko.kex_group1-module.html#MSG_USERAUTH_PK_OK -paramiko.kex_group1.MSG_USERAUTH_REQUEST paramiko.kex_group1-module.html#MSG_USERAUTH_REQUEST -paramiko.kex_group1.DISCONNECT_SERVICE_NOT_AVAILABLE paramiko.kex_group1-module.html#DISCONNECT_SERVICE_NOT_AVAILABLE -paramiko.kex_group1.PY22 paramiko.kex_group1-module.html#PY22 -paramiko.kex_group1.MSG_SERVICE_REQUEST paramiko.kex_group1-module.html#MSG_SERVICE_REQUEST -paramiko.kex_group1.AUTH_FAILED paramiko.kex_group1-module.html#AUTH_FAILED -paramiko.kex_group1.MSG_CHANNEL_EXTENDED_DATA paramiko.kex_group1-module.html#MSG_CHANNEL_EXTENDED_DATA -paramiko.kex_group1.MSG_CHANNEL_CLOSE paramiko.kex_group1-module.html#MSG_CHANNEL_CLOSE -paramiko.kex_group1.DISCONNECT_AUTH_CANCELLED_BY_USER paramiko.kex_group1-module.html#DISCONNECT_AUTH_CANCELLED_BY_USER -paramiko.kex_group1.MSG_CHANNEL_OPEN_SUCCESS paramiko.kex_group1-module.html#MSG_CHANNEL_OPEN_SUCCESS -paramiko.kex_group1.MSG_CHANNEL_EOF paramiko.kex_group1-module.html#MSG_CHANNEL_EOF -paramiko.kex_group1.MSG_USERAUTH_SUCCESS paramiko.kex_group1-module.html#MSG_USERAUTH_SUCCESS -paramiko.kex_group1.CONNECTION_FAILED_CODE paramiko.kex_group1-module.html#CONNECTION_FAILED_CODE -paramiko.logging22 paramiko.logging22-module.html -paramiko.logging22.INFO paramiko.logging22-module.html#INFO -paramiko.logging22.WARNING paramiko.logging22-module.html#WARNING -paramiko.logging22._logger paramiko.logging22-module.html#_logger -paramiko.logging22.__package__ paramiko.logging22-module.html#__package__ -paramiko.logging22.getLogger paramiko.logging22-module.html#getLogger -paramiko.logging22.CRITICAL paramiko.logging22-module.html#CRITICAL -paramiko.logging22.ERROR paramiko.logging22-module.html#ERROR -paramiko.logging22.DEBUG paramiko.logging22-module.html#DEBUG -paramiko.message paramiko.message-module.html -paramiko.message.__package__ paramiko.message-module.html#__package__ -paramiko.packet paramiko.packet-module.html -paramiko.packet.AUTH_SUCCESSFUL paramiko.packet-module.html#AUTH_SUCCESSFUL -paramiko.packet.MSG_KEXINIT paramiko.packet-module.html#MSG_KEXINIT -paramiko.packet.MSG_CHANNEL_WINDOW_ADJUST paramiko.packet-module.html#MSG_CHANNEL_WINDOW_ADJUST -paramiko.packet.MSG_CHANNEL_REQUEST paramiko.packet-module.html#MSG_CHANNEL_REQUEST -paramiko.packet.MSG_NAMES paramiko.packet-module.html#MSG_NAMES -paramiko.packet.PY22 paramiko.packet-module.html#PY22 -paramiko.packet.MSG_CHANNEL_OPEN paramiko.packet-module.html#MSG_CHANNEL_OPEN -paramiko.packet.MSG_REQUEST_SUCCESS paramiko.packet-module.html#MSG_REQUEST_SUCCESS -paramiko.packet.MSG_DISCONNECT paramiko.packet-module.html#MSG_DISCONNECT -paramiko.packet.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE paramiko.packet-module.html#DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE -paramiko.packet.MSG_SERVICE_ACCEPT paramiko.packet-module.html#MSG_SERVICE_ACCEPT -paramiko.packet.MSG_IGNORE paramiko.packet-module.html#MSG_IGNORE -paramiko.packet.WARNING paramiko.packet-module.html#WARNING -paramiko.packet.MSG_GLOBAL_REQUEST paramiko.packet-module.html#MSG_GLOBAL_REQUEST -paramiko.packet.MSG_USERAUTH_INFO_RESPONSE paramiko.packet-module.html#MSG_USERAUTH_INFO_RESPONSE -paramiko.packet.MSG_CHANNEL_SUCCESS paramiko.packet-module.html#MSG_CHANNEL_SUCCESS -paramiko.packet.MSG_USERAUTH_FAILURE paramiko.packet-module.html#MSG_USERAUTH_FAILURE -paramiko.packet.compute_hmac paramiko.packet-module.html#compute_hmac -paramiko.packet.MSG_REQUEST_FAILURE paramiko.packet-module.html#MSG_REQUEST_FAILURE -paramiko.packet.__package__ paramiko.packet-module.html#__package__ -paramiko.packet.MSG_CHANNEL_DATA paramiko.packet-module.html#MSG_CHANNEL_DATA -paramiko.packet.CRITICAL paramiko.packet-module.html#CRITICAL -paramiko.packet.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED paramiko.packet-module.html#OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -paramiko.packet.got_r_hmac paramiko.packet-module.html#got_r_hmac -paramiko.packet.MSG_UNIMPLEMENTED paramiko.packet-module.html#MSG_UNIMPLEMENTED -paramiko.packet.MSG_CHANNEL_OPEN_FAILURE paramiko.packet-module.html#MSG_CHANNEL_OPEN_FAILURE -paramiko.packet.MSG_USERAUTH_INFO_REQUEST paramiko.packet-module.html#MSG_USERAUTH_INFO_REQUEST -paramiko.packet.MSG_DEBUG paramiko.packet-module.html#MSG_DEBUG -paramiko.packet.MSG_CHANNEL_FAILURE paramiko.packet-module.html#MSG_CHANNEL_FAILURE -paramiko.packet.OPEN_SUCCEEDED paramiko.packet-module.html#OPEN_SUCCEEDED -paramiko.packet.rng paramiko.packet-module.html#rng -paramiko.packet.OPEN_FAILED_UNKNOWN_CHANNEL_TYPE paramiko.packet-module.html#OPEN_FAILED_UNKNOWN_CHANNEL_TYPE -paramiko.packet.OPEN_FAILED_RESOURCE_SHORTAGE paramiko.packet-module.html#OPEN_FAILED_RESOURCE_SHORTAGE -paramiko.packet.ERROR paramiko.packet-module.html#ERROR -paramiko.packet.DEBUG paramiko.packet-module.html#DEBUG -paramiko.packet.AUTH_PARTIALLY_SUCCESSFUL paramiko.packet-module.html#AUTH_PARTIALLY_SUCCESSFUL -paramiko.packet.OPEN_FAILED_CONNECT_FAILED paramiko.packet-module.html#OPEN_FAILED_CONNECT_FAILED -paramiko.packet.INFO paramiko.packet-module.html#INFO -paramiko.packet.MSG_USERAUTH_BANNER paramiko.packet-module.html#MSG_USERAUTH_BANNER -paramiko.packet.MSG_NEWKEYS paramiko.packet-module.html#MSG_NEWKEYS -paramiko.packet.MSG_USERAUTH_PK_OK paramiko.packet-module.html#MSG_USERAUTH_PK_OK -paramiko.packet.MSG_USERAUTH_REQUEST paramiko.packet-module.html#MSG_USERAUTH_REQUEST -paramiko.packet.DISCONNECT_SERVICE_NOT_AVAILABLE paramiko.packet-module.html#DISCONNECT_SERVICE_NOT_AVAILABLE -paramiko.packet.MSG_SERVICE_REQUEST paramiko.packet-module.html#MSG_SERVICE_REQUEST -paramiko.packet.AUTH_FAILED paramiko.packet-module.html#AUTH_FAILED -paramiko.packet.MSG_CHANNEL_EXTENDED_DATA paramiko.packet-module.html#MSG_CHANNEL_EXTENDED_DATA -paramiko.packet.MSG_CHANNEL_CLOSE paramiko.packet-module.html#MSG_CHANNEL_CLOSE -paramiko.packet.DISCONNECT_AUTH_CANCELLED_BY_USER paramiko.packet-module.html#DISCONNECT_AUTH_CANCELLED_BY_USER -paramiko.packet.MSG_CHANNEL_OPEN_SUCCESS paramiko.packet-module.html#MSG_CHANNEL_OPEN_SUCCESS -paramiko.packet.MSG_CHANNEL_EOF paramiko.packet-module.html#MSG_CHANNEL_EOF -paramiko.packet.MSG_USERAUTH_SUCCESS paramiko.packet-module.html#MSG_USERAUTH_SUCCESS -paramiko.packet.CONNECTION_FAILED_CODE paramiko.packet-module.html#CONNECTION_FAILED_CODE -paramiko.pipe paramiko.pipe-module.html -paramiko.pipe.make_or_pipe paramiko.pipe-module.html#make_or_pipe -paramiko.pipe.__package__ paramiko.pipe-module.html#__package__ -paramiko.pipe.make_pipe paramiko.pipe-module.html#make_pipe -paramiko.pkey paramiko.pkey-module.html -paramiko.pkey.AUTH_SUCCESSFUL paramiko.pkey-module.html#AUTH_SUCCESSFUL -paramiko.pkey.MSG_KEXINIT paramiko.pkey-module.html#MSG_KEXINIT -paramiko.pkey.MSG_CHANNEL_WINDOW_ADJUST paramiko.pkey-module.html#MSG_CHANNEL_WINDOW_ADJUST -paramiko.pkey.MSG_CHANNEL_REQUEST paramiko.pkey-module.html#MSG_CHANNEL_REQUEST -paramiko.pkey.MSG_NAMES paramiko.pkey-module.html#MSG_NAMES -paramiko.pkey.__package__ paramiko.pkey-module.html#__package__ -paramiko.pkey.MSG_CHANNEL_OPEN paramiko.pkey-module.html#MSG_CHANNEL_OPEN -paramiko.pkey.MSG_REQUEST_SUCCESS paramiko.pkey-module.html#MSG_REQUEST_SUCCESS -paramiko.pkey.MSG_DISCONNECT paramiko.pkey-module.html#MSG_DISCONNECT -paramiko.pkey.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE paramiko.pkey-module.html#DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE -paramiko.pkey.MSG_SERVICE_ACCEPT paramiko.pkey-module.html#MSG_SERVICE_ACCEPT -paramiko.pkey.MSG_IGNORE paramiko.pkey-module.html#MSG_IGNORE -paramiko.pkey.WARNING paramiko.pkey-module.html#WARNING -paramiko.pkey.MSG_GLOBAL_REQUEST paramiko.pkey-module.html#MSG_GLOBAL_REQUEST -paramiko.pkey.MSG_USERAUTH_INFO_RESPONSE paramiko.pkey-module.html#MSG_USERAUTH_INFO_RESPONSE -paramiko.pkey.MSG_CHANNEL_SUCCESS paramiko.pkey-module.html#MSG_CHANNEL_SUCCESS -paramiko.pkey.MSG_USERAUTH_FAILURE paramiko.pkey-module.html#MSG_USERAUTH_FAILURE -paramiko.pkey.MSG_REQUEST_FAILURE paramiko.pkey-module.html#MSG_REQUEST_FAILURE -paramiko.pkey.MSG_CHANNEL_DATA paramiko.pkey-module.html#MSG_CHANNEL_DATA -paramiko.pkey.CRITICAL paramiko.pkey-module.html#CRITICAL -paramiko.pkey.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED paramiko.pkey-module.html#OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -paramiko.pkey.MSG_UNIMPLEMENTED paramiko.pkey-module.html#MSG_UNIMPLEMENTED -paramiko.pkey.OPEN_FAILED_CONNECT_FAILED paramiko.pkey-module.html#OPEN_FAILED_CONNECT_FAILED -paramiko.pkey.MSG_CHANNEL_OPEN_FAILURE paramiko.pkey-module.html#MSG_CHANNEL_OPEN_FAILURE -paramiko.pkey.MSG_USERAUTH_INFO_REQUEST paramiko.pkey-module.html#MSG_USERAUTH_INFO_REQUEST -paramiko.pkey.MSG_DEBUG paramiko.pkey-module.html#MSG_DEBUG -paramiko.pkey.MSG_CHANNEL_FAILURE paramiko.pkey-module.html#MSG_CHANNEL_FAILURE -paramiko.pkey.OPEN_SUCCEEDED paramiko.pkey-module.html#OPEN_SUCCEEDED -paramiko.pkey.rng paramiko.pkey-module.html#rng -paramiko.pkey.OPEN_FAILED_UNKNOWN_CHANNEL_TYPE paramiko.pkey-module.html#OPEN_FAILED_UNKNOWN_CHANNEL_TYPE -paramiko.pkey.OPEN_FAILED_RESOURCE_SHORTAGE paramiko.pkey-module.html#OPEN_FAILED_RESOURCE_SHORTAGE -paramiko.pkey.ERROR paramiko.pkey-module.html#ERROR -paramiko.pkey.DEBUG paramiko.pkey-module.html#DEBUG -paramiko.pkey.AUTH_PARTIALLY_SUCCESSFUL paramiko.pkey-module.html#AUTH_PARTIALLY_SUCCESSFUL -paramiko.pkey.INFO paramiko.pkey-module.html#INFO -paramiko.pkey.MSG_USERAUTH_BANNER paramiko.pkey-module.html#MSG_USERAUTH_BANNER -paramiko.pkey.MSG_NEWKEYS paramiko.pkey-module.html#MSG_NEWKEYS -paramiko.pkey.MSG_USERAUTH_PK_OK paramiko.pkey-module.html#MSG_USERAUTH_PK_OK -paramiko.pkey.MSG_USERAUTH_REQUEST paramiko.pkey-module.html#MSG_USERAUTH_REQUEST -paramiko.pkey.DISCONNECT_SERVICE_NOT_AVAILABLE paramiko.pkey-module.html#DISCONNECT_SERVICE_NOT_AVAILABLE -paramiko.pkey.PY22 paramiko.pkey-module.html#PY22 -paramiko.pkey.MSG_SERVICE_REQUEST paramiko.pkey-module.html#MSG_SERVICE_REQUEST -paramiko.pkey.AUTH_FAILED paramiko.pkey-module.html#AUTH_FAILED -paramiko.pkey.MSG_CHANNEL_EXTENDED_DATA paramiko.pkey-module.html#MSG_CHANNEL_EXTENDED_DATA -paramiko.pkey.MSG_CHANNEL_CLOSE paramiko.pkey-module.html#MSG_CHANNEL_CLOSE -paramiko.pkey.DISCONNECT_AUTH_CANCELLED_BY_USER paramiko.pkey-module.html#DISCONNECT_AUTH_CANCELLED_BY_USER -paramiko.pkey.MSG_CHANNEL_OPEN_SUCCESS paramiko.pkey-module.html#MSG_CHANNEL_OPEN_SUCCESS -paramiko.pkey.MSG_CHANNEL_EOF paramiko.pkey-module.html#MSG_CHANNEL_EOF -paramiko.pkey.MSG_USERAUTH_SUCCESS paramiko.pkey-module.html#MSG_USERAUTH_SUCCESS -paramiko.pkey.CONNECTION_FAILED_CODE paramiko.pkey-module.html#CONNECTION_FAILED_CODE -paramiko.primes paramiko.primes-module.html -paramiko.primes._roll_random paramiko.primes-module.html#_roll_random -paramiko.primes._generate_prime paramiko.primes-module.html#_generate_prime -paramiko.primes.__package__ paramiko.primes-module.html#__package__ -paramiko.resource paramiko.resource-module.html -paramiko.resource.ResourceManager paramiko.resource-module.html#ResourceManager -paramiko.resource.__package__ paramiko.resource-module.html#__package__ -paramiko.rsakey paramiko.rsakey-module.html -paramiko.rsakey.AUTH_SUCCESSFUL paramiko.rsakey-module.html#AUTH_SUCCESSFUL -paramiko.rsakey.MSG_KEXINIT paramiko.rsakey-module.html#MSG_KEXINIT -paramiko.rsakey.MSG_CHANNEL_WINDOW_ADJUST paramiko.rsakey-module.html#MSG_CHANNEL_WINDOW_ADJUST -paramiko.rsakey.MSG_CHANNEL_REQUEST paramiko.rsakey-module.html#MSG_CHANNEL_REQUEST -paramiko.rsakey.MSG_NAMES paramiko.rsakey-module.html#MSG_NAMES -paramiko.rsakey.__package__ paramiko.rsakey-module.html#__package__ -paramiko.rsakey.MSG_CHANNEL_OPEN paramiko.rsakey-module.html#MSG_CHANNEL_OPEN -paramiko.rsakey.MSG_REQUEST_SUCCESS paramiko.rsakey-module.html#MSG_REQUEST_SUCCESS -paramiko.rsakey.MSG_DISCONNECT paramiko.rsakey-module.html#MSG_DISCONNECT -paramiko.rsakey.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE paramiko.rsakey-module.html#DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE -paramiko.rsakey.MSG_SERVICE_ACCEPT paramiko.rsakey-module.html#MSG_SERVICE_ACCEPT -paramiko.rsakey.MSG_IGNORE paramiko.rsakey-module.html#MSG_IGNORE -paramiko.rsakey.WARNING paramiko.rsakey-module.html#WARNING -paramiko.rsakey.MSG_GLOBAL_REQUEST paramiko.rsakey-module.html#MSG_GLOBAL_REQUEST -paramiko.rsakey.MSG_USERAUTH_INFO_RESPONSE paramiko.rsakey-module.html#MSG_USERAUTH_INFO_RESPONSE -paramiko.rsakey.MSG_CHANNEL_SUCCESS paramiko.rsakey-module.html#MSG_CHANNEL_SUCCESS -paramiko.rsakey.MSG_USERAUTH_FAILURE paramiko.rsakey-module.html#MSG_USERAUTH_FAILURE -paramiko.rsakey.MSG_REQUEST_FAILURE paramiko.rsakey-module.html#MSG_REQUEST_FAILURE -paramiko.rsakey.MSG_CHANNEL_DATA paramiko.rsakey-module.html#MSG_CHANNEL_DATA -paramiko.rsakey.CRITICAL paramiko.rsakey-module.html#CRITICAL -paramiko.rsakey.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED paramiko.rsakey-module.html#OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -paramiko.rsakey.MSG_UNIMPLEMENTED paramiko.rsakey-module.html#MSG_UNIMPLEMENTED -paramiko.rsakey.OPEN_FAILED_CONNECT_FAILED paramiko.rsakey-module.html#OPEN_FAILED_CONNECT_FAILED -paramiko.rsakey.MSG_CHANNEL_OPEN_FAILURE paramiko.rsakey-module.html#MSG_CHANNEL_OPEN_FAILURE -paramiko.rsakey.MSG_USERAUTH_INFO_REQUEST paramiko.rsakey-module.html#MSG_USERAUTH_INFO_REQUEST -paramiko.rsakey.MSG_DEBUG paramiko.rsakey-module.html#MSG_DEBUG -paramiko.rsakey.MSG_CHANNEL_FAILURE paramiko.rsakey-module.html#MSG_CHANNEL_FAILURE -paramiko.rsakey.OPEN_SUCCEEDED paramiko.rsakey-module.html#OPEN_SUCCEEDED -paramiko.rsakey.rng paramiko.rsakey-module.html#rng -paramiko.rsakey.OPEN_FAILED_UNKNOWN_CHANNEL_TYPE paramiko.rsakey-module.html#OPEN_FAILED_UNKNOWN_CHANNEL_TYPE -paramiko.rsakey.OPEN_FAILED_RESOURCE_SHORTAGE paramiko.rsakey-module.html#OPEN_FAILED_RESOURCE_SHORTAGE -paramiko.rsakey.ERROR paramiko.rsakey-module.html#ERROR -paramiko.rsakey.DEBUG paramiko.rsakey-module.html#DEBUG -paramiko.rsakey.AUTH_PARTIALLY_SUCCESSFUL paramiko.rsakey-module.html#AUTH_PARTIALLY_SUCCESSFUL -paramiko.rsakey.INFO paramiko.rsakey-module.html#INFO -paramiko.rsakey.MSG_USERAUTH_BANNER paramiko.rsakey-module.html#MSG_USERAUTH_BANNER -paramiko.rsakey.MSG_NEWKEYS paramiko.rsakey-module.html#MSG_NEWKEYS -paramiko.rsakey.MSG_USERAUTH_PK_OK paramiko.rsakey-module.html#MSG_USERAUTH_PK_OK -paramiko.rsakey.MSG_USERAUTH_REQUEST paramiko.rsakey-module.html#MSG_USERAUTH_REQUEST -paramiko.rsakey.DISCONNECT_SERVICE_NOT_AVAILABLE paramiko.rsakey-module.html#DISCONNECT_SERVICE_NOT_AVAILABLE -paramiko.rsakey.PY22 paramiko.rsakey-module.html#PY22 -paramiko.rsakey.MSG_SERVICE_REQUEST paramiko.rsakey-module.html#MSG_SERVICE_REQUEST -paramiko.rsakey.AUTH_FAILED paramiko.rsakey-module.html#AUTH_FAILED -paramiko.rsakey.MSG_CHANNEL_EXTENDED_DATA paramiko.rsakey-module.html#MSG_CHANNEL_EXTENDED_DATA -paramiko.rsakey.MSG_CHANNEL_CLOSE paramiko.rsakey-module.html#MSG_CHANNEL_CLOSE -paramiko.rsakey.DISCONNECT_AUTH_CANCELLED_BY_USER paramiko.rsakey-module.html#DISCONNECT_AUTH_CANCELLED_BY_USER -paramiko.rsakey.MSG_CHANNEL_OPEN_SUCCESS paramiko.rsakey-module.html#MSG_CHANNEL_OPEN_SUCCESS -paramiko.rsakey.MSG_CHANNEL_EOF paramiko.rsakey-module.html#MSG_CHANNEL_EOF -paramiko.rsakey.MSG_USERAUTH_SUCCESS paramiko.rsakey-module.html#MSG_USERAUTH_SUCCESS -paramiko.rsakey.CONNECTION_FAILED_CODE paramiko.rsakey-module.html#CONNECTION_FAILED_CODE -paramiko.server paramiko.server-module.html -paramiko.server.AUTH_SUCCESSFUL paramiko.server-module.html#AUTH_SUCCESSFUL -paramiko.server.MSG_KEXINIT paramiko.server-module.html#MSG_KEXINIT -paramiko.server.MSG_CHANNEL_WINDOW_ADJUST paramiko.server-module.html#MSG_CHANNEL_WINDOW_ADJUST -paramiko.server.MSG_CHANNEL_REQUEST paramiko.server-module.html#MSG_CHANNEL_REQUEST -paramiko.server.MSG_NAMES paramiko.server-module.html#MSG_NAMES -paramiko.server.MSG_CHANNEL_OPEN paramiko.server-module.html#MSG_CHANNEL_OPEN -paramiko.server.MSG_REQUEST_SUCCESS paramiko.server-module.html#MSG_REQUEST_SUCCESS -paramiko.server.MSG_DISCONNECT paramiko.server-module.html#MSG_DISCONNECT -paramiko.server.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE paramiko.server-module.html#DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE -paramiko.server.MSG_SERVICE_ACCEPT paramiko.server-module.html#MSG_SERVICE_ACCEPT -paramiko.server.MSG_IGNORE paramiko.server-module.html#MSG_IGNORE -paramiko.server.MSG_GLOBAL_REQUEST paramiko.server-module.html#MSG_GLOBAL_REQUEST -paramiko.server.MSG_USERAUTH_INFO_RESPONSE paramiko.server-module.html#MSG_USERAUTH_INFO_RESPONSE -paramiko.server.AUTH_FAILED paramiko.server-module.html#AUTH_FAILED -paramiko.server.MSG_CHANNEL_SUCCESS paramiko.server-module.html#MSG_CHANNEL_SUCCESS -paramiko.server.MSG_USERAUTH_FAILURE paramiko.server-module.html#MSG_USERAUTH_FAILURE -paramiko.server.MSG_REQUEST_FAILURE paramiko.server-module.html#MSG_REQUEST_FAILURE -paramiko.server.__package__ paramiko.server-module.html#__package__ -paramiko.server.MSG_CHANNEL_DATA paramiko.server-module.html#MSG_CHANNEL_DATA -paramiko.server.CRITICAL paramiko.server-module.html#CRITICAL -paramiko.server.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED paramiko.server-module.html#OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -paramiko.server.MSG_UNIMPLEMENTED paramiko.server-module.html#MSG_UNIMPLEMENTED -paramiko.server.MSG_CHANNEL_OPEN_FAILURE paramiko.server-module.html#MSG_CHANNEL_OPEN_FAILURE -paramiko.server.MSG_USERAUTH_INFO_REQUEST paramiko.server-module.html#MSG_USERAUTH_INFO_REQUEST -paramiko.server.MSG_DEBUG paramiko.server-module.html#MSG_DEBUG -paramiko.server.MSG_CHANNEL_FAILURE paramiko.server-module.html#MSG_CHANNEL_FAILURE -paramiko.server.OPEN_SUCCEEDED paramiko.server-module.html#OPEN_SUCCEEDED -paramiko.server.rng paramiko.server-module.html#rng -paramiko.server.OPEN_FAILED_UNKNOWN_CHANNEL_TYPE paramiko.server-module.html#OPEN_FAILED_UNKNOWN_CHANNEL_TYPE -paramiko.server.OPEN_FAILED_RESOURCE_SHORTAGE paramiko.server-module.html#OPEN_FAILED_RESOURCE_SHORTAGE -paramiko.server.ERROR paramiko.server-module.html#ERROR -paramiko.server.DEBUG paramiko.server-module.html#DEBUG -paramiko.server.AUTH_PARTIALLY_SUCCESSFUL paramiko.server-module.html#AUTH_PARTIALLY_SUCCESSFUL -paramiko.server.OPEN_FAILED_CONNECT_FAILED paramiko.server-module.html#OPEN_FAILED_CONNECT_FAILED -paramiko.server.INFO paramiko.server-module.html#INFO -paramiko.server.MSG_USERAUTH_BANNER paramiko.server-module.html#MSG_USERAUTH_BANNER -paramiko.server.MSG_NEWKEYS paramiko.server-module.html#MSG_NEWKEYS -paramiko.server.MSG_USERAUTH_PK_OK paramiko.server-module.html#MSG_USERAUTH_PK_OK -paramiko.server.WARNING paramiko.server-module.html#WARNING -paramiko.server.MSG_USERAUTH_REQUEST paramiko.server-module.html#MSG_USERAUTH_REQUEST -paramiko.server.DISCONNECT_SERVICE_NOT_AVAILABLE paramiko.server-module.html#DISCONNECT_SERVICE_NOT_AVAILABLE -paramiko.server.PY22 paramiko.server-module.html#PY22 -paramiko.server.MSG_SERVICE_REQUEST paramiko.server-module.html#MSG_SERVICE_REQUEST -paramiko.server.MSG_CHANNEL_EXTENDED_DATA paramiko.server-module.html#MSG_CHANNEL_EXTENDED_DATA -paramiko.server.MSG_CHANNEL_CLOSE paramiko.server-module.html#MSG_CHANNEL_CLOSE -paramiko.server.DISCONNECT_AUTH_CANCELLED_BY_USER paramiko.server-module.html#DISCONNECT_AUTH_CANCELLED_BY_USER -paramiko.server.MSG_CHANNEL_OPEN_SUCCESS paramiko.server-module.html#MSG_CHANNEL_OPEN_SUCCESS -paramiko.server.MSG_CHANNEL_EOF paramiko.server-module.html#MSG_CHANNEL_EOF -paramiko.server.MSG_USERAUTH_SUCCESS paramiko.server-module.html#MSG_USERAUTH_SUCCESS -paramiko.server.CONNECTION_FAILED_CODE paramiko.server-module.html#CONNECTION_FAILED_CODE -paramiko.sftp paramiko.sftp-module.html -paramiko.sftp.MSG_NAMES paramiko.sftp-module.html#MSG_NAMES -paramiko.sftp.CMD_MKDIR paramiko.sftp-module.html#CMD_MKDIR -paramiko.sftp.SFTP_FLAG_APPEND paramiko.sftp-module.html#SFTP_FLAG_APPEND -paramiko.sftp.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE paramiko.sftp-module.html#DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE -paramiko.sftp.SFTP_DESC paramiko.sftp-module.html#SFTP_DESC -paramiko.sftp.CMD_LSTAT paramiko.sftp-module.html#CMD_LSTAT -paramiko.sftp.MSG_GLOBAL_REQUEST paramiko.sftp-module.html#MSG_GLOBAL_REQUEST -paramiko.sftp.MSG_CHANNEL_SUCCESS paramiko.sftp-module.html#MSG_CHANNEL_SUCCESS -paramiko.sftp.CRITICAL paramiko.sftp-module.html#CRITICAL -paramiko.sftp.SFTP_FLAG_READ paramiko.sftp-module.html#SFTP_FLAG_READ -paramiko.sftp.CMD_SYMLINK paramiko.sftp-module.html#CMD_SYMLINK -paramiko.sftp.OPEN_FAILED_RESOURCE_SHORTAGE paramiko.sftp-module.html#OPEN_FAILED_RESOURCE_SHORTAGE -paramiko.sftp.MSG_CHANNEL_OPEN_FAILURE paramiko.sftp-module.html#MSG_CHANNEL_OPEN_FAILURE -paramiko.sftp.CMD_VERSION paramiko.sftp-module.html#CMD_VERSION -paramiko.sftp.CMD_INIT paramiko.sftp-module.html#CMD_INIT -paramiko.sftp.CMD_EXTENDED paramiko.sftp-module.html#CMD_EXTENDED -paramiko.sftp.MSG_CHANNEL_EOF paramiko.sftp-module.html#MSG_CHANNEL_EOF -paramiko.sftp.SFTP_BAD_MESSAGE paramiko.sftp-module.html#SFTP_BAD_MESSAGE -paramiko.sftp.PY22 paramiko.sftp-module.html#PY22 -paramiko.sftp.CMD_READLINK paramiko.sftp-module.html#CMD_READLINK -paramiko.sftp.__package__ paramiko.sftp-module.html#__package__ -paramiko.sftp.DISCONNECT_AUTH_CANCELLED_BY_USER paramiko.sftp-module.html#DISCONNECT_AUTH_CANCELLED_BY_USER -paramiko.sftp.MSG_NEWKEYS paramiko.sftp-module.html#MSG_NEWKEYS -paramiko.sftp.MSG_USERAUTH_SUCCESS paramiko.sftp-module.html#MSG_USERAUTH_SUCCESS -paramiko.sftp.MSG_USERAUTH_PK_OK paramiko.sftp-module.html#MSG_USERAUTH_PK_OK -paramiko.sftp.CMD_READDIR paramiko.sftp-module.html#CMD_READDIR -paramiko.sftp.SFTP_FLAG_WRITE paramiko.sftp-module.html#SFTP_FLAG_WRITE -paramiko.sftp.CMD_NAMES paramiko.sftp-module.html#CMD_NAMES -paramiko.sftp.CMD_WRITE paramiko.sftp-module.html#CMD_WRITE -paramiko.sftp.CMD_OPEN paramiko.sftp-module.html#CMD_OPEN -paramiko.sftp.MSG_SERVICE_ACCEPT paramiko.sftp-module.html#MSG_SERVICE_ACCEPT -paramiko.sftp.WARNING paramiko.sftp-module.html#WARNING -paramiko.sftp.CMD_REMOVE paramiko.sftp-module.html#CMD_REMOVE -paramiko.sftp.SFTP_EOF paramiko.sftp-module.html#SFTP_EOF -paramiko.sftp.CMD_FSETSTAT paramiko.sftp-module.html#CMD_FSETSTAT -paramiko.sftp.SFTP_FLAG_TRUNC paramiko.sftp-module.html#SFTP_FLAG_TRUNC -paramiko.sftp.CMD_SETSTAT paramiko.sftp-module.html#CMD_SETSTAT -paramiko.sftp.ERROR paramiko.sftp-module.html#ERROR -paramiko.sftp.DEBUG paramiko.sftp-module.html#DEBUG -paramiko.sftp.CMD_FSTAT paramiko.sftp-module.html#CMD_FSTAT -paramiko.sftp.MSG_USERAUTH_BANNER paramiko.sftp-module.html#MSG_USERAUTH_BANNER -paramiko.sftp.CMD_OPENDIR paramiko.sftp-module.html#CMD_OPENDIR -paramiko.sftp.SFTP_FAILURE paramiko.sftp-module.html#SFTP_FAILURE -paramiko.sftp.SFTP_NO_CONNECTION paramiko.sftp-module.html#SFTP_NO_CONNECTION -paramiko.sftp.AUTH_FAILED paramiko.sftp-module.html#AUTH_FAILED -paramiko.sftp.MSG_REQUEST_SUCCESS paramiko.sftp-module.html#MSG_REQUEST_SUCCESS -paramiko.sftp.AUTH_SUCCESSFUL paramiko.sftp-module.html#AUTH_SUCCESSFUL -paramiko.sftp.MSG_CHANNEL_WINDOW_ADJUST paramiko.sftp-module.html#MSG_CHANNEL_WINDOW_ADJUST -paramiko.sftp.MSG_CHANNEL_REQUEST paramiko.sftp-module.html#MSG_CHANNEL_REQUEST -paramiko.sftp.MSG_USERAUTH_INFO_REQUEST paramiko.sftp-module.html#MSG_USERAUTH_INFO_REQUEST -paramiko.sftp.CMD_ATTRS paramiko.sftp-module.html#CMD_ATTRS -paramiko.sftp.CMD_EXTENDED_REPLY paramiko.sftp-module.html#CMD_EXTENDED_REPLY -paramiko.sftp.MSG_DISCONNECT paramiko.sftp-module.html#MSG_DISCONNECT -paramiko.sftp.MSG_IGNORE paramiko.sftp-module.html#MSG_IGNORE -paramiko.sftp.SFTP_FLAG_EXCL paramiko.sftp-module.html#SFTP_FLAG_EXCL -paramiko.sftp.SFTP_NO_SUCH_FILE paramiko.sftp-module.html#SFTP_NO_SUCH_FILE -paramiko.sftp.MSG_USERAUTH_FAILURE paramiko.sftp-module.html#MSG_USERAUTH_FAILURE -paramiko.sftp.MSG_KEXINIT paramiko.sftp-module.html#MSG_KEXINIT -paramiko.sftp.MSG_CHANNEL_DATA paramiko.sftp-module.html#MSG_CHANNEL_DATA -paramiko.sftp.CMD_CLOSE paramiko.sftp-module.html#CMD_CLOSE -paramiko.sftp.CMD_RENAME paramiko.sftp-module.html#CMD_RENAME -paramiko.sftp.SFTP_FLAG_CREATE paramiko.sftp-module.html#SFTP_FLAG_CREATE -paramiko.sftp.MSG_DEBUG paramiko.sftp-module.html#MSG_DEBUG -paramiko.sftp.SFTP_PERMISSION_DENIED paramiko.sftp-module.html#SFTP_PERMISSION_DENIED -paramiko.sftp.OPEN_SUCCEEDED paramiko.sftp-module.html#OPEN_SUCCEEDED -paramiko.sftp.OPEN_FAILED_UNKNOWN_CHANNEL_TYPE paramiko.sftp-module.html#OPEN_FAILED_UNKNOWN_CHANNEL_TYPE -paramiko.sftp.CMD_DATA paramiko.sftp-module.html#CMD_DATA -paramiko.sftp.MSG_UNIMPLEMENTED paramiko.sftp-module.html#MSG_UNIMPLEMENTED -paramiko.sftp.INFO paramiko.sftp-module.html#INFO -paramiko.sftp.CMD_STAT paramiko.sftp-module.html#CMD_STAT -paramiko.sftp.DISCONNECT_SERVICE_NOT_AVAILABLE paramiko.sftp-module.html#DISCONNECT_SERVICE_NOT_AVAILABLE -paramiko.sftp.MSG_CHANNEL_EXTENDED_DATA paramiko.sftp-module.html#MSG_CHANNEL_EXTENDED_DATA -paramiko.sftp.CMD_NAME paramiko.sftp-module.html#CMD_NAME -paramiko.sftp.CONNECTION_FAILED_CODE paramiko.sftp-module.html#CONNECTION_FAILED_CODE -paramiko.sftp.CMD_HANDLE paramiko.sftp-module.html#CMD_HANDLE -paramiko.sftp._VERSION paramiko.sftp-module.html#_VERSION -paramiko.sftp.MSG_CHANNEL_OPEN paramiko.sftp-module.html#MSG_CHANNEL_OPEN -paramiko.sftp.CMD_RMDIR paramiko.sftp-module.html#CMD_RMDIR -paramiko.sftp.SFTP_OK paramiko.sftp-module.html#SFTP_OK -paramiko.sftp.CMD_READ paramiko.sftp-module.html#CMD_READ -paramiko.sftp.SFTP_OP_UNSUPPORTED paramiko.sftp-module.html#SFTP_OP_UNSUPPORTED -paramiko.sftp.MSG_USERAUTH_INFO_RESPONSE paramiko.sftp-module.html#MSG_USERAUTH_INFO_RESPONSE -paramiko.sftp.MSG_REQUEST_FAILURE paramiko.sftp-module.html#MSG_REQUEST_FAILURE -paramiko.sftp.CMD_STATUS paramiko.sftp-module.html#CMD_STATUS -paramiko.sftp.AUTH_PARTIALLY_SUCCESSFUL paramiko.sftp-module.html#AUTH_PARTIALLY_SUCCESSFUL -paramiko.sftp.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED paramiko.sftp-module.html#OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -paramiko.sftp.MSG_CHANNEL_FAILURE paramiko.sftp-module.html#MSG_CHANNEL_FAILURE -paramiko.sftp.rng paramiko.sftp-module.html#rng -paramiko.sftp.SFTP_CONNECTION_LOST paramiko.sftp-module.html#SFTP_CONNECTION_LOST -paramiko.sftp.OPEN_FAILED_CONNECT_FAILED paramiko.sftp-module.html#OPEN_FAILED_CONNECT_FAILED -paramiko.sftp.MSG_USERAUTH_REQUEST paramiko.sftp-module.html#MSG_USERAUTH_REQUEST -paramiko.sftp.MSG_SERVICE_REQUEST paramiko.sftp-module.html#MSG_SERVICE_REQUEST -paramiko.sftp.CMD_REALPATH paramiko.sftp-module.html#CMD_REALPATH -paramiko.sftp.MSG_CHANNEL_CLOSE paramiko.sftp-module.html#MSG_CHANNEL_CLOSE -paramiko.sftp.MSG_CHANNEL_OPEN_SUCCESS paramiko.sftp-module.html#MSG_CHANNEL_OPEN_SUCCESS -paramiko.sftp_attr paramiko.sftp_attr-module.html -paramiko.sftp_attr.MSG_NAMES paramiko.sftp_attr-module.html#MSG_NAMES -paramiko.sftp_attr.CMD_MKDIR paramiko.sftp_attr-module.html#CMD_MKDIR -paramiko.sftp_attr.SFTP_FLAG_APPEND paramiko.sftp_attr-module.html#SFTP_FLAG_APPEND -paramiko.sftp_attr.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE paramiko.sftp_attr-module.html#DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE -paramiko.sftp_attr.SFTP_DESC paramiko.sftp_attr-module.html#SFTP_DESC -paramiko.sftp_attr.CMD_LSTAT paramiko.sftp_attr-module.html#CMD_LSTAT -paramiko.sftp_attr.MSG_GLOBAL_REQUEST paramiko.sftp_attr-module.html#MSG_GLOBAL_REQUEST -paramiko.sftp_attr.MSG_CHANNEL_SUCCESS paramiko.sftp_attr-module.html#MSG_CHANNEL_SUCCESS -paramiko.sftp_attr.CRITICAL paramiko.sftp_attr-module.html#CRITICAL -paramiko.sftp_attr.SFTP_FLAG_READ paramiko.sftp_attr-module.html#SFTP_FLAG_READ -paramiko.sftp_attr.CMD_SYMLINK paramiko.sftp_attr-module.html#CMD_SYMLINK -paramiko.sftp_attr.OPEN_FAILED_RESOURCE_SHORTAGE paramiko.sftp_attr-module.html#OPEN_FAILED_RESOURCE_SHORTAGE -paramiko.sftp_attr.MSG_CHANNEL_OPEN_FAILURE paramiko.sftp_attr-module.html#MSG_CHANNEL_OPEN_FAILURE -paramiko.sftp_attr.CMD_VERSION paramiko.sftp_attr-module.html#CMD_VERSION -paramiko.sftp_attr.CMD_INIT paramiko.sftp_attr-module.html#CMD_INIT -paramiko.sftp_attr.CMD_EXTENDED paramiko.sftp_attr-module.html#CMD_EXTENDED -paramiko.sftp_attr.MSG_CHANNEL_EOF paramiko.sftp_attr-module.html#MSG_CHANNEL_EOF -paramiko.sftp_attr.SFTP_BAD_MESSAGE paramiko.sftp_attr-module.html#SFTP_BAD_MESSAGE -paramiko.sftp_attr.PY22 paramiko.sftp_attr-module.html#PY22 -paramiko.sftp_attr.CMD_READLINK paramiko.sftp_attr-module.html#CMD_READLINK -paramiko.sftp_attr.__package__ paramiko.sftp_attr-module.html#__package__ -paramiko.sftp_attr.DISCONNECT_AUTH_CANCELLED_BY_USER paramiko.sftp_attr-module.html#DISCONNECT_AUTH_CANCELLED_BY_USER -paramiko.sftp_attr.MSG_NEWKEYS paramiko.sftp_attr-module.html#MSG_NEWKEYS -paramiko.sftp_attr.MSG_USERAUTH_SUCCESS paramiko.sftp_attr-module.html#MSG_USERAUTH_SUCCESS -paramiko.sftp_attr.MSG_USERAUTH_PK_OK paramiko.sftp_attr-module.html#MSG_USERAUTH_PK_OK -paramiko.sftp_attr.CMD_READDIR paramiko.sftp_attr-module.html#CMD_READDIR -paramiko.sftp_attr.SFTP_FLAG_WRITE paramiko.sftp_attr-module.html#SFTP_FLAG_WRITE -paramiko.sftp_attr.CMD_NAMES paramiko.sftp_attr-module.html#CMD_NAMES -paramiko.sftp_attr.CMD_WRITE paramiko.sftp_attr-module.html#CMD_WRITE -paramiko.sftp_attr.CMD_OPEN paramiko.sftp_attr-module.html#CMD_OPEN -paramiko.sftp_attr.MSG_SERVICE_ACCEPT paramiko.sftp_attr-module.html#MSG_SERVICE_ACCEPT -paramiko.sftp_attr.WARNING paramiko.sftp_attr-module.html#WARNING -paramiko.sftp_attr.CMD_REMOVE paramiko.sftp_attr-module.html#CMD_REMOVE -paramiko.sftp_attr.SFTP_EOF paramiko.sftp_attr-module.html#SFTP_EOF -paramiko.sftp_attr.CMD_FSETSTAT paramiko.sftp_attr-module.html#CMD_FSETSTAT -paramiko.sftp_attr.SFTP_FLAG_TRUNC paramiko.sftp_attr-module.html#SFTP_FLAG_TRUNC -paramiko.sftp_attr.CMD_SETSTAT paramiko.sftp_attr-module.html#CMD_SETSTAT -paramiko.sftp_attr.ERROR paramiko.sftp_attr-module.html#ERROR -paramiko.sftp_attr.DEBUG paramiko.sftp_attr-module.html#DEBUG -paramiko.sftp_attr.CMD_FSTAT paramiko.sftp_attr-module.html#CMD_FSTAT -paramiko.sftp_attr.MSG_USERAUTH_BANNER paramiko.sftp_attr-module.html#MSG_USERAUTH_BANNER -paramiko.sftp_attr.CMD_OPENDIR paramiko.sftp_attr-module.html#CMD_OPENDIR -paramiko.sftp_attr.SFTP_FAILURE paramiko.sftp_attr-module.html#SFTP_FAILURE -paramiko.sftp_attr.SFTP_NO_CONNECTION paramiko.sftp_attr-module.html#SFTP_NO_CONNECTION -paramiko.sftp_attr.AUTH_FAILED paramiko.sftp_attr-module.html#AUTH_FAILED -paramiko.sftp_attr.MSG_REQUEST_SUCCESS paramiko.sftp_attr-module.html#MSG_REQUEST_SUCCESS -paramiko.sftp_attr.AUTH_SUCCESSFUL paramiko.sftp_attr-module.html#AUTH_SUCCESSFUL -paramiko.sftp_attr.MSG_CHANNEL_WINDOW_ADJUST paramiko.sftp_attr-module.html#MSG_CHANNEL_WINDOW_ADJUST -paramiko.sftp_attr.MSG_CHANNEL_REQUEST paramiko.sftp_attr-module.html#MSG_CHANNEL_REQUEST -paramiko.sftp_attr.MSG_USERAUTH_INFO_REQUEST paramiko.sftp_attr-module.html#MSG_USERAUTH_INFO_REQUEST -paramiko.sftp_attr.CMD_ATTRS paramiko.sftp_attr-module.html#CMD_ATTRS -paramiko.sftp_attr.CMD_EXTENDED_REPLY paramiko.sftp_attr-module.html#CMD_EXTENDED_REPLY -paramiko.sftp_attr.MSG_DISCONNECT paramiko.sftp_attr-module.html#MSG_DISCONNECT -paramiko.sftp_attr.MSG_IGNORE paramiko.sftp_attr-module.html#MSG_IGNORE -paramiko.sftp_attr.SFTP_FLAG_EXCL paramiko.sftp_attr-module.html#SFTP_FLAG_EXCL -paramiko.sftp_attr.SFTP_NO_SUCH_FILE paramiko.sftp_attr-module.html#SFTP_NO_SUCH_FILE -paramiko.sftp_attr.MSG_USERAUTH_FAILURE paramiko.sftp_attr-module.html#MSG_USERAUTH_FAILURE -paramiko.sftp_attr.MSG_KEXINIT paramiko.sftp_attr-module.html#MSG_KEXINIT -paramiko.sftp_attr.MSG_CHANNEL_DATA paramiko.sftp_attr-module.html#MSG_CHANNEL_DATA -paramiko.sftp_attr.CMD_CLOSE paramiko.sftp_attr-module.html#CMD_CLOSE -paramiko.sftp_attr.CMD_RENAME paramiko.sftp_attr-module.html#CMD_RENAME -paramiko.sftp_attr.SFTP_FLAG_CREATE paramiko.sftp_attr-module.html#SFTP_FLAG_CREATE -paramiko.sftp_attr.MSG_DEBUG paramiko.sftp_attr-module.html#MSG_DEBUG -paramiko.sftp_attr.SFTP_PERMISSION_DENIED paramiko.sftp_attr-module.html#SFTP_PERMISSION_DENIED -paramiko.sftp_attr.OPEN_SUCCEEDED paramiko.sftp_attr-module.html#OPEN_SUCCEEDED -paramiko.sftp_attr.OPEN_FAILED_UNKNOWN_CHANNEL_TYPE paramiko.sftp_attr-module.html#OPEN_FAILED_UNKNOWN_CHANNEL_TYPE -paramiko.sftp_attr.CMD_DATA paramiko.sftp_attr-module.html#CMD_DATA -paramiko.sftp_attr.MSG_UNIMPLEMENTED paramiko.sftp_attr-module.html#MSG_UNIMPLEMENTED -paramiko.sftp_attr.INFO paramiko.sftp_attr-module.html#INFO -paramiko.sftp_attr.CMD_STAT paramiko.sftp_attr-module.html#CMD_STAT -paramiko.sftp_attr.DISCONNECT_SERVICE_NOT_AVAILABLE paramiko.sftp_attr-module.html#DISCONNECT_SERVICE_NOT_AVAILABLE -paramiko.sftp_attr.MSG_CHANNEL_EXTENDED_DATA paramiko.sftp_attr-module.html#MSG_CHANNEL_EXTENDED_DATA -paramiko.sftp_attr.CMD_NAME paramiko.sftp_attr-module.html#CMD_NAME -paramiko.sftp_attr.CONNECTION_FAILED_CODE paramiko.sftp_attr-module.html#CONNECTION_FAILED_CODE -paramiko.sftp_attr.CMD_HANDLE paramiko.sftp_attr-module.html#CMD_HANDLE -paramiko.sftp_attr.MSG_CHANNEL_OPEN paramiko.sftp_attr-module.html#MSG_CHANNEL_OPEN -paramiko.sftp_attr.CMD_RMDIR paramiko.sftp_attr-module.html#CMD_RMDIR -paramiko.sftp_attr.SFTP_OK paramiko.sftp_attr-module.html#SFTP_OK -paramiko.sftp_attr.CMD_READ paramiko.sftp_attr-module.html#CMD_READ -paramiko.sftp_attr.SFTP_OP_UNSUPPORTED paramiko.sftp_attr-module.html#SFTP_OP_UNSUPPORTED -paramiko.sftp_attr.MSG_USERAUTH_INFO_RESPONSE paramiko.sftp_attr-module.html#MSG_USERAUTH_INFO_RESPONSE -paramiko.sftp_attr.MSG_REQUEST_FAILURE paramiko.sftp_attr-module.html#MSG_REQUEST_FAILURE -paramiko.sftp_attr.CMD_STATUS paramiko.sftp_attr-module.html#CMD_STATUS -paramiko.sftp_attr.AUTH_PARTIALLY_SUCCESSFUL paramiko.sftp_attr-module.html#AUTH_PARTIALLY_SUCCESSFUL -paramiko.sftp_attr.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED paramiko.sftp_attr-module.html#OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -paramiko.sftp_attr.MSG_CHANNEL_FAILURE paramiko.sftp_attr-module.html#MSG_CHANNEL_FAILURE -paramiko.sftp_attr.rng paramiko.sftp_attr-module.html#rng -paramiko.sftp_attr.SFTP_CONNECTION_LOST paramiko.sftp_attr-module.html#SFTP_CONNECTION_LOST -paramiko.sftp_attr.OPEN_FAILED_CONNECT_FAILED paramiko.sftp_attr-module.html#OPEN_FAILED_CONNECT_FAILED -paramiko.sftp_attr.MSG_USERAUTH_REQUEST paramiko.sftp_attr-module.html#MSG_USERAUTH_REQUEST -paramiko.sftp_attr.MSG_SERVICE_REQUEST paramiko.sftp_attr-module.html#MSG_SERVICE_REQUEST -paramiko.sftp_attr.CMD_REALPATH paramiko.sftp_attr-module.html#CMD_REALPATH -paramiko.sftp_attr.MSG_CHANNEL_CLOSE paramiko.sftp_attr-module.html#MSG_CHANNEL_CLOSE -paramiko.sftp_attr.MSG_CHANNEL_OPEN_SUCCESS paramiko.sftp_attr-module.html#MSG_CHANNEL_OPEN_SUCCESS -paramiko.sftp_client paramiko.sftp_client-module.html -paramiko.sftp_client.MSG_NAMES paramiko.sftp_client-module.html#MSG_NAMES -paramiko.sftp_client.CMD_MKDIR paramiko.sftp_client-module.html#CMD_MKDIR -paramiko.sftp_client.SFTP_FLAG_APPEND paramiko.sftp_client-module.html#SFTP_FLAG_APPEND -paramiko.sftp_client.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE paramiko.sftp_client-module.html#DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE -paramiko.sftp_client.SFTP_DESC paramiko.sftp_client-module.html#SFTP_DESC -paramiko.sftp_client.CMD_LSTAT paramiko.sftp_client-module.html#CMD_LSTAT -paramiko.sftp_client.MSG_GLOBAL_REQUEST paramiko.sftp_client-module.html#MSG_GLOBAL_REQUEST -paramiko.sftp_client.MSG_CHANNEL_SUCCESS paramiko.sftp_client-module.html#MSG_CHANNEL_SUCCESS -paramiko.sftp_client.CRITICAL paramiko.sftp_client-module.html#CRITICAL -paramiko.sftp_client.SFTP_FLAG_READ paramiko.sftp_client-module.html#SFTP_FLAG_READ -paramiko.sftp_client.CMD_SYMLINK paramiko.sftp_client-module.html#CMD_SYMLINK -paramiko.sftp_client.OPEN_FAILED_RESOURCE_SHORTAGE paramiko.sftp_client-module.html#OPEN_FAILED_RESOURCE_SHORTAGE -paramiko.sftp_client.MSG_CHANNEL_OPEN_FAILURE paramiko.sftp_client-module.html#MSG_CHANNEL_OPEN_FAILURE -paramiko.sftp_client.CMD_VERSION paramiko.sftp_client-module.html#CMD_VERSION -paramiko.sftp_client.CMD_INIT paramiko.sftp_client-module.html#CMD_INIT -paramiko.sftp_client.CMD_EXTENDED paramiko.sftp_client-module.html#CMD_EXTENDED -paramiko.sftp_client.MSG_CHANNEL_EOF paramiko.sftp_client-module.html#MSG_CHANNEL_EOF -paramiko.sftp_client.CMD_STAT paramiko.sftp_client-module.html#CMD_STAT -paramiko.sftp_client.SFTP_BAD_MESSAGE paramiko.sftp_client-module.html#SFTP_BAD_MESSAGE -paramiko.sftp_client.PY22 paramiko.sftp_client-module.html#PY22 -paramiko.sftp_client.CMD_READLINK paramiko.sftp_client-module.html#CMD_READLINK -paramiko.sftp_client.__package__ paramiko.sftp_client-module.html#__package__ -paramiko.sftp_client.DISCONNECT_AUTH_CANCELLED_BY_USER paramiko.sftp_client-module.html#DISCONNECT_AUTH_CANCELLED_BY_USER -paramiko.sftp_client.MSG_NEWKEYS paramiko.sftp_client-module.html#MSG_NEWKEYS -paramiko.sftp_client.MSG_USERAUTH_SUCCESS paramiko.sftp_client-module.html#MSG_USERAUTH_SUCCESS -paramiko.sftp_client.MSG_USERAUTH_PK_OK paramiko.sftp_client-module.html#MSG_USERAUTH_PK_OK -paramiko.sftp_client.CMD_READDIR paramiko.sftp_client-module.html#CMD_READDIR -paramiko.sftp_client.SFTP_FLAG_WRITE paramiko.sftp_client-module.html#SFTP_FLAG_WRITE -paramiko.sftp_client.CMD_NAMES paramiko.sftp_client-module.html#CMD_NAMES -paramiko.sftp_client.CMD_WRITE paramiko.sftp_client-module.html#CMD_WRITE -paramiko.sftp_client.CMD_OPEN paramiko.sftp_client-module.html#CMD_OPEN -paramiko.sftp_client.MSG_SERVICE_ACCEPT paramiko.sftp_client-module.html#MSG_SERVICE_ACCEPT -paramiko.sftp_client.WARNING paramiko.sftp_client-module.html#WARNING -paramiko.sftp_client.CMD_REMOVE paramiko.sftp_client-module.html#CMD_REMOVE -paramiko.sftp_client.SFTP_EOF paramiko.sftp_client-module.html#SFTP_EOF -paramiko.sftp_client.CMD_FSETSTAT paramiko.sftp_client-module.html#CMD_FSETSTAT -paramiko.sftp_client.SFTP_FLAG_TRUNC paramiko.sftp_client-module.html#SFTP_FLAG_TRUNC -paramiko.sftp_client.CMD_SETSTAT paramiko.sftp_client-module.html#CMD_SETSTAT -paramiko.sftp_client.ERROR paramiko.sftp_client-module.html#ERROR -paramiko.sftp_client.DEBUG paramiko.sftp_client-module.html#DEBUG -paramiko.sftp_client.CMD_FSTAT paramiko.sftp_client-module.html#CMD_FSTAT -paramiko.sftp_client.MSG_USERAUTH_BANNER paramiko.sftp_client-module.html#MSG_USERAUTH_BANNER -paramiko.sftp_client.CMD_OPENDIR paramiko.sftp_client-module.html#CMD_OPENDIR -paramiko.sftp_client.SFTP_FAILURE paramiko.sftp_client-module.html#SFTP_FAILURE -paramiko.sftp_client.SFTP_NO_CONNECTION paramiko.sftp_client-module.html#SFTP_NO_CONNECTION -paramiko.sftp_client.AUTH_FAILED paramiko.sftp_client-module.html#AUTH_FAILED -paramiko.sftp_client.MSG_REQUEST_SUCCESS paramiko.sftp_client-module.html#MSG_REQUEST_SUCCESS -paramiko.sftp_client.AUTH_SUCCESSFUL paramiko.sftp_client-module.html#AUTH_SUCCESSFUL -paramiko.sftp_client.MSG_CHANNEL_WINDOW_ADJUST paramiko.sftp_client-module.html#MSG_CHANNEL_WINDOW_ADJUST -paramiko.sftp_client.MSG_CHANNEL_REQUEST paramiko.sftp_client-module.html#MSG_CHANNEL_REQUEST -paramiko.sftp_client.MSG_USERAUTH_INFO_REQUEST paramiko.sftp_client-module.html#MSG_USERAUTH_INFO_REQUEST -paramiko.sftp_client.CMD_ATTRS paramiko.sftp_client-module.html#CMD_ATTRS -paramiko.sftp_client.CMD_EXTENDED_REPLY paramiko.sftp_client-module.html#CMD_EXTENDED_REPLY -paramiko.sftp_client.MSG_DISCONNECT paramiko.sftp_client-module.html#MSG_DISCONNECT -paramiko.sftp_client.MSG_IGNORE paramiko.sftp_client-module.html#MSG_IGNORE -paramiko.sftp_client.SFTP_FLAG_EXCL paramiko.sftp_client-module.html#SFTP_FLAG_EXCL -paramiko.sftp_client.SFTP_NO_SUCH_FILE paramiko.sftp_client-module.html#SFTP_NO_SUCH_FILE -paramiko.sftp_client.MSG_USERAUTH_FAILURE paramiko.sftp_client-module.html#MSG_USERAUTH_FAILURE -paramiko.sftp_client.MSG_KEXINIT paramiko.sftp_client-module.html#MSG_KEXINIT -paramiko.sftp_client.MSG_CHANNEL_DATA paramiko.sftp_client-module.html#MSG_CHANNEL_DATA -paramiko.sftp_client.CMD_CLOSE paramiko.sftp_client-module.html#CMD_CLOSE -paramiko.sftp_client.CMD_RENAME paramiko.sftp_client-module.html#CMD_RENAME -paramiko.sftp_client.SFTP_FLAG_CREATE paramiko.sftp_client-module.html#SFTP_FLAG_CREATE -paramiko.sftp_client.MSG_DEBUG paramiko.sftp_client-module.html#MSG_DEBUG -paramiko.sftp_client.SFTP_PERMISSION_DENIED paramiko.sftp_client-module.html#SFTP_PERMISSION_DENIED -paramiko.sftp_client.OPEN_SUCCEEDED paramiko.sftp_client-module.html#OPEN_SUCCEEDED -paramiko.sftp_client.OPEN_FAILED_UNKNOWN_CHANNEL_TYPE paramiko.sftp_client-module.html#OPEN_FAILED_UNKNOWN_CHANNEL_TYPE -paramiko.sftp_client.CMD_DATA paramiko.sftp_client-module.html#CMD_DATA -paramiko.sftp_client.MSG_UNIMPLEMENTED paramiko.sftp_client-module.html#MSG_UNIMPLEMENTED -paramiko.sftp_client.INFO paramiko.sftp_client-module.html#INFO -paramiko.sftp_client.DISCONNECT_SERVICE_NOT_AVAILABLE paramiko.sftp_client-module.html#DISCONNECT_SERVICE_NOT_AVAILABLE -paramiko.sftp_client._to_unicode paramiko.sftp_client-module.html#_to_unicode -paramiko.sftp_client.MSG_CHANNEL_EXTENDED_DATA paramiko.sftp_client-module.html#MSG_CHANNEL_EXTENDED_DATA -paramiko.sftp_client.CMD_NAME paramiko.sftp_client-module.html#CMD_NAME -paramiko.sftp_client.CONNECTION_FAILED_CODE paramiko.sftp_client-module.html#CONNECTION_FAILED_CODE -paramiko.sftp_client.CMD_HANDLE paramiko.sftp_client-module.html#CMD_HANDLE -paramiko.sftp_client.MSG_CHANNEL_OPEN paramiko.sftp_client-module.html#MSG_CHANNEL_OPEN -paramiko.sftp_client.CMD_RMDIR paramiko.sftp_client-module.html#CMD_RMDIR -paramiko.sftp_client.SFTP_OK paramiko.sftp_client-module.html#SFTP_OK -paramiko.sftp_client.CMD_READ paramiko.sftp_client-module.html#CMD_READ -paramiko.sftp_client.SFTP_OP_UNSUPPORTED paramiko.sftp_client-module.html#SFTP_OP_UNSUPPORTED -paramiko.sftp_client.MSG_USERAUTH_INFO_RESPONSE paramiko.sftp_client-module.html#MSG_USERAUTH_INFO_RESPONSE -paramiko.sftp_client.MSG_REQUEST_FAILURE paramiko.sftp_client-module.html#MSG_REQUEST_FAILURE -paramiko.sftp_client.CMD_STATUS paramiko.sftp_client-module.html#CMD_STATUS -paramiko.sftp_client.AUTH_PARTIALLY_SUCCESSFUL paramiko.sftp_client-module.html#AUTH_PARTIALLY_SUCCESSFUL -paramiko.sftp_client.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED paramiko.sftp_client-module.html#OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -paramiko.sftp_client.MSG_CHANNEL_FAILURE paramiko.sftp_client-module.html#MSG_CHANNEL_FAILURE -paramiko.sftp_client.rng paramiko.sftp_client-module.html#rng -paramiko.sftp_client.SFTP_CONNECTION_LOST paramiko.sftp_client-module.html#SFTP_CONNECTION_LOST -paramiko.sftp_client.OPEN_FAILED_CONNECT_FAILED paramiko.sftp_client-module.html#OPEN_FAILED_CONNECT_FAILED -paramiko.sftp_client.MSG_USERAUTH_REQUEST paramiko.sftp_client-module.html#MSG_USERAUTH_REQUEST -paramiko.sftp_client.MSG_SERVICE_REQUEST paramiko.sftp_client-module.html#MSG_SERVICE_REQUEST -paramiko.sftp_client.CMD_REALPATH paramiko.sftp_client-module.html#CMD_REALPATH -paramiko.sftp_client.MSG_CHANNEL_CLOSE paramiko.sftp_client-module.html#MSG_CHANNEL_CLOSE -paramiko.sftp_client.MSG_CHANNEL_OPEN_SUCCESS paramiko.sftp_client-module.html#MSG_CHANNEL_OPEN_SUCCESS -paramiko.sftp_file paramiko.sftp_file-module.html -paramiko.sftp_file.MSG_NAMES paramiko.sftp_file-module.html#MSG_NAMES -paramiko.sftp_file.CMD_MKDIR paramiko.sftp_file-module.html#CMD_MKDIR -paramiko.sftp_file.SFTP_FLAG_APPEND paramiko.sftp_file-module.html#SFTP_FLAG_APPEND -paramiko.sftp_file.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE paramiko.sftp_file-module.html#DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE -paramiko.sftp_file.SFTP_DESC paramiko.sftp_file-module.html#SFTP_DESC -paramiko.sftp_file.CMD_LSTAT paramiko.sftp_file-module.html#CMD_LSTAT -paramiko.sftp_file.MSG_GLOBAL_REQUEST paramiko.sftp_file-module.html#MSG_GLOBAL_REQUEST -paramiko.sftp_file.MSG_CHANNEL_SUCCESS paramiko.sftp_file-module.html#MSG_CHANNEL_SUCCESS -paramiko.sftp_file.CRITICAL paramiko.sftp_file-module.html#CRITICAL -paramiko.sftp_file.SFTP_FLAG_READ paramiko.sftp_file-module.html#SFTP_FLAG_READ -paramiko.sftp_file.CMD_SYMLINK paramiko.sftp_file-module.html#CMD_SYMLINK -paramiko.sftp_file.OPEN_FAILED_RESOURCE_SHORTAGE paramiko.sftp_file-module.html#OPEN_FAILED_RESOURCE_SHORTAGE -paramiko.sftp_file.MSG_CHANNEL_OPEN_FAILURE paramiko.sftp_file-module.html#MSG_CHANNEL_OPEN_FAILURE -paramiko.sftp_file.CMD_VERSION paramiko.sftp_file-module.html#CMD_VERSION -paramiko.sftp_file.CMD_INIT paramiko.sftp_file-module.html#CMD_INIT -paramiko.sftp_file.CMD_EXTENDED paramiko.sftp_file-module.html#CMD_EXTENDED -paramiko.sftp_file.MSG_CHANNEL_EOF paramiko.sftp_file-module.html#MSG_CHANNEL_EOF -paramiko.sftp_file.CMD_STAT paramiko.sftp_file-module.html#CMD_STAT -paramiko.sftp_file.SFTP_BAD_MESSAGE paramiko.sftp_file-module.html#SFTP_BAD_MESSAGE -paramiko.sftp_file.PY22 paramiko.sftp_file-module.html#PY22 -paramiko.sftp_file.CMD_READLINK paramiko.sftp_file-module.html#CMD_READLINK -paramiko.sftp_file.__package__ paramiko.sftp_file-module.html#__package__ -paramiko.sftp_file.DISCONNECT_AUTH_CANCELLED_BY_USER paramiko.sftp_file-module.html#DISCONNECT_AUTH_CANCELLED_BY_USER -paramiko.sftp_file.MSG_NEWKEYS paramiko.sftp_file-module.html#MSG_NEWKEYS -paramiko.sftp_file.MSG_USERAUTH_SUCCESS paramiko.sftp_file-module.html#MSG_USERAUTH_SUCCESS -paramiko.sftp_file.MSG_USERAUTH_PK_OK paramiko.sftp_file-module.html#MSG_USERAUTH_PK_OK -paramiko.sftp_file.CMD_READDIR paramiko.sftp_file-module.html#CMD_READDIR -paramiko.sftp_file.SFTP_FLAG_WRITE paramiko.sftp_file-module.html#SFTP_FLAG_WRITE -paramiko.sftp_file.CMD_NAMES paramiko.sftp_file-module.html#CMD_NAMES -paramiko.sftp_file.CMD_WRITE paramiko.sftp_file-module.html#CMD_WRITE -paramiko.sftp_file.CMD_OPEN paramiko.sftp_file-module.html#CMD_OPEN -paramiko.sftp_file.MSG_SERVICE_ACCEPT paramiko.sftp_file-module.html#MSG_SERVICE_ACCEPT -paramiko.sftp_file.WARNING paramiko.sftp_file-module.html#WARNING -paramiko.sftp_file.CMD_REMOVE paramiko.sftp_file-module.html#CMD_REMOVE -paramiko.sftp_file.SFTP_EOF paramiko.sftp_file-module.html#SFTP_EOF -paramiko.sftp_file.CMD_FSETSTAT paramiko.sftp_file-module.html#CMD_FSETSTAT -paramiko.sftp_file.SFTP_FLAG_TRUNC paramiko.sftp_file-module.html#SFTP_FLAG_TRUNC -paramiko.sftp_file.CMD_SETSTAT paramiko.sftp_file-module.html#CMD_SETSTAT -paramiko.sftp_file.ERROR paramiko.sftp_file-module.html#ERROR -paramiko.sftp_file.DEBUG paramiko.sftp_file-module.html#DEBUG -paramiko.sftp_file.CMD_FSTAT paramiko.sftp_file-module.html#CMD_FSTAT -paramiko.sftp_file.MSG_USERAUTH_BANNER paramiko.sftp_file-module.html#MSG_USERAUTH_BANNER -paramiko.sftp_file.CMD_OPENDIR paramiko.sftp_file-module.html#CMD_OPENDIR -paramiko.sftp_file.SFTP_FAILURE paramiko.sftp_file-module.html#SFTP_FAILURE -paramiko.sftp_file.SFTP_NO_CONNECTION paramiko.sftp_file-module.html#SFTP_NO_CONNECTION -paramiko.sftp_file.AUTH_FAILED paramiko.sftp_file-module.html#AUTH_FAILED -paramiko.sftp_file.MSG_REQUEST_SUCCESS paramiko.sftp_file-module.html#MSG_REQUEST_SUCCESS -paramiko.sftp_file.AUTH_SUCCESSFUL paramiko.sftp_file-module.html#AUTH_SUCCESSFUL -paramiko.sftp_file.MSG_CHANNEL_WINDOW_ADJUST paramiko.sftp_file-module.html#MSG_CHANNEL_WINDOW_ADJUST -paramiko.sftp_file.MSG_CHANNEL_REQUEST paramiko.sftp_file-module.html#MSG_CHANNEL_REQUEST -paramiko.sftp_file.MSG_USERAUTH_INFO_REQUEST paramiko.sftp_file-module.html#MSG_USERAUTH_INFO_REQUEST -paramiko.sftp_file.CMD_ATTRS paramiko.sftp_file-module.html#CMD_ATTRS -paramiko.sftp_file.CMD_EXTENDED_REPLY paramiko.sftp_file-module.html#CMD_EXTENDED_REPLY -paramiko.sftp_file.MSG_DISCONNECT paramiko.sftp_file-module.html#MSG_DISCONNECT -paramiko.sftp_file.MSG_IGNORE paramiko.sftp_file-module.html#MSG_IGNORE -paramiko.sftp_file.SFTP_FLAG_EXCL paramiko.sftp_file-module.html#SFTP_FLAG_EXCL -paramiko.sftp_file.SFTP_NO_SUCH_FILE paramiko.sftp_file-module.html#SFTP_NO_SUCH_FILE -paramiko.sftp_file.MSG_USERAUTH_FAILURE paramiko.sftp_file-module.html#MSG_USERAUTH_FAILURE -paramiko.sftp_file.MSG_KEXINIT paramiko.sftp_file-module.html#MSG_KEXINIT -paramiko.sftp_file.MSG_CHANNEL_DATA paramiko.sftp_file-module.html#MSG_CHANNEL_DATA -paramiko.sftp_file.CMD_CLOSE paramiko.sftp_file-module.html#CMD_CLOSE -paramiko.sftp_file.CMD_RENAME paramiko.sftp_file-module.html#CMD_RENAME -paramiko.sftp_file.SFTP_FLAG_CREATE paramiko.sftp_file-module.html#SFTP_FLAG_CREATE -paramiko.sftp_file.MSG_DEBUG paramiko.sftp_file-module.html#MSG_DEBUG -paramiko.sftp_file.SFTP_PERMISSION_DENIED paramiko.sftp_file-module.html#SFTP_PERMISSION_DENIED -paramiko.sftp_file.OPEN_SUCCEEDED paramiko.sftp_file-module.html#OPEN_SUCCEEDED -paramiko.sftp_file.OPEN_FAILED_UNKNOWN_CHANNEL_TYPE paramiko.sftp_file-module.html#OPEN_FAILED_UNKNOWN_CHANNEL_TYPE -paramiko.sftp_file.CMD_DATA paramiko.sftp_file-module.html#CMD_DATA -paramiko.sftp_file.MSG_UNIMPLEMENTED paramiko.sftp_file-module.html#MSG_UNIMPLEMENTED -paramiko.sftp_file.INFO paramiko.sftp_file-module.html#INFO -paramiko.sftp_file.DISCONNECT_SERVICE_NOT_AVAILABLE paramiko.sftp_file-module.html#DISCONNECT_SERVICE_NOT_AVAILABLE -paramiko.sftp_file.MSG_CHANNEL_EXTENDED_DATA paramiko.sftp_file-module.html#MSG_CHANNEL_EXTENDED_DATA -paramiko.sftp_file.CMD_NAME paramiko.sftp_file-module.html#CMD_NAME -paramiko.sftp_file.CONNECTION_FAILED_CODE paramiko.sftp_file-module.html#CONNECTION_FAILED_CODE -paramiko.sftp_file.CMD_HANDLE paramiko.sftp_file-module.html#CMD_HANDLE -paramiko.sftp_file.MSG_CHANNEL_OPEN paramiko.sftp_file-module.html#MSG_CHANNEL_OPEN -paramiko.sftp_file.CMD_RMDIR paramiko.sftp_file-module.html#CMD_RMDIR -paramiko.sftp_file.SFTP_OK paramiko.sftp_file-module.html#SFTP_OK -paramiko.sftp_file.CMD_READ paramiko.sftp_file-module.html#CMD_READ -paramiko.sftp_file.SFTP_OP_UNSUPPORTED paramiko.sftp_file-module.html#SFTP_OP_UNSUPPORTED -paramiko.sftp_file.MSG_USERAUTH_INFO_RESPONSE paramiko.sftp_file-module.html#MSG_USERAUTH_INFO_RESPONSE -paramiko.sftp_file.MSG_REQUEST_FAILURE paramiko.sftp_file-module.html#MSG_REQUEST_FAILURE -paramiko.sftp_file.CMD_STATUS paramiko.sftp_file-module.html#CMD_STATUS -paramiko.sftp_file.AUTH_PARTIALLY_SUCCESSFUL paramiko.sftp_file-module.html#AUTH_PARTIALLY_SUCCESSFUL -paramiko.sftp_file.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED paramiko.sftp_file-module.html#OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -paramiko.sftp_file.MSG_CHANNEL_FAILURE paramiko.sftp_file-module.html#MSG_CHANNEL_FAILURE -paramiko.sftp_file.rng paramiko.sftp_file-module.html#rng -paramiko.sftp_file.SFTP_CONNECTION_LOST paramiko.sftp_file-module.html#SFTP_CONNECTION_LOST -paramiko.sftp_file.OPEN_FAILED_CONNECT_FAILED paramiko.sftp_file-module.html#OPEN_FAILED_CONNECT_FAILED -paramiko.sftp_file.MSG_USERAUTH_REQUEST paramiko.sftp_file-module.html#MSG_USERAUTH_REQUEST -paramiko.sftp_file.MSG_SERVICE_REQUEST paramiko.sftp_file-module.html#MSG_SERVICE_REQUEST -paramiko.sftp_file.CMD_REALPATH paramiko.sftp_file-module.html#CMD_REALPATH -paramiko.sftp_file.MSG_CHANNEL_CLOSE paramiko.sftp_file-module.html#MSG_CHANNEL_CLOSE -paramiko.sftp_file.MSG_CHANNEL_OPEN_SUCCESS paramiko.sftp_file-module.html#MSG_CHANNEL_OPEN_SUCCESS -paramiko.sftp_handle paramiko.sftp_handle-module.html -paramiko.sftp_handle.MSG_NAMES paramiko.sftp_handle-module.html#MSG_NAMES -paramiko.sftp_handle.CMD_MKDIR paramiko.sftp_handle-module.html#CMD_MKDIR -paramiko.sftp_handle.SFTP_FLAG_APPEND paramiko.sftp_handle-module.html#SFTP_FLAG_APPEND -paramiko.sftp_handle.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE paramiko.sftp_handle-module.html#DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE -paramiko.sftp_handle.SFTP_DESC paramiko.sftp_handle-module.html#SFTP_DESC -paramiko.sftp_handle.CMD_LSTAT paramiko.sftp_handle-module.html#CMD_LSTAT -paramiko.sftp_handle.MSG_GLOBAL_REQUEST paramiko.sftp_handle-module.html#MSG_GLOBAL_REQUEST -paramiko.sftp_handle.MSG_CHANNEL_SUCCESS paramiko.sftp_handle-module.html#MSG_CHANNEL_SUCCESS -paramiko.sftp_handle.CRITICAL paramiko.sftp_handle-module.html#CRITICAL -paramiko.sftp_handle.SFTP_FLAG_READ paramiko.sftp_handle-module.html#SFTP_FLAG_READ -paramiko.sftp_handle.CMD_SYMLINK paramiko.sftp_handle-module.html#CMD_SYMLINK -paramiko.sftp_handle.OPEN_FAILED_RESOURCE_SHORTAGE paramiko.sftp_handle-module.html#OPEN_FAILED_RESOURCE_SHORTAGE -paramiko.sftp_handle.MSG_CHANNEL_OPEN_FAILURE paramiko.sftp_handle-module.html#MSG_CHANNEL_OPEN_FAILURE -paramiko.sftp_handle.CMD_VERSION paramiko.sftp_handle-module.html#CMD_VERSION -paramiko.sftp_handle.CMD_INIT paramiko.sftp_handle-module.html#CMD_INIT -paramiko.sftp_handle.CMD_EXTENDED paramiko.sftp_handle-module.html#CMD_EXTENDED -paramiko.sftp_handle.MSG_CHANNEL_EOF paramiko.sftp_handle-module.html#MSG_CHANNEL_EOF -paramiko.sftp_handle.SFTP_BAD_MESSAGE paramiko.sftp_handle-module.html#SFTP_BAD_MESSAGE -paramiko.sftp_handle.PY22 paramiko.sftp_handle-module.html#PY22 -paramiko.sftp_handle.CMD_READLINK paramiko.sftp_handle-module.html#CMD_READLINK -paramiko.sftp_handle.__package__ paramiko.sftp_handle-module.html#__package__ -paramiko.sftp_handle.DISCONNECT_AUTH_CANCELLED_BY_USER paramiko.sftp_handle-module.html#DISCONNECT_AUTH_CANCELLED_BY_USER -paramiko.sftp_handle.MSG_NEWKEYS paramiko.sftp_handle-module.html#MSG_NEWKEYS -paramiko.sftp_handle.MSG_USERAUTH_SUCCESS paramiko.sftp_handle-module.html#MSG_USERAUTH_SUCCESS -paramiko.sftp_handle.MSG_USERAUTH_PK_OK paramiko.sftp_handle-module.html#MSG_USERAUTH_PK_OK -paramiko.sftp_handle.CMD_READDIR paramiko.sftp_handle-module.html#CMD_READDIR -paramiko.sftp_handle.SFTP_FLAG_WRITE paramiko.sftp_handle-module.html#SFTP_FLAG_WRITE -paramiko.sftp_handle.CMD_NAMES paramiko.sftp_handle-module.html#CMD_NAMES -paramiko.sftp_handle.CMD_WRITE paramiko.sftp_handle-module.html#CMD_WRITE -paramiko.sftp_handle.CMD_OPEN paramiko.sftp_handle-module.html#CMD_OPEN -paramiko.sftp_handle.MSG_SERVICE_ACCEPT paramiko.sftp_handle-module.html#MSG_SERVICE_ACCEPT -paramiko.sftp_handle.WARNING paramiko.sftp_handle-module.html#WARNING -paramiko.sftp_handle.CMD_REMOVE paramiko.sftp_handle-module.html#CMD_REMOVE -paramiko.sftp_handle.SFTP_EOF paramiko.sftp_handle-module.html#SFTP_EOF -paramiko.sftp_handle.CMD_FSETSTAT paramiko.sftp_handle-module.html#CMD_FSETSTAT -paramiko.sftp_handle.SFTP_FLAG_TRUNC paramiko.sftp_handle-module.html#SFTP_FLAG_TRUNC -paramiko.sftp_handle.CMD_SETSTAT paramiko.sftp_handle-module.html#CMD_SETSTAT -paramiko.sftp_handle.ERROR paramiko.sftp_handle-module.html#ERROR -paramiko.sftp_handle.DEBUG paramiko.sftp_handle-module.html#DEBUG -paramiko.sftp_handle.CMD_FSTAT paramiko.sftp_handle-module.html#CMD_FSTAT -paramiko.sftp_handle.MSG_USERAUTH_BANNER paramiko.sftp_handle-module.html#MSG_USERAUTH_BANNER -paramiko.sftp_handle.CMD_OPENDIR paramiko.sftp_handle-module.html#CMD_OPENDIR -paramiko.sftp_handle.SFTP_FAILURE paramiko.sftp_handle-module.html#SFTP_FAILURE -paramiko.sftp_handle.SFTP_NO_CONNECTION paramiko.sftp_handle-module.html#SFTP_NO_CONNECTION -paramiko.sftp_handle.AUTH_FAILED paramiko.sftp_handle-module.html#AUTH_FAILED -paramiko.sftp_handle.MSG_REQUEST_SUCCESS paramiko.sftp_handle-module.html#MSG_REQUEST_SUCCESS -paramiko.sftp_handle.AUTH_SUCCESSFUL paramiko.sftp_handle-module.html#AUTH_SUCCESSFUL -paramiko.sftp_handle.MSG_CHANNEL_WINDOW_ADJUST paramiko.sftp_handle-module.html#MSG_CHANNEL_WINDOW_ADJUST -paramiko.sftp_handle.MSG_CHANNEL_REQUEST paramiko.sftp_handle-module.html#MSG_CHANNEL_REQUEST -paramiko.sftp_handle.MSG_USERAUTH_INFO_REQUEST paramiko.sftp_handle-module.html#MSG_USERAUTH_INFO_REQUEST -paramiko.sftp_handle.CMD_ATTRS paramiko.sftp_handle-module.html#CMD_ATTRS -paramiko.sftp_handle.CMD_EXTENDED_REPLY paramiko.sftp_handle-module.html#CMD_EXTENDED_REPLY -paramiko.sftp_handle.MSG_DISCONNECT paramiko.sftp_handle-module.html#MSG_DISCONNECT -paramiko.sftp_handle.MSG_IGNORE paramiko.sftp_handle-module.html#MSG_IGNORE -paramiko.sftp_handle.SFTP_FLAG_EXCL paramiko.sftp_handle-module.html#SFTP_FLAG_EXCL -paramiko.sftp_handle.SFTP_NO_SUCH_FILE paramiko.sftp_handle-module.html#SFTP_NO_SUCH_FILE -paramiko.sftp_handle.MSG_USERAUTH_FAILURE paramiko.sftp_handle-module.html#MSG_USERAUTH_FAILURE -paramiko.sftp_handle.MSG_KEXINIT paramiko.sftp_handle-module.html#MSG_KEXINIT -paramiko.sftp_handle.MSG_CHANNEL_DATA paramiko.sftp_handle-module.html#MSG_CHANNEL_DATA -paramiko.sftp_handle.CMD_CLOSE paramiko.sftp_handle-module.html#CMD_CLOSE -paramiko.sftp_handle.CMD_RENAME paramiko.sftp_handle-module.html#CMD_RENAME -paramiko.sftp_handle.SFTP_FLAG_CREATE paramiko.sftp_handle-module.html#SFTP_FLAG_CREATE -paramiko.sftp_handle.MSG_DEBUG paramiko.sftp_handle-module.html#MSG_DEBUG -paramiko.sftp_handle.SFTP_PERMISSION_DENIED paramiko.sftp_handle-module.html#SFTP_PERMISSION_DENIED -paramiko.sftp_handle.OPEN_SUCCEEDED paramiko.sftp_handle-module.html#OPEN_SUCCEEDED -paramiko.sftp_handle.OPEN_FAILED_UNKNOWN_CHANNEL_TYPE paramiko.sftp_handle-module.html#OPEN_FAILED_UNKNOWN_CHANNEL_TYPE -paramiko.sftp_handle.CMD_DATA paramiko.sftp_handle-module.html#CMD_DATA -paramiko.sftp_handle.MSG_UNIMPLEMENTED paramiko.sftp_handle-module.html#MSG_UNIMPLEMENTED -paramiko.sftp_handle.INFO paramiko.sftp_handle-module.html#INFO -paramiko.sftp_handle.CMD_STAT paramiko.sftp_handle-module.html#CMD_STAT -paramiko.sftp_handle.DISCONNECT_SERVICE_NOT_AVAILABLE paramiko.sftp_handle-module.html#DISCONNECT_SERVICE_NOT_AVAILABLE -paramiko.sftp_handle.MSG_CHANNEL_EXTENDED_DATA paramiko.sftp_handle-module.html#MSG_CHANNEL_EXTENDED_DATA -paramiko.sftp_handle.CMD_NAME paramiko.sftp_handle-module.html#CMD_NAME -paramiko.sftp_handle.CONNECTION_FAILED_CODE paramiko.sftp_handle-module.html#CONNECTION_FAILED_CODE -paramiko.sftp_handle.CMD_HANDLE paramiko.sftp_handle-module.html#CMD_HANDLE -paramiko.sftp_handle.MSG_CHANNEL_OPEN paramiko.sftp_handle-module.html#MSG_CHANNEL_OPEN -paramiko.sftp_handle.CMD_RMDIR paramiko.sftp_handle-module.html#CMD_RMDIR -paramiko.sftp_handle.SFTP_OK paramiko.sftp_handle-module.html#SFTP_OK -paramiko.sftp_handle.CMD_READ paramiko.sftp_handle-module.html#CMD_READ -paramiko.sftp_handle.SFTP_OP_UNSUPPORTED paramiko.sftp_handle-module.html#SFTP_OP_UNSUPPORTED -paramiko.sftp_handle.MSG_USERAUTH_INFO_RESPONSE paramiko.sftp_handle-module.html#MSG_USERAUTH_INFO_RESPONSE -paramiko.sftp_handle.MSG_REQUEST_FAILURE paramiko.sftp_handle-module.html#MSG_REQUEST_FAILURE -paramiko.sftp_handle.CMD_STATUS paramiko.sftp_handle-module.html#CMD_STATUS -paramiko.sftp_handle.AUTH_PARTIALLY_SUCCESSFUL paramiko.sftp_handle-module.html#AUTH_PARTIALLY_SUCCESSFUL -paramiko.sftp_handle.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED paramiko.sftp_handle-module.html#OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -paramiko.sftp_handle.MSG_CHANNEL_FAILURE paramiko.sftp_handle-module.html#MSG_CHANNEL_FAILURE -paramiko.sftp_handle.rng paramiko.sftp_handle-module.html#rng -paramiko.sftp_handle.SFTP_CONNECTION_LOST paramiko.sftp_handle-module.html#SFTP_CONNECTION_LOST -paramiko.sftp_handle.OPEN_FAILED_CONNECT_FAILED paramiko.sftp_handle-module.html#OPEN_FAILED_CONNECT_FAILED -paramiko.sftp_handle.MSG_USERAUTH_REQUEST paramiko.sftp_handle-module.html#MSG_USERAUTH_REQUEST -paramiko.sftp_handle.MSG_SERVICE_REQUEST paramiko.sftp_handle-module.html#MSG_SERVICE_REQUEST -paramiko.sftp_handle.CMD_REALPATH paramiko.sftp_handle-module.html#CMD_REALPATH -paramiko.sftp_handle.MSG_CHANNEL_CLOSE paramiko.sftp_handle-module.html#MSG_CHANNEL_CLOSE -paramiko.sftp_handle.MSG_CHANNEL_OPEN_SUCCESS paramiko.sftp_handle-module.html#MSG_CHANNEL_OPEN_SUCCESS -paramiko.sftp_server paramiko.sftp_server-module.html -paramiko.sftp_server.MSG_NAMES paramiko.sftp_server-module.html#MSG_NAMES -paramiko.sftp_server.CMD_MKDIR paramiko.sftp_server-module.html#CMD_MKDIR -paramiko.sftp_server.SFTP_FLAG_APPEND paramiko.sftp_server-module.html#SFTP_FLAG_APPEND -paramiko.sftp_server.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE paramiko.sftp_server-module.html#DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE -paramiko.sftp_server.SFTP_DESC paramiko.sftp_server-module.html#SFTP_DESC -paramiko.sftp_server.CMD_LSTAT paramiko.sftp_server-module.html#CMD_LSTAT -paramiko.sftp_server.MSG_GLOBAL_REQUEST paramiko.sftp_server-module.html#MSG_GLOBAL_REQUEST -paramiko.sftp_server.MSG_CHANNEL_SUCCESS paramiko.sftp_server-module.html#MSG_CHANNEL_SUCCESS -paramiko.sftp_server.CRITICAL paramiko.sftp_server-module.html#CRITICAL -paramiko.sftp_server.SFTP_FLAG_READ paramiko.sftp_server-module.html#SFTP_FLAG_READ -paramiko.sftp_server.CMD_SYMLINK paramiko.sftp_server-module.html#CMD_SYMLINK -paramiko.sftp_server.OPEN_FAILED_RESOURCE_SHORTAGE paramiko.sftp_server-module.html#OPEN_FAILED_RESOURCE_SHORTAGE -paramiko.sftp_server.MSG_CHANNEL_OPEN_FAILURE paramiko.sftp_server-module.html#MSG_CHANNEL_OPEN_FAILURE -paramiko.sftp_server.CMD_VERSION paramiko.sftp_server-module.html#CMD_VERSION -paramiko.sftp_server.CMD_INIT paramiko.sftp_server-module.html#CMD_INIT -paramiko.sftp_server.CMD_EXTENDED paramiko.sftp_server-module.html#CMD_EXTENDED -paramiko.sftp_server.MSG_CHANNEL_EOF paramiko.sftp_server-module.html#MSG_CHANNEL_EOF -paramiko.sftp_server.SFTP_BAD_MESSAGE paramiko.sftp_server-module.html#SFTP_BAD_MESSAGE -paramiko.sftp_server.PY22 paramiko.sftp_server-module.html#PY22 -paramiko.sftp_server.CMD_READLINK paramiko.sftp_server-module.html#CMD_READLINK -paramiko.sftp_server.__package__ paramiko.sftp_server-module.html#__package__ -paramiko.sftp_server.DISCONNECT_AUTH_CANCELLED_BY_USER paramiko.sftp_server-module.html#DISCONNECT_AUTH_CANCELLED_BY_USER -paramiko.sftp_server.MSG_NEWKEYS paramiko.sftp_server-module.html#MSG_NEWKEYS -paramiko.sftp_server.MSG_USERAUTH_SUCCESS paramiko.sftp_server-module.html#MSG_USERAUTH_SUCCESS -paramiko.sftp_server.MSG_USERAUTH_PK_OK paramiko.sftp_server-module.html#MSG_USERAUTH_PK_OK -paramiko.sftp_server.CMD_READDIR paramiko.sftp_server-module.html#CMD_READDIR -paramiko.sftp_server.SFTP_FLAG_WRITE paramiko.sftp_server-module.html#SFTP_FLAG_WRITE -paramiko.sftp_server.CMD_NAMES paramiko.sftp_server-module.html#CMD_NAMES -paramiko.sftp_server.CMD_WRITE paramiko.sftp_server-module.html#CMD_WRITE -paramiko.sftp_server.CMD_OPEN paramiko.sftp_server-module.html#CMD_OPEN -paramiko.sftp_server.MSG_SERVICE_ACCEPT paramiko.sftp_server-module.html#MSG_SERVICE_ACCEPT -paramiko.sftp_server.WARNING paramiko.sftp_server-module.html#WARNING -paramiko.sftp_server.CMD_REMOVE paramiko.sftp_server-module.html#CMD_REMOVE -paramiko.sftp_server.SFTP_EOF paramiko.sftp_server-module.html#SFTP_EOF -paramiko.sftp_server.CMD_FSETSTAT paramiko.sftp_server-module.html#CMD_FSETSTAT -paramiko.sftp_server.SFTP_FLAG_TRUNC paramiko.sftp_server-module.html#SFTP_FLAG_TRUNC -paramiko.sftp_server.CMD_SETSTAT paramiko.sftp_server-module.html#CMD_SETSTAT -paramiko.sftp_server.ERROR paramiko.sftp_server-module.html#ERROR -paramiko.sftp_server.DEBUG paramiko.sftp_server-module.html#DEBUG -paramiko.sftp_server.CMD_FSTAT paramiko.sftp_server-module.html#CMD_FSTAT -paramiko.sftp_server.MSG_USERAUTH_BANNER paramiko.sftp_server-module.html#MSG_USERAUTH_BANNER -paramiko.sftp_server.CMD_OPENDIR paramiko.sftp_server-module.html#CMD_OPENDIR -paramiko.sftp_server.SFTP_FAILURE paramiko.sftp_server-module.html#SFTP_FAILURE -paramiko.sftp_server.SFTP_NO_CONNECTION paramiko.sftp_server-module.html#SFTP_NO_CONNECTION -paramiko.sftp_server.AUTH_FAILED paramiko.sftp_server-module.html#AUTH_FAILED -paramiko.sftp_server.MSG_REQUEST_SUCCESS paramiko.sftp_server-module.html#MSG_REQUEST_SUCCESS -paramiko.sftp_server.AUTH_SUCCESSFUL paramiko.sftp_server-module.html#AUTH_SUCCESSFUL -paramiko.sftp_server.MSG_CHANNEL_WINDOW_ADJUST paramiko.sftp_server-module.html#MSG_CHANNEL_WINDOW_ADJUST -paramiko.sftp_server.MSG_CHANNEL_REQUEST paramiko.sftp_server-module.html#MSG_CHANNEL_REQUEST -paramiko.sftp_server.MSG_USERAUTH_INFO_REQUEST paramiko.sftp_server-module.html#MSG_USERAUTH_INFO_REQUEST -paramiko.sftp_server.CMD_ATTRS paramiko.sftp_server-module.html#CMD_ATTRS -paramiko.sftp_server.CMD_EXTENDED_REPLY paramiko.sftp_server-module.html#CMD_EXTENDED_REPLY -paramiko.sftp_server.MSG_DISCONNECT paramiko.sftp_server-module.html#MSG_DISCONNECT -paramiko.sftp_server.MSG_IGNORE paramiko.sftp_server-module.html#MSG_IGNORE -paramiko.sftp_server.SFTP_FLAG_EXCL paramiko.sftp_server-module.html#SFTP_FLAG_EXCL -paramiko.sftp_server.SFTP_NO_SUCH_FILE paramiko.sftp_server-module.html#SFTP_NO_SUCH_FILE -paramiko.sftp_server.MSG_USERAUTH_FAILURE paramiko.sftp_server-module.html#MSG_USERAUTH_FAILURE -paramiko.sftp_server.MSG_KEXINIT paramiko.sftp_server-module.html#MSG_KEXINIT -paramiko.sftp_server.MSG_CHANNEL_DATA paramiko.sftp_server-module.html#MSG_CHANNEL_DATA -paramiko.sftp_server.CMD_CLOSE paramiko.sftp_server-module.html#CMD_CLOSE -paramiko.sftp_server.CMD_RENAME paramiko.sftp_server-module.html#CMD_RENAME -paramiko.sftp_server.SFTP_FLAG_CREATE paramiko.sftp_server-module.html#SFTP_FLAG_CREATE -paramiko.sftp_server.MSG_DEBUG paramiko.sftp_server-module.html#MSG_DEBUG -paramiko.sftp_server.SFTP_PERMISSION_DENIED paramiko.sftp_server-module.html#SFTP_PERMISSION_DENIED -paramiko.sftp_server.OPEN_SUCCEEDED paramiko.sftp_server-module.html#OPEN_SUCCEEDED -paramiko.sftp_server._hash_class paramiko.sftp_server-module.html#_hash_class -paramiko.sftp_server.OPEN_FAILED_UNKNOWN_CHANNEL_TYPE paramiko.sftp_server-module.html#OPEN_FAILED_UNKNOWN_CHANNEL_TYPE -paramiko.sftp_server.CMD_DATA paramiko.sftp_server-module.html#CMD_DATA -paramiko.sftp_server.MSG_UNIMPLEMENTED paramiko.sftp_server-module.html#MSG_UNIMPLEMENTED -paramiko.sftp_server.INFO paramiko.sftp_server-module.html#INFO -paramiko.sftp_server.CMD_STAT paramiko.sftp_server-module.html#CMD_STAT -paramiko.sftp_server.DISCONNECT_SERVICE_NOT_AVAILABLE paramiko.sftp_server-module.html#DISCONNECT_SERVICE_NOT_AVAILABLE -paramiko.sftp_server.MSG_CHANNEL_EXTENDED_DATA paramiko.sftp_server-module.html#MSG_CHANNEL_EXTENDED_DATA -paramiko.sftp_server.CMD_NAME paramiko.sftp_server-module.html#CMD_NAME -paramiko.sftp_server.CONNECTION_FAILED_CODE paramiko.sftp_server-module.html#CONNECTION_FAILED_CODE -paramiko.sftp_server.CMD_HANDLE paramiko.sftp_server-module.html#CMD_HANDLE -paramiko.sftp_server.MSG_CHANNEL_OPEN paramiko.sftp_server-module.html#MSG_CHANNEL_OPEN -paramiko.sftp_server.CMD_RMDIR paramiko.sftp_server-module.html#CMD_RMDIR -paramiko.sftp_server.SFTP_OK paramiko.sftp_server-module.html#SFTP_OK -paramiko.sftp_server.CMD_READ paramiko.sftp_server-module.html#CMD_READ -paramiko.sftp_server.SFTP_OP_UNSUPPORTED paramiko.sftp_server-module.html#SFTP_OP_UNSUPPORTED -paramiko.sftp_server.MSG_USERAUTH_INFO_RESPONSE paramiko.sftp_server-module.html#MSG_USERAUTH_INFO_RESPONSE -paramiko.sftp_server.MSG_REQUEST_FAILURE paramiko.sftp_server-module.html#MSG_REQUEST_FAILURE -paramiko.sftp_server.CMD_STATUS paramiko.sftp_server-module.html#CMD_STATUS -paramiko.sftp_server.AUTH_PARTIALLY_SUCCESSFUL paramiko.sftp_server-module.html#AUTH_PARTIALLY_SUCCESSFUL -paramiko.sftp_server.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED paramiko.sftp_server-module.html#OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -paramiko.sftp_server.MSG_CHANNEL_FAILURE paramiko.sftp_server-module.html#MSG_CHANNEL_FAILURE -paramiko.sftp_server.rng paramiko.sftp_server-module.html#rng -paramiko.sftp_server.SFTP_CONNECTION_LOST paramiko.sftp_server-module.html#SFTP_CONNECTION_LOST -paramiko.sftp_server.OPEN_FAILED_CONNECT_FAILED paramiko.sftp_server-module.html#OPEN_FAILED_CONNECT_FAILED -paramiko.sftp_server.MSG_USERAUTH_REQUEST paramiko.sftp_server-module.html#MSG_USERAUTH_REQUEST -paramiko.sftp_server.MSG_SERVICE_REQUEST paramiko.sftp_server-module.html#MSG_SERVICE_REQUEST -paramiko.sftp_server.CMD_REALPATH paramiko.sftp_server-module.html#CMD_REALPATH -paramiko.sftp_server.MSG_CHANNEL_CLOSE paramiko.sftp_server-module.html#MSG_CHANNEL_CLOSE -paramiko.sftp_server.MSG_CHANNEL_OPEN_SUCCESS paramiko.sftp_server-module.html#MSG_CHANNEL_OPEN_SUCCESS -paramiko.sftp_si paramiko.sftp_si-module.html -paramiko.sftp_si.MSG_NAMES paramiko.sftp_si-module.html#MSG_NAMES -paramiko.sftp_si.CMD_MKDIR paramiko.sftp_si-module.html#CMD_MKDIR -paramiko.sftp_si.SFTP_FLAG_APPEND paramiko.sftp_si-module.html#SFTP_FLAG_APPEND -paramiko.sftp_si.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE paramiko.sftp_si-module.html#DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE -paramiko.sftp_si.SFTP_DESC paramiko.sftp_si-module.html#SFTP_DESC -paramiko.sftp_si.CMD_LSTAT paramiko.sftp_si-module.html#CMD_LSTAT -paramiko.sftp_si.MSG_GLOBAL_REQUEST paramiko.sftp_si-module.html#MSG_GLOBAL_REQUEST -paramiko.sftp_si.MSG_CHANNEL_SUCCESS paramiko.sftp_si-module.html#MSG_CHANNEL_SUCCESS -paramiko.sftp_si.CRITICAL paramiko.sftp_si-module.html#CRITICAL -paramiko.sftp_si.SFTP_FLAG_READ paramiko.sftp_si-module.html#SFTP_FLAG_READ -paramiko.sftp_si.CMD_SYMLINK paramiko.sftp_si-module.html#CMD_SYMLINK -paramiko.sftp_si.OPEN_FAILED_RESOURCE_SHORTAGE paramiko.sftp_si-module.html#OPEN_FAILED_RESOURCE_SHORTAGE -paramiko.sftp_si.MSG_CHANNEL_OPEN_FAILURE paramiko.sftp_si-module.html#MSG_CHANNEL_OPEN_FAILURE -paramiko.sftp_si.CMD_VERSION paramiko.sftp_si-module.html#CMD_VERSION -paramiko.sftp_si.CMD_INIT paramiko.sftp_si-module.html#CMD_INIT -paramiko.sftp_si.CMD_EXTENDED paramiko.sftp_si-module.html#CMD_EXTENDED -paramiko.sftp_si.MSG_CHANNEL_EOF paramiko.sftp_si-module.html#MSG_CHANNEL_EOF -paramiko.sftp_si.SFTP_BAD_MESSAGE paramiko.sftp_si-module.html#SFTP_BAD_MESSAGE -paramiko.sftp_si.PY22 paramiko.sftp_si-module.html#PY22 -paramiko.sftp_si.CMD_READLINK paramiko.sftp_si-module.html#CMD_READLINK -paramiko.sftp_si.__package__ paramiko.sftp_si-module.html#__package__ -paramiko.sftp_si.DISCONNECT_AUTH_CANCELLED_BY_USER paramiko.sftp_si-module.html#DISCONNECT_AUTH_CANCELLED_BY_USER -paramiko.sftp_si.MSG_NEWKEYS paramiko.sftp_si-module.html#MSG_NEWKEYS -paramiko.sftp_si.MSG_USERAUTH_SUCCESS paramiko.sftp_si-module.html#MSG_USERAUTH_SUCCESS -paramiko.sftp_si.MSG_USERAUTH_PK_OK paramiko.sftp_si-module.html#MSG_USERAUTH_PK_OK -paramiko.sftp_si.CMD_READDIR paramiko.sftp_si-module.html#CMD_READDIR -paramiko.sftp_si.SFTP_FLAG_WRITE paramiko.sftp_si-module.html#SFTP_FLAG_WRITE -paramiko.sftp_si.CMD_NAMES paramiko.sftp_si-module.html#CMD_NAMES -paramiko.sftp_si.CMD_WRITE paramiko.sftp_si-module.html#CMD_WRITE -paramiko.sftp_si.CMD_OPEN paramiko.sftp_si-module.html#CMD_OPEN -paramiko.sftp_si.MSG_SERVICE_ACCEPT paramiko.sftp_si-module.html#MSG_SERVICE_ACCEPT -paramiko.sftp_si.WARNING paramiko.sftp_si-module.html#WARNING -paramiko.sftp_si.CMD_REMOVE paramiko.sftp_si-module.html#CMD_REMOVE -paramiko.sftp_si.SFTP_EOF paramiko.sftp_si-module.html#SFTP_EOF -paramiko.sftp_si.CMD_FSETSTAT paramiko.sftp_si-module.html#CMD_FSETSTAT -paramiko.sftp_si.SFTP_FLAG_TRUNC paramiko.sftp_si-module.html#SFTP_FLAG_TRUNC -paramiko.sftp_si.CMD_SETSTAT paramiko.sftp_si-module.html#CMD_SETSTAT -paramiko.sftp_si.ERROR paramiko.sftp_si-module.html#ERROR -paramiko.sftp_si.DEBUG paramiko.sftp_si-module.html#DEBUG -paramiko.sftp_si.CMD_FSTAT paramiko.sftp_si-module.html#CMD_FSTAT -paramiko.sftp_si.MSG_USERAUTH_BANNER paramiko.sftp_si-module.html#MSG_USERAUTH_BANNER -paramiko.sftp_si.CMD_OPENDIR paramiko.sftp_si-module.html#CMD_OPENDIR -paramiko.sftp_si.SFTP_FAILURE paramiko.sftp_si-module.html#SFTP_FAILURE -paramiko.sftp_si.SFTP_NO_CONNECTION paramiko.sftp_si-module.html#SFTP_NO_CONNECTION -paramiko.sftp_si.AUTH_FAILED paramiko.sftp_si-module.html#AUTH_FAILED -paramiko.sftp_si.MSG_REQUEST_SUCCESS paramiko.sftp_si-module.html#MSG_REQUEST_SUCCESS -paramiko.sftp_si.AUTH_SUCCESSFUL paramiko.sftp_si-module.html#AUTH_SUCCESSFUL -paramiko.sftp_si.MSG_CHANNEL_WINDOW_ADJUST paramiko.sftp_si-module.html#MSG_CHANNEL_WINDOW_ADJUST -paramiko.sftp_si.MSG_CHANNEL_REQUEST paramiko.sftp_si-module.html#MSG_CHANNEL_REQUEST -paramiko.sftp_si.MSG_USERAUTH_INFO_REQUEST paramiko.sftp_si-module.html#MSG_USERAUTH_INFO_REQUEST -paramiko.sftp_si.CMD_ATTRS paramiko.sftp_si-module.html#CMD_ATTRS -paramiko.sftp_si.CMD_EXTENDED_REPLY paramiko.sftp_si-module.html#CMD_EXTENDED_REPLY -paramiko.sftp_si.MSG_DISCONNECT paramiko.sftp_si-module.html#MSG_DISCONNECT -paramiko.sftp_si.MSG_IGNORE paramiko.sftp_si-module.html#MSG_IGNORE -paramiko.sftp_si.SFTP_FLAG_EXCL paramiko.sftp_si-module.html#SFTP_FLAG_EXCL -paramiko.sftp_si.SFTP_NO_SUCH_FILE paramiko.sftp_si-module.html#SFTP_NO_SUCH_FILE -paramiko.sftp_si.MSG_USERAUTH_FAILURE paramiko.sftp_si-module.html#MSG_USERAUTH_FAILURE -paramiko.sftp_si.MSG_KEXINIT paramiko.sftp_si-module.html#MSG_KEXINIT -paramiko.sftp_si.MSG_CHANNEL_DATA paramiko.sftp_si-module.html#MSG_CHANNEL_DATA -paramiko.sftp_si.CMD_CLOSE paramiko.sftp_si-module.html#CMD_CLOSE -paramiko.sftp_si.CMD_RENAME paramiko.sftp_si-module.html#CMD_RENAME -paramiko.sftp_si.SFTP_FLAG_CREATE paramiko.sftp_si-module.html#SFTP_FLAG_CREATE -paramiko.sftp_si.MSG_DEBUG paramiko.sftp_si-module.html#MSG_DEBUG -paramiko.sftp_si.SFTP_PERMISSION_DENIED paramiko.sftp_si-module.html#SFTP_PERMISSION_DENIED -paramiko.sftp_si.OPEN_SUCCEEDED paramiko.sftp_si-module.html#OPEN_SUCCEEDED -paramiko.sftp_si.OPEN_FAILED_UNKNOWN_CHANNEL_TYPE paramiko.sftp_si-module.html#OPEN_FAILED_UNKNOWN_CHANNEL_TYPE -paramiko.sftp_si.CMD_DATA paramiko.sftp_si-module.html#CMD_DATA -paramiko.sftp_si.MSG_UNIMPLEMENTED paramiko.sftp_si-module.html#MSG_UNIMPLEMENTED -paramiko.sftp_si.INFO paramiko.sftp_si-module.html#INFO -paramiko.sftp_si.CMD_STAT paramiko.sftp_si-module.html#CMD_STAT -paramiko.sftp_si.DISCONNECT_SERVICE_NOT_AVAILABLE paramiko.sftp_si-module.html#DISCONNECT_SERVICE_NOT_AVAILABLE -paramiko.sftp_si.MSG_CHANNEL_EXTENDED_DATA paramiko.sftp_si-module.html#MSG_CHANNEL_EXTENDED_DATA -paramiko.sftp_si.CMD_NAME paramiko.sftp_si-module.html#CMD_NAME -paramiko.sftp_si.CONNECTION_FAILED_CODE paramiko.sftp_si-module.html#CONNECTION_FAILED_CODE -paramiko.sftp_si.CMD_HANDLE paramiko.sftp_si-module.html#CMD_HANDLE -paramiko.sftp_si.MSG_CHANNEL_OPEN paramiko.sftp_si-module.html#MSG_CHANNEL_OPEN -paramiko.sftp_si.CMD_RMDIR paramiko.sftp_si-module.html#CMD_RMDIR -paramiko.sftp_si.SFTP_OK paramiko.sftp_si-module.html#SFTP_OK -paramiko.sftp_si.CMD_READ paramiko.sftp_si-module.html#CMD_READ -paramiko.sftp_si.SFTP_OP_UNSUPPORTED paramiko.sftp_si-module.html#SFTP_OP_UNSUPPORTED -paramiko.sftp_si.MSG_USERAUTH_INFO_RESPONSE paramiko.sftp_si-module.html#MSG_USERAUTH_INFO_RESPONSE -paramiko.sftp_si.MSG_REQUEST_FAILURE paramiko.sftp_si-module.html#MSG_REQUEST_FAILURE -paramiko.sftp_si.CMD_STATUS paramiko.sftp_si-module.html#CMD_STATUS -paramiko.sftp_si.AUTH_PARTIALLY_SUCCESSFUL paramiko.sftp_si-module.html#AUTH_PARTIALLY_SUCCESSFUL -paramiko.sftp_si.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED paramiko.sftp_si-module.html#OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -paramiko.sftp_si.MSG_CHANNEL_FAILURE paramiko.sftp_si-module.html#MSG_CHANNEL_FAILURE -paramiko.sftp_si.rng paramiko.sftp_si-module.html#rng -paramiko.sftp_si.SFTP_CONNECTION_LOST paramiko.sftp_si-module.html#SFTP_CONNECTION_LOST -paramiko.sftp_si.OPEN_FAILED_CONNECT_FAILED paramiko.sftp_si-module.html#OPEN_FAILED_CONNECT_FAILED -paramiko.sftp_si.MSG_USERAUTH_REQUEST paramiko.sftp_si-module.html#MSG_USERAUTH_REQUEST -paramiko.sftp_si.MSG_SERVICE_REQUEST paramiko.sftp_si-module.html#MSG_SERVICE_REQUEST -paramiko.sftp_si.CMD_REALPATH paramiko.sftp_si-module.html#CMD_REALPATH -paramiko.sftp_si.MSG_CHANNEL_CLOSE paramiko.sftp_si-module.html#MSG_CHANNEL_CLOSE -paramiko.sftp_si.MSG_CHANNEL_OPEN_SUCCESS paramiko.sftp_si-module.html#MSG_CHANNEL_OPEN_SUCCESS -paramiko.ssh_exception paramiko.ssh_exception-module.html -paramiko.ssh_exception.__package__ paramiko.ssh_exception-module.html#__package__ -paramiko.transport paramiko.transport-module.html -paramiko.transport.MSG_NAMES paramiko.transport-module.html#MSG_NAMES -paramiko.transport.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE paramiko.transport-module.html#DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE -paramiko.transport.MSG_GLOBAL_REQUEST paramiko.transport-module.html#MSG_GLOBAL_REQUEST -paramiko.transport._active_threads paramiko.transport-module.html#_active_threads -paramiko.transport.MSG_CHANNEL_SUCCESS paramiko.transport-module.html#MSG_CHANNEL_SUCCESS -paramiko.transport.CRITICAL paramiko.transport-module.html#CRITICAL -paramiko.transport.OPEN_FAILED_RESOURCE_SHORTAGE paramiko.transport-module.html#OPEN_FAILED_RESOURCE_SHORTAGE -paramiko.transport.MSG_CHANNEL_OPEN_FAILURE paramiko.transport-module.html#MSG_CHANNEL_OPEN_FAILURE -paramiko.transport.PY22 paramiko.transport-module.html#PY22 -paramiko.transport.DISCONNECT_AUTH_CANCELLED_BY_USER paramiko.transport-module.html#DISCONNECT_AUTH_CANCELLED_BY_USER -paramiko.transport.MSG_NEWKEYS paramiko.transport-module.html#MSG_NEWKEYS -paramiko.transport.MSG_USERAUTH_SUCCESS paramiko.transport-module.html#MSG_USERAUTH_SUCCESS -paramiko.transport.MSG_KEXINIT paramiko.transport-module.html#MSG_KEXINIT -paramiko.transport.MSG_SERVICE_ACCEPT paramiko.transport-module.html#MSG_SERVICE_ACCEPT -paramiko.transport.WARNING paramiko.transport-module.html#WARNING -paramiko.transport.ERROR paramiko.transport-module.html#ERROR -paramiko.transport.DEBUG paramiko.transport-module.html#DEBUG -paramiko.transport.MSG_USERAUTH_BANNER paramiko.transport-module.html#MSG_USERAUTH_BANNER -paramiko.transport.MSG_CHANNEL_EOF paramiko.transport-module.html#MSG_CHANNEL_EOF -paramiko.transport.AUTH_FAILED paramiko.transport-module.html#AUTH_FAILED -paramiko.transport.MSG_USERAUTH_PK_OK paramiko.transport-module.html#MSG_USERAUTH_PK_OK -paramiko.transport.AUTH_SUCCESSFUL paramiko.transport-module.html#AUTH_SUCCESSFUL -paramiko.transport.MSG_CHANNEL_WINDOW_ADJUST paramiko.transport-module.html#MSG_CHANNEL_WINDOW_ADJUST -paramiko.transport.MSG_CHANNEL_REQUEST paramiko.transport-module.html#MSG_CHANNEL_REQUEST -paramiko.transport.MSG_USERAUTH_INFO_REQUEST paramiko.transport-module.html#MSG_USERAUTH_INFO_REQUEST -paramiko.transport.MSG_DISCONNECT paramiko.transport-module.html#MSG_DISCONNECT -paramiko.transport.MSG_IGNORE paramiko.transport-module.html#MSG_IGNORE -paramiko.transport.MSG_USERAUTH_FAILURE paramiko.transport-module.html#MSG_USERAUTH_FAILURE -paramiko.transport.MSG_CHANNEL_DATA paramiko.transport-module.html#MSG_CHANNEL_DATA -paramiko.transport.MSG_UNIMPLEMENTED paramiko.transport-module.html#MSG_UNIMPLEMENTED -paramiko.transport.MSG_DEBUG paramiko.transport-module.html#MSG_DEBUG -paramiko.transport.OPEN_SUCCEEDED paramiko.transport-module.html#OPEN_SUCCEEDED -paramiko.transport.OPEN_FAILED_UNKNOWN_CHANNEL_TYPE paramiko.transport-module.html#OPEN_FAILED_UNKNOWN_CHANNEL_TYPE -paramiko.transport.INFO paramiko.transport-module.html#INFO -paramiko.transport.DISCONNECT_SERVICE_NOT_AVAILABLE paramiko.transport-module.html#DISCONNECT_SERVICE_NOT_AVAILABLE -paramiko.transport.MSG_CHANNEL_EXTENDED_DATA paramiko.transport-module.html#MSG_CHANNEL_EXTENDED_DATA -paramiko.transport.CONNECTION_FAILED_CODE paramiko.transport-module.html#CONNECTION_FAILED_CODE -paramiko.transport.MSG_CHANNEL_OPEN paramiko.transport-module.html#MSG_CHANNEL_OPEN -paramiko.transport.MSG_USERAUTH_INFO_RESPONSE paramiko.transport-module.html#MSG_USERAUTH_INFO_RESPONSE -paramiko.transport.MSG_REQUEST_FAILURE paramiko.transport-module.html#MSG_REQUEST_FAILURE -paramiko.transport.__package__ paramiko.transport-module.html#__package__ -paramiko.transport.AUTH_PARTIALLY_SUCCESSFUL paramiko.transport-module.html#AUTH_PARTIALLY_SUCCESSFUL -paramiko.transport.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED paramiko.transport-module.html#OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -paramiko.transport.MSG_CHANNEL_FAILURE paramiko.transport-module.html#MSG_CHANNEL_FAILURE -paramiko.transport.rng paramiko.transport-module.html#rng -paramiko.transport.MSG_REQUEST_SUCCESS paramiko.transport-module.html#MSG_REQUEST_SUCCESS -paramiko.transport.OPEN_FAILED_CONNECT_FAILED paramiko.transport-module.html#OPEN_FAILED_CONNECT_FAILED -paramiko.transport.MSG_USERAUTH_REQUEST paramiko.transport-module.html#MSG_USERAUTH_REQUEST -paramiko.transport._join_lingering_threads paramiko.transport-module.html#_join_lingering_threads -paramiko.transport.MSG_SERVICE_REQUEST paramiko.transport-module.html#MSG_SERVICE_REQUEST -paramiko.transport.MSG_CHANNEL_CLOSE paramiko.transport-module.html#MSG_CHANNEL_CLOSE -paramiko.transport.MSG_CHANNEL_OPEN_SUCCESS paramiko.transport-module.html#MSG_CHANNEL_OPEN_SUCCESS -paramiko.util paramiko.util-module.html -paramiko.util.AUTH_SUCCESSFUL paramiko.util-module.html#AUTH_SUCCESSFUL -paramiko.util.generate_key_bytes paramiko.util-module.html#generate_key_bytes -paramiko.util.MSG_KEXINIT paramiko.util-module.html#MSG_KEXINIT -paramiko.util.MSG_CHANNEL_WINDOW_ADJUST paramiko.util-module.html#MSG_CHANNEL_WINDOW_ADJUST -paramiko.util.MSG_CHANNEL_REQUEST paramiko.util-module.html#MSG_CHANNEL_REQUEST -paramiko.util.MSG_NAMES paramiko.util-module.html#MSG_NAMES -paramiko.util.get_thread_id paramiko.util-module.html#get_thread_id -paramiko.util.lookup_ssh_host_config paramiko.util-module.html#lookup_ssh_host_config -paramiko.util.MSG_CHANNEL_OPEN paramiko.util-module.html#MSG_CHANNEL_OPEN -paramiko.util.tb_strings paramiko.util-module.html#tb_strings -paramiko.util.load_host_keys paramiko.util-module.html#load_host_keys -paramiko.util.MSG_REQUEST_SUCCESS paramiko.util-module.html#MSG_REQUEST_SUCCESS -paramiko.util.MSG_DISCONNECT paramiko.util-module.html#MSG_DISCONNECT -paramiko.util.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE paramiko.util-module.html#DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE -paramiko.util.MSG_SERVICE_ACCEPT paramiko.util-module.html#MSG_SERVICE_ACCEPT -paramiko.util.MSG_IGNORE paramiko.util-module.html#MSG_IGNORE -paramiko.util._g_thread_lock paramiko.util-module.html#_g_thread_lock -paramiko.util.deflate_long paramiko.util-module.html#deflate_long -paramiko.util.MSG_GLOBAL_REQUEST paramiko.util-module.html#MSG_GLOBAL_REQUEST -paramiko.util.MSG_USERAUTH_INFO_RESPONSE paramiko.util-module.html#MSG_USERAUTH_INFO_RESPONSE -paramiko.util.get_logger paramiko.util-module.html#get_logger -paramiko.util.MSG_CHANNEL_SUCCESS paramiko.util-module.html#MSG_CHANNEL_SUCCESS -paramiko.util.MSG_USERAUTH_FAILURE paramiko.util-module.html#MSG_USERAUTH_FAILURE -paramiko.util.MSG_REQUEST_FAILURE paramiko.util-module.html#MSG_REQUEST_FAILURE -paramiko.util.inflate_long paramiko.util-module.html#inflate_long -paramiko.util.__package__ paramiko.util-module.html#__package__ -paramiko.util.safe_string paramiko.util-module.html#safe_string -paramiko.util._g_thread_counter paramiko.util-module.html#_g_thread_counter -paramiko.util.MSG_CHANNEL_DATA paramiko.util-module.html#MSG_CHANNEL_DATA -paramiko.util.CRITICAL paramiko.util-module.html#CRITICAL -paramiko.util.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED paramiko.util-module.html#OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -paramiko.util.parse_ssh_config paramiko.util-module.html#parse_ssh_config -paramiko.util.MSG_UNIMPLEMENTED paramiko.util-module.html#MSG_UNIMPLEMENTED -paramiko.util.bit_length paramiko.util-module.html#bit_length -paramiko.util.unhexify paramiko.util-module.html#unhexify -paramiko.util.MSG_CHANNEL_OPEN_FAILURE paramiko.util-module.html#MSG_CHANNEL_OPEN_FAILURE -paramiko.util.MSG_USERAUTH_INFO_REQUEST paramiko.util-module.html#MSG_USERAUTH_INFO_REQUEST -paramiko.util.log_to_file paramiko.util-module.html#log_to_file -paramiko.util.MSG_DEBUG paramiko.util-module.html#MSG_DEBUG -paramiko.util.MSG_CHANNEL_FAILURE paramiko.util-module.html#MSG_CHANNEL_FAILURE -paramiko.util.OPEN_SUCCEEDED paramiko.util-module.html#OPEN_SUCCEEDED -paramiko.util.format_binary_weird paramiko.util-module.html#format_binary_weird -paramiko.util.format_binary_line paramiko.util-module.html#format_binary_line -paramiko.util.rng paramiko.util-module.html#rng -paramiko.util.OPEN_FAILED_UNKNOWN_CHANNEL_TYPE paramiko.util-module.html#OPEN_FAILED_UNKNOWN_CHANNEL_TYPE -paramiko.util.OPEN_FAILED_RESOURCE_SHORTAGE paramiko.util-module.html#OPEN_FAILED_RESOURCE_SHORTAGE -paramiko.util.ERROR paramiko.util-module.html#ERROR -paramiko.util.DEBUG paramiko.util-module.html#DEBUG -paramiko.util.AUTH_PARTIALLY_SUCCESSFUL paramiko.util-module.html#AUTH_PARTIALLY_SUCCESSFUL -paramiko.util.hexify paramiko.util-module.html#hexify -paramiko.util.OPEN_FAILED_CONNECT_FAILED paramiko.util-module.html#OPEN_FAILED_CONNECT_FAILED -paramiko.util.INFO paramiko.util-module.html#INFO -paramiko.util.MSG_USERAUTH_BANNER paramiko.util-module.html#MSG_USERAUTH_BANNER -paramiko.util.MSG_NEWKEYS paramiko.util-module.html#MSG_NEWKEYS -paramiko.util.MSG_USERAUTH_PK_OK paramiko.util-module.html#MSG_USERAUTH_PK_OK -paramiko.util.WARNING paramiko.util-module.html#WARNING -paramiko.util.mod_inverse paramiko.util-module.html#mod_inverse -paramiko.util.MSG_USERAUTH_REQUEST paramiko.util-module.html#MSG_USERAUTH_REQUEST -paramiko.util.DISCONNECT_SERVICE_NOT_AVAILABLE paramiko.util-module.html#DISCONNECT_SERVICE_NOT_AVAILABLE -paramiko.util.PY22 paramiko.util-module.html#PY22 -paramiko.util.MSG_SERVICE_REQUEST paramiko.util-module.html#MSG_SERVICE_REQUEST -paramiko.util.AUTH_FAILED paramiko.util-module.html#AUTH_FAILED -paramiko.util._pfilter paramiko.util-module.html#_pfilter -paramiko.util.MSG_CHANNEL_EXTENDED_DATA paramiko.util-module.html#MSG_CHANNEL_EXTENDED_DATA -paramiko.util.format_binary paramiko.util-module.html#format_binary -paramiko.util.MSG_CHANNEL_CLOSE paramiko.util-module.html#MSG_CHANNEL_CLOSE -paramiko.util.DISCONNECT_AUTH_CANCELLED_BY_USER paramiko.util-module.html#DISCONNECT_AUTH_CANCELLED_BY_USER -paramiko.util.MSG_CHANNEL_OPEN_SUCCESS paramiko.util-module.html#MSG_CHANNEL_OPEN_SUCCESS -paramiko.util.MSG_CHANNEL_EOF paramiko.util-module.html#MSG_CHANNEL_EOF -paramiko.util._g_thread_ids paramiko.util-module.html#_g_thread_ids -paramiko.util.MSG_USERAUTH_SUCCESS paramiko.util-module.html#MSG_USERAUTH_SUCCESS -paramiko.util.CONNECTION_FAILED_CODE paramiko.util-module.html#CONNECTION_FAILED_CODE -paramiko.win_pageant paramiko.win_pageant-module.html -paramiko.win_pageant.win32con_WM_COPYDATA paramiko.win_pageant-module.html#win32con_WM_COPYDATA -paramiko.win_pageant._AGENT_MAX_MSGLEN paramiko.win_pageant-module.html#_AGENT_MAX_MSGLEN -paramiko.win_pageant._query_pageant paramiko.win_pageant-module.html#_query_pageant -paramiko.win_pageant.__package__ paramiko.win_pageant-module.html#__package__ -paramiko.win_pageant._AGENT_COPYDATA_ID paramiko.win_pageant-module.html#_AGENT_COPYDATA_ID -paramiko.win_pageant._get_pageant_window_object paramiko.win_pageant-module.html#_get_pageant_window_object -paramiko.win_pageant._has_win32all paramiko.win_pageant-module.html#_has_win32all -paramiko.win_pageant._has_ctypes paramiko.win_pageant-module.html#_has_ctypes -paramiko.win_pageant.can_talk_to_agent paramiko.win_pageant-module.html#can_talk_to_agent -paramiko.Agent paramiko.Agent-class.html -paramiko.Agent._send_message paramiko.Agent-class.html#_send_message -paramiko.Agent.close paramiko.Agent-class.html#close -paramiko.Agent.get_keys paramiko.Agent-class.html#get_keys -paramiko.Agent.__init__ paramiko.Agent-class.html#__init__ -paramiko.Agent._read_all paramiko.Agent-class.html#_read_all -paramiko.AgentKey paramiko.AgentKey-class.html -paramiko.AgentKey.sign_ssh_data paramiko.AgentKey-class.html#sign_ssh_data -paramiko.PKey.write_private_key_file paramiko.PKey-class.html#write_private_key_file -paramiko.AgentKey.__str__ paramiko.AgentKey-class.html#__str__ -paramiko.PKey._write_private_key_file paramiko.PKey-class.html#_write_private_key_file -paramiko.PKey.__cmp__ paramiko.PKey-class.html#__cmp__ -paramiko.AgentKey.__init__ paramiko.AgentKey-class.html#__init__ -paramiko.PKey.get_bits paramiko.PKey-class.html#get_bits -paramiko.PKey.from_private_key paramiko.PKey-class.html#from_private_key -paramiko.PKey.from_private_key_file paramiko.PKey-class.html#from_private_key_file -paramiko.PKey.verify_ssh_sig paramiko.PKey-class.html#verify_ssh_sig -paramiko.PKey._CIPHER_TABLE paramiko.PKey-class.html#_CIPHER_TABLE -paramiko.PKey.get_fingerprint paramiko.PKey-class.html#get_fingerprint -paramiko.PKey._write_private_key paramiko.PKey-class.html#_write_private_key -paramiko.PKey.get_base64 paramiko.PKey-class.html#get_base64 -paramiko.PKey._read_private_key paramiko.PKey-class.html#_read_private_key -paramiko.PKey.write_private_key paramiko.PKey-class.html#write_private_key -paramiko.AgentKey.get_name paramiko.AgentKey-class.html#get_name -paramiko.PKey._read_private_key_file paramiko.PKey-class.html#_read_private_key_file -paramiko.PKey.can_sign paramiko.PKey-class.html#can_sign -paramiko.AuthenticationException paramiko.AuthenticationException-class.html -paramiko.AutoAddPolicy paramiko.AutoAddPolicy-class.html -paramiko.AutoAddPolicy.missing_host_key paramiko.AutoAddPolicy-class.html#missing_host_key -paramiko.BadAuthenticationType paramiko.BadAuthenticationType-class.html -paramiko.BadAuthenticationType.__str__ paramiko.BadAuthenticationType-class.html#__str__ -paramiko.BadAuthenticationType.allowed_types paramiko.BadAuthenticationType-class.html#allowed_types -paramiko.BadAuthenticationType.__init__ paramiko.BadAuthenticationType-class.html#__init__ -paramiko.BadHostKeyException paramiko.BadHostKeyException-class.html -paramiko.BadHostKeyException.expected_key paramiko.BadHostKeyException-class.html#expected_key -paramiko.BadHostKeyException.__init__ paramiko.BadHostKeyException-class.html#__init__ -paramiko.BadHostKeyException.hostname paramiko.BadHostKeyException-class.html#hostname -paramiko.BadHostKeyException.key paramiko.BadHostKeyException-class.html#key -paramiko.BufferedFile paramiko.BufferedFile-class.html -paramiko.BufferedFile.xreadlines paramiko.BufferedFile-class.html#xreadlines -paramiko.BufferedFile.readlines paramiko.BufferedFile-class.html#readlines -paramiko.BufferedFile.SEEK_CUR paramiko.BufferedFile-class.html#SEEK_CUR -paramiko.BufferedFile.FLAG_READ paramiko.BufferedFile-class.html#FLAG_READ -paramiko.BufferedFile.flush paramiko.BufferedFile-class.html#flush -paramiko.BufferedFile.close paramiko.BufferedFile-class.html#close -paramiko.BufferedFile._set_mode paramiko.BufferedFile-class.html#_set_mode -paramiko.BufferedFile._write paramiko.BufferedFile-class.html#_write -paramiko.BufferedFile.__init__ paramiko.BufferedFile-class.html#__init__ -paramiko.BufferedFile.FLAG_UNIVERSAL_NEWLINE paramiko.BufferedFile-class.html#FLAG_UNIVERSAL_NEWLINE -paramiko.BufferedFile.readline paramiko.BufferedFile-class.html#readline -paramiko.BufferedFile.seek paramiko.BufferedFile-class.html#seek -paramiko.BufferedFile.next paramiko.BufferedFile-class.html#next -paramiko.BufferedFile.write paramiko.BufferedFile-class.html#write -paramiko.BufferedFile.read paramiko.BufferedFile-class.html#read -paramiko.BufferedFile.tell paramiko.BufferedFile-class.html#tell -paramiko.BufferedFile.FLAG_BINARY paramiko.BufferedFile-class.html#FLAG_BINARY -paramiko.BufferedFile.__del__ paramiko.BufferedFile-class.html#__del__ -paramiko.BufferedFile.SEEK_SET paramiko.BufferedFile-class.html#SEEK_SET -paramiko.BufferedFile.FLAG_APPEND paramiko.BufferedFile-class.html#FLAG_APPEND -paramiko.BufferedFile.__iter__ paramiko.BufferedFile-class.html#__iter__ -paramiko.BufferedFile._record_newline paramiko.BufferedFile-class.html#_record_newline -paramiko.BufferedFile._DEFAULT_BUFSIZE paramiko.BufferedFile-class.html#_DEFAULT_BUFSIZE -paramiko.BufferedFile.FLAG_BUFFERED paramiko.BufferedFile-class.html#FLAG_BUFFERED -paramiko.BufferedFile._write_all paramiko.BufferedFile-class.html#_write_all -paramiko.BufferedFile.writelines paramiko.BufferedFile-class.html#writelines -paramiko.BufferedFile.SEEK_END paramiko.BufferedFile-class.html#SEEK_END -paramiko.BufferedFile._read paramiko.BufferedFile-class.html#_read -paramiko.BufferedFile.FLAG_LINE_BUFFERED paramiko.BufferedFile-class.html#FLAG_LINE_BUFFERED -paramiko.BufferedFile._get_size paramiko.BufferedFile-class.html#_get_size -paramiko.BufferedFile.FLAG_WRITE paramiko.BufferedFile-class.html#FLAG_WRITE -paramiko.Channel paramiko.Channel-class.html -paramiko.Channel.makefile_stderr paramiko.Channel-class.html#makefile_stderr -paramiko.Channel.gettimeout paramiko.Channel-class.html#gettimeout -paramiko.Channel.shutdown_read paramiko.Channel-class.html#shutdown_read -paramiko.Channel.set_combine_stderr paramiko.Channel-class.html#set_combine_stderr -paramiko.Channel.send_ready paramiko.Channel-class.html#send_ready -paramiko.Channel._unlink paramiko.Channel-class.html#_unlink -paramiko.Channel.shutdown paramiko.Channel-class.html#shutdown -paramiko.Channel.get_transport paramiko.Channel-class.html#get_transport -paramiko.Channel.sendall_stderr paramiko.Channel-class.html#sendall_stderr -paramiko.Channel.close paramiko.Channel-class.html#close -paramiko.Channel.send_exit_status paramiko.Channel-class.html#send_exit_status -paramiko.Channel.recv_stderr paramiko.Channel-class.html#recv_stderr -paramiko.Channel.__init__ paramiko.Channel-class.html#__init__ -paramiko.Channel._set_closed paramiko.Channel-class.html#_set_closed -paramiko.Channel.exit_status_ready paramiko.Channel-class.html#exit_status_ready -paramiko.Channel.request_x11 paramiko.Channel-class.html#request_x11 -paramiko.Channel.recv_ready paramiko.Channel-class.html#recv_ready -paramiko.Channel._feed_extended paramiko.Channel-class.html#_feed_extended -paramiko.Channel.shutdown_write paramiko.Channel-class.html#shutdown_write -paramiko.Channel._set_remote_channel paramiko.Channel-class.html#_set_remote_channel -paramiko.Channel._feed paramiko.Channel-class.html#_feed -paramiko.Channel.makefile paramiko.Channel-class.html#makefile -paramiko.Channel._handle_close paramiko.Channel-class.html#_handle_close -paramiko.Channel.send paramiko.Channel-class.html#send -paramiko.Channel._handle_request paramiko.Channel-class.html#_handle_request -paramiko.Channel.resize_pty paramiko.Channel-class.html#resize_pty -paramiko.Channel.get_pty paramiko.Channel-class.html#get_pty -paramiko.Channel.recv_stderr_ready paramiko.Channel-class.html#recv_stderr_ready -paramiko.Channel._request_success paramiko.Channel-class.html#_request_success -paramiko.Channel._send_eof paramiko.Channel-class.html#_send_eof -paramiko.Channel._window_adjust paramiko.Channel-class.html#_window_adjust -paramiko.Channel._event_pending paramiko.Channel-class.html#_event_pending -paramiko.Channel.__del__ paramiko.Channel-class.html#__del__ -paramiko.Channel._check_add_window paramiko.Channel-class.html#_check_add_window -paramiko.Channel.invoke_subsystem paramiko.Channel-class.html#invoke_subsystem -paramiko.Channel.invoke_shell paramiko.Channel-class.html#invoke_shell -paramiko.Channel.recv_exit_status paramiko.Channel-class.html#recv_exit_status -paramiko.Channel._request_failed paramiko.Channel-class.html#_request_failed -paramiko.Channel.get_id paramiko.Channel-class.html#get_id -paramiko.Channel.send_stderr paramiko.Channel-class.html#send_stderr -paramiko.Channel._log paramiko.Channel-class.html#_log -paramiko.Channel.getpeername paramiko.Channel-class.html#getpeername -paramiko.Channel.recv paramiko.Channel-class.html#recv -paramiko.Channel.exec_command paramiko.Channel-class.html#exec_command -paramiko.Channel.setblocking paramiko.Channel-class.html#setblocking -paramiko.Channel._wait_for_event paramiko.Channel-class.html#_wait_for_event -paramiko.Channel.fileno paramiko.Channel-class.html#fileno -paramiko.Channel.set_name paramiko.Channel-class.html#set_name -paramiko.Channel._handle_eof paramiko.Channel-class.html#_handle_eof -paramiko.Channel._close_internal paramiko.Channel-class.html#_close_internal -paramiko.Channel._set_window paramiko.Channel-class.html#_set_window -paramiko.Channel._set_transport paramiko.Channel-class.html#_set_transport -paramiko.Channel.get_name paramiko.Channel-class.html#get_name -paramiko.Channel.__repr__ paramiko.Channel-class.html#__repr__ -paramiko.Channel.sendall paramiko.Channel-class.html#sendall -paramiko.Channel._wait_for_send_window paramiko.Channel-class.html#_wait_for_send_window -paramiko.Channel.settimeout paramiko.Channel-class.html#settimeout -paramiko.ChannelException paramiko.ChannelException-class.html -paramiko.ChannelException.code paramiko.ChannelException-class.html#code -paramiko.ChannelException.__init__ paramiko.ChannelException-class.html#__init__ -paramiko.DSSKey paramiko.DSSKey-class.html -paramiko.DSSKey.sign_ssh_data paramiko.DSSKey-class.html#sign_ssh_data -paramiko.DSSKey._from_private_key paramiko.DSSKey-class.html#_from_private_key -paramiko.DSSKey.write_private_key_file paramiko.DSSKey-class.html#write_private_key_file -paramiko.DSSKey.__str__ paramiko.DSSKey-class.html#__str__ -paramiko.PKey._write_private_key_file paramiko.PKey-class.html#_write_private_key_file -paramiko.PKey.__cmp__ paramiko.PKey-class.html#__cmp__ -paramiko.DSSKey.__init__ paramiko.DSSKey-class.html#__init__ -paramiko.DSSKey._from_private_key_file paramiko.DSSKey-class.html#_from_private_key_file -paramiko.DSSKey.get_bits paramiko.DSSKey-class.html#get_bits -paramiko.PKey.from_private_key paramiko.PKey-class.html#from_private_key -paramiko.DSSKey.verify_ssh_sig paramiko.DSSKey-class.html#verify_ssh_sig -paramiko.DSSKey.can_sign paramiko.DSSKey-class.html#can_sign -paramiko.PKey.from_private_key_file paramiko.PKey-class.html#from_private_key_file -paramiko.PKey._CIPHER_TABLE paramiko.PKey-class.html#_CIPHER_TABLE -paramiko.PKey.get_fingerprint paramiko.PKey-class.html#get_fingerprint -paramiko.PKey._write_private_key paramiko.PKey-class.html#_write_private_key -paramiko.PKey.get_base64 paramiko.PKey-class.html#get_base64 -paramiko.PKey._read_private_key paramiko.PKey-class.html#_read_private_key -paramiko.DSSKey.write_private_key paramiko.DSSKey-class.html#write_private_key -paramiko.DSSKey.generate paramiko.DSSKey-class.html#generate -paramiko.DSSKey.get_name paramiko.DSSKey-class.html#get_name -paramiko.DSSKey._encode_key paramiko.DSSKey-class.html#_encode_key -paramiko.DSSKey._decode_key paramiko.DSSKey-class.html#_decode_key -paramiko.DSSKey.__hash__ paramiko.DSSKey-class.html#__hash__ -paramiko.PKey._read_private_key_file paramiko.PKey-class.html#_read_private_key_file -paramiko.HostKeys paramiko.HostKeys-class.html -paramiko.HostKeys.load paramiko.HostKeys-class.html#load -paramiko.HostKeys.check paramiko.HostKeys-class.html#check -paramiko.HostKeys.__init__ paramiko.HostKeys-class.html#__init__ -paramiko.HostKeys.add paramiko.HostKeys-class.html#add -paramiko.HostKeys.lookup paramiko.HostKeys-class.html#lookup -paramiko.HostKeys.save paramiko.HostKeys-class.html#save -paramiko.HostKeys.__getitem__ paramiko.HostKeys-class.html#__getitem__ -paramiko.HostKeys.keys paramiko.HostKeys-class.html#keys -paramiko.HostKeys.hash_host paramiko.HostKeys-class.html#hash_host -paramiko.HostKeys.clear paramiko.HostKeys-class.html#clear -paramiko.HostKeys.__setitem__ paramiko.HostKeys-class.html#__setitem__ -paramiko.HostKeys.values paramiko.HostKeys-class.html#values -paramiko.Message paramiko.Message-class.html -paramiko.Message.get_byte paramiko.Message-class.html#get_byte -paramiko.Message.__str__ paramiko.Message-class.html#__str__ -paramiko.Message.get_so_far paramiko.Message-class.html#get_so_far -paramiko.Message._add paramiko.Message-class.html#_add -paramiko.Message.add_list paramiko.Message-class.html#add_list -paramiko.Message.__init__ paramiko.Message-class.html#__init__ -paramiko.Message.get_mpint paramiko.Message-class.html#get_mpint -paramiko.Message.add_byte paramiko.Message-class.html#add_byte -paramiko.Message.get_list paramiko.Message-class.html#get_list -paramiko.Message.add paramiko.Message-class.html#add -paramiko.Message.get_string paramiko.Message-class.html#get_string -paramiko.Message.rewind paramiko.Message-class.html#rewind -paramiko.Message.get_bytes paramiko.Message-class.html#get_bytes -paramiko.Message.get_boolean paramiko.Message-class.html#get_boolean -paramiko.Message.get_int64 paramiko.Message-class.html#get_int64 -paramiko.Message.add_boolean paramiko.Message-class.html#add_boolean -paramiko.Message.add_int64 paramiko.Message-class.html#add_int64 -paramiko.Message.add_bytes paramiko.Message-class.html#add_bytes -paramiko.Message.add_int paramiko.Message-class.html#add_int -paramiko.Message.get_int paramiko.Message-class.html#get_int -paramiko.Message.__repr__ paramiko.Message-class.html#__repr__ -paramiko.Message.get_remainder paramiko.Message-class.html#get_remainder -paramiko.Message.add_string paramiko.Message-class.html#add_string -paramiko.Message.add_mpint paramiko.Message-class.html#add_mpint -paramiko.MissingHostKeyPolicy paramiko.MissingHostKeyPolicy-class.html -paramiko.MissingHostKeyPolicy.missing_host_key paramiko.MissingHostKeyPolicy-class.html#missing_host_key -paramiko.PKey paramiko.PKey-class.html -paramiko.PKey.sign_ssh_data paramiko.PKey-class.html#sign_ssh_data -paramiko.PKey.write_private_key_file paramiko.PKey-class.html#write_private_key_file -paramiko.PKey.__str__ paramiko.PKey-class.html#__str__ -paramiko.PKey._write_private_key_file paramiko.PKey-class.html#_write_private_key_file -paramiko.PKey.__cmp__ paramiko.PKey-class.html#__cmp__ -paramiko.PKey.__init__ paramiko.PKey-class.html#__init__ -paramiko.PKey.get_bits paramiko.PKey-class.html#get_bits -paramiko.PKey.from_private_key paramiko.PKey-class.html#from_private_key -paramiko.PKey.from_private_key_file paramiko.PKey-class.html#from_private_key_file -paramiko.PKey.verify_ssh_sig paramiko.PKey-class.html#verify_ssh_sig -paramiko.PKey._CIPHER_TABLE paramiko.PKey-class.html#_CIPHER_TABLE -paramiko.PKey.get_fingerprint paramiko.PKey-class.html#get_fingerprint -paramiko.PKey._write_private_key paramiko.PKey-class.html#_write_private_key -paramiko.PKey.get_base64 paramiko.PKey-class.html#get_base64 -paramiko.PKey._read_private_key paramiko.PKey-class.html#_read_private_key -paramiko.PKey.write_private_key paramiko.PKey-class.html#write_private_key -paramiko.PKey.get_name paramiko.PKey-class.html#get_name -paramiko.PKey.can_sign paramiko.PKey-class.html#can_sign -paramiko.PKey._read_private_key_file paramiko.PKey-class.html#_read_private_key_file -paramiko.PasswordRequiredException paramiko.PasswordRequiredException-class.html -paramiko.RSAKey paramiko.RSAKey-class.html -paramiko.RSAKey.sign_ssh_data paramiko.RSAKey-class.html#sign_ssh_data -paramiko.RSAKey._from_private_key paramiko.RSAKey-class.html#_from_private_key -paramiko.PKey.from_private_key paramiko.PKey-class.html#from_private_key -paramiko.RSAKey.__str__ paramiko.RSAKey-class.html#__str__ -paramiko.PKey._write_private_key_file paramiko.PKey-class.html#_write_private_key_file -paramiko.PKey.__cmp__ paramiko.PKey-class.html#__cmp__ -paramiko.RSAKey.__init__ paramiko.RSAKey-class.html#__init__ -paramiko.RSAKey._from_private_key_file paramiko.RSAKey-class.html#_from_private_key_file -paramiko.RSAKey.get_bits paramiko.RSAKey-class.html#get_bits -paramiko.RSAKey.write_private_key_file paramiko.RSAKey-class.html#write_private_key_file -paramiko.RSAKey.verify_ssh_sig paramiko.RSAKey-class.html#verify_ssh_sig -paramiko.RSAKey._pkcs1imify paramiko.RSAKey-class.html#_pkcs1imify -paramiko.PKey.from_private_key_file paramiko.PKey-class.html#from_private_key_file -paramiko.PKey._CIPHER_TABLE paramiko.PKey-class.html#_CIPHER_TABLE -paramiko.PKey.get_fingerprint paramiko.PKey-class.html#get_fingerprint -paramiko.PKey._write_private_key paramiko.PKey-class.html#_write_private_key -paramiko.PKey.get_base64 paramiko.PKey-class.html#get_base64 -paramiko.PKey._read_private_key paramiko.PKey-class.html#_read_private_key -paramiko.RSAKey.write_private_key paramiko.RSAKey-class.html#write_private_key -paramiko.RSAKey.generate paramiko.RSAKey-class.html#generate -paramiko.PKey._read_private_key_file paramiko.PKey-class.html#_read_private_key_file -paramiko.RSAKey.get_name paramiko.RSAKey-class.html#get_name -paramiko.RSAKey.can_sign paramiko.RSAKey-class.html#can_sign -paramiko.RSAKey._decode_key paramiko.RSAKey-class.html#_decode_key -paramiko.RSAKey.__hash__ paramiko.RSAKey-class.html#__hash__ -paramiko.RSAKey._encode_key paramiko.RSAKey-class.html#_encode_key -paramiko.RejectPolicy paramiko.RejectPolicy-class.html -paramiko.RejectPolicy.missing_host_key paramiko.RejectPolicy-class.html#missing_host_key -paramiko.SFTP paramiko.SFTP-class.html -paramiko.SFTPClient.rename paramiko.SFTPClient-class.html#rename -paramiko.SFTPClient._request paramiko.SFTPClient-class.html#_request -paramiko.SFTPClient.stat paramiko.SFTPClient-class.html#stat -paramiko.SFTPClient.chmod paramiko.SFTPClient-class.html#chmod -paramiko.SFTPClient.file paramiko.SFTPClient-class.html#file -paramiko.SFTPClient.close paramiko.SFTPClient-class.html#close -paramiko.SFTPClient.open paramiko.SFTPClient-class.html#open -paramiko.SFTPClient.__init__ paramiko.SFTPClient-class.html#__init__ -paramiko.SFTPClient.normalize paramiko.SFTPClient-class.html#normalize -paramiko.SFTPClient._convert_status paramiko.SFTPClient-class.html#_convert_status -paramiko.SFTPClient.lstat paramiko.SFTPClient-class.html#lstat -paramiko.SFTPClient.mkdir paramiko.SFTPClient-class.html#mkdir -paramiko.SFTPClient._finish_responses paramiko.SFTPClient-class.html#_finish_responses -paramiko.SFTPClient._adjust_cwd paramiko.SFTPClient-class.html#_adjust_cwd -paramiko.SFTPClient.rmdir paramiko.SFTPClient-class.html#rmdir -paramiko.SFTPClient.listdir paramiko.SFTPClient-class.html#listdir -paramiko.SFTPClient.truncate paramiko.SFTPClient-class.html#truncate -paramiko.SFTPClient.get paramiko.SFTPClient-class.html#get -paramiko.SFTPClient.get_channel paramiko.SFTPClient-class.html#get_channel -paramiko.SFTPClient.getcwd paramiko.SFTPClient-class.html#getcwd -paramiko.SFTPClient._async_request paramiko.SFTPClient-class.html#_async_request -paramiko.SFTPClient.symlink paramiko.SFTPClient-class.html#symlink -paramiko.SFTPClient.readlink paramiko.SFTPClient-class.html#readlink -paramiko.SFTPClient._log paramiko.SFTPClient-class.html#_log -paramiko.SFTPClient.put paramiko.SFTPClient-class.html#put -paramiko.SFTPClient.unlink paramiko.SFTPClient-class.html#unlink -paramiko.SFTPClient.listdir_attr paramiko.SFTPClient-class.html#listdir_attr -paramiko.SFTPClient.utime paramiko.SFTPClient-class.html#utime -paramiko.SFTPClient.chdir paramiko.SFTPClient-class.html#chdir -paramiko.SFTPClient.remove paramiko.SFTPClient-class.html#remove -paramiko.SFTPClient.from_transport paramiko.SFTPClient-class.html#from_transport -paramiko.SFTPClient.chown paramiko.SFTPClient-class.html#chown -paramiko.SFTPClient._read_response paramiko.SFTPClient-class.html#_read_response -paramiko.SFTPAttributes paramiko.SFTPAttributes-class.html -paramiko.SFTPAttributes.__str__ paramiko.SFTPAttributes-class.html#__str__ -paramiko.SFTPAttributes.FLAG_AMTIME paramiko.SFTPAttributes-class.html#FLAG_AMTIME -paramiko.SFTPAttributes._pack paramiko.SFTPAttributes-class.html#_pack -paramiko.SFTPAttributes.__init__ paramiko.SFTPAttributes-class.html#__init__ -paramiko.SFTPAttributes.FLAG_EXTENDED paramiko.SFTPAttributes-class.html#FLAG_EXTENDED -paramiko.SFTPAttributes.FLAG_PERMISSIONS paramiko.SFTPAttributes-class.html#FLAG_PERMISSIONS -paramiko.SFTPAttributes._unpack paramiko.SFTPAttributes-class.html#_unpack -paramiko.SFTPAttributes.from_stat paramiko.SFTPAttributes-class.html#from_stat -paramiko.SFTPAttributes.FLAG_UIDGID paramiko.SFTPAttributes-class.html#FLAG_UIDGID -paramiko.SFTPAttributes._rwx paramiko.SFTPAttributes-class.html#_rwx -paramiko.SFTPAttributes._debug_str paramiko.SFTPAttributes-class.html#_debug_str -paramiko.SFTPAttributes.FLAG_SIZE paramiko.SFTPAttributes-class.html#FLAG_SIZE -paramiko.SFTPAttributes.__repr__ paramiko.SFTPAttributes-class.html#__repr__ -paramiko.SFTPAttributes._from_msg paramiko.SFTPAttributes-class.html#_from_msg -paramiko.SFTPClient paramiko.SFTPClient-class.html -paramiko.SFTPClient.rename paramiko.SFTPClient-class.html#rename -paramiko.SFTPClient._request paramiko.SFTPClient-class.html#_request -paramiko.SFTPClient.listdir paramiko.SFTPClient-class.html#listdir -paramiko.SFTPClient.chmod paramiko.SFTPClient-class.html#chmod -paramiko.SFTPClient.file paramiko.SFTPClient-class.html#file -paramiko.SFTPClient.close paramiko.SFTPClient-class.html#close -paramiko.SFTPClient.open paramiko.SFTPClient-class.html#open -paramiko.SFTPClient.__init__ paramiko.SFTPClient-class.html#__init__ -paramiko.SFTPClient.normalize paramiko.SFTPClient-class.html#normalize -paramiko.SFTPClient._convert_status paramiko.SFTPClient-class.html#_convert_status -paramiko.SFTPClient.get paramiko.SFTPClient-class.html#get -paramiko.SFTPClient.mkdir paramiko.SFTPClient-class.html#mkdir -paramiko.SFTPClient._finish_responses paramiko.SFTPClient-class.html#_finish_responses -paramiko.SFTPClient._adjust_cwd paramiko.SFTPClient-class.html#_adjust_cwd -paramiko.SFTPClient.rmdir paramiko.SFTPClient-class.html#rmdir -paramiko.SFTPClient.stat paramiko.SFTPClient-class.html#stat -paramiko.SFTPClient.truncate paramiko.SFTPClient-class.html#truncate -paramiko.SFTPClient.lstat paramiko.SFTPClient-class.html#lstat -paramiko.SFTPClient.get_channel paramiko.SFTPClient-class.html#get_channel -paramiko.SFTPClient.getcwd paramiko.SFTPClient-class.html#getcwd -paramiko.SFTPClient._async_request paramiko.SFTPClient-class.html#_async_request -paramiko.SFTPClient.symlink paramiko.SFTPClient-class.html#symlink -paramiko.SFTPClient.readlink paramiko.SFTPClient-class.html#readlink -paramiko.SFTPClient._log paramiko.SFTPClient-class.html#_log -paramiko.SFTPClient.put paramiko.SFTPClient-class.html#put -paramiko.SFTPClient.unlink paramiko.SFTPClient-class.html#unlink -paramiko.SFTPClient.listdir_attr paramiko.SFTPClient-class.html#listdir_attr -paramiko.SFTPClient.utime paramiko.SFTPClient-class.html#utime -paramiko.SFTPClient.chdir paramiko.SFTPClient-class.html#chdir -paramiko.SFTPClient.remove paramiko.SFTPClient-class.html#remove -paramiko.SFTPClient.from_transport paramiko.SFTPClient-class.html#from_transport -paramiko.SFTPClient.chown paramiko.SFTPClient-class.html#chown -paramiko.SFTPClient._read_response paramiko.SFTPClient-class.html#_read_response -paramiko.SFTPError paramiko.SFTPError-class.html -paramiko.SFTPFile paramiko.SFTPFile-class.html -paramiko.BufferedFile._record_newline paramiko.BufferedFile-class.html#_record_newline -paramiko.SFTPFile._get_size paramiko.SFTPFile-class.html#_get_size -paramiko.SFTPFile.gettimeout paramiko.SFTPFile-class.html#gettimeout -paramiko.BufferedFile.xreadlines paramiko.BufferedFile-class.html#xreadlines -paramiko.BufferedFile.readlines paramiko.BufferedFile-class.html#readlines -paramiko.SFTPFile.chmod paramiko.SFTPFile-class.html#chmod -paramiko.BufferedFile.SEEK_CUR paramiko.BufferedFile-class.html#SEEK_CUR -paramiko.BufferedFile.FLAG_READ paramiko.BufferedFile-class.html#FLAG_READ -paramiko.SFTPFile.readv paramiko.SFTPFile-class.html#readv -paramiko.SFTPFile.close paramiko.SFTPFile-class.html#close -paramiko.BufferedFile.next paramiko.BufferedFile-class.html#next -paramiko.SFTPFile.seek paramiko.SFTPFile-class.html#seek -paramiko.SFTPFile.check paramiko.SFTPFile-class.html#check -paramiko.SFTPFile.__init__ paramiko.SFTPFile-class.html#__init__ -paramiko.BufferedFile.FLAG_UNIVERSAL_NEWLINE paramiko.BufferedFile-class.html#FLAG_UNIVERSAL_NEWLINE -paramiko.BufferedFile.readline paramiko.BufferedFile-class.html#readline -paramiko.BufferedFile._set_mode paramiko.BufferedFile-class.html#_set_mode -paramiko.BufferedFile.flush paramiko.BufferedFile-class.html#flush -paramiko.SFTPFile._async_response paramiko.SFTPFile-class.html#_async_response -paramiko.SFTPFile._read_prefetch paramiko.SFTPFile-class.html#_read_prefetch -paramiko.BufferedFile.write paramiko.BufferedFile-class.html#write -paramiko.SFTPFile.__del__ paramiko.SFTPFile-class.html#__del__ -paramiko.SFTPFile._start_prefetch paramiko.SFTPFile-class.html#_start_prefetch -paramiko.BufferedFile._DEFAULT_BUFSIZE paramiko.BufferedFile-class.html#_DEFAULT_BUFSIZE -paramiko.BufferedFile.tell paramiko.BufferedFile-class.html#tell -paramiko.SFTPFile._close paramiko.SFTPFile-class.html#_close -paramiko.SFTPFile.stat paramiko.SFTPFile-class.html#stat -paramiko.BufferedFile.FLAG_BINARY paramiko.BufferedFile-class.html#FLAG_BINARY -paramiko.SFTPFile.truncate paramiko.SFTPFile-class.html#truncate -paramiko.SFTPFile.MAX_REQUEST_SIZE paramiko.SFTPFile-class.html#MAX_REQUEST_SIZE -paramiko.BufferedFile.SEEK_SET paramiko.BufferedFile-class.html#SEEK_SET -paramiko.SFTPFile._check_exception paramiko.SFTPFile-class.html#_check_exception -paramiko.BufferedFile.FLAG_APPEND paramiko.BufferedFile-class.html#FLAG_APPEND -paramiko.SFTPFile._data_in_prefetch_buffers paramiko.SFTPFile-class.html#_data_in_prefetch_buffers -paramiko.BufferedFile.__iter__ paramiko.BufferedFile-class.html#__iter__ -paramiko.SFTPFile._write paramiko.SFTPFile-class.html#_write -paramiko.SFTPFile._data_in_prefetch_requests paramiko.SFTPFile-class.html#_data_in_prefetch_requests -paramiko.SFTPFile.setblocking paramiko.SFTPFile-class.html#setblocking -paramiko.SFTPFile.utime paramiko.SFTPFile-class.html#utime -paramiko.BufferedFile.FLAG_BUFFERED paramiko.BufferedFile-class.html#FLAG_BUFFERED -paramiko.BufferedFile._write_all paramiko.BufferedFile-class.html#_write_all -paramiko.BufferedFile.writelines paramiko.BufferedFile-class.html#writelines -paramiko.BufferedFile.SEEK_END paramiko.BufferedFile-class.html#SEEK_END -paramiko.BufferedFile.read paramiko.BufferedFile-class.html#read -paramiko.SFTPFile._read paramiko.SFTPFile-class.html#_read -paramiko.SFTPFile.set_pipelined paramiko.SFTPFile-class.html#set_pipelined -paramiko.BufferedFile.FLAG_LINE_BUFFERED paramiko.BufferedFile-class.html#FLAG_LINE_BUFFERED -paramiko.SFTPFile.chown paramiko.SFTPFile-class.html#chown -paramiko.BufferedFile.FLAG_WRITE paramiko.BufferedFile-class.html#FLAG_WRITE -paramiko.SFTPFile.prefetch paramiko.SFTPFile-class.html#prefetch -paramiko.SFTPFile.settimeout paramiko.SFTPFile-class.html#settimeout -paramiko.SFTPFile._prefetch_thread paramiko.SFTPFile-class.html#_prefetch_thread -paramiko.SFTPHandle paramiko.SFTPHandle-class.html -paramiko.SFTPHandle._set_files paramiko.SFTPHandle-class.html#_set_files -paramiko.SFTPHandle.close paramiko.SFTPHandle-class.html#close -paramiko.SFTPHandle.__init__ paramiko.SFTPHandle-class.html#__init__ -paramiko.SFTPHandle.write paramiko.SFTPHandle-class.html#write -paramiko.SFTPHandle._get_name paramiko.SFTPHandle-class.html#_get_name -paramiko.SFTPHandle.chattr paramiko.SFTPHandle-class.html#chattr -paramiko.SFTPHandle._set_name paramiko.SFTPHandle-class.html#_set_name -paramiko.SFTPHandle.stat paramiko.SFTPHandle-class.html#stat -paramiko.SFTPHandle.read paramiko.SFTPHandle-class.html#read -paramiko.SFTPHandle._get_next_files paramiko.SFTPHandle-class.html#_get_next_files -paramiko.SFTPServer paramiko.SFTPServer-class.html -paramiko.SFTPServer.start_subsystem paramiko.SFTPServer-class.html#start_subsystem -paramiko.SFTPServer._send_handle_response paramiko.SFTPServer-class.html#_send_handle_response -paramiko.SFTPServer._open_folder paramiko.SFTPServer-class.html#_open_folder -paramiko.SFTPServer._process paramiko.SFTPServer-class.html#_process -paramiko.SFTPServer._send_status paramiko.SFTPServer-class.html#_send_status -paramiko.SFTPServer.__init__ paramiko.SFTPServer-class.html#__init__ -paramiko.SFTPServer._response paramiko.SFTPServer-class.html#_response -paramiko.SubsystemHandler._run paramiko.SubsystemHandler-class.html#_run -paramiko.SFTPServer._convert_pflags paramiko.SFTPServer-class.html#_convert_pflags -paramiko.SFTPServer._check_file paramiko.SFTPServer-class.html#_check_file -paramiko.SFTPServer._log paramiko.SFTPServer-class.html#_log -paramiko.SFTPServer.finish_subsystem paramiko.SFTPServer-class.html#finish_subsystem -paramiko.SubsystemHandler.get_server paramiko.SubsystemHandler-class.html#get_server -paramiko.SFTPServer.convert_errno paramiko.SFTPServer-class.html#convert_errno -paramiko.SFTPServer.set_file_attr paramiko.SFTPServer-class.html#set_file_attr -paramiko.SFTPServer._read_folder paramiko.SFTPServer-class.html#_read_folder -paramiko.SFTPServerInterface paramiko.SFTPServerInterface-class.html -paramiko.SFTPServerInterface.rename paramiko.SFTPServerInterface-class.html#rename -paramiko.SFTPServerInterface.canonicalize paramiko.SFTPServerInterface-class.html#canonicalize -paramiko.SFTPServerInterface.open paramiko.SFTPServerInterface-class.html#open -paramiko.SFTPServerInterface.__init__ paramiko.SFTPServerInterface-class.html#__init__ -paramiko.SFTPServerInterface.mkdir paramiko.SFTPServerInterface-class.html#mkdir -paramiko.SFTPServerInterface.chattr paramiko.SFTPServerInterface-class.html#chattr -paramiko.SFTPServerInterface.list_folder paramiko.SFTPServerInterface-class.html#list_folder -paramiko.SFTPServerInterface.rmdir paramiko.SFTPServerInterface-class.html#rmdir -paramiko.SFTPServerInterface.stat paramiko.SFTPServerInterface-class.html#stat -paramiko.SFTPServerInterface.lstat paramiko.SFTPServerInterface-class.html#lstat -paramiko.SFTPServerInterface.session_ended paramiko.SFTPServerInterface-class.html#session_ended -paramiko.SFTPServerInterface.symlink paramiko.SFTPServerInterface-class.html#symlink -paramiko.SFTPServerInterface.readlink paramiko.SFTPServerInterface-class.html#readlink -paramiko.SFTPServerInterface.remove paramiko.SFTPServerInterface-class.html#remove -paramiko.SFTPServerInterface.session_started paramiko.SFTPServerInterface-class.html#session_started -paramiko.SSHClient paramiko.SSHClient-class.html -paramiko.SSHClient.open_sftp paramiko.SSHClient-class.html#open_sftp -paramiko.SSHClient.connect paramiko.SSHClient-class.html#connect -paramiko.SSHClient.get_transport paramiko.SSHClient-class.html#get_transport -paramiko.SSHClient.close paramiko.SSHClient-class.html#close -paramiko.SSHClient.__init__ paramiko.SSHClient-class.html#__init__ -paramiko.SSHClient.set_log_channel paramiko.SSHClient-class.html#set_log_channel -paramiko.SSHClient.load_system_host_keys paramiko.SSHClient-class.html#load_system_host_keys -paramiko.SSHClient.load_host_keys paramiko.SSHClient-class.html#load_host_keys -paramiko.SSHClient.save_host_keys paramiko.SSHClient-class.html#save_host_keys -paramiko.SSHClient._auth paramiko.SSHClient-class.html#_auth -paramiko.SSHClient.invoke_shell paramiko.SSHClient-class.html#invoke_shell -paramiko.SSHClient._log paramiko.SSHClient-class.html#_log -paramiko.SSHClient.exec_command paramiko.SSHClient-class.html#exec_command -paramiko.SSHClient.get_host_keys paramiko.SSHClient-class.html#get_host_keys -paramiko.SSHClient.set_missing_host_key_policy paramiko.SSHClient-class.html#set_missing_host_key_policy -paramiko.SSHConfig paramiko.SSHConfig-class.html -paramiko.SSHConfig.parse paramiko.SSHConfig-class.html#parse -paramiko.SSHConfig.lookup paramiko.SSHConfig-class.html#lookup -paramiko.SSHConfig.__init__ paramiko.SSHConfig-class.html#__init__ -paramiko.SSHException paramiko.SSHException-class.html -paramiko.SecurityOptions paramiko.SecurityOptions-class.html -paramiko.SecurityOptions._transport paramiko.SecurityOptions-class.html#_transport -paramiko.SecurityOptions._get_digests paramiko.SecurityOptions-class.html#_get_digests -paramiko.SecurityOptions._set_digests paramiko.SecurityOptions-class.html#_set_digests -paramiko.SecurityOptions.__init__ paramiko.SecurityOptions-class.html#__init__ -paramiko.SecurityOptions._get_ciphers paramiko.SecurityOptions-class.html#_get_ciphers -paramiko.SecurityOptions._set_compression paramiko.SecurityOptions-class.html#_set_compression -paramiko.SecurityOptions.compression paramiko.SecurityOptions-class.html#compression -paramiko.SecurityOptions.key_types paramiko.SecurityOptions-class.html#key_types -paramiko.SecurityOptions._get_compression paramiko.SecurityOptions-class.html#_get_compression -paramiko.SecurityOptions.digests paramiko.SecurityOptions-class.html#digests -paramiko.SecurityOptions._set_key_types paramiko.SecurityOptions-class.html#_set_key_types -paramiko.SecurityOptions.ciphers paramiko.SecurityOptions-class.html#ciphers -paramiko.SecurityOptions._get_key_types paramiko.SecurityOptions-class.html#_get_key_types -paramiko.SecurityOptions.kex paramiko.SecurityOptions-class.html#kex -paramiko.SecurityOptions._get_kex paramiko.SecurityOptions-class.html#_get_kex -paramiko.SecurityOptions._set_ciphers paramiko.SecurityOptions-class.html#_set_ciphers -paramiko.SecurityOptions._set_kex paramiko.SecurityOptions-class.html#_set_kex -paramiko.SecurityOptions.__repr__ paramiko.SecurityOptions-class.html#__repr__ -paramiko.SecurityOptions._set paramiko.SecurityOptions-class.html#_set -paramiko.ServerInterface paramiko.ServerInterface-class.html -paramiko.ServerInterface.check_auth_interactive paramiko.ServerInterface-class.html#check_auth_interactive -paramiko.ServerInterface.check_auth_none paramiko.ServerInterface-class.html#check_auth_none -paramiko.ServerInterface.check_channel_pty_request paramiko.ServerInterface-class.html#check_channel_pty_request -paramiko.ServerInterface.cancel_port_forward_request paramiko.ServerInterface-class.html#cancel_port_forward_request -paramiko.ServerInterface.check_channel_direct_tcpip_request paramiko.ServerInterface-class.html#check_channel_direct_tcpip_request -paramiko.ServerInterface.get_allowed_auths paramiko.ServerInterface-class.html#get_allowed_auths -paramiko.ServerInterface.check_auth_interactive_response paramiko.ServerInterface-class.html#check_auth_interactive_response -paramiko.ServerInterface.check_global_request paramiko.ServerInterface-class.html#check_global_request -paramiko.ServerInterface.check_auth_password paramiko.ServerInterface-class.html#check_auth_password -paramiko.ServerInterface.check_channel_window_change_request paramiko.ServerInterface-class.html#check_channel_window_change_request -paramiko.ServerInterface.check_auth_publickey paramiko.ServerInterface-class.html#check_auth_publickey -paramiko.ServerInterface.check_channel_shell_request paramiko.ServerInterface-class.html#check_channel_shell_request -paramiko.ServerInterface.check_channel_request paramiko.ServerInterface-class.html#check_channel_request -paramiko.ServerInterface.check_channel_x11_request paramiko.ServerInterface-class.html#check_channel_x11_request -paramiko.ServerInterface.check_channel_subsystem_request paramiko.ServerInterface-class.html#check_channel_subsystem_request -paramiko.ServerInterface.check_port_forward_request paramiko.ServerInterface-class.html#check_port_forward_request -paramiko.ServerInterface.check_channel_exec_request paramiko.ServerInterface-class.html#check_channel_exec_request -paramiko.SubsystemHandler paramiko.SubsystemHandler-class.html -paramiko.SubsystemHandler.start_subsystem paramiko.SubsystemHandler-class.html#start_subsystem -paramiko.SubsystemHandler.__init__ paramiko.SubsystemHandler-class.html#__init__ -paramiko.SubsystemHandler._run paramiko.SubsystemHandler-class.html#_run -paramiko.SubsystemHandler.finish_subsystem paramiko.SubsystemHandler-class.html#finish_subsystem -paramiko.SubsystemHandler.get_server paramiko.SubsystemHandler-class.html#get_server -paramiko.Transport paramiko.Transport-class.html -paramiko.Transport._auth_trigger paramiko.Transport-class.html#_auth_trigger -paramiko.Transport.set_subsystem_handler paramiko.Transport-class.html#set_subsystem_handler -paramiko.Transport._preferred_kex paramiko.Transport-class.html#_preferred_kex -paramiko.Transport.open_session paramiko.Transport-class.html#open_session -paramiko.Transport._parse_request_success paramiko.Transport-class.html#_parse_request_success -paramiko.Transport._parse_kex_init paramiko.Transport-class.html#_parse_kex_init -paramiko.Transport.set_keepalive paramiko.Transport-class.html#set_keepalive -paramiko.Transport.auth_none paramiko.Transport-class.html#auth_none -paramiko.Transport._parse_request_failure paramiko.Transport-class.html#_parse_request_failure -paramiko.Transport._key_info paramiko.Transport-class.html#_key_info -paramiko.Transport._parse_disconnect paramiko.Transport-class.html#_parse_disconnect -paramiko.Transport._channel_handler_table paramiko.Transport-class.html#_channel_handler_table -paramiko.Transport.is_active paramiko.Transport-class.html#is_active -paramiko.Transport.cancel_port_forward paramiko.Transport-class.html#cancel_port_forward -paramiko.Transport.get_security_options paramiko.Transport-class.html#get_security_options -paramiko.Transport.send_ignore paramiko.Transport-class.html#send_ignore -paramiko.Transport._preferred_macs paramiko.Transport-class.html#_preferred_macs -paramiko.Transport._parse_debug paramiko.Transport-class.html#_parse_debug -paramiko.Transport._parse_newkeys paramiko.Transport-class.html#_parse_newkeys -paramiko.Transport.start_client paramiko.Transport-class.html#start_client -paramiko.Transport._get_modulus_pack paramiko.Transport-class.html#_get_modulus_pack -paramiko.Transport._preferred_ciphers paramiko.Transport-class.html#_preferred_ciphers -paramiko.Transport._get_subsystem_handler paramiko.Transport-class.html#_get_subsystem_handler -paramiko.Transport._queue_incoming_channel paramiko.Transport-class.html#_queue_incoming_channel -paramiko.Transport._next_channel paramiko.Transport-class.html#_next_channel -paramiko.Transport._verify_key paramiko.Transport-class.html#_verify_key -paramiko.Transport.connect paramiko.Transport-class.html#connect -paramiko.Transport._negotiate_keys paramiko.Transport-class.html#_negotiate_keys -paramiko.Transport.close paramiko.Transport-class.html#close -paramiko.Transport.stop_thread paramiko.Transport-class.html#stop_thread -paramiko.Transport._mac_info paramiko.Transport-class.html#_mac_info -paramiko.Transport.get_username paramiko.Transport-class.html#get_username -paramiko.Transport.get_exception paramiko.Transport-class.html#get_exception -paramiko.Transport._send_message paramiko.Transport-class.html#_send_message -paramiko.Transport.run paramiko.Transport-class.html#run -paramiko.Transport.atfork paramiko.Transport-class.html#atfork -paramiko.Transport.getpeername paramiko.Transport-class.html#getpeername -paramiko.Transport._cipher_info paramiko.Transport-class.html#_cipher_info -paramiko.Transport._activate_inbound paramiko.Transport-class.html#_activate_inbound -paramiko.Transport.__repr__ paramiko.Transport-class.html#__repr__ -paramiko.Transport._parse_global_request paramiko.Transport-class.html#_parse_global_request -paramiko.Transport._expect_packet paramiko.Transport-class.html#_expect_packet -paramiko.Transport.set_hexdump paramiko.Transport-class.html#set_hexdump -paramiko.Transport.auth_password paramiko.Transport-class.html#auth_password -paramiko.Transport.get_log_channel paramiko.Transport-class.html#get_log_channel -paramiko.Transport._kex_info paramiko.Transport-class.html#_kex_info -paramiko.Transport._check_banner paramiko.Transport-class.html#_check_banner -paramiko.Transport.open_sftp_client paramiko.Transport-class.html#open_sftp_client -paramiko.Transport.is_authenticated paramiko.Transport-class.html#is_authenticated -paramiko.Transport.request_port_forward paramiko.Transport-class.html#request_port_forward -paramiko.Transport.auth_publickey paramiko.Transport-class.html#auth_publickey -paramiko.Transport._CLIENT_ID paramiko.Transport-class.html#_CLIENT_ID -paramiko.Transport.global_request paramiko.Transport-class.html#global_request -paramiko.Transport._get_cipher paramiko.Transport-class.html#_get_cipher -paramiko.Transport.renegotiate_keys paramiko.Transport-class.html#renegotiate_keys -paramiko.Transport.open_x11_channel paramiko.Transport-class.html#open_x11_channel -paramiko.Transport._PROTO_ID paramiko.Transport-class.html#_PROTO_ID -paramiko.Transport._set_K_H paramiko.Transport-class.html#_set_K_H -paramiko.Transport.use_compression paramiko.Transport-class.html#use_compression -paramiko.Transport._log paramiko.Transport-class.html#_log -paramiko.Transport.start_server paramiko.Transport-class.html#start_server -paramiko.Transport._send_user_message paramiko.Transport-class.html#_send_user_message -paramiko.Transport._modulus_pack paramiko.Transport-class.html#_modulus_pack -paramiko.Transport.get_hexdump paramiko.Transport-class.html#get_hexdump -paramiko.Transport.add_server_key paramiko.Transport-class.html#add_server_key -paramiko.Transport._activate_outbound paramiko.Transport-class.html#_activate_outbound -paramiko.Transport.accept paramiko.Transport-class.html#accept -paramiko.Transport._preferred_compression paramiko.Transport-class.html#_preferred_compression -paramiko.Transport._compute_key paramiko.Transport-class.html#_compute_key -paramiko.Transport.__init__ paramiko.Transport-class.html#__init__ -paramiko.Transport._unlink_channel paramiko.Transport-class.html#_unlink_channel -paramiko.Transport.auth_interactive paramiko.Transport-class.html#auth_interactive -paramiko.Transport.set_log_channel paramiko.Transport-class.html#set_log_channel -paramiko.Transport._set_x11_handler paramiko.Transport-class.html#_set_x11_handler -paramiko.Transport._compression_info paramiko.Transport-class.html#_compression_info -paramiko.Transport._handler_table paramiko.Transport-class.html#_handler_table -paramiko.Transport.load_server_moduli paramiko.Transport-class.html#load_server_moduli -paramiko.Transport._parse_channel_open_success paramiko.Transport-class.html#_parse_channel_open_success -paramiko.Transport.get_server_key paramiko.Transport-class.html#get_server_key -paramiko.Transport._parse_channel_open_failure paramiko.Transport-class.html#_parse_channel_open_failure -paramiko.Transport.get_remote_server_key paramiko.Transport-class.html#get_remote_server_key -paramiko.Transport._parse_channel_open paramiko.Transport-class.html#_parse_channel_open -paramiko.Transport.open_forwarded_tcpip_channel paramiko.Transport-class.html#open_forwarded_tcpip_channel -paramiko.Transport._preferred_keys paramiko.Transport-class.html#_preferred_keys -paramiko.Transport.open_channel paramiko.Transport-class.html#open_channel -paramiko.Transport._send_kex_init paramiko.Transport-class.html#_send_kex_init -paramiko.WarningPolicy paramiko.WarningPolicy-class.html -paramiko.WarningPolicy.missing_host_key paramiko.WarningPolicy-class.html#missing_host_key -paramiko.ber.BER paramiko.ber.BER-class.html -paramiko.ber.BER.decode_sequence paramiko.ber.BER-class.html#decode_sequence -paramiko.ber.BER.decode_next paramiko.ber.BER-class.html#decode_next -paramiko.ber.BER.__str__ paramiko.ber.BER-class.html#__str__ -paramiko.ber.BER.encode_tlv paramiko.ber.BER-class.html#encode_tlv -paramiko.ber.BER.encode_sequence paramiko.ber.BER-class.html#encode_sequence -paramiko.ber.BER.decode paramiko.ber.BER-class.html#decode -paramiko.ber.BER.__repr__ paramiko.ber.BER-class.html#__repr__ -paramiko.ber.BER.encode paramiko.ber.BER-class.html#encode -paramiko.ber.BER.__init__ paramiko.ber.BER-class.html#__init__ -paramiko.ber.BERException paramiko.ber.BERException-class.html -paramiko.buffered_pipe.BufferedPipe paramiko.buffered_pipe.BufferedPipe-class.html -paramiko.buffered_pipe.BufferedPipe.feed paramiko.buffered_pipe.BufferedPipe-class.html#feed -paramiko.buffered_pipe.BufferedPipe.set_event paramiko.buffered_pipe.BufferedPipe-class.html#set_event -paramiko.buffered_pipe.BufferedPipe.read paramiko.buffered_pipe.BufferedPipe-class.html#read -paramiko.buffered_pipe.BufferedPipe.read_ready paramiko.buffered_pipe.BufferedPipe-class.html#read_ready -paramiko.buffered_pipe.BufferedPipe.__len__ paramiko.buffered_pipe.BufferedPipe-class.html#__len__ -paramiko.buffered_pipe.BufferedPipe.empty paramiko.buffered_pipe.BufferedPipe-class.html#empty -paramiko.buffered_pipe.BufferedPipe.close paramiko.buffered_pipe.BufferedPipe-class.html#close -paramiko.buffered_pipe.BufferedPipe.__init__ paramiko.buffered_pipe.BufferedPipe-class.html#__init__ -paramiko.buffered_pipe.PipeTimeout paramiko.buffered_pipe.PipeTimeout-class.html -paramiko.channel.ChannelStderrFile paramiko.channel.ChannelStderrFile-class.html -paramiko.BufferedFile._record_newline paramiko.BufferedFile-class.html#_record_newline -paramiko.BufferedFile.xreadlines paramiko.BufferedFile-class.html#xreadlines -paramiko.BufferedFile.readlines paramiko.BufferedFile-class.html#readlines -paramiko.BufferedFile.SEEK_CUR paramiko.BufferedFile-class.html#SEEK_CUR -paramiko.BufferedFile.FLAG_READ paramiko.BufferedFile-class.html#FLAG_READ -paramiko.BufferedFile.flush paramiko.BufferedFile-class.html#flush -paramiko.BufferedFile.close paramiko.BufferedFile-class.html#close -paramiko.BufferedFile.seek paramiko.BufferedFile-class.html#seek -paramiko.BufferedFile.readline paramiko.BufferedFile-class.html#readline -paramiko.channel.ChannelStderrFile.__init__ paramiko.channel.ChannelStderrFile-class.html#__init__ -paramiko.BufferedFile.FLAG_UNIVERSAL_NEWLINE paramiko.BufferedFile-class.html#FLAG_UNIVERSAL_NEWLINE -paramiko.BufferedFile._set_mode paramiko.BufferedFile-class.html#_set_mode -paramiko.BufferedFile.next paramiko.BufferedFile-class.html#next -paramiko.BufferedFile.write paramiko.BufferedFile-class.html#write -paramiko.BufferedFile.__del__ paramiko.BufferedFile-class.html#__del__ -paramiko.BufferedFile.tell paramiko.BufferedFile-class.html#tell -paramiko.BufferedFile.FLAG_BINARY paramiko.BufferedFile-class.html#FLAG_BINARY -paramiko.BufferedFile.read paramiko.BufferedFile-class.html#read -paramiko.BufferedFile.SEEK_SET paramiko.BufferedFile-class.html#SEEK_SET -paramiko.BufferedFile.FLAG_APPEND paramiko.BufferedFile-class.html#FLAG_APPEND -paramiko.BufferedFile.__iter__ paramiko.BufferedFile-class.html#__iter__ -paramiko.channel.ChannelStderrFile._write paramiko.channel.ChannelStderrFile-class.html#_write -paramiko.BufferedFile._DEFAULT_BUFSIZE paramiko.BufferedFile-class.html#_DEFAULT_BUFSIZE -paramiko.BufferedFile.FLAG_BUFFERED paramiko.BufferedFile-class.html#FLAG_BUFFERED -paramiko.BufferedFile._write_all paramiko.BufferedFile-class.html#_write_all -paramiko.BufferedFile.writelines paramiko.BufferedFile-class.html#writelines -paramiko.BufferedFile.SEEK_END paramiko.BufferedFile-class.html#SEEK_END -paramiko.channel.ChannelStderrFile._read paramiko.channel.ChannelStderrFile-class.html#_read -paramiko.BufferedFile.FLAG_LINE_BUFFERED paramiko.BufferedFile-class.html#FLAG_LINE_BUFFERED -paramiko.BufferedFile._get_size paramiko.BufferedFile-class.html#_get_size -paramiko.BufferedFile.FLAG_WRITE paramiko.BufferedFile-class.html#FLAG_WRITE -paramiko.compress.ZlibCompressor paramiko.compress.ZlibCompressor-class.html -paramiko.compress.ZlibCompressor.__call__ paramiko.compress.ZlibCompressor-class.html#__call__ -paramiko.compress.ZlibCompressor.__init__ paramiko.compress.ZlibCompressor-class.html#__init__ -paramiko.compress.ZlibDecompressor paramiko.compress.ZlibDecompressor-class.html -paramiko.compress.ZlibDecompressor.__call__ paramiko.compress.ZlibDecompressor-class.html#__call__ -paramiko.compress.ZlibDecompressor.__init__ paramiko.compress.ZlibDecompressor-class.html#__init__ -paramiko.hostkeys.HostKeyEntry paramiko.hostkeys.HostKeyEntry-class.html -paramiko.hostkeys.HostKeyEntry.from_line paramiko.hostkeys.HostKeyEntry-class.html#from_line -paramiko.hostkeys.HostKeyEntry.__repr__ paramiko.hostkeys.HostKeyEntry-class.html#__repr__ -paramiko.hostkeys.HostKeyEntry.__init__ paramiko.hostkeys.HostKeyEntry-class.html#__init__ -paramiko.hostkeys.HostKeyEntry.to_line paramiko.hostkeys.HostKeyEntry-class.html#to_line -paramiko.kex_gex.KexGex paramiko.kex_gex.KexGex-class.html -paramiko.kex_gex.KexGex.max_bits paramiko.kex_gex.KexGex-class.html#max_bits -paramiko.kex_gex.KexGex._parse_kexdh_gex_request paramiko.kex_gex.KexGex-class.html#_parse_kexdh_gex_request -paramiko.kex_gex.KexGex.__init__ paramiko.kex_gex.KexGex-class.html#__init__ -paramiko.kex_gex.KexGex._generate_x paramiko.kex_gex.KexGex-class.html#_generate_x -paramiko.kex_gex.KexGex.parse_next paramiko.kex_gex.KexGex-class.html#parse_next -paramiko.kex_gex.KexGex.min_bits paramiko.kex_gex.KexGex-class.html#min_bits -paramiko.kex_gex.KexGex._parse_kexdh_gex_group paramiko.kex_gex.KexGex-class.html#_parse_kexdh_gex_group -paramiko.kex_gex.KexGex.preferred_bits paramiko.kex_gex.KexGex-class.html#preferred_bits -paramiko.kex_gex.KexGex._parse_kexdh_gex_request_old paramiko.kex_gex.KexGex-class.html#_parse_kexdh_gex_request_old -paramiko.kex_gex.KexGex.name paramiko.kex_gex.KexGex-class.html#name -paramiko.kex_gex.KexGex._parse_kexdh_gex_reply paramiko.kex_gex.KexGex-class.html#_parse_kexdh_gex_reply -paramiko.kex_gex.KexGex.start_kex paramiko.kex_gex.KexGex-class.html#start_kex -paramiko.kex_gex.KexGex._parse_kexdh_gex_init paramiko.kex_gex.KexGex-class.html#_parse_kexdh_gex_init -paramiko.kex_group1.KexGroup1 paramiko.kex_group1.KexGroup1-class.html -paramiko.kex_group1.KexGroup1.parse_next paramiko.kex_group1.KexGroup1-class.html#parse_next -paramiko.kex_group1.KexGroup1.name paramiko.kex_group1.KexGroup1-class.html#name -paramiko.kex_group1.KexGroup1._parse_kexdh_init paramiko.kex_group1.KexGroup1-class.html#_parse_kexdh_init -paramiko.kex_group1.KexGroup1._parse_kexdh_reply paramiko.kex_group1.KexGroup1-class.html#_parse_kexdh_reply -paramiko.kex_group1.KexGroup1.start_kex paramiko.kex_group1.KexGroup1-class.html#start_kex -paramiko.kex_group1.KexGroup1._generate_x paramiko.kex_group1.KexGroup1-class.html#_generate_x -paramiko.kex_group1.KexGroup1.__init__ paramiko.kex_group1.KexGroup1-class.html#__init__ -paramiko.logging22.Formatter paramiko.logging22.Formatter-class.html -paramiko.logging22.Formatter.__init__ paramiko.logging22.Formatter-class.html#__init__ -paramiko.logging22.StreamHandler paramiko.logging22.StreamHandler-class.html -paramiko.logging22.StreamHandler.setFormatter paramiko.logging22.StreamHandler-class.html#setFormatter -paramiko.logging22.StreamHandler.__init__ paramiko.logging22.StreamHandler-class.html#__init__ -paramiko.logging22.logger paramiko.logging22.logger-class.html -paramiko.logging22.logger.log paramiko.logging22.logger-class.html#log -paramiko.logging22.logger.addFilter paramiko.logging22.logger-class.html#addFilter -paramiko.logging22.logger.setLevel paramiko.logging22.logger-class.html#setLevel -paramiko.logging22.logger.addHandler paramiko.logging22.logger-class.html#addHandler -paramiko.logging22.logger.__init__ paramiko.logging22.logger-class.html#__init__ -paramiko.packet.NeedRekeyException paramiko.packet.NeedRekeyException-class.html -paramiko.pipe.OrPipe paramiko.pipe.OrPipe-class.html -paramiko.pipe.OrPipe.set paramiko.pipe.OrPipe-class.html#set -paramiko.pipe.OrPipe.clear paramiko.pipe.OrPipe-class.html#clear -paramiko.pipe.OrPipe.__init__ paramiko.pipe.OrPipe-class.html#__init__ -paramiko.pipe.PosixPipe paramiko.pipe.PosixPipe-class.html -paramiko.pipe.PosixPipe.fileno paramiko.pipe.PosixPipe-class.html#fileno -paramiko.pipe.PosixPipe.set paramiko.pipe.PosixPipe-class.html#set -paramiko.pipe.PosixPipe.clear paramiko.pipe.PosixPipe-class.html#clear -paramiko.pipe.PosixPipe.set_forever paramiko.pipe.PosixPipe-class.html#set_forever -paramiko.pipe.PosixPipe.close paramiko.pipe.PosixPipe-class.html#close -paramiko.pipe.PosixPipe.__init__ paramiko.pipe.PosixPipe-class.html#__init__ -paramiko.pipe.WindowsPipe paramiko.pipe.WindowsPipe-class.html -paramiko.pipe.WindowsPipe.fileno paramiko.pipe.WindowsPipe-class.html#fileno -paramiko.pipe.WindowsPipe.set paramiko.pipe.WindowsPipe-class.html#set -paramiko.pipe.WindowsPipe.clear paramiko.pipe.WindowsPipe-class.html#clear -paramiko.pipe.WindowsPipe.set_forever paramiko.pipe.WindowsPipe-class.html#set_forever -paramiko.pipe.WindowsPipe.close paramiko.pipe.WindowsPipe-class.html#close -paramiko.pipe.WindowsPipe.__init__ paramiko.pipe.WindowsPipe-class.html#__init__ -paramiko.primes.ModulusPack paramiko.primes.ModulusPack-class.html -paramiko.primes.ModulusPack._parse_modulus paramiko.primes.ModulusPack-class.html#_parse_modulus -paramiko.primes.ModulusPack.read_file paramiko.primes.ModulusPack-class.html#read_file -paramiko.primes.ModulusPack.get_modulus paramiko.primes.ModulusPack-class.html#get_modulus -paramiko.primes.ModulusPack.__init__ paramiko.primes.ModulusPack-class.html#__init__ -paramiko.ssh_exception.PartialAuthentication paramiko.ssh_exception.PartialAuthentication-class.html -paramiko.ssh_exception.PartialAuthentication.allowed_types paramiko.ssh_exception.PartialAuthentication-class.html#allowed_types -paramiko.ssh_exception.PartialAuthentication.__init__ paramiko.ssh_exception.PartialAuthentication-class.html#__init__ -paramiko.transport.ChannelMap paramiko.transport.ChannelMap-class.html -paramiko.transport.ChannelMap.get paramiko.transport.ChannelMap-class.html#get -paramiko.transport.ChannelMap.values paramiko.transport.ChannelMap-class.html#values -paramiko.transport.ChannelMap.__init__ paramiko.transport.ChannelMap-class.html#__init__ -paramiko.transport.ChannelMap.put paramiko.transport.ChannelMap-class.html#put -paramiko.transport.ChannelMap.__len__ paramiko.transport.ChannelMap-class.html#__len__ -paramiko.transport.ChannelMap.delete paramiko.transport.ChannelMap-class.html#delete -paramiko.util.Counter paramiko.util.Counter-class.html -paramiko.util.Counter.__call__ paramiko.util.Counter-class.html#__call__ -paramiko.util.Counter.new paramiko.util.Counter-class.html#new -paramiko.util.Counter.__init__ paramiko.util.Counter-class.html#__init__ -paramiko.util.PFilter paramiko.util.PFilter-class.html -paramiko.util.PFilter.filter paramiko.util.PFilter-class.html#filter -paramiko.util.enumerate paramiko.util.enumerate-class.html -paramiko.util.enumerate.__iter__ paramiko.util.enumerate-class.html#__iter__ -paramiko.util.enumerate.__init__ paramiko.util.enumerate-class.html#__init__ -paramiko.win_pageant.PageantConnection paramiko.win_pageant.PageantConnection-class.html -paramiko.win_pageant.PageantConnection.send paramiko.win_pageant.PageantConnection-class.html#send -paramiko.win_pageant.PageantConnection.close paramiko.win_pageant.PageantConnection-class.html#close -paramiko.win_pageant.PageantConnection.recv paramiko.win_pageant.PageantConnection-class.html#recv -paramiko.win_pageant.PageantConnection.__init__ paramiko.win_pageant.PageantConnection-class.html#__init__ diff --git a/docs/bug-index.html b/docs/bug-index.html deleted file mode 100644 index be27b5f..0000000 --- a/docs/bug-index.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - Bug List - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  - - - -
[frames] | no frames]
-
-
[ - Identifiers -| Bugs -| Introductions -]

-

Bug List

-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/class-tree.html b/docs/class-tree.html deleted file mode 100644 index b840938..0000000 --- a/docs/class-tree.html +++ /dev/null @@ -1,364 +0,0 @@ - - - - - Class Hierarchy - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  - - - -
[frames] | no frames]
-
-
- [ Module Hierarchy - | Class Hierarchy ] -

-

Class Hierarchy

- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/crarr.png b/docs/crarr.png deleted file mode 100644 index 26b43c5..0000000 Binary files a/docs/crarr.png and /dev/null differ diff --git a/docs/epydoc.css b/docs/epydoc.css deleted file mode 100644 index 86d4170..0000000 --- a/docs/epydoc.css +++ /dev/null @@ -1,322 +0,0 @@ - - -/* Epydoc CSS Stylesheet - * - * This stylesheet can be used to customize the appearance of epydoc's - * HTML output. - * - */ - -/* Default Colors & Styles - * - Set the default foreground & background color with 'body'; and - * link colors with 'a:link' and 'a:visited'. - * - Use bold for decision list terms. - * - The heading styles defined here are used for headings *within* - * docstring descriptions. All headings used by epydoc itself use - * either class='epydoc' or class='toc' (CSS styles for both - * defined below). - */ -body { background: #ffffff; color: #000000; } -p { margin-top: 0.5em; margin-bottom: 0.5em; } -a:link { color: #0000ff; } -a:visited { color: #204080; } -dt { font-weight: bold; } -h1 { font-size: +140%; font-style: italic; - font-weight: bold; } -h2 { font-size: +125%; font-style: italic; - font-weight: bold; } -h3 { font-size: +110%; font-style: italic; - font-weight: normal; } -code { font-size: 100%; } -/* N.B.: class, not pseudoclass */ -a.link { font-family: monospace; } - -/* Page Header & Footer - * - The standard page header consists of a navigation bar (with - * pointers to standard pages such as 'home' and 'trees'); a - * breadcrumbs list, which can be used to navigate to containing - * classes or modules; options links, to show/hide private - * variables and to show/hide frames; and a page title (using - *

). The page title may be followed by a link to the - * corresponding source code (using 'span.codelink'). - * - The footer consists of a navigation bar, a timestamp, and a - * pointer to epydoc's homepage. - */ -h1.epydoc { margin: 0; font-size: +140%; font-weight: bold; } -h2.epydoc { font-size: +130%; font-weight: bold; } -h3.epydoc { font-size: +115%; font-weight: bold; - margin-top: 0.2em; } -td h3.epydoc { font-size: +115%; font-weight: bold; - margin-bottom: 0; } -table.navbar { background: #a0c0ff; color: #000000; - border: 2px groove #c0d0d0; } -table.navbar table { color: #000000; } -th.navbar-select { background: #70b0ff; - color: #000000; } -table.navbar a { text-decoration: none; } -table.navbar a:link { color: #0000ff; } -table.navbar a:visited { color: #204080; } -span.breadcrumbs { font-size: 85%; font-weight: bold; } -span.options { font-size: 70%; } -span.codelink { font-size: 85%; } -td.footer { font-size: 85%; } - -/* Table Headers - * - Each summary table and details section begins with a 'header' - * row. This row contains a section title (marked by - * 'span.table-header') as well as a show/hide private link - * (marked by 'span.options', defined above). - * - Summary tables that contain user-defined groups mark those - * groups using 'group header' rows. - */ -td.table-header { background: #70b0ff; color: #000000; - border: 1px solid #608090; } -td.table-header table { color: #000000; } -td.table-header table a:link { color: #0000ff; } -td.table-header table a:visited { color: #204080; } -span.table-header { font-size: 120%; font-weight: bold; } -th.group-header { background: #c0e0f8; color: #000000; - text-align: left; font-style: italic; - font-size: 115%; - border: 1px solid #608090; } - -/* Summary Tables (functions, variables, etc) - * - Each object is described by a single row of the table with - * two cells. The left cell gives the object's type, and is - * marked with 'code.summary-type'. The right cell gives the - * object's name and a summary description. - * - CSS styles for the table's header and group headers are - * defined above, under 'Table Headers' - */ -table.summary { border-collapse: collapse; - background: #e8f0f8; color: #000000; - border: 1px solid #608090; - margin-bottom: 0.5em; } -td.summary { border: 1px solid #608090; } -code.summary-type { font-size: 85%; } -table.summary a:link { color: #0000ff; } -table.summary a:visited { color: #204080; } - - -/* Details Tables (functions, variables, etc) - * - Each object is described in its own div. - * - A single-row summary table w/ table-header is used as - * a header for each details section (CSS style for table-header - * is defined above, under 'Table Headers'). - */ -table.details { border-collapse: collapse; - background: #e8f0f8; color: #000000; - border: 1px solid #608090; - margin: .2em 0 0 0; } -table.details table { color: #000000; } -table.details a:link { color: #0000ff; } -table.details a:visited { color: #204080; } - -/* Fields */ -dl.fields { margin-left: 2em; margin-top: 1em; - margin-bottom: 1em; } -dl.fields dd ul { margin-left: 0em; padding-left: 0em; } -dl.fields dd ul li ul { margin-left: 2em; padding-left: 0em; } -div.fields { margin-left: 2em; } -div.fields p { margin-bottom: 0.5em; } - -/* Index tables (identifier index, term index, etc) - * - link-index is used for indices containing lists of links - * (namely, the identifier index & term index). - * - index-where is used in link indices for the text indicating - * the container/source for each link. - * - metadata-index is used for indices containing metadata - * extracted from fields (namely, the bug index & todo index). - */ -table.link-index { border-collapse: collapse; - background: #e8f0f8; color: #000000; - border: 1px solid #608090; } -td.link-index { border-width: 0px; } -table.link-index a:link { color: #0000ff; } -table.link-index a:visited { color: #204080; } -span.index-where { font-size: 70%; } -table.metadata-index { border-collapse: collapse; - background: #e8f0f8; color: #000000; - border: 1px solid #608090; - margin: .2em 0 0 0; } -td.metadata-index { border-width: 1px; border-style: solid; } -table.metadata-index a:link { color: #0000ff; } -table.metadata-index a:visited { color: #204080; } - -/* Function signatures - * - sig* is used for the signature in the details section. - * - .summary-sig* is used for the signature in the summary - * table, and when listing property accessor functions. - * */ -.sig-name { color: #006080; } -.sig-arg { color: #008060; } -.sig-default { color: #602000; } -.summary-sig { font-family: monospace; } -.summary-sig-name { color: #006080; font-weight: bold; } -table.summary a.summary-sig-name:link - { color: #006080; font-weight: bold; } -table.summary a.summary-sig-name:visited - { color: #006080; font-weight: bold; } -.summary-sig-arg { color: #006040; } -.summary-sig-default { color: #501800; } - -/* Subclass list - */ -ul.subclass-list { display: inline; } -ul.subclass-list li { display: inline; } - -/* To render variables, classes etc. like functions */ -table.summary .summary-name { color: #006080; font-weight: bold; - font-family: monospace; } -table.summary - a.summary-name:link { color: #006080; font-weight: bold; - font-family: monospace; } -table.summary - a.summary-name:visited { color: #006080; font-weight: bold; - font-family: monospace; } - -/* Variable values - * - In the 'variable details' sections, each varaible's value is - * listed in a 'pre.variable' box. The width of this box is - * restricted to 80 chars; if the value's repr is longer than - * this it will be wrapped, using a backslash marked with - * class 'variable-linewrap'. If the value's repr is longer - * than 3 lines, the rest will be ellided; and an ellipsis - * marker ('...' marked with 'variable-ellipsis') will be used. - * - If the value is a string, its quote marks will be marked - * with 'variable-quote'. - * - If the variable is a regexp, it is syntax-highlighted using - * the re* CSS classes. - */ -pre.variable { padding: .5em; margin: 0; - background: #dce4ec; color: #000000; - border: 1px solid #708890; } -.variable-linewrap { color: #604000; font-weight: bold; } -.variable-ellipsis { color: #604000; font-weight: bold; } -.variable-quote { color: #604000; font-weight: bold; } -.variable-group { color: #008000; font-weight: bold; } -.variable-op { color: #604000; font-weight: bold; } -.variable-string { color: #006030; } -.variable-unknown { color: #a00000; font-weight: bold; } -.re { color: #000000; } -.re-char { color: #006030; } -.re-op { color: #600000; } -.re-group { color: #003060; } -.re-ref { color: #404040; } - -/* Base tree - * - Used by class pages to display the base class hierarchy. - */ -pre.base-tree { font-size: 80%; margin: 0; } - -/* Frames-based table of contents headers - * - Consists of two frames: one for selecting modules; and - * the other listing the contents of the selected module. - * - h1.toc is used for each frame's heading - * - h2.toc is used for subheadings within each frame. - */ -h1.toc { text-align: center; font-size: 105%; - margin: 0; font-weight: bold; - padding: 0; } -h2.toc { font-size: 100%; font-weight: bold; - margin: 0.5em 0 0 -0.3em; } - -/* Syntax Highlighting for Source Code - * - doctest examples are displayed in a 'pre.py-doctest' block. - * If the example is in a details table entry, then it will use - * the colors specified by the 'table pre.py-doctest' line. - * - Source code listings are displayed in a 'pre.py-src' block. - * Each line is marked with 'span.py-line' (used to draw a line - * down the left margin, separating the code from the line - * numbers). Line numbers are displayed with 'span.py-lineno'. - * The expand/collapse block toggle button is displayed with - * 'a.py-toggle' (Note: the CSS style for 'a.py-toggle' should not - * modify the font size of the text.) - * - If a source code page is opened with an anchor, then the - * corresponding code block will be highlighted. The code - * block's header is highlighted with 'py-highlight-hdr'; and - * the code block's body is highlighted with 'py-highlight'. - * - The remaining py-* classes are used to perform syntax - * highlighting (py-string for string literals, py-name for names, - * etc.) - */ -pre.py-doctest { padding: .5em; margin: 1em; - background: #e8f0f8; color: #000000; - border: 1px solid #708890; } -table pre.py-doctest { background: #dce4ec; - color: #000000; } -pre.py-src { border: 2px solid #000000; - background: #f0f0f0; color: #000000; } -.py-line { border-left: 2px solid #000000; - margin-left: .2em; padding-left: .4em; } -.py-lineno { font-style: italic; font-size: 90%; - padding-left: .5em; } -a.py-toggle { text-decoration: none; } -div.py-highlight-hdr { border-top: 2px solid #000000; - border-bottom: 2px solid #000000; - background: #d8e8e8; } -div.py-highlight { border-bottom: 2px solid #000000; - background: #d0e0e0; } -.py-prompt { color: #005050; font-weight: bold;} -.py-more { color: #005050; font-weight: bold;} -.py-string { color: #006030; } -.py-comment { color: #003060; } -.py-keyword { color: #600000; } -.py-output { color: #404040; } -.py-name { color: #000050; } -.py-name:link { color: #000050 !important; } -.py-name:visited { color: #000050 !important; } -.py-number { color: #005000; } -.py-defname { color: #000060; font-weight: bold; } -.py-def-name { color: #000060; font-weight: bold; } -.py-base-class { color: #000060; } -.py-param { color: #000060; } -.py-docstring { color: #006030; } -.py-decorator { color: #804020; } -/* Use this if you don't want links to names underlined: */ -/*a.py-name { text-decoration: none; }*/ - -/* Graphs & Diagrams - * - These CSS styles are used for graphs & diagrams generated using - * Graphviz dot. 'img.graph-without-title' is used for bare - * diagrams (to remove the border created by making the image - * clickable). - */ -img.graph-without-title { border: none; } -img.graph-with-title { border: 1px solid #000000; } -span.graph-title { font-weight: bold; } -span.graph-caption { } - -/* General-purpose classes - * - 'p.indent-wrapped-lines' defines a paragraph whose first line - * is not indented, but whose subsequent lines are. - * - The 'nomargin-top' class is used to remove the top margin (e.g. - * from lists). The 'nomargin' class is used to remove both the - * top and bottom margin (but not the left or right margin -- - * for lists, that would cause the bullets to disappear.) - */ -p.indent-wrapped-lines { padding: 0 0 0 7em; text-indent: -7em; - margin: 0; } -.nomargin-top { margin-top: 0; } -.nomargin { margin-top: 0; margin-bottom: 0; } - -/* HTML Log */ -div.log-block { padding: 0; margin: .5em 0 .5em 0; - background: #e8f0f8; color: #000000; - border: 1px solid #000000; } -div.log-error { padding: .1em .3em .1em .3em; margin: 4px; - background: #ffb0b0; color: #000000; - border: 1px solid #000000; } -div.log-warning { padding: .1em .3em .1em .3em; margin: 4px; - background: #ffffb0; color: #000000; - border: 1px solid #000000; } -div.log-info { padding: .1em .3em .1em .3em; margin: 4px; - background: #b0ffb0; color: #000000; - border: 1px solid #000000; } -h2.log-hdr { background: #70b0ff; color: #000000; - margin: 0; padding: 0em 0.5em 0em 0.5em; - border-bottom: 1px solid #000000; font-size: 110%; } -p.log { font-weight: bold; margin: .5em 0 .5em 0; } -tr.opt-changed { color: #000000; font-weight: bold; } -tr.opt-default { color: #606060; } -pre.log { margin: 0; padding: 0; padding-left: 1em; } diff --git a/docs/epydoc.js b/docs/epydoc.js deleted file mode 100644 index e787dbc..0000000 --- a/docs/epydoc.js +++ /dev/null @@ -1,293 +0,0 @@ -function toggle_private() { - // Search for any private/public links on this page. Store - // their old text in "cmd," so we will know what action to - // take; and change their text to the opposite action. - var cmd = "?"; - var elts = document.getElementsByTagName("a"); - for(var i=0; i...
"; - elt.innerHTML = s; - } -} - -function toggle(id) { - elt = document.getElementById(id+"-toggle"); - if (elt.innerHTML == "-") - collapse(id); - else - expand(id); - return false; -} - -function highlight(id) { - var elt = document.getElementById(id+"-def"); - if (elt) elt.className = "py-highlight-hdr"; - var elt = document.getElementById(id+"-expanded"); - if (elt) elt.className = "py-highlight"; - var elt = document.getElementById(id+"-collapsed"); - if (elt) elt.className = "py-highlight"; -} - -function num_lines(s) { - var n = 1; - var pos = s.indexOf("\n"); - while ( pos > 0) { - n += 1; - pos = s.indexOf("\n", pos+1); - } - return n; -} - -// Collapse all blocks that mave more than `min_lines` lines. -function collapse_all(min_lines) { - var elts = document.getElementsByTagName("div"); - for (var i=0; i 0) - if (elt.id.substring(split, elt.id.length) == "-expanded") - if (num_lines(elt.innerHTML) > min_lines) - collapse(elt.id.substring(0, split)); - } -} - -function expandto(href) { - var start = href.indexOf("#")+1; - if (start != 0 && start != href.length) { - if (href.substring(start, href.length) != "-") { - collapse_all(4); - pos = href.indexOf(".", start); - while (pos != -1) { - var id = href.substring(start, pos); - expand(id); - pos = href.indexOf(".", pos+1); - } - var id = href.substring(start, href.length); - expand(id); - highlight(id); - } - } -} - -function kill_doclink(id) { - var parent = document.getElementById(id); - parent.removeChild(parent.childNodes.item(0)); -} -function auto_kill_doclink(ev) { - if (!ev) var ev = window.event; - if (!this.contains(ev.toElement)) { - var parent = document.getElementById(this.parentID); - parent.removeChild(parent.childNodes.item(0)); - } -} - -function doclink(id, name, targets_id) { - var elt = document.getElementById(id); - - // If we already opened the box, then destroy it. - // (This case should never occur, but leave it in just in case.) - if (elt.childNodes.length > 1) { - elt.removeChild(elt.childNodes.item(0)); - } - else { - // The outer box: relative + inline positioning. - var box1 = document.createElement("div"); - box1.style.position = "relative"; - box1.style.display = "inline"; - box1.style.top = 0; - box1.style.left = 0; - - // A shadow for fun - var shadow = document.createElement("div"); - shadow.style.position = "absolute"; - shadow.style.left = "-1.3em"; - shadow.style.top = "-1.3em"; - shadow.style.background = "#404040"; - - // The inner box: absolute positioning. - var box2 = document.createElement("div"); - box2.style.position = "relative"; - box2.style.border = "1px solid #a0a0a0"; - box2.style.left = "-.2em"; - box2.style.top = "-.2em"; - box2.style.background = "white"; - box2.style.padding = ".3em .4em .3em .4em"; - box2.style.fontStyle = "normal"; - box2.onmouseout=auto_kill_doclink; - box2.parentID = id; - - // Get the targets - var targets_elt = document.getElementById(targets_id); - var targets = targets_elt.getAttribute("targets"); - var links = ""; - target_list = targets.split(","); - for (var i=0; i" + - target[0] + ""; - } - - // Put it all together. - elt.insertBefore(box1, elt.childNodes.item(0)); - //box1.appendChild(box2); - box1.appendChild(shadow); - shadow.appendChild(box2); - box2.innerHTML = - "Which "+name+" do you want to see documentation for?" + - ""; - } - return false; -} - -function get_anchor() { - var href = location.href; - var start = href.indexOf("#")+1; - if ((start != 0) && (start != href.length)) - return href.substring(start, href.length); - } -function redirect_url(dottedName) { - // Scan through each element of the "pages" list, and check - // if "name" matches with any of them. - for (var i=0; i-m" or "-c"; - // extract the portion & compare it to dottedName. - var pagename = pages[i].substring(0, pages[i].length-2); - if (pagename == dottedName.substring(0,pagename.length)) { - - // We've found a page that matches `dottedName`; - // construct its URL, using leftover `dottedName` - // content to form an anchor. - var pagetype = pages[i].charAt(pages[i].length-1); - var url = pagename + ((pagetype=="m")?"-module.html": - "-class.html"); - if (dottedName.length > pagename.length) - url += "#" + dottedName.substring(pagename.length+1, - dottedName.length); - return url; - } - } - } diff --git a/docs/frames.html b/docs/frames.html deleted file mode 100644 index d1e8877..0000000 --- a/docs/frames.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - API Documentation - - - - - - - - - diff --git a/docs/help.html b/docs/help.html deleted file mode 100644 index 2ff891a..0000000 --- a/docs/help.html +++ /dev/null @@ -1,266 +0,0 @@ - - - - - Help - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  - - - -
[frames] | no frames]
-
- -

API Documentation

- -

This document contains the API (Application Programming Interface) -documentation for this project. Documentation for the Python -objects defined by the project is divided into separate pages for each -package, module, and class. The API documentation also includes two -pages containing information about the project as a whole: a trees -page, and an index page.

- -

Object Documentation

- -

Each Package Documentation page contains:

-
    -
  • A description of the package.
  • -
  • A list of the modules and sub-packages contained by the - package.
  • -
  • A summary of the classes defined by the package.
  • -
  • A summary of the functions defined by the package.
  • -
  • A summary of the variables defined by the package.
  • -
  • A detailed description of each function defined by the - package.
  • -
  • A detailed description of each variable defined by the - package.
  • -
- -

Each Module Documentation page contains:

-
    -
  • A description of the module.
  • -
  • A summary of the classes defined by the module.
  • -
  • A summary of the functions defined by the module.
  • -
  • A summary of the variables defined by the module.
  • -
  • A detailed description of each function defined by the - module.
  • -
  • A detailed description of each variable defined by the - module.
  • -
- -

Each Class Documentation page contains:

-
    -
  • A class inheritance diagram.
  • -
  • A list of known subclasses.
  • -
  • A description of the class.
  • -
  • A summary of the methods defined by the class.
  • -
  • A summary of the instance variables defined by the class.
  • -
  • A summary of the class (static) variables defined by the - class.
  • -
  • A detailed description of each method defined by the - class.
  • -
  • A detailed description of each instance variable defined by the - class.
  • -
  • A detailed description of each class (static) variable defined - by the class.
  • -
- -

Project Documentation

- -

The Trees page contains the module and class hierarchies:

-
    -
  • The module hierarchy lists every package and module, with - modules grouped into packages. At the top level, and within each - package, modules and sub-packages are listed alphabetically.
  • -
  • The class hierarchy lists every class, grouped by base - class. If a class has more than one base class, then it will be - listed under each base class. At the top level, and under each base - class, classes are listed alphabetically.
  • -
- -

The Index page contains indices of terms and - identifiers:

-
    -
  • The term index lists every term indexed by any object's - documentation. For each term, the index provides links to each - place where the term is indexed.
  • -
  • The identifier index lists the (short) name of every package, - module, class, method, function, variable, and parameter. For each - identifier, the index provides a short description, and a link to - its documentation.
  • -
- -

The Table of Contents

- -

The table of contents occupies the two frames on the left side of -the window. The upper-left frame displays the project -contents, and the lower-left frame displays the module -contents:

- - - - - - - - - -
- Project
Contents
...
- API
Documentation
Frame


-
- Module
Contents
 
...
  -

- -

The project contents frame contains a list of all packages -and modules that are defined by the project. Clicking on an entry -will display its contents in the module contents frame. Clicking on a -special entry, labeled "Everything," will display the contents of -the entire project.

- -

The module contents frame contains a list of every -submodule, class, type, exception, function, and variable defined by a -module or package. Clicking on an entry will display its -documentation in the API documentation frame. Clicking on the name of -the module, at the top of the frame, will display the documentation -for the module itself.

- -

The "frames" and "no frames" buttons below the top -navigation bar can be used to control whether the table of contents is -displayed or not.

- -

The Navigation Bar

- -

A navigation bar is located at the top and bottom of every page. -It indicates what type of page you are currently viewing, and allows -you to go to related pages. The following table describes the labels -on the navigation bar. Note that not some labels (such as -[Parent]) are not displayed on all pages.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LabelHighlighted when...Links to...
[Parent](never highlighted) the parent of the current package
[Package]viewing a packagethe package containing the current object -
[Module]viewing a modulethe module containing the current object -
[Class]viewing a class the class containing the current object
[Trees]viewing the trees page the trees page
[Index]viewing the index page the index page
[Help]viewing the help page the help page
- -

The "show private" and "hide private" buttons below -the top navigation bar can be used to control whether documentation -for private objects is displayed. Private objects are usually defined -as objects whose (short) names begin with a single underscore, but do -not end with an underscore. For example, "_x", -"__pprint", and "epydoc.epytext._tokenize" -are private objects; but "re.sub", -"__init__", and "type_" are not. However, -if a module defines the "__all__" variable, then its -contents are used to decide which objects are private.

- -

A timestamp below the bottom navigation bar indicates when each -page was last updated.

- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/identifier-index.html b/docs/identifier-index.html deleted file mode 100644 index ee9873e..0000000 --- a/docs/identifier-index.html +++ /dev/null @@ -1,5475 +0,0 @@ - - - - - Identifier Index - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  - - - -
[frames] | no frames]
-
-
[ - Identifiers -| Bugs -| Introductions -]

- -
-

Identifier Index

-
-[ - A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z - _ -] -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

B

- - - - - - - - - - - - - - - - - -

C

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

D

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

E

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

F

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

G

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

H

- - - - - - - - - - - - -

I

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

K

- - - - - - - - - - - - - - - - - -

L

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

M

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

N

- - - - - - - - - - - - -

O

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

P

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

R

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

S

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

T

- - - - - - - - - - - - - - - - - -

U

- - - - - - - - - - - - -

V

- - - - - - - - - - - - -

W

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

X

- - - - - - - - -

Z

- - - - - - - - -

_

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index d1e8877..0000000 --- a/docs/index.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - API Documentation - - - - - - - - - diff --git a/docs/module-tree.html b/docs/module-tree.html deleted file mode 100644 index 3e08e6a..0000000 --- a/docs/module-tree.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - Module Hierarchy - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  - - - -
[frames] | no frames]
-
-
- [ Module Hierarchy - | Class Hierarchy ] -

-

Module Hierarchy

- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko-module.html b/docs/paramiko-module.html deleted file mode 100644 index 33e51b0..0000000 --- a/docs/paramiko-module.html +++ /dev/null @@ -1,513 +0,0 @@ - - - - - paramiko - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko - - - - - -
[frames] | no frames]
-
- -

Package paramiko

source code

-

Paramiko (a combination of the esperanto words for - "paranoid" and "friend") is a module for python 2.3 - or greater that implements the SSH2 protocol for secure (encrypted and - authenticated) connections to remote machines. Unlike SSL (aka TLS), the - SSH2 protocol does not require hierarchical certificates signed by a - powerful central authority. You may know SSH2 as the protocol that - replaced telnet and rsh for secure access to - remote shells, but the protocol also includes the ability to open - arbitrary channels to remote services across an encrypted tunnel. (This - is how sftp works, for example.)

-

The high-level client API starts with creation of an SSHClient object. - For more direct control, pass a socket (or socket-like object) to a Transport, and use - start_server or start_client to negoatite with the remote host as either - a server or client. As a client, you are responsible for authenticating - using a password or private key, and checking the server's host key. - (Key signature and verification is done by paramiko, but you will need - to provide private keys and check that the content of a public key - matches what you expected to see.) As a server, you are responsible - for deciding which users, passwords, and keys to allow, and what kind of - channels to allow.

-

Once you have finished, either side may request flow-controlled Channels to the other - side, which are python objects that act like sockets, but send and - receive data over the encrypted session.

-

Paramiko is written entirely in python (no C or platform-dependent - code) and is released under the GNU Lesser General Public License - (LGPL).

-

Website: http://www.lag.net/paramiko/

- -
-

Version: - 1.7.7.1 (George) -

-

Author: - Robey Pointer -

-

Contact: - robeypointer@gmail.com -

-

License: - GNU Lesser General Public License (LGPL) -

-

Date: - 21 May 2011 -

-
- - - - - - -
- Submodules
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Classes
-   - - SecurityOptions
- Simple object containing the security preferences of an ssh - transport. -
-   - - Transport
- An SSH Transport attaches to a stream (usually a socket), - negotiates an encrypted session, authenticates, and then creates - stream tunnels, called Channels, across the session. -
-   - - SSHClient
- A high-level representation of a session with an SSH server. -
-   - - MissingHostKeyPolicy
- Interface for defining the policy that SSHClient - should use when the SSH server's hostname is not in either the - system host keys or the application's keys. -
-   - - AutoAddPolicy
- Policy for automatically adding the hostname and new host key to - the local HostKeys object, and saving it. -
-   - - RejectPolicy
- Policy for automatically rejecting the unknown hostname & key. -
-   - - WarningPolicy
- Policy for logging a python-style warning for an unknown host key, - but accepting it. -
-   - - Channel
- A secure tunnel across an SSH Transport. -
-   - - SSHException
- Exception raised by failures in SSH2 protocol negotiation or logic - errors. -
-   - - PasswordRequiredException
- Exception raised when a password is needed to unlock a private key - file. -
-   - - BadAuthenticationType
- Exception raised when an authentication type (like password) is - used, but the server isn't allowing that type. -
-   - - ChannelException
- Exception raised when an attempt to open a new Channel fails. -
-   - - BadHostKeyException
- The host key given by the SSH server did not match what we were - expecting. -
-   - - AuthenticationException
- Exception raised when authentication failed for some reason. -
-   - - ServerInterface
- This class defines an interface for controlling the behavior of - paramiko in server mode. -
-   - - SubsystemHandler
- Handler for a subsytem in server mode. -
-   - - RSAKey
- Representation of an RSA key which can be used to sign and verify - SSH2 data. -
-   - - DSSKey
- Representation of a DSS key which can be used to sign an verify - SSH2 data. -
-   - - SFTPError -
-   - - SFTP
- an alias for SFTPClient for backwards compatability -
-   - - SFTPClient
- SFTP client object. -
-   - - SFTPServer
- Server-side SFTP subsystem support. -
-   - - SFTPAttributes
- Representation of the attributes of a file (or proxied file) for - SFTP in client or server mode. -
-   - - SFTPHandle
- Abstract object representing a handle to an open file (or folder) - in an SFTP server implementation. -
-   - - SFTPServerInterface
- This class defines an interface for controlling the behavior of - paramiko when using the SFTPServer subsystem to provide an SFTP server. -
-   - - SFTPFile
- Proxy object for a file on the remote server, in client mode SFTP. -
-   - - Message
- An SSH2 Message is a stream of bytes that encodes some - combination of strings, integers, bools, and infinite-precision - integers (known in python as longs). -
-   - - BufferedFile
- Reusable base class to implement python-style file buffering around - a simpler stream. -
-   - - Agent
- Client interface for using private keys from an SSH agent running - on the local machine. -
-   - - AgentKey
- Private key held in a local SSH agent. -
-   - - PKey
- Base class for public keys. -
-   - - HostKeys
- Representation of an openssh-style "known hosts" file. -
-   - - SSHConfig
- Representation of config information as stored in the format used - by OpenSSH. -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko-pysrc.html b/docs/paramiko-pysrc.html deleted file mode 100644 index 607fd59..0000000 --- a/docs/paramiko-pysrc.html +++ /dev/null @@ -1,465 +0,0 @@ - - - - - paramiko - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko - - - - - -
[frames] | no frames]
-
-

Source Code for Package paramiko

-
-  1  # Copyright (C) 2003-2011  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  I{Paramiko} (a combination of the esperanto words for "paranoid" and "friend") 
- 21  is a module for python 2.3 or greater that implements the SSH2 protocol for 
- 22  secure (encrypted and authenticated) connections to remote machines.  Unlike 
- 23  SSL (aka TLS), the SSH2 protocol does not require hierarchical certificates 
- 24  signed by a powerful central authority.  You may know SSH2 as the protocol that 
- 25  replaced C{telnet} and C{rsh} for secure access to remote shells, but the 
- 26  protocol also includes the ability to open arbitrary channels to remote 
- 27  services across an encrypted tunnel.  (This is how C{sftp} works, for example.) 
- 28   
- 29  The high-level client API starts with creation of an L{SSHClient} object. 
- 30  For more direct control, pass a socket (or socket-like object) to a 
- 31  L{Transport}, and use L{start_server <Transport.start_server>} or 
- 32  L{start_client <Transport.start_client>} to negoatite 
- 33  with the remote host as either a server or client.  As a client, you are 
- 34  responsible for authenticating using a password or private key, and checking 
- 35  the server's host key.  I{(Key signature and verification is done by paramiko, 
- 36  but you will need to provide private keys and check that the content of a 
- 37  public key matches what you expected to see.)}  As a server, you are 
- 38  responsible for deciding which users, passwords, and keys to allow, and what 
- 39  kind of channels to allow. 
- 40   
- 41  Once you have finished, either side may request flow-controlled L{Channel}s to 
- 42  the other side, which are python objects that act like sockets, but send and 
- 43  receive data over the encrypted session. 
- 44   
- 45  Paramiko is written entirely in python (no C or platform-dependent code) and is 
- 46  released under the GNU Lesser General Public License (LGPL). 
- 47   
- 48  Website: U{http://www.lag.net/paramiko/} 
- 49   
- 50  @version: 1.7.7.1 (George) 
- 51  @author: Robey Pointer 
- 52  @contact: robeypointer@gmail.com 
- 53  @license: GNU Lesser General Public License (LGPL) 
- 54  """ 
- 55   
- 56  import sys 
- 57   
- 58  if sys.version_info < (2, 2): 
- 59      raise RuntimeError('You need python 2.2 for this module.') 
- 60   
- 61   
- 62  __author__ = "Robey Pointer <robeypointer@gmail.com>" 
- 63  __date__ = "21 May 2011" 
- 64  __version__ = "1.7.7.1 (George)" 
- 65  __version_info__ = (1, 7, 7, 1) 
- 66  __license__ = "GNU Lesser General Public License (LGPL)" 
- 67   
- 68   
- 69  from transport import SecurityOptions, Transport 
- 70  from client import SSHClient, MissingHostKeyPolicy, AutoAddPolicy, RejectPolicy, WarningPolicy 
- 71  from auth_handler import AuthHandler 
- 72  from channel import Channel, ChannelFile 
- 73  from ssh_exception import SSHException, PasswordRequiredException, \ 
- 74      BadAuthenticationType, ChannelException, BadHostKeyException, \ 
- 75      AuthenticationException 
- 76  from server import ServerInterface, SubsystemHandler, InteractiveQuery 
- 77  from rsakey import RSAKey 
- 78  from dsskey import DSSKey 
- 79  from sftp import SFTPError, BaseSFTP 
- 80  from sftp_client import SFTP, SFTPClient 
- 81  from sftp_server import SFTPServer 
- 82  from sftp_attr import SFTPAttributes 
- 83  from sftp_handle import SFTPHandle 
- 84  from sftp_si import SFTPServerInterface 
- 85  from sftp_file import SFTPFile 
- 86  from message import Message 
- 87  from packet import Packetizer 
- 88  from file import BufferedFile 
- 89  from agent import Agent, AgentKey 
- 90  from pkey import PKey 
- 91  from hostkeys import HostKeys 
- 92  from config import SSHConfig 
- 93   
- 94  # fix module names for epydoc 
- 95  for c in locals().values(): 
- 96      if issubclass(type(c), type) or type(c).__name__ == 'classobj': 
- 97          # classobj for exceptions :/ 
- 98          c.__module__ = __name__ 
- 99  del c 
-100   
-101  from common import AUTH_SUCCESSFUL, AUTH_PARTIALLY_SUCCESSFUL, AUTH_FAILED, \ 
-102       OPEN_SUCCEEDED, OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED,  OPEN_FAILED_CONNECT_FAILED, \ 
-103       OPEN_FAILED_UNKNOWN_CHANNEL_TYPE, OPEN_FAILED_RESOURCE_SHORTAGE 
-104   
-105  from sftp import SFTP_OK, SFTP_EOF, SFTP_NO_SUCH_FILE, SFTP_PERMISSION_DENIED, SFTP_FAILURE, \ 
-106       SFTP_BAD_MESSAGE, SFTP_NO_CONNECTION, SFTP_CONNECTION_LOST, SFTP_OP_UNSUPPORTED 
-107   
-108  __all__ = [ 'Transport', 
-109              'SSHClient', 
-110              'MissingHostKeyPolicy', 
-111              'AutoAddPolicy', 
-112              'RejectPolicy', 
-113              'WarningPolicy', 
-114              'SecurityOptions', 
-115              'SubsystemHandler', 
-116              'Channel', 
-117              'PKey', 
-118              'RSAKey', 
-119              'DSSKey', 
-120              'Message', 
-121              'SSHException', 
-122              'AuthenticationException', 
-123              'PasswordRequiredException', 
-124              'BadAuthenticationType', 
-125              'ChannelException', 
-126              'BadHostKeyException', 
-127              'SFTP', 
-128              'SFTPFile', 
-129              'SFTPHandle', 
-130              'SFTPClient', 
-131              'SFTPServer', 
-132              'SFTPError', 
-133              'SFTPAttributes', 
-134              'SFTPServerInterface', 
-135              'ServerInterface', 
-136              'BufferedFile', 
-137              'Agent', 
-138              'AgentKey', 
-139              'HostKeys', 
-140              'SSHConfig', 
-141              'util' ] 
-142   
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.Agent-class.html b/docs/paramiko.Agent-class.html deleted file mode 100644 index 41ed7fa..0000000 --- a/docs/paramiko.Agent-class.html +++ /dev/null @@ -1,233 +0,0 @@ - - - - - paramiko.Agent - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class Agent - - - - - -
[frames] | no frames]
-
- -

Class Agent

source code

-

Client interface for using private keys from an SSH agent running on - the local machine. If an SSH agent is running, this class can be used to - connect to it and retreive PKey objects which can be used when attempting to - authenticate to remote SSH servers.

-

Because the SSH agent protocol uses environment variables and - unix-domain sockets, this probably doesn't work on Windows. It does work - on most posix platforms though (Linux and MacOS X, for example).

- - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self)
- Open a session with the local machine's SSH agent, if one is running.
- source code - -
- -
-   - - - - - - -
close(self)
- Close the SSH agent connection.
- source code - -
- -
- tuple of AgentKey - - - - - - -
get_keys(self)
- Return the list of keys available through the SSH agent, if any.
- source code - -
- -
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self) -
(Constructor) -

-
source code  -
- -

Open a session with the local machine's SSH agent, if one is running. - If no agent is running, initialization will succeed, but get_keys will - return an empty tuple.

-
-
Raises:
-
    -
  • SSHException - if an SSH agent is found, but speaks an incompatible protocol
  • -
-
-
-
- -
- -
- - -
-

get_keys(self) -

-
source code  -
- -

Return the list of keys available through the SSH agent, if any. If - no SSH agent was running (or it couldn't be contacted), an empty list - will be returned.

-
-
Returns: tuple of AgentKey
-
a list of keys available on the SSH agent
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.AgentKey-class.html b/docs/paramiko.AgentKey-class.html deleted file mode 100644 index 3034e6c..0000000 --- a/docs/paramiko.AgentKey-class.html +++ /dev/null @@ -1,399 +0,0 @@ - - - - - paramiko.AgentKey - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class AgentKey - - - - - -
[frames] | no frames]
-
- -

Class AgentKey

source code

-
-object --+    
-         |    
-      PKey --+
-             |
-            AgentKey
-
- -
-

Private key held in a local SSH agent. This type of key can be used - for authenticating to a remote server (signing). Most other key - operations work as expected.

- - - - - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - agent, - blob)
- Create a new instance of this public key type.
- source code - -
- -
- str - - - - - - -
__str__(self)
- Return a string of an SSH Message made up of the public part(s) of this key.
- source code - -
- -
- str - - - - - - -
get_name(self)
- Return the name of this private key implementation.
- source code - -
- -
- Message - - - - - - -
sign_ssh_data(self, - rng, - data)
- Sign a blob of data with this private key, and return a Message - representing an SSH signature message.
- source code - -
- -
-

Inherited from PKey: - __cmp__, - can_sign, - get_base64, - get_bits, - get_fingerprint, - verify_ssh_sig, - write_private_key, - write_private_key_file -

-

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

-
- - - - - - - - - -
- Class Methods
-

Inherited from PKey: - from_private_key, - from_private_key_file -

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - agent, - blob) -
(Constructor) -

-
source code  -
- -

Create a new instance of this public key type. If msg is - given, the key's public part(s) will be filled in from the message. If - data is given, the key's public part(s) will be filled in - from the string.

-
-
Parameters:
-
    -
  • msg - an optional SSH Message containing a public key of this type.
  • -
  • data - an optional string containing a public key of this type
  • -
-
Raises:
-
    -
  • SSHException - if a key cannot be created from the data or - msg given, or no key was passed in.
  • -
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

__str__(self) -
(Informal representation operator) -

-
source code  -
- -

Return a string of an SSH Message made up of the public part(s) of this key. This - string is suitable for passing to __init__ to - re-create the key object later.

-
-
Returns: str
-
string representation of an SSH key message.
-
Overrides: - object.__str__ -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

get_name(self) -

-
source code  -
- -

Return the name of this private key implementation.

-
-
Returns: str
-
name of this private key type, in SSH terminology (for example, - "ssh-rsa").
-
Overrides: - PKey.get_name -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

sign_ssh_data(self, - rng, - data) -

-
source code  -
- -

Sign a blob of data with this private key, and return a Message representing - an SSH signature message.

-
-
Parameters:
-
    -
  • rng - a secure random number generator.
  • -
  • data - the data to sign.
  • -
-
Returns: Message
-
an SSH signature message.
-
Overrides: - PKey.sign_ssh_data -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.AuthenticationException-class.html b/docs/paramiko.AuthenticationException-class.html deleted file mode 100644 index 9eca0ff..0000000 --- a/docs/paramiko.AuthenticationException-class.html +++ /dev/null @@ -1,185 +0,0 @@ - - - - - paramiko.AuthenticationException - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class AuthenticationException - - - - - -
[frames] | no frames]
-
- -

Class AuthenticationException

source code

-
-              object --+            
-                       |            
-exceptions.BaseException --+        
-                           |        
-        exceptions.Exception --+    
-                               |    
-                    SSHException --+
-                                   |
-                                  AuthenticationException
-
- -
Known Subclasses:
-
- -
- -
-

Exception raised when authentication failed for some reason. It may - be possible to retry with different credentials. (Other classes specify - more specific reasons.)

- -
-

Since: - 1.6 -

-
- - - - - - - - -
- Instance Methods
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- Properties
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.AutoAddPolicy-class.html b/docs/paramiko.AutoAddPolicy-class.html deleted file mode 100644 index 6acbd2a..0000000 --- a/docs/paramiko.AutoAddPolicy-class.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - - paramiko.AutoAddPolicy - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class AutoAddPolicy - - - - - -
[frames] | no frames]
-
- -

Class AutoAddPolicy

source code

-
-          object --+    
-                   |    
-MissingHostKeyPolicy --+
-                       |
-                      AutoAddPolicy
-
- -
-

Policy for automatically adding the hostname and new host key to the - local HostKeys - object, and saving it. This is used by SSHClient.

- - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
missing_host_key(self, - client, - hostname, - key)
- Called when an SSHClient receives a server key for a server that - isn't in either the system or local HostKeys object.
- source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

missing_host_key(self, - client, - hostname, - key) -

-
source code  -
- -

Called when an SSHClient receives a server key for a server that isn't - in either the system or local HostKeys object. To accept the key, simply return. To - reject, raised an exception (which will be passed to the calling - application).

-
-
Overrides: - MissingHostKeyPolicy.missing_host_key -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.BadAuthenticationType-class.html b/docs/paramiko.BadAuthenticationType-class.html deleted file mode 100644 index 243c134..0000000 --- a/docs/paramiko.BadAuthenticationType-class.html +++ /dev/null @@ -1,296 +0,0 @@ - - - - - paramiko.BadAuthenticationType - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class BadAuthenticationType - - - - - -
[frames] | no frames]
-
- -

Class BadAuthenticationType

source code

-
-              object --+                
-                       |                
-exceptions.BaseException --+            
-                           |            
-        exceptions.Exception --+        
-                               |        
-                    SSHException --+    
-                                   |    
-             AuthenticationException --+
-                                       |
-                                      BadAuthenticationType
-
- -
-

Exception raised when an authentication type (like password) is used, - but the server isn't allowing that type. (It may only allow public-key, - for example.)

- -
-

Since: - 1.1 -

-
- - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - explanation, - types)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
-   - - - - - - -
__str__(self)
- str(x)
- source code - -
- -
-

Inherited from exceptions.Exception: - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- Instance Variables
- list - - allowed_types = []
- list of allowed authentication types provided by the server (possible - values are: "none", - "password", and - "publickey"). -
- - - - - - - - - -
- Properties
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - explanation, - types) -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

__str__(self) -
(Informal representation operator) -

-
source code  -
- -

str(x)

-
-
Overrides: - object.__str__ -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.BadHostKeyException-class.html b/docs/paramiko.BadHostKeyException-class.html deleted file mode 100644 index a62448c..0000000 --- a/docs/paramiko.BadHostKeyException-class.html +++ /dev/null @@ -1,268 +0,0 @@ - - - - - paramiko.BadHostKeyException - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class BadHostKeyException - - - - - -
[frames] | no frames]
-
- -

Class BadHostKeyException

source code

-
-              object --+            
-                       |            
-exceptions.BaseException --+        
-                           |        
-        exceptions.Exception --+    
-                               |    
-                    SSHException --+
-                                   |
-                                  BadHostKeyException
-
- -
-

The host key given by the SSH server did not match what we were - expecting.

- -
-

Since: - 1.6 -

-
- - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - hostname, - got_key, - expected_key)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
-

Inherited from exceptions.Exception: - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - - - - - - - -
- Instance Variables
- PKey - - expected_key
- the host key expected -
- str - - hostname
- the hostname of the SSH server -
- PKey - - key
- the host key presented by the server -
- - - - - - - - - -
- Properties
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - hostname, - got_key, - expected_key) -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.BufferedFile-class.html b/docs/paramiko.BufferedFile-class.html deleted file mode 100644 index 13a3c66..0000000 --- a/docs/paramiko.BufferedFile-class.html +++ /dev/null @@ -1,856 +0,0 @@ - - - - - paramiko.BufferedFile - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class BufferedFile - - - - - -
[frames] | no frames]
-
- -

Class BufferedFile

source code

-
-object --+
-         |
-        BufferedFile
-
- -
Known Subclasses:
-
- -
- -
-

Reusable base class to implement python-style file buffering around a - simpler stream.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__del__(self) - source code - -
- -
-   - - - - - - -
__init__(self)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
- iterator - - - - - - -
__iter__(self)
- Returns an iterator that can be used to iterate over the lines in - this file.
- source code - -
- -
-   - - - - - - -
close(self)
- Close the file.
- source code - -
- -
-   - - - - - - -
flush(self)
- Write out any data in the write buffer.
- source code - -
- -
- str - - - - - - -
next(self)
- Returns the next line from the input, or raises StopIteration when EOF is hit.
- source code - -
- -
- str - - - - - - -
read(self, - size=None)
- Read at most size bytes from the file (less if we hit - the end of the file first).
- source code - -
- -
- str - - - - - - -
readline(self, - size=None)
- Read one entire line from the file.
- source code - -
- -
- list - - - - - - -
readlines(self, - sizehint=None)
- Read all remaining lines using readline and return them as a list.
- source code - -
- -
-   - - - - - - -
seek(self, - offset, - whence=0)
- Set the file's current position, like stdio's fseek.
- source code - -
- -
- int - - - - - - -
tell(self)
- Return the file's current position.
- source code - -
- -
-   - - - - - - -
write(self, - data)
- Write data to the file.
- source code - -
- -
-   - - - - - - -
writelines(self, - sequence)
- Write a sequence of strings to the file.
- source code - -
- -
- iterator - - - - - - -
xreadlines(self)
- Identical to iter(f).
- source code - -
- -
-

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

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Class Variables
-   - - FLAG_APPEND = 4 -
-   - - FLAG_BINARY = 16 -
-   - - FLAG_BUFFERED = 32 -
-   - - FLAG_LINE_BUFFERED = 64 -
-   - - FLAG_READ = 1 -
-   - - FLAG_UNIVERSAL_NEWLINE = 128 -
-   - - FLAG_WRITE = 2 -
-   - - SEEK_CUR = 1 -
-   - - SEEK_END = 2 -
-   - - SEEK_SET = 0 -
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self) -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

__iter__(self) -

-
source code  -
- -

Returns an iterator that can be used to iterate over the lines in this - file. This iterator happens to return the file itself, since a file is - its own iterator.

-
-
Returns: iterator
-
an interator.
-
Raises:
-
    -
  • ValueError - if the file is closed.
  • -
-
-
-
- -
- -
- - -
-

close(self) -

-
source code  -
- -

Close the file. Future read and write operations will fail.

-
-
-
-
- -
- -
- - -
-

flush(self) -

-
source code  -
- -

Write out any data in the write buffer. This may do nothing if write - buffering is not turned on.

-
-
-
-
- -
- -
- - -
-

next(self) -

-
source code  -
- -

Returns the next line from the input, or raises StopIteration when EOF is hit. Unlike python file - objects, it's okay to mix calls to next and readline.

-
-
Returns: str
-
a line read from the file.
-
Raises:
-
    -
  • StopIteration - when the end of the file is reached.
  • -
-
-
-
- -
- -
- - -
-

read(self, - size=None) -

-
source code  -
- -

Read at most size bytes from the file (less if we hit the - end of the file first). If the size argument is negative or - omitted, read all the remaining data in the file.

-
-
Parameters:
-
    -
  • size (int) - maximum number of bytes to read
  • -
-
Returns: str
-
data read from the file, or an empty string if EOF was - encountered immediately
-
-
-
- -
- -
- - -
-

readline(self, - size=None) -

-
source code  -
- -

Read one entire line from the file. A trailing newline character is - kept in the string (but may be absent when a file ends with an incomplete - line). If the size argument is present and non-negative, it is a maximum - byte count (including the trailing newline) and an incomplete line may be - returned. An empty string is returned only when EOF is encountered - immediately.

-
-
Parameters:
-
    -
  • size (int) - maximum length of returned string.
  • -
-
Returns: str
-
next line of the file, or an empty string if the end of the file - has been reached.
-
-

Note: - Unlike stdio's fgets(), the returned string contains - null characters ('\0') if they occurred in the input. -

-
-
- -
- -
- - -
-

readlines(self, - sizehint=None) -

-
source code  -
- -

Read all remaining lines using readline and return them as a list. If the optional - sizehint argument is present, instead of reading up to EOF, - whole lines totalling approximately sizehint bytes (possibly after - rounding up to an internal buffer size) are read.

-
-
Parameters:
-
    -
  • sizehint (int) - desired maximum number of bytes to read.
  • -
-
Returns: list
-
list of lines read from the file.
-
-
-
- -
- -
- - -
-

seek(self, - offset, - whence=0) -

-
source code  -
- -

Set the file's current position, like stdio's fseek. Not - all file objects support seeking.

-
-
Parameters:
-
    -
  • offset (int) - position to move to within the file, relative to - whence.
  • -
  • whence (int) - type of movement: 0 = absolute; 1 = relative to the current - position; 2 = relative to the end of the file.
  • -
-
Raises:
-
    -
  • IOError - if the file doesn't support random access.
  • -
-
-

Note: - If a file is opened in append mode ('a' or - 'a+'), any seek operations will be undone at the next - write (as the file position will move back to the end of the file). -

-
-
- -
- -
- - -
-

tell(self) -

-
source code  -
- -

Return the file's current position. This may not be accurate or - useful if the underlying file doesn't support random access, or was - opened in append mode.

-
-
Returns: int
-
file position (in bytes).
-
-
-
- -
- -
- - -
-

write(self, - data) -

-
source code  -
- -

Write data to the file. If write buffering is on - (bufsize was specified and non-zero), some or all of the - data may not actually be written yet. (Use flush or - close - to force buffered data to be written out.)

-
-
Parameters:
-
    -
  • data (str) - data to write.
  • -
-
-
-
- -
- -
- - -
-

writelines(self, - sequence) -

-
source code  -
- -

Write a sequence of strings to the file. The sequence can be any - iterable object producing strings, typically a list of strings. (The - name is intended to match readlines; writelines does not add line - separators.)

-
-
Parameters:
-
    -
  • sequence (sequence) - an iterable sequence of strings.
  • -
-
-
-
- -
- -
- - -
-

xreadlines(self) -

-
source code  -
- -

Identical to iter(f). This is a deprecated file - interface that predates python iterator support.

-
-
Returns: iterator
-
an iterator.
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.Channel-class.html b/docs/paramiko.Channel-class.html deleted file mode 100644 index aa4c6fa..0000000 --- a/docs/paramiko.Channel-class.html +++ /dev/null @@ -1,1998 +0,0 @@ - - - - - paramiko.Channel - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class Channel - - - - - -
[frames] | no frames]
-
- -

Class Channel

source code

-
-object --+
-         |
-        Channel
-
- -
-

A secure tunnel across an SSH Transport. A Channel is meant to behave like a socket, - and has an API that should be indistinguishable from the python socket - API.

-

Because SSH2 has a windowing kind of flow control, if you stop reading - data from a Channel and its buffer fills up, the server will be unable to - send you any more data until you read some of it. (This won't affect - other channels on the same transport -- all channels on a single - transport are flow-controlled independently.) Similarly, if the server - isn't reading data you send, calls to send may block, - unless you set a timeout. This is exactly like a normal network socket, - so it shouldn't be too surprising.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__del__(self) - source code - -
- -
-   - - - - - - -
__init__(self, - chanid)
- Create a new channel.
- source code - -
- -
- str - - - - - - -
__repr__(self)
- Return a string representation of this object, for debugging.
- source code - -
- -
-   - - - - - - -
close(self)
- Close the channel.
- source code - -
- -
-   - - - - - - -
exec_command(self, - command)
- Execute a command on the server.
- source code - -
- -
- bool - - - - - - -
exit_status_ready(self)
- Return true if the remote process has exited and returned an exit - status.
- source code - -
- -
- int - - - - - - -
fileno(self)
- Returns an OS-level file descriptor which can be used for polling, - but but not for reading or writing.
- source code - -
- -
- int - - - - - - -
get_id(self)
- Return the ID # for this channel.
- source code - -
- -
- str - - - - - - -
get_name(self)
- Get the name of this channel that was previously set by set_name.
- source code - -
- -
-   - - - - - - -
get_pty(self, - term='vt100', - width=80, - height=24)
- Request a pseudo-terminal from the server.
- source code - -
- -
- Transport - - - - - - -
get_transport(self)
- Return the Transport associated with this channel.
- source code - -
- -
- tuple(str, int) - - - - - - -
getpeername(self)
- Return the address of the remote side of this Channel, if possible.
- source code - -
- -
- float - - - - - - -
gettimeout(self)
- Returns the timeout in seconds (as a float) associated with socket - operations, or None if no timeout is set.
- source code - -
- -
-   - - - - - - -
invoke_shell(self)
- Request an interactive shell session on this channel.
- source code - -
- -
-   - - - - - - -
invoke_subsystem(self, - subsystem)
- Request a subsystem on the server (for example, sftp).
- source code - -
- -
- ChannelFile - - - - - - -
makefile(self, - *params)
- Return a file-like object associated with this channel.
- source code - -
- -
- ChannelFile - - - - - - -
makefile_stderr(self, - *params)
- Return a file-like object associated with this channel's stderr - stream.
- source code - -
- -
- str - - - - - - -
recv(self, - nbytes)
- Receive data from the channel.
- source code - -
- -
- int - - - - - - -
recv_exit_status(self)
- Return the exit status from the process on the server.
- source code - -
- -
- boolean - - - - - - -
recv_ready(self)
- Returns true if data is buffered and ready to be read from this - channel.
- source code - -
- -
- str - - - - - - -
recv_stderr(self, - nbytes)
- Receive data from the channel's stderr stream.
- source code - -
- -
- boolean - - - - - - -
recv_stderr_ready(self)
- Returns true if data is buffered and ready to be read from this - channel's stderr stream.
- source code - -
- -
-   - - - - - - -
request_x11(self, - screen_number=0, - auth_protocol=None, - auth_cookie=None, - single_connection=False, - handler=None)
- Request an x11 session on this channel.
- source code - -
- -
-   - - - - - - -
resize_pty(self, - width=80, - height=24)
- Resize the pseudo-terminal.
- source code - -
- -
- int - - - - - - -
send(self, - s)
- Send data to the channel.
- source code - -
- -
-   - - - - - - -
send_exit_status(self, - status)
- Send the exit status of an executed command to the client.
- source code - -
- -
- boolean - - - - - - -
send_ready(self)
- Returns true if data can be written to this channel without blocking.
- source code - -
- -
- int - - - - - - -
send_stderr(self, - s)
- Send data to the channel on the "stderr" stream.
- source code - -
- -
-   - - - - - - -
sendall(self, - s)
- Send data to the channel, without allowing partial results.
- source code - -
- -
-   - - - - - - -
sendall_stderr(self, - s)
- Send data to the channel's "stderr" stream, without - allowing partial results.
- source code - -
- -
- bool - - - - - - -
set_combine_stderr(self, - combine)
- Set whether stderr should be combined into stdout on this channel.
- source code - -
- -
-   - - - - - - -
set_name(self, - name)
- Set a name for this channel.
- source code - -
- -
-   - - - - - - -
setblocking(self, - blocking)
- Set blocking or non-blocking mode of the channel: if - blocking is 0, the channel is set to non-blocking mode; - otherwise it's set to blocking mode.
- source code - -
- -
-   - - - - - - -
settimeout(self, - timeout)
- Set a timeout on blocking read/write operations.
- source code - -
- -
-   - - - - - - -
shutdown(self, - how)
- Shut down one or both halves of the connection.
- source code - -
- -
-   - - - - - - -
shutdown_read(self)
- Shutdown the receiving side of this socket, closing the stream in the - incoming direction.
- source code - -
- -
-   - - - - - - -
shutdown_write(self)
- Shutdown the sending side of this socket, closing the stream in the - outgoing direction.
- source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - chanid) -
(Constructor) -

-
source code  -
- -

Create a new channel. The channel is not associated with any - particular session or Transport until the Transport attaches it. Normally you - would only call this method from the constructor of a subclass of Channel.

-
-
Parameters:
-
    -
  • chanid (int) - the ID of this channel, as passed by an existing Transport.
  • -
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

__repr__(self) -
(Representation operator) -

-
source code  -
- -

Return a string representation of this object, for debugging.

-
-
Returns: str
-
Overrides: - object.__repr__ -
-
-
-
- -
- -
- - -
-

close(self) -

-
source code  -
- -

Close the channel. All future read/write operations on the channel - will fail. The remote end will receive no more data (after queued data - is flushed). Channels are automatically closed when their Transport is closed - or when they are garbage collected.

-
-
-
-
- -
- -
- - -
-

exec_command(self, - command) -

-
source code  -
- -

Execute a command on the server. If the server allows it, the channel - will then be directly connected to the stdin, stdout, and stderr of the - command being executed.

-

When the command finishes executing, the channel will be closed and - can't be reused. You must open a new channel if you wish to execute - another command.

-
-
Parameters:
-
    -
  • command (str) - a shell command to execute.
  • -
-
Raises:
-
    -
  • SSHException - if the request was rejected or the channel was closed
  • -
-
-
-
- -
- -
- - -
-

exit_status_ready(self) -

-
source code  -
- -

Return true if the remote process has exited and returned an exit - status. You may use this to poll the process status if you don't want to - block in recv_exit_status. Note that the server may not return an - exit status in some cases (like bad servers).

-
-
Returns: bool
-
True if recv_exit_status will return immediately
-
-

Since: - 1.7.3 -

-
-
- -
- -
- - -
-

fileno(self) -

-
source code  -
- -

Returns an OS-level file descriptor which can be used for polling, but - but not for reading or writing. This is primaily to allow - python's select module to work.

-

The first time fileno is called on a channel, a pipe is - created to simulate real OS-level file descriptor (FD) behavior. Because - of this, two OS-level FDs are created, which will use up FDs faster than - normal. (You won't notice this effect unless you have hundreds of - channels open at the same time.)

-
-
Returns: int
-
an OS-level file descriptor
-
-

Warning: - This method causes channel reads to be slightly less efficient. -

-
-
- -
- -
- - -
-

get_id(self) -

-
source code  -
- -

Return the ID # for this channel. The channel ID is unique across a - Transport and - usually a small number. It's also the number passed to ServerInterface.check_channel_request when determining - whether to accept a channel request in server mode.

-
-
Returns: int
-
the ID of this channel.
-
-
-
- -
- -
- - -
-

get_name(self) -

-
source code  -
- -

Get the name of this channel that was previously set by set_name.

-
-
Returns: str
-
the name of this channel.
-
-
-
- -
- -
- - -
-

get_pty(self, - term='vt100', - width=80, - height=24) -

-
source code  -
- -

Request a pseudo-terminal from the server. This is usually used right - after creating a client channel, to ask the server to provide some basic - terminal semantics for a shell invoked with invoke_shell. It isn't necessary (or desirable) to call - this method if you're going to exectue a single command with exec_command.

-
-
Parameters:
-
    -
  • term (str) - the terminal type to emulate (for example, 'vt100')
  • -
  • width (int) - width (in characters) of the terminal screen
  • -
  • height (int) - height (in characters) of the terminal screen
  • -
-
Raises:
-
    -
  • SSHException - if the request was rejected or the channel was closed
  • -
-
-
-
- -
- -
- - -
-

get_transport(self) -

-
source code  -
- -

Return the Transport associated with this channel.

-
-
Returns: Transport
-
the Transport that was used to create this channel.
-
-
-
- -
- -
- - -
-

getpeername(self) -

-
source code  -
- -

Return the address of the remote side of this Channel, if possible. - This is just a wrapper around 'getpeername' on the - Transport, used to provide enough of a socket-like interface to allow - asyncore to work. (asyncore likes to call - 'getpeername'.)

-
-
Returns: tuple(str, int)
-
the address if the remote host, if known
-
-
-
- -
- -
- - -
-

gettimeout(self) -

-
source code  -
- -

Returns the timeout in seconds (as a float) associated with socket - operations, or None if no timeout is set. This reflects the - last call to setblocking or settimeout.

-
-
Returns: float
-
timeout in seconds, or None.
-
-
-
- -
- -
- - -
-

invoke_shell(self) -

-
source code  -
- -

Request an interactive shell session on this channel. If the server - allows it, the channel will then be directly connected to the stdin, - stdout, and stderr of the shell.

-

Normally you would call get_pty before this, in which case the shell will - operate through the pty, and the channel will be connected to the stdin - and stdout of the pty.

-

When the shell exits, the channel will be closed and can't be reused. - You must open a new channel if you wish to open another shell.

-
-
Raises:
-
    -
  • SSHException - if the request was rejected or the channel was closed
  • -
-
-
-
- -
- -
- - -
-

invoke_subsystem(self, - subsystem) -

-
source code  -
- -

Request a subsystem on the server (for example, sftp). - If the server allows it, the channel will then be directly connected to - the requested subsystem.

-

When the subsystem finishes, the channel will be closed and can't be - reused.

-
-
Parameters:
-
    -
  • subsystem (str) - name of the subsystem being requested.
  • -
-
Raises:
-
    -
  • SSHException - if the request was rejected or the channel was closed
  • -
-
-
-
- -
- -
- - -
-

makefile(self, - *params) -

-
source code  -
- -

Return a file-like object associated with this channel. The optional - mode and bufsize arguments are interpreted the - same way as by the built-in file() function in python.

-
-
Returns: ChannelFile
-
object which can be used for python file I/O.
-
-
-
- -
- -
- - -
-

makefile_stderr(self, - *params) -

-
source code  -
- -

Return a file-like object associated with this channel's stderr - stream. Only channels using exec_command or invoke_shell without a pty will ever have data on the - stderr stream.

-

The optional mode and bufsize arguments are - interpreted the same way as by the built-in file() function - in python. For a client, it only makes sense to open this file for - reading. For a server, it only makes sense to open this file for - writing.

-
-
Returns: ChannelFile
-
object which can be used for python file I/O.
-
-

Since: - 1.1 -

-
-
- -
- -
- - -
-

recv(self, - nbytes) -

-
source code  -
- -

Receive data from the channel. The return value is a string - representing the data received. The maximum amount of data to be - received at once is specified by nbytes. If a string of - length zero is returned, the channel stream has closed.

-
-
Parameters:
-
    -
  • nbytes (int) - maximum number of bytes to read.
  • -
-
Returns: str
-
data.
-
Raises:
-
    -
  • socket.timeout - if no data is ready before the timeout set by settimeout.
  • -
-
-
-
- -
- -
- - -
-

recv_exit_status(self) -

-
source code  -
- -

Return the exit status from the process on the server. This is mostly - useful for retrieving the reults of an exec_command. If the command hasn't finished yet, this - method will wait until it does, or until the channel is closed. If no - exit status is provided by the server, -1 is returned.

-
-
Returns: int
-
the exit code of the process on the server.
-
-

Since: - 1.2 -

-
-
- -
- -
- - -
-

recv_ready(self) -

-
source code  -
- -

Returns true if data is buffered and ready to be read from this - channel. A False result does not mean that the channel has - closed; it means you may need to wait before more data arrives.

-
-
Returns: boolean
-
True if a recv call on this channel would immediately - return at least one byte; False otherwise.
-
-
-
- -
- -
- - -
-

recv_stderr(self, - nbytes) -

-
source code  -
- -

Receive data from the channel's stderr stream. Only channels using exec_command or invoke_shell without a pty will ever have data on the - stderr stream. The return value is a string representing the data - received. The maximum amount of data to be received at once is specified - by nbytes. If a string of length zero is returned, the - channel stream has closed.

-
-
Parameters:
-
    -
  • nbytes (int) - maximum number of bytes to read.
  • -
-
Returns: str
-
data.
-
Raises:
-
    -
  • socket.timeout - if no data is ready before the timeout set by settimeout.
  • -
-
-

Since: - 1.1 -

-
-
- -
- -
- - -
-

recv_stderr_ready(self) -

-
source code  -
- -

Returns true if data is buffered and ready to be read from this - channel's stderr stream. Only channels using exec_command or invoke_shell without a pty will ever have data on the - stderr stream.

-
-
Returns: boolean
-
True if a recv_stderr call on this channel would - immediately return at least one byte; False - otherwise.
-
-

Since: - 1.1 -

-
-
- -
- -
- - -
-

request_x11(self, - screen_number=0, - auth_protocol=None, - auth_cookie=None, - single_connection=False, - handler=None) -

-
source code  -
- -

Request an x11 session on this channel. If the server allows it, - further x11 requests can be made from the server to the client, when an - x11 application is run in a shell session.

-

From RFC4254:

-
-   It is RECOMMENDED that the 'x11 authentication cookie' that is
-   sent be a fake, random cookie, and that the cookie be checked and
-   replaced by the real cookie when a connection request is received.
-
-

If you omit the auth_cookie, a new secure random 128-bit value will be - generated, used, and returned. You will need to use this value to verify - incoming x11 requests and replace them with the actual local x11 cookie - (which requires some knoweldge of the x11 protocol).

-

If a handler is passed in, the handler is called from another thread - whenever a new x11 connection arrives. The default handler queues up - incoming x11 connections, which may be retrieved using Transport.accept. The handler's calling signature - is:

-
-   handler(channel: Channel, (address: str, port: int))
-
-
-
Parameters:
-
    -
  • screen_number (int) - the x11 screen number (0, 10, etc)
  • -
  • auth_protocol (str) - the name of the X11 authentication method used; if none is given, - "MIT-MAGIC-COOKIE-1" is used
  • -
  • auth_cookie (str) - hexadecimal string containing the x11 auth cookie; if none is - given, a secure random 128-bit value is generated
  • -
  • single_connection (bool) - if True, only a single x11 connection will be forwarded (by - default, any number of x11 connections can arrive over this - session)
  • -
  • handler (function) - an optional handler to use for incoming X11 connections
  • -
-
Returns:
-
the auth_cookie used
-
-
-
- -
- -
- - -
-

resize_pty(self, - width=80, - height=24) -

-
source code  -
- -

Resize the pseudo-terminal. This can be used to change the width and - height of the terminal emulation created in a previous get_pty - call.

-
-
Parameters:
-
    -
  • width (int) - new width (in characters) of the terminal screen
  • -
  • height (int) - new height (in characters) of the terminal screen
  • -
-
Raises:
-
    -
  • SSHException - if the request was rejected or the channel was closed
  • -
-
-
-
- -
- -
- - -
-

send(self, - s) -

-
source code  -
- -

Send data to the channel. Returns the number of bytes sent, or 0 if - the channel stream is closed. Applications are responsible for checking - that all data has been sent: if only some of the data was transmitted, - the application needs to attempt delivery of the remaining data.

-
-
Parameters:
-
    -
  • s (str) - data to send
  • -
-
Returns: int
-
number of bytes actually sent
-
Raises:
-
    -
  • socket.timeout - if no data could be sent before the timeout set by settimeout.
  • -
-
-
-
- -
- -
- - -
-

send_exit_status(self, - status) -

-
source code  -
- -

Send the exit status of an executed command to the client. (This - really only makes sense in server mode.) Many clients expect to get some - sort of status code back from an executed command after it completes.

-
-
Parameters:
-
    -
  • status (int) - the exit code of the process
  • -
-
-

Since: - 1.2 -

-
-
- -
- -
- - -
-

send_ready(self) -

-
source code  -
- -

Returns true if data can be written to this channel without blocking. - This means the channel is either closed (so any write attempt would - return immediately) or there is at least one byte of space in the - outbound buffer. If there is at least one byte of space in the outbound - buffer, a send call will succeed immediately and return the number - of bytes actually written.

-
-
Returns: boolean
-
True if a send call on this channel would immediately - succeed or fail
-
-
-
- -
- -
- - -
-

send_stderr(self, - s) -

-
source code  -
- -

Send data to the channel on the "stderr" stream. This is - normally only used by servers to send output from shell commands -- - clients won't use this. Returns the number of bytes sent, or 0 if the - channel stream is closed. Applications are responsible for checking that - all data has been sent: if only some of the data was transmitted, the - application needs to attempt delivery of the remaining data.

-
-
Parameters:
-
    -
  • s (str) - data to send.
  • -
-
Returns: int
-
number of bytes actually sent.
-
Raises:
-
    -
  • socket.timeout - if no data could be sent before the timeout set by settimeout.
  • -
-
-

Since: - 1.1 -

-
-
- -
- -
- - -
-

sendall(self, - s) -

-
source code  -
- -

Send data to the channel, without allowing partial results. Unlike send, this - method continues to send data from the given string until either all data - has been sent or an error occurs. Nothing is returned.

-
-
Parameters:
-
    -
  • s (str) - data to send.
  • -
-
Raises:
-
    -
  • socket.timeout - if sending stalled for longer than the timeout set by settimeout.
  • -
  • socket.error - if an error occured before the entire string was sent.
  • -
-
-

Note: - If the channel is closed while only part of the data hase been - sent, there is no way to determine how much data (if any) was sent. - This is irritating, but identically follows python's API. -

-
-
- -
- -
- - -
-

sendall_stderr(self, - s) -

-
source code  -
- -

Send data to the channel's "stderr" stream, without allowing - partial results. Unlike send_stderr, this method continues to send data from the - given string until all data has been sent or an error occurs. Nothing is - returned.

-
-
Parameters:
-
    -
  • s (str) - data to send to the client as "stderr" output.
  • -
-
Raises:
-
    -
  • socket.timeout - if sending stalled for longer than the timeout set by settimeout.
  • -
  • socket.error - if an error occured before the entire string was sent.
  • -
-
-

Since: - 1.1 -

-
-
- -
- -
- - -
-

set_combine_stderr(self, - combine) -

-
source code  -
- -

Set whether stderr should be combined into stdout on this channel. The - default is False, but in some cases it may be convenient to - have both streams combined.

-

If this is False, and exec_command is called (or invoke_shell - with no pty), output to stderr will not show up through the recv and recv_ready - calls. You will have to use recv_stderr and recv_stderr_ready to get stderr output.

-

If this is True, data will never show up via recv_stderr or recv_stderr_ready.

-
-
Parameters:
-
    -
  • combine (bool) - True if stderr output should be combined into stdout - on this channel.
  • -
-
Returns: bool
-
previous setting.
-
-

Since: - 1.1 -

-
-
- -
- -
- - -
-

set_name(self, - name) -

-
source code  -
- -

Set a name for this channel. Currently it's only used to set the name - of the channel in logfile entries. The name can be fetched with the get_name - method.

-
-
Parameters:
-
    -
  • name (str) - new channel name
  • -
-
-
-
- -
- -
- - -
-

setblocking(self, - blocking) -

-
source code  -
- -

Set blocking or non-blocking mode of the channel: if - blocking is 0, the channel is set to non-blocking mode; - otherwise it's set to blocking mode. Initially all channels are in - blocking mode.

-

In non-blocking mode, if a recv call doesn't find any data, or if a send call can't - immediately dispose of the data, an error exception is raised. In - blocking mode, the calls block until they can proceed. An EOF condition - is considered "immediate data" for recv, so if the - channel is closed in the read direction, it will never block.

-

chan.setblocking(0) is equivalent to - chan.settimeout(0); chan.setblocking(1) is - equivalent to chan.settimeout(None).

-
-
Parameters:
-
    -
  • blocking (int) - 0 to set non-blocking mode; non-0 to set blocking mode.
  • -
-
-
-
- -
- -
- - -
-

settimeout(self, - timeout) -

-
source code  -
- -

Set a timeout on blocking read/write operations. The - timeout argument can be a nonnegative float expressing - seconds, or None. If a float is given, subsequent channel - read/write operations will raise a timeout exception if the timeout - period value has elapsed before the operation has completed. Setting a - timeout of None disables timeouts on socket operations.

-

chan.settimeout(0.0) is equivalent to - chan.setblocking(0); chan.settimeout(None) is - equivalent to chan.setblocking(1).

-
-
Parameters:
-
    -
  • timeout (float) - seconds to wait for a pending read/write operation before raising - socket.timeout, or None for no timeout.
  • -
-
-
-
- -
- -
- - -
-

shutdown(self, - how) -

-
source code  -
- -

Shut down one or both halves of the connection. If how - is 0, further receives are disallowed. If how is 1, further - sends are disallowed. If how is 2, further sends and - receives are disallowed. This closes the stream in one or both - directions.

-
-
Parameters:
-
    -
  • how (int) - 0 (stop receiving), 1 (stop sending), or 2 (stop receiving and - sending).
  • -
-
-
-
- -
- -
- - -
-

shutdown_read(self) -

-
source code  -
- -

Shutdown the receiving side of this socket, closing the stream in the - incoming direction. After this call, future reads on this channel will - fail instantly. This is a convenience method, equivalent to - shutdown(0), for people who don't make it a habit to - memorize unix constants from the 1970s.

-
-
-

Since: - 1.2 -

-
-
- -
- -
- - -
-

shutdown_write(self) -

-
source code  -
- -

Shutdown the sending side of this socket, closing the stream in the - outgoing direction. After this call, future writes on this channel will - fail instantly. This is a convenience method, equivalent to - shutdown(1), for people who don't make it a habit to - memorize unix constants from the 1970s.

-
-
-

Since: - 1.2 -

-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.ChannelException-class.html b/docs/paramiko.ChannelException-class.html deleted file mode 100644 index 26e4f7d..0000000 --- a/docs/paramiko.ChannelException-class.html +++ /dev/null @@ -1,250 +0,0 @@ - - - - - paramiko.ChannelException - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class ChannelException - - - - - -
[frames] | no frames]
-
- -

Class ChannelException

source code

-
-              object --+            
-                       |            
-exceptions.BaseException --+        
-                           |        
-        exceptions.Exception --+    
-                               |    
-                    SSHException --+
-                                   |
-                                  ChannelException
-
- -
-

Exception raised when an attempt to open a new Channel fails.

- -
-

Since: - 1.6 -

-
- - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - code, - text)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
-

Inherited from exceptions.Exception: - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- Instance Variables
- int - - code
- the error code returned by the server -
- - - - - - - - - -
- Properties
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - code, - text) -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.DSSKey-class.html b/docs/paramiko.DSSKey-class.html deleted file mode 100644 index 8f44a94..0000000 --- a/docs/paramiko.DSSKey-class.html +++ /dev/null @@ -1,750 +0,0 @@ - - - - - paramiko.DSSKey - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class DSSKey - - - - - -
[frames] | no frames]
-
- -

Class DSSKey

source code

-
-object --+    
-         |    
-      PKey --+
-             |
-            DSSKey
-
- -
-

Representation of a DSS key which can be used to sign an verify SSH2 - data.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__hash__(self)
- hash(x)
- source code - -
- -
-   - - - - - - -
__init__(self, - msg=None, - data=None, - filename=None, - password=None, - vals=None, - file_obj=None)
- Create a new instance of this public key type.
- source code - -
- -
- str - - - - - - -
__str__(self)
- Return a string of an SSH Message made up of the public part(s) of this key.
- source code - -
- -
- bool - - - - - - -
can_sign(self)
- Return True if this key has the private part necessary - for signing data.
- source code - -
- -
- int - - - - - - -
get_bits(self)
- Return the number of significant bits in this key.
- source code - -
- -
- str - - - - - - -
get_name(self)
- Return the name of this private key implementation.
- source code - -
- -
- Message - - - - - - -
sign_ssh_data(self, - rng, - data)
- Sign a blob of data with this private key, and return a Message - representing an SSH signature message.
- source code - -
- -
- boolean - - - - - - -
verify_ssh_sig(self, - data, - msg)
- Given a blob of data, and an SSH message representing a signature of - that data, verify that it was signed with this key.
- source code - -
- -
-   - - - - - - -
write_private_key(self, - file_obj, - password=None)
- Write private key contents into a file (or file-like) object.
- source code - -
- -
-   - - - - - - -
write_private_key_file(self, - filename, - password=None)
- Write private key contents into a file.
- source code - -
- -
-

Inherited from PKey: - __cmp__, - get_base64, - get_fingerprint -

-

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

-
- - - - - - - - - -
- Class Methods
-

Inherited from PKey: - from_private_key, - from_private_key_file -

-
- - - - - - - - - -
- Static Methods
- DSSKey - - - - - - -
generate(bits=1024, - progress_func=None)
- Generate a new private DSS key.
- source code - -
- -
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__hash__(self) -
(Hashing function) -

-
source code  -
- -

hash(x)

-
-
Overrides: - object.__hash__ -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

__init__(self, - msg=None, - data=None, - filename=None, - password=None, - vals=None, - file_obj=None) -
(Constructor) -

-
source code  -
- -

Create a new instance of this public key type. If msg is - given, the key's public part(s) will be filled in from the message. If - data is given, the key's public part(s) will be filled in - from the string.

-
-
Parameters:
-
    -
  • msg - an optional SSH Message containing a public key of this type.
  • -
  • data - an optional string containing a public key of this type
  • -
-
Raises:
-
    -
  • SSHException - if a key cannot be created from the data or - msg given, or no key was passed in.
  • -
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

__str__(self) -
(Informal representation operator) -

-
source code  -
- -

Return a string of an SSH Message made up of the public part(s) of this key. This - string is suitable for passing to __init__ to - re-create the key object later.

-
-
Returns: str
-
string representation of an SSH key message.
-
Overrides: - object.__str__ -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

can_sign(self) -

-
source code  -
- -

Return True if this key has the private part necessary - for signing data.

-
-
Returns: bool
-
True if this is a private key.
-
Overrides: - PKey.can_sign -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

generate(bits=1024, - progress_func=None) -
Static Method -

-
source code  -
- -

Generate a new private DSS key. This factory function can be used to - generate a new host key or authentication key.

-
-
Parameters:
-
    -
  • bits (int) - number of bits the generated key should be.
  • -
  • progress_func (function) - an optional function to call at key points in key generation - (used by pyCrypto.PublicKey).
  • -
-
Returns: DSSKey
-
new private key
-
-
-
- -
- -
- - -
-

get_bits(self) -

-
source code  -
- -

Return the number of significant bits in this key. This is useful for - judging the relative security of a key.

-
-
Returns: int
-
bits in the key.
-
Overrides: - PKey.get_bits -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

get_name(self) -

-
source code  -
- -

Return the name of this private key implementation.

-
-
Returns: str
-
name of this private key type, in SSH terminology (for example, - "ssh-rsa").
-
Overrides: - PKey.get_name -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

sign_ssh_data(self, - rng, - data) -

-
source code  -
- -

Sign a blob of data with this private key, and return a Message representing - an SSH signature message.

-
-
Parameters:
-
    -
  • rng - a secure random number generator.
  • -
  • data - the data to sign.
  • -
-
Returns: Message
-
an SSH signature message.
-
Overrides: - PKey.sign_ssh_data -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

verify_ssh_sig(self, - data, - msg) -

-
source code  -
- -

Given a blob of data, and an SSH message representing a signature of - that data, verify that it was signed with this key.

-
-
Parameters:
-
    -
  • data - the data that was signed.
  • -
  • msg - an SSH signature message
  • -
-
Returns: boolean
-
True if the signature verifies correctly; - False otherwise.
-
Overrides: - PKey.verify_ssh_sig -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

write_private_key(self, - file_obj, - password=None) -

-
source code  -
- -

Write private key contents into a file (or file-like) object. If the - password is not None, the key is encrypted before - writing.

-
-
Parameters:
-
    -
  • file_obj - the file object to write into
  • -
  • password - an optional password to use to encrypt the key
  • -
-
Raises:
-
    -
  • IOError - if there was an error writing to the file
  • -
  • SSHException - if the key is invalid
  • -
-
Overrides: - PKey.write_private_key -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

write_private_key_file(self, - filename, - password=None) -

-
source code  -
- -

Write private key contents into a file. If the password is not - None, the key is encrypted before writing.

-
-
Parameters:
-
    -
  • filename - name of the file to write
  • -
  • password - an optional password to use to encrypt the key file
  • -
-
Raises:
-
    -
  • IOError - if there was an error writing the file
  • -
  • SSHException - if the key is invalid
  • -
-
Overrides: - PKey.write_private_key_file -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.HostKeys-class.html b/docs/paramiko.HostKeys-class.html deleted file mode 100644 index c823af5..0000000 --- a/docs/paramiko.HostKeys-class.html +++ /dev/null @@ -1,643 +0,0 @@ - - - - - paramiko.HostKeys - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class HostKeys - - - - - -
[frames] | no frames]
-
- -

Class HostKeys

source code

-
-UserDict.DictMixin --+
-                     |
-                    HostKeys
-
- -
-

Representation of an openssh-style "known hosts" file. Host - keys can be read from one or more files, and then individual hosts can be - looked up to verify server keys during SSH negotiation.

-

A HostKeys object can be treated like a dict; any dict lookup is - equivalent to calling lookup.

- -
-

Since: - 1.5.3 -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__getitem__(self, - key) - source code - -
- -
-   - - - - - - -
__init__(self, - filename=None)
- Create a new HostKeys object, optionally loading keys from an openssh - style host-key file.
- source code - -
- -
-   - - - - - - -
__setitem__(self, - hostname, - entry) - source code - -
- -
-   - - - - - - -
add(self, - hostname, - keytype, - key)
- Add a host key entry to the table.
- source code - -
- -
- bool - - - - - - -
check(self, - hostname, - key)
- Return True if the given key is associated with the given hostname in - this dictionary.
- source code - -
- -
-   - - - - - - -
clear(self)
- Remove all host keys from the dictionary.
- source code - -
- -
-   - - - - - - -
keys(self) - source code - -
- -
-   - - - - - - -
load(self, - filename)
- Read a file of known SSH host keys, in the format used by openssh.
- source code - -
- -
- dict(str, PKey) - - - - - - -
lookup(self, - hostname)
- Find a hostkey entry for a given hostname or IP.
- source code - -
- -
-   - - - - - - -
save(self, - filename)
- Save host keys into a file, in the format used by openssh.
- source code - -
- -
-   - - - - - - -
values(self) - source code - -
- -
-

Inherited from UserDict.DictMixin: - __cmp__, - __contains__, - __iter__, - __len__, - __repr__, - get, - has_key, - items, - iteritems, - iterkeys, - itervalues, - pop, - popitem, - setdefault, - update -

-
- - - - - - - - - -
- Static Methods
- str - - - - - - -
hash_host(hostname, - salt=None)
- Return a "hashed" form of the hostname, as used by openssh - when storing hashed hostnames in the known_hosts file.
- source code - -
- -
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - filename=None) -
(Constructor) -

-
source code  -
- -

Create a new HostKeys object, optionally loading keys from an openssh - style host-key file.

-
-
Parameters:
-
    -
  • filename (str) - filename to load host keys from, or None
  • -
-
-
-
- -
- -
- - -
-

add(self, - hostname, - keytype, - key) -

-
source code  -
- -

Add a host key entry to the table. Any existing entry for a - (hostname, keytype) pair will be replaced.

-
-
Parameters:
-
    -
  • hostname (str) - the hostname (or IP) to add
  • -
  • keytype (str) - key type ("ssh-rsa" or - "ssh-dss")
  • -
  • key (PKey) - the key to add
  • -
-
-
-
- -
- -
- - -
-

check(self, - hostname, - key) -

-
source code  -
- -

Return True if the given key is associated with the given hostname in - this dictionary.

-
-
Parameters:
-
    -
  • hostname (str) - hostname (or IP) of the SSH server
  • -
  • key (PKey) - the key to check
  • -
-
Returns: bool
-
True if the key is associated with the hostname; - False if not
-
-
-
- -
- -
- - -
-

clear(self) -

-
source code  -
- -

Remove all host keys from the dictionary.

-
-
Overrides: - UserDict.DictMixin.clear -
-
-
-
- -
- -
- - -
-

hash_host(hostname, - salt=None) -
Static Method -

-
source code  -
- -

Return a "hashed" form of the hostname, as used by openssh - when storing hashed hostnames in the known_hosts file.

-
-
Parameters:
-
    -
  • hostname (str) - the hostname to hash
  • -
  • salt (str) - optional salt to use when hashing (must be 20 bytes long)
  • -
-
Returns: str
-
the hashed hostname
-
-
-
- -
- -
- - -
-

load(self, - filename) -

-
source code  -
- -

Read a file of known SSH host keys, in the format used by openssh. - This type of file unfortunately doesn't exist on Windows, but on posix, - it will usually be stored in - os.path.expanduser("~/.ssh/known_hosts").

-

If this method is called multiple times, the host keys are merged, not - cleared. So multiple calls to load will just call add, replacing - any existing entries and adding new ones.

-
-
Parameters:
-
    -
  • filename (str) - name of the file to read host keys from
  • -
-
Raises:
-
    -
  • IOError - if there was an error reading the file
  • -
-
-
-
- -
- -
- - -
-

lookup(self, - hostname) -

-
source code  -
- -

Find a hostkey entry for a given hostname or IP. If no entry is - found, None is returned. Otherwise a dictionary of keytype - to key is returned. The keytype will be either - "ssh-rsa" or "ssh-dss".

-
-
Parameters:
-
    -
  • hostname (str) - the hostname (or IP) to lookup
  • -
-
Returns: dict(str, PKey)
-
keys associated with this host (or None)
-
-
-
- -
- -
- - -
-

save(self, - filename) -

-
source code  -
- -

Save host keys into a file, in the format used by openssh. The order - of keys in the file will be preserved when possible (if these keys were - loaded from a file originally). The single exception is that combined - lines will be split into individual key lines, which is arguably a - bug.

-
-
Parameters:
-
    -
  • filename (str) - name of the file to write
  • -
-
Raises:
-
    -
  • IOError - if there was an error writing the file
  • -
-
-

Since: - 1.6.1 -

-
-
- -
- -
- - -
-

values(self) -

-
source code  -
- - -
-
Overrides: - UserDict.DictMixin.values -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.Message-class.html b/docs/paramiko.Message-class.html deleted file mode 100644 index 6e7d0be..0000000 --- a/docs/paramiko.Message-class.html +++ /dev/null @@ -1,1101 +0,0 @@ - - - - - paramiko.Message - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class Message - - - - - -
[frames] | no frames]
-
- -

Class Message

source code

-
-object --+
-         |
-        Message
-
- -
-

An SSH2 Message is a stream of bytes that encodes some - combination of strings, integers, bools, and infinite-precision integers - (known in python as longs). This class builds or breaks down such - a byte stream.

-

Normally you don't need to deal with anything this low-level, but it's - exposed for people implementing custom extensions, or features that - paramiko doesn't support yet.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - content=None)
- Create a new SSH2 Message.
- source code - -
- -
- string - - - - - - -
__repr__(self)
- Returns a string representation of this object, for debugging.
- source code - -
- -
- string - - - - - - -
__str__(self)
- Return the byte stream content of this Message, as a string.
- source code - -
- -
-   - - - - - - -
add(self, - *seq)
- Add a sequence of items to the stream.
- source code - -
- -
-   - - - - - - -
add_boolean(self, - b)
- Add a boolean value to the stream.
- source code - -
- -
-   - - - - - - -
add_byte(self, - b)
- Write a single byte to the stream, without any formatting.
- source code - -
- -
-   - - - - - - -
add_bytes(self, - b)
- Write bytes to the stream, without any formatting.
- source code - -
- -
-   - - - - - - -
add_int(self, - n)
- Add an integer to the stream.
- source code - -
- -
-   - - - - - - -
add_int64(self, - n)
- Add a 64-bit int to the stream.
- source code - -
- -
-   - - - - - - -
add_list(self, - l)
- Add a list of strings to the stream.
- source code - -
- -
-   - - - - - - -
add_mpint(self, - z)
- Add a long int to the stream, encoded as an infinite-precision - integer.
- source code - -
- -
-   - - - - - - -
add_string(self, - s)
- Add a string to the stream.
- source code - -
- -
- bool - - - - - - -
get_boolean(self)
- Fetch a boolean from the stream.
- source code - -
- -
- string - - - - - - -
get_byte(self)
- Return the next byte of the Message, without decomposing it.
- source code - -
- -
- string - - - - - - -
get_bytes(self, - n)
- Return the next n bytes of the Message, without - decomposing into an int, string, etc.
- source code - -
- -
- int - - - - - - -
get_int(self)
- Fetch an int from the stream.
- source code - -
- -
- long - - - - - - -
get_int64(self)
- Fetch a 64-bit int from the stream.
- source code - -
- -
- list of strings - - - - - - -
get_list(self)
- Fetch a list of strings from the stream.
- source code - -
- -
- long - - - - - - -
get_mpint(self)
- Fetch a long int (mpint) from the stream.
- source code - -
- -
- string - - - - - - -
get_remainder(self)
- Return the bytes of this Message that haven't already been parsed and - returned.
- source code - -
- -
- string - - - - - - -
get_so_far(self)
- Returns the bytes of this Message that have been parsed and returned.
- source code - -
- -
- string - - - - - - -
get_string(self)
- Fetch a string from the stream.
- source code - -
- -
-   - - - - - - -
rewind(self)
- Rewind the message to the beginning as if no items had been parsed - out of it yet.
- source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - content=None) -
(Constructor) -

-
source code  -
- -

Create a new SSH2 Message.

-
-
Parameters:
-
    -
  • content (string) - the byte stream to use as the Message content (passed in only - when decomposing a Message).
  • -
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

__repr__(self) -
(Representation operator) -

-
source code  -
- -

Returns a string representation of this object, for debugging.

-
-
Returns: string
-
Overrides: - object.__repr__ -
-
-
-
- -
- -
- - -
-

__str__(self) -
(Informal representation operator) -

-
source code  -
- -

Return the byte stream content of this Message, as a string.

-
-
Returns: string
-
the contents of this Message.
-
Overrides: - object.__str__ -
-
-
-
- -
- -
- - -
-

add(self, - *seq) -

-
source code  -
- -

Add a sequence of items to the stream. The values are encoded based - on their type: str, int, bool, list, or long.

-
-
Parameters:
-
    -
  • seq (sequence) - the sequence of items
  • -
-
-

Bug: - longs are encoded non-deterministically. Don't use this method. -

-
-
- -
- -
- - -
-

add_boolean(self, - b) -

-
source code  -
- -

Add a boolean value to the stream.

-
-
Parameters:
-
    -
  • b (bool) - boolean value to add
  • -
-
-
-
- -
- -
- - -
-

add_byte(self, - b) -

-
source code  -
- -

Write a single byte to the stream, without any formatting.

-
-
Parameters:
-
    -
  • b (str) - byte to add
  • -
-
-
-
- -
- -
- - -
-

add_bytes(self, - b) -

-
source code  -
- -

Write bytes to the stream, without any formatting.

-
-
Parameters:
-
    -
  • b (str) - bytes to add
  • -
-
-
-
- -
- -
- - -
-

add_int(self, - n) -

-
source code  -
- -

Add an integer to the stream.

-
-
Parameters:
-
    -
  • n (int) - integer to add
  • -
-
-
-
- -
- -
- - -
-

add_int64(self, - n) -

-
source code  -
- -

Add a 64-bit int to the stream.

-
-
Parameters:
-
    -
  • n (long) - long int to add
  • -
-
-
-
- -
- -
- - -
-

add_list(self, - l) -

-
source code  -
- -

Add a list of strings to the stream. They are encoded identically to - a single string of values separated by commas. (Yes, really, that's how - SSH2 does it.)

-
-
Parameters:
-
    -
  • l (list(str)) - list of strings to add
  • -
-
-
-
- -
- -
- - -
-

add_mpint(self, - z) -

-
source code  -
- -

Add a long int to the stream, encoded as an infinite-precision - integer. This method only works on positive numbers.

-
-
Parameters:
-
    -
  • z (long) - long int to add
  • -
-
-
-
- -
- -
- - -
-

add_string(self, - s) -

-
source code  -
- -

Add a string to the stream.

-
-
Parameters:
-
    -
  • s (str) - string to add
  • -
-
-
-
- -
- -
- - -
-

get_boolean(self) -

-
source code  -
- -

Fetch a boolean from the stream.

-
-
Returns: bool
-
True or False (from the Message).
-
-
-
- -
- -
- - -
-

get_byte(self) -

-
source code  -
- -

Return the next byte of the Message, without decomposing it. This is - equivalent to get_bytes(1).

-
-
Returns: string
-
the next byte of the Message, or '' if there aren't - any bytes remaining.
-
-
-
- -
- -
- - -
-

get_bytes(self, - n) -

-
source code  -
- -

Return the next n bytes of the Message, without - decomposing into an int, string, etc. Just the raw bytes are - returned.

-
-
Returns: string
-
a string of the next n bytes of the Message, or a - string of n zero bytes, if there aren't - n bytes remaining.
-
-
-
- -
- -
- - -
-

get_int(self) -

-
source code  -
- -

Fetch an int from the stream.

-
-
Returns: int
-
a 32-bit unsigned integer.
-
-
-
- -
- -
- - -
-

get_int64(self) -

-
source code  -
- -

Fetch a 64-bit int from the stream.

-
-
Returns: long
-
a 64-bit unsigned integer.
-
-
-
- -
- -
- - -
-

get_list(self) -

-
source code  -
- -

Fetch a list of strings from the stream. These are trivially encoded - as comma-separated values in a string.

-
-
Returns: list of strings
-
a list of strings.
-
-
-
- -
- -
- - -
-

get_mpint(self) -

-
source code  -
- -

Fetch a long int (mpint) from the stream.

-
-
Returns: long
-
an arbitrary-length integer.
-
-
-
- -
- -
- - -
-

get_remainder(self) -

-
source code  -
- -

Return the bytes of this Message that haven't already been parsed and - returned.

-
-
Returns: string
-
a string of the bytes not parsed yet.
-
-
-
- -
- -
- - -
-

get_so_far(self) -

-
source code  -
- -

Returns the bytes of this Message that have been parsed and returned. - The string passed into a Message's constructor can be regenerated by - concatenating get_so_far and get_remainder.

-
-
Returns: string
-
a string of the bytes parsed so far.
-
-
-
- -
- -
- - -
-

get_string(self) -

-
source code  -
- -

Fetch a string from the stream. This could be a byte string and may - contain unprintable characters. (It's not unheard of for a string to - contain another byte-stream Message.)

-
-
Returns: string
-
a string.
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.MissingHostKeyPolicy-class.html b/docs/paramiko.MissingHostKeyPolicy-class.html deleted file mode 100644 index eb51517..0000000 --- a/docs/paramiko.MissingHostKeyPolicy-class.html +++ /dev/null @@ -1,232 +0,0 @@ - - - - - paramiko.MissingHostKeyPolicy - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class MissingHostKeyPolicy - - - - - -
[frames] | no frames]
-
- -

Class MissingHostKeyPolicy

source code

-
-object --+
-         |
-        MissingHostKeyPolicy
-
- -
Known Subclasses:
-
- -
- -
-

Interface for defining the policy that SSHClient should - use when the SSH server's hostname is not in either the system host keys - or the application's keys. Pre-made classes implement policies for - automatically adding the key to the application's HostKeys object (AutoAddPolicy), - and for automatically rejecting the key (RejectPolicy).

-

This function may be used to ask the user to verify the key, for - example.

- - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
missing_host_key(self, - client, - hostname, - key)
- Called when an SSHClient receives a server key for a server that - isn't in either the system or local HostKeys object.
- source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

missing_host_key(self, - client, - hostname, - key) -

-
source code  -
- -

Called when an SSHClient receives a server key for a server that isn't - in either the system or local HostKeys object. To accept the key, simply return. To - reject, raised an exception (which will be passed to the calling - application).

-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.PKey-class.html b/docs/paramiko.PKey-class.html deleted file mode 100644 index 1759963..0000000 --- a/docs/paramiko.PKey-class.html +++ /dev/null @@ -1,857 +0,0 @@ - - - - - paramiko.PKey - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class PKey - - - - - -
[frames] | no frames]
-
- -

Class PKey

source code

-
-object --+
-         |
-        PKey
-
- -
Known Subclasses:
-
- -
- -
-

Base class for public keys.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Instance Methods
- int - - - - - - -
__cmp__(self, - other)
- Compare this key to another.
- source code - -
- -
-   - - - - - - -
__init__(self, - msg=None, - data=None)
- Create a new instance of this public key type.
- source code - -
- -
- str - - - - - - -
__str__(self)
- Return a string of an SSH Message made up of the public part(s) of this key.
- source code - -
- -
- bool - - - - - - -
can_sign(self)
- Return True if this key has the private part necessary - for signing data.
- source code - -
- -
- str - - - - - - -
get_base64(self)
- Return a base64 string containing the public part of this key.
- source code - -
- -
- int - - - - - - -
get_bits(self)
- Return the number of significant bits in this key.
- source code - -
- -
- str - - - - - - -
get_fingerprint(self)
- Return an MD5 fingerprint of the public part of this key.
- source code - -
- -
- str - - - - - - -
get_name(self)
- Return the name of this private key implementation.
- source code - -
- -
- Message - - - - - - -
sign_ssh_data(self, - rng, - data)
- Sign a blob of data with this private key, and return a Message - representing an SSH signature message.
- source code - -
- -
- boolean - - - - - - -
verify_ssh_sig(self, - data, - msg)
- Given a blob of data, and an SSH message representing a signature of - that data, verify that it was signed with this key.
- source code - -
- -
-   - - - - - - -
write_private_key(self, - file_obj, - password=None)
- Write private key contents into a file (or file-like) object.
- source code - -
- -
-   - - - - - - -
write_private_key_file(self, - filename, - password=None)
- Write private key contents into a file.
- source code - -
- -
-

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

-
- - - - - - - - - - - - -
- Class Methods
- PKey - - - - - - -
from_private_key(cls, - file_obj, - password=None)
- Create a key object by reading a private key from a file (or - file-like) object.
- source code - -
- -
- PKey - - - - - - -
from_private_key_file(cls, - filename, - password=None)
- Create a key object by reading a private key file.
- source code - -
- -
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__cmp__(self, - other) -
(Comparison operator) -

-
source code  -
- -

Compare this key to another. Returns 0 if this key is equivalent to - the given key, or non-0 if they are different. Only the public parts of - the key are compared, so a public key will compare equal to its - corresponding private key.

-
-
Parameters:
-
    -
  • other (PKey) - key to compare to.
  • -
-
Returns: int
-
0 if the two keys are equivalent, non-0 otherwise.
-
-
-
- -
- -
- - -
-

__init__(self, - msg=None, - data=None) -
(Constructor) -

-
source code  -
- -

Create a new instance of this public key type. If msg is - given, the key's public part(s) will be filled in from the message. If - data is given, the key's public part(s) will be filled in - from the string.

-
-
Parameters:
-
    -
  • msg (Message) - an optional SSH Message containing a public key of this type.
  • -
  • data (str) - an optional string containing a public key of this type
  • -
-
Raises:
-
    -
  • SSHException - if a key cannot be created from the data or - msg given, or no key was passed in.
  • -
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

__str__(self) -
(Informal representation operator) -

-
source code  -
- -

Return a string of an SSH Message made up of the public part(s) of this key. This - string is suitable for passing to __init__ to - re-create the key object later.

-
-
Returns: str
-
string representation of an SSH key message.
-
Overrides: - object.__str__ -
-
-
-
- -
- -
- - -
-

can_sign(self) -

-
source code  -
- -

Return True if this key has the private part necessary - for signing data.

-
-
Returns: bool
-
True if this is a private key.
-
-
-
- -
- -
- - -
-

from_private_key(cls, - file_obj, - password=None) -
Class Method -

-
source code  -
- -

Create a key object by reading a private key from a file (or - file-like) object. If the private key is encrypted and - password is not None, the given password will - be used to decrypt the key (otherwise PasswordRequiredException is thrown).

-
-
Parameters:
-
    -
  • file_obj (file) - the file to read from
  • -
  • password (str) - an optional password to use to decrypt the key, if it's encrypted
  • -
-
Returns: PKey
-
a new key object based on the given private key
-
Raises:
-
    -
  • IOError - if there was an error reading the key
  • -
  • PasswordRequiredException - if the private key file is encrypted, and password is - None
  • -
  • SSHException - if the key file is invalid
  • -
-
-
-
- -
- -
- - -
-

from_private_key_file(cls, - filename, - password=None) -
Class Method -

-
source code  -
- -

Create a key object by reading a private key file. If the private key - is encrypted and password is not None, the - given password will be used to decrypt the key (otherwise PasswordRequiredException is thrown). Through the magic - of python, this factory method will exist in all subclasses of PKey (such - as RSAKey or DSSKey), but is - useless on the abstract PKey class.

-
-
Parameters:
-
    -
  • filename (str) - name of the file to read
  • -
  • password (str) - an optional password to use to decrypt the key file, if it's - encrypted
  • -
-
Returns: PKey
-
a new key object based on the given private key
-
Raises:
-
    -
  • IOError - if there was an error reading the file
  • -
  • PasswordRequiredException - if the private key file is encrypted, and password is - None
  • -
  • SSHException - if the key file is invalid
  • -
-
-
-
- -
- -
- - -
-

get_base64(self) -

-
source code  -
- -

Return a base64 string containing the public part of this key. - Nothing secret is revealed. This format is compatible with that used to - store public key files or recognized host keys.

-
-
Returns: str
-
a base64 string containing the public part of the key.
-
-
-
- -
- -
- - -
-

get_bits(self) -

-
source code  -
- -

Return the number of significant bits in this key. This is useful for - judging the relative security of a key.

-
-
Returns: int
-
bits in the key.
-
-
-
- -
- -
- - -
-

get_fingerprint(self) -

-
source code  -
- -

Return an MD5 fingerprint of the public part of this key. Nothing - secret is revealed.

-
-
Returns: str
-
a 16-byte string (binary) of the MD5 fingerprint, in SSH format.
-
-
-
- -
- -
- - -
-

get_name(self) -

-
source code  -
- -

Return the name of this private key implementation.

-
-
Returns: str
-
name of this private key type, in SSH terminology (for example, - "ssh-rsa").
-
-
-
- -
- -
- - -
-

sign_ssh_data(self, - rng, - data) -

-
source code  -
- -

Sign a blob of data with this private key, and return a Message representing - an SSH signature message.

-
-
Parameters:
-
    -
  • rng (Crypto.Util.rng.RandomPool) - a secure random number generator.
  • -
  • data (str) - the data to sign.
  • -
-
Returns: Message
-
an SSH signature message.
-
-
-
- -
- -
- - -
-

verify_ssh_sig(self, - data, - msg) -

-
source code  -
- -

Given a blob of data, and an SSH message representing a signature of - that data, verify that it was signed with this key.

-
-
Parameters:
-
    -
  • data (str) - the data that was signed.
  • -
  • msg (Message) - an SSH signature message
  • -
-
Returns: boolean
-
True if the signature verifies correctly; - False otherwise.
-
-
-
- -
- -
- - -
-

write_private_key(self, - file_obj, - password=None) -

-
source code  -
- -

Write private key contents into a file (or file-like) object. If the - password is not None, the key is encrypted before - writing.

-
-
Parameters:
-
    -
  • file_obj (file) - the file object to write into
  • -
  • password (str) - an optional password to use to encrypt the key
  • -
-
Raises:
-
    -
  • IOError - if there was an error writing to the file
  • -
  • SSHException - if the key is invalid
  • -
-
-
-
- -
- -
- - -
-

write_private_key_file(self, - filename, - password=None) -

-
source code  -
- -

Write private key contents into a file. If the password is not - None, the key is encrypted before writing.

-
-
Parameters:
-
    -
  • filename (str) - name of the file to write
  • -
  • password (str) - an optional password to use to encrypt the key file
  • -
-
Raises:
-
    -
  • IOError - if there was an error writing the file
  • -
  • SSHException - if the key is invalid
  • -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.PasswordRequiredException-class.html b/docs/paramiko.PasswordRequiredException-class.html deleted file mode 100644 index 36c4cde..0000000 --- a/docs/paramiko.PasswordRequiredException-class.html +++ /dev/null @@ -1,176 +0,0 @@ - - - - - paramiko.PasswordRequiredException - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class PasswordRequiredException - - - - - -
[frames] | no frames]
-
- -

Class PasswordRequiredException

source code

-
-              object --+                
-                       |                
-exceptions.BaseException --+            
-                           |            
-        exceptions.Exception --+        
-                               |        
-                    SSHException --+    
-                                   |    
-             AuthenticationException --+
-                                       |
-                                      PasswordRequiredException
-
- -
-

Exception raised when a password is needed to unlock a private key - file.

- - - - - - - - - - -
- Instance Methods
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- Properties
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.RSAKey-class.html b/docs/paramiko.RSAKey-class.html deleted file mode 100644 index 27eeb53..0000000 --- a/docs/paramiko.RSAKey-class.html +++ /dev/null @@ -1,750 +0,0 @@ - - - - - paramiko.RSAKey - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class RSAKey - - - - - -
[frames] | no frames]
-
- -

Class RSAKey

source code

-
-object --+    
-         |    
-      PKey --+
-             |
-            RSAKey
-
- -
-

Representation of an RSA key which can be used to sign and verify SSH2 - data.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__hash__(self)
- hash(x)
- source code - -
- -
-   - - - - - - -
__init__(self, - msg=None, - data=None, - filename=None, - password=None, - vals=None, - file_obj=None)
- Create a new instance of this public key type.
- source code - -
- -
- str - - - - - - -
__str__(self)
- Return a string of an SSH Message made up of the public part(s) of this key.
- source code - -
- -
- bool - - - - - - -
can_sign(self)
- Return True if this key has the private part necessary - for signing data.
- source code - -
- -
- int - - - - - - -
get_bits(self)
- Return the number of significant bits in this key.
- source code - -
- -
- str - - - - - - -
get_name(self)
- Return the name of this private key implementation.
- source code - -
- -
- Message - - - - - - -
sign_ssh_data(self, - rpool, - data)
- Sign a blob of data with this private key, and return a Message - representing an SSH signature message.
- source code - -
- -
- boolean - - - - - - -
verify_ssh_sig(self, - data, - msg)
- Given a blob of data, and an SSH message representing a signature of - that data, verify that it was signed with this key.
- source code - -
- -
-   - - - - - - -
write_private_key(self, - file_obj, - password=None)
- Write private key contents into a file (or file-like) object.
- source code - -
- -
-   - - - - - - -
write_private_key_file(self, - filename, - password=None)
- Write private key contents into a file.
- source code - -
- -
-

Inherited from PKey: - __cmp__, - get_base64, - get_fingerprint -

-

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

-
- - - - - - - - - -
- Class Methods
-

Inherited from PKey: - from_private_key, - from_private_key_file -

-
- - - - - - - - - -
- Static Methods
- RSAKey - - - - - - -
generate(bits, - progress_func=None)
- Generate a new private RSA key.
- source code - -
- -
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__hash__(self) -
(Hashing function) -

-
source code  -
- -

hash(x)

-
-
Overrides: - object.__hash__ -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

__init__(self, - msg=None, - data=None, - filename=None, - password=None, - vals=None, - file_obj=None) -
(Constructor) -

-
source code  -
- -

Create a new instance of this public key type. If msg is - given, the key's public part(s) will be filled in from the message. If - data is given, the key's public part(s) will be filled in - from the string.

-
-
Parameters:
-
    -
  • msg - an optional SSH Message containing a public key of this type.
  • -
  • data - an optional string containing a public key of this type
  • -
-
Raises:
-
    -
  • SSHException - if a key cannot be created from the data or - msg given, or no key was passed in.
  • -
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

__str__(self) -
(Informal representation operator) -

-
source code  -
- -

Return a string of an SSH Message made up of the public part(s) of this key. This - string is suitable for passing to __init__ to - re-create the key object later.

-
-
Returns: str
-
string representation of an SSH key message.
-
Overrides: - object.__str__ -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

can_sign(self) -

-
source code  -
- -

Return True if this key has the private part necessary - for signing data.

-
-
Returns: bool
-
True if this is a private key.
-
Overrides: - PKey.can_sign -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

generate(bits, - progress_func=None) -
Static Method -

-
source code  -
- -

Generate a new private RSA key. This factory function can be used to - generate a new host key or authentication key.

-
-
Parameters:
-
    -
  • bits (int) - number of bits the generated key should be.
  • -
  • progress_func (function) - an optional function to call at key points in key generation - (used by pyCrypto.PublicKey).
  • -
-
Returns: RSAKey
-
new private key
-
-
-
- -
- -
- - -
-

get_bits(self) -

-
source code  -
- -

Return the number of significant bits in this key. This is useful for - judging the relative security of a key.

-
-
Returns: int
-
bits in the key.
-
Overrides: - PKey.get_bits -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

get_name(self) -

-
source code  -
- -

Return the name of this private key implementation.

-
-
Returns: str
-
name of this private key type, in SSH terminology (for example, - "ssh-rsa").
-
Overrides: - PKey.get_name -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

sign_ssh_data(self, - rpool, - data) -

-
source code  -
- -

Sign a blob of data with this private key, and return a Message representing - an SSH signature message.

-
-
Parameters:
-
    -
  • rng - a secure random number generator.
  • -
  • data - the data to sign.
  • -
-
Returns: Message
-
an SSH signature message.
-
Overrides: - PKey.sign_ssh_data -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

verify_ssh_sig(self, - data, - msg) -

-
source code  -
- -

Given a blob of data, and an SSH message representing a signature of - that data, verify that it was signed with this key.

-
-
Parameters:
-
    -
  • data - the data that was signed.
  • -
  • msg - an SSH signature message
  • -
-
Returns: boolean
-
True if the signature verifies correctly; - False otherwise.
-
Overrides: - PKey.verify_ssh_sig -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

write_private_key(self, - file_obj, - password=None) -

-
source code  -
- -

Write private key contents into a file (or file-like) object. If the - password is not None, the key is encrypted before - writing.

-
-
Parameters:
-
    -
  • file_obj - the file object to write into
  • -
  • password - an optional password to use to encrypt the key
  • -
-
Raises:
-
    -
  • IOError - if there was an error writing to the file
  • -
  • SSHException - if the key is invalid
  • -
-
Overrides: - PKey.write_private_key -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

write_private_key_file(self, - filename, - password=None) -

-
source code  -
- -

Write private key contents into a file. If the password is not - None, the key is encrypted before writing.

-
-
Parameters:
-
    -
  • filename - name of the file to write
  • -
  • password - an optional password to use to encrypt the key file
  • -
-
Raises:
-
    -
  • IOError - if there was an error writing the file
  • -
  • SSHException - if the key is invalid
  • -
-
Overrides: - PKey.write_private_key_file -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.RejectPolicy-class.html b/docs/paramiko.RejectPolicy-class.html deleted file mode 100644 index d5a9747..0000000 --- a/docs/paramiko.RejectPolicy-class.html +++ /dev/null @@ -1,223 +0,0 @@ - - - - - paramiko.RejectPolicy - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class RejectPolicy - - - - - -
[frames] | no frames]
-
- -

Class RejectPolicy

source code

-
-          object --+    
-                   |    
-MissingHostKeyPolicy --+
-                       |
-                      RejectPolicy
-
- -
-

Policy for automatically rejecting the unknown hostname & key. - This is used by SSHClient.

- - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
missing_host_key(self, - client, - hostname, - key)
- Called when an SSHClient receives a server key for a server that - isn't in either the system or local HostKeys object.
- source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

missing_host_key(self, - client, - hostname, - key) -

-
source code  -
- -

Called when an SSHClient receives a server key for a server that isn't - in either the system or local HostKeys object. To accept the key, simply return. To - reject, raised an exception (which will be passed to the calling - application).

-
-
Overrides: - MissingHostKeyPolicy.missing_host_key -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.SFTP-class.html b/docs/paramiko.SFTP-class.html deleted file mode 100644 index 35767af..0000000 --- a/docs/paramiko.SFTP-class.html +++ /dev/null @@ -1,202 +0,0 @@ - - - - - paramiko.SFTP - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SFTP - - - - - -
[frames] | no frames]
-
- -

Class SFTP

source code

-
-object --+        
-         |        
-  BaseSFTP --+    
-             |    
-    SFTPClient --+
-                 |
-                SFTP
-
- -
-

an alias for SFTPClient for backwards compatability

- - - - - - - - - - -
- Instance Methods
-

Inherited from SFTPClient: - __init__, - chdir, - chmod, - chown, - close, - file, - get, - get_channel, - getcwd, - listdir, - listdir_attr, - lstat, - mkdir, - normalize, - open, - put, - readlink, - remove, - rename, - rmdir, - stat, - symlink, - truncate, - unlink, - utime -

-

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

-
- - - - - - - - - -
- Class Methods
-

Inherited from SFTPClient: - from_transport -

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.SFTPAttributes-class.html b/docs/paramiko.SFTPAttributes-class.html deleted file mode 100644 index 0724b9b..0000000 --- a/docs/paramiko.SFTPAttributes-class.html +++ /dev/null @@ -1,418 +0,0 @@ - - - - - paramiko.SFTPAttributes - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SFTPAttributes - - - - - -
[frames] | no frames]
-
- -

Class SFTPAttributes

source code

-
-object --+
-         |
-        SFTPAttributes
-
- -
-

Representation of the attributes of a file (or proxied file) for SFTP - in client or server mode. It attemps to mirror the object returned by - os.stat as closely as possible, so it may have the following - fields, with the same meanings as those returned by an - os.stat object:

-
    -
  • - st_size -
  • -
  • - st_uid -
  • -
  • - st_gid -
  • -
  • - st_mode -
  • -
  • - st_atime -
  • -
  • - st_mtime -
  • -
-

Because SFTP allows flags to have other arbitrary named attributes, - these are stored in a dict named attr. Occasionally, the - filename is also stored, in filename.

- - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self)
- Create a new (empty) SFTPAttributes object.
- source code - -
- -
-   - - - - - - -
__repr__(self)
- repr(x)
- source code - -
- -
-   - - - - - - -
__str__(self)
- create a unix-style long description of the file (like ls -l)
- source code - -
- -
-

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

-
- - - - - - - - - -
- Class Methods
- SFTPAttributes - - - - - - -
from_stat(cls, - obj, - filename=None)
- Create an SFTPAttributes object from an existing stat - object (an object returned by os.stat).
- source code - -
- -
- - - - - - - - - - - - - - - - - - - - - -
- Class Variables
-   - - FLAG_AMTIME = 8 -
-   - - FLAG_EXTENDED = 2147483648 -
-   - - FLAG_PERMISSIONS = 4 -
-   - - FLAG_SIZE = 1 -
-   - - FLAG_UIDGID = 2 -
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self) -
(Constructor) -

-
source code  -
- -

Create a new (empty) SFTPAttributes object. All fields will be - empty.

-
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

__repr__(self) -
(Representation operator) -

-
source code  -
- -

repr(x)

-
-
Overrides: - object.__repr__ -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

__str__(self) -
(Informal representation operator) -

-
source code  -
- -

create a unix-style long description of the file (like ls -l)

-
-
Overrides: - object.__str__ -
-
-
-
- -
- -
- - -
-

from_stat(cls, - obj, - filename=None) -
Class Method -

-
source code  -
- -

Create an SFTPAttributes object from an existing stat - object (an object returned by os.stat).

-
-
Parameters:
-
    -
  • obj (object) - an object returned by os.stat (or equivalent).
  • -
  • filename (str) - the filename associated with this file.
  • -
-
Returns: SFTPAttributes
-
new SFTPAttributes object with the same attribute - fields.
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.SFTPClient-class.html b/docs/paramiko.SFTPClient-class.html deleted file mode 100644 index d6b7abd..0000000 --- a/docs/paramiko.SFTPClient-class.html +++ /dev/null @@ -1,1536 +0,0 @@ - - - - - paramiko.SFTPClient - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SFTPClient - - - - - -
[frames] | no frames]
-
- -

Class SFTPClient

source code

-
-object --+    
-         |    
-  BaseSFTP --+
-             |
-            SFTPClient
-
- -
Known Subclasses:
-
- -
- -
-

SFTP client object. SFTPClient is used to open an sftp - session across an open ssh Transport and do remote file operations.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - sock)
- Create an SFTP client from an existing Channel.
- source code - -
- -
-   - - - - - - -
chdir(self, - path)
- Change the "current directory" of this SFTP session.
- source code - -
- -
-   - - - - - - -
chmod(self, - path, - mode)
- Change the mode (permissions) of a file.
- source code - -
- -
-   - - - - - - -
chown(self, - path, - uid, - gid)
- Change the owner (uid) and group (gid) of a - file.
- source code - -
- -
-   - - - - - - -
close(self)
- Close the SFTP session and its underlying channel.
- source code - -
- -
- SFTPFile - - - - - - -
file(self, - filename, - mode='r', - bufsize=-1)
- Open a file on the remote server.
- source code - -
- -
-   - - - - - - -
get(self, - remotepath, - localpath, - callback=None)
- Copy a remote file (remotepath) from the SFTP server to - the local host as localpath.
- source code - -
- -
- Channel - - - - - - -
get_channel(self)
- Return the underlying Channel object for this SFTP session.
- source code - -
- -
- str - - - - - - -
getcwd(self)
- Return the "current working directory" for this SFTP - session, as emulated by paramiko.
- source code - -
- -
- list of str - - - - - - -
listdir(self, - path='.')
- Return a list containing the names of the entries in the given - path.
- source code - -
- -
- list of SFTPAttributes - - - - - - -
listdir_attr(self, - path='.')
- Return a list containing SFTPAttributes objects corresponding to files in the - given path.
- source code - -
- -
- SFTPAttributes - - - - - - -
lstat(self, - path)
- Retrieve information about a file on the remote system, without - following symbolic links (shortcuts).
- source code - -
- -
-   - - - - - - -
mkdir(self, - path, - mode=511)
- Create a folder (directory) named path with numeric mode - mode.
- source code - -
- -
- str - - - - - - -
normalize(self, - path)
- Return the normalized path (on the server) of a given path.
- source code - -
- -
- SFTPFile - - - - - - -
open(self, - filename, - mode='r', - bufsize=-1)
- Open a file on the remote server.
- source code - -
- -
- SFTPAttributes - - - - - - -
put(self, - localpath, - remotepath, - callback=None, - confirm=True)
- Copy a local file (localpath) to the SFTP server as - remotepath.
- source code - -
- -
- str - - - - - - -
readlink(self, - path)
- Return the target of a symbolic link (shortcut).
- source code - -
- -
-   - - - - - - -
remove(self, - path)
- Remove the file at the given path.
- source code - -
- -
-   - - - - - - -
rename(self, - oldpath, - newpath)
- Rename a file or folder from oldpath to - newpath.
- source code - -
- -
-   - - - - - - -
rmdir(self, - path)
- Remove the folder named path.
- source code - -
- -
- SFTPAttributes - - - - - - -
stat(self, - path)
- Retrieve information about a file on the remote system.
- source code - -
- -
-   - - - - - - -
symlink(self, - source, - dest)
- Create a symbolic link (shortcut) of the source path at - destination.
- source code - -
- -
-   - - - - - - -
truncate(self, - path, - size)
- Change the size of the file specified by path.
- source code - -
- -
-   - - - - - - -
unlink(self, - path)
- Remove the file at the given path.
- source code - -
- -
-   - - - - - - -
utime(self, - path, - times)
- Set the access and modified times of the file specified by - path.
- source code - -
- -
-

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

-
- - - - - - - - - -
- Class Methods
- SFTPClient - - - - - - -
from_transport(cls, - t)
- Create an SFTP client channel from an open Transport.
- source code - -
- -
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - sock) -
(Constructor) -

-
source code  -
- -

Create an SFTP client from an existing Channel. The channel - should already have requested the "sftp" - subsystem.

-

An alternate way to create an SFTP client context is by using from_transport.

-
-
Parameters:
-
-
Raises:
-
    -
  • SSHException - if there's an exception while negotiating sftp
  • -
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

chdir(self, - path) -

-
source code  -
- -

Change the "current directory" of this SFTP session. Since - SFTP doesn't really have the concept of a current working directory, this - is emulated by paramiko. Once you use this method to set a working - directory, all operations on this SFTPClient object will be relative to - that path. You can pass in None to stop using a current - working directory.

-
-
Parameters:
-
    -
  • path (str) - new current working directory
  • -
-
Raises:
-
    -
  • IOError - if the requested path doesn't exist on the server
  • -
-
-

Since: - 1.4 -

-
-
- -
- -
- - -
-

chmod(self, - path, - mode) -

-
source code  -
- -

Change the mode (permissions) of a file. The permissions are - unix-style and identical to those used by python's os.chmod - function.

-
-
Parameters:
-
    -
  • path (str) - path of the file to change the permissions of
  • -
  • mode (int) - new permissions
  • -
-
-
-
- -
- -
- - -
-

chown(self, - path, - uid, - gid) -

-
source code  -
- -

Change the owner (uid) and group (gid) of a - file. As with python's os.chown function, you must pass - both arguments, so if you only want to change one, use stat first to - retrieve the current owner and group.

-
-
Parameters:
-
    -
  • path (str) - path of the file to change the owner and group of
  • -
  • uid (int) - new owner's uid
  • -
  • gid (int) - new group id
  • -
-
-
-
- -
- -
- - -
-

close(self) -

-
source code  -
- -

Close the SFTP session and its underlying channel.

-
-
-

Since: - 1.4 -

-
-
- -
- -
- - -
-

file(self, - filename, - mode='r', - bufsize=-1) -

-
source code  -
- -

Open a file on the remote server. The arguments are the same as for - python's built-in file (aka open). A file-like - object is returned, which closely mimics the behavior of a normal python - file object.

-

The mode indicates how the file is to be opened: 'r' for - reading, 'w' for writing (truncating an existing file), - 'a' for appending, 'r+' for reading/writing, - 'w+' for reading/writing (truncating an existing file), - 'a+' for reading/appending. The python 'b' - flag is ignored, since SSH treats all files as binary. The - 'U' flag is supported in a compatible way.

-

Since 1.5.2, an 'x' flag indicates that the operation - should only succeed if the file was created and did not previously exist. - This has no direct mapping to python's file flags, but is commonly known - as the O_EXCL flag in posix.

-

The file will be buffered in standard python style by default, but can - be altered with the bufsize parameter. 0 turns - off buffering, 1 uses line buffering, and any number greater - than 1 (>1) uses that specific buffer size.

-
-
Parameters:
-
    -
  • filename (str) - name of the file to open
  • -
  • mode (str) - mode (python-style) to open in
  • -
  • bufsize (int) - desired buffering (-1 = default buffer size)
  • -
-
Returns: SFTPFile
-
a file object representing the open file
-
Raises:
-
    -
  • IOError - if the file could not be opened.
  • -
-
-
-
- -
- -
- - -
-

from_transport(cls, - t) -
Class Method -

-
source code  -
- -

Create an SFTP client channel from an open Transport.

-
-
Parameters:
-
-
Returns: SFTPClient
-
a new SFTPClient object, referring to an sftp session - (channel) across the transport
-
-
-
- -
- -
- - -
-

get(self, - remotepath, - localpath, - callback=None) -

-
source code  -
- -

Copy a remote file (remotepath) from the SFTP server to - the local host as localpath. Any exception raised by - operations will be passed through. This method is primarily provided as - a convenience.

-
-
Parameters:
-
    -
  • remotepath (str) - the remote file to copy
  • -
  • localpath (str) - the destination path on the local host
  • -
  • callback (function(int, int)) - optional callback function that accepts the bytes transferred so - far and the total bytes to be transferred (since 1.7.4)
  • -
-
-

Since: - 1.4 -

-
-
- -
- -
- - -
-

get_channel(self) -

-
source code  -
- -

Return the underlying Channel object for this SFTP session. This might be - useful for doing things like setting a timeout on the channel.

-
-
Returns: Channel
-
the SSH channel
-
-

Since: - 1.7.1 -

-
-
- -
- -
- - -
-

getcwd(self) -

-
source code  -
- -

Return the "current working directory" for this SFTP - session, as emulated by paramiko. If no directory has been set with chdir, this - method will return None.

-
-
Returns: str
-
the current working directory on the server, or None
-
-

Since: - 1.4 -

-
-
- -
- -
- - -
-

listdir(self, - path='.') -

-
source code  -
- -

Return a list containing the names of the entries in the given - path. The list is in arbitrary order. It does not include - the special entries '.' and '..' even if they - are present in the folder. This method is meant to mirror - os.listdir as closely as possible. For a list of full SFTPAttributes - objects, see listdir_attr.

-
-
Parameters:
-
    -
  • path (str) - path to list (defaults to '.')
  • -
-
Returns: list of str
-
list of filenames
-
-
-
- -
- -
- - -
-

listdir_attr(self, - path='.') -

-
source code  -
- -

Return a list containing SFTPAttributes objects corresponding to files in the - given path. The list is in arbitrary order. It does not - include the special entries '.' and '..' even - if they are present in the folder.

-

The returned SFTPAttributes objects will each have an additional - field: longname, which may contain a formatted string of the - file's attributes, in unix format. The content of this string will - probably depend on the SFTP server implementation.

-
-
Parameters:
-
    -
  • path (str) - path to list (defaults to '.')
  • -
-
Returns: list of SFTPAttributes
-
list of attributes
-
-

Since: - 1.2 -

-
-
- -
- -
- - -
-

lstat(self, - path) -

-
source code  -
- -

Retrieve information about a file on the remote system, without - following symbolic links (shortcuts). This otherwise behaves exactly the - same as stat.

-
-
Parameters:
-
    -
  • path (str) - the filename to stat
  • -
-
Returns: SFTPAttributes
-
an object containing attributes about the given file
-
-
-
- -
- -
- - -
-

mkdir(self, - path, - mode=511) -

-
source code  -
- -

Create a folder (directory) named path with numeric mode - mode. The default mode is 0777 (octal). On some systems, - mode is ignored. Where it is used, the current umask value is first - masked out.

-
-
Parameters:
-
    -
  • path (str) - name of the folder to create
  • -
  • mode (int) - permissions (posix-style) for the newly-created folder
  • -
-
-
-
- -
- -
- - -
-

normalize(self, - path) -

-
source code  -
- -

Return the normalized path (on the server) of a given path. This can - be used to quickly resolve symbolic links or determine what the server is - considering to be the "current folder" (by passing - '.' as path).

-
-
Parameters:
-
    -
  • path (str) - path to be normalized
  • -
-
Returns: str
-
normalized form of the given path
-
Raises:
-
    -
  • IOError - if the path can't be resolved on the server
  • -
-
-
-
- -
- -
- - -
-

open(self, - filename, - mode='r', - bufsize=-1) -

-
source code  -
- -

Open a file on the remote server. The arguments are the same as for - python's built-in file (aka open). A file-like - object is returned, which closely mimics the behavior of a normal python - file object.

-

The mode indicates how the file is to be opened: 'r' for - reading, 'w' for writing (truncating an existing file), - 'a' for appending, 'r+' for reading/writing, - 'w+' for reading/writing (truncating an existing file), - 'a+' for reading/appending. The python 'b' - flag is ignored, since SSH treats all files as binary. The - 'U' flag is supported in a compatible way.

-

Since 1.5.2, an 'x' flag indicates that the operation - should only succeed if the file was created and did not previously exist. - This has no direct mapping to python's file flags, but is commonly known - as the O_EXCL flag in posix.

-

The file will be buffered in standard python style by default, but can - be altered with the bufsize parameter. 0 turns - off buffering, 1 uses line buffering, and any number greater - than 1 (>1) uses that specific buffer size.

-
-
Parameters:
-
    -
  • filename (str) - name of the file to open
  • -
  • mode (str) - mode (python-style) to open in
  • -
  • bufsize (int) - desired buffering (-1 = default buffer size)
  • -
-
Returns: SFTPFile
-
a file object representing the open file
-
Raises:
-
    -
  • IOError - if the file could not be opened.
  • -
-
-
-
- -
- -
- - -
-

put(self, - localpath, - remotepath, - callback=None, - confirm=True) -

-
source code  -
- -

Copy a local file (localpath) to the SFTP server as - remotepath. Any exception raised by operations will be - passed through. This method is primarily provided as a convenience.

-

The SFTP operations use pipelining for speed.

-
-
Parameters:
-
    -
  • localpath (str) - the local file to copy
  • -
  • remotepath (str) - the destination path on the SFTP server
  • -
  • callback (function(int, int)) - optional callback function that accepts the bytes transferred so - far and the total bytes to be transferred (since 1.7.4)
  • -
  • confirm (bool) - whether to do a stat() on the file afterwards to confirm the file - size (since 1.7.7)
  • -
-
Returns: SFTPAttributes
-
an object containing attributes about the given file (since - 1.7.4)
-
-

Since: - 1.4 -

-
-
- -
- -
- - -
-

readlink(self, - path) -

-
source code  -
- -

Return the target of a symbolic link (shortcut). You can use symlink to - create these. The result may be either an absolute or relative - pathname.

-
-
Parameters:
-
    -
  • path (str) - path of the symbolic link file
  • -
-
Returns: str
-
target path
-
-
-
- -
- -
- - -
-

remove(self, - path) -

-
source code  -
- -

Remove the file at the given path. This only works on files; for - removing folders (directories), use rmdir.

-
-
Parameters:
-
    -
  • path (str) - path (absolute or relative) of the file to remove
  • -
-
Raises:
-
    -
  • IOError - if the path refers to a folder (directory)
  • -
-
-
-
- -
- -
- - -
-

rename(self, - oldpath, - newpath) -

-
source code  -
- -

Rename a file or folder from oldpath to - newpath.

-
-
Parameters:
-
    -
  • oldpath (str) - existing name of the file or folder
  • -
  • newpath (str) - new name for the file or folder
  • -
-
Raises:
-
    -
  • IOError - if newpath is a folder, or something else goes wrong
  • -
-
-
-
- -
- -
- - -
-

rmdir(self, - path) -

-
source code  -
- -

Remove the folder named path.

-
-
Parameters:
-
    -
  • path (str) - name of the folder to remove
  • -
-
-
-
- -
- -
- - -
-

stat(self, - path) -

-
source code  -
- -

Retrieve information about a file on the remote system. The return - value is an object whose attributes correspond to the attributes of - python's stat structure as returned by os.stat, - except that it contains fewer fields. An SFTP server may return as much - or as little info as it wants, so the results may vary from server to - server.

-

Unlike a python stat object, the result may not be - accessed as a tuple. This is mostly due to the author's slack - factor.

-

The fields supported are: st_mode, st_size, - st_uid, st_gid, st_atime, and - st_mtime.

-
-
Parameters:
-
    -
  • path (str) - the filename to stat
  • -
-
Returns: SFTPAttributes
-
an object containing attributes about the given file
-
-
-
- -
- -
- - -
-

symlink(self, - source, - dest) -

-
source code  -
- -

Create a symbolic link (shortcut) of the source path at - destination.

-
-
Parameters:
-
    -
  • source (str) - path of the original file
  • -
  • dest (str) - path of the newly created symlink
  • -
-
-
-
- -
- -
- - -
-

truncate(self, - path, - size) -

-
source code  -
- -

Change the size of the file specified by path. This - usually extends or shrinks the size of the file, just like the - truncate() method on python file objects.

-
-
Parameters:
-
    -
  • path (str) - path of the file to modify
  • -
  • size (int or long) - the new size of the file
  • -
-
-
-
- -
- -
- - -
-

unlink(self, - path) -

-
source code  -
- -

Remove the file at the given path. This only works on files; for - removing folders (directories), use rmdir.

-
-
Parameters:
-
    -
  • path (str) - path (absolute or relative) of the file to remove
  • -
-
Raises:
-
    -
  • IOError - if the path refers to a folder (directory)
  • -
-
-
-
- -
- -
- - -
-

utime(self, - path, - times) -

-
source code  -
- -

Set the access and modified times of the file specified by - path. If times is None, then the - file's access and modified times are set to the current time. Otherwise, - times must be a 2-tuple of numbers, of the form - (atime, mtime), which is used to set the access and modified - times, respectively. This bizarre API is mimicked from python for the - sake of consistency -- I apologize.

-
-
Parameters:
-
    -
  • path (str) - path of the file to modify
  • -
  • times (tuple(int)) - None or a tuple of (access time, modified time) in - standard internet epoch time (seconds since 01 January 1970 GMT)
  • -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.SFTPError-class.html b/docs/paramiko.SFTPError-class.html deleted file mode 100644 index db75cdf..0000000 --- a/docs/paramiko.SFTPError-class.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - paramiko.SFTPError - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SFTPError - - - - - -
[frames] | no frames]
-
- -

Class SFTPError

source code

-
-              object --+        
-                       |        
-exceptions.BaseException --+    
-                           |    
-        exceptions.Exception --+
-                               |
-                              SFTPError
-
- -
- - - - - - - - - -
- Instance Methods
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- Properties
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.SFTPFile-class.html b/docs/paramiko.SFTPFile-class.html deleted file mode 100644 index 8485072..0000000 --- a/docs/paramiko.SFTPFile-class.html +++ /dev/null @@ -1,1011 +0,0 @@ - - - - - paramiko.SFTPFile - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SFTPFile - - - - - -
[frames] | no frames]
-
- -

Class SFTPFile

source code

-
-  object --+    
-           |    
-BufferedFile --+
-               |
-              SFTPFile
-
- -
-

Proxy object for a file on the remote server, in client mode SFTP.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__del__(self) - source code - -
- -
-   - - - - - - -
__init__(self, - sftp, - handle, - mode='r', - bufsize=-1)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
- str - - - - - - -
check(self, - hash_algorithm, - offset=0, - length=0, - block_size=0)
- Ask the server for a hash of a section of this file.
- source code - -
- -
-   - - - - - - -
chmod(self, - mode)
- Change the mode (permissions) of this file.
- source code - -
- -
-   - - - - - - -
chown(self, - uid, - gid)
- Change the owner (uid) and group (gid) of - this file.
- source code - -
- -
-   - - - - - - -
close(self)
- Close the file.
- source code - -
- -
- float - - - - - - -
gettimeout(self)
- Returns the timeout in seconds (as a float) associated with the - socket or ssh Channel used for this file.
- source code - -
- -
-   - - - - - - -
prefetch(self)
- Pre-fetch the remaining contents of this file in anticipation of - future read calls.
- source code - -
- -
- list(str) - - - - - - -
readv(self, - chunks)
- Read a set of blocks from the file by (offset, length).
- source code - -
- -
-   - - - - - - -
seek(self, - offset, - whence=0)
- Set the file's current position, like stdio's fseek.
- source code - -
- -
-   - - - - - - -
set_pipelined(self, - pipelined=True)
- Turn on/off the pipelining of write operations to this file.
- source code - -
- -
-   - - - - - - -
setblocking(self, - blocking)
- Set blocking or non-blocking mode on the underiying socket or ssh Channel.
- source code - -
- -
-   - - - - - - -
settimeout(self, - timeout)
- Set a timeout on read/write operations on the underlying socket or - ssh Channel.
- source code - -
- -
- SFTPAttributes - - - - - - -
stat(self)
- Retrieve information about this file from the remote system.
- source code - -
- -
-   - - - - - - -
truncate(self, - size)
- Change the size of this file.
- source code - -
- -
-   - - - - - - -
utime(self, - times)
- Set the access and modified times of this file.
- source code - -
- -
-

Inherited from BufferedFile: - __iter__, - flush, - next, - read, - readline, - readlines, - tell, - write, - writelines, - xreadlines -

-

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

-
- - - - - - - - - - - - -
- Class Variables
-   - - MAX_REQUEST_SIZE = 32768 -
-

Inherited from BufferedFile: - FLAG_APPEND, - FLAG_BINARY, - FLAG_BUFFERED, - FLAG_LINE_BUFFERED, - FLAG_READ, - FLAG_UNIVERSAL_NEWLINE, - FLAG_WRITE, - SEEK_CUR, - SEEK_END, - SEEK_SET -

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__del__(self) -
(Destructor) -

-
source code  -
- - -
-
Overrides: - BufferedFile.__del__ -
-
-
-
- -
- -
- - -
-

__init__(self, - sftp, - handle, - mode='r', - bufsize=-1) -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

check(self, - hash_algorithm, - offset=0, - length=0, - block_size=0) -

-
source code  -
- -

Ask the server for a hash of a section of this file. This can be used - to verify a successful upload or download, or for various rsync-like - operations.

-

The file is hashed from offset, for length - bytes. If length is 0, the remainder of the file is hashed. - Thus, if both offset and length are zero, the - entire file is hashed.

-

Normally, block_size will be 0 (the default), and this - method will return a byte string representing the requested hash (for - example, a string of length 16 for MD5, or 20 for SHA-1). If a non-zero - block_size is given, each chunk of the file (from - offset to offset + length) of - block_size bytes is computed as a separate hash. The hash - results are all concatenated and returned as a single string.

-

For example, check('sha1', 0, 1024, 512) will return a - string of length 40. The first 20 bytes will be the SHA-1 of the first - 512 bytes of the file, and the last 20 bytes will be the SHA-1 of the - next 512 bytes.

-
-
Parameters:
-
    -
  • hash_algorithm (str) - the name of the hash algorithm to use (normally - "sha1" or "md5")
  • -
  • offset (int or long) - offset into the file to begin hashing (0 means to start from the - beginning)
  • -
  • length (int or long) - number of bytes to hash (0 means continue to the end of the file)
  • -
  • block_size (int) - number of bytes to hash per result (must not be less than 256; 0 - means to compute only one hash of the entire segment)
  • -
-
Returns: str
-
string of bytes representing the hash of each block, concatenated - together
-
Raises:
-
    -
  • IOError - if the server doesn't support the "check-file" extension, - or possibly doesn't support the hash algorithm requested
  • -
-
-

Note: - Many (most?) servers don't support this extension yet. -

-

Since: - 1.4 -

-
-
- -
- -
- - -
-

chmod(self, - mode) -

-
source code  -
- -

Change the mode (permissions) of this file. The permissions are - unix-style and identical to those used by python's os.chmod - function.

-
-
Parameters:
-
    -
  • mode (int) - new permissions
  • -
-
-
-
- -
- -
- - -
-

chown(self, - uid, - gid) -

-
source code  -
- -

Change the owner (uid) and group (gid) of - this file. As with python's os.chown function, you must - pass both arguments, so if you only want to change one, use stat first to - retrieve the current owner and group.

-
-
Parameters:
-
    -
  • uid (int) - new owner's uid
  • -
  • gid (int) - new group id
  • -
-
-
-
- -
- -
- - -
-

close(self) -

-
source code  -
- -

Close the file. Future read and write operations will fail.

-
-
Overrides: - BufferedFile.close -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

gettimeout(self) -

-
source code  -
- -

Returns the timeout in seconds (as a float) associated with the socket - or ssh Channel - used for this file.

-
-
Returns: float
-
-

See Also: - Channel.gettimeout -

-
-
- -
- -
- - -
-

prefetch(self) -

-
source code  -
- -

Pre-fetch the remaining contents of this file in anticipation of - future read calls. If reading the entire file, pre-fetching - can dramatically improve the download speed by avoiding roundtrip - latency. The file's contents are incrementally buffered in a background - thread.

-

The prefetched data is stored in a buffer until read via the read - method. Once data has been read, it's removed from the buffer. The data - may be read in a random order (using seek); chunks - of the buffer that haven't been read will continue to be buffered.

-
-
-

Since: - 1.5.1 -

-
-
- -
- -
- - -
-

readv(self, - chunks) -

-
source code  -
- -

Read a set of blocks from the file by (offset, length). This is more - efficient than doing a series of seek and read calls, - since the prefetch machinery is used to retrieve all the requested blocks - at once.

-
-
Parameters:
-
    -
  • chunks (list(tuple(long, int))) - a list of (offset, length) tuples indicating which sections of - the file to read
  • -
-
Returns: list(str)
-
a list of blocks read, in the same order as in - chunks
-
-

Since: - 1.5.4 -

-
-
- -
- -
- - -
-

seek(self, - offset, - whence=0) -

-
source code  -
- -

Set the file's current position, like stdio's fseek. Not - all file objects support seeking.

-
-
Parameters:
-
    -
  • offset - position to move to within the file, relative to - whence.
  • -
  • whence - type of movement: 0 = absolute; 1 = relative to the current - position; 2 = relative to the end of the file.
  • -
-
Raises:
-
    -
  • IOError - if the file doesn't support random access.
  • -
-
Overrides: - BufferedFile.seek -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

set_pipelined(self, - pipelined=True) -

-
source code  -
- -

Turn on/off the pipelining of write operations to this file. When - pipelining is on, paramiko won't wait for the server response after each - write operation. Instead, they're collected as they come in. At the - first non-write operation (including close), all - remaining server responses are collected. This means that if there was - an error with one of your later writes, an exception might be thrown from - within close instead of write.

-

By default, files are not pipelined.

-
-
Parameters:
-
    -
  • pipelined (bool) - True if pipelining should be turned on for this - file; False otherwise
  • -
-
-

Since: - 1.5 -

-
-
- -
- -
- - -
-

setblocking(self, - blocking) -

-
source code  -
- -

Set blocking or non-blocking mode on the underiying socket or ssh Channel.

-
-
Parameters:
-
    -
  • blocking (int) - 0 to set non-blocking mode; non-0 to set blocking mode.
  • -
-
-

See Also: - Channel.setblocking -

-
-
- -
- -
- - -
-

settimeout(self, - timeout) -

-
source code  -
- -

Set a timeout on read/write operations on the underlying socket or ssh - Channel.

-
-
Parameters:
-
    -
  • timeout (float) - seconds to wait for a pending read/write operation before raising - socket.timeout, or None for no timeout
  • -
-
-

See Also: - Channel.settimeout -

-
-
- -
- -
- - -
-

stat(self) -

-
source code  -
- -

Retrieve information about this file from the remote system. This is - exactly like SFTP.stat, except that it operates on an already-open - file.

-
-
Returns: SFTPAttributes
-
an object containing attributes about this file.
-
-
-
- -
- -
- - -
-

truncate(self, - size) -

-
source code  -
- -

Change the size of this file. This usually extends or shrinks the - size of the file, just like the truncate() method on python - file objects.

-
-
Parameters:
-
    -
  • size (int or long) - the new size of the file
  • -
-
-
-
- -
- -
- - -
-

utime(self, - times) -

-
source code  -
- -

Set the access and modified times of this file. If times - is None, then the file's access and modified times are set - to the current time. Otherwise, times must be a 2-tuple of - numbers, of the form (atime, mtime), which is used to set - the access and modified times, respectively. This bizarre API is - mimicked from python for the sake of consistency -- I apologize.

-
-
Parameters:
-
    -
  • times (tuple(int)) - None or a tuple of (access time, modified time) in - standard internet epoch time (seconds since 01 January 1970 GMT)
  • -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.SFTPHandle-class.html b/docs/paramiko.SFTPHandle-class.html deleted file mode 100644 index fa258af..0000000 --- a/docs/paramiko.SFTPHandle-class.html +++ /dev/null @@ -1,476 +0,0 @@ - - - - - paramiko.SFTPHandle - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SFTPHandle - - - - - -
[frames] | no frames]
-
- -

Class SFTPHandle

source code

-
-object --+
-         |
-        SFTPHandle
-
- -
-

Abstract object representing a handle to an open file (or folder) in - an SFTP server implementation. Each handle has a string representation - used by the client to refer to the underlying file.

-

Server implementations can (and should) subclass SFTPHandle to - implement features of a file handle, like stat or chattr.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - flags=0)
- Create a new file handle representing a local file being served over - SFTP.
- source code - -
- -
- int - - - - - - -
chattr(self, - attr)
- Change the attributes of this file.
- source code - -
- -
-   - - - - - - -
close(self)
- When a client closes a file, this method is called on the handle.
- source code - -
- -
- str - - - - - - -
read(self, - offset, - length)
- Read up to length bytes from this file, starting at - position offset.
- source code - -
- -
- SFTPAttributes or error code - - - - - - -
stat(self)
- Return an SFTPAttributes object referring to this open file, - or an error code.
- source code - -
- -
-   - - - - - - -
write(self, - offset, - data)
- Write data into this file at position - offset.
- source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - flags=0) -
(Constructor) -

-
source code  -
- -

Create a new file handle representing a local file being served over - SFTP. If flags is passed in, it's used to determine if the - file is open in append mode.

-
-
Parameters:
-
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

chattr(self, - attr) -

-
source code  -
- -

Change the attributes of this file. The attr object will - contain only those fields provided by the client in its request, so you - should check for the presence of fields before using them.

-
-
Parameters:
-
-
Returns: int
-
an error code like SFTP_OK.
-
-
-
- -
- -
- - -
-

close(self) -

-
source code  -
- -

When a client closes a file, this method is called on the handle. - Normally you would use this method to close the underlying OS level file - object(s).

-

The default implementation checks for attributes on self - named readfile and/or writefile, and if either - or both are present, their close() methods are called. This - means that if you are using the default implementations of read and write, this - method's default implementation should be fine also.

-
-
-
-
- -
- -
- - -
-

read(self, - offset, - length) -

-
source code  -
- -

Read up to length bytes from this file, starting at - position offset. The offset may be a python long, since - SFTP allows it to be 64 bits.

-

If the end of the file has been reached, this method may return an - empty string to signify EOF, or it may also return SFTP_EOF.

-

The default implementation checks for an attribute on - self named readfile, and if present, performs - the read operation on the python file-like object found there. (This is - meant as a time saver for the common case where you are wrapping a python - file object.)

-
-
Parameters:
-
    -
  • offset (int or long) - position in the file to start reading from.
  • -
  • length (int) - number of bytes to attempt to read.
  • -
-
Returns: str
-
data read from the file, or an SFTP error code.
-
-
-
- -
- -
- - -
-

stat(self) -

-
source code  -
- -

Return an SFTPAttributes object referring to this open file, or an - error code. This is equivalent to SFTPServerInterface.stat, except it's called on an open - file instead of a path.

-
-
Returns: SFTPAttributes or error code
-
an attributes object for the given file, or an SFTP error code - (like SFTP_PERMISSION_DENIED).
-
-
-
- -
- -
- - -
-

write(self, - offset, - data) -

-
source code  -
- -

Write data into this file at position - offset. Extending the file past its original end is - expected. Unlike python's normal write() methods, this - method cannot do a partial write: it must write all of data - or else return an error.

-

The default implementation checks for an attribute on - self named writefile, and if present, performs - the write operation on the python file-like object found there. The - attribute is named differently from readfile to make it easy - to implement read-only (or write-only) files, but if both attributes are - present, they should refer to the same file.

-
-
Parameters:
-
    -
  • offset (int or long) - position in the file to start reading from.
  • -
  • data (str) - data to write into the file.
  • -
-
Returns:
-
an SFTP error code like SFTP_OK.
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.SFTPServer-class.html b/docs/paramiko.SFTPServer-class.html deleted file mode 100644 index 9cb08b6..0000000 --- a/docs/paramiko.SFTPServer-class.html +++ /dev/null @@ -1,477 +0,0 @@ - - - - - paramiko.SFTPServer - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SFTPServer - - - - - -
[frames] | no frames]
-
- -

Class SFTPServer

source code

-
-                object --+    
-                         |    
-                  BaseSFTP --+
-                             |
-        object --+           |
-                 |           |
-threading._Verbose --+       |
-                     |       |
-      threading.Thread --+   |
-                         |   |
-          SubsystemHandler --+
-                             |
-                            SFTPServer
-
- -
-

Server-side SFTP subsystem support. Since this is a SubsystemHandler, it can be (and is meant to be) set as - the handler for "sftp" requests. Use Transport.set_subsystem_handler to activate this - class.

- - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - channel, - name, - server, - sftp_si=<class 'paramiko.SFTPServerInterface'>, - *largs, - **kwargs)
- The constructor for SFTPServer is meant to be called from within the - Transport as - a subsystem handler.
- source code - -
- -
-   - - - - - - -
finish_subsystem(self)
- Perform any cleanup at the end of a subsystem.
- source code - -
- -
-   - - - - - - -
start_subsystem(self, - name, - transport, - channel)
- Process an ssh subsystem in server mode.
- source code - -
- -
-

Inherited from SubsystemHandler: - get_server -

-

Inherited from threading.Thread: - __repr__, - getName, - isAlive, - isDaemon, - is_alive, - join, - run, - setDaemon, - setName, - start -

-

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

-
- - - - - - - - - - - - -
- Static Methods
- int - - - - - - -
convert_errno(e)
- Convert an errno value (as from an OSError or - IOError) into a standard SFTP result code.
- source code - -
- -
-   - - - - - - -
set_file_attr(filename, - attr)
- Change a file's attributes on the local filesystem.
- source code - -
- -
- - - - - - - - - -
- Properties
-

Inherited from threading.Thread: - daemon, - ident, - name -

-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - channel, - name, - server, - sftp_si=<class 'paramiko.SFTPServerInterface'>, - *largs, - **kwargs) -
(Constructor) -

-
source code  -
- -

The constructor for SFTPServer is meant to be called from within the - Transport as a - subsystem handler. server and any additional parameters or - keyword parameters are passed from the original call to Transport.set_subsystem_handler.

-
-
Parameters:
-
    -
  • channel (Channel) - channel passed from the Transport.
  • -
  • name (str) - name of the requested subsystem.
  • -
  • server (ServerInterface) - the server object associated with this channel and subsystem
  • -
  • sftp_si (class) - a subclass of SFTPServerInterface to use for handling - individual requests.
  • -
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

convert_errno(e) -
Static Method -

-
source code  -
- -

Convert an errno value (as from an OSError or - IOError) into a standard SFTP result code. This is a - convenience function for trapping exceptions in server code and returning - an appropriate result.

-
-
Parameters:
-
    -
  • e (int) - an errno code, as from OSError.errno.
  • -
-
Returns: int
-
an SFTP error code like SFTP_NO_SUCH_FILE.
-
-
-
- -
- -
- - -
-

finish_subsystem(self) -

-
source code  -
- -

Perform any cleanup at the end of a subsystem. The default - implementation just closes the channel.

-
-
Overrides: - SubsystemHandler.finish_subsystem -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

set_file_attr(filename, - attr) -
Static Method -

-
source code  -
- -

Change a file's attributes on the local filesystem. The contents of - attr are used to change the permissions, owner, group - ownership, and/or modification & access time of the file, depending - on which attributes are present in attr.

-

This is meant to be a handy helper function for translating SFTP file - requests into local file operations.

-
-
Parameters:
-
    -
  • filename (str) - name of the file to alter (should usually be an absolute path).
  • -
  • attr (SFTPAttributes) - attributes to change.
  • -
-
-
-
- -
- -
- - -
-

start_subsystem(self, - name, - transport, - channel) -

-
source code  -
- -

Process an ssh subsystem in server mode. This method is called on a - new object (and in a new thread) for each subsystem request. It is - assumed that all subsystem logic will take place here, and when the - subsystem is finished, this method will return. After this method - returns, the channel is closed.

-

The combination of transport and channel are - unique; this handler corresponds to exactly one Channel on one Transport.

-
-
Parameters:
-
    -
  • name - name of the requested subsystem.
  • -
  • transport - the server-mode Transport.
  • -
  • channel - the channel associated with this subsystem request.
  • -
-
Overrides: - SubsystemHandler.start_subsystem -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.SFTPServerInterface-class.html b/docs/paramiko.SFTPServerInterface-class.html deleted file mode 100644 index 9474b77..0000000 --- a/docs/paramiko.SFTPServerInterface-class.html +++ /dev/null @@ -1,979 +0,0 @@ - - - - - paramiko.SFTPServerInterface - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SFTPServerInterface - - - - - -
[frames] | no frames]
-
- -

Class SFTPServerInterface

source code

-
-object --+
-         |
-        SFTPServerInterface
-
- -
-

This class defines an interface for controlling the behavior of - paramiko when using the SFTPServer subsystem to provide an SFTP server.

-

Methods on this class are called from the SFTP session's thread, so - you can block as long as necessary without affecting other sessions (even - other SFTP sessions). However, raising an exception will usually cause - the SFTP session to abruptly end, so you will usually want to catch - exceptions and return an appropriate error code.

-

All paths are in string form instead of unicode because not all SFTP - clients & servers obey the requirement that paths be encoded in - UTF-8.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - server, - *largs, - **kwargs)
- Create a new SFTPServerInterface object.
- source code - -
- -
-   - - - - - - -
canonicalize(self, - path)
- Return the canonical form of a path on the server.
- source code - -
- -
- int - - - - - - -
chattr(self, - path, - attr)
- Change the attributes of a file.
- source code - -
- -
- list of SFTPAttributes or error code - - - - - - -
list_folder(self, - path)
- Return a list of files within a given folder.
- source code - -
- -
- SFTPAttributes or error code - - - - - - -
lstat(self, - path)
- Return an SFTPAttributes object for a path on the server, or - an error code.
- source code - -
- -
- int - - - - - - -
mkdir(self, - path, - attr)
- Create a new directory with the given attributes.
- source code - -
- -
-   - - - - - - -
open(self, - path, - flags, - attr)
- Open a file on the server and create a handle for future operations - on that file.
- source code - -
- -
- str or error code - - - - - - -
readlink(self, - path)
- Return the target of a symbolic link (or shortcut) on the server.
- source code - -
- -
- int - - - - - - -
remove(self, - path)
- Delete a file, if possible.
- source code - -
- -
- int - - - - - - -
rename(self, - oldpath, - newpath)
- Rename (or move) a file.
- source code - -
- -
- int - - - - - - -
rmdir(self, - path)
- Remove a directory if it exists.
- source code - -
- -
-   - - - - - - -
session_ended(self)
- The SFTP server session has just ended, either cleanly or via an - exception.
- source code - -
- -
-   - - - - - - -
session_started(self)
- The SFTP server session has just started.
- source code - -
- -
- SFTPAttributes or error code - - - - - - -
stat(self, - path)
- Return an SFTPAttributes object for a path on the server, or - an error code.
- source code - -
- -
- int - - - - - - -
symlink(self, - target_path, - path)
- Create a symbolic link on the server, as new pathname - path, with target_path as the target of the - link.
- source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - server, - *largs, - **kwargs) -
(Constructor) -

-
source code  -
- -

Create a new SFTPServerInterface object. This method does nothing by - default and is meant to be overridden by subclasses.

-
-
Parameters:
-
    -
  • server (ServerInterface) - the server object associated with this channel and SFTP subsystem
  • -
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

canonicalize(self, - path) -

-
source code  -
- -

Return the canonical form of a path on the server. For example, if - the server's home folder is /home/foo, the path - "../betty" would be canonicalized to - "/home/betty". Note the obvious security issues: - if you're serving files only from a specific folder, you probably don't - want this method to reveal path names outside that folder.

-

You may find the python methods in os.path useful, - especially os.path.normpath and - os.path.realpath.

-

The default implementation returns os.path.normpath('/' + - path).

-
-
-
-
- -
- -
- - -
-

chattr(self, - path, - attr) -

-
source code  -
- -

Change the attributes of a file. The attr object will - contain only those fields provided by the client in its request, so you - should check for the presence of fields before using them.

-
-
Parameters:
-
    -
  • path (str) - requested path (relative or absolute) of the file to change.
  • -
  • attr (SFTPAttributes) - requested attributes to change on the file.
  • -
-
Returns: int
-
an error code like SFTP_OK.
-
-
-
- -
- -
- - -
-

list_folder(self, - path) -

-
source code  -
- -

Return a list of files within a given folder. The path - will use posix notation ("/" separates folder - names) and may be an absolute or relative path.

-

The list of files is expected to be a list of SFTPAttributes - objects, which are similar in structure to the objects returned by - os.stat. In addition, each object should have its - filename field filled in, since this is important to a - directory listing and not normally present in os.stat - results. The method SFTPAttributes.from_stat will usually do what you - want.

-

In case of an error, you should return one of the SFTP_* - error codes, such as SFTP_PERMISSION_DENIED.

-
-
Parameters:
-
    -
  • path (str) - the requested path (relative or absolute) to be listed.
  • -
-
Returns: list of SFTPAttributes or error code
-
a list of the files in the given folder, using SFTPAttributes objects.
-
-

Note: - You should normalize the given path first (see the - os.path module) and check appropriate permissions - before returning the list of files. Be careful of malicious - clients attempting to use relative paths to escape restricted - folders, if you're doing a direct translation from the SFTP server - path to your local filesystem. -

-
-
- -
- -
- - -
-

lstat(self, - path) -

-
source code  -
- -

Return an SFTPAttributes object for a path on the server, or an - error code. If your server supports symbolic links (also known as - "aliases"), you should not follow them -- instead, you - should return data on the symlink or alias itself. (stat - is the corresponding call that follows symlinks/aliases.)

-
-
Parameters:
-
    -
  • path (str) - the requested path (relative or absolute) to fetch file - statistics for.
  • -
-
Returns: SFTPAttributes or error code
-
an attributes object for the given file, or an SFTP error code - (like SFTP_PERMISSION_DENIED).
-
-
-
- -
- -
- - -
-

mkdir(self, - path, - attr) -

-
source code  -
- -

Create a new directory with the given attributes. The - attr object may be considered a "hint" and - ignored.

-

The attr object will contain only those fields provided - by the client in its request, so you should use hasattr to - check for the presense of fields before using them. In some cases, the - attr object may be completely empty.

-
-
Parameters:
-
    -
  • path (str) - requested path (relative or absolute) of the new folder.
  • -
  • attr (SFTPAttributes) - requested attributes of the new folder.
  • -
-
Returns: int
-
an SFTP error code like SFTP_OK.
-
-
-
- -
- -
- - -
-

open(self, - path, - flags, - attr) -

-
source code  -
- -

Open a file on the server and create a handle for future operations on - that file. On success, a new object subclassed from SFTPHandle should - be returned. This handle will be used for future operations on the file - (read, write, etc). On failure, an error code such as - SFTP_PERMISSION_DENIED should be returned.

-

flags contains the requested mode for opening (read-only, - write-append, etc) as a bitset of flags from the os - module:

-
    -
  • - os.O_RDONLY -
  • -
  • - os.O_WRONLY -
  • -
  • - os.O_RDWR -
  • -
  • - os.O_APPEND -
  • -
  • - os.O_CREAT -
  • -
  • - os.O_TRUNC -
  • -
  • - os.O_EXCL -
  • -
-

(One of os.O_RDONLY, os.O_WRONLY, or - os.O_RDWR will always be set.)

-

The attr object contains requested attributes of the file - if it has to be created. Some or all attribute fields may be missing if - the client didn't specify them.

-
-
Parameters:
-
    -
  • path (str) - the requested path (relative or absolute) of the file to be - opened.
  • -
  • flags (int) - flags or'd together from the os module indicating - the requested mode for opening the file.
  • -
  • attr (SFTPAttributes) - requested attributes of the file if it is newly created.
  • -
-
Returns:
-
a new SFTPHandle or error code. @rtype SFTPHandle
-
-

Note: - The SFTP protocol defines all files to be in "binary" - mode. There is no equivalent to python's "text" mode. -

-
-
- -
- -
- - -
-

readlink(self, - path) -

-
source code  -
- -

Return the target of a symbolic link (or shortcut) on the server. If - the specified path doesn't refer to a symbolic link, an error should be - returned.

-
-
Parameters:
-
    -
  • path (str) - path (relative or absolute) of the symbolic link.
  • -
-
Returns: str or error code
-
the target path of the symbolic link, or an error code like - SFTP_NO_SUCH_FILE.
-
-
-
- -
- -
- - -
-

remove(self, - path) -

-
source code  -
- -

Delete a file, if possible.

-
-
Parameters:
-
    -
  • path (str) - the requested path (relative or absolute) of the file to delete.
  • -
-
Returns: int
-
an SFTP error code like SFTP_OK.
-
-
-
- -
- -
- - -
-

rename(self, - oldpath, - newpath) -

-
source code  -
- -

Rename (or move) a file. The SFTP specification implies that this - method can be used to move an existing file into a different folder, and - since there's no other (easy) way to move files via SFTP, it's probably a - good idea to implement "move" in this method too, even for - files that cross disk partition boundaries, if at all possible.

-
-
Parameters:
-
    -
  • oldpath (str) - the requested path (relative or absolute) of the existing file.
  • -
  • newpath (str) - the requested new path of the file.
  • -
-
Returns: int
-
an SFTP error code like SFTP_OK.
-
-

Note: - You should return an error if a file with the same name as - newpath already exists. (The rename operation should - be non-desctructive.) -

-
-
- -
- -
- - -
-

rmdir(self, - path) -

-
source code  -
- -

Remove a directory if it exists. The path should refer - to an existing, empty folder -- otherwise this method should return an - error.

-
-
Parameters:
-
    -
  • path (str) - requested path (relative or absolute) of the folder to remove.
  • -
-
Returns: int
-
an SFTP error code like SFTP_OK.
-
-
-
- -
- -
- - -
-

session_ended(self) -

-
source code  -
- -

The SFTP server session has just ended, either cleanly or via an - exception. This method is meant to be overridden to perform any - necessary cleanup before this SFTPServerInterface object is - destroyed.

-
-
-
-
- -
- -
- - -
-

session_started(self) -

-
source code  -
- -

The SFTP server session has just started. This method is meant to be - overridden to perform any necessary setup before handling callbacks from - SFTP operations.

-
-
-
-
- -
- -
- - -
-

stat(self, - path) -

-
source code  -
- -

Return an SFTPAttributes object for a path on the server, or an - error code. If your server supports symbolic links (also known as - "aliases"), you should follow them. (lstat is the corresponding call that doesn't follow - symlinks/aliases.)

-
-
Parameters:
-
    -
  • path (str) - the requested path (relative or absolute) to fetch file - statistics for.
  • -
-
Returns: SFTPAttributes or error code
-
an attributes object for the given file, or an SFTP error code - (like SFTP_PERMISSION_DENIED).
-
-
-
- -
- -
- - -
-

symlink(self, - target_path, - path) -

-
source code  -
- -

Create a symbolic link on the server, as new pathname - path, with target_path as the target of the - link.

-
-
Parameters:
-
    -
  • target_path (str) - path (relative or absolute) of the target for this new symbolic - link.
  • -
  • path (str) - path (relative or absolute) of the symbolic link to create.
  • -
-
Returns: int
-
an error code like SFTP_OK.
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.SSHClient-class.html b/docs/paramiko.SSHClient-class.html deleted file mode 100644 index d45aef1..0000000 --- a/docs/paramiko.SSHClient-class.html +++ /dev/null @@ -1,845 +0,0 @@ - - - - - paramiko.SSHClient - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SSHClient - - - - - -
[frames] | no frames]
-
- -

Class SSHClient

source code

-
-object --+
-         |
-        SSHClient
-
- -
-

A high-level representation of a session with an SSH server. This - class wraps Transport, Channel, and SFTPClient to take care of most aspects of - authenticating and opening channels. A typical use case is:

-
-   client = SSHClient()
-   client.load_system_host_keys()
-   client.connect('ssh.example.com')
-   stdin, stdout, stderr = client.exec_command('ls -l')
-
-

You may pass in explicit overrides for authentication and server host - key checking. The default mechanism is to try to use local key files or - an SSH agent (if one is running).

- -
-

Since: - 1.6 -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self)
- Create a new SSHClient.
- source code - -
- -
-   - - - - - - -
close(self)
- Close this SSHClient and its underlying Transport.
- source code - -
- -
-   - - - - - - -
connect(self, - hostname, - port=22, - username=None, - password=None, - pkey=None, - key_filename=None, - timeout=None, - allow_agent=True, - look_for_keys=True, - compress=False)
- Connect to an SSH server and authenticate to it.
- source code - -
- -
- tuple(ChannelFile, ChannelFile, ChannelFile) - - - - - - -
exec_command(self, - command, - bufsize=-1)
- Execute a command on the SSH server.
- source code - -
- -
- HostKeys - - - - - - -
get_host_keys(self)
- Get the local HostKeys object.
- source code - -
- -
- Transport - - - - - - -
get_transport(self)
- Return the underlying Transport object for this SSH connection.
- source code - -
- -
- Channel - - - - - - -
invoke_shell(self, - term='vt100', - width=80, - height=24)
- Start an interactive shell session on the SSH server.
- source code - -
- -
-   - - - - - - -
load_host_keys(self, - filename)
- Load host keys from a local host-key file.
- source code - -
- -
-   - - - - - - -
load_system_host_keys(self, - filename=None)
- Load host keys from a system (read-only) file.
- source code - -
- -
- SFTPClient - - - - - - -
open_sftp(self)
- Open an SFTP session on the SSH server.
- source code - -
- -
-   - - - - - - -
save_host_keys(self, - filename)
- Save the host keys back to a file.
- source code - -
- -
-   - - - - - - -
set_log_channel(self, - name)
- Set the channel for logging.
- source code - -
- -
-   - - - - - - -
set_missing_host_key_policy(self, - policy)
- Set the policy to use when connecting to a server that doesn't have a - host key in either the system or local HostKeys - objects.
- source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self) -
(Constructor) -

-
source code  -
- -

Create a new SSHClient.

-
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

connect(self, - hostname, - port=22, - username=None, - password=None, - pkey=None, - key_filename=None, - timeout=None, - allow_agent=True, - look_for_keys=True, - compress=False) -

-
source code  -
- -

Connect to an SSH server and authenticate to it. The server's host - key is checked against the system host keys (see load_system_host_keys) and any local host keys (load_host_keys). If the server's hostname is not found - in either set of host keys, the missing host key policy is used (see set_missing_host_key_policy). The default policy is to - reject the key and raise an SSHException.

-

Authentication is attempted in the following order of priority:

-
    -
  • - The pkey or key_filename passed in (if any) -
  • -
  • - Any key we can find through an SSH agent -
  • -
  • - Any "id_rsa" or "id_dsa" key discoverable in - ~/.ssh/ -
  • -
  • - Plain username/password auth, if a password was given -
  • -
-

If a private key requires a password to unlock it, and a password is - passed in, that password will be used to attempt to unlock the key.

-
-
Parameters:
-
    -
  • hostname (str) - the server to connect to
  • -
  • port (int) - the server port to connect to
  • -
  • username (str) - the username to authenticate as (defaults to the current local - username)
  • -
  • password (str) - a password to use for authentication or for unlocking a private - key
  • -
  • pkey (PKey) - an optional private key to use for authentication
  • -
  • key_filename (str or list(str)) - the filename, or list of filenames, of optional private key(s) to - try for authentication
  • -
  • timeout (float) - an optional timeout (in seconds) for the TCP connect
  • -
  • allow_agent (bool) - set to False to disable connecting to the SSH agent
  • -
  • look_for_keys (bool) - set to False to disable searching for discoverable private key - files in ~/.ssh/
  • -
  • compress (bool) - set to True to turn on compression
  • -
-
Raises:
-
    -
  • BadHostKeyException - if the server's host key could not be verified
  • -
  • AuthenticationException - if authentication failed
  • -
  • SSHException - if there was any other error connecting or establishing an SSH - session
  • -
  • socket.error - if a socket error occurred while connecting
  • -
-
-
-
- -
- -
- - -
-

exec_command(self, - command, - bufsize=-1) -

-
source code  -
- -

Execute a command on the SSH server. A new Channel is opened and - the requested command is executed. The command's input and output - streams are returned as python file-like objects - representing stdin, stdout, and stderr.

-
-
Parameters:
-
    -
  • command (str) - the command to execute
  • -
  • bufsize (int) - interpreted the same way as by the built-in file() - function in python
  • -
-
Returns: tuple(ChannelFile, ChannelFile, ChannelFile)
-
the stdin, stdout, and stderr of the executing command
-
Raises:
-
    -
  • SSHException - if the server fails to execute the command
  • -
-
-
-
- -
- -
- - -
-

get_host_keys(self) -

-
source code  -
- -

Get the local HostKeys object. This can be used to examine the local - host keys or change them.

-
-
Returns: HostKeys
-
the local host keys
-
-
-
- -
- -
- - -
-

get_transport(self) -

-
source code  -
- -

Return the underlying Transport object for this SSH connection. This can be - used to perform lower-level tasks, like opening specific kinds of - channels.

-
-
Returns: Transport
-
the Transport for this connection
-
-
-
- -
- -
- - -
-

invoke_shell(self, - term='vt100', - width=80, - height=24) -

-
source code  -
- -

Start an interactive shell session on the SSH server. A new Channel is opened and - connected to a pseudo-terminal using the requested terminal type and - size.

-
-
Parameters:
-
    -
  • term (str) - the terminal type to emulate (for example, - "vt100")
  • -
  • width (int) - the width (in characters) of the terminal window
  • -
  • height (int) - the height (in characters) of the terminal window
  • -
-
Returns: Channel
-
a new channel connected to the remote shell
-
Raises:
-
-
-
-
- -
- -
- - -
-

load_host_keys(self, - filename) -

-
source code  -
- -

Load host keys from a local host-key file. Host keys read with this - method will be checked after keys loaded via load_system_host_keys, but will be saved back by save_host_keys (so they can be modified). The missing - host key policy AutoAddPolicy adds keys to this set and saves them, when - connecting to a previously-unknown server.

-

This method can be called multiple times. Each new set of host keys - will be merged with the existing set (new replacing old if there are - conflicts). When automatically saving, the last hostname is used.

-
-
Parameters:
-
    -
  • filename (str) - the filename to read
  • -
-
Raises:
-
    -
  • IOError - if the filename could not be read
  • -
-
-
-
- -
- -
- - -
-

load_system_host_keys(self, - filename=None) -

-
source code  -
- -

Load host keys from a system (read-only) file. Host keys read with - this method will not be saved back by save_host_keys.

-

This method can be called multiple times. Each new set of host keys - will be merged with the existing set (new replacing old if there are - conflicts).

-

If filename is left as None, an attempt will - be made to read keys from the user's local "known hosts" file, - as used by OpenSSH, and no exception will be raised if the file can't be - read. This is probably only useful on posix.

-
-
Parameters:
-
    -
  • filename (str) - the filename to read, or None
  • -
-
Raises:
-
    -
  • IOError - if a filename was provided and the file could not be read
  • -
-
-
-
- -
- -
- - -
-

open_sftp(self) -

-
source code  -
- -

Open an SFTP session on the SSH server.

-
-
Returns: SFTPClient
-
a new SFTP session object
-
-
-
- -
- -
- - -
-

save_host_keys(self, - filename) -

-
source code  -
- -

Save the host keys back to a file. Only the host keys loaded with load_host_keys (plus any added directly) will be saved - -- not any host keys loaded with load_system_host_keys.

-
-
Parameters:
-
    -
  • filename (str) - the filename to save to
  • -
-
Raises:
-
    -
  • IOError - if the file could not be written
  • -
-
-
-
- -
- -
- - -
-

set_log_channel(self, - name) -

-
source code  -
- -

Set the channel for logging. The default is - "paramiko.transport" but it can be set to anything - you want.

-
-
Parameters:
-
    -
  • name (str) - new channel name for logging
  • -
-
-
-
- -
- -
- - -
-

set_missing_host_key_policy(self, - policy) -

-
source code  -
- -

Set the policy to use when connecting to a server that doesn't have a - host key in either the system or local HostKeys objects. - The default policy is to reject all unknown servers (using RejectPolicy). - You may substitute AutoAddPolicy or write your own policy class.

-
-
Parameters:
-
    -
  • policy (MissingHostKeyPolicy) - the policy to use when receiving a host key from a - previously-unknown server
  • -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.SSHConfig-class.html b/docs/paramiko.SSHConfig-class.html deleted file mode 100644 index d46115c..0000000 --- a/docs/paramiko.SSHConfig-class.html +++ /dev/null @@ -1,309 +0,0 @@ - - - - - paramiko.SSHConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SSHConfig - - - - - -
[frames] | no frames]
-
- -

Class SSHConfig

source code

-
-object --+
-         |
-        SSHConfig
-
- -
-

Representation of config information as stored in the format used by - OpenSSH. Queries can be made via lookup. The - format is described in OpenSSH's ssh_config man page. This - class 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.

- -
-

Since: - 1.6 -

-
- - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self)
- Create a new OpenSSH config object.
- source code - -
- -
-   - - - - - - -
lookup(self, - hostname)
- Return a dict of config options for a given hostname.
- source code - -
- -
-   - - - - - - -
parse(self, - file_obj)
- Read an OpenSSH config from the given file object.
- source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self) -
(Constructor) -

-
source code  -
- -

Create a new OpenSSH config object.

-
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

lookup(self, - hostname) -

-
source code  -
- -

Return a dict of config options for a given hostname.

-

The host-matching rules of OpenSSH's ssh_config 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 "Port" is set under - "Host *" and also "Host - *.example.com", and the lookup is for - "ssh.example.com", then the port entry for - "Host *.example.com" will win out.

-

The keys in the returned dict are all normalized to lowercase (look - for "port", not "Port". No - other processing is done to the keys or values.

-
-
Parameters:
-
    -
  • hostname (str) - the hostname to lookup
  • -
-
-
-
- -
- -
- - -
-

parse(self, - file_obj) -

-
source code  -
- -

Read an OpenSSH config from the given file object.

-
-
Parameters:
-
    -
  • file_obj (file) - a file-like object to read the config file from
  • -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.SSHException-class.html b/docs/paramiko.SSHException-class.html deleted file mode 100644 index 7867d5d..0000000 --- a/docs/paramiko.SSHException-class.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - paramiko.SSHException - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SSHException - - - - - -
[frames] | no frames]
-
- -

Class SSHException

source code

-
-              object --+        
-                       |        
-exceptions.BaseException --+    
-                           |    
-        exceptions.Exception --+
-                               |
-                              SSHException
-
- -
Known Subclasses:
-
- -
- -
-

Exception raised by failures in SSH2 protocol negotiation or logic - errors.

- - - - - - - - - - -
- Instance Methods
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- Properties
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.SecurityOptions-class.html b/docs/paramiko.SecurityOptions-class.html deleted file mode 100644 index 3133bed..0000000 --- a/docs/paramiko.SecurityOptions-class.html +++ /dev/null @@ -1,397 +0,0 @@ - - - - - paramiko.SecurityOptions - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SecurityOptions - - - - - -
[frames] | no frames]
-
- -

Class SecurityOptions

source code

-
-object --+
-         |
-        SecurityOptions
-
- -
-

Simple object containing the security preferences of an ssh transport. - These are tuples of acceptable ciphers, digests, key types, and key - exchange algorithms, listed in order of preference.

-

Changing the contents and/or order of these fields affects the - underlying Transport (but only if you change them before starting - the session). If you try to add an algorithm that paramiko doesn't - recognize, ValueError will be raised. If you try to assign - something besides a tuple to one of the fields, TypeError - will be raised.

- - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - transport)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
- str - - - - - - -
__repr__(self)
- Returns a string representation of this object, for debugging.
- source code - -
- -
-

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

-
- - - - - - - - - - - - - - - - - - - - - - - - -
- Properties
-   - - ciphers
- Symmetric encryption ciphers -
-   - - compression
- Compression algorithms -
-   - - digests
- Digest (one-way hash) algorithms -
-   - - kex
- Key exchange algorithms -
-   - - key_types
- Public-key algorithms -
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - transport) -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

__repr__(self) -
(Representation operator) -

-
source code  -
- -

Returns a string representation of this object, for debugging.

-
-
Returns: str
-
Overrides: - object.__repr__ -
-
-
-
-
- - - - - - -
- Property Details
- -
- -
-

ciphers

-

Symmetric encryption ciphers

-
-
Get Method:
-
_get_ciphers(self) -
-
Set Method:
-
_set_ciphers(self, - x) -
-
-
-
- -
- -
-

compression

-

Compression algorithms

-
-
Get Method:
-
_get_compression(self) -
-
Set Method:
-
_set_compression(self, - x) -
-
-
-
- -
- -
-

digests

-

Digest (one-way hash) algorithms

-
-
Get Method:
-
_get_digests(self) -
-
Set Method:
-
_set_digests(self, - x) -
-
-
-
- -
- -
-

kex

-

Key exchange algorithms

-
-
Get Method:
-
_get_kex(self) -
-
Set Method:
-
_set_kex(self, - x) -
-
-
-
- -
- -
-

key_types

-

Public-key algorithms

-
-
Get Method:
-
_get_key_types(self) -
-
Set Method:
-
_set_key_types(self, - x) -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.ServerInterface-class.html b/docs/paramiko.ServerInterface-class.html deleted file mode 100644 index 7cf53a6..0000000 --- a/docs/paramiko.ServerInterface-class.html +++ /dev/null @@ -1,1247 +0,0 @@ - - - - - paramiko.ServerInterface - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class ServerInterface - - - - - -
[frames] | no frames]
-
- -

Class ServerInterface

source code

-
-object --+
-         |
-        ServerInterface
-
- -
-

This class defines an interface for controlling the behavior of - paramiko in server mode.

-

Methods on this class are called from paramiko's primary thread, so - you shouldn't do too much work in them. (Certainly nothing that blocks - or sleeps.)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
cancel_port_forward_request(self, - address, - port)
- The client would like to cancel a previous port-forwarding request.
- source code - -
- -
- int or InteractiveQuery - - - - - - -
check_auth_interactive(self, - username, - submethods)
- Begin an interactive authentication challenge, if supported.
- source code - -
- -
- int or InteractiveQuery - - - - - - -
check_auth_interactive_response(self, - responses)
- Continue or finish an interactive authentication challenge, if - supported.
- source code - -
- -
- int - - - - - - -
check_auth_none(self, - username)
- Determine if a client may open channels with no (further) - authentication.
- source code - -
- -
- int - - - - - - -
check_auth_password(self, - username, - password)
- Determine if a given username and password supplied by the client is - acceptable for use in authentication.
- source code - -
- -
- int - - - - - - -
check_auth_publickey(self, - username, - key)
- Determine if a given key supplied by the client is acceptable for use - in authentication.
- source code - -
- -
- int - - - - - - -
check_channel_direct_tcpip_request(self, - chanid, - origin, - destination)
- Determine if a local port forwarding channel will be granted, and - return OPEN_SUCCEEDED or an error code.
- source code - -
- -
- bool - - - - - - -
check_channel_exec_request(self, - channel, - command)
- Determine if a shell command will be executed for the client.
- source code - -
- -
- bool - - - - - - -
check_channel_pty_request(self, - channel, - term, - width, - height, - pixelwidth, - pixelheight, - modes)
- Determine if a pseudo-terminal of the given dimensions (usually - requested for shell access) can be provided on the given channel.
- source code - -
- -
- int - - - - - - -
check_channel_request(self, - kind, - chanid)
- Determine if a channel request of a given type will be granted, and - return OPEN_SUCCEEDED or an error code.
- source code - -
- -
- bool - - - - - - -
check_channel_shell_request(self, - channel)
- Determine if a shell will be provided to the client on the given - channel.
- source code - -
- -
- bool - - - - - - -
check_channel_subsystem_request(self, - channel, - name)
- Determine if a requested subsystem will be provided to the client on - the given channel.
- source code - -
- -
- bool - - - - - - -
check_channel_window_change_request(self, - channel, - width, - height, - pixelwidth, - pixelheight)
- Determine if the pseudo-terminal on the given channel can be resized.
- source code - -
- -
- bool - - - - - - -
check_channel_x11_request(self, - channel, - single_connection, - auth_protocol, - auth_cookie, - screen_number)
- Determine if the client will be provided with an X11 session.
- source code - -
- -
- bool - - - - - - -
check_global_request(self, - kind, - msg)
- Handle a global request of the given kind.
- source code - -
- -
- int - - - - - - -
check_port_forward_request(self, - address, - port)
- Handle a request for port forwarding.
- source code - -
- -
- str - - - - - - -
get_allowed_auths(self, - username)
- Return a list of authentication methods supported by the server.
- source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

cancel_port_forward_request(self, - address, - port) -

-
source code  -
- -

The client would like to cancel a previous port-forwarding request. If - the given address and port is being forwarded across this ssh connection, - the port should be closed.

-
-
Parameters:
-
    -
  • address (str) - the forwarded address
  • -
  • port (int) - the forwarded port
  • -
-
-
-
- -
- -
- - -
-

check_auth_interactive(self, - username, - submethods) -

-
source code  -
- -

Begin an interactive authentication challenge, if supported. You - should override this method in server mode if you want to support the - "keyboard-interactive" auth type, which requires - you to send a series of questions for the client to answer.

-

Return AUTH_FAILED if this auth method isn't supported. Otherwise, - you should return an InteractiveQuery object containing the prompts and - instructions for the user. The response will be sent via a call to check_auth_interactive_response.

-

The default implementation always returns AUTH_FAILED.

-
-
Parameters:
-
    -
  • username (str) - the username of the authenticating client
  • -
  • submethods (str) - a comma-separated list of methods preferred by the client - (usually empty)
  • -
-
Returns: int or InteractiveQuery
-
AUTH_FAILED if this auth method isn't supported; otherwise an - object containing queries for the user
-
-
-
- -
- -
- - -
-

check_auth_interactive_response(self, - responses) -

-
source code  -
- -

Continue or finish an interactive authentication challenge, if - supported. You should override this method in server mode if you want to - support the "keyboard-interactive" auth type.

-

Return AUTH_FAILED if the responses are not accepted, AUTH_SUCCESSFUL - if the responses are accepted and complete the authentication, or - AUTH_PARTIALLY_SUCCESSFUL if your authentication is stateful, and this - set of responses is accepted for authentication, but more authentication - is required. (In this latter case, get_allowed_auths will be called to report to the client - what options it has for continuing the authentication.)

-

If you wish to continue interactive authentication with more - questions, you may return an InteractiveQuery object, which should cause - the client to respond with more answers, calling this method again. This - cycle can continue indefinitely.

-

The default implementation always returns AUTH_FAILED.

-
-
Parameters:
-
    -
  • responses (list(str)) - list of responses from the client
  • -
-
Returns: int or InteractiveQuery
-
AUTH_FAILED if the authentication fails; AUTH_SUCCESSFUL if it - succeeds; AUTH_PARTIALLY_SUCCESSFUL if the interactive auth is - successful, but authentication must continue; otherwise an object - containing queries for the user
-
-
-
- -
- -
- - -
-

check_auth_none(self, - username) -

-
source code  -
- -

Determine if a client may open channels with no (further) - authentication.

-

Return AUTH_FAILED if the client must authenticate, or AUTH_SUCCESSFUL - if it's okay for the client to not authenticate.

-

The default implementation always returns AUTH_FAILED.

-
-
Parameters:
-
    -
  • username (str) - the username of the client.
  • -
-
Returns: int
-
AUTH_FAILED if the authentication fails; AUTH_SUCCESSFUL if it - succeeds.
-
-
-
- -
- -
- - -
-

check_auth_password(self, - username, - password) -

-
source code  -
- -

Determine if a given username and password supplied by the client is - acceptable for use in authentication.

-

Return AUTH_FAILED if the password is not accepted, AUTH_SUCCESSFUL if - the password is accepted and completes the authentication, or - AUTH_PARTIALLY_SUCCESSFUL if your authentication is stateful, and this - key is accepted for authentication, but more authentication is required. - (In this latter case, get_allowed_auths will be called to report to the client - what options it has for continuing the authentication.)

-

The default implementation always returns AUTH_FAILED.

-
-
Parameters:
-
    -
  • username (str) - the username of the authenticating client.
  • -
  • password (str) - the password given by the client.
  • -
-
Returns: int
-
AUTH_FAILED if the authentication fails; AUTH_SUCCESSFUL if it - succeeds; AUTH_PARTIALLY_SUCCESSFUL if the password auth is - successful, but authentication must continue.
-
-
-
- -
- -
- - -
-

check_auth_publickey(self, - username, - key) -

-
source code  -
- -

Determine if a given key supplied by the client is acceptable for use - in authentication. You should override this method in server mode to - check the username and key and decide if you would accept a signature - made using this key.

-

Return AUTH_FAILED if the key is not accepted, AUTH_SUCCESSFUL if the - key is accepted and completes the authentication, or - AUTH_PARTIALLY_SUCCESSFUL if your authentication is stateful, and this - password is accepted for authentication, but more authentication is - required. (In this latter case, get_allowed_auths will be called to report to the client - what options it has for continuing the authentication.)

-

Note that you don't have to actually verify any key signtature here. - If you're willing to accept the key, paramiko will do the work of - verifying the client's signature.

-

The default implementation always returns AUTH_FAILED.

-
-
Parameters:
-
    -
  • username (str) - the username of the authenticating client
  • -
  • key (PKey) - the key object provided by the client
  • -
-
Returns: int
-
AUTH_FAILED if the client can't authenticate with this key; - AUTH_SUCCESSFUL if it can; AUTH_PARTIALLY_SUCCESSFUL if it can - authenticate with this key but must continue with authentication
-
-
-
- -
- -
- - -
-

check_channel_direct_tcpip_request(self, - chanid, - origin, - destination) -

-
source code  -
- -

Determine if a local port forwarding channel will be granted, and - return OPEN_SUCCEEDED or an error code. This method is - called in server mode when the client requests a channel, after - authentication is complete.

-

The chanid parameter is a small number that uniquely - identifies the channel within a Transport. A Channel object is not created unless this method returns - OPEN_SUCCEEDED -- once a Channel object is - created, you can call Channel.get_id to retrieve the channel ID.

-

The origin and destination parameters are (ip_address, port) tuples - that correspond to both ends of the TCP connection in the forwarding - tunnel.

-

The return value should either be OPEN_SUCCEEDED (or - 0) to allow the channel request, or one of the following - error codes to reject it:

-
    -
  • - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -
  • -
  • - OPEN_FAILED_CONNECT_FAILED -
  • -
  • - OPEN_FAILED_UNKNOWN_CHANNEL_TYPE -
  • -
  • - OPEN_FAILED_RESOURCE_SHORTAGE -
  • -
-

The default implementation always returns - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED.

-
-
Parameters:
-
    -
  • chanid (int) - ID of the channel
  • -
  • origin (tuple) - 2-tuple containing the IP address and port of the originator - (client side)
  • -
  • destination (tuple) - 2-tuple containing the IP address and port of the destination - (server side)
  • -
-
Returns: int
-
a success or failure code (listed above)
-
-
-
- -
- -
- - -
-

check_channel_exec_request(self, - channel, - command) -

-
source code  -
- -

Determine if a shell command will be executed for the client. If this - method returns True, the channel should be connected to the - stdin, stdout, and stderr of the shell command.

-

The default implementation always returns False.

-
-
Parameters:
-
    -
  • channel (Channel) - the Channel the request arrived on.
  • -
  • command (str) - the command to execute.
  • -
-
Returns: bool
-
True if this channel is now hooked up to the stdin, - stdout, and stderr of the executing command; False - if the command will not be executed.
-
-

Since: - 1.1 -

-
-
- -
- -
- - -
-

check_channel_pty_request(self, - channel, - term, - width, - height, - pixelwidth, - pixelheight, - modes) -

-
source code  -
- -

Determine if a pseudo-terminal of the given dimensions (usually - requested for shell access) can be provided on the given channel.

-

The default implementation always returns False.

-
-
Parameters:
-
    -
  • channel (Channel) - the Channel the pty request arrived on.
  • -
  • term (str) - type of terminal requested (for example, - "vt100").
  • -
  • width (int) - width of screen in characters.
  • -
  • height (int) - height of screen in characters.
  • -
  • pixelwidth (int) - width of screen in pixels, if known (may be 0 if - unknown).
  • -
  • pixelheight (int) - height of screen in pixels, if known (may be 0 if - unknown).
  • -
-
Returns: bool
-
True if the psuedo-terminal has been allocated; - False otherwise.
-
-
-
- -
- -
- - -
-

check_channel_request(self, - kind, - chanid) -

-
source code  -
- -

Determine if a channel request of a given type will be granted, and - return OPEN_SUCCEEDED or an error code. This method is - called in server mode when the client requests a channel, after - authentication is complete.

-

If you allow channel requests (and an ssh server that didn't would be - useless), you should also override some of the channel request methods - below, which are used to determine which services will be allowed on a - given channel:

- -

The chanid parameter is a small number that uniquely - identifies the channel within a Transport. A Channel object is not created unless this method returns - OPEN_SUCCEEDED -- once a Channel object is - created, you can call Channel.get_id to retrieve the channel ID.

-

The return value should either be OPEN_SUCCEEDED (or - 0) to allow the channel request, or one of the following - error codes to reject it:

-
    -
  • - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -
  • -
  • - OPEN_FAILED_CONNECT_FAILED -
  • -
  • - OPEN_FAILED_UNKNOWN_CHANNEL_TYPE -
  • -
  • - OPEN_FAILED_RESOURCE_SHORTAGE -
  • -
-

The default implementation always returns - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED.

-
-
Parameters:
-
    -
  • kind (str) - the kind of channel the client would like to open (usually - "session").
  • -
  • chanid (int) - ID of the channel
  • -
-
Returns: int
-
a success or failure code (listed above)
-
-
-
- -
- -
- - -
-

check_channel_shell_request(self, - channel) -

-
source code  -
- -

Determine if a shell will be provided to the client on the given - channel. If this method returns True, the channel should be - connected to the stdin/stdout of a shell (or something that acts like a - shell).

-

The default implementation always returns False.

-
-
Parameters:
-
-
Returns: bool
-
True if this channel is now hooked up to a shell; - False if a shell can't or won't be provided.
-
-
-
- -
- -
- - -
-

check_channel_subsystem_request(self, - channel, - name) -

-
source code  -
- -

Determine if a requested subsystem will be provided to the client on - the given channel. If this method returns True, all future - I/O through this channel will be assumed to be connected to the requested - subsystem. An example of a subsystem is sftp.

-

The default implementation checks for a subsystem handler assigned via - Transport.set_subsystem_handler. If one has been set, - the handler is invoked and this method returns True. - Otherwise it returns False.

-
-
Parameters:
-
    -
  • channel (Channel) - the Channel the pty request arrived on.
  • -
  • name (str) - name of the requested subsystem.
  • -
-
Returns: bool
-
True if this channel is now hooked up to the - requested subsystem; False if that subsystem can't - or won't be provided.
-
-

Note: - Because the default implementation uses the Transport to - identify valid subsystems, you probably won't need to override this - method. -

-
-
- -
- -
- - -
-

check_channel_window_change_request(self, - channel, - width, - height, - pixelwidth, - pixelheight) -

-
source code  -
- -

Determine if the pseudo-terminal on the given channel can be resized. - This only makes sense if a pty was previously allocated on it.

-

The default implementation always returns False.

-
-
Parameters:
-
    -
  • channel (Channel) - the Channel the pty request arrived on.
  • -
  • width (int) - width of screen in characters.
  • -
  • height (int) - height of screen in characters.
  • -
  • pixelwidth (int) - width of screen in pixels, if known (may be 0 if - unknown).
  • -
  • pixelheight (int) - height of screen in pixels, if known (may be 0 if - unknown).
  • -
-
Returns: bool
-
True if the terminal was resized; False - if not.
-
-
-
- -
- -
- - -
-

check_channel_x11_request(self, - channel, - single_connection, - auth_protocol, - auth_cookie, - screen_number) -

-
source code  -
- -

Determine if the client will be provided with an X11 session. If this - method returns True, X11 applications should be routed - through new SSH channels, using Transport.open_x11_channel.

-

The default implementation always returns False.

-
-
Parameters:
-
    -
  • channel (Channel) - the Channel the X11 request arrived on
  • -
  • single_connection (bool) - True if only a single X11 channel should be opened
  • -
  • auth_protocol (str) - the protocol used for X11 authentication
  • -
  • auth_cookie (str) - the cookie used to authenticate to X11
  • -
  • screen_number (int) - the number of the X11 screen to connect to
  • -
-
Returns: bool
-
True if the X11 session was opened; - False if not
-
-
-
- -
- -
- - -
-

check_global_request(self, - kind, - msg) -

-
source code  -
- -

Handle a global request of the given kind. This method - is called in server mode and client mode, whenever the remote host makes - a global request. If there are any arguments to the request, they will - be in msg.

-

There aren't any useful global requests defined, aside from port - forwarding, so usually this type of request is an extension to the - protocol.

-

If the request was successful and you would like to return contextual - data to the remote host, return a tuple. Items in the tuple will be sent - back with the successful result. (Note that the items in the tuple can - only be strings, ints, longs, or bools.)

-

The default implementation always returns False, - indicating that it does not support any global requests.

-
-
Parameters:
-
    -
  • kind (str) - the kind of global request being made.
  • -
  • msg (Message) - any extra arguments to the request.
  • -
-
Returns: bool
-
True or a tuple of data if the request was granted; - False otherwise.
-
-

Note: - Port forwarding requests are handled separately, in check_port_forward_request. -

-
-
- -
- -
- - -
-

check_port_forward_request(self, - address, - port) -

-
source code  -
- -

Handle a request for port forwarding. The client is asking that - connections to the given address and port be forwarded back across this - ssh connection. An address of "0.0.0.0" indicates - a global address (any address associated with this server) and a port of - 0 indicates that no specific port is requested (usually the - OS will pick a port).

-

The default implementation always returns False, - rejecting the port forwarding request. If the request is accepted, you - should return the port opened for listening.

-
-
Parameters:
-
    -
  • address (str) - the requested address
  • -
  • port (int) - the requested port
  • -
-
Returns: int
-
the port number that was opened for listening, or - False to reject
-
-
-
- -
- -
- - -
-

get_allowed_auths(self, - username) -

-
source code  -
- -

Return a list of authentication methods supported by the server. This - list is sent to clients attempting to authenticate, to inform them of - authentication methods that might be successful.

-

The "list" is actually a string of comma-separated names of - types of authentication. Possible values are - "password", "publickey", - and "none".

-

The default implementation always returns - "password".

-
-
Parameters:
-
    -
  • username (str) - the username requesting authentication.
  • -
-
Returns: str
-
a comma-separated list of authentication types
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.SubsystemHandler-class.html b/docs/paramiko.SubsystemHandler-class.html deleted file mode 100644 index b7003eb..0000000 --- a/docs/paramiko.SubsystemHandler-class.html +++ /dev/null @@ -1,393 +0,0 @@ - - - - - paramiko.SubsystemHandler - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SubsystemHandler - - - - - -
[frames] | no frames]
-
- -

Class SubsystemHandler

source code

-
-        object --+        
-                 |        
-threading._Verbose --+    
-                     |    
-      threading.Thread --+
-                         |
-                        SubsystemHandler
-
- -
Known Subclasses:
-
- -
- -
-

Handler for a subsytem in server mode. If you create a subclass of - this class and pass it to Transport.set_subsystem_handler, an object of this class - will be created for each request for this subsystem. Each new object - will be executed within its own new thread by calling start_subsystem. When that method completes, the channel - is closed.

-

For example, if you made a subclass MP3Handler and - registered it as the handler for subsystem "mp3", - then whenever a client has successfully authenticated and requests - subsytem "mp3", an object of class - MP3Handler will be created, and start_subsystem will be called on it from a new - thread.

- - - - - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - channel, - name, - server)
- Create a new handler for a channel.
- source code - -
- -
-   - - - - - - -
finish_subsystem(self)
- Perform any cleanup at the end of a subsystem.
- source code - -
- -
- ServerInterface - - - - - - -
get_server(self)
- Return the ServerInterface object associated with this channel - and subsystem.
- source code - -
- -
-   - - - - - - -
start_subsystem(self, - name, - transport, - channel)
- Process an ssh subsystem in server mode.
- source code - -
- -
-

Inherited from threading.Thread: - __repr__, - getName, - isAlive, - isDaemon, - is_alive, - join, - run, - setDaemon, - setName, - start -

-

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

-
- - - - - - - - - -
- Properties
-

Inherited from threading.Thread: - daemon, - ident, - name -

-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - channel, - name, - server) -
(Constructor) -

-
source code  -
- -

Create a new handler for a channel. This is used by ServerInterface to start up a new handler when a channel - requests this subsystem. You don't need to override this method, but if - you do, be sure to pass the channel and name - parameters through to the original __init__ method here.

-
-
Parameters:
-
    -
  • channel (Channel) - the channel associated with this subsystem request.
  • -
  • name (str) - name of the requested subsystem.
  • -
  • server (ServerInterface) - the server object for the session that started this subsystem
  • -
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

finish_subsystem(self) -

-
source code  -
- -

Perform any cleanup at the end of a subsystem. The default - implementation just closes the channel.

-
-
-

Since: - 1.1 -

-
-
- -
- -
- - -
-

start_subsystem(self, - name, - transport, - channel) -

-
source code  -
- -

Process an ssh subsystem in server mode. This method is called on a - new object (and in a new thread) for each subsystem request. It is - assumed that all subsystem logic will take place here, and when the - subsystem is finished, this method will return. After this method - returns, the channel is closed.

-

The combination of transport and channel are - unique; this handler corresponds to exactly one Channel on one Transport.

-
-
Parameters:
-
    -
  • name (str) - name of the requested subsystem.
  • -
  • transport (Transport) - the server-mode Transport.
  • -
  • channel (Channel) - the channel associated with this subsystem request.
  • -
-
-

Note: - It is the responsibility of this method to exit if the underlying - Transport - is closed. This can be done by checking Transport.is_active or noticing an EOF on the Channel. If - this method loops forever without checking for this case, your - python interpreter may refuse to exit because this thread will - still be running. -

-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.Transport-class.html b/docs/paramiko.Transport-class.html deleted file mode 100644 index e15be3d..0000000 --- a/docs/paramiko.Transport-class.html +++ /dev/null @@ -1,2352 +0,0 @@ - - - - - paramiko.Transport - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class Transport - - - - - -
[frames] | no frames]
-
- -

Class Transport

source code

-
-        object --+        
-                 |        
-threading._Verbose --+    
-                     |    
-      threading.Thread --+
-                         |
-                        Transport
-
- -
-

An SSH Transport attaches to a stream (usually a socket), negotiates - an encrypted session, authenticates, and then creates stream tunnels, - called Channels, - across the session. Multiple channels can be multiplexed across a single - session (and often are, in the case of port forwardings).

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - sock)
- Create a new SSH session over an existing socket, or socket-like - object.
- source code - -
- -
- str - - - - - - -
__repr__(self)
- Returns a string representation of this object, for debugging.
- source code - -
- -
- Channel - - - - - - -
accept(self, - timeout=None)
- Return the next channel opened by the client over this transport, in - server mode.
- source code - -
- -
-   - - - - - - -
add_server_key(self, - key)
- Add a host key to the list of keys used for server mode.
- source code - -
- -
-   - - - - - - -
atfork(self)
- Terminate this Transport without closing the session.
- source code - -
- -
- list - - - - - - -
auth_interactive(self, - username, - handler, - submethods='')
- Authenticate to the server interactively.
- source code - -
- -
- list - - - - - - -
auth_none(self, - username)
- Try to authenticate to the server using no authentication at all.
- source code - -
- -
- list - - - - - - -
auth_password(self, - username, - password, - event=None, - fallback=True)
- Authenticate to the server using a password.
- source code - -
- -
- list - - - - - - -
auth_publickey(self, - username, - key, - event=None)
- Authenticate to the server using a private key.
- source code - -
- -
-   - - - - - - -
cancel_port_forward(self, - address, - port)
- Ask the server to cancel a previous port-forwarding request.
- source code - -
- -
-   - - - - - - -
close(self)
- Close this session, and any open channels that are tied to it.
- source code - -
- -
-   - - - - - - -
connect(self, - hostkey=None, - username='', - password=None, - pkey=None)
- Negotiate an SSH2 session, and optionally verify the server's host - key and authenticate using a password or private key.
- source code - -
- -
- Exception - - - - - - -
get_exception(self)
- Return any exception that happened during the last server request.
- source code - -
- -
- bool - - - - - - -
get_hexdump(self)
- Return True if the transport is currently logging hex - dumps of protocol traffic.
- source code - -
- -
- str - - - - - - -
get_log_channel(self)
- Return the channel name used for this transport's logging.
- source code - -
- -
- PKey - - - - - - -
get_remote_server_key(self)
- Return the host key of the server (in client mode).
- source code - -
- -
- SecurityOptions - - - - - - -
get_security_options(self)
- Return a SecurityOptions object which can be used to tweak - the encryption algorithms this transport will permit, and the order - of preference for them.
- source code - -
- -
- PKey - - - - - - -
get_server_key(self)
- Return the active host key, in server mode.
- source code - -
- -
- string - - - - - - -
get_username(self)
- Return the username this connection is authenticated for.
- source code - -
- -
- tuple(str, int) - - - - - - -
getpeername(self)
- Return the address of the remote side of this Transport, if possible.
- source code - -
- -
- Message - - - - - - -
global_request(self, - kind, - data=None, - wait=True)
- Make a global request to the remote host.
- source code - -
- -
- bool - - - - - - -
is_active(self)
- Return true if this session is active (open).
- source code - -
- -
- bool - - - - - - -
is_authenticated(self)
- Return true if this session is active and authenticated.
- source code - -
- -
- Channel - - - - - - -
open_channel(self, - kind, - dest_addr=None, - src_addr=None)
- Request a new channel to the server.
- source code - -
- -
-   - - - - - - -
open_forwarded_tcpip_channel(self, - (src_addr, src_port), - (dest_addr, dest_port))
- Request a new channel back to the client, of type - "forwarded-tcpip".
- source code - -
- -
- Channel - - - - - - -
open_session(self)
- Request a new channel to the server, of type - "session".
- source code - -
- -
- SFTPClient - - - - - - -
open_sftp_client(self)
- Create an SFTP client channel from an open transport.
- source code - -
- -
- Channel - - - - - - -
open_x11_channel(self, - src_addr=None)
- Request a new channel to the client, of type - "x11".
- source code - -
- -
-   - - - - - - -
renegotiate_keys(self)
- Force this session to switch to new keys.
- source code - -
- -
- int - - - - - - -
request_port_forward(self, - address, - port, - handler=None)
- Ask the server to forward TCP connections from a listening port on - the server, across this SSH session.
- source code - -
- -
-   - - - - - - -
run(self) - source code - -
- -
-   - - - - - - -
send_ignore(self, - bytes=None)
- Send a junk packet across the encrypted link.
- source code - -
- -
-   - - - - - - -
set_hexdump(self, - hexdump)
- Turn on/off logging a hex dump of protocol traffic at DEBUG level in - the logs.
- source code - -
- -
-   - - - - - - -
set_keepalive(self, - interval)
- Turn on/off keepalive packets (default is off).
- source code - -
- -
-   - - - - - - -
set_log_channel(self, - name)
- Set the channel for this transport's logging.
- source code - -
- -
-   - - - - - - -
set_subsystem_handler(self, - name, - handler, - *larg, - **kwarg)
- Set the handler class for a subsystem in server mode.
- source code - -
- -
-   - - - - - - -
start_client(self, - event=None)
- Negotiate a new SSH2 session as a client.
- source code - -
- -
-   - - - - - - -
start_server(self, - event=None, - server=None)
- Negotiate a new SSH2 session as a server.
- source code - -
- -
-   - - - - - - -
stop_thread(self) - source code - -
- -
-   - - - - - - -
use_compression(self, - compress=True)
- Turn on/off compression.
- source code - -
- -
-

Inherited from threading.Thread: - getName, - isAlive, - isDaemon, - is_alive, - join, - setDaemon, - setName, - start -

-

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

-
- - - - - - - - - -
- Static Methods
- bool - - - - - - -
load_server_moduli(filename=None)
- (optional) Load a file of prime moduli for use in doing - group-exchange key negotiation in server mode.
- source code - -
- -
- - - - - - - - - -
- Properties
-

Inherited from threading.Thread: - daemon, - ident, - name -

-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - sock) -
(Constructor) -

-
source code  -
- -

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 connect or start_client to begin a client session, or start_server to begin a server session.

-

If the object is not actually a socket, it must have the following - methods:

-
    -
  • - send(str): Writes from 1 to len(str) bytes, - and returns an int representing the number of bytes written. Returns - 0 or raises EOFError if the stream has been closed. -
  • -
  • - recv(int): Reads from 1 to int bytes and - returns them as a string. Returns 0 or raises EOFError - if the stream has been closed. -
  • -
  • - close(): Closes the socket. -
  • -
  • - settimeout(n): Sets a (float) timeout on I/O operations. -
  • -
-

For ease of use, you may also pass in an address (as a tuple) or a - host string as the sock argument. (A host string is a - hostname with an optional port (separated by ":") - which will be converted into a tuple of (hostname, port).) - A socket will be connected to this address and used for communication. - Exceptions from the socket call may be thrown in this - case.

-
-
Parameters:
-
    -
  • sock (socket) - a socket or socket-like object to create the session over.
  • -
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

__repr__(self) -
(Representation operator) -

-
source code  -
- -

Returns a string representation of this object, for debugging.

-
-
Returns: str
-
Overrides: - object.__repr__ -
-
-
-
- -
- -
- - -
-

accept(self, - timeout=None) -

-
source code  -
- -

Return the next channel opened by the client over this transport, in - server mode. If no channel is opened before the given timeout, - None is returned.

-
-
Parameters:
-
    -
  • timeout (int) - seconds to wait for a channel, or None to wait - forever
  • -
-
Returns: Channel
-
a new Channel opened by the client
-
-
-
- -
- -
- - -
-

add_server_key(self, - key) -

-
source code  -
- -

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.

-
-
Parameters:
-
-
-
-
- -
- -
- - -
-

atfork(self) -

-
source code  -
- -

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.

-
-
-

Since: - 1.5.3 -

-
-
- -
- -
- - -
-

auth_interactive(self, - username, - handler, - submethods='') -

-
source code  -
- -

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.

-

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.

-

The handler is expected to be a callable that will handle calls of the - form: handler(title, instructions, prompt_list). The - title is meant to be a dialog-window title, and the - instructions are user instructions (both are strings). - prompt_list will be a list of prompts, each prompt being a - tuple of (str, bool). The string is the prompt and the - boolean indicates whether the user text should be echoed.

-

A sample call would thus be: handler('title', 'instructions', - [('Password:', False)]).

-

The handler should return a list or tuple of answers to the server's - questions.

-

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.

-
-
Parameters:
-
    -
  • username (string) - the username to authenticate as
  • -
  • handler (callable) - a handler for responding to server questions
  • -
  • submethods (str) - a string list of desired submethods (optional)
  • -
-
Returns: list
-
list of auth types permissible for the next stage of - authentication (normally empty).
-
Raises:
-
-
-

Since: - 1.5 -

-
-
- -
- -
- - -
-

auth_none(self, - username) -

-
source code  -
- -

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 BadAuthenticationType exception raised.

-
-
Parameters:
-
    -
  • username (string) - the username to authenticate as
  • -
-
Returns: list
-
list of auth types permissible for the next stage of - authentication (normally empty)
-
Raises:
-
    -
  • BadAuthenticationType - if "none" authentication isn't allowed by the server for - this user
  • -
  • SSHException - if the authentication failed due to a network error
  • -
-
-

Since: - 1.5 -

-
-
- -
- -
- - -
-

auth_password(self, - username, - password, - event=None, - fallback=True) -

-
source code  -
- -

Authenticate to the server using a password. The username and - password are sent over an encrypted link.

-

If an event is passed in, this method will return - immediately, and the event will be triggered once authentication succeeds - or fails. On success, is_authenticated will return True. On - failure, you may use get_exception to get more detailed error - information.

-

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.

-

Since 1.5, if no event is passed and fallback is - True (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.)

-

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.

-
-
Parameters:
-
    -
  • username (str) - the username to authenticate as
  • -
  • password (str or unicode) - the password to authenticate with
  • -
  • event (threading.Event) - an event to trigger when the authentication attempt is complete - (whether it was successful or not)
  • -
  • fallback (bool) - True if an attempt at an automated - "interactive" password auth should be made if the - server doesn't support normal password auth
  • -
-
Returns: list
-
list of auth types permissible for the next stage of - authentication (normally empty)
-
Raises:
-
-
-
-
- -
- -
- - -
-

auth_publickey(self, - username, - key, - event=None) -

-
source code  -
- -

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.

-

If an event is passed in, this method will return - immediately, and the event will be triggered once authentication succeeds - or fails. On success, is_authenticated will return True. On - failure, you may use get_exception to get more detailed error - information.

-

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.

-

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.

-
-
Parameters:
-
    -
  • username (string) - the username to authenticate as
  • -
  • key (PKey) - the private key to authenticate with
  • -
  • event (threading.Event) - an event to trigger when the authentication attempt is complete - (whether it was successful or not)
  • -
-
Returns: list
-
list of auth types permissible for the next stage of - authentication (normally empty)
-
Raises:
-
-
-
-
- -
- -
- - -
-

cancel_port_forward(self, - address, - port) -

-
source code  -
- -

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.

-
-
Parameters:
-
    -
  • address (str) - the address to stop forwarding
  • -
  • port (int) - the port to stop forwarding
  • -
-
-
-
- -
- -
- - -
-

connect(self, - hostkey=None, - username='', - password=None, - pkey=None) -

-
source code  -
- -

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 - start_client, get_remote_server_key, and Transport.auth_password or Transport.auth_publickey. Use those methods if you want - more control.

-

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 open_channel or open_session to get a Channel object, which - is used for data transfer.

-
-
Parameters:
-
    -
  • hostkey (PKey) - the host key expected from the server, or None if - you don't want to do host key verification.
  • -
  • username (str) - the username to authenticate as.
  • -
  • password (str) - a password to use for authentication, if you want to use password - authentication; otherwise None.
  • -
  • pkey (PKey) - a private key to use for authentication, if you want to use - private key authentication; otherwise None.
  • -
-
Raises:
-
    -
  • SSHException - if the SSH2 negotiation fails, the host key supplied by the server - is incorrect, or authentication fails.
  • -
-
-

Note: - If you fail to supply a password or private key, this method may - succeed, but a subsequent open_channel or open_session call may fail because you haven't - authenticated yet. -

-
-
- -
- -
- - -
-

get_exception(self) -

-
source code  -
- -

Return any exception that happened during the last server request. - This can be used to fetch more specific error information after using - calls like start_client. The exception (if any) is cleared after - this call.

-
-
Returns: Exception
-
an exception, or None if there is no stored - exception.
-
-

Since: - 1.1 -

-
-
- -
- -
- - -
-

get_hexdump(self) -

-
source code  -
- -

Return True if the transport is currently logging hex - dumps of protocol traffic.

-
-
Returns: bool
-
True if hex dumps are being logged
-
-

Since: - 1.4 -

-
-
- -
- -
- - -
-

get_log_channel(self) -

-
source code  -
- -

Return the channel name used for this transport's logging.

-
-
Returns: str
-
channel name.
-
-

Since: - 1.2 -

-
-
- -
- -
- - -
-

get_remote_server_key(self) -

-
source code  -
- -

Return the host key of the server (in client mode).

-
-
Returns: PKey
-
public key of the remote server
-
Raises:
-
-
-

Note: - Previously this call returned a tuple of (key type, key string). - You can get the same effect by calling PKey.get_name for the key type, and - str(key) for the key string. -

-
-
- -
- -
- - -
-

get_security_options(self) -

-
source code  -
- -

Return a SecurityOptions object which can be used to tweak the - encryption algorithms this transport will permit, and the order of - preference for them.

-
-
Returns: SecurityOptions
-
an object that can be used to change the preferred algorithms for - encryption, digest (hash), public key, and key exchange.
-
-
-
- -
- -
- - -
-

get_server_key(self) -

-
source code  -
- -

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 add_server_key, that's the only key that will ever be - returned. But in cases where you have set more than one type of host key - (for example, an RSA key and a DSS key), the key type will be negotiated - by the client, and this method will return the key of the type agreed on. - If the host key has not been negotiated yet, None is - returned. In client mode, the behavior is undefined.

-
-
Returns: PKey
-
host key of the type negotiated by the client, or - None.
-
-
-
- -
- -
- - -
-

get_username(self) -

-
source code  -
- -

Return the username this connection is authenticated for. If the - session is not authenticated (or authentication failed), this method - returns None.

-
-
Returns: string
-
username that was authenticated, or None.
-
-
-
- -
- -
- - -
-

getpeername(self) -

-
source code  -
- -

Return the address of the remote side of this Transport, if possible. - This is effectively a wrapper around 'getpeername' on the - underlying socket. If the socket-like object has no - 'getpeername' method, then ("unknown", - 0) is returned.

-
-
Returns: tuple(str, int)
-
the address if the remote host, if known
-
-
-
- -
- -
- - -
-

global_request(self, - kind, - data=None, - wait=True) -

-
source code  -
- -

Make a global request to the remote host. These are normally - extensions to the SSH2 protocol.

-
-
Parameters:
-
    -
  • kind (str) - name of the request.
  • -
  • data (tuple) - an optional tuple containing additional data to attach to the - request.
  • -
  • wait (bool) - True if this method should not return until a - response is received; False otherwise.
  • -
-
Returns: Message
-
a Message - containing possible additional data if the request was successful - (or an empty Message if wait was - False); None if the request was denied.
-
-
-
- -
- -
- - -
-

is_active(self) -

-
source code  -
- -

Return true if this session is active (open).

-
-
Returns: bool
-
True if the session is still active (open); False if the session - is closed
-
-
-
- -
- -
- - -
-

is_authenticated(self) -

-
source code  -
- -

Return true if this session is active and authenticated.

-
-
Returns: bool
-
True if the session is still open and has been authenticated - successfully; False if authentication failed and/or the session - is closed.
-
-
-
- -
- -
- - -
-

load_server_moduli(filename=None) -
Static Method -

-
source code  -
- -

(optional) Load a file of prime moduli for use in doing - group-exchange key negotiation in server mode. It's a rather obscure - option and can be safely ignored.

-

In server mode, the remote client may request - "group-exchange" key negotiation, which asks the server to send - a random prime number that fits certain criteria. These primes are - pretty difficult to compute, so they can't be generated on demand. But - many systems contain a file of suitable primes (usually named something - like /etc/ssh/moduli). If you call - load_server_moduli and it returns True, then - this file of primes has been loaded and we will support - "group-exchange" in server mode. Otherwise server mode will - just claim that it doesn't support that method of key negotiation.

-
-
Parameters:
-
    -
  • filename (str) - optional path to the moduli file, if you happen to know that it's - not in a standard location.
  • -
-
Returns: bool
-
True if a moduli file was successfully loaded; False otherwise.
-
-

Note: - This has no effect when used in client mode. -

-
-
- -
- -
- - -
-

open_channel(self, - kind, - dest_addr=None, - src_addr=None) -

-
source code  -
- -

Request a new channel to the server. Channels are - socket-like objects used for the actual transfer of data across the - session. You may only request a channel after negotiating encryption - (using connect or start_client) and authenticating.

-
-
Parameters:
-
    -
  • kind (str) - the kind of channel requested (usually - "session", - "forwarded-tcpip", - "direct-tcpip", or - "x11")
  • -
  • dest_addr ((str, int)) - the destination address of this port forwarding, if - kind is "forwarded-tcpip" or - "direct-tcpip" (ignored for other channel - types)
  • -
  • src_addr ((str, int)) - the source address of this port forwarding, if kind - is "forwarded-tcpip", - "direct-tcpip", or - "x11"
  • -
-
Returns: Channel
-
a new Channel on success
-
Raises:
-
    -
  • SSHException - if the request is rejected or the session ends prematurely
  • -
-
-
-
- -
- -
- - -
-

open_forwarded_tcpip_channel(self, - (src_addr, src_port), - (dest_addr, dest_port)) -

-
source code  -
- -

Request a new channel back to the client, of type - "forwarded-tcpip". This is used after a client has - requested port forwarding, for sending incoming connections back to the - client.

-
-
Parameters:
-
    -
  • src_addr - originator's address
  • -
  • src_port - originator's port
  • -
  • dest_addr - local (server) connected address
  • -
  • dest_port - local (server) connected port
  • -
-
-
-
- -
- -
- - -
-

open_session(self) -

-
source code  -
- -

Request a new channel to the server, of type - "session". This is just an alias for - open_channel('session').

-
-
Returns: Channel
-
a new Channel
-
Raises:
-
    -
  • SSHException - if the request is rejected or the session ends prematurely
  • -
-
-
-
- -
- -
- - -
-

open_sftp_client(self) -

-
source code  -
- -

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.

-
-
Returns: SFTPClient
-
a new SFTPClient object, referring to an sftp session - (channel) across this transport
-
-
-
- -
- -
- - -
-

open_x11_channel(self, - src_addr=None) -

-
source code  -
- -

Request a new channel to the client, of type - "x11". This is just an alias for - open_channel('x11', src_addr=src_addr).

-
-
Parameters:
-
    -
  • src_addr ((str, int)) - the source address of the x11 server (port is the x11 port, ie. - 6010)
  • -
-
Returns: Channel
-
a new Channel
-
Raises:
-
    -
  • SSHException - if the request is rejected or the session ends prematurely
  • -
-
-
-
- -
- -
- - -
-

renegotiate_keys(self) -

-
source code  -
- -

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.

-
-
Raises:
-
    -
  • SSHException - if the key renegotiation failed (which causes the session to end)
  • -
-
-
-
- -
- -
- - -
-

request_port_forward(self, - address, - port, - handler=None) -

-
source code  -
- -

Ask the server to forward TCP connections from a listening port on the - server, across this SSH session.

-

If a handler is given, that handler is called from a different thread - whenever a forwarded connection arrives. The handler parameters are:

-
-   handler(channel, (origin_addr, origin_port), (server_addr, server_port))
-
-

where server_addr and server_port are the - address and port that the server was listening on.

-

If no handler is set, the default behavior is to send new incoming - forwarded connections into the accept queue, to be picked up via accept.

-
-
Parameters:
-
    -
  • address (str) - the address to bind when forwarding
  • -
  • port (int) - the port to forward, or 0 to ask the server to allocate any port
  • -
  • handler (function(Channel, (str, int), (str, int))) - optional handler for incoming forwarded connections
  • -
-
Returns: int
-
the port # allocated by the server
-
Raises:
-
    -
  • SSHException - if the server refused the TCP forward request
  • -
-
-
-
- -
- -
- - -
-

run(self) -

-
source code  -
- - -
-
Overrides: - threading.Thread.run -
-
-
-
- -
- -
- - -
-

send_ignore(self, - bytes=None) -

-
source code  -
- -

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.

-
-
Parameters:
-
    -
  • bytes (int) - the number of random bytes to send in the payload of the ignored - packet -- defaults to a random number from 10 to 41.
  • -
-
-
-
- -
- -
- - -
-

set_hexdump(self, - hexdump) -

-
source code  -
- -

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.

-
-
Parameters:
-
    -
  • hexdump (bool) - True to log protocol traffix (in hex) to the log; - False otherwise.
  • -
-
-
-
- -
- -
- - -
-

set_keepalive(self, - interval) -

-
source code  -
- -

Turn on/off keepalive packets (default is off). If this is set, after - interval 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.

-
-
Parameters:
-
    -
  • interval (int) - seconds to wait before sending a keepalive packet (or 0 to - disable keepalives).
  • -
-
-
-
- -
- -
- - -
-

set_log_channel(self, - name) -

-
source code  -
- -

Set the channel for this transport's logging. The default is - "paramiko.transport" but it can be set to anything - you want. (See the logging module for more info.) SSH - Channels will log to a sub-channel of the one specified.

-
-
Parameters:
-
    -
  • name (str) - new channel name for logging
  • -
-
-

Since: - 1.1 -

-
-
- -
- -
- - -
-

set_subsystem_handler(self, - name, - handler, - *larg, - **kwarg) -

-
source code  -
- -

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 SubsystemHandler for more detailed documentation.

-

Any extra parameters (including keyword arguments) are saved and - passed to the SubsystemHandler constructor later.

-
-
Parameters:
-
    -
  • name (str) - name of the subsystem.
  • -
  • handler (class) - subclass of SubsystemHandler that handles this subsystem.
  • -
-
-
-
- -
- -
- - -
-

start_client(self, - event=None) -

-
source code  -
- -

Negotiate a new SSH2 session as a client. This is the first step - after creating a new Transport. A separate thread is created for protocol - negotiation.

-

If an event is passed in, this method returns immediately. When - negotiation is done (successful or not), the given Event - will be triggered. On failure, is_active - will return False.

-

(Since 1.4) If event is None, this method - will not return until negotation is done. On success, the method returns - normally. Otherwise an SSHException is raised.

-

After a successful negotiation, you will usually want to authenticate, - calling auth_password or auth_publickey.

-
-
Parameters:
-
    -
  • event (threading.Event) - an event to trigger when negotiation is complete (optional)
  • -
-
Raises:
-
    -
  • SSHException - if negotiation fails (and no event was passed in)
  • -
-
-
Notes: -
    -
  • - connect is a simpler method for connecting as a - client. -
  • -
  • - After calling this method (or start_server or connect), you should no longer directly read from - or write to the original socket object. -
  • -
-
-
- -
- -
- - -
-

start_server(self, - event=None, - server=None) -

-
source code  -
- -

Negotiate a new SSH2 session as a server. This is the first step - after creating a new Transport and setting up your server host key(s). A - separate thread is created for protocol negotiation.

-

If an event is passed in, this method returns immediately. When - negotiation is done (successful or not), the given Event - will be triggered. On failure, is_active - will return False.

-

(Since 1.4) If event is None, this method - will not return until negotation is done. On success, the method returns - normally. Otherwise an SSHException is raised.

-

After a successful negotiation, the client will need to authenticate. - Override the methods get_allowed_auths, check_auth_none, check_auth_password, and check_auth_publickey in the given server - object to control the authentication process.

-

After a successful authentication, the client should request to open a - channel. Override check_channel_request in the given server - object to allow channels to be opened.

-
-
Parameters:
-
    -
  • event (threading.Event) - an event to trigger when negotiation is complete.
  • -
  • server (server.ServerInterface) - an object used to perform authentication and create Channels.
  • -
-
Raises:
-
    -
  • SSHException - if negotiation fails (and no event was passed in)
  • -
-
-

Note: - After calling this method (or start_client or connect), you should no longer directly read from - or write to the original socket object. -

-
-
- -
- -
- - -
-

use_compression(self, - compress=True) -

-
source code  -
- -

Turn on/off compression. This will only have an affect before - starting the transport (ie before calling connect, - etc). By default, compression is off since it negatively affects - interactive sessions.

-
-
Parameters:
-
    -
  • compress (bool) - True to ask the remote client/server to compress - traffic; False to refuse compression
  • -
-
-

Since: - 1.5.2 -

-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.WarningPolicy-class.html b/docs/paramiko.WarningPolicy-class.html deleted file mode 100644 index 66be09e..0000000 --- a/docs/paramiko.WarningPolicy-class.html +++ /dev/null @@ -1,223 +0,0 @@ - - - - - paramiko.WarningPolicy - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class WarningPolicy - - - - - -
[frames] | no frames]
-
- -

Class WarningPolicy

source code

-
-          object --+    
-                   |    
-MissingHostKeyPolicy --+
-                       |
-                      WarningPolicy
-
- -
-

Policy for logging a python-style warning for an unknown host key, but - accepting it. This is used by SSHClient.

- - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
missing_host_key(self, - client, - hostname, - key)
- Called when an SSHClient receives a server key for a server that - isn't in either the system or local HostKeys object.
- source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

missing_host_key(self, - client, - hostname, - key) -

-
source code  -
- -

Called when an SSHClient receives a server key for a server that isn't - in either the system or local HostKeys object. To accept the key, simply return. To - reject, raised an exception (which will be passed to the calling - application).

-
-
Overrides: - MissingHostKeyPolicy.missing_host_key -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.agent-module.html b/docs/paramiko.agent-module.html deleted file mode 100644 index ba9a85a..0000000 --- a/docs/paramiko.agent-module.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - paramiko.agent - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module agent - - - - - -
[frames] | no frames]
-
- -

Module agent

source code

-

SSH Agent interface for Unix clients.

- - - - - - - - - - - - - - - - - - - - - - -
- Variables
-   - - SSH2_AGENTC_REQUEST_IDENTITIES = 11 -
-   - - SSH2_AGENTC_SIGN_REQUEST = 13 -
-   - - SSH2_AGENT_IDENTITIES_ANSWER = 12 -
-   - - SSH2_AGENT_SIGN_RESPONSE = 14 -
-   - - __package__ = 'paramiko' -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.agent-pysrc.html b/docs/paramiko.agent-pysrc.html deleted file mode 100644 index c83bde8..0000000 --- a/docs/paramiko.agent-pysrc.html +++ /dev/null @@ -1,279 +0,0 @@ - - - - - paramiko.agent - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module agent - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.agent

-
-  1  # Copyright (C) 2003-2007  John Rochester <john@jrochester.org> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  SSH Agent interface for Unix clients. 
- 21  """ 
- 22   
- 23  import os 
- 24  import socket 
- 25  import struct 
- 26  import sys 
- 27   
- 28  from paramiko.ssh_exception import SSHException 
- 29  from paramiko.message import Message 
- 30  from paramiko.pkey import PKey 
- 31   
- 32   
- 33  SSH2_AGENTC_REQUEST_IDENTITIES, SSH2_AGENT_IDENTITIES_ANSWER, \ 
- 34      SSH2_AGENTC_SIGN_REQUEST, SSH2_AGENT_SIGN_RESPONSE = range(11, 15) 
- 35   
- 36   
-
37 -class Agent: -
38 """ - 39 Client interface for using private keys from an SSH agent running on the - 40 local machine. If an SSH agent is running, this class can be used to - 41 connect to it and retreive L{PKey} objects which can be used when - 42 attempting to authenticate to remote SSH servers. - 43 - 44 Because the SSH agent protocol uses environment variables and unix-domain - 45 sockets, this probably doesn't work on Windows. It does work on most - 46 posix platforms though (Linux and MacOS X, for example). - 47 """ - 48 -
49 - def __init__(self): -
50 """ - 51 Open a session with the local machine's SSH agent, if one is running. - 52 If no agent is running, initialization will succeed, but L{get_keys} - 53 will return an empty tuple. - 54 - 55 @raise SSHException: if an SSH agent is found, but speaks an - 56 incompatible protocol - 57 """ - 58 self.conn = None - 59 self.keys = () - 60 if ('SSH_AUTH_SOCK' in os.environ) and (sys.platform != 'win32'): - 61 conn = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) - 62 try: - 63 conn.connect(os.environ['SSH_AUTH_SOCK']) - 64 except: - 65 # probably a dangling env var: the ssh agent is gone - 66 return - 67 self.conn = conn - 68 elif sys.platform == 'win32': - 69 import win_pageant - 70 if win_pageant.can_talk_to_agent(): - 71 self.conn = win_pageant.PageantConnection() - 72 else: - 73 return - 74 else: - 75 # no agent support - 76 return - 77 - 78 ptype, result = self._send_message(chr(SSH2_AGENTC_REQUEST_IDENTITIES)) - 79 if ptype != SSH2_AGENT_IDENTITIES_ANSWER: - 80 raise SSHException('could not get keys from ssh-agent') - 81 keys = [] - 82 for i in range(result.get_int()): - 83 keys.append(AgentKey(self, result.get_string())) - 84 result.get_string() - 85 self.keys = tuple(keys) -
86 -
87 - def close(self): -
88 """ - 89 Close the SSH agent connection. - 90 """ - 91 if self.conn is not None: - 92 self.conn.close() - 93 self.conn = None - 94 self.keys = () -
95 -
96 - def get_keys(self): -
97 """ - 98 Return the list of keys available through the SSH agent, if any. If - 99 no SSH agent was running (or it couldn't be contacted), an empty list -100 will be returned. -101 -102 @return: a list of keys available on the SSH agent -103 @rtype: tuple of L{AgentKey} -104 """ -105 return self.keys -
106 -
107 - def _send_message(self, msg): -
108 msg = str(msg) -109 self.conn.send(struct.pack('>I', len(msg)) + msg) -110 l = self._read_all(4) -111 msg = Message(self._read_all(struct.unpack('>I', l)[0])) -112 return ord(msg.get_byte()), msg -
113 -
114 - def _read_all(self, wanted): -
115 result = self.conn.recv(wanted) -116 while len(result) < wanted: -117 if len(result) == 0: -118 raise SSHException('lost ssh-agent') -119 extra = self.conn.recv(wanted - len(result)) -120 if len(extra) == 0: -121 raise SSHException('lost ssh-agent') -122 result += extra -123 return result -
124 -125 -
126 -class AgentKey(PKey): -
127 """ -128 Private key held in a local SSH agent. This type of key can be used for -129 authenticating to a remote server (signing). Most other key operations -130 work as expected. -131 """ -132 -
133 - def __init__(self, agent, blob): -
134 self.agent = agent -135 self.blob = blob -136 self.name = Message(blob).get_string() -
137 -
138 - def __str__(self): -
139 return self.blob -
140 -
141 - def get_name(self): -
142 return self.name -
143 -
144 - def sign_ssh_data(self, rng, data): -
145 msg = Message() -146 msg.add_byte(chr(SSH2_AGENTC_SIGN_REQUEST)) -147 msg.add_string(self.blob) -148 msg.add_string(data) -149 msg.add_int(0) -150 ptype, result = self.agent._send_message(msg) -151 if ptype != SSH2_AGENT_SIGN_RESPONSE: -152 raise SSHException('key cannot be used for signing') -153 return result.get_string() -
154 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.auth_handler-module.html b/docs/paramiko.auth_handler-module.html deleted file mode 100644 index fb61b0d..0000000 --- a/docs/paramiko.auth_handler-module.html +++ /dev/null @@ -1,531 +0,0 @@ - - - - - paramiko.auth_handler - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module auth_handler - - - - - -
[frames] | no frames]
-
- -

Module auth_handler

source code

-

AuthHandler

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Variables
-   - - AUTH_FAILED = 2 -
-   - - AUTH_PARTIALLY_SUCCESSFUL = 1 -
-   - - AUTH_SUCCESSFUL = 0 -
-   - - CONNECTION_FAILED_CODE = {1: 'Administratively prohibited', 2:... -
-   - - CRITICAL = 50 -
-   - - DEBUG = 10 -
-   - - DISCONNECT_AUTH_CANCELLED_BY_USER = 13 -
-   - - DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14 -
-   - - DISCONNECT_SERVICE_NOT_AVAILABLE = 7 -
-   - - ERROR = 40 -
-   - - INFO = 20 -
-   - - MSG_CHANNEL_CLOSE = 97 -
-   - - MSG_CHANNEL_DATA = 94 -
-   - - MSG_CHANNEL_EOF = 96 -
-   - - MSG_CHANNEL_EXTENDED_DATA = 95 -
-   - - MSG_CHANNEL_FAILURE = 100 -
-   - - MSG_CHANNEL_OPEN = 90 -
-   - - MSG_CHANNEL_OPEN_FAILURE = 92 -
-   - - MSG_CHANNEL_OPEN_SUCCESS = 91 -
-   - - MSG_CHANNEL_REQUEST = 98 -
-   - - MSG_CHANNEL_SUCCESS = 99 -
-   - - MSG_CHANNEL_WINDOW_ADJUST = 93 -
-   - - MSG_DEBUG = 4 -
-   - - MSG_DISCONNECT = 1 -
-   - - MSG_GLOBAL_REQUEST = 80 -
-   - - MSG_IGNORE = 2 -
-   - - MSG_KEXINIT = 20 -
-   - - MSG_NAMES = {1: 'disconnect', 2: 'ignore', 3: 'unimplemented',... -
-   - - MSG_NEWKEYS = 21 -
-   - - MSG_REQUEST_FAILURE = 82 -
-   - - MSG_REQUEST_SUCCESS = 81 -
-   - - MSG_SERVICE_ACCEPT = 6 -
-   - - MSG_SERVICE_REQUEST = 5 -
-   - - MSG_UNIMPLEMENTED = 3 -
-   - - MSG_USERAUTH_BANNER = 53 -
-   - - MSG_USERAUTH_FAILURE = 51 -
-   - - MSG_USERAUTH_INFO_REQUEST = 60 -
-   - - MSG_USERAUTH_INFO_RESPONSE = 61 -
-   - - MSG_USERAUTH_PK_OK = 60 -
-   - - MSG_USERAUTH_REQUEST = 50 -
-   - - MSG_USERAUTH_SUCCESS = 52 -
-   - - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED = 1 -
-   - - OPEN_FAILED_CONNECT_FAILED = 2 -
-   - - OPEN_FAILED_RESOURCE_SHORTAGE = 4 -
-   - - OPEN_FAILED_UNKNOWN_CHANNEL_TYPE = 3 -
-   - - OPEN_SUCCEEDED = 0 -
-   - - PY22 = False -
-   - - WARNING = 30 -
-   - - __package__ = 'paramiko' -
-   - - rng = Random.new() -
- - - - - - -
- Variables Details
- -
- -
-

CONNECTION_FAILED_CODE

- -
-
-
-
Value:
-
-{1: 'Administratively prohibited',
- 2: 'Connect failed',
- 3: 'Unknown channel type',
- 4: 'Resource shortage'}
-
-
-
-
-
- -
- -
-

MSG_NAMES

- -
-
-
-
Value:
-
-{1: 'disconnect',
- 2: 'ignore',
- 3: 'unimplemented',
- 4: 'debug',
- 5: 'service-request',
- 6: 'service-accept',
- 20: 'kexinit',
- 21: 'newkeys',
-...
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.auth_handler-pysrc.html b/docs/paramiko.auth_handler-pysrc.html deleted file mode 100644 index 5015ec8..0000000 --- a/docs/paramiko.auth_handler-pysrc.html +++ /dev/null @@ -1,1514 +0,0 @@ - - - - - paramiko.auth_handler - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module auth_handler - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.auth_handler

-
-  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  L{AuthHandler} 
- 21  """ 
- 22   
- 23  import threading 
- 24  import weakref 
- 25   
- 26  # this helps freezing utils 
- 27  import encodings.utf_8 
- 28   
- 29  from paramiko.common import * 
- 30  from paramiko import util 
- 31  from paramiko.message import Message 
- 32  from paramiko.ssh_exception import SSHException, AuthenticationException, \ 
- 33      BadAuthenticationType, PartialAuthentication 
- 34  from paramiko.server import InteractiveQuery 
- 35   
- 36   
-
37 -class AuthHandler (object): -
38 """ - 39 Internal class to handle the mechanics of authentication. - 40 """ - 41 -
42 - def __init__(self, transport): -
43 self.transport = weakref.proxy(transport) - 44 self.username = None - 45 self.authenticated = False - 46 self.auth_event = None - 47 self.auth_method = '' - 48 self.password = None - 49 self.private_key = None - 50 self.interactive_handler = None - 51 self.submethods = None - 52 # for server mode: - 53 self.auth_username = None - 54 self.auth_fail_count = 0 -
55 -
56 - def is_authenticated(self): -
57 return self.authenticated -
58 -
59 - def get_username(self): -
60 if self.transport.server_mode: - 61 return self.auth_username - 62 else: - 63 return self.username -
64 -
65 - def auth_none(self, username, event): -
66 self.transport.lock.acquire() - 67 try: - 68 self.auth_event = event - 69 self.auth_method = 'none' - 70 self.username = username - 71 self._request_auth() - 72 finally: - 73 self.transport.lock.release() -
74 -
75 - def auth_publickey(self, username, key, event): -
76 self.transport.lock.acquire() - 77 try: - 78 self.auth_event = event - 79 self.auth_method = 'publickey' - 80 self.username = username - 81 self.private_key = key - 82 self._request_auth() - 83 finally: - 84 self.transport.lock.release() -
85 -
86 - def auth_password(self, username, password, event): -
87 self.transport.lock.acquire() - 88 try: - 89 self.auth_event = event - 90 self.auth_method = 'password' - 91 self.username = username - 92 self.password = password - 93 self._request_auth() - 94 finally: - 95 self.transport.lock.release() -
96 -
97 - def auth_interactive(self, username, handler, event, submethods=''): -
98 """ - 99 response_list = handler(title, instructions, prompt_list) -100 """ -101 self.transport.lock.acquire() -102 try: -103 self.auth_event = event -104 self.auth_method = 'keyboard-interactive' -105 self.username = username -106 self.interactive_handler = handler -107 self.submethods = submethods -108 self._request_auth() -109 finally: -110 self.transport.lock.release() -
111 -
112 - def abort(self): -
113 if self.auth_event is not None: -114 self.auth_event.set() -
115 -116 -117 ### internals... -118 -119 -
120 - def _request_auth(self): -
121 m = Message() -122 m.add_byte(chr(MSG_SERVICE_REQUEST)) -123 m.add_string('ssh-userauth') -124 self.transport._send_message(m) -
125 -
127 m = Message() -128 m.add_byte(chr(MSG_DISCONNECT)) -129 m.add_int(DISCONNECT_SERVICE_NOT_AVAILABLE) -130 m.add_string('Service not available') -131 m.add_string('en') -132 self.transport._send_message(m) -133 self.transport.close() -
134 -
135 - def _disconnect_no_more_auth(self): -
136 m = Message() -137 m.add_byte(chr(MSG_DISCONNECT)) -138 m.add_int(DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE) -139 m.add_string('No more auth methods available') -140 m.add_string('en') -141 self.transport._send_message(m) -142 self.transport.close() -
143 -
144 - def _get_session_blob(self, key, service, username): -
145 m = Message() -146 m.add_string(self.transport.session_id) -147 m.add_byte(chr(MSG_USERAUTH_REQUEST)) -148 m.add_string(username) -149 m.add_string(service) -150 m.add_string('publickey') -151 m.add_boolean(1) -152 m.add_string(key.get_name()) -153 m.add_string(str(key)) -154 return str(m) -
155 -
156 - def wait_for_response(self, event): -
157 while True: -158 event.wait(0.1) -159 if not self.transport.is_active(): -160 e = self.transport.get_exception() -161 if (e is None) or issubclass(e.__class__, EOFError): -162 e = AuthenticationException('Authentication failed.') -163 raise e -164 if event.isSet(): -165 break -166 if not self.is_authenticated(): -167 e = self.transport.get_exception() -168 if e is None: -169 e = AuthenticationException('Authentication failed.') -170 # this is horrible. python Exception isn't yet descended from -171 # object, so type(e) won't work. :( -172 if issubclass(e.__class__, PartialAuthentication): -173 return e.allowed_types -174 raise e -175 return [] -
176 -
177 - def _parse_service_request(self, m): -
178 service = m.get_string() -179 if self.transport.server_mode and (service == 'ssh-userauth'): -180 # accepted -181 m = Message() -182 m.add_byte(chr(MSG_SERVICE_ACCEPT)) -183 m.add_string(service) -184 self.transport._send_message(m) -185 return -186 # dunno this one -187 self._disconnect_service_not_available() -
188 -
189 - def _parse_service_accept(self, m): -
190 service = m.get_string() -191 if service == 'ssh-userauth': -192 self.transport._log(DEBUG, 'userauth is OK') -193 m = Message() -194 m.add_byte(chr(MSG_USERAUTH_REQUEST)) -195 m.add_string(self.username) -196 m.add_string('ssh-connection') -197 m.add_string(self.auth_method) -198 if self.auth_method == 'password': -199 m.add_boolean(False) -200 password = self.password -201 if isinstance(password, unicode): -202 password = password.encode('UTF-8') -203 m.add_string(password) -204 elif self.auth_method == 'publickey': -205 m.add_boolean(True) -206 m.add_string(self.private_key.get_name()) -207 m.add_string(str(self.private_key)) -208 blob = self._get_session_blob(self.private_key, 'ssh-connection', self.username) -209 sig = self.private_key.sign_ssh_data(self.transport.rng, blob) -210 m.add_string(str(sig)) -211 elif self.auth_method == 'keyboard-interactive': -212 m.add_string('') -213 m.add_string(self.submethods) -214 elif self.auth_method == 'none': -215 pass -216 else: -217 raise SSHException('Unknown auth method "%s"' % self.auth_method) -218 self.transport._send_message(m) -219 else: -220 self.transport._log(DEBUG, 'Service request "%s" accepted (?)' % service) -
221 -
222 - def _send_auth_result(self, username, method, result): -
223 # okay, send result -224 m = Message() -225 if result == AUTH_SUCCESSFUL: -226 self.transport._log(INFO, 'Auth granted (%s).' % method) -227 m.add_byte(chr(MSG_USERAUTH_SUCCESS)) -228 self.authenticated = True -229 else: -230 self.transport._log(INFO, 'Auth rejected (%s).' % method) -231 m.add_byte(chr(MSG_USERAUTH_FAILURE)) -232 m.add_string(self.transport.server_object.get_allowed_auths(username)) -233 if result == AUTH_PARTIALLY_SUCCESSFUL: -234 m.add_boolean(1) -235 else: -236 m.add_boolean(0) -237 self.auth_fail_count += 1 -238 self.transport._send_message(m) -239 if self.auth_fail_count >= 10: -240 self._disconnect_no_more_auth() -241 if result == AUTH_SUCCESSFUL: -242 self.transport._auth_trigger() -
243 -
244 - def _interactive_query(self, q): -
245 # make interactive query instead of response -246 m = Message() -247 m.add_byte(chr(MSG_USERAUTH_INFO_REQUEST)) -248 m.add_string(q.name) -249 m.add_string(q.instructions) -250 m.add_string('') -251 m.add_int(len(q.prompts)) -252 for p in q.prompts: -253 m.add_string(p[0]) -254 m.add_boolean(p[1]) -255 self.transport._send_message(m) -
256 -
257 - def _parse_userauth_request(self, m): -
258 if not self.transport.server_mode: -259 # er, uh... what? -260 m = Message() -261 m.add_byte(chr(MSG_USERAUTH_FAILURE)) -262 m.add_string('none') -263 m.add_boolean(0) -264 self.transport._send_message(m) -265 return -266 if self.authenticated: -267 # ignore -268 return -269 username = m.get_string() -270 service = m.get_string() -271 method = m.get_string() -272 self.transport._log(DEBUG, 'Auth request (type=%s) service=%s, username=%s' % (method, service, username)) -273 if service != 'ssh-connection': -274 self._disconnect_service_not_available() -275 return -276 if (self.auth_username is not None) and (self.auth_username != username): -277 self.transport._log(WARNING, 'Auth rejected because the client attempted to change username in mid-flight') -278 self._disconnect_no_more_auth() -279 return -280 self.auth_username = username -281 -282 if method == 'none': -283 result = self.transport.server_object.check_auth_none(username) -284 elif method == 'password': -285 changereq = m.get_boolean() -286 password = m.get_string() -287 try: -288 password = password.decode('UTF-8') -289 except UnicodeError: -290 # some clients/servers expect non-utf-8 passwords! -291 # in this case, just return the raw byte string. -292 pass -293 if changereq: -294 # always treated as failure, since we don't support changing passwords, but collect -295 # the list of valid auth types from the callback anyway -296 self.transport._log(DEBUG, 'Auth request to change passwords (rejected)') -297 newpassword = m.get_string() -298 try: -299 newpassword = newpassword.decode('UTF-8', 'replace') -300 except UnicodeError: -301 pass -302 result = AUTH_FAILED -303 else: -304 result = self.transport.server_object.check_auth_password(username, password) -305 elif method == 'publickey': -306 sig_attached = m.get_boolean() -307 keytype = m.get_string() -308 keyblob = m.get_string() -309 try: -310 key = self.transport._key_info[keytype](Message(keyblob)) -311 except SSHException, e: -312 self.transport._log(INFO, 'Auth rejected: public key: %s' % str(e)) -313 key = None -314 except: -315 self.transport._log(INFO, 'Auth rejected: unsupported or mangled public key') -316 key = None -317 if key is None: -318 self._disconnect_no_more_auth() -319 return -320 # first check if this key is okay... if not, we can skip the verify -321 result = self.transport.server_object.check_auth_publickey(username, key) -322 if result != AUTH_FAILED: -323 # key is okay, verify it -324 if not sig_attached: -325 # client wants to know if this key is acceptable, before it -326 # signs anything... send special "ok" message -327 m = Message() -328 m.add_byte(chr(MSG_USERAUTH_PK_OK)) -329 m.add_string(keytype) -330 m.add_string(keyblob) -331 self.transport._send_message(m) -332 return -333 sig = Message(m.get_string()) -334 blob = self._get_session_blob(key, service, username) -335 if not key.verify_ssh_sig(blob, sig): -336 self.transport._log(INFO, 'Auth rejected: invalid signature') -337 result = AUTH_FAILED -338 elif method == 'keyboard-interactive': -339 lang = m.get_string() -340 submethods = m.get_string() -341 result = self.transport.server_object.check_auth_interactive(username, submethods) -342 if isinstance(result, InteractiveQuery): -343 # make interactive query instead of response -344 self._interactive_query(result) -345 return -346 else: -347 result = self.transport.server_object.check_auth_none(username) -348 # okay, send result -349 self._send_auth_result(username, method, result) -
350 -
351 - def _parse_userauth_success(self, m): -
352 self.transport._log(INFO, 'Authentication (%s) successful!' % self.auth_method) -353 self.authenticated = True -354 self.transport._auth_trigger() -355 if self.auth_event != None: -356 self.auth_event.set() -
357 -
358 - def _parse_userauth_failure(self, m): -
359 authlist = m.get_list() -360 partial = m.get_boolean() -361 if partial: -362 self.transport._log(INFO, 'Authentication continues...') -363 self.transport._log(DEBUG, 'Methods: ' + str(authlist)) -364 self.transport.saved_exception = PartialAuthentication(authlist) -365 elif self.auth_method not in authlist: -366 self.transport._log(DEBUG, 'Authentication type (%s) not permitted.' % self.auth_method) -367 self.transport._log(DEBUG, 'Allowed methods: ' + str(authlist)) -368 self.transport.saved_exception = BadAuthenticationType('Bad authentication type', authlist) -369 else: -370 self.transport._log(INFO, 'Authentication (%s) failed.' % self.auth_method) -371 self.authenticated = False -372 self.username = None -373 if self.auth_event != None: -374 self.auth_event.set() -
375 -
376 - def _parse_userauth_banner(self, m): -
377 banner = m.get_string() -378 lang = m.get_string() -379 self.transport._log(INFO, 'Auth banner: ' + banner) -
380 # who cares. -381 -
382 - def _parse_userauth_info_request(self, m): -
383 if self.auth_method != 'keyboard-interactive': -384 raise SSHException('Illegal info request from server') -385 title = m.get_string() -386 instructions = m.get_string() -387 m.get_string() # lang -388 prompts = m.get_int() -389 prompt_list = [] -390 for i in range(prompts): -391 prompt_list.append((m.get_string(), m.get_boolean())) -392 response_list = self.interactive_handler(title, instructions, prompt_list) -393 -394 m = Message() -395 m.add_byte(chr(MSG_USERAUTH_INFO_RESPONSE)) -396 m.add_int(len(response_list)) -397 for r in response_list: -398 m.add_string(r) -399 self.transport._send_message(m) -
400 -
401 - def _parse_userauth_info_response(self, m): -
402 if not self.transport.server_mode: -403 raise SSHException('Illegal info response from server') -404 n = m.get_int() -405 responses = [] -406 for i in range(n): -407 responses.append(m.get_string()) -408 result = self.transport.server_object.check_auth_interactive_response(responses) -409 if isinstance(type(result), InteractiveQuery): -410 # make interactive query instead of response -411 self._interactive_query(result) -412 return -413 self._send_auth_result(self.auth_username, 'keyboard-interactive', result) -
414 -415 -416 _handler_table = { -417 MSG_SERVICE_REQUEST: _parse_service_request, -418 MSG_SERVICE_ACCEPT: _parse_service_accept, -419 MSG_USERAUTH_REQUEST: _parse_userauth_request, -420 MSG_USERAUTH_SUCCESS: _parse_userauth_success, -421 MSG_USERAUTH_FAILURE: _parse_userauth_failure, -422 MSG_USERAUTH_BANNER: _parse_userauth_banner, -423 MSG_USERAUTH_INFO_REQUEST: _parse_userauth_info_request, -424 MSG_USERAUTH_INFO_RESPONSE: _parse_userauth_info_response, -425 } -
426 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.ber-module.html b/docs/paramiko.ber-module.html deleted file mode 100644 index 6012a41..0000000 --- a/docs/paramiko.ber-module.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - - paramiko.ber - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module ber - - - - - -
[frames] | no frames]
-
- -

Module ber

source code

- - - - - - - - - - - - -
- Classes
-   - - BERException -
-   - - BER
- Robey's tiny little attempt at a BER decoder. -
- - - - - - - - - -
- Variables
-   - - __package__ = 'paramiko' -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.ber-pysrc.html b/docs/paramiko.ber-pysrc.html deleted file mode 100644 index d58e1fc..0000000 --- a/docs/paramiko.ber-pysrc.html +++ /dev/null @@ -1,238 +0,0 @@ - - - - - paramiko.ber - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module ber - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.ber

-
-  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19   
- 20  import util 
- 21   
- 22   
-
23 -class BERException (Exception): -
24 pass -
25 - 26 -
27 -class BER(object): -
28 """ - 29 Robey's tiny little attempt at a BER decoder. - 30 """ - 31 -
32 - def __init__(self, content=''): -
33 self.content = content - 34 self.idx = 0 -
35 -
36 - def __str__(self): -
37 return self.content -
38 -
39 - def __repr__(self): -
40 return 'BER(\'' + repr(self.content) + '\')' -
41 -
42 - def decode(self): -
43 return self.decode_next() -
44 -
45 - def decode_next(self): -
46 if self.idx >= len(self.content): - 47 return None - 48 ident = ord(self.content[self.idx]) - 49 self.idx += 1 - 50 if (ident & 31) == 31: - 51 # identifier > 30 - 52 ident = 0 - 53 while self.idx < len(self.content): - 54 t = ord(self.content[self.idx]) - 55 self.idx += 1 - 56 ident = (ident << 7) | (t & 0x7f) - 57 if not (t & 0x80): - 58 break - 59 if self.idx >= len(self.content): - 60 return None - 61 # now fetch length - 62 size = ord(self.content[self.idx]) - 63 self.idx += 1 - 64 if size & 0x80: - 65 # more complimicated... - 66 # FIXME: theoretically should handle indefinite-length (0x80) - 67 t = size & 0x7f - 68 if self.idx + t > len(self.content): - 69 return None - 70 size = util.inflate_long(self.content[self.idx : self.idx + t], True) - 71 self.idx += t - 72 if self.idx + size > len(self.content): - 73 # can't fit - 74 return None - 75 data = self.content[self.idx : self.idx + size] - 76 self.idx += size - 77 # now switch on id - 78 if ident == 0x30: - 79 # sequence - 80 return self.decode_sequence(data) - 81 elif ident == 2: - 82 # int - 83 return util.inflate_long(data) - 84 else: - 85 # 1: boolean (00 false, otherwise true) - 86 raise BERException('Unknown ber encoding type %d (robey is lazy)' % ident) -
87 -
88 - def decode_sequence(data): -
89 out = [] - 90 b = BER(data) - 91 while True: - 92 x = b.decode_next() - 93 if x is None: - 94 break - 95 out.append(x) - 96 return out -
97 decode_sequence = staticmethod(decode_sequence) - 98 -
99 - def encode_tlv(self, ident, val): -
100 # no need to support ident > 31 here -101 self.content += chr(ident) -102 if len(val) > 0x7f: -103 lenstr = util.deflate_long(len(val)) -104 self.content += chr(0x80 + len(lenstr)) + lenstr -105 else: -106 self.content += chr(len(val)) -107 self.content += val -
108 -
109 - def encode(self, x): -
110 if type(x) is bool: -111 if x: -112 self.encode_tlv(1, '\xff') -113 else: -114 self.encode_tlv(1, '\x00') -115 elif (type(x) is int) or (type(x) is long): -116 self.encode_tlv(2, util.deflate_long(x)) -117 elif type(x) is str: -118 self.encode_tlv(4, x) -119 elif (type(x) is list) or (type(x) is tuple): -120 self.encode_tlv(0x30, self.encode_sequence(x)) -121 else: -122 raise BERException('Unknown type for encoding: %s' % repr(type(x))) -
123 -
124 - def encode_sequence(data): -
125 b = BER() -126 for item in data: -127 b.encode(item) -128 return str(b) -
129 encode_sequence = staticmethod(encode_sequence) -
130 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.ber.BER-class.html b/docs/paramiko.ber.BER-class.html deleted file mode 100644 index 1765e9a..0000000 --- a/docs/paramiko.ber.BER-class.html +++ /dev/null @@ -1,397 +0,0 @@ - - - - - paramiko.ber.BER - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module ber :: - Class BER - - - - - -
[frames] | no frames]
-
- -

Class BER

source code

-
-object --+
-         |
-        BER
-
- -
-

Robey's tiny little attempt at a BER decoder.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - content='')
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
-   - - - - - - -
__str__(self)
- str(x)
- source code - -
- -
-   - - - - - - -
__repr__(self)
- repr(x)
- source code - -
- -
-   - - - - - - -
decode(self) - source code - -
- -
-   - - - - - - -
decode_next(self) - source code - -
- -
-   - - - - - - -
encode_tlv(self, - ident, - val) - source code - -
- -
-   - - - - - - -
encode(self, - x) - source code - -
- -
-

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

-
- - - - - - - - - - - - -
- Static Methods
-   - - - - - - -
decode_sequence(data) - source code - -
- -
-   - - - - - - -
encode_sequence(data) - source code - -
- -
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - content='') -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

__str__(self) -
(Informal representation operator) -

-
source code  -
- -

str(x)

-
-
Overrides: - object.__str__ -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

__repr__(self) -
(Representation operator) -

-
source code  -
- -

repr(x)

-
-
Overrides: - object.__repr__ -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.ber.BERException-class.html b/docs/paramiko.ber.BERException-class.html deleted file mode 100644 index c49bebf..0000000 --- a/docs/paramiko.ber.BERException-class.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - paramiko.ber.BERException - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module ber :: - Class BERException - - - - - -
[frames] | no frames]
-
- -

Class BERException

source code

-
-              object --+        
-                       |        
-exceptions.BaseException --+    
-                           |    
-        exceptions.Exception --+
-                               |
-                              BERException
-
- -
- - - - - - - - - -
- Instance Methods
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- Properties
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.buffered_pipe-module.html b/docs/paramiko.buffered_pipe-module.html deleted file mode 100644 index 1b88510..0000000 --- a/docs/paramiko.buffered_pipe-module.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - paramiko.buffered_pipe - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module buffered_pipe - - - - - -
[frames] | no frames]
-
- -

Module buffered_pipe

source code

-

Attempt to generalize the "feeder" part of a Channel: an - object which can be read from and closed, but is reading from a buffer - fed by another thread. The read operations are blocking and can have a - timeout set.

- - - - - - - - - - - - - -
- Classes
-   - - PipeTimeout
- Indicates that a timeout was reached on a read from a BufferedPipe. -
-   - - BufferedPipe
- A buffer that obeys normal read (with timeout) & close - semantics for a file or socket, but is fed data from another - thread. -
- - - - - - - - - -
- Variables
-   - - __package__ = 'paramiko' -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.buffered_pipe-pysrc.html b/docs/paramiko.buffered_pipe-pysrc.html deleted file mode 100644 index 2ee00dd..0000000 --- a/docs/paramiko.buffered_pipe-pysrc.html +++ /dev/null @@ -1,323 +0,0 @@ - - - - - paramiko.buffered_pipe - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module buffered_pipe - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.buffered_pipe

-
-  1  # Copyright (C) 2006-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  Attempt to generalize the "feeder" part of a Channel: an object which can be 
- 21  read from and closed, but is reading from a buffer fed by another thread.  The 
- 22  read operations are blocking and can have a timeout set. 
- 23  """ 
- 24   
- 25  import array 
- 26  import threading 
- 27  import time 
- 28   
- 29   
-
30 -class PipeTimeout (IOError): -
31 """ - 32 Indicates that a timeout was reached on a read from a L{BufferedPipe}. - 33 """ - 34 pass -
35 - 36 -
37 -class BufferedPipe (object): -
38 """ - 39 A buffer that obeys normal read (with timeout) & close semantics for a - 40 file or socket, but is fed data from another thread. This is used by - 41 L{Channel}. - 42 """ - 43 -
44 - def __init__(self): -
45 self._lock = threading.Lock() - 46 self._cv = threading.Condition(self._lock) - 47 self._event = None - 48 self._buffer = array.array('B') - 49 self._closed = False -
50 -
51 - def set_event(self, event): -
52 """ - 53 Set an event on this buffer. When data is ready to be read (or the - 54 buffer has been closed), the event will be set. When no data is - 55 ready, the event will be cleared. - 56 - 57 @param event: the event to set/clear - 58 @type event: Event - 59 """ - 60 self._event = event - 61 if len(self._buffer) > 0: - 62 event.set() - 63 else: - 64 event.clear() -
65 -
66 - def feed(self, data): -
67 """ - 68 Feed new data into this pipe. This method is assumed to be called - 69 from a separate thread, so synchronization is done. - 70 - 71 @param data: the data to add - 72 @type data: str - 73 """ - 74 self._lock.acquire() - 75 try: - 76 if self._event is not None: - 77 self._event.set() - 78 self._buffer.fromstring(data) - 79 self._cv.notifyAll() - 80 finally: - 81 self._lock.release() -
82 -
83 - def read_ready(self): -
84 """ - 85 Returns true if data is buffered and ready to be read from this - 86 feeder. A C{False} result does not mean that the feeder has closed; - 87 it means you may need to wait before more data arrives. - 88 - 89 @return: C{True} if a L{read} call would immediately return at least - 90 one byte; C{False} otherwise. - 91 @rtype: bool - 92 """ - 93 self._lock.acquire() - 94 try: - 95 if len(self._buffer) == 0: - 96 return False - 97 return True - 98 finally: - 99 self._lock.release() -
100 -
101 - def read(self, nbytes, timeout=None): -
102 """ -103 Read data from the pipe. The return value is a string representing -104 the data received. The maximum amount of data to be received at once -105 is specified by C{nbytes}. If a string of length zero is returned, -106 the pipe has been closed. -107 -108 The optional C{timeout} argument can be a nonnegative float expressing -109 seconds, or C{None} for no timeout. If a float is given, a -110 C{PipeTimeout} will be raised if the timeout period value has -111 elapsed before any data arrives. -112 -113 @param nbytes: maximum number of bytes to read -114 @type nbytes: int -115 @param timeout: maximum seconds to wait (or C{None}, the default, to -116 wait forever) -117 @type timeout: float -118 @return: data -119 @rtype: str -120 -121 @raise PipeTimeout: if a timeout was specified and no data was ready -122 before that timeout -123 """ -124 out = '' -125 self._lock.acquire() -126 try: -127 if len(self._buffer) == 0: -128 if self._closed: -129 return out -130 # should we block? -131 if timeout == 0.0: -132 raise PipeTimeout() -133 # loop here in case we get woken up but a different thread has -134 # grabbed everything in the buffer. -135 while (len(self._buffer) == 0) and not self._closed: -136 then = time.time() -137 self._cv.wait(timeout) -138 if timeout is not None: -139 timeout -= time.time() - then -140 if timeout <= 0.0: -141 raise PipeTimeout() -142 -143 # something's in the buffer and we have the lock! -144 if len(self._buffer) <= nbytes: -145 out = self._buffer.tostring() -146 del self._buffer[:] -147 if (self._event is not None) and not self._closed: -148 self._event.clear() -149 else: -150 out = self._buffer[:nbytes].tostring() -151 del self._buffer[:nbytes] -152 finally: -153 self._lock.release() -154 -155 return out -
156 -
157 - def empty(self): -
158 """ -159 Clear out the buffer and return all data that was in it. -160 -161 @return: any data that was in the buffer prior to clearing it out -162 @rtype: str -163 """ -164 self._lock.acquire() -165 try: -166 out = self._buffer.tostring() -167 del self._buffer[:] -168 if (self._event is not None) and not self._closed: -169 self._event.clear() -170 return out -171 finally: -172 self._lock.release() -
173 -
174 - def close(self): -
175 """ -176 Close this pipe object. Future calls to L{read} after the buffer -177 has been emptied will return immediately with an empty string. -178 """ -179 self._lock.acquire() -180 try: -181 self._closed = True -182 self._cv.notifyAll() -183 if self._event is not None: -184 self._event.set() -185 finally: -186 self._lock.release() -
187 -
188 - def __len__(self): -
189 """ -190 Return the number of bytes buffered. -191 -192 @return: number of bytes bufferes -193 @rtype: int -194 """ -195 self._lock.acquire() -196 try: -197 return len(self._buffer) -198 finally: -199 self._lock.release() -
200 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.buffered_pipe.BufferedPipe-class.html b/docs/paramiko.buffered_pipe.BufferedPipe-class.html deleted file mode 100644 index 4a9d16d..0000000 --- a/docs/paramiko.buffered_pipe.BufferedPipe-class.html +++ /dev/null @@ -1,516 +0,0 @@ - - - - - paramiko.buffered_pipe.BufferedPipe - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module buffered_pipe :: - Class BufferedPipe - - - - - -
[frames] | no frames]
-
- -

Class BufferedPipe

source code

-
-object --+
-         |
-        BufferedPipe
-
- -
-

A buffer that obeys normal read (with timeout) & close semantics - for a file or socket, but is fed data from another thread. This is used - by Channel.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
-   - - - - - - -
set_event(self, - event)
- Set an event on this buffer.
- source code - -
- -
-   - - - - - - -
feed(self, - data)
- Feed new data into this pipe.
- source code - -
- -
- bool - - - - - - -
read_ready(self)
- Returns true if data is buffered and ready to be read from this - feeder.
- source code - -
- -
- str - - - - - - -
read(self, - nbytes, - timeout=None)
- Read data from the pipe.
- source code - -
- -
- str - - - - - - -
empty(self)
- Clear out the buffer and return all data that was in it.
- source code - -
- -
-   - - - - - - -
close(self)
- Close this pipe object.
- source code - -
- -
- int - - - - - - -
__len__(self)
- Return the number of bytes buffered.
- source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self) -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

set_event(self, - event) -

-
source code  -
- -

Set an event on this buffer. When data is ready to be read (or the - buffer has been closed), the event will be set. When no data is ready, - the event will be cleared.

-
-
Parameters:
-
    -
  • event (Event) - the event to set/clear
  • -
-
-
-
- -
- -
- - -
-

feed(self, - data) -

-
source code  -
- -

Feed new data into this pipe. This method is assumed to be called - from a separate thread, so synchronization is done.

-
-
Parameters:
-
    -
  • data (str) - the data to add
  • -
-
-
-
- -
- -
- - -
-

read_ready(self) -

-
source code  -
- -

Returns true if data is buffered and ready to be read from this - feeder. A False result does not mean that the feeder has - closed; it means you may need to wait before more data arrives.

-
-
Returns: bool
-
True if a read call would immediately return at least one - byte; False otherwise.
-
-
-
- -
- -
- - -
-

read(self, - nbytes, - timeout=None) -

-
source code  -
- -

Read data from the pipe. The return value is a string representing - the data received. The maximum amount of data to be received at once is - specified by nbytes. If a string of length zero is - returned, the pipe has been closed.

-

The optional timeout argument can be a nonnegative float - expressing seconds, or None for no timeout. If a float is - given, a PipeTimeout will be raised if the timeout period - value has elapsed before any data arrives.

-
-
Parameters:
-
    -
  • nbytes (int) - maximum number of bytes to read
  • -
  • timeout (float) - maximum seconds to wait (or None, the default, to - wait forever)
  • -
-
Returns: str
-
data
-
Raises:
-
    -
  • PipeTimeout - if a timeout was specified and no data was ready before that - timeout
  • -
-
-
-
- -
- -
- - -
-

empty(self) -

-
source code  -
- -

Clear out the buffer and return all data that was in it.

-
-
Returns: str
-
any data that was in the buffer prior to clearing it out
-
-
-
- -
- -
- - -
-

close(self) -

-
source code  -
- -

Close this pipe object. Future calls to read after the buffer has been emptied will return - immediately with an empty string.

-
-
-
-
- -
- -
- - -
-

__len__(self) -
(Length operator) -

-
source code  -
- -

Return the number of bytes buffered.

-
-
Returns: int
-
number of bytes bufferes
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.buffered_pipe.PipeTimeout-class.html b/docs/paramiko.buffered_pipe.PipeTimeout-class.html deleted file mode 100644 index 0de755a..0000000 --- a/docs/paramiko.buffered_pipe.PipeTimeout-class.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - - paramiko.buffered_pipe.PipeTimeout - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module buffered_pipe :: - Class PipeTimeout - - - - - -
[frames] | no frames]
-
- -

Class PipeTimeout

source code

-
-              object --+                    
-                       |                    
-exceptions.BaseException --+                
-                           |                
-        exceptions.Exception --+            
-                               |            
-        exceptions.StandardError --+        
-                                   |        
-         exceptions.EnvironmentError --+    
-                                       |    
-                      exceptions.IOError --+
-                                           |
-                                          PipeTimeout
-
- -
-

Indicates that a timeout was reached on a read from a BufferedPipe.

- - - - - - - - - - -
- Instance Methods
-

Inherited from exceptions.IOError: - __init__, - __new__ -

-

Inherited from exceptions.EnvironmentError: - __reduce__, - __str__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __repr__, - __setattr__, - __setstate__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- Properties
-

Inherited from exceptions.EnvironmentError: - errno, - filename, - strerror -

-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.channel-module.html b/docs/paramiko.channel-module.html deleted file mode 100644 index 7361776..0000000 --- a/docs/paramiko.channel-module.html +++ /dev/null @@ -1,554 +0,0 @@ - - - - - paramiko.channel - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module channel - - - - - -
[frames] | no frames]
-
- -

Module channel

source code

-

Abstraction for an SSH2 channel.

- - - - - - - - - - -
- Classes
-   - - ChannelStderrFile -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Variables
-   - - MIN_PACKET_SIZE = 1024 -
-   - - AUTH_FAILED = 2 -
-   - - AUTH_PARTIALLY_SUCCESSFUL = 1 -
-   - - AUTH_SUCCESSFUL = 0 -
-   - - CONNECTION_FAILED_CODE = {1: 'Administratively prohibited', 2:... -
-   - - CRITICAL = 50 -
-   - - DEBUG = 10 -
-   - - DISCONNECT_AUTH_CANCELLED_BY_USER = 13 -
-   - - DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14 -
-   - - DISCONNECT_SERVICE_NOT_AVAILABLE = 7 -
-   - - ERROR = 40 -
-   - - INFO = 20 -
-   - - MSG_CHANNEL_CLOSE = 97 -
-   - - MSG_CHANNEL_DATA = 94 -
-   - - MSG_CHANNEL_EOF = 96 -
-   - - MSG_CHANNEL_EXTENDED_DATA = 95 -
-   - - MSG_CHANNEL_FAILURE = 100 -
-   - - MSG_CHANNEL_OPEN = 90 -
-   - - MSG_CHANNEL_OPEN_FAILURE = 92 -
-   - - MSG_CHANNEL_OPEN_SUCCESS = 91 -
-   - - MSG_CHANNEL_REQUEST = 98 -
-   - - MSG_CHANNEL_SUCCESS = 99 -
-   - - MSG_CHANNEL_WINDOW_ADJUST = 93 -
-   - - MSG_DEBUG = 4 -
-   - - MSG_DISCONNECT = 1 -
-   - - MSG_GLOBAL_REQUEST = 80 -
-   - - MSG_IGNORE = 2 -
-   - - MSG_KEXINIT = 20 -
-   - - MSG_NAMES = {1: 'disconnect', 2: 'ignore', 3: 'unimplemented',... -
-   - - MSG_NEWKEYS = 21 -
-   - - MSG_REQUEST_FAILURE = 82 -
-   - - MSG_REQUEST_SUCCESS = 81 -
-   - - MSG_SERVICE_ACCEPT = 6 -
-   - - MSG_SERVICE_REQUEST = 5 -
-   - - MSG_UNIMPLEMENTED = 3 -
-   - - MSG_USERAUTH_BANNER = 53 -
-   - - MSG_USERAUTH_FAILURE = 51 -
-   - - MSG_USERAUTH_INFO_REQUEST = 60 -
-   - - MSG_USERAUTH_INFO_RESPONSE = 61 -
-   - - MSG_USERAUTH_PK_OK = 60 -
-   - - MSG_USERAUTH_REQUEST = 50 -
-   - - MSG_USERAUTH_SUCCESS = 52 -
-   - - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED = 1 -
-   - - OPEN_FAILED_CONNECT_FAILED = 2 -
-   - - OPEN_FAILED_RESOURCE_SHORTAGE = 4 -
-   - - OPEN_FAILED_UNKNOWN_CHANNEL_TYPE = 3 -
-   - - OPEN_SUCCEEDED = 0 -
-   - - PY22 = False -
-   - - WARNING = 30 -
-   - - __package__ = 'paramiko' -
-   - - rng = Random.new() -
- - - - - - -
- Variables Details
- -
- -
-

CONNECTION_FAILED_CODE

- -
-
-
-
Value:
-
-{1: 'Administratively prohibited',
- 2: 'Connect failed',
- 3: 'Unknown channel type',
- 4: 'Resource shortage'}
-
-
-
-
-
- -
- -
-

MSG_NAMES

- -
-
-
-
Value:
-
-{1: 'disconnect',
- 2: 'ignore',
- 3: 'unimplemented',
- 4: 'debug',
- 5: 'service-request',
- 6: 'service-accept',
- 20: 'kexinit',
- 21: 'newkeys',
-...
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.channel-pysrc.html b/docs/paramiko.channel-pysrc.html deleted file mode 100644 index 09e9132..0000000 --- a/docs/paramiko.channel-pysrc.html +++ /dev/null @@ -1,2076 +0,0 @@ - - - - - paramiko.channel - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module channel - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.channel

-
-   1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-   2  # 
-   3  # This file is part of paramiko. 
-   4  # 
-   5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-   6  # terms of the GNU Lesser General Public License as published by the Free 
-   7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-   8  # any later version. 
-   9  # 
-  10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
-  11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
-  12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
-  13  # details. 
-  14  # 
-  15  # You should have received a copy of the GNU Lesser General Public License 
-  16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
-  17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
-  18   
-  19  """ 
-  20  Abstraction for an SSH2 channel. 
-  21  """ 
-  22   
-  23  import binascii 
-  24  import sys 
-  25  import time 
-  26  import threading 
-  27  import socket 
-  28  import os 
-  29   
-  30  from paramiko.common import * 
-  31  from paramiko import util 
-  32  from paramiko.message import Message 
-  33  from paramiko.ssh_exception import SSHException 
-  34  from paramiko.file import BufferedFile 
-  35  from paramiko.buffered_pipe import BufferedPipe, PipeTimeout 
-  36  from paramiko import pipe 
-  37   
-  38   
-  39  # lower bound on the max packet size we'll accept from the remote host 
-  40  MIN_PACKET_SIZE = 1024 
-  41   
-  42   
-
43 -class Channel (object): -
44 """ - 45 A secure tunnel across an SSH L{Transport}. A Channel is meant to behave - 46 like a socket, and has an API that should be indistinguishable from the - 47 python socket API. - 48 - 49 Because SSH2 has a windowing kind of flow control, if you stop reading data - 50 from a Channel and its buffer fills up, the server will be unable to send - 51 you any more data until you read some of it. (This won't affect other - 52 channels on the same transport -- all channels on a single transport are - 53 flow-controlled independently.) Similarly, if the server isn't reading - 54 data you send, calls to L{send} may block, unless you set a timeout. This - 55 is exactly like a normal network socket, so it shouldn't be too surprising. - 56 """ - 57 -
58 - def __init__(self, chanid): -
59 """ - 60 Create a new channel. The channel is not associated with any - 61 particular session or L{Transport} until the Transport attaches it. - 62 Normally you would only call this method from the constructor of a - 63 subclass of L{Channel}. - 64 - 65 @param chanid: the ID of this channel, as passed by an existing - 66 L{Transport}. - 67 @type chanid: int - 68 """ - 69 self.chanid = chanid - 70 self.remote_chanid = 0 - 71 self.transport = None - 72 self.active = False - 73 self.eof_received = 0 - 74 self.eof_sent = 0 - 75 self.in_buffer = BufferedPipe() - 76 self.in_stderr_buffer = BufferedPipe() - 77 self.timeout = None - 78 self.closed = False - 79 self.ultra_debug = False - 80 self.lock = threading.Lock() - 81 self.out_buffer_cv = threading.Condition(self.lock) - 82 self.in_window_size = 0 - 83 self.out_window_size = 0 - 84 self.in_max_packet_size = 0 - 85 self.out_max_packet_size = 0 - 86 self.in_window_threshold = 0 - 87 self.in_window_sofar = 0 - 88 self.status_event = threading.Event() - 89 self._name = str(chanid) - 90 self.logger = util.get_logger('paramiko.transport') - 91 self._pipe = None - 92 self.event = threading.Event() - 93 self.event_ready = False - 94 self.combine_stderr = False - 95 self.exit_status = -1 - 96 self.origin_addr = None -
97 -
98 - def __del__(self): -
99 try: - 100 self.close() - 101 except: - 102 pass -
103 -
104 - def __repr__(self): -
105 """ - 106 Return a string representation of this object, for debugging. - 107 - 108 @rtype: str - 109 """ - 110 out = '<paramiko.Channel %d' % self.chanid - 111 if self.closed: - 112 out += ' (closed)' - 113 elif self.active: - 114 if self.eof_received: - 115 out += ' (EOF received)' - 116 if self.eof_sent: - 117 out += ' (EOF sent)' - 118 out += ' (open) window=%d' % (self.out_window_size) - 119 if len(self.in_buffer) > 0: - 120 out += ' in-buffer=%d' % (len(self.in_buffer),) - 121 out += ' -> ' + repr(self.transport) - 122 out += '>' - 123 return out -
124 -
125 - def get_pty(self, term='vt100', width=80, height=24): -
126 """ - 127 Request a pseudo-terminal from the server. This is usually used right - 128 after creating a client channel, to ask the server to provide some - 129 basic terminal semantics for a shell invoked with L{invoke_shell}. - 130 It isn't necessary (or desirable) to call this method if you're going - 131 to exectue a single command with L{exec_command}. - 132 - 133 @param term: the terminal type to emulate (for example, C{'vt100'}) - 134 @type term: str - 135 @param width: width (in characters) of the terminal screen - 136 @type width: int - 137 @param height: height (in characters) of the terminal screen - 138 @type height: int - 139 - 140 @raise SSHException: if the request was rejected or the channel was - 141 closed - 142 """ - 143 if self.closed or self.eof_received or self.eof_sent or not self.active: - 144 raise SSHException('Channel is not open') - 145 m = Message() - 146 m.add_byte(chr(MSG_CHANNEL_REQUEST)) - 147 m.add_int(self.remote_chanid) - 148 m.add_string('pty-req') - 149 m.add_boolean(True) - 150 m.add_string(term) - 151 m.add_int(width) - 152 m.add_int(height) - 153 # pixel height, width (usually useless) - 154 m.add_int(0).add_int(0) - 155 m.add_string('') - 156 self._event_pending() - 157 self.transport._send_user_message(m) - 158 self._wait_for_event() -
159 -
160 - def invoke_shell(self): -
161 """ - 162 Request an interactive shell session on this channel. If the server - 163 allows it, the channel will then be directly connected to the stdin, - 164 stdout, and stderr of the shell. - 165 - 166 Normally you would call L{get_pty} before this, in which case the - 167 shell will operate through the pty, and the channel will be connected - 168 to the stdin and stdout of the pty. - 169 - 170 When the shell exits, the channel will be closed and can't be reused. - 171 You must open a new channel if you wish to open another shell. - 172 - 173 @raise SSHException: if the request was rejected or the channel was - 174 closed - 175 """ - 176 if self.closed or self.eof_received or self.eof_sent or not self.active: - 177 raise SSHException('Channel is not open') - 178 m = Message() - 179 m.add_byte(chr(MSG_CHANNEL_REQUEST)) - 180 m.add_int(self.remote_chanid) - 181 m.add_string('shell') - 182 m.add_boolean(1) - 183 self._event_pending() - 184 self.transport._send_user_message(m) - 185 self._wait_for_event() -
186 -
187 - def exec_command(self, command): -
188 """ - 189 Execute a command on the server. If the server allows it, the channel - 190 will then be directly connected to the stdin, stdout, and stderr of - 191 the command being executed. - 192 - 193 When the command finishes executing, the channel will be closed and - 194 can't be reused. You must open a new channel if you wish to execute - 195 another command. - 196 - 197 @param command: a shell command to execute. - 198 @type command: str - 199 - 200 @raise SSHException: if the request was rejected or the channel was - 201 closed - 202 """ - 203 if self.closed or self.eof_received or self.eof_sent or not self.active: - 204 raise SSHException('Channel is not open') - 205 m = Message() - 206 m.add_byte(chr(MSG_CHANNEL_REQUEST)) - 207 m.add_int(self.remote_chanid) - 208 m.add_string('exec') - 209 m.add_boolean(True) - 210 m.add_string(command) - 211 self._event_pending() - 212 self.transport._send_user_message(m) - 213 self._wait_for_event() -
214 -
215 - def invoke_subsystem(self, subsystem): -
216 """ - 217 Request a subsystem on the server (for example, C{sftp}). If the - 218 server allows it, the channel will then be directly connected to the - 219 requested subsystem. - 220 - 221 When the subsystem finishes, the channel will be closed and can't be - 222 reused. - 223 - 224 @param subsystem: name of the subsystem being requested. - 225 @type subsystem: str - 226 - 227 @raise SSHException: if the request was rejected or the channel was - 228 closed - 229 """ - 230 if self.closed or self.eof_received or self.eof_sent or not self.active: - 231 raise SSHException('Channel is not open') - 232 m = Message() - 233 m.add_byte(chr(MSG_CHANNEL_REQUEST)) - 234 m.add_int(self.remote_chanid) - 235 m.add_string('subsystem') - 236 m.add_boolean(True) - 237 m.add_string(subsystem) - 238 self._event_pending() - 239 self.transport._send_user_message(m) - 240 self._wait_for_event() -
241 -
242 - def resize_pty(self, width=80, height=24): -
243 """ - 244 Resize the pseudo-terminal. This can be used to change the width and - 245 height of the terminal emulation created in a previous L{get_pty} call. - 246 - 247 @param width: new width (in characters) of the terminal screen - 248 @type width: int - 249 @param height: new height (in characters) of the terminal screen - 250 @type height: int - 251 - 252 @raise SSHException: if the request was rejected or the channel was - 253 closed - 254 """ - 255 if self.closed or self.eof_received or self.eof_sent or not self.active: - 256 raise SSHException('Channel is not open') - 257 m = Message() - 258 m.add_byte(chr(MSG_CHANNEL_REQUEST)) - 259 m.add_int(self.remote_chanid) - 260 m.add_string('window-change') - 261 m.add_boolean(True) - 262 m.add_int(width) - 263 m.add_int(height) - 264 m.add_int(0).add_int(0) - 265 self._event_pending() - 266 self.transport._send_user_message(m) - 267 self._wait_for_event() -
268 -
269 - def exit_status_ready(self): -
270 """ - 271 Return true if the remote process has exited and returned an exit - 272 status. You may use this to poll the process status if you don't - 273 want to block in L{recv_exit_status}. Note that the server may not - 274 return an exit status in some cases (like bad servers). - 275 - 276 @return: True if L{recv_exit_status} will return immediately - 277 @rtype: bool - 278 @since: 1.7.3 - 279 """ - 280 return self.closed or self.status_event.isSet() -
281 -
282 - def recv_exit_status(self): -
283 """ - 284 Return the exit status from the process on the server. This is - 285 mostly useful for retrieving the reults of an L{exec_command}. - 286 If the command hasn't finished yet, this method will wait until - 287 it does, or until the channel is closed. If no exit status is - 288 provided by the server, -1 is returned. - 289 - 290 @return: the exit code of the process on the server. - 291 @rtype: int - 292 - 293 @since: 1.2 - 294 """ - 295 self.status_event.wait() - 296 assert self.status_event.isSet() - 297 return self.exit_status -
298 -
299 - def send_exit_status(self, status): -
300 """ - 301 Send the exit status of an executed command to the client. (This - 302 really only makes sense in server mode.) Many clients expect to - 303 get some sort of status code back from an executed command after - 304 it completes. - 305 - 306 @param status: the exit code of the process - 307 @type status: int - 308 - 309 @since: 1.2 - 310 """ - 311 # in many cases, the channel will not still be open here. - 312 # that's fine. - 313 m = Message() - 314 m.add_byte(chr(MSG_CHANNEL_REQUEST)) - 315 m.add_int(self.remote_chanid) - 316 m.add_string('exit-status') - 317 m.add_boolean(False) - 318 m.add_int(status) - 319 self.transport._send_user_message(m) -
320 -
321 - def request_x11(self, screen_number=0, auth_protocol=None, auth_cookie=None, - 322 single_connection=False, handler=None): -
323 """ - 324 Request an x11 session on this channel. If the server allows it, - 325 further x11 requests can be made from the server to the client, - 326 when an x11 application is run in a shell session. - 327 - 328 From RFC4254:: - 329 - 330 It is RECOMMENDED that the 'x11 authentication cookie' that is - 331 sent be a fake, random cookie, and that the cookie be checked and - 332 replaced by the real cookie when a connection request is received. - 333 - 334 If you omit the auth_cookie, a new secure random 128-bit value will be - 335 generated, used, and returned. You will need to use this value to - 336 verify incoming x11 requests and replace them with the actual local - 337 x11 cookie (which requires some knoweldge of the x11 protocol). - 338 - 339 If a handler is passed in, the handler is called from another thread - 340 whenever a new x11 connection arrives. The default handler queues up - 341 incoming x11 connections, which may be retrieved using - 342 L{Transport.accept}. The handler's calling signature is:: - 343 - 344 handler(channel: Channel, (address: str, port: int)) - 345 - 346 @param screen_number: the x11 screen number (0, 10, etc) - 347 @type screen_number: int - 348 @param auth_protocol: the name of the X11 authentication method used; - 349 if none is given, C{"MIT-MAGIC-COOKIE-1"} is used - 350 @type auth_protocol: str - 351 @param auth_cookie: hexadecimal string containing the x11 auth cookie; - 352 if none is given, a secure random 128-bit value is generated - 353 @type auth_cookie: str - 354 @param single_connection: if True, only a single x11 connection will be - 355 forwarded (by default, any number of x11 connections can arrive - 356 over this session) - 357 @type single_connection: bool - 358 @param handler: an optional handler to use for incoming X11 connections - 359 @type handler: function - 360 @return: the auth_cookie used - 361 """ - 362 if self.closed or self.eof_received or self.eof_sent or not self.active: - 363 raise SSHException('Channel is not open') - 364 if auth_protocol is None: - 365 auth_protocol = 'MIT-MAGIC-COOKIE-1' - 366 if auth_cookie is None: - 367 auth_cookie = binascii.hexlify(self.transport.rng.read(16)) - 368 - 369 m = Message() - 370 m.add_byte(chr(MSG_CHANNEL_REQUEST)) - 371 m.add_int(self.remote_chanid) - 372 m.add_string('x11-req') - 373 m.add_boolean(True) - 374 m.add_boolean(single_connection) - 375 m.add_string(auth_protocol) - 376 m.add_string(auth_cookie) - 377 m.add_int(screen_number) - 378 self._event_pending() - 379 self.transport._send_user_message(m) - 380 self._wait_for_event() - 381 self.transport._set_x11_handler(handler) - 382 return auth_cookie -
383 -
384 - def get_transport(self): -
385 """ - 386 Return the L{Transport} associated with this channel. - 387 - 388 @return: the L{Transport} that was used to create this channel. - 389 @rtype: L{Transport} - 390 """ - 391 return self.transport -
392 -
393 - def set_name(self, name): -
394 """ - 395 Set a name for this channel. Currently it's only used to set the name - 396 of the channel in logfile entries. The name can be fetched with the - 397 L{get_name} method. - 398 - 399 @param name: new channel name - 400 @type name: str - 401 """ - 402 self._name = name -
403 -
404 - def get_name(self): -
405 """ - 406 Get the name of this channel that was previously set by L{set_name}. - 407 - 408 @return: the name of this channel. - 409 @rtype: str - 410 """ - 411 return self._name -
412 -
413 - def get_id(self): -
414 """ - 415 Return the ID # for this channel. The channel ID is unique across - 416 a L{Transport} and usually a small number. It's also the number - 417 passed to L{ServerInterface.check_channel_request} when determining - 418 whether to accept a channel request in server mode. - 419 - 420 @return: the ID of this channel. - 421 @rtype: int - 422 """ - 423 return self.chanid -
424 -
425 - def set_combine_stderr(self, combine): -
426 """ - 427 Set whether stderr should be combined into stdout on this channel. - 428 The default is C{False}, but in some cases it may be convenient to - 429 have both streams combined. - 430 - 431 If this is C{False}, and L{exec_command} is called (or C{invoke_shell} - 432 with no pty), output to stderr will not show up through the L{recv} - 433 and L{recv_ready} calls. You will have to use L{recv_stderr} and - 434 L{recv_stderr_ready} to get stderr output. - 435 - 436 If this is C{True}, data will never show up via L{recv_stderr} or - 437 L{recv_stderr_ready}. - 438 - 439 @param combine: C{True} if stderr output should be combined into - 440 stdout on this channel. - 441 @type combine: bool - 442 @return: previous setting. - 443 @rtype: bool - 444 - 445 @since: 1.1 - 446 """ - 447 data = '' - 448 self.lock.acquire() - 449 try: - 450 old = self.combine_stderr - 451 self.combine_stderr = combine - 452 if combine and not old: - 453 # copy old stderr buffer into primary buffer - 454 data = self.in_stderr_buffer.empty() - 455 finally: - 456 self.lock.release() - 457 if len(data) > 0: - 458 self._feed(data) - 459 return old -
460 - 461 - 462 ### socket API - 463 - 464 -
465 - def settimeout(self, timeout): -
466 """ - 467 Set a timeout on blocking read/write operations. The C{timeout} - 468 argument can be a nonnegative float expressing seconds, or C{None}. If - 469 a float is given, subsequent channel read/write operations will raise - 470 a timeout exception if the timeout period value has elapsed before the - 471 operation has completed. Setting a timeout of C{None} disables - 472 timeouts on socket operations. - 473 - 474 C{chan.settimeout(0.0)} is equivalent to C{chan.setblocking(0)}; - 475 C{chan.settimeout(None)} is equivalent to C{chan.setblocking(1)}. - 476 - 477 @param timeout: seconds to wait for a pending read/write operation - 478 before raising C{socket.timeout}, or C{None} for no timeout. - 479 @type timeout: float - 480 """ - 481 self.timeout = timeout -
482 -
483 - def gettimeout(self): -
484 """ - 485 Returns the timeout in seconds (as a float) associated with socket - 486 operations, or C{None} if no timeout is set. This reflects the last - 487 call to L{setblocking} or L{settimeout}. - 488 - 489 @return: timeout in seconds, or C{None}. - 490 @rtype: float - 491 """ - 492 return self.timeout -
493 -
494 - def setblocking(self, blocking): -
495 """ - 496 Set blocking or non-blocking mode of the channel: if C{blocking} is 0, - 497 the channel is set to non-blocking mode; otherwise it's set to blocking - 498 mode. Initially all channels are in blocking mode. - 499 - 500 In non-blocking mode, if a L{recv} call doesn't find any data, or if a - 501 L{send} call can't immediately dispose of the data, an error exception - 502 is raised. In blocking mode, the calls block until they can proceed. An - 503 EOF condition is considered "immediate data" for L{recv}, so if the - 504 channel is closed in the read direction, it will never block. - 505 - 506 C{chan.setblocking(0)} is equivalent to C{chan.settimeout(0)}; - 507 C{chan.setblocking(1)} is equivalent to C{chan.settimeout(None)}. - 508 - 509 @param blocking: 0 to set non-blocking mode; non-0 to set blocking - 510 mode. - 511 @type blocking: int - 512 """ - 513 if blocking: - 514 self.settimeout(None) - 515 else: - 516 self.settimeout(0.0) -
517 -
518 - def getpeername(self): -
519 """ - 520 Return the address of the remote side of this Channel, if possible. - 521 This is just a wrapper around C{'getpeername'} on the Transport, used - 522 to provide enough of a socket-like interface to allow asyncore to work. - 523 (asyncore likes to call C{'getpeername'}.) - 524 - 525 @return: the address if the remote host, if known - 526 @rtype: tuple(str, int) - 527 """ - 528 return self.transport.getpeername() -
529 -
530 - def close(self): -
531 """ - 532 Close the channel. All future read/write operations on the channel - 533 will fail. The remote end will receive no more data (after queued data - 534 is flushed). Channels are automatically closed when their L{Transport} - 535 is closed or when they are garbage collected. - 536 """ - 537 self.lock.acquire() - 538 try: - 539 # only close the pipe when the user explicitly closes the channel. - 540 # otherwise they will get unpleasant surprises. (and do it before - 541 # checking self.closed, since the remote host may have already - 542 # closed the connection.) - 543 if self._pipe is not None: - 544 self._pipe.close() - 545 self._pipe = None - 546 - 547 if not self.active or self.closed: - 548 return - 549 msgs = self._close_internal() - 550 finally: - 551 self.lock.release() - 552 for m in msgs: - 553 if m is not None: - 554 self.transport._send_user_message(m) -
555 -
556 - def recv_ready(self): -
557 """ - 558 Returns true if data is buffered and ready to be read from this - 559 channel. A C{False} result does not mean that the channel has closed; - 560 it means you may need to wait before more data arrives. - 561 - 562 @return: C{True} if a L{recv} call on this channel would immediately - 563 return at least one byte; C{False} otherwise. - 564 @rtype: boolean - 565 """ - 566 return self.in_buffer.read_ready() -
567 -
568 - def recv(self, nbytes): -
569 """ - 570 Receive data from the channel. The return value is a string - 571 representing the data received. The maximum amount of data to be - 572 received at once is specified by C{nbytes}. If a string of length zero - 573 is returned, the channel stream has closed. - 574 - 575 @param nbytes: maximum number of bytes to read. - 576 @type nbytes: int - 577 @return: data. - 578 @rtype: str - 579 - 580 @raise socket.timeout: if no data is ready before the timeout set by - 581 L{settimeout}. - 582 """ - 583 try: - 584 out = self.in_buffer.read(nbytes, self.timeout) - 585 except PipeTimeout, e: - 586 raise socket.timeout() - 587 - 588 ack = self._check_add_window(len(out)) - 589 # no need to hold the channel lock when sending this - 590 if ack > 0: - 591 m = Message() - 592 m.add_byte(chr(MSG_CHANNEL_WINDOW_ADJUST)) - 593 m.add_int(self.remote_chanid) - 594 m.add_int(ack) - 595 self.transport._send_user_message(m) - 596 - 597 return out -
598 -
599 - def recv_stderr_ready(self): -
600 """ - 601 Returns true if data is buffered and ready to be read from this - 602 channel's stderr stream. Only channels using L{exec_command} or - 603 L{invoke_shell} without a pty will ever have data on the stderr - 604 stream. - 605 - 606 @return: C{True} if a L{recv_stderr} call on this channel would - 607 immediately return at least one byte; C{False} otherwise. - 608 @rtype: boolean - 609 - 610 @since: 1.1 - 611 """ - 612 return self.in_stderr_buffer.read_ready() -
613 -
614 - def recv_stderr(self, nbytes): -
615 """ - 616 Receive data from the channel's stderr stream. Only channels using - 617 L{exec_command} or L{invoke_shell} without a pty will ever have data - 618 on the stderr stream. The return value is a string representing the - 619 data received. The maximum amount of data to be received at once is - 620 specified by C{nbytes}. If a string of length zero is returned, the - 621 channel stream has closed. - 622 - 623 @param nbytes: maximum number of bytes to read. - 624 @type nbytes: int - 625 @return: data. - 626 @rtype: str - 627 - 628 @raise socket.timeout: if no data is ready before the timeout set by - 629 L{settimeout}. - 630 - 631 @since: 1.1 - 632 """ - 633 try: - 634 out = self.in_stderr_buffer.read(nbytes, self.timeout) - 635 except PipeTimeout, e: - 636 raise socket.timeout() - 637 - 638 ack = self._check_add_window(len(out)) - 639 # no need to hold the channel lock when sending this - 640 if ack > 0: - 641 m = Message() - 642 m.add_byte(chr(MSG_CHANNEL_WINDOW_ADJUST)) - 643 m.add_int(self.remote_chanid) - 644 m.add_int(ack) - 645 self.transport._send_user_message(m) - 646 - 647 return out -
648 -
649 - def send_ready(self): -
650 """ - 651 Returns true if data can be written to this channel without blocking. - 652 This means the channel is either closed (so any write attempt would - 653 return immediately) or there is at least one byte of space in the - 654 outbound buffer. If there is at least one byte of space in the - 655 outbound buffer, a L{send} call will succeed immediately and return - 656 the number of bytes actually written. - 657 - 658 @return: C{True} if a L{send} call on this channel would immediately - 659 succeed or fail - 660 @rtype: boolean - 661 """ - 662 self.lock.acquire() - 663 try: - 664 if self.closed or self.eof_sent: - 665 return True - 666 return self.out_window_size > 0 - 667 finally: - 668 self.lock.release() -
669 -
670 - def send(self, s): -
671 """ - 672 Send data to the channel. Returns the number of bytes sent, or 0 if - 673 the channel stream is closed. Applications are responsible for - 674 checking that all data has been sent: if only some of the data was - 675 transmitted, the application needs to attempt delivery of the remaining - 676 data. - 677 - 678 @param s: data to send - 679 @type s: str - 680 @return: number of bytes actually sent - 681 @rtype: int - 682 - 683 @raise socket.timeout: if no data could be sent before the timeout set - 684 by L{settimeout}. - 685 """ - 686 size = len(s) - 687 self.lock.acquire() - 688 try: - 689 size = self._wait_for_send_window(size) - 690 if size == 0: - 691 # eof or similar - 692 return 0 - 693 m = Message() - 694 m.add_byte(chr(MSG_CHANNEL_DATA)) - 695 m.add_int(self.remote_chanid) - 696 m.add_string(s[:size]) - 697 finally: - 698 self.lock.release() - 699 # Note: We release self.lock before calling _send_user_message. - 700 # Otherwise, we can deadlock during re-keying. - 701 self.transport._send_user_message(m) - 702 return size -
703 -
704 - def send_stderr(self, s): -
705 """ - 706 Send data to the channel on the "stderr" stream. This is normally - 707 only used by servers to send output from shell commands -- clients - 708 won't use this. Returns the number of bytes sent, or 0 if the channel - 709 stream is closed. Applications are responsible for checking that all - 710 data has been sent: if only some of the data was transmitted, the - 711 application needs to attempt delivery of the remaining data. - 712 - 713 @param s: data to send. - 714 @type s: str - 715 @return: number of bytes actually sent. - 716 @rtype: int - 717 - 718 @raise socket.timeout: if no data could be sent before the timeout set - 719 by L{settimeout}. - 720 - 721 @since: 1.1 - 722 """ - 723 size = len(s) - 724 self.lock.acquire() - 725 try: - 726 size = self._wait_for_send_window(size) - 727 if size == 0: - 728 # eof or similar - 729 return 0 - 730 m = Message() - 731 m.add_byte(chr(MSG_CHANNEL_EXTENDED_DATA)) - 732 m.add_int(self.remote_chanid) - 733 m.add_int(1) - 734 m.add_string(s[:size]) - 735 finally: - 736 self.lock.release() - 737 # Note: We release self.lock before calling _send_user_message. - 738 # Otherwise, we can deadlock during re-keying. - 739 self.transport._send_user_message(m) - 740 return size -
741 -
742 - def sendall(self, s): -
743 """ - 744 Send data to the channel, without allowing partial results. Unlike - 745 L{send}, this method continues to send data from the given string until - 746 either all data has been sent or an error occurs. Nothing is returned. - 747 - 748 @param s: data to send. - 749 @type s: str - 750 - 751 @raise socket.timeout: if sending stalled for longer than the timeout - 752 set by L{settimeout}. - 753 @raise socket.error: if an error occured before the entire string was - 754 sent. - 755 - 756 @note: If the channel is closed while only part of the data hase been - 757 sent, there is no way to determine how much data (if any) was sent. - 758 This is irritating, but identically follows python's API. - 759 """ - 760 while s: - 761 if self.closed: - 762 # this doesn't seem useful, but it is the documented behavior of Socket - 763 raise socket.error('Socket is closed') - 764 sent = self.send(s) - 765 s = s[sent:] - 766 return None -
767 -
768 - def sendall_stderr(self, s): -
769 """ - 770 Send data to the channel's "stderr" stream, without allowing partial - 771 results. Unlike L{send_stderr}, this method continues to send data - 772 from the given string until all data has been sent or an error occurs. - 773 Nothing is returned. - 774 - 775 @param s: data to send to the client as "stderr" output. - 776 @type s: str - 777 - 778 @raise socket.timeout: if sending stalled for longer than the timeout - 779 set by L{settimeout}. - 780 @raise socket.error: if an error occured before the entire string was - 781 sent. - 782 - 783 @since: 1.1 - 784 """ - 785 while s: - 786 if self.closed: - 787 raise socket.error('Socket is closed') - 788 sent = self.send_stderr(s) - 789 s = s[sent:] - 790 return None -
791 -
792 - def makefile(self, *params): -
793 """ - 794 Return a file-like object associated with this channel. The optional - 795 C{mode} and C{bufsize} arguments are interpreted the same way as by - 796 the built-in C{file()} function in python. - 797 - 798 @return: object which can be used for python file I/O. - 799 @rtype: L{ChannelFile} - 800 """ - 801 return ChannelFile(*([self] + list(params))) -
802 -
803 - def makefile_stderr(self, *params): -
804 """ - 805 Return a file-like object associated with this channel's stderr - 806 stream. Only channels using L{exec_command} or L{invoke_shell} - 807 without a pty will ever have data on the stderr stream. - 808 - 809 The optional C{mode} and C{bufsize} arguments are interpreted the - 810 same way as by the built-in C{file()} function in python. For a - 811 client, it only makes sense to open this file for reading. For a - 812 server, it only makes sense to open this file for writing. - 813 - 814 @return: object which can be used for python file I/O. - 815 @rtype: L{ChannelFile} - 816 - 817 @since: 1.1 - 818 """ - 819 return ChannelStderrFile(*([self] + list(params))) -
820 -
821 - def fileno(self): -
822 """ - 823 Returns an OS-level file descriptor which can be used for polling, but - 824 but I{not} for reading or writing. This is primaily to allow python's - 825 C{select} module to work. - 826 - 827 The first time C{fileno} is called on a channel, a pipe is created to - 828 simulate real OS-level file descriptor (FD) behavior. Because of this, - 829 two OS-level FDs are created, which will use up FDs faster than normal. - 830 (You won't notice this effect unless you have hundreds of channels - 831 open at the same time.) - 832 - 833 @return: an OS-level file descriptor - 834 @rtype: int - 835 - 836 @warning: This method causes channel reads to be slightly less - 837 efficient. - 838 """ - 839 self.lock.acquire() - 840 try: - 841 if self._pipe is not None: - 842 return self._pipe.fileno() - 843 # create the pipe and feed in any existing data - 844 self._pipe = pipe.make_pipe() - 845 p1, p2 = pipe.make_or_pipe(self._pipe) - 846 self.in_buffer.set_event(p1) - 847 self.in_stderr_buffer.set_event(p2) - 848 return self._pipe.fileno() - 849 finally: - 850 self.lock.release() -
851 -
852 - def shutdown(self, how): -
853 """ - 854 Shut down one or both halves of the connection. If C{how} is 0, - 855 further receives are disallowed. If C{how} is 1, further sends - 856 are disallowed. If C{how} is 2, further sends and receives are - 857 disallowed. This closes the stream in one or both directions. - 858 - 859 @param how: 0 (stop receiving), 1 (stop sending), or 2 (stop - 860 receiving and sending). - 861 @type how: int - 862 """ - 863 if (how == 0) or (how == 2): - 864 # feign "read" shutdown - 865 self.eof_received = 1 - 866 if (how == 1) or (how == 2): - 867 self.lock.acquire() - 868 try: - 869 m = self._send_eof() - 870 finally: - 871 self.lock.release() - 872 if m is not None: - 873 self.transport._send_user_message(m) -
874 -
875 - def shutdown_read(self): -
876 """ - 877 Shutdown the receiving side of this socket, closing the stream in - 878 the incoming direction. After this call, future reads on this - 879 channel will fail instantly. This is a convenience method, equivalent - 880 to C{shutdown(0)}, for people who don't make it a habit to - 881 memorize unix constants from the 1970s. - 882 - 883 @since: 1.2 - 884 """ - 885 self.shutdown(0) -
886 -
887 - def shutdown_write(self): -
888 """ - 889 Shutdown the sending side of this socket, closing the stream in - 890 the outgoing direction. After this call, future writes on this - 891 channel will fail instantly. This is a convenience method, equivalent - 892 to C{shutdown(1)}, for people who don't make it a habit to - 893 memorize unix constants from the 1970s. - 894 - 895 @since: 1.2 - 896 """ - 897 self.shutdown(1) -
898 - 899 - 900 ### calls from Transport - 901 - 902 -
903 - def _set_transport(self, transport): -
906 -
907 - def _set_window(self, window_size, max_packet_size): -
908 self.in_window_size = window_size - 909 self.in_max_packet_size = max_packet_size - 910 # threshold of bytes we receive before we bother to send a window update - 911 self.in_window_threshold = window_size // 10 - 912 self.in_window_sofar = 0 - 913 self._log(DEBUG, 'Max packet in: %d bytes' % max_packet_size) -
914 -
915 - def _set_remote_channel(self, chanid, window_size, max_packet_size): -
916 self.remote_chanid = chanid - 917 self.out_window_size = window_size - 918 self.out_max_packet_size = max(max_packet_size, MIN_PACKET_SIZE) - 919 self.active = 1 - 920 self._log(DEBUG, 'Max packet out: %d bytes' % max_packet_size) -
921 -
922 - def _request_success(self, m): -
923 self._log(DEBUG, 'Sesch channel %d request ok' % self.chanid) - 924 self.event_ready = True - 925 self.event.set() - 926 return -
927 -
928 - def _request_failed(self, m): -
929 self.lock.acquire() - 930 try: - 931 msgs = self._close_internal() - 932 finally: - 933 self.lock.release() - 934 for m in msgs: - 935 if m is not None: - 936 self.transport._send_user_message(m) -
937 -
938 - def _feed(self, m): -
939 if type(m) is str: - 940 # passed from _feed_extended - 941 s = m - 942 else: - 943 s = m.get_string() - 944 self.in_buffer.feed(s) -
945 -
946 - def _feed_extended(self, m): -
947 code = m.get_int() - 948 s = m.get_string() - 949 if code != 1: - 950 self._log(ERROR, 'unknown extended_data type %d; discarding' % code) - 951 return - 952 if self.combine_stderr: - 953 self._feed(s) - 954 else: - 955 self.in_stderr_buffer.feed(s) -
956 -
957 - def _window_adjust(self, m): -
958 nbytes = m.get_int() - 959 self.lock.acquire() - 960 try: - 961 if self.ultra_debug: - 962 self._log(DEBUG, 'window up %d' % nbytes) - 963 self.out_window_size += nbytes - 964 self.out_buffer_cv.notifyAll() - 965 finally: - 966 self.lock.release() -
967 -
968 - def _handle_request(self, m): -
969 key = m.get_string() - 970 want_reply = m.get_boolean() - 971 server = self.transport.server_object - 972 ok = False - 973 if key == 'exit-status': - 974 self.exit_status = m.get_int() - 975 self.status_event.set() - 976 ok = True - 977 elif key == 'xon-xoff': - 978 # ignore - 979 ok = True - 980 elif key == 'pty-req': - 981 term = m.get_string() - 982 width = m.get_int() - 983 height = m.get_int() - 984 pixelwidth = m.get_int() - 985 pixelheight = m.get_int() - 986 modes = m.get_string() - 987 if server is None: - 988 ok = False - 989 else: - 990 ok = server.check_channel_pty_request(self, term, width, height, pixelwidth, - 991 pixelheight, modes) - 992 elif key == 'shell': - 993 if server is None: - 994 ok = False - 995 else: - 996 ok = server.check_channel_shell_request(self) - 997 elif key == 'exec': - 998 cmd = m.get_string() - 999 if server is None: -1000 ok = False -1001 else: -1002 ok = server.check_channel_exec_request(self, cmd) -1003 elif key == 'subsystem': -1004 name = m.get_string() -1005 if server is None: -1006 ok = False -1007 else: -1008 ok = server.check_channel_subsystem_request(self, name) -1009 elif key == 'window-change': -1010 width = m.get_int() -1011 height = m.get_int() -1012 pixelwidth = m.get_int() -1013 pixelheight = m.get_int() -1014 if server is None: -1015 ok = False -1016 else: -1017 ok = server.check_channel_window_change_request(self, width, height, pixelwidth, -1018 pixelheight) -1019 elif key == 'x11-req': -1020 single_connection = m.get_boolean() -1021 auth_proto = m.get_string() -1022 auth_cookie = m.get_string() -1023 screen_number = m.get_int() -1024 if server is None: -1025 ok = False -1026 else: -1027 ok = server.check_channel_x11_request(self, single_connection, -1028 auth_proto, auth_cookie, screen_number) -1029 else: -1030 self._log(DEBUG, 'Unhandled channel request "%s"' % key) -1031 ok = False -1032 if want_reply: -1033 m = Message() -1034 if ok: -1035 m.add_byte(chr(MSG_CHANNEL_SUCCESS)) -1036 else: -1037 m.add_byte(chr(MSG_CHANNEL_FAILURE)) -1038 m.add_int(self.remote_chanid) -1039 self.transport._send_user_message(m) -
1040 -
1041 - def _handle_eof(self, m): -
1042 self.lock.acquire() -1043 try: -1044 if not self.eof_received: -1045 self.eof_received = True -1046 self.in_buffer.close() -1047 self.in_stderr_buffer.close() -1048 if self._pipe is not None: -1049 self._pipe.set_forever() -1050 finally: -1051 self.lock.release() -1052 self._log(DEBUG, 'EOF received (%s)', self._name) -
1053 -
1054 - def _handle_close(self, m): -
1055 self.lock.acquire() -1056 try: -1057 msgs = self._close_internal() -1058 self.transport._unlink_channel(self.chanid) -1059 finally: -1060 self.lock.release() -1061 for m in msgs: -1062 if m is not None: -1063 self.transport._send_user_message(m) -
1064 -1065 -1066 ### internals... -1067 -1068 -
1069 - def _log(self, level, msg, *args): -
1070 self.logger.log(level, "[chan " + self._name + "] " + msg, *args) -
1071 -
1072 - def _event_pending(self): -
1073 self.event.clear() -1074 self.event_ready = False -
1075 -
1076 - def _wait_for_event(self): -
1077 self.event.wait() -1078 assert self.event.isSet() -1079 if self.event_ready: -1080 return -1081 e = self.transport.get_exception() -1082 if e is None: -1083 e = SSHException('Channel closed.') -1084 raise e -
1085 -
1086 - def _set_closed(self): -
1087 # you are holding the lock. -1088 self.closed = True -1089 self.in_buffer.close() -1090 self.in_stderr_buffer.close() -1091 self.out_buffer_cv.notifyAll() -1092 # Notify any waiters that we are closed -1093 self.event.set() -1094 self.status_event.set() -1095 if self._pipe is not None: -1096 self._pipe.set_forever() -
1097 -
1098 - def _send_eof(self): -
1099 # you are holding the lock. -1100 if self.eof_sent: -1101 return None -1102 m = Message() -1103 m.add_byte(chr(MSG_CHANNEL_EOF)) -1104 m.add_int(self.remote_chanid) -1105 self.eof_sent = True -1106 self._log(DEBUG, 'EOF sent (%s)', self._name) -1107 return m -
1108 -
1109 - def _close_internal(self): -
1110 # you are holding the lock. -1111 if not self.active or self.closed: -1112 return None, None -1113 m1 = self._send_eof() -1114 m2 = Message() -1115 m2.add_byte(chr(MSG_CHANNEL_CLOSE)) -1116 m2.add_int(self.remote_chanid) -1117 self._set_closed() -1118 # can't unlink from the Transport yet -- the remote side may still -1119 # try to send meta-data (exit-status, etc) -1120 return m1, m2 -
1121 -1132 -
1133 - def _check_add_window(self, n): -
1134 self.lock.acquire() -1135 try: -1136 if self.closed or self.eof_received or not self.active: -1137 return 0 -1138 if self.ultra_debug: -1139 self._log(DEBUG, 'addwindow %d' % n) -1140 self.in_window_sofar += n -1141 if self.in_window_sofar <= self.in_window_threshold: -1142 return 0 -1143 if self.ultra_debug: -1144 self._log(DEBUG, 'addwindow send %d' % self.in_window_sofar) -1145 out = self.in_window_sofar -1146 self.in_window_sofar = 0 -1147 return out -1148 finally: -1149 self.lock.release() -
1150 -
1151 - def _wait_for_send_window(self, size): -
1152 """ -1153 (You are already holding the lock.) -1154 Wait for the send window to open up, and allocate up to C{size} bytes -1155 for transmission. If no space opens up before the timeout, a timeout -1156 exception is raised. Returns the number of bytes available to send -1157 (may be less than requested). -1158 """ -1159 # you are already holding the lock -1160 if self.closed or self.eof_sent: -1161 return 0 -1162 if self.out_window_size == 0: -1163 # should we block? -1164 if self.timeout == 0.0: -1165 raise socket.timeout() -1166 # loop here in case we get woken up but a different thread has filled the buffer -1167 timeout = self.timeout -1168 while self.out_window_size == 0: -1169 if self.closed or self.eof_sent: -1170 return 0 -1171 then = time.time() -1172 self.out_buffer_cv.wait(timeout) -1173 if timeout != None: -1174 timeout -= time.time() - then -1175 if timeout <= 0.0: -1176 raise socket.timeout() -1177 # we have some window to squeeze into -1178 if self.closed or self.eof_sent: -1179 return 0 -1180 if self.out_window_size < size: -1181 size = self.out_window_size -1182 if self.out_max_packet_size - 64 < size: -1183 size = self.out_max_packet_size - 64 -1184 self.out_window_size -= size -1185 if self.ultra_debug: -1186 self._log(DEBUG, 'window down to %d' % self.out_window_size) -1187 return size -
1188 -1189 -
1190 -class ChannelFile (BufferedFile): -
1191 """ -1192 A file-like wrapper around L{Channel}. A ChannelFile is created by calling -1193 L{Channel.makefile}. -1194 -1195 @bug: To correctly emulate the file object created from a socket's -1196 C{makefile} method, a L{Channel} and its C{ChannelFile} should be able -1197 to be closed or garbage-collected independently. Currently, closing -1198 the C{ChannelFile} does nothing but flush the buffer. -1199 """ -1200 -
1201 - def __init__(self, channel, mode = 'r', bufsize = -1): -
1202 self.channel = channel -1203 BufferedFile.__init__(self) -1204 self._set_mode(mode, bufsize) -
1205 -
1206 - def __repr__(self): -
1207 """ -1208 Returns a string representation of this object, for debugging. -1209 -1210 @rtype: str -1211 """ -1212 return '<paramiko.ChannelFile from ' + repr(self.channel) + '>' -
1213 -
1214 - def _read(self, size): -
1215 return self.channel.recv(size) -
1216 -
1217 - def _write(self, data): -
1218 self.channel.sendall(data) -1219 return len(data) -
1220 -1221 -
1222 -class ChannelStderrFile (ChannelFile): -
1223 - def __init__(self, channel, mode = 'r', bufsize = -1): -
1224 ChannelFile.__init__(self, channel, mode, bufsize) -
1225 -
1226 - def _read(self, size): -
1227 return self.channel.recv_stderr(size) -
1228 -
1229 - def _write(self, data): -
1230 self.channel.sendall_stderr(data) -1231 return len(data) -
1232 -1233 -1234 # vim: set shiftwidth=4 expandtab : -1235 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.channel.ChannelStderrFile-class.html b/docs/paramiko.channel.ChannelStderrFile-class.html deleted file mode 100644 index 3136f45..0000000 --- a/docs/paramiko.channel.ChannelStderrFile-class.html +++ /dev/null @@ -1,257 +0,0 @@ - - - - - paramiko.channel.ChannelStderrFile - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module channel :: - Class ChannelStderrFile - - - - - -
[frames] | no frames]
-
- -

Class ChannelStderrFile

source code

-
-  object --+        
-           |        
-BufferedFile --+    
-               |    
-     ChannelFile --+
-                   |
-                  ChannelStderrFile
-
- -
- - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - channel, - mode='r', - bufsize=-1)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
-

Inherited from ChannelFile: - __repr__ -

-

Inherited from BufferedFile: - __del__, - __iter__, - close, - flush, - next, - read, - readline, - readlines, - seek, - tell, - write, - writelines, - xreadlines -

-

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

-
- - - - - - - - - -
- Class Variables
-

Inherited from BufferedFile: - FLAG_APPEND, - FLAG_BINARY, - FLAG_BUFFERED, - FLAG_LINE_BUFFERED, - FLAG_READ, - FLAG_UNIVERSAL_NEWLINE, - FLAG_WRITE, - SEEK_CUR, - SEEK_END, - SEEK_SET -

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - channel, - mode='r', - bufsize=-1) -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.client-module.html b/docs/paramiko.client-module.html deleted file mode 100644 index 48d7ff9..0000000 --- a/docs/paramiko.client-module.html +++ /dev/null @@ -1,539 +0,0 @@ - - - - - paramiko.client - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module client - - - - - -
[frames] | no frames]
-
- -

Module client

source code

-

SSHClient.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Variables
-   - - SSH_PORT = 22 -
-   - - AUTH_FAILED = 2 -
-   - - AUTH_PARTIALLY_SUCCESSFUL = 1 -
-   - - AUTH_SUCCESSFUL = 0 -
-   - - CONNECTION_FAILED_CODE = {1: 'Administratively prohibited', 2:... -
-   - - CRITICAL = 50 -
-   - - DEBUG = 10 -
-   - - DISCONNECT_AUTH_CANCELLED_BY_USER = 13 -
-   - - DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14 -
-   - - DISCONNECT_SERVICE_NOT_AVAILABLE = 7 -
-   - - ERROR = 40 -
-   - - INFO = 20 -
-   - - MSG_CHANNEL_CLOSE = 97 -
-   - - MSG_CHANNEL_DATA = 94 -
-   - - MSG_CHANNEL_EOF = 96 -
-   - - MSG_CHANNEL_EXTENDED_DATA = 95 -
-   - - MSG_CHANNEL_FAILURE = 100 -
-   - - MSG_CHANNEL_OPEN = 90 -
-   - - MSG_CHANNEL_OPEN_FAILURE = 92 -
-   - - MSG_CHANNEL_OPEN_SUCCESS = 91 -
-   - - MSG_CHANNEL_REQUEST = 98 -
-   - - MSG_CHANNEL_SUCCESS = 99 -
-   - - MSG_CHANNEL_WINDOW_ADJUST = 93 -
-   - - MSG_DEBUG = 4 -
-   - - MSG_DISCONNECT = 1 -
-   - - MSG_GLOBAL_REQUEST = 80 -
-   - - MSG_IGNORE = 2 -
-   - - MSG_KEXINIT = 20 -
-   - - MSG_NAMES = {1: 'disconnect', 2: 'ignore', 3: 'unimplemented',... -
-   - - MSG_NEWKEYS = 21 -
-   - - MSG_REQUEST_FAILURE = 82 -
-   - - MSG_REQUEST_SUCCESS = 81 -
-   - - MSG_SERVICE_ACCEPT = 6 -
-   - - MSG_SERVICE_REQUEST = 5 -
-   - - MSG_UNIMPLEMENTED = 3 -
-   - - MSG_USERAUTH_BANNER = 53 -
-   - - MSG_USERAUTH_FAILURE = 51 -
-   - - MSG_USERAUTH_INFO_REQUEST = 60 -
-   - - MSG_USERAUTH_INFO_RESPONSE = 61 -
-   - - MSG_USERAUTH_PK_OK = 60 -
-   - - MSG_USERAUTH_REQUEST = 50 -
-   - - MSG_USERAUTH_SUCCESS = 52 -
-   - - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED = 1 -
-   - - OPEN_FAILED_CONNECT_FAILED = 2 -
-   - - OPEN_FAILED_RESOURCE_SHORTAGE = 4 -
-   - - OPEN_FAILED_UNKNOWN_CHANNEL_TYPE = 3 -
-   - - OPEN_SUCCEEDED = 0 -
-   - - PY22 = False -
-   - - WARNING = 30 -
-   - - __package__ = 'paramiko' -
-   - - rng = Random.new() -
- - - - - - -
- Variables Details
- -
- -
-

CONNECTION_FAILED_CODE

- -
-
-
-
Value:
-
-{1: 'Administratively prohibited',
- 2: 'Connect failed',
- 3: 'Unknown channel type',
- 4: 'Resource shortage'}
-
-
-
-
-
- -
- -
-

MSG_NAMES

- -
-
-
-
Value:
-
-{1: 'disconnect',
- 2: 'ignore',
- 3: 'unimplemented',
- 4: 'debug',
- 5: 'service-request',
- 6: 'service-accept',
- 20: 'kexinit',
- 21: 'newkeys',
-...
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.client-pysrc.html b/docs/paramiko.client-pysrc.html deleted file mode 100644 index cdca4fe..0000000 --- a/docs/paramiko.client-pysrc.html +++ /dev/null @@ -1,801 +0,0 @@ - - - - - paramiko.client - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module client - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.client

-
-  1  # Copyright (C) 2006-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  L{SSHClient}. 
- 21  """ 
- 22   
- 23  from binascii import hexlify 
- 24  import getpass 
- 25  import os 
- 26  import socket 
- 27  import warnings 
- 28   
- 29  from paramiko.agent import Agent 
- 30  from paramiko.common import * 
- 31  from paramiko.dsskey import DSSKey 
- 32  from paramiko.hostkeys import HostKeys 
- 33  from paramiko.resource import ResourceManager 
- 34  from paramiko.rsakey import RSAKey 
- 35  from paramiko.ssh_exception import SSHException, BadHostKeyException 
- 36  from paramiko.transport import Transport 
- 37   
- 38   
- 39  SSH_PORT = 22 
- 40   
-
41 -class MissingHostKeyPolicy (object): -
42 """ - 43 Interface for defining the policy that L{SSHClient} should use when the - 44 SSH server's hostname is not in either the system host keys or the - 45 application's keys. Pre-made classes implement policies for automatically - 46 adding the key to the application's L{HostKeys} object (L{AutoAddPolicy}), - 47 and for automatically rejecting the key (L{RejectPolicy}). - 48 - 49 This function may be used to ask the user to verify the key, for example. - 50 """ - 51 -
52 - def missing_host_key(self, client, hostname, key): -
53 """ - 54 Called when an L{SSHClient} receives a server key for a server that - 55 isn't in either the system or local L{HostKeys} object. To accept - 56 the key, simply return. To reject, raised an exception (which will - 57 be passed to the calling application). - 58 """ - 59 pass -
60 - 61 -
62 -class AutoAddPolicy (MissingHostKeyPolicy): -
63 """ - 64 Policy for automatically adding the hostname and new host key to the - 65 local L{HostKeys} object, and saving it. This is used by L{SSHClient}. - 66 """ - 67 -
68 - def missing_host_key(self, client, hostname, key): -
69 client._host_keys.add(hostname, key.get_name(), key) - 70 if client._host_keys_filename is not None: - 71 client.save_host_keys(client._host_keys_filename) - 72 client._log(DEBUG, 'Adding %s host key for %s: %s' % - 73 (key.get_name(), hostname, hexlify(key.get_fingerprint()))) -
74 - 75 -
76 -class RejectPolicy (MissingHostKeyPolicy): -
77 """ - 78 Policy for automatically rejecting the unknown hostname & key. This is - 79 used by L{SSHClient}. - 80 """ - 81 -
82 - def missing_host_key(self, client, hostname, key): -
83 client._log(DEBUG, 'Rejecting %s host key for %s: %s' % - 84 (key.get_name(), hostname, hexlify(key.get_fingerprint()))) - 85 raise SSHException('Unknown server %s' % hostname) -
86 - 87 -
88 -class WarningPolicy (MissingHostKeyPolicy): -
89 """ - 90 Policy for logging a python-style warning for an unknown host key, but - 91 accepting it. This is used by L{SSHClient}. - 92 """ -
93 - def missing_host_key(self, client, hostname, key): -
94 warnings.warn('Unknown %s host key for %s: %s' % - 95 (key.get_name(), hostname, hexlify(key.get_fingerprint()))) -
96 - 97 -
98 -class SSHClient (object): -
99 """ -100 A high-level representation of a session with an SSH server. This class -101 wraps L{Transport}, L{Channel}, and L{SFTPClient} to take care of most -102 aspects of authenticating and opening channels. A typical use case is:: -103 -104 client = SSHClient() -105 client.load_system_host_keys() -106 client.connect('ssh.example.com') -107 stdin, stdout, stderr = client.exec_command('ls -l') -108 -109 You may pass in explicit overrides for authentication and server host key -110 checking. The default mechanism is to try to use local key files or an -111 SSH agent (if one is running). -112 -113 @since: 1.6 -114 """ -115 -
116 - def __init__(self): -
117 """ -118 Create a new SSHClient. -119 """ -120 self._system_host_keys = HostKeys() -121 self._host_keys = HostKeys() -122 self._host_keys_filename = None -123 self._log_channel = None -124 self._policy = RejectPolicy() -125 self._transport = None -126 self._agent = None -
127 -
128 - def load_system_host_keys(self, filename=None): -
129 """ -130 Load host keys from a system (read-only) file. Host keys read with -131 this method will not be saved back by L{save_host_keys}. -132 -133 This method can be called multiple times. Each new set of host keys -134 will be merged with the existing set (new replacing old if there are -135 conflicts). -136 -137 If C{filename} is left as C{None}, an attempt will be made to read -138 keys from the user's local "known hosts" file, as used by OpenSSH, -139 and no exception will be raised if the file can't be read. This is -140 probably only useful on posix. -141 -142 @param filename: the filename to read, or C{None} -143 @type filename: str -144 -145 @raise IOError: if a filename was provided and the file could not be -146 read -147 """ -148 if filename is None: -149 # try the user's .ssh key file, and mask exceptions -150 filename = os.path.expanduser('~/.ssh/known_hosts') -151 try: -152 self._system_host_keys.load(filename) -153 except IOError: -154 pass -155 return -156 self._system_host_keys.load(filename) -
157 -
158 - def load_host_keys(self, filename): -
159 """ -160 Load host keys from a local host-key file. Host keys read with this -161 method will be checked I{after} keys loaded via L{load_system_host_keys}, -162 but will be saved back by L{save_host_keys} (so they can be modified). -163 The missing host key policy L{AutoAddPolicy} adds keys to this set and -164 saves them, when connecting to a previously-unknown server. -165 -166 This method can be called multiple times. Each new set of host keys -167 will be merged with the existing set (new replacing old if there are -168 conflicts). When automatically saving, the last hostname is used. -169 -170 @param filename: the filename to read -171 @type filename: str -172 -173 @raise IOError: if the filename could not be read -174 """ -175 self._host_keys_filename = filename -176 self._host_keys.load(filename) -
177 -
178 - def save_host_keys(self, filename): -
179 """ -180 Save the host keys back to a file. Only the host keys loaded with -181 L{load_host_keys} (plus any added directly) will be saved -- not any -182 host keys loaded with L{load_system_host_keys}. -183 -184 @param filename: the filename to save to -185 @type filename: str -186 -187 @raise IOError: if the file could not be written -188 """ -189 f = open(filename, 'w') -190 f.write('# SSH host keys collected by paramiko\n') -191 for hostname, keys in self._host_keys.iteritems(): -192 for keytype, key in keys.iteritems(): -193 f.write('%s %s %s\n' % (hostname, keytype, key.get_base64())) -194 f.close() -
195 -
196 - def get_host_keys(self): -
197 """ -198 Get the local L{HostKeys} object. This can be used to examine the -199 local host keys or change them. -200 -201 @return: the local host keys -202 @rtype: L{HostKeys} -203 """ -204 return self._host_keys -
205 -
206 - def set_log_channel(self, name): -
207 """ -208 Set the channel for logging. The default is C{"paramiko.transport"} -209 but it can be set to anything you want. -210 -211 @param name: new channel name for logging -212 @type name: str -213 """ -214 self._log_channel = name -
215 -
216 - def set_missing_host_key_policy(self, policy): -
217 """ -218 Set the policy to use when connecting to a server that doesn't have a -219 host key in either the system or local L{HostKeys} objects. The -220 default policy is to reject all unknown servers (using L{RejectPolicy}). -221 You may substitute L{AutoAddPolicy} or write your own policy class. -222 -223 @param policy: the policy to use when receiving a host key from a -224 previously-unknown server -225 @type policy: L{MissingHostKeyPolicy} -226 """ -227 self._policy = policy -
228 -
229 - def connect(self, hostname, port=SSH_PORT, username=None, password=None, pkey=None, -230 key_filename=None, timeout=None, allow_agent=True, look_for_keys=True, -231 compress=False): -
232 """ -233 Connect to an SSH server and authenticate to it. The server's host key -234 is checked against the system host keys (see L{load_system_host_keys}) -235 and any local host keys (L{load_host_keys}). If the server's hostname -236 is not found in either set of host keys, the missing host key policy -237 is used (see L{set_missing_host_key_policy}). The default policy is -238 to reject the key and raise an L{SSHException}. -239 -240 Authentication is attempted in the following order of priority: -241 -242 - The C{pkey} or C{key_filename} passed in (if any) -243 - Any key we can find through an SSH agent -244 - Any "id_rsa" or "id_dsa" key discoverable in C{~/.ssh/} -245 - Plain username/password auth, if a password was given -246 -247 If a private key requires a password to unlock it, and a password is -248 passed in, that password will be used to attempt to unlock the key. -249 -250 @param hostname: the server to connect to -251 @type hostname: str -252 @param port: the server port to connect to -253 @type port: int -254 @param username: the username to authenticate as (defaults to the -255 current local username) -256 @type username: str -257 @param password: a password to use for authentication or for unlocking -258 a private key -259 @type password: str -260 @param pkey: an optional private key to use for authentication -261 @type pkey: L{PKey} -262 @param key_filename: the filename, or list of filenames, of optional -263 private key(s) to try for authentication -264 @type key_filename: str or list(str) -265 @param timeout: an optional timeout (in seconds) for the TCP connect -266 @type timeout: float -267 @param allow_agent: set to False to disable connecting to the SSH agent -268 @type allow_agent: bool -269 @param look_for_keys: set to False to disable searching for discoverable -270 private key files in C{~/.ssh/} -271 @type look_for_keys: bool -272 @param compress: set to True to turn on compression -273 @type compress: bool -274 -275 @raise BadHostKeyException: if the server's host key could not be -276 verified -277 @raise AuthenticationException: if authentication failed -278 @raise SSHException: if there was any other error connecting or -279 establishing an SSH session -280 @raise socket.error: if a socket error occurred while connecting -281 """ -282 for (family, socktype, proto, canonname, sockaddr) in socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM): -283 if socktype == socket.SOCK_STREAM: -284 af = family -285 addr = sockaddr -286 break -287 else: -288 # some OS like AIX don't indicate SOCK_STREAM support, so just guess. :( -289 af, _, _, _, addr = socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM) -290 sock = socket.socket(af, socket.SOCK_STREAM) -291 if timeout is not None: -292 try: -293 sock.settimeout(timeout) -294 except: -295 pass -296 sock.connect(addr) -297 t = self._transport = Transport(sock) -298 t.use_compression(compress=compress) -299 if self._log_channel is not None: -300 t.set_log_channel(self._log_channel) -301 t.start_client() -302 ResourceManager.register(self, t) -303 -304 server_key = t.get_remote_server_key() -305 keytype = server_key.get_name() -306 -307 if port == SSH_PORT: -308 server_hostkey_name = hostname -309 else: -310 server_hostkey_name = "[%s]:%d" % (hostname, port) -311 our_server_key = self._system_host_keys.get(server_hostkey_name, {}).get(keytype, None) -312 if our_server_key is None: -313 our_server_key = self._host_keys.get(server_hostkey_name, {}).get(keytype, None) -314 if our_server_key is None: -315 # will raise exception if the key is rejected; let that fall out -316 self._policy.missing_host_key(self, server_hostkey_name, server_key) -317 # if the callback returns, assume the key is ok -318 our_server_key = server_key -319 -320 if server_key != our_server_key: -321 raise BadHostKeyException(hostname, server_key, our_server_key) -322 -323 if username is None: -324 username = getpass.getuser() -325 -326 if key_filename is None: -327 key_filenames = [] -328 elif isinstance(key_filename, (str, unicode)): -329 key_filenames = [ key_filename ] -330 else: -331 key_filenames = key_filename -332 self._auth(username, password, pkey, key_filenames, allow_agent, look_for_keys) -
333 -
334 - def close(self): -
335 """ -336 Close this SSHClient and its underlying L{Transport}. -337 """ -338 if self._transport is None: -339 return -340 self._transport.close() -341 self._transport = None -342 -343 if self._agent != None: -344 self._agent.close() -345 self._agent = None -
346 -
347 - def exec_command(self, command, bufsize=-1): -
348 """ -349 Execute a command on the SSH server. A new L{Channel} is opened and -350 the requested command is executed. The command's input and output -351 streams are returned as python C{file}-like objects representing -352 stdin, stdout, and stderr. -353 -354 @param command: the command to execute -355 @type command: str -356 @param bufsize: interpreted the same way as by the built-in C{file()} function in python -357 @type bufsize: int -358 @return: the stdin, stdout, and stderr of the executing command -359 @rtype: tuple(L{ChannelFile}, L{ChannelFile}, L{ChannelFile}) -360 -361 @raise SSHException: if the server fails to execute the command -362 """ -363 chan = self._transport.open_session() -364 chan.exec_command(command) -365 stdin = chan.makefile('wb', bufsize) -366 stdout = chan.makefile('rb', bufsize) -367 stderr = chan.makefile_stderr('rb', bufsize) -368 return stdin, stdout, stderr -
369 -
370 - def invoke_shell(self, term='vt100', width=80, height=24): -
371 """ -372 Start an interactive shell session on the SSH server. A new L{Channel} -373 is opened and connected to a pseudo-terminal using the requested -374 terminal type and size. -375 -376 @param term: the terminal type to emulate (for example, C{"vt100"}) -377 @type term: str -378 @param width: the width (in characters) of the terminal window -379 @type width: int -380 @param height: the height (in characters) of the terminal window -381 @type height: int -382 @return: a new channel connected to the remote shell -383 @rtype: L{Channel} -384 -385 @raise SSHException: if the server fails to invoke a shell -386 """ -387 chan = self._transport.open_session() -388 chan.get_pty(term, width, height) -389 chan.invoke_shell() -390 return chan -
391 -
392 - def open_sftp(self): -
393 """ -394 Open an SFTP session on the SSH server. -395 -396 @return: a new SFTP session object -397 @rtype: L{SFTPClient} -398 """ -399 return self._transport.open_sftp_client() -
400 -
401 - def get_transport(self): -
402 """ -403 Return the underlying L{Transport} object for this SSH connection. -404 This can be used to perform lower-level tasks, like opening specific -405 kinds of channels. -406 -407 @return: the Transport for this connection -408 @rtype: L{Transport} -409 """ -410 return self._transport -
411 -
412 - def _auth(self, username, password, pkey, key_filenames, allow_agent, look_for_keys): -
413 """ -414 Try, in order: -415 -416 - The key passed in, if one was passed in. -417 - Any key we can find through an SSH agent (if allowed). -418 - Any "id_rsa" or "id_dsa" key discoverable in ~/.ssh/ (if allowed). -419 - Plain username/password auth, if a password was given. -420 -421 (The password might be needed to unlock a private key.) -422 """ -423 saved_exception = None -424 -425 if pkey is not None: -426 try: -427 self._log(DEBUG, 'Trying SSH key %s' % hexlify(pkey.get_fingerprint())) -428 self._transport.auth_publickey(username, pkey) -429 return -430 except SSHException, e: -431 saved_exception = e -432 -433 for key_filename in key_filenames: -434 for pkey_class in (RSAKey, DSSKey): -435 try: -436 key = pkey_class.from_private_key_file(key_filename, password) -437 self._log(DEBUG, 'Trying key %s from %s' % (hexlify(key.get_fingerprint()), key_filename)) -438 self._transport.auth_publickey(username, key) -439 return -440 except SSHException, e: -441 saved_exception = e -442 -443 if allow_agent: -444 if self._agent == None: -445 self._agent = Agent() -446 -447 for key in self._agent.get_keys(): -448 try: -449 self._log(DEBUG, 'Trying SSH agent key %s' % hexlify(key.get_fingerprint())) -450 self._transport.auth_publickey(username, key) -451 return -452 except SSHException, e: -453 saved_exception = e -454 -455 keyfiles = [] -456 rsa_key = os.path.expanduser('~/.ssh/id_rsa') -457 dsa_key = os.path.expanduser('~/.ssh/id_dsa') -458 if os.path.isfile(rsa_key): -459 keyfiles.append((RSAKey, rsa_key)) -460 if os.path.isfile(dsa_key): -461 keyfiles.append((DSSKey, dsa_key)) -462 # look in ~/ssh/ for windows users: -463 rsa_key = os.path.expanduser('~/ssh/id_rsa') -464 dsa_key = os.path.expanduser('~/ssh/id_dsa') -465 if os.path.isfile(rsa_key): -466 keyfiles.append((RSAKey, rsa_key)) -467 if os.path.isfile(dsa_key): -468 keyfiles.append((DSSKey, dsa_key)) -469 -470 if not look_for_keys: -471 keyfiles = [] -472 -473 for pkey_class, filename in keyfiles: -474 try: -475 key = pkey_class.from_private_key_file(filename, password) -476 self._log(DEBUG, 'Trying discovered key %s in %s' % (hexlify(key.get_fingerprint()), filename)) -477 self._transport.auth_publickey(username, key) -478 return -479 except SSHException, e: -480 saved_exception = e -481 except IOError, e: -482 saved_exception = e -483 -484 if password is not None: -485 try: -486 self._transport.auth_password(username, password) -487 return -488 except SSHException, e: -489 saved_exception = e -490 -491 # if we got an auth-failed exception earlier, re-raise it -492 if saved_exception is not None: -493 raise saved_exception -494 raise SSHException('No authentication methods available') -
495 -
496 - def _log(self, level, msg): -
497 self._transport._log(level, msg) -
498 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.common-module.html b/docs/paramiko.common-module.html deleted file mode 100644 index 9b48688..0000000 --- a/docs/paramiko.common-module.html +++ /dev/null @@ -1,531 +0,0 @@ - - - - - paramiko.common - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module common - - - - - -
[frames] | no frames]
-
- -

Module common

source code

-

Common constants and global variables.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Variables
-   - - MSG_USERAUTH_PK_OK = 60 -
-   - - MSG_NAMES = {1: 'disconnect', 2: 'ignore', 3: 'unimplemented',... -
-   - - CONNECTION_FAILED_CODE = {1: 'Administratively prohibited', 2:... -
-   - - rng = Random.new() -
-   - - PY22 = False -
-   - - DEBUG = 10 -
-   - - INFO = 20 -
-   - - WARNING = 30 -
-   - - ERROR = 40 -
-   - - CRITICAL = 50 -
-   - - AUTH_FAILED = 2 -
-   - - AUTH_PARTIALLY_SUCCESSFUL = 1 -
-   - - AUTH_SUCCESSFUL = 0 -
-   - - DISCONNECT_AUTH_CANCELLED_BY_USER = 13 -
-   - - DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14 -
-   - - DISCONNECT_SERVICE_NOT_AVAILABLE = 7 -
-   - - MSG_CHANNEL_CLOSE = 97 -
-   - - MSG_CHANNEL_DATA = 94 -
-   - - MSG_CHANNEL_EOF = 96 -
-   - - MSG_CHANNEL_EXTENDED_DATA = 95 -
-   - - MSG_CHANNEL_FAILURE = 100 -
-   - - MSG_CHANNEL_OPEN = 90 -
-   - - MSG_CHANNEL_OPEN_FAILURE = 92 -
-   - - MSG_CHANNEL_OPEN_SUCCESS = 91 -
-   - - MSG_CHANNEL_REQUEST = 98 -
-   - - MSG_CHANNEL_SUCCESS = 99 -
-   - - MSG_CHANNEL_WINDOW_ADJUST = 93 -
-   - - MSG_DEBUG = 4 -
-   - - MSG_DISCONNECT = 1 -
-   - - MSG_GLOBAL_REQUEST = 80 -
-   - - MSG_IGNORE = 2 -
-   - - MSG_KEXINIT = 20 -
-   - - MSG_NEWKEYS = 21 -
-   - - MSG_REQUEST_FAILURE = 82 -
-   - - MSG_REQUEST_SUCCESS = 81 -
-   - - MSG_SERVICE_ACCEPT = 6 -
-   - - MSG_SERVICE_REQUEST = 5 -
-   - - MSG_UNIMPLEMENTED = 3 -
-   - - MSG_USERAUTH_BANNER = 53 -
-   - - MSG_USERAUTH_FAILURE = 51 -
-   - - MSG_USERAUTH_INFO_REQUEST = 60 -
-   - - MSG_USERAUTH_INFO_RESPONSE = 61 -
-   - - MSG_USERAUTH_REQUEST = 50 -
-   - - MSG_USERAUTH_SUCCESS = 52 -
-   - - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED = 1 -
-   - - OPEN_FAILED_CONNECT_FAILED = 2 -
-   - - OPEN_FAILED_RESOURCE_SHORTAGE = 4 -
-   - - OPEN_FAILED_UNKNOWN_CHANNEL_TYPE = 3 -
-   - - OPEN_SUCCEEDED = 0 -
-   - - __package__ = 'paramiko' -
- - - - - - -
- Variables Details
- -
- -
-

MSG_NAMES

- -
-
-
-
Value:
-
-{1: 'disconnect',
- 2: 'ignore',
- 3: 'unimplemented',
- 4: 'debug',
- 5: 'service-request',
- 6: 'service-accept',
- 20: 'kexinit',
- 21: 'newkeys',
-...
-
-
-
-
-
- -
- -
-

CONNECTION_FAILED_CODE

- -
-
-
-
Value:
-
-{1: 'Administratively prohibited',
- 2: 'Connect failed',
- 3: 'Unknown channel type',
- 4: 'Resource shortage'}
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.common-pysrc.html b/docs/paramiko.common-pysrc.html deleted file mode 100644 index 92e998f..0000000 --- a/docs/paramiko.common-pysrc.html +++ /dev/null @@ -1,1905 +0,0 @@ - - - - - paramiko.common - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module common - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.common

-
-  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  Common constants and global variables. 
- 21  """ 
- 22   
- 23  MSG_DISCONNECT, MSG_IGNORE, MSG_UNIMPLEMENTED, MSG_DEBUG, MSG_SERVICE_REQUEST, \ 
- 24      MSG_SERVICE_ACCEPT = range(1, 7) 
- 25  MSG_KEXINIT, MSG_NEWKEYS = range(20, 22) 
- 26  MSG_USERAUTH_REQUEST, MSG_USERAUTH_FAILURE, MSG_USERAUTH_SUCCESS, \ 
- 27          MSG_USERAUTH_BANNER = range(50, 54) 
- 28  MSG_USERAUTH_PK_OK = 60 
- 29  MSG_USERAUTH_INFO_REQUEST, MSG_USERAUTH_INFO_RESPONSE = range(60, 62) 
- 30  MSG_GLOBAL_REQUEST, MSG_REQUEST_SUCCESS, MSG_REQUEST_FAILURE = range(80, 83) 
- 31  MSG_CHANNEL_OPEN, MSG_CHANNEL_OPEN_SUCCESS, MSG_CHANNEL_OPEN_FAILURE, \ 
- 32      MSG_CHANNEL_WINDOW_ADJUST, MSG_CHANNEL_DATA, MSG_CHANNEL_EXTENDED_DATA, \ 
- 33      MSG_CHANNEL_EOF, MSG_CHANNEL_CLOSE, MSG_CHANNEL_REQUEST, \ 
- 34      MSG_CHANNEL_SUCCESS, MSG_CHANNEL_FAILURE = range(90, 101) 
- 35   
- 36   
- 37  # for debugging: 
- 38  MSG_NAMES = { 
- 39      MSG_DISCONNECT: 'disconnect', 
- 40      MSG_IGNORE: 'ignore', 
- 41      MSG_UNIMPLEMENTED: 'unimplemented', 
- 42      MSG_DEBUG: 'debug', 
- 43      MSG_SERVICE_REQUEST: 'service-request', 
- 44      MSG_SERVICE_ACCEPT: 'service-accept', 
- 45      MSG_KEXINIT: 'kexinit', 
- 46      MSG_NEWKEYS: 'newkeys', 
- 47      30: 'kex30', 
- 48      31: 'kex31', 
- 49      32: 'kex32', 
- 50      33: 'kex33', 
- 51      34: 'kex34', 
- 52      MSG_USERAUTH_REQUEST: 'userauth-request', 
- 53      MSG_USERAUTH_FAILURE: 'userauth-failure', 
- 54      MSG_USERAUTH_SUCCESS: 'userauth-success', 
- 55      MSG_USERAUTH_BANNER: 'userauth--banner', 
- 56      MSG_USERAUTH_PK_OK: 'userauth-60(pk-ok/info-request)', 
- 57      MSG_USERAUTH_INFO_RESPONSE: 'userauth-info-response', 
- 58      MSG_GLOBAL_REQUEST: 'global-request', 
- 59      MSG_REQUEST_SUCCESS: 'request-success', 
- 60      MSG_REQUEST_FAILURE: 'request-failure', 
- 61      MSG_CHANNEL_OPEN: 'channel-open', 
- 62      MSG_CHANNEL_OPEN_SUCCESS: 'channel-open-success', 
- 63      MSG_CHANNEL_OPEN_FAILURE: 'channel-open-failure', 
- 64      MSG_CHANNEL_WINDOW_ADJUST: 'channel-window-adjust', 
- 65      MSG_CHANNEL_DATA: 'channel-data', 
- 66      MSG_CHANNEL_EXTENDED_DATA: 'channel-extended-data', 
- 67      MSG_CHANNEL_EOF: 'channel-eof', 
- 68      MSG_CHANNEL_CLOSE: 'channel-close', 
- 69      MSG_CHANNEL_REQUEST: 'channel-request', 
- 70      MSG_CHANNEL_SUCCESS: 'channel-success', 
- 71      MSG_CHANNEL_FAILURE: 'channel-failure' 
- 72      } 
- 73   
- 74   
- 75  # authentication request return codes: 
- 76  AUTH_SUCCESSFUL, AUTH_PARTIALLY_SUCCESSFUL, AUTH_FAILED = range(3) 
- 77   
- 78   
- 79  # channel request failed reasons: 
- 80  (OPEN_SUCCEEDED, 
- 81   OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED, 
- 82   OPEN_FAILED_CONNECT_FAILED, 
- 83   OPEN_FAILED_UNKNOWN_CHANNEL_TYPE, 
- 84   OPEN_FAILED_RESOURCE_SHORTAGE) = range(0, 5) 
- 85   
- 86   
- 87  CONNECTION_FAILED_CODE = { 
- 88      1: 'Administratively prohibited', 
- 89      2: 'Connect failed', 
- 90      3: 'Unknown channel type', 
- 91      4: 'Resource shortage' 
- 92  } 
- 93   
- 94   
- 95  DISCONNECT_SERVICE_NOT_AVAILABLE, DISCONNECT_AUTH_CANCELLED_BY_USER, \ 
- 96      DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 7, 13, 14 
- 97   
- 98  from Crypto import Random 
- 99   
-100  # keep a crypto-strong PRNG nearby 
-101  rng = Random.new() 
-102   
-103  import sys 
-104  if sys.version_info < (2, 3): 
-105      try: 
-106          import logging 
-107      except: 
-108          import logging22 as logging 
-109      import select 
-110      PY22 = True 
-111   
-112      import socket 
-113      if not hasattr(socket, 'timeout'): 
-
114 - class timeout(socket.error): pass -
115 socket.timeout = timeout -116 del timeout -117 else: -118 import logging -119 PY22 = False -120 -121 -122 DEBUG = logging.DEBUG -123 INFO = logging.INFO -124 WARNING = logging.WARNING -125 ERROR = logging.ERROR -126 CRITICAL = logging.CRITICAL -127 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.compress-module.html b/docs/paramiko.compress-module.html deleted file mode 100644 index 0a003a7..0000000 --- a/docs/paramiko.compress-module.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - - paramiko.compress - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module compress - - - - - -
[frames] | no frames]
-
- -

Module compress

source code

-

Compression implementations for a Transport.

- - - - - - - - - - - - - -
- Classes
-   - - ZlibCompressor -
-   - - ZlibDecompressor -
- - - - - - - - - -
- Variables
-   - - __package__ = 'paramiko' -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.compress-pysrc.html b/docs/paramiko.compress-pysrc.html deleted file mode 100644 index f19033f..0000000 --- a/docs/paramiko.compress-pysrc.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - paramiko.compress - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module compress - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.compress

-
- 1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
- 2  # 
- 3  # This file is part of paramiko. 
- 4  # 
- 5  # Paramiko is free software; you can redistribute it and/or modify it under the 
- 6  # terms of the GNU Lesser General Public License as published by the Free 
- 7  # Software Foundation; either version 2.1 of the License, or (at your option) 
- 8  # any later version. 
- 9  # 
-10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
-11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
-12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
-13  # details. 
-14  # 
-15  # You should have received a copy of the GNU Lesser General Public License 
-16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
-17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
-18   
-19  """ 
-20  Compression implementations for a Transport. 
-21  """ 
-22   
-23  import zlib 
-24   
-25   
-
26 -class ZlibCompressor (object): -
27 - def __init__(self): -
28 self.z = zlib.compressobj(9) -
29 -
30 - def __call__(self, data): -
31 return self.z.compress(data) + self.z.flush(zlib.Z_FULL_FLUSH) -
32 -33 -
34 -class ZlibDecompressor (object): -
35 - def __init__(self): -
36 self.z = zlib.decompressobj() -
37 -
38 - def __call__(self, data): -
39 return self.z.decompress(data) -
40 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.compress.ZlibCompressor-class.html b/docs/paramiko.compress.ZlibCompressor-class.html deleted file mode 100644 index b735db6..0000000 --- a/docs/paramiko.compress.ZlibCompressor-class.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - - paramiko.compress.ZlibCompressor - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module compress :: - Class ZlibCompressor - - - - - -
[frames] | no frames]
-
- -

Class ZlibCompressor

source code

-
-object --+
-         |
-        ZlibCompressor
-
- -
- - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
-   - - - - - - -
__call__(self, - data) - source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self) -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.compress.ZlibDecompressor-class.html b/docs/paramiko.compress.ZlibDecompressor-class.html deleted file mode 100644 index 48ff726..0000000 --- a/docs/paramiko.compress.ZlibDecompressor-class.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - - paramiko.compress.ZlibDecompressor - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module compress :: - Class ZlibDecompressor - - - - - -
[frames] | no frames]
-
- -

Class ZlibDecompressor

source code

-
-object --+
-         |
-        ZlibDecompressor
-
- -
- - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
-   - - - - - - -
__call__(self, - data) - source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self) -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.config-module.html b/docs/paramiko.config-module.html deleted file mode 100644 index 51fef48..0000000 --- a/docs/paramiko.config-module.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - paramiko.config - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module config - - - - - -
[frames] | no frames]
-
- -

Module config

source code

-

SSHConfig.

- - - - - - - - - - -
- Variables
-   - - __package__ = 'paramiko' -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.config-pysrc.html b/docs/paramiko.config-pysrc.html deleted file mode 100644 index c773999..0000000 --- a/docs/paramiko.config-pysrc.html +++ /dev/null @@ -1,219 +0,0 @@ - - - - - paramiko.config - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module config - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.config

-
-  1  # Copyright (C) 2006-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  L{SSHConfig}. 
- 21  """ 
- 22   
- 23  import fnmatch 
- 24   
- 25   
-
26 -class SSHConfig (object): -
27 """ - 28 Representation of config information as stored in the format used by - 29 OpenSSH. Queries can be made via L{lookup}. The format is described in - 30 OpenSSH's C{ssh_config} man page. This class is provided primarily as a - 31 convenience to posix users (since the OpenSSH format is a de-facto - 32 standard on posix) but should work fine on Windows too. - 33 - 34 @since: 1.6 - 35 """ - 36 -
37 - def __init__(self): -
38 """ - 39 Create a new OpenSSH config object. - 40 """ - 41 self._config = [ { 'host': '*' } ] -
42 -
43 - def parse(self, file_obj): -
44 """ - 45 Read an OpenSSH config from the given file object. - 46 - 47 @param file_obj: a file-like object to read the config file from - 48 @type file_obj: file - 49 """ - 50 configs = [self._config[0]] - 51 for line in file_obj: - 52 line = line.rstrip('\n').lstrip() - 53 if (line == '') or (line[0] == '#'): - 54 continue - 55 if '=' in line: - 56 key, value = line.split('=', 1) - 57 key = key.strip().lower() - 58 else: - 59 # find first whitespace, and split there - 60 i = 0 - 61 while (i < len(line)) and not line[i].isspace(): - 62 i += 1 - 63 if i == len(line): - 64 raise Exception('Unparsable line: %r' % line) - 65 key = line[:i].lower() - 66 value = line[i:].lstrip() - 67 - 68 if key == 'host': - 69 del configs[:] - 70 # the value may be multiple hosts, space-delimited - 71 for host in value.split(): - 72 # do we have a pre-existing host config to append to? - 73 matches = [c for c in self._config if c['host'] == host] - 74 if len(matches) > 0: - 75 configs.append(matches[0]) - 76 else: - 77 config = { 'host': host } - 78 self._config.append(config) - 79 configs.append(config) - 80 else: - 81 for config in configs: - 82 config[key] = value -
83 -
84 - def lookup(self, hostname): -
85 """ - 86 Return a dict of config options for a given hostname. - 87 - 88 The host-matching rules of OpenSSH's C{ssh_config} man page are used, - 89 which means that all configuration options from matching host - 90 specifications are merged, with more specific hostmasks taking - 91 precedence. In other words, if C{"Port"} is set under C{"Host *"} - 92 and also C{"Host *.example.com"}, and the lookup is for - 93 C{"ssh.example.com"}, then the port entry for C{"Host *.example.com"} - 94 will win out. - 95 - 96 The keys in the returned dict are all normalized to lowercase (look for - 97 C{"port"}, not C{"Port"}. No other processing is done to the keys or - 98 values. - 99 -100 @param hostname: the hostname to lookup -101 @type hostname: str -102 """ -103 matches = [x for x in self._config if fnmatch.fnmatch(hostname, x['host'])] -104 # sort in order of shortest match (usually '*') to longest -105 matches.sort(lambda x,y: cmp(len(x['host']), len(y['host']))) -106 ret = {} -107 for m in matches: -108 ret.update(m) -109 del ret['host'] -110 return ret -
111 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.dsskey-module.html b/docs/paramiko.dsskey-module.html deleted file mode 100644 index 537c36d..0000000 --- a/docs/paramiko.dsskey-module.html +++ /dev/null @@ -1,531 +0,0 @@ - - - - - paramiko.dsskey - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module dsskey - - - - - -
[frames] | no frames]
-
- -

Module dsskey

source code

-

DSSKey

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Variables
-   - - AUTH_FAILED = 2 -
-   - - AUTH_PARTIALLY_SUCCESSFUL = 1 -
-   - - AUTH_SUCCESSFUL = 0 -
-   - - CONNECTION_FAILED_CODE = {1: 'Administratively prohibited', 2:... -
-   - - CRITICAL = 50 -
-   - - DEBUG = 10 -
-   - - DISCONNECT_AUTH_CANCELLED_BY_USER = 13 -
-   - - DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14 -
-   - - DISCONNECT_SERVICE_NOT_AVAILABLE = 7 -
-   - - ERROR = 40 -
-   - - INFO = 20 -
-   - - MSG_CHANNEL_CLOSE = 97 -
-   - - MSG_CHANNEL_DATA = 94 -
-   - - MSG_CHANNEL_EOF = 96 -
-   - - MSG_CHANNEL_EXTENDED_DATA = 95 -
-   - - MSG_CHANNEL_FAILURE = 100 -
-   - - MSG_CHANNEL_OPEN = 90 -
-   - - MSG_CHANNEL_OPEN_FAILURE = 92 -
-   - - MSG_CHANNEL_OPEN_SUCCESS = 91 -
-   - - MSG_CHANNEL_REQUEST = 98 -
-   - - MSG_CHANNEL_SUCCESS = 99 -
-   - - MSG_CHANNEL_WINDOW_ADJUST = 93 -
-   - - MSG_DEBUG = 4 -
-   - - MSG_DISCONNECT = 1 -
-   - - MSG_GLOBAL_REQUEST = 80 -
-   - - MSG_IGNORE = 2 -
-   - - MSG_KEXINIT = 20 -
-   - - MSG_NAMES = {1: 'disconnect', 2: 'ignore', 3: 'unimplemented',... -
-   - - MSG_NEWKEYS = 21 -
-   - - MSG_REQUEST_FAILURE = 82 -
-   - - MSG_REQUEST_SUCCESS = 81 -
-   - - MSG_SERVICE_ACCEPT = 6 -
-   - - MSG_SERVICE_REQUEST = 5 -
-   - - MSG_UNIMPLEMENTED = 3 -
-   - - MSG_USERAUTH_BANNER = 53 -
-   - - MSG_USERAUTH_FAILURE = 51 -
-   - - MSG_USERAUTH_INFO_REQUEST = 60 -
-   - - MSG_USERAUTH_INFO_RESPONSE = 61 -
-   - - MSG_USERAUTH_PK_OK = 60 -
-   - - MSG_USERAUTH_REQUEST = 50 -
-   - - MSG_USERAUTH_SUCCESS = 52 -
-   - - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED = 1 -
-   - - OPEN_FAILED_CONNECT_FAILED = 2 -
-   - - OPEN_FAILED_RESOURCE_SHORTAGE = 4 -
-   - - OPEN_FAILED_UNKNOWN_CHANNEL_TYPE = 3 -
-   - - OPEN_SUCCEEDED = 0 -
-   - - PY22 = False -
-   - - WARNING = 30 -
-   - - __package__ = 'paramiko' -
-   - - rng = Random.new() -
- - - - - - -
- Variables Details
- -
- -
-

CONNECTION_FAILED_CODE

- -
-
-
-
Value:
-
-{1: 'Administratively prohibited',
- 2: 'Connect failed',
- 3: 'Unknown channel type',
- 4: 'Resource shortage'}
-
-
-
-
-
- -
- -
-

MSG_NAMES

- -
-
-
-
Value:
-
-{1: 'disconnect',
- 2: 'ignore',
- 3: 'unimplemented',
- 4: 'debug',
- 5: 'service-request',
- 6: 'service-accept',
- 20: 'kexinit',
- 21: 'newkeys',
-...
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.dsskey-pysrc.html b/docs/paramiko.dsskey-pysrc.html deleted file mode 100644 index 6e96318..0000000 --- a/docs/paramiko.dsskey-pysrc.html +++ /dev/null @@ -1,356 +0,0 @@ - - - - - paramiko.dsskey - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module dsskey - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.dsskey

-
-  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  L{DSSKey} 
- 21  """ 
- 22   
- 23  from Crypto.PublicKey import DSA 
- 24  from Crypto.Hash import SHA 
- 25   
- 26  from paramiko.common import * 
- 27  from paramiko import util 
- 28  from paramiko.ssh_exception import SSHException 
- 29  from paramiko.message import Message 
- 30  from paramiko.ber import BER, BERException 
- 31  from paramiko.pkey import PKey 
- 32   
- 33   
-
34 -class DSSKey (PKey): -
35 """ - 36 Representation of a DSS key which can be used to sign an verify SSH2 - 37 data. - 38 """ - 39 -
40 - def __init__(self, msg=None, data=None, filename=None, password=None, vals=None, file_obj=None): -
41 self.p = None - 42 self.q = None - 43 self.g = None - 44 self.y = None - 45 self.x = None - 46 if file_obj is not None: - 47 self._from_private_key(file_obj, password) - 48 return - 49 if filename is not None: - 50 self._from_private_key_file(filename, password) - 51 return - 52 if (msg is None) and (data is not None): - 53 msg = Message(data) - 54 if vals is not None: - 55 self.p, self.q, self.g, self.y = vals - 56 else: - 57 if msg is None: - 58 raise SSHException('Key object may not be empty') - 59 if msg.get_string() != 'ssh-dss': - 60 raise SSHException('Invalid key') - 61 self.p = msg.get_mpint() - 62 self.q = msg.get_mpint() - 63 self.g = msg.get_mpint() - 64 self.y = msg.get_mpint() - 65 self.size = util.bit_length(self.p) -
66 -
67 - def __str__(self): -
68 m = Message() - 69 m.add_string('ssh-dss') - 70 m.add_mpint(self.p) - 71 m.add_mpint(self.q) - 72 m.add_mpint(self.g) - 73 m.add_mpint(self.y) - 74 return str(m) -
75 -
76 - def __hash__(self): -
77 h = hash(self.get_name()) - 78 h = h * 37 + hash(self.p) - 79 h = h * 37 + hash(self.q) - 80 h = h * 37 + hash(self.g) - 81 h = h * 37 + hash(self.y) - 82 # h might be a long by now... - 83 return hash(h) -
84 -
85 - def get_name(self): -
86 return 'ssh-dss' -
87 -
88 - def get_bits(self): -
89 return self.size -
90 -
91 - def can_sign(self): -
92 return self.x is not None -
93 -
94 - def sign_ssh_data(self, rng, data): -
95 digest = SHA.new(data).digest() - 96 dss = DSA.construct((long(self.y), long(self.g), long(self.p), long(self.q), long(self.x))) - 97 # generate a suitable k - 98 qsize = len(util.deflate_long(self.q, 0)) - 99 while True: -100 k = util.inflate_long(rng.read(qsize), 1) -101 if (k > 2) and (k < self.q): -102 break -103 r, s = dss.sign(util.inflate_long(digest, 1), k) -104 m = Message() -105 m.add_string('ssh-dss') -106 # apparently, in rare cases, r or s may be shorter than 20 bytes! -107 rstr = util.deflate_long(r, 0) -108 sstr = util.deflate_long(s, 0) -109 if len(rstr) < 20: -110 rstr = '\x00' * (20 - len(rstr)) + rstr -111 if len(sstr) < 20: -112 sstr = '\x00' * (20 - len(sstr)) + sstr -113 m.add_string(rstr + sstr) -114 return m -
115 -
116 - def verify_ssh_sig(self, data, msg): -
117 if len(str(msg)) == 40: -118 # spies.com bug: signature has no header -119 sig = str(msg) -120 else: -121 kind = msg.get_string() -122 if kind != 'ssh-dss': -123 return 0 -124 sig = msg.get_string() -125 -126 # pull out (r, s) which are NOT encoded as mpints -127 sigR = util.inflate_long(sig[:20], 1) -128 sigS = util.inflate_long(sig[20:], 1) -129 sigM = util.inflate_long(SHA.new(data).digest(), 1) -130 -131 dss = DSA.construct((long(self.y), long(self.g), long(self.p), long(self.q))) -132 return dss.verify(sigM, (sigR, sigS)) -
133 -
134 - def _encode_key(self): -
135 if self.x is None: -136 raise SSHException('Not enough key information') -137 keylist = [ 0, self.p, self.q, self.g, self.y, self.x ] -138 try: -139 b = BER() -140 b.encode(keylist) -141 except BERException: -142 raise SSHException('Unable to create ber encoding of key') -143 return str(b) -
144 -
145 - def write_private_key_file(self, filename, password=None): -
146 self._write_private_key_file('DSA', filename, self._encode_key(), password) -
147 -
148 - def write_private_key(self, file_obj, password=None): -
149 self._write_private_key('DSA', file_obj, self._encode_key(), password) -
150 -
151 - def generate(bits=1024, progress_func=None): -
152 """ -153 Generate a new private DSS key. This factory function can be used to -154 generate a new host key or authentication key. -155 -156 @param bits: number of bits the generated key should be. -157 @type bits: int -158 @param progress_func: an optional function to call at key points in -159 key generation (used by C{pyCrypto.PublicKey}). -160 @type progress_func: function -161 @return: new private key -162 @rtype: L{DSSKey} -163 """ -164 dsa = DSA.generate(bits, rng.read, progress_func) -165 key = DSSKey(vals=(dsa.p, dsa.q, dsa.g, dsa.y)) -166 key.x = dsa.x -167 return key -
168 generate = staticmethod(generate) -169 -170 -171 ### internals... -172 -173 -
174 - def _from_private_key_file(self, filename, password): -
175 data = self._read_private_key_file('DSA', filename, password) -176 self._decode_key(data) -
177 -
178 - def _from_private_key(self, file_obj, password): -
179 data = self._read_private_key('DSA', file_obj, password) -180 self._decode_key(data) -
181 -
182 - def _decode_key(self, data): -
183 # private key file contains: -184 # DSAPrivateKey = { version = 0, p, q, g, y, x } -185 try: -186 keylist = BER(data).decode() -187 except BERException, x: -188 raise SSHException('Unable to parse key file: ' + str(x)) -189 if (type(keylist) is not list) or (len(keylist) < 6) or (keylist[0] != 0): -190 raise SSHException('not a valid DSA private key file (bad ber encoding)') -191 self.p = keylist[1] -192 self.q = keylist[2] -193 self.g = keylist[3] -194 self.y = keylist[4] -195 self.x = keylist[5] -196 self.size = util.bit_length(self.p) -
197 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.file-module.html b/docs/paramiko.file-module.html deleted file mode 100644 index a0722b0..0000000 --- a/docs/paramiko.file-module.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - paramiko.file - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module file - - - - - -
[frames] | no frames]
-
- -

Module file

source code

-

BufferedFile.

- - - - - - - - - - -
- Variables
-   - - __package__ = 'paramiko' -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.file-pysrc.html b/docs/paramiko.file-pysrc.html deleted file mode 100644 index 7798427..0000000 --- a/docs/paramiko.file-pysrc.html +++ /dev/null @@ -1,579 +0,0 @@ - - - - - paramiko.file - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module file - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.file

-
-  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  BufferedFile. 
- 21  """ 
- 22   
- 23  from cStringIO import StringIO 
- 24   
- 25   
-
26 -class BufferedFile (object): -
27 """ - 28 Reusable base class to implement python-style file buffering around a - 29 simpler stream. - 30 """ - 31 - 32 _DEFAULT_BUFSIZE = 8192 - 33 - 34 SEEK_SET = 0 - 35 SEEK_CUR = 1 - 36 SEEK_END = 2 - 37 - 38 FLAG_READ = 0x1 - 39 FLAG_WRITE = 0x2 - 40 FLAG_APPEND = 0x4 - 41 FLAG_BINARY = 0x10 - 42 FLAG_BUFFERED = 0x20 - 43 FLAG_LINE_BUFFERED = 0x40 - 44 FLAG_UNIVERSAL_NEWLINE = 0x80 - 45 -
46 - def __init__(self): -
47 self.newlines = None - 48 self._flags = 0 - 49 self._bufsize = self._DEFAULT_BUFSIZE - 50 self._wbuffer = StringIO() - 51 self._rbuffer = '' - 52 self._at_trailing_cr = False - 53 self._closed = False - 54 # pos - position within the file, according to the user - 55 # realpos - position according the OS - 56 # (these may be different because we buffer for line reading) - 57 self._pos = self._realpos = 0 - 58 # size only matters for seekable files - 59 self._size = 0 -
60 -
61 - def __del__(self): -
62 self.close() -
63 -
64 - def __iter__(self): -
65 """ - 66 Returns an iterator that can be used to iterate over the lines in this - 67 file. This iterator happens to return the file itself, since a file is - 68 its own iterator. - 69 - 70 @raise ValueError: if the file is closed. - 71 - 72 @return: an interator. - 73 @rtype: iterator - 74 """ - 75 if self._closed: - 76 raise ValueError('I/O operation on closed file') - 77 return self -
78 -
79 - def close(self): -
80 """ - 81 Close the file. Future read and write operations will fail. - 82 """ - 83 self.flush() - 84 self._closed = True -
85 -
86 - def flush(self): -
87 """ - 88 Write out any data in the write buffer. This may do nothing if write - 89 buffering is not turned on. - 90 """ - 91 self._write_all(self._wbuffer.getvalue()) - 92 self._wbuffer = StringIO() - 93 return -
94 -
95 - def next(self): -
96 """ - 97 Returns the next line from the input, or raises L{StopIteration} when - 98 EOF is hit. Unlike python file objects, it's okay to mix calls to - 99 C{next} and L{readline}. -100 -101 @raise StopIteration: when the end of the file is reached. -102 -103 @return: a line read from the file. -104 @rtype: str -105 """ -106 line = self.readline() -107 if not line: -108 raise StopIteration -109 return line -
110 -
111 - def read(self, size=None): -
112 """ -113 Read at most C{size} bytes from the file (less if we hit the end of the -114 file first). If the C{size} argument is negative or omitted, read all -115 the remaining data in the file. -116 -117 @param size: maximum number of bytes to read -118 @type size: int -119 @return: data read from the file, or an empty string if EOF was -120 encountered immediately -121 @rtype: str -122 """ -123 if self._closed: -124 raise IOError('File is closed') -125 if not (self._flags & self.FLAG_READ): -126 raise IOError('File is not open for reading') -127 if (size is None) or (size < 0): -128 # go for broke -129 result = self._rbuffer -130 self._rbuffer = '' -131 self._pos += len(result) -132 while True: -133 try: -134 new_data = self._read(self._DEFAULT_BUFSIZE) -135 except EOFError: -136 new_data = None -137 if (new_data is None) or (len(new_data) == 0): -138 break -139 result += new_data -140 self._realpos += len(new_data) -141 self._pos += len(new_data) -142 return result -143 if size <= len(self._rbuffer): -144 result = self._rbuffer[:size] -145 self._rbuffer = self._rbuffer[size:] -146 self._pos += len(result) -147 return result -148 while len(self._rbuffer) < size: -149 read_size = size - len(self._rbuffer) -150 if self._flags & self.FLAG_BUFFERED: -151 read_size = max(self._bufsize, read_size) -152 try: -153 new_data = self._read(read_size) -154 except EOFError: -155 new_data = None -156 if (new_data is None) or (len(new_data) == 0): -157 break -158 self._rbuffer += new_data -159 self._realpos += len(new_data) -160 result = self._rbuffer[:size] -161 self._rbuffer = self._rbuffer[size:] -162 self._pos += len(result) -163 return result -
164 -
165 - def readline(self, size=None): -
166 """ -167 Read one entire line from the file. A trailing newline character is -168 kept in the string (but may be absent when a file ends with an -169 incomplete line). If the size argument is present and non-negative, it -170 is a maximum byte count (including the trailing newline) and an -171 incomplete line may be returned. An empty string is returned only when -172 EOF is encountered immediately. -173 -174 @note: Unlike stdio's C{fgets()}, the returned string contains null -175 characters (C{'\\0'}) if they occurred in the input. -176 -177 @param size: maximum length of returned string. -178 @type size: int -179 @return: next line of the file, or an empty string if the end of the -180 file has been reached. -181 @rtype: str -182 """ -183 # it's almost silly how complex this function is. -184 if self._closed: -185 raise IOError('File is closed') -186 if not (self._flags & self.FLAG_READ): -187 raise IOError('File not open for reading') -188 line = self._rbuffer -189 while True: -190 if self._at_trailing_cr and (self._flags & self.FLAG_UNIVERSAL_NEWLINE) and (len(line) > 0): -191 # edge case: the newline may be '\r\n' and we may have read -192 # only the first '\r' last time. -193 if line[0] == '\n': -194 line = line[1:] -195 self._record_newline('\r\n') -196 else: -197 self._record_newline('\r') -198 self._at_trailing_cr = False -199 # check size before looking for a linefeed, in case we already have -200 # enough. -201 if (size is not None) and (size >= 0): -202 if len(line) >= size: -203 # truncate line and return -204 self._rbuffer = line[size:] -205 line = line[:size] -206 self._pos += len(line) -207 return line -208 n = size - len(line) -209 else: -210 n = self._bufsize -211 if ('\n' in line) or ((self._flags & self.FLAG_UNIVERSAL_NEWLINE) and ('\r' in line)): -212 break -213 try: -214 new_data = self._read(n) -215 except EOFError: -216 new_data = None -217 if (new_data is None) or (len(new_data) == 0): -218 self._rbuffer = '' -219 self._pos += len(line) -220 return line -221 line += new_data -222 self._realpos += len(new_data) -223 # find the newline -224 pos = line.find('\n') -225 if self._flags & self.FLAG_UNIVERSAL_NEWLINE: -226 rpos = line.find('\r') -227 if (rpos >= 0) and ((rpos < pos) or (pos < 0)): -228 pos = rpos -229 xpos = pos + 1 -230 if (line[pos] == '\r') and (xpos < len(line)) and (line[xpos] == '\n'): -231 xpos += 1 -232 self._rbuffer = line[xpos:] -233 lf = line[pos:xpos] -234 line = line[:pos] + '\n' -235 if (len(self._rbuffer) == 0) and (lf == '\r'): -236 # we could read the line up to a '\r' and there could still be a -237 # '\n' following that we read next time. note that and eat it. -238 self._at_trailing_cr = True -239 else: -240 self._record_newline(lf) -241 self._pos += len(line) -242 return line -
243 -
244 - def readlines(self, sizehint=None): -
245 """ -246 Read all remaining lines using L{readline} and return them as a list. -247 If the optional C{sizehint} argument is present, instead of reading up -248 to EOF, whole lines totalling approximately sizehint bytes (possibly -249 after rounding up to an internal buffer size) are read. -250 -251 @param sizehint: desired maximum number of bytes to read. -252 @type sizehint: int -253 @return: list of lines read from the file. -254 @rtype: list -255 """ -256 lines = [] -257 bytes = 0 -258 while True: -259 line = self.readline() -260 if len(line) == 0: -261 break -262 lines.append(line) -263 bytes += len(line) -264 if (sizehint is not None) and (bytes >= sizehint): -265 break -266 return lines -
267 -
268 - def seek(self, offset, whence=0): -
269 """ -270 Set the file's current position, like stdio's C{fseek}. Not all file -271 objects support seeking. -272 -273 @note: If a file is opened in append mode (C{'a'} or C{'a+'}), any seek -274 operations will be undone at the next write (as the file position -275 will move back to the end of the file). -276 -277 @param offset: position to move to within the file, relative to -278 C{whence}. -279 @type offset: int -280 @param whence: type of movement: 0 = absolute; 1 = relative to the -281 current position; 2 = relative to the end of the file. -282 @type whence: int -283 -284 @raise IOError: if the file doesn't support random access. -285 """ -286 raise IOError('File does not support seeking.') -
287 -
288 - def tell(self): -
289 """ -290 Return the file's current position. This may not be accurate or -291 useful if the underlying file doesn't support random access, or was -292 opened in append mode. -293 -294 @return: file position (in bytes). -295 @rtype: int -296 """ -297 return self._pos -
298 -
299 - def write(self, data): -
300 """ -301 Write data to the file. If write buffering is on (C{bufsize} was -302 specified and non-zero), some or all of the data may not actually be -303 written yet. (Use L{flush} or L{close} to force buffered data to be -304 written out.) -305 -306 @param data: data to write. -307 @type data: str -308 """ -309 if self._closed: -310 raise IOError('File is closed') -311 if not (self._flags & self.FLAG_WRITE): -312 raise IOError('File not open for writing') -313 if not (self._flags & self.FLAG_BUFFERED): -314 self._write_all(data) -315 return -316 self._wbuffer.write(data) -317 if self._flags & self.FLAG_LINE_BUFFERED: -318 # only scan the new data for linefeed, to avoid wasting time. -319 last_newline_pos = data.rfind('\n') -320 if last_newline_pos >= 0: -321 wbuf = self._wbuffer.getvalue() -322 last_newline_pos += len(wbuf) - len(data) -323 self._write_all(wbuf[:last_newline_pos + 1]) -324 self._wbuffer = StringIO() -325 self._wbuffer.write(wbuf[last_newline_pos + 1:]) -326 return -327 # even if we're line buffering, if the buffer has grown past the -328 # buffer size, force a flush. -329 if self._wbuffer.tell() >= self._bufsize: -330 self.flush() -331 return -
332 -
333 - def writelines(self, sequence): -
334 """ -335 Write a sequence of strings to the file. The sequence can be any -336 iterable object producing strings, typically a list of strings. (The -337 name is intended to match L{readlines}; C{writelines} does not add line -338 separators.) -339 -340 @param sequence: an iterable sequence of strings. -341 @type sequence: sequence -342 """ -343 for line in sequence: -344 self.write(line) -345 return -
346 -
347 - def xreadlines(self): -
348 """ -349 Identical to C{iter(f)}. This is a deprecated file interface that -350 predates python iterator support. -351 -352 @return: an iterator. -353 @rtype: iterator -354 """ -355 return self -
356 -357 -358 ### overrides... -359 -360 -
361 - def _read(self, size): -
362 """ -363 I{(subclass override)} -364 Read data from the stream. Return C{None} or raise C{EOFError} to -365 indicate EOF. -366 """ -367 raise EOFError() -
368 -
369 - def _write(self, data): -
370 """ -371 I{(subclass override)} -372 Write data into the stream. -373 """ -374 raise IOError('write not implemented') -
375 -
376 - def _get_size(self): -
377 """ -378 I{(subclass override)} -379 Return the size of the file. This is called from within L{_set_mode} -380 if the file is opened in append mode, so the file position can be -381 tracked and L{seek} and L{tell} will work correctly. If the file is -382 a stream that can't be randomly accessed, you don't need to override -383 this method, -384 """ -385 return 0 -
386 -387 -388 ### internals... -389 -390 -
391 - def _set_mode(self, mode='r', bufsize=-1): -
392 """ -393 Subclasses call this method to initialize the BufferedFile. -394 """ -395 # set bufsize in any event, because it's used for readline(). -396 self._bufsize = self._DEFAULT_BUFSIZE -397 if bufsize < 0: -398 # do no buffering by default, because otherwise writes will get -399 # buffered in a way that will probably confuse people. -400 bufsize = 0 -401 if bufsize == 1: -402 # apparently, line buffering only affects writes. reads are only -403 # buffered if you call readline (directly or indirectly: iterating -404 # over a file will indirectly call readline). -405 self._flags |= self.FLAG_BUFFERED | self.FLAG_LINE_BUFFERED -406 elif bufsize > 1: -407 self._bufsize = bufsize -408 self._flags |= self.FLAG_BUFFERED -409 self._flags &= ~self.FLAG_LINE_BUFFERED -410 elif bufsize == 0: -411 # unbuffered -412 self._flags &= ~(self.FLAG_BUFFERED | self.FLAG_LINE_BUFFERED) -413 -414 if ('r' in mode) or ('+' in mode): -415 self._flags |= self.FLAG_READ -416 if ('w' in mode) or ('+' in mode): -417 self._flags |= self.FLAG_WRITE -418 if ('a' in mode): -419 self._flags |= self.FLAG_WRITE | self.FLAG_APPEND -420 self._size = self._get_size() -421 self._pos = self._realpos = self._size -422 if ('b' in mode): -423 self._flags |= self.FLAG_BINARY -424 if ('U' in mode): -425 self._flags |= self.FLAG_UNIVERSAL_NEWLINE -426 # built-in file objects have this attribute to store which kinds of -427 # line terminations they've seen: -428 # <http://www.python.org/doc/current/lib/built-in-funcs.html> -429 self.newlines = None -
430 -
431 - def _write_all(self, data): -
432 # the underlying stream may be something that does partial writes (like -433 # a socket). -434 while len(data) > 0: -435 count = self._write(data) -436 data = data[count:] -437 if self._flags & self.FLAG_APPEND: -438 self._size += count -439 self._pos = self._realpos = self._size -440 else: -441 self._pos += count -442 self._realpos += count -443 return None -
444 -
445 - def _record_newline(self, newline): -
446 # silliness about tracking what kinds of newlines we've seen. -447 # i don't understand why it can be None, a string, or a tuple, instead -448 # of just always being a tuple, but we'll emulate that behavior anyway. -449 if not (self._flags & self.FLAG_UNIVERSAL_NEWLINE): -450 return -451 if self.newlines is None: -452 self.newlines = newline -453 elif (type(self.newlines) is str) and (self.newlines != newline): -454 self.newlines = (self.newlines, newline) -455 elif newline not in self.newlines: -456 self.newlines += (newline,) -
457 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.hostkeys-module.html b/docs/paramiko.hostkeys-module.html deleted file mode 100644 index 3477a7b..0000000 --- a/docs/paramiko.hostkeys-module.html +++ /dev/null @@ -1,549 +0,0 @@ - - - - - paramiko.hostkeys - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module hostkeys - - - - - -
[frames] | no frames]
-
- -

Module hostkeys

source code

-

HostKeys

- - - - - - - - - - -
- Classes
-   - - HostKeyEntry
- Representation of a line in an OpenSSH-style "known - hosts" file. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Variables
-   - - AUTH_FAILED = 2 -
-   - - AUTH_PARTIALLY_SUCCESSFUL = 1 -
-   - - AUTH_SUCCESSFUL = 0 -
-   - - CONNECTION_FAILED_CODE = {1: 'Administratively prohibited', 2:... -
-   - - CRITICAL = 50 -
-   - - DEBUG = 10 -
-   - - DISCONNECT_AUTH_CANCELLED_BY_USER = 13 -
-   - - DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14 -
-   - - DISCONNECT_SERVICE_NOT_AVAILABLE = 7 -
-   - - ERROR = 40 -
-   - - INFO = 20 -
-   - - MSG_CHANNEL_CLOSE = 97 -
-   - - MSG_CHANNEL_DATA = 94 -
-   - - MSG_CHANNEL_EOF = 96 -
-   - - MSG_CHANNEL_EXTENDED_DATA = 95 -
-   - - MSG_CHANNEL_FAILURE = 100 -
-   - - MSG_CHANNEL_OPEN = 90 -
-   - - MSG_CHANNEL_OPEN_FAILURE = 92 -
-   - - MSG_CHANNEL_OPEN_SUCCESS = 91 -
-   - - MSG_CHANNEL_REQUEST = 98 -
-   - - MSG_CHANNEL_SUCCESS = 99 -
-   - - MSG_CHANNEL_WINDOW_ADJUST = 93 -
-   - - MSG_DEBUG = 4 -
-   - - MSG_DISCONNECT = 1 -
-   - - MSG_GLOBAL_REQUEST = 80 -
-   - - MSG_IGNORE = 2 -
-   - - MSG_KEXINIT = 20 -
-   - - MSG_NAMES = {1: 'disconnect', 2: 'ignore', 3: 'unimplemented',... -
-   - - MSG_NEWKEYS = 21 -
-   - - MSG_REQUEST_FAILURE = 82 -
-   - - MSG_REQUEST_SUCCESS = 81 -
-   - - MSG_SERVICE_ACCEPT = 6 -
-   - - MSG_SERVICE_REQUEST = 5 -
-   - - MSG_UNIMPLEMENTED = 3 -
-   - - MSG_USERAUTH_BANNER = 53 -
-   - - MSG_USERAUTH_FAILURE = 51 -
-   - - MSG_USERAUTH_INFO_REQUEST = 60 -
-   - - MSG_USERAUTH_INFO_RESPONSE = 61 -
-   - - MSG_USERAUTH_PK_OK = 60 -
-   - - MSG_USERAUTH_REQUEST = 50 -
-   - - MSG_USERAUTH_SUCCESS = 52 -
-   - - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED = 1 -
-   - - OPEN_FAILED_CONNECT_FAILED = 2 -
-   - - OPEN_FAILED_RESOURCE_SHORTAGE = 4 -
-   - - OPEN_FAILED_UNKNOWN_CHANNEL_TYPE = 3 -
-   - - OPEN_SUCCEEDED = 0 -
-   - - PY22 = False -
-   - - WARNING = 30 -
-   - - __package__ = 'paramiko' -
-   - - rng = Random.new() -
- - - - - - -
- Variables Details
- -
- -
-

CONNECTION_FAILED_CODE

- -
-
-
-
Value:
-
-{1: 'Administratively prohibited',
- 2: 'Connect failed',
- 3: 'Unknown channel type',
- 4: 'Resource shortage'}
-
-
-
-
-
- -
- -
-

MSG_NAMES

- -
-
-
-
Value:
-
-{1: 'disconnect',
- 2: 'ignore',
- 3: 'unimplemented',
- 4: 'debug',
- 5: 'service-request',
- 6: 'service-accept',
- 20: 'kexinit',
- 21: 'newkeys',
-...
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.hostkeys-pysrc.html b/docs/paramiko.hostkeys-pysrc.html deleted file mode 100644 index c4175b1..0000000 --- a/docs/paramiko.hostkeys-pysrc.html +++ /dev/null @@ -1,501 +0,0 @@ - - - - - paramiko.hostkeys - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module hostkeys - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.hostkeys

-
-  1  # Copyright (C) 2006-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  L{HostKeys} 
- 21  """ 
- 22   
- 23  import base64 
- 24  from Crypto.Hash import SHA, HMAC 
- 25  import UserDict 
- 26   
- 27  from paramiko.common import * 
- 28  from paramiko.dsskey import DSSKey 
- 29  from paramiko.rsakey import RSAKey 
- 30   
- 31   
-
32 -class HostKeyEntry: -
33 """ - 34 Representation of a line in an OpenSSH-style "known hosts" file. - 35 """ - 36 -
37 - def __init__(self, hostnames=None, key=None): -
38 self.valid = (hostnames is not None) and (key is not None) - 39 self.hostnames = hostnames - 40 self.key = key -
41 -
42 - def from_line(cls, line): -
43 """ - 44 Parses the given line of text to find the names for the host, - 45 the type of key, and the key data. The line is expected to be in the - 46 format used by the openssh known_hosts file. - 47 - 48 Lines are expected to not have leading or trailing whitespace. - 49 We don't bother to check for comments or empty lines. All of - 50 that should be taken care of before sending the line to us. - 51 - 52 @param line: a line from an OpenSSH known_hosts file - 53 @type line: str - 54 """ - 55 fields = line.split(' ') - 56 if len(fields) < 3: - 57 # Bad number of fields - 58 return None - 59 fields = fields[:3] - 60 - 61 names, keytype, key = fields - 62 names = names.split(',') - 63 - 64 # Decide what kind of key we're looking at and create an object - 65 # to hold it accordingly. - 66 if keytype == 'ssh-rsa': - 67 key = RSAKey(data=base64.decodestring(key)) - 68 elif keytype == 'ssh-dss': - 69 key = DSSKey(data=base64.decodestring(key)) - 70 else: - 71 return None - 72 - 73 return cls(names, key) -
74 from_line = classmethod(from_line) - 75 -
76 - def to_line(self): -
77 """ - 78 Returns a string in OpenSSH known_hosts file format, or None if - 79 the object is not in a valid state. A trailing newline is - 80 included. - 81 """ - 82 if self.valid: - 83 return '%s %s %s\n' % (','.join(self.hostnames), self.key.get_name(), - 84 self.key.get_base64()) - 85 return None -
86 -
87 - def __repr__(self): -
88 return '<HostKeyEntry %r: %r>' % (self.hostnames, self.key) -
89 - 90 -
91 -class HostKeys (UserDict.DictMixin): -
92 """ - 93 Representation of an openssh-style "known hosts" file. Host keys can be - 94 read from one or more files, and then individual hosts can be looked up to - 95 verify server keys during SSH negotiation. - 96 - 97 A HostKeys object can be treated like a dict; any dict lookup is equivalent - 98 to calling L{lookup}. - 99 -100 @since: 1.5.3 -101 """ -102 -
103 - def __init__(self, filename=None): -
104 """ -105 Create a new HostKeys object, optionally loading keys from an openssh -106 style host-key file. -107 -108 @param filename: filename to load host keys from, or C{None} -109 @type filename: str -110 """ -111 # emulate a dict of { hostname: { keytype: PKey } } -112 self._entries = [] -113 if filename is not None: -114 self.load(filename) -
115 -
116 - def add(self, hostname, keytype, key): -
117 """ -118 Add a host key entry to the table. Any existing entry for a -119 C{(hostname, keytype)} pair will be replaced. -120 -121 @param hostname: the hostname (or IP) to add -122 @type hostname: str -123 @param keytype: key type (C{"ssh-rsa"} or C{"ssh-dss"}) -124 @type keytype: str -125 @param key: the key to add -126 @type key: L{PKey} -127 """ -128 for e in self._entries: -129 if (hostname in e.hostnames) and (e.key.get_name() == keytype): -130 e.key = key -131 return -132 self._entries.append(HostKeyEntry([hostname], key)) -
133 -
134 - def load(self, filename): -
135 """ -136 Read a file of known SSH host keys, in the format used by openssh. -137 This type of file unfortunately doesn't exist on Windows, but on -138 posix, it will usually be stored in -139 C{os.path.expanduser("~/.ssh/known_hosts")}. -140 -141 If this method is called multiple times, the host keys are merged, -142 not cleared. So multiple calls to C{load} will just call L{add}, -143 replacing any existing entries and adding new ones. -144 -145 @param filename: name of the file to read host keys from -146 @type filename: str -147 -148 @raise IOError: if there was an error reading the file -149 """ -150 f = open(filename, 'r') -151 for line in f: -152 line = line.strip() -153 if (len(line) == 0) or (line[0] == '#'): -154 continue -155 e = HostKeyEntry.from_line(line) -156 if e is not None: -157 self._entries.append(e) -158 f.close() -
159 -
160 - def save(self, filename): -
161 """ -162 Save host keys into a file, in the format used by openssh. The order of -163 keys in the file will be preserved when possible (if these keys were -164 loaded from a file originally). The single exception is that combined -165 lines will be split into individual key lines, which is arguably a bug. -166 -167 @param filename: name of the file to write -168 @type filename: str -169 -170 @raise IOError: if there was an error writing the file -171 -172 @since: 1.6.1 -173 """ -174 f = open(filename, 'w') -175 for e in self._entries: -176 line = e.to_line() -177 if line: -178 f.write(line) -179 f.close() -
180 -
181 - def lookup(self, hostname): -
182 """ -183 Find a hostkey entry for a given hostname or IP. If no entry is found, -184 C{None} is returned. Otherwise a dictionary of keytype to key is -185 returned. The keytype will be either C{"ssh-rsa"} or C{"ssh-dss"}. -186 -187 @param hostname: the hostname (or IP) to lookup -188 @type hostname: str -189 @return: keys associated with this host (or C{None}) -190 @rtype: dict(str, L{PKey}) -191 """ -192 class SubDict (UserDict.DictMixin): -193 def __init__(self, hostname, entries, hostkeys): -194 self._hostname = hostname -195 self._entries = entries -196 self._hostkeys = hostkeys -
197 -198 def __getitem__(self, key): -199 for e in self._entries: -200 if e.key.get_name() == key: -201 return e.key -202 raise KeyError(key) -
203 -204 def __setitem__(self, key, val): -205 for e in self._entries: -206 if e.key is None: -207 continue -208 if e.key.get_name() == key: -209 # replace -210 e.key = val -211 break -212 else: -213 # add a new one -214 e = HostKeyEntry([hostname], val) -215 self._entries.append(e) -216 self._hostkeys._entries.append(e) -217 -218 def keys(self): -219 return [e.key.get_name() for e in self._entries if e.key is not None] -220 -221 entries = [] -222 for e in self._entries: -223 for h in e.hostnames: -224 if (h.startswith('|1|') and (self.hash_host(hostname, h) == h)) or (h == hostname): -225 entries.append(e) -226 if len(entries) == 0: -227 return None -228 return SubDict(hostname, entries, self) -229 -
230 - def check(self, hostname, key): -
231 """ -232 Return True if the given key is associated with the given hostname -233 in this dictionary. -234 -235 @param hostname: hostname (or IP) of the SSH server -236 @type hostname: str -237 @param key: the key to check -238 @type key: L{PKey} -239 @return: C{True} if the key is associated with the hostname; C{False} -240 if not -241 @rtype: bool -242 """ -243 k = self.lookup(hostname) -244 if k is None: -245 return False -246 host_key = k.get(key.get_name(), None) -247 if host_key is None: -248 return False -249 return str(host_key) == str(key) -
250 -
251 - def clear(self): -
252 """ -253 Remove all host keys from the dictionary. -254 """ -255 self._entries = [] -
256 -
257 - def __getitem__(self, key): -
258 ret = self.lookup(key) -259 if ret is None: -260 raise KeyError(key) -261 return ret -
262 -
263 - def __setitem__(self, hostname, entry): -
264 # don't use this please. -265 if len(entry) == 0: -266 self._entries.append(HostKeyEntry([hostname], None)) -267 return -268 for key_type in entry.keys(): -269 found = False -270 for e in self._entries: -271 if (hostname in e.hostnames) and (e.key.get_name() == key_type): -272 # replace -273 e.key = entry[key_type] -274 found = True -275 if not found: -276 self._entries.append(HostKeyEntry([hostname], entry[key_type])) -
277 -
278 - def keys(self): -
279 # python 2.4 sets would be nice here. -280 ret = [] -281 for e in self._entries: -282 for h in e.hostnames: -283 if h not in ret: -284 ret.append(h) -285 return ret -
286 -
287 - def values(self): -
288 ret = [] -289 for k in self.keys(): -290 ret.append(self.lookup(k)) -291 return ret -
292 -
293 - def hash_host(hostname, salt=None): -
294 """ -295 Return a "hashed" form of the hostname, as used by openssh when storing -296 hashed hostnames in the known_hosts file. -297 -298 @param hostname: the hostname to hash -299 @type hostname: str -300 @param salt: optional salt to use when hashing (must be 20 bytes long) -301 @type salt: str -302 @return: the hashed hostname -303 @rtype: str -304 """ -305 if salt is None: -306 salt = rng.read(SHA.digest_size) -307 else: -308 if salt.startswith('|1|'): -309 salt = salt.split('|')[2] -310 salt = base64.decodestring(salt) -311 assert len(salt) == SHA.digest_size -312 hmac = HMAC.HMAC(salt, hostname, SHA).digest() -313 hostkey = '|1|%s|%s' % (base64.encodestring(salt), base64.encodestring(hmac)) -314 return hostkey.replace('\n', '') -
315 hash_host = staticmethod(hash_host) -316 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.hostkeys.HostKeyEntry-class.html b/docs/paramiko.hostkeys.HostKeyEntry-class.html deleted file mode 100644 index 584888c..0000000 --- a/docs/paramiko.hostkeys.HostKeyEntry-class.html +++ /dev/null @@ -1,255 +0,0 @@ - - - - - paramiko.hostkeys.HostKeyEntry - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module hostkeys :: - Class HostKeyEntry - - - - - -
[frames] | no frames]
-
- -

Class HostKeyEntry

source code

-

Representation of a line in an OpenSSH-style "known hosts" - file.

- - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - hostnames=None, - key=None) - source code - -
- -
-   - - - - - - -
to_line(self)
- Returns a string in OpenSSH known_hosts file format, or None if the - object is not in a valid state.
- source code - -
- -
-   - - - - - - -
__repr__(self) - source code - -
- -
- - - - - - - - - -
- Class Methods
-   - - - - - - -
from_line(cls, - line)
- Parses the given line of text to find the names for the host, the - type of key, and the key data.
- source code - -
- -
- - - - - - -
- Method Details
- -
- -
- - -
-

from_line(cls, - line) -
Class Method -

-
source code  -
- -

Parses the given line of text to find the names for the host, the type - of key, and the key data. The line is expected to be in the format used - by the openssh known_hosts file.

-

Lines are expected to not have leading or trailing whitespace. We - don't bother to check for comments or empty lines. All of that should be - taken care of before sending the line to us.

-
-
Parameters:
-
    -
  • line (str) - a line from an OpenSSH known_hosts file
  • -
-
-
-
- -
- -
- - -
-

to_line(self) -

-
source code  -
- -

Returns a string in OpenSSH known_hosts file format, or None if the - object is not in a valid state. A trailing newline is included.

-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.kex_gex-module.html b/docs/paramiko.kex_gex-module.html deleted file mode 100644 index 345acc1..0000000 --- a/docs/paramiko.kex_gex-module.html +++ /dev/null @@ -1,550 +0,0 @@ - - - - - paramiko.kex_gex - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module kex_gex - - - - - -
[frames] | no frames]
-
- -

Module kex_gex

source code

-

Variant on KexGroup1 where the prime "p" and generator - "g" are provided by the server. A bit more work is required on - the client side, and a lot more on the server side.

- - - - - - - - - - -
- Classes
-   - - KexGex -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Variables
-   - - AUTH_FAILED = 2 -
-   - - AUTH_PARTIALLY_SUCCESSFUL = 1 -
-   - - AUTH_SUCCESSFUL = 0 -
-   - - CONNECTION_FAILED_CODE = {1: 'Administratively prohibited', 2:... -
-   - - CRITICAL = 50 -
-   - - DEBUG = 10 -
-   - - DISCONNECT_AUTH_CANCELLED_BY_USER = 13 -
-   - - DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14 -
-   - - DISCONNECT_SERVICE_NOT_AVAILABLE = 7 -
-   - - ERROR = 40 -
-   - - INFO = 20 -
-   - - MSG_CHANNEL_CLOSE = 97 -
-   - - MSG_CHANNEL_DATA = 94 -
-   - - MSG_CHANNEL_EOF = 96 -
-   - - MSG_CHANNEL_EXTENDED_DATA = 95 -
-   - - MSG_CHANNEL_FAILURE = 100 -
-   - - MSG_CHANNEL_OPEN = 90 -
-   - - MSG_CHANNEL_OPEN_FAILURE = 92 -
-   - - MSG_CHANNEL_OPEN_SUCCESS = 91 -
-   - - MSG_CHANNEL_REQUEST = 98 -
-   - - MSG_CHANNEL_SUCCESS = 99 -
-   - - MSG_CHANNEL_WINDOW_ADJUST = 93 -
-   - - MSG_DEBUG = 4 -
-   - - MSG_DISCONNECT = 1 -
-   - - MSG_GLOBAL_REQUEST = 80 -
-   - - MSG_IGNORE = 2 -
-   - - MSG_KEXINIT = 20 -
-   - - MSG_NAMES = {1: 'disconnect', 2: 'ignore', 3: 'unimplemented',... -
-   - - MSG_NEWKEYS = 21 -
-   - - MSG_REQUEST_FAILURE = 82 -
-   - - MSG_REQUEST_SUCCESS = 81 -
-   - - MSG_SERVICE_ACCEPT = 6 -
-   - - MSG_SERVICE_REQUEST = 5 -
-   - - MSG_UNIMPLEMENTED = 3 -
-   - - MSG_USERAUTH_BANNER = 53 -
-   - - MSG_USERAUTH_FAILURE = 51 -
-   - - MSG_USERAUTH_INFO_REQUEST = 60 -
-   - - MSG_USERAUTH_INFO_RESPONSE = 61 -
-   - - MSG_USERAUTH_PK_OK = 60 -
-   - - MSG_USERAUTH_REQUEST = 50 -
-   - - MSG_USERAUTH_SUCCESS = 52 -
-   - - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED = 1 -
-   - - OPEN_FAILED_CONNECT_FAILED = 2 -
-   - - OPEN_FAILED_RESOURCE_SHORTAGE = 4 -
-   - - OPEN_FAILED_UNKNOWN_CHANNEL_TYPE = 3 -
-   - - OPEN_SUCCEEDED = 0 -
-   - - PY22 = False -
-   - - WARNING = 30 -
-   - - __package__ = 'paramiko' -
-   - - rng = Random.new() -
- - - - - - -
- Variables Details
- -
- -
-

CONNECTION_FAILED_CODE

- -
-
-
-
Value:
-
-{1: 'Administratively prohibited',
- 2: 'Connect failed',
- 3: 'Unknown channel type',
- 4: 'Resource shortage'}
-
-
-
-
-
- -
- -
-

MSG_NAMES

- -
-
-
-
Value:
-
-{1: 'disconnect',
- 2: 'ignore',
- 3: 'unimplemented',
- 4: 'debug',
- 5: 'service-request',
- 6: 'service-accept',
- 20: 'kexinit',
- 21: 'newkeys',
-...
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.kex_gex-pysrc.html b/docs/paramiko.kex_gex-pysrc.html deleted file mode 100644 index 82f065e..0000000 --- a/docs/paramiko.kex_gex-pysrc.html +++ /dev/null @@ -1,463 +0,0 @@ - - - - - paramiko.kex_gex - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module kex_gex - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.kex_gex

-
-  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  Variant on L{KexGroup1 <paramiko.kex_group1.KexGroup1>} where the prime "p" and 
- 21  generator "g" are provided by the server.  A bit more work is required on the 
- 22  client side, and a B{lot} more on the server side. 
- 23  """ 
- 24   
- 25  from Crypto.Hash import SHA 
- 26  from Crypto.Util import number 
- 27   
- 28  from paramiko.common import * 
- 29  from paramiko import util 
- 30  from paramiko.message import Message 
- 31  from paramiko.ssh_exception import SSHException 
- 32   
- 33   
- 34  _MSG_KEXDH_GEX_REQUEST_OLD, _MSG_KEXDH_GEX_GROUP, _MSG_KEXDH_GEX_INIT, \ 
- 35      _MSG_KEXDH_GEX_REPLY, _MSG_KEXDH_GEX_REQUEST = range(30, 35) 
- 36   
- 37   
-
38 -class KexGex (object): -
39 - 40 name = 'diffie-hellman-group-exchange-sha1' - 41 min_bits = 1024 - 42 max_bits = 8192 - 43 preferred_bits = 2048 - 44 -
45 - def __init__(self, transport): -
46 self.transport = transport - 47 self.p = None - 48 self.q = None - 49 self.g = None - 50 self.x = None - 51 self.e = None - 52 self.f = None - 53 self.old_style = False -
54 -
55 - def start_kex(self, _test_old_style=False): -
56 if self.transport.server_mode: - 57 self.transport._expect_packet(_MSG_KEXDH_GEX_REQUEST, _MSG_KEXDH_GEX_REQUEST_OLD) - 58 return - 59 # request a bit range: we accept (min_bits) to (max_bits), but prefer - 60 # (preferred_bits). according to the spec, we shouldn't pull the - 61 # minimum up above 1024. - 62 m = Message() - 63 if _test_old_style: - 64 # only used for unit tests: we shouldn't ever send this - 65 m.add_byte(chr(_MSG_KEXDH_GEX_REQUEST_OLD)) - 66 m.add_int(self.preferred_bits) - 67 self.old_style = True - 68 else: - 69 m.add_byte(chr(_MSG_KEXDH_GEX_REQUEST)) - 70 m.add_int(self.min_bits) - 71 m.add_int(self.preferred_bits) - 72 m.add_int(self.max_bits) - 73 self.transport._send_message(m) - 74 self.transport._expect_packet(_MSG_KEXDH_GEX_GROUP) -
75 -
76 - def parse_next(self, ptype, m): -
77 if ptype == _MSG_KEXDH_GEX_REQUEST: - 78 return self._parse_kexdh_gex_request(m) - 79 elif ptype == _MSG_KEXDH_GEX_GROUP: - 80 return self._parse_kexdh_gex_group(m) - 81 elif ptype == _MSG_KEXDH_GEX_INIT: - 82 return self._parse_kexdh_gex_init(m) - 83 elif ptype == _MSG_KEXDH_GEX_REPLY: - 84 return self._parse_kexdh_gex_reply(m) - 85 elif ptype == _MSG_KEXDH_GEX_REQUEST_OLD: - 86 return self._parse_kexdh_gex_request_old(m) - 87 raise SSHException('KexGex asked to handle packet type %d' % ptype) -
88 - 89 - 90 ### internals... - 91 - 92 -
93 - def _generate_x(self): -
94 # generate an "x" (1 < x < (p-1)/2). - 95 q = (self.p - 1) // 2 - 96 qnorm = util.deflate_long(q, 0) - 97 qhbyte = ord(qnorm[0]) - 98 bytes = len(qnorm) - 99 qmask = 0xff -100 while not (qhbyte & 0x80): -101 qhbyte <<= 1 -102 qmask >>= 1 -103 while True: -104 x_bytes = self.transport.rng.read(bytes) -105 x_bytes = chr(ord(x_bytes[0]) & qmask) + x_bytes[1:] -106 x = util.inflate_long(x_bytes, 1) -107 if (x > 1) and (x < q): -108 break -109 self.x = x -
110 -
111 - def _parse_kexdh_gex_request(self, m): -
112 minbits = m.get_int() -113 preferredbits = m.get_int() -114 maxbits = m.get_int() -115 # smoosh the user's preferred size into our own limits -116 if preferredbits > self.max_bits: -117 preferredbits = self.max_bits -118 if preferredbits < self.min_bits: -119 preferredbits = self.min_bits -120 # fix min/max if they're inconsistent. technically, we could just pout -121 # and hang up, but there's no harm in giving them the benefit of the -122 # doubt and just picking a bitsize for them. -123 if minbits > preferredbits: -124 minbits = preferredbits -125 if maxbits < preferredbits: -126 maxbits = preferredbits -127 # now save a copy -128 self.min_bits = minbits -129 self.preferred_bits = preferredbits -130 self.max_bits = maxbits -131 # generate prime -132 pack = self.transport._get_modulus_pack() -133 if pack is None: -134 raise SSHException('Can\'t do server-side gex with no modulus pack') -135 self.transport._log(DEBUG, 'Picking p (%d <= %d <= %d bits)' % (minbits, preferredbits, maxbits)) -136 self.g, self.p = pack.get_modulus(minbits, preferredbits, maxbits) -137 m = Message() -138 m.add_byte(chr(_MSG_KEXDH_GEX_GROUP)) -139 m.add_mpint(self.p) -140 m.add_mpint(self.g) -141 self.transport._send_message(m) -142 self.transport._expect_packet(_MSG_KEXDH_GEX_INIT) -
143 -
144 - def _parse_kexdh_gex_request_old(self, m): -
145 # same as above, but without min_bits or max_bits (used by older clients like putty) -146 self.preferred_bits = m.get_int() -147 # smoosh the user's preferred size into our own limits -148 if self.preferred_bits > self.max_bits: -149 self.preferred_bits = self.max_bits -150 if self.preferred_bits < self.min_bits: -151 self.preferred_bits = self.min_bits -152 # generate prime -153 pack = self.transport._get_modulus_pack() -154 if pack is None: -155 raise SSHException('Can\'t do server-side gex with no modulus pack') -156 self.transport._log(DEBUG, 'Picking p (~ %d bits)' % (self.preferred_bits,)) -157 self.g, self.p = pack.get_modulus(self.min_bits, self.preferred_bits, self.max_bits) -158 m = Message() -159 m.add_byte(chr(_MSG_KEXDH_GEX_GROUP)) -160 m.add_mpint(self.p) -161 m.add_mpint(self.g) -162 self.transport._send_message(m) -163 self.transport._expect_packet(_MSG_KEXDH_GEX_INIT) -164 self.old_style = True -
165 -
166 - def _parse_kexdh_gex_group(self, m): -
167 self.p = m.get_mpint() -168 self.g = m.get_mpint() -169 # reject if p's bit length < 1024 or > 8192 -170 bitlen = util.bit_length(self.p) -171 if (bitlen < 1024) or (bitlen > 8192): -172 raise SSHException('Server-generated gex p (don\'t ask) is out of range (%d bits)' % bitlen) -173 self.transport._log(DEBUG, 'Got server p (%d bits)' % bitlen) -174 self._generate_x() -175 # now compute e = g^x mod p -176 self.e = pow(self.g, self.x, self.p) -177 m = Message() -178 m.add_byte(chr(_MSG_KEXDH_GEX_INIT)) -179 m.add_mpint(self.e) -180 self.transport._send_message(m) -181 self.transport._expect_packet(_MSG_KEXDH_GEX_REPLY) -
182 -
183 - def _parse_kexdh_gex_init(self, m): -
184 self.e = m.get_mpint() -185 if (self.e < 1) or (self.e > self.p - 1): -186 raise SSHException('Client kex "e" is out of range') -187 self._generate_x() -188 self.f = pow(self.g, self.x, self.p) -189 K = pow(self.e, self.x, self.p) -190 key = str(self.transport.get_server_key()) -191 # okay, build up the hash H of (V_C || V_S || I_C || I_S || K_S || min || n || max || p || g || e || f || K) -192 hm = Message() -193 hm.add(self.transport.remote_version, self.transport.local_version, -194 self.transport.remote_kex_init, self.transport.local_kex_init, -195 key) -196 if not self.old_style: -197 hm.add_int(self.min_bits) -198 hm.add_int(self.preferred_bits) -199 if not self.old_style: -200 hm.add_int(self.max_bits) -201 hm.add_mpint(self.p) -202 hm.add_mpint(self.g) -203 hm.add_mpint(self.e) -204 hm.add_mpint(self.f) -205 hm.add_mpint(K) -206 H = SHA.new(str(hm)).digest() -207 self.transport._set_K_H(K, H) -208 # sign it -209 sig = self.transport.get_server_key().sign_ssh_data(self.transport.rng, H) -210 # send reply -211 m = Message() -212 m.add_byte(chr(_MSG_KEXDH_GEX_REPLY)) -213 m.add_string(key) -214 m.add_mpint(self.f) -215 m.add_string(str(sig)) -216 self.transport._send_message(m) -217 self.transport._activate_outbound() -
218 -
219 - def _parse_kexdh_gex_reply(self, m): -
220 host_key = m.get_string() -221 self.f = m.get_mpint() -222 sig = m.get_string() -223 if (self.f < 1) or (self.f > self.p - 1): -224 raise SSHException('Server kex "f" is out of range') -225 K = pow(self.f, self.x, self.p) -226 # okay, build up the hash H of (V_C || V_S || I_C || I_S || K_S || min || n || max || p || g || e || f || K) -227 hm = Message() -228 hm.add(self.transport.local_version, self.transport.remote_version, -229 self.transport.local_kex_init, self.transport.remote_kex_init, -230 host_key) -231 if not self.old_style: -232 hm.add_int(self.min_bits) -233 hm.add_int(self.preferred_bits) -234 if not self.old_style: -235 hm.add_int(self.max_bits) -236 hm.add_mpint(self.p) -237 hm.add_mpint(self.g) -238 hm.add_mpint(self.e) -239 hm.add_mpint(self.f) -240 hm.add_mpint(K) -241 self.transport._set_K_H(K, SHA.new(str(hm)).digest()) -242 self.transport._verify_key(host_key, sig) -243 self.transport._activate_outbound() -
244 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.kex_gex.KexGex-class.html b/docs/paramiko.kex_gex.KexGex-class.html deleted file mode 100644 index ddfcb20..0000000 --- a/docs/paramiko.kex_gex.KexGex-class.html +++ /dev/null @@ -1,279 +0,0 @@ - - - - - paramiko.kex_gex.KexGex - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module kex_gex :: - Class KexGex - - - - - -
[frames] | no frames]
-
- -

Class KexGex

source code

-
-object --+
-         |
-        KexGex
-
- -
- - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - transport)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
-   - - - - - - -
start_kex(self, - _test_old_style=False) - source code - -
- -
-   - - - - - - -
parse_next(self, - ptype, - m) - source code - -
- -
-

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

-
- - - - - - - - - - - - - - - - - - -
- Class Variables
-   - - name = 'diffie-hellman-group-exchange-sha1' -
-   - - min_bits = 1024 -
-   - - max_bits = 8192 -
-   - - preferred_bits = 2048 -
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - transport) -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.kex_group1-module.html b/docs/paramiko.kex_group1-module.html deleted file mode 100644 index 05186e7..0000000 --- a/docs/paramiko.kex_group1-module.html +++ /dev/null @@ -1,589 +0,0 @@ - - - - - paramiko.kex_group1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module kex_group1 - - - - - -
[frames] | no frames]
-
- -

Module kex_group1

source code

-

Standard SSH key exchange ("kex" if you wanna sound cool). - Diffie-Hellman of 1024 bit key halves, using a known "p" prime - and "g" generator.

- - - - - - - - - - -
- Classes
-   - - KexGroup1 -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Variables
-   - - P = 1797693134862315907708391567937874531978602960487560117064... -
-   - - G = 2 -
-   - - AUTH_FAILED = 2 -
-   - - AUTH_PARTIALLY_SUCCESSFUL = 1 -
-   - - AUTH_SUCCESSFUL = 0 -
-   - - CONNECTION_FAILED_CODE = {1: 'Administratively prohibited', 2:... -
-   - - CRITICAL = 50 -
-   - - DEBUG = 10 -
-   - - DISCONNECT_AUTH_CANCELLED_BY_USER = 13 -
-   - - DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14 -
-   - - DISCONNECT_SERVICE_NOT_AVAILABLE = 7 -
-   - - ERROR = 40 -
-   - - INFO = 20 -
-   - - MSG_CHANNEL_CLOSE = 97 -
-   - - MSG_CHANNEL_DATA = 94 -
-   - - MSG_CHANNEL_EOF = 96 -
-   - - MSG_CHANNEL_EXTENDED_DATA = 95 -
-   - - MSG_CHANNEL_FAILURE = 100 -
-   - - MSG_CHANNEL_OPEN = 90 -
-   - - MSG_CHANNEL_OPEN_FAILURE = 92 -
-   - - MSG_CHANNEL_OPEN_SUCCESS = 91 -
-   - - MSG_CHANNEL_REQUEST = 98 -
-   - - MSG_CHANNEL_SUCCESS = 99 -
-   - - MSG_CHANNEL_WINDOW_ADJUST = 93 -
-   - - MSG_DEBUG = 4 -
-   - - MSG_DISCONNECT = 1 -
-   - - MSG_GLOBAL_REQUEST = 80 -
-   - - MSG_IGNORE = 2 -
-   - - MSG_KEXINIT = 20 -
-   - - MSG_NAMES = {1: 'disconnect', 2: 'ignore', 3: 'unimplemented',... -
-   - - MSG_NEWKEYS = 21 -
-   - - MSG_REQUEST_FAILURE = 82 -
-   - - MSG_REQUEST_SUCCESS = 81 -
-   - - MSG_SERVICE_ACCEPT = 6 -
-   - - MSG_SERVICE_REQUEST = 5 -
-   - - MSG_UNIMPLEMENTED = 3 -
-   - - MSG_USERAUTH_BANNER = 53 -
-   - - MSG_USERAUTH_FAILURE = 51 -
-   - - MSG_USERAUTH_INFO_REQUEST = 60 -
-   - - MSG_USERAUTH_INFO_RESPONSE = 61 -
-   - - MSG_USERAUTH_PK_OK = 60 -
-   - - MSG_USERAUTH_REQUEST = 50 -
-   - - MSG_USERAUTH_SUCCESS = 52 -
-   - - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED = 1 -
-   - - OPEN_FAILED_CONNECT_FAILED = 2 -
-   - - OPEN_FAILED_RESOURCE_SHORTAGE = 4 -
-   - - OPEN_FAILED_UNKNOWN_CHANNEL_TYPE = 3 -
-   - - OPEN_SUCCEEDED = 0 -
-   - - PY22 = False -
-   - - WARNING = 30 -
-   - - __package__ = 'paramiko' -
-   - - rng = Random.new() -
- - - - - - -
- Variables Details
- -
- -
-

P

- -
-
-
-
Value:
-
-1797693134862315907708391567937874531978602960487560117064444236841971\
-8021615851936894783379586492554150218056548598050364644054819923910005\
-0792877003355816639229553136239076508735759914822574862575007425302077\
-4477125895509579377784244424266173347276292993876687092056060502708108\
-42907692932019128194467627007
-
-
-
-
-
- -
- -
-

CONNECTION_FAILED_CODE

- -
-
-
-
Value:
-
-{1: 'Administratively prohibited',
- 2: 'Connect failed',
- 3: 'Unknown channel type',
- 4: 'Resource shortage'}
-
-
-
-
-
- -
- -
-

MSG_NAMES

- -
-
-
-
Value:
-
-{1: 'disconnect',
- 2: 'ignore',
- 3: 'unimplemented',
- 4: 'debug',
- 5: 'service-request',
- 6: 'service-accept',
- 20: 'kexinit',
- 21: 'newkeys',
-...
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.kex_group1-pysrc.html b/docs/paramiko.kex_group1-pysrc.html deleted file mode 100644 index 1a3f340..0000000 --- a/docs/paramiko.kex_group1-pysrc.html +++ /dev/null @@ -1,292 +0,0 @@ - - - - - paramiko.kex_group1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module kex_group1 - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.kex_group1

-
-  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  Standard SSH key exchange ("kex" if you wanna sound cool).  Diffie-Hellman of 
- 21  1024 bit key halves, using a known "p" prime and "g" generator. 
- 22  """ 
- 23   
- 24  from Crypto.Hash import SHA 
- 25   
- 26  from paramiko.common import * 
- 27  from paramiko import util 
- 28  from paramiko.message import Message 
- 29  from paramiko.ssh_exception import SSHException 
- 30   
- 31   
- 32  _MSG_KEXDH_INIT, _MSG_KEXDH_REPLY = range(30, 32) 
- 33   
- 34  # draft-ietf-secsh-transport-09.txt, page 17 
- 35  P = 0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFFL 
- 36  G = 2 
- 37   
- 38   
-
39 -class KexGroup1(object): -
40 - 41 name = 'diffie-hellman-group1-sha1' - 42 -
43 - def __init__(self, transport): -
44 self.transport = transport - 45 self.x = 0L - 46 self.e = 0L - 47 self.f = 0L -
48 -
49 - def start_kex(self): -
50 self._generate_x() - 51 if self.transport.server_mode: - 52 # compute f = g^x mod p, but don't send it yet - 53 self.f = pow(G, self.x, P) - 54 self.transport._expect_packet(_MSG_KEXDH_INIT) - 55 return - 56 # compute e = g^x mod p (where g=2), and send it - 57 self.e = pow(G, self.x, P) - 58 m = Message() - 59 m.add_byte(chr(_MSG_KEXDH_INIT)) - 60 m.add_mpint(self.e) - 61 self.transport._send_message(m) - 62 self.transport._expect_packet(_MSG_KEXDH_REPLY) -
63 -
64 - def parse_next(self, ptype, m): -
65 if self.transport.server_mode and (ptype == _MSG_KEXDH_INIT): - 66 return self._parse_kexdh_init(m) - 67 elif not self.transport.server_mode and (ptype == _MSG_KEXDH_REPLY): - 68 return self._parse_kexdh_reply(m) - 69 raise SSHException('KexGroup1 asked to handle packet type %d' % ptype) -
70 - 71 - 72 ### internals... - 73 - 74 -
75 - def _generate_x(self): -
76 # generate an "x" (1 < x < q), where q is (p-1)/2. - 77 # p is a 128-byte (1024-bit) number, where the first 64 bits are 1. - 78 # therefore q can be approximated as a 2^1023. we drop the subset of - 79 # potential x where the first 63 bits are 1, because some of those will be - 80 # larger than q (but this is a tiny tiny subset of potential x). - 81 while 1: - 82 x_bytes = self.transport.rng.read(128) - 83 x_bytes = chr(ord(x_bytes[0]) & 0x7f) + x_bytes[1:] - 84 if (x_bytes[:8] != '\x7F\xFF\xFF\xFF\xFF\xFF\xFF\xFF') and \ - 85 (x_bytes[:8] != '\x00\x00\x00\x00\x00\x00\x00\x00'): - 86 break - 87 self.x = util.inflate_long(x_bytes) -
88 -
89 - def _parse_kexdh_reply(self, m): -
90 # client mode - 91 host_key = m.get_string() - 92 self.f = m.get_mpint() - 93 if (self.f < 1) or (self.f > P - 1): - 94 raise SSHException('Server kex "f" is out of range') - 95 sig = m.get_string() - 96 K = pow(self.f, self.x, P) - 97 # okay, build up the hash H of (V_C || V_S || I_C || I_S || K_S || e || f || K) - 98 hm = Message() - 99 hm.add(self.transport.local_version, self.transport.remote_version, -100 self.transport.local_kex_init, self.transport.remote_kex_init) -101 hm.add_string(host_key) -102 hm.add_mpint(self.e) -103 hm.add_mpint(self.f) -104 hm.add_mpint(K) -105 self.transport._set_K_H(K, SHA.new(str(hm)).digest()) -106 self.transport._verify_key(host_key, sig) -107 self.transport._activate_outbound() -
108 -
109 - def _parse_kexdh_init(self, m): -
110 # server mode -111 self.e = m.get_mpint() -112 if (self.e < 1) or (self.e > P - 1): -113 raise SSHException('Client kex "e" is out of range') -114 K = pow(self.e, self.x, P) -115 key = str(self.transport.get_server_key()) -116 # okay, build up the hash H of (V_C || V_S || I_C || I_S || K_S || e || f || K) -117 hm = Message() -118 hm.add(self.transport.remote_version, self.transport.local_version, -119 self.transport.remote_kex_init, self.transport.local_kex_init) -120 hm.add_string(key) -121 hm.add_mpint(self.e) -122 hm.add_mpint(self.f) -123 hm.add_mpint(K) -124 H = SHA.new(str(hm)).digest() -125 self.transport._set_K_H(K, H) -126 # sign it -127 sig = self.transport.get_server_key().sign_ssh_data(self.transport.rng, H) -128 # send reply -129 m = Message() -130 m.add_byte(chr(_MSG_KEXDH_REPLY)) -131 m.add_string(key) -132 m.add_mpint(self.f) -133 m.add_string(str(sig)) -134 self.transport._send_message(m) -135 self.transport._activate_outbound() -
136 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.kex_group1.KexGroup1-class.html b/docs/paramiko.kex_group1.KexGroup1-class.html deleted file mode 100644 index b440267..0000000 --- a/docs/paramiko.kex_group1.KexGroup1-class.html +++ /dev/null @@ -1,257 +0,0 @@ - - - - - paramiko.kex_group1.KexGroup1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module kex_group1 :: - Class KexGroup1 - - - - - -
[frames] | no frames]
-
- -

Class KexGroup1

source code

-
-object --+
-         |
-        KexGroup1
-
- -
- - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - transport)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
-   - - - - - - -
start_kex(self) - source code - -
- -
-   - - - - - - -
parse_next(self, - ptype, - m) - source code - -
- -
-

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

-
- - - - - - - - - -
- Class Variables
-   - - name = 'diffie-hellman-group1-sha1' -
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - transport) -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.logging22-module.html b/docs/paramiko.logging22-module.html deleted file mode 100644 index 9a4ed69..0000000 --- a/docs/paramiko.logging22-module.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - - paramiko.logging22 - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module logging22 - - - - - -
[frames] | no frames]
-
- -

Module logging22

source code

-

Stub out logging on python < 2.3.

- - - - - - - - - - - - - - - - -
- Classes
-   - - logger -
-   - - StreamHandler -
-   - - Formatter -
- - - - - - - - - -
- Functions
-   - - - - - - -
getLogger(name) - source code - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - -
- Variables
-   - - DEBUG = 10 -
-   - - INFO = 20 -
-   - - WARNING = 30 -
-   - - ERROR = 40 -
-   - - CRITICAL = 50 -
-   - - __package__ = None -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.logging22-pysrc.html b/docs/paramiko.logging22-pysrc.html deleted file mode 100644 index b4b8079..0000000 --- a/docs/paramiko.logging22-pysrc.html +++ /dev/null @@ -1,302 +0,0 @@ - - - - - paramiko.logging22 - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module logging22 - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.logging22

-
- 1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
- 2  # 
- 3  # This file is part of paramiko. 
- 4  # 
- 5  # Paramiko is free software; you can redistribute it and/or modify it under the 
- 6  # terms of the GNU Lesser General Public License as published by the Free 
- 7  # Software Foundation; either version 2.1 of the License, or (at your option) 
- 8  # any later version. 
- 9  # 
-10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
-11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
-12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
-13  # details. 
-14  # 
-15  # You should have received a copy of the GNU Lesser General Public License 
-16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
-17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
-18   
-19  """ 
-20  Stub out logging on python < 2.3. 
-21  """ 
-22   
-23   
-24  DEBUG = 10 
-25  INFO = 20 
-26  WARNING = 30 
-27  ERROR = 40 
-28  CRITICAL = 50 
-29   
-30   
-
31 -def getLogger(name): -
32 return _logger -
33 -34 -
35 -class logger (object): -
36 - def __init__(self): -
37 self.handlers = [ ] -38 self.level = ERROR -
39 -
40 - def setLevel(self, level): -
41 self.level = level -
42 -
43 - def addHandler(self, h): -
44 self.handlers.append(h) -
45 -
46 - def addFilter(self, filter): -
47 pass -
48 -
49 - def log(self, level, text): -
50 if level >= self.level: -51 for h in self.handlers: -52 h.f.write(text + '\n') -53 h.f.flush() -
54 -
55 -class StreamHandler (object): -
56 - def __init__(self, f): -
57 self.f = f -
58 -
59 - def setFormatter(self, f): -
60 pass -
61 -
62 -class Formatter (object): -
63 - def __init__(self, x, y): -
64 pass -
65 -66 _logger = logger() -67 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.logging22.Formatter-class.html b/docs/paramiko.logging22.Formatter-class.html deleted file mode 100644 index 4fcf2cc..0000000 --- a/docs/paramiko.logging22.Formatter-class.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - - paramiko.logging22.Formatter - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module logging22 :: - Class Formatter - - - - - -
[frames] | no frames]
-
- -

Class Formatter

source code

-
-object --+
-         |
-        Formatter
-
- -
- - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - x, - y)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - x, - y) -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.logging22.StreamHandler-class.html b/docs/paramiko.logging22.StreamHandler-class.html deleted file mode 100644 index ec646d7..0000000 --- a/docs/paramiko.logging22.StreamHandler-class.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - - paramiko.logging22.StreamHandler - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module logging22 :: - Class StreamHandler - - - - - -
[frames] | no frames]
-
- -

Class StreamHandler

source code

-
-object --+
-         |
-        StreamHandler
-
- -
- - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - f)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
-   - - - - - - -
setFormatter(self, - f) - source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - f) -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.logging22.logger-class.html b/docs/paramiko.logging22.logger-class.html deleted file mode 100644 index 420aeee..0000000 --- a/docs/paramiko.logging22.logger-class.html +++ /dev/null @@ -1,274 +0,0 @@ - - - - - paramiko.logging22.logger - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module logging22 :: - Class logger - - - - - -
[frames] | no frames]
-
- -

Class logger

source code

-
-object --+
-         |
-        logger
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
-   - - - - - - -
setLevel(self, - level) - source code - -
- -
-   - - - - - - -
addHandler(self, - h) - source code - -
- -
-   - - - - - - -
addFilter(self, - filter) - source code - -
- -
-   - - - - - - -
log(self, - level, - text) - source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self) -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.message-module.html b/docs/paramiko.message-module.html deleted file mode 100644 index 9f7103e..0000000 --- a/docs/paramiko.message-module.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - paramiko.message - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module message - - - - - -
[frames] | no frames]
-
- -

Module message

source code

-

Implementation of an SSH2 "message".

- - - - - - - - - - -
- Variables
-   - - __package__ = 'paramiko' -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.message-pysrc.html b/docs/paramiko.message-pysrc.html deleted file mode 100644 index 723920e..0000000 --- a/docs/paramiko.message-pysrc.html +++ /dev/null @@ -1,423 +0,0 @@ - - - - - paramiko.message - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module message - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.message

-
-  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  Implementation of an SSH2 "message". 
- 21  """ 
- 22   
- 23  import struct 
- 24  import cStringIO 
- 25   
- 26  from paramiko import util 
- 27   
- 28   
-
29 -class Message (object): -
30 """ - 31 An SSH2 I{Message} is a stream of bytes that encodes some combination of - 32 strings, integers, bools, and infinite-precision integers (known in python - 33 as I{long}s). This class builds or breaks down such a byte stream. - 34 - 35 Normally you don't need to deal with anything this low-level, but it's - 36 exposed for people implementing custom extensions, or features that - 37 paramiko doesn't support yet. - 38 """ - 39 -
40 - def __init__(self, content=None): -
41 """ - 42 Create a new SSH2 Message. - 43 - 44 @param content: the byte stream to use as the Message content (passed - 45 in only when decomposing a Message). - 46 @type content: string - 47 """ - 48 if content != None: - 49 self.packet = cStringIO.StringIO(content) - 50 else: - 51 self.packet = cStringIO.StringIO() -
52 -
53 - def __str__(self): -
54 """ - 55 Return the byte stream content of this Message, as a string. - 56 - 57 @return: the contents of this Message. - 58 @rtype: string - 59 """ - 60 return self.packet.getvalue() -
61 -
62 - def __repr__(self): -
63 """ - 64 Returns a string representation of this object, for debugging. - 65 - 66 @rtype: string - 67 """ - 68 return 'paramiko.Message(' + repr(self.packet.getvalue()) + ')' -
69 -
70 - def rewind(self): -
71 """ - 72 Rewind the message to the beginning as if no items had been parsed - 73 out of it yet. - 74 """ - 75 self.packet.seek(0) -
76 -
77 - def get_remainder(self): -
78 """ - 79 Return the bytes of this Message that haven't already been parsed and - 80 returned. - 81 - 82 @return: a string of the bytes not parsed yet. - 83 @rtype: string - 84 """ - 85 position = self.packet.tell() - 86 remainder = self.packet.read() - 87 self.packet.seek(position) - 88 return remainder -
89 -
90 - def get_so_far(self): -
91 """ - 92 Returns the bytes of this Message that have been parsed and returned. - 93 The string passed into a Message's constructor can be regenerated by - 94 concatenating C{get_so_far} and L{get_remainder}. - 95 - 96 @return: a string of the bytes parsed so far. - 97 @rtype: string - 98 """ - 99 position = self.packet.tell() -100 self.rewind() -101 return self.packet.read(position) -
102 -
103 - def get_bytes(self, n): -
104 """ -105 Return the next C{n} bytes of the Message, without decomposing into -106 an int, string, etc. Just the raw bytes are returned. -107 -108 @return: a string of the next C{n} bytes of the Message, or a string -109 of C{n} zero bytes, if there aren't C{n} bytes remaining. -110 @rtype: string -111 """ -112 b = self.packet.read(n) -113 if len(b) < n: -114 return b + '\x00' * (n - len(b)) -115 return b -
116 -
117 - def get_byte(self): -
118 """ -119 Return the next byte of the Message, without decomposing it. This -120 is equivalent to L{get_bytes(1)<get_bytes>}. -121 -122 @return: the next byte of the Message, or C{'\000'} if there aren't -123 any bytes remaining. -124 @rtype: string -125 """ -126 return self.get_bytes(1) -
127 -
128 - def get_boolean(self): -
129 """ -130 Fetch a boolean from the stream. -131 -132 @return: C{True} or C{False} (from the Message). -133 @rtype: bool -134 """ -135 b = self.get_bytes(1) -136 return b != '\x00' -
137 -
138 - def get_int(self): -
139 """ -140 Fetch an int from the stream. -141 -142 @return: a 32-bit unsigned integer. -143 @rtype: int -144 """ -145 return struct.unpack('>I', self.get_bytes(4))[0] -
146 -
147 - def get_int64(self): -
148 """ -149 Fetch a 64-bit int from the stream. -150 -151 @return: a 64-bit unsigned integer. -152 @rtype: long -153 """ -154 return struct.unpack('>Q', self.get_bytes(8))[0] -
155 -
156 - def get_mpint(self): -
157 """ -158 Fetch a long int (mpint) from the stream. -159 -160 @return: an arbitrary-length integer. -161 @rtype: long -162 """ -163 return util.inflate_long(self.get_string()) -
164 -
165 - def get_string(self): -
166 """ -167 Fetch a string from the stream. This could be a byte string and may -168 contain unprintable characters. (It's not unheard of for a string to -169 contain another byte-stream Message.) -170 -171 @return: a string. -172 @rtype: string -173 """ -174 return self.get_bytes(self.get_int()) -
175 -
176 - def get_list(self): -
177 """ -178 Fetch a list of strings from the stream. These are trivially encoded -179 as comma-separated values in a string. -180 -181 @return: a list of strings. -182 @rtype: list of strings -183 """ -184 return self.get_string().split(',') -
185 -
186 - def add_bytes(self, b): -
187 """ -188 Write bytes to the stream, without any formatting. -189 -190 @param b: bytes to add -191 @type b: str -192 """ -193 self.packet.write(b) -194 return self -
195 -
196 - def add_byte(self, b): -
197 """ -198 Write a single byte to the stream, without any formatting. -199 -200 @param b: byte to add -201 @type b: str -202 """ -203 self.packet.write(b) -204 return self -
205 -
206 - def add_boolean(self, b): -
207 """ -208 Add a boolean value to the stream. -209 -210 @param b: boolean value to add -211 @type b: bool -212 """ -213 if b: -214 self.add_byte('\x01') -215 else: -216 self.add_byte('\x00') -217 return self -
218 -
219 - def add_int(self, n): -
220 """ -221 Add an integer to the stream. -222 -223 @param n: integer to add -224 @type n: int -225 """ -226 self.packet.write(struct.pack('>I', n)) -227 return self -
228 -
229 - def add_int64(self, n): -
230 """ -231 Add a 64-bit int to the stream. -232 -233 @param n: long int to add -234 @type n: long -235 """ -236 self.packet.write(struct.pack('>Q', n)) -237 return self -
238 -
239 - def add_mpint(self, z): -
240 """ -241 Add a long int to the stream, encoded as an infinite-precision -242 integer. This method only works on positive numbers. -243 -244 @param z: long int to add -245 @type z: long -246 """ -247 self.add_string(util.deflate_long(z)) -248 return self -
249 -
250 - def add_string(self, s): -
251 """ -252 Add a string to the stream. -253 -254 @param s: string to add -255 @type s: str -256 """ -257 self.add_int(len(s)) -258 self.packet.write(s) -259 return self -
260 -
261 - def add_list(self, l): -
262 """ -263 Add a list of strings to the stream. They are encoded identically to -264 a single string of values separated by commas. (Yes, really, that's -265 how SSH2 does it.) -266 -267 @param l: list of strings to add -268 @type l: list(str) -269 """ -270 self.add_string(','.join(l)) -271 return self -
272 -
273 - def _add(self, i): -
274 if type(i) is str: -275 return self.add_string(i) -276 elif type(i) is int: -277 return self.add_int(i) -278 elif type(i) is long: -279 if i > 0xffffffffL: -280 return self.add_mpint(i) -281 else: -282 return self.add_int(i) -283 elif type(i) is bool: -284 return self.add_boolean(i) -285 elif type(i) is list: -286 return self.add_list(i) -287 else: -288 raise Exception('Unknown type') -
289 -
290 - def add(self, *seq): -
291 """ -292 Add a sequence of items to the stream. The values are encoded based -293 on their type: str, int, bool, list, or long. -294 -295 @param seq: the sequence of items -296 @type seq: sequence -297 -298 @bug: longs are encoded non-deterministically. Don't use this method. -299 """ -300 for item in seq: -301 self._add(item) -
302 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.packet-module.html b/docs/paramiko.packet-module.html deleted file mode 100644 index ebe8825..0000000 --- a/docs/paramiko.packet-module.html +++ /dev/null @@ -1,581 +0,0 @@ - - - - - paramiko.packet - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module packet - - - - - -
[frames] | no frames]
-
- -

Module packet

source code

-

Packetizer.

- - - - - - - - - - -
- Classes
-   - - NeedRekeyException -
- - - - - - - - - -
- Functions
-   - - - - - - -
compute_hmac(key, - message, - digest_class) - source code - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Variables
-   - - got_r_hmac = False -
-   - - AUTH_FAILED = 2 -
-   - - AUTH_PARTIALLY_SUCCESSFUL = 1 -
-   - - AUTH_SUCCESSFUL = 0 -
-   - - CONNECTION_FAILED_CODE = {1: 'Administratively prohibited', 2:... -
-   - - CRITICAL = 50 -
-   - - DEBUG = 10 -
-   - - DISCONNECT_AUTH_CANCELLED_BY_USER = 13 -
-   - - DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14 -
-   - - DISCONNECT_SERVICE_NOT_AVAILABLE = 7 -
-   - - ERROR = 40 -
-   - - INFO = 20 -
-   - - MSG_CHANNEL_CLOSE = 97 -
-   - - MSG_CHANNEL_DATA = 94 -
-   - - MSG_CHANNEL_EOF = 96 -
-   - - MSG_CHANNEL_EXTENDED_DATA = 95 -
-   - - MSG_CHANNEL_FAILURE = 100 -
-   - - MSG_CHANNEL_OPEN = 90 -
-   - - MSG_CHANNEL_OPEN_FAILURE = 92 -
-   - - MSG_CHANNEL_OPEN_SUCCESS = 91 -
-   - - MSG_CHANNEL_REQUEST = 98 -
-   - - MSG_CHANNEL_SUCCESS = 99 -
-   - - MSG_CHANNEL_WINDOW_ADJUST = 93 -
-   - - MSG_DEBUG = 4 -
-   - - MSG_DISCONNECT = 1 -
-   - - MSG_GLOBAL_REQUEST = 80 -
-   - - MSG_IGNORE = 2 -
-   - - MSG_KEXINIT = 20 -
-   - - MSG_NAMES = {1: 'disconnect', 2: 'ignore', 3: 'unimplemented',... -
-   - - MSG_NEWKEYS = 21 -
-   - - MSG_REQUEST_FAILURE = 82 -
-   - - MSG_REQUEST_SUCCESS = 81 -
-   - - MSG_SERVICE_ACCEPT = 6 -
-   - - MSG_SERVICE_REQUEST = 5 -
-   - - MSG_UNIMPLEMENTED = 3 -
-   - - MSG_USERAUTH_BANNER = 53 -
-   - - MSG_USERAUTH_FAILURE = 51 -
-   - - MSG_USERAUTH_INFO_REQUEST = 60 -
-   - - MSG_USERAUTH_INFO_RESPONSE = 61 -
-   - - MSG_USERAUTH_PK_OK = 60 -
-   - - MSG_USERAUTH_REQUEST = 50 -
-   - - MSG_USERAUTH_SUCCESS = 52 -
-   - - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED = 1 -
-   - - OPEN_FAILED_CONNECT_FAILED = 2 -
-   - - OPEN_FAILED_RESOURCE_SHORTAGE = 4 -
-   - - OPEN_FAILED_UNKNOWN_CHANNEL_TYPE = 3 -
-   - - OPEN_SUCCEEDED = 0 -
-   - - PY22 = False -
-   - - WARNING = 30 -
-   - - __package__ = 'paramiko' -
-   - - rng = Random.new() -
- - - - - - -
- Variables Details
- -
- -
-

CONNECTION_FAILED_CODE

- -
-
-
-
Value:
-
-{1: 'Administratively prohibited',
- 2: 'Connect failed',
- 3: 'Unknown channel type',
- 4: 'Resource shortage'}
-
-
-
-
-
- -
- -
-

MSG_NAMES

- -
-
-
-
Value:
-
-{1: 'disconnect',
- 2: 'ignore',
- 3: 'unimplemented',
- 4: 'debug',
- 5: 'service-request',
- 6: 'service-accept',
- 20: 'kexinit',
- 21: 'newkeys',
-...
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.packet-pysrc.html b/docs/paramiko.packet-pysrc.html deleted file mode 100644 index 8341e2c..0000000 --- a/docs/paramiko.packet-pysrc.html +++ /dev/null @@ -1,920 +0,0 @@ - - - - - paramiko.packet - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module packet - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.packet

-
-  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  Packetizer. 
- 21  """ 
- 22   
- 23  import errno 
- 24  import select 
- 25  import socket 
- 26  import struct 
- 27  import threading 
- 28  import time 
- 29   
- 30  from paramiko.common import * 
- 31  from paramiko import util 
- 32  from paramiko.ssh_exception import SSHException 
- 33  from paramiko.message import Message 
- 34   
- 35   
- 36  got_r_hmac = False 
- 37  try: 
- 38      import r_hmac 
- 39      got_r_hmac = True 
- 40  except ImportError: 
- 41      pass 
-
42 -def compute_hmac(key, message, digest_class): -
43 if got_r_hmac: - 44 return r_hmac.HMAC(key, message, digest_class).digest() - 45 from Crypto.Hash import HMAC - 46 return HMAC.HMAC(key, message, digest_class).digest() -
47 - 48 -
49 -class NeedRekeyException (Exception): -
50 pass -
51 - 52 -
53 -class Packetizer (object): -
54 """ - 55 Implementation of the base SSH packet protocol. - 56 """ - 57 - 58 # READ the secsh RFC's before raising these values. if anything, - 59 # they should probably be lower. - 60 REKEY_PACKETS = pow(2, 30) - 61 REKEY_BYTES = pow(2, 30) - 62 -
63 - def __init__(self, socket): -
64 self.__socket = socket - 65 self.__logger = None - 66 self.__closed = False - 67 self.__dump_packets = False - 68 self.__need_rekey = False - 69 self.__init_count = 0 - 70 self.__remainder = '' - 71 - 72 # used for noticing when to re-key: - 73 self.__sent_bytes = 0 - 74 self.__sent_packets = 0 - 75 self.__received_bytes = 0 - 76 self.__received_packets = 0 - 77 self.__received_packets_overflow = 0 - 78 - 79 # current inbound/outbound ciphering: - 80 self.__block_size_out = 8 - 81 self.__block_size_in = 8 - 82 self.__mac_size_out = 0 - 83 self.__mac_size_in = 0 - 84 self.__block_engine_out = None - 85 self.__block_engine_in = None - 86 self.__mac_engine_out = None - 87 self.__mac_engine_in = None - 88 self.__mac_key_out = '' - 89 self.__mac_key_in = '' - 90 self.__compress_engine_out = None - 91 self.__compress_engine_in = None - 92 self.__sequence_number_out = 0L - 93 self.__sequence_number_in = 0L - 94 - 95 # lock around outbound writes (packet computation) - 96 self.__write_lock = threading.RLock() - 97 - 98 # keepalives: - 99 self.__keepalive_interval = 0 -100 self.__keepalive_last = time.time() -101 self.__keepalive_callback = None -
102 -
103 - def set_log(self, log): -
104 """ -105 Set the python log object to use for logging. -106 """ -107 self.__logger = log -
108 -
109 - def set_outbound_cipher(self, block_engine, block_size, mac_engine, mac_size, mac_key): -
110 """ -111 Switch outbound data cipher. -112 """ -113 self.__block_engine_out = block_engine -114 self.__block_size_out = block_size -115 self.__mac_engine_out = mac_engine -116 self.__mac_size_out = mac_size -117 self.__mac_key_out = mac_key -118 self.__sent_bytes = 0 -119 self.__sent_packets = 0 -120 # wait until the reset happens in both directions before clearing rekey flag -121 self.__init_count |= 1 -122 if self.__init_count == 3: -123 self.__init_count = 0 -124 self.__need_rekey = False -
125 -
126 - def set_inbound_cipher(self, block_engine, block_size, mac_engine, mac_size, mac_key): -
127 """ -128 Switch inbound data cipher. -129 """ -130 self.__block_engine_in = block_engine -131 self.__block_size_in = block_size -132 self.__mac_engine_in = mac_engine -133 self.__mac_size_in = mac_size -134 self.__mac_key_in = mac_key -135 self.__received_bytes = 0 -136 self.__received_packets = 0 -137 self.__received_packets_overflow = 0 -138 # wait until the reset happens in both directions before clearing rekey flag -139 self.__init_count |= 2 -140 if self.__init_count == 3: -141 self.__init_count = 0 -142 self.__need_rekey = False -
143 -
144 - def set_outbound_compressor(self, compressor): -
145 self.__compress_engine_out = compressor -
146 -
147 - def set_inbound_compressor(self, compressor): -
148 self.__compress_engine_in = compressor -
149 -
150 - def close(self): -
151 self.__closed = True -152 self.__socket.close() -
153 -
154 - def set_hexdump(self, hexdump): -
155 self.__dump_packets = hexdump -
156 -
157 - def get_hexdump(self): -
158 return self.__dump_packets -
159 -
160 - def get_mac_size_in(self): -
161 return self.__mac_size_in -
162 -
163 - def get_mac_size_out(self): -
164 return self.__mac_size_out -
165 -
166 - def need_rekey(self): -
167 """ -168 Returns C{True} if a new set of keys needs to be negotiated. This -169 will be triggered during a packet read or write, so it should be -170 checked after every read or write, or at least after every few. -171 -172 @return: C{True} if a new set of keys needs to be negotiated -173 """ -174 return self.__need_rekey -
175 -
176 - def set_keepalive(self, interval, callback): -
177 """ -178 Turn on/off the callback keepalive. If C{interval} seconds pass with -179 no data read from or written to the socket, the callback will be -180 executed and the timer will be reset. -181 """ -182 self.__keepalive_interval = interval -183 self.__keepalive_callback = callback -184 self.__keepalive_last = time.time() -
185 -
186 - def read_all(self, n, check_rekey=False): -
187 """ -188 Read as close to N bytes as possible, blocking as long as necessary. -189 -190 @param n: number of bytes to read -191 @type n: int -192 @return: the data read -193 @rtype: str -194 @raise EOFError: if the socket was closed before all the bytes could -195 be read -196 """ -197 out = '' -198 # handle over-reading from reading the banner line -199 if len(self.__remainder) > 0: -200 out = self.__remainder[:n] -201 self.__remainder = self.__remainder[n:] -202 n -= len(out) -203 if PY22: -204 return self._py22_read_all(n, out) -205 while n > 0: -206 got_timeout = False -207 try: -208 x = self.__socket.recv(n) -209 if len(x) == 0: -210 raise EOFError() -211 out += x -212 n -= len(x) -213 except socket.timeout: -214 got_timeout = True -215 except socket.error, e: -216 # on Linux, sometimes instead of socket.timeout, we get -217 # EAGAIN. this is a bug in recent (> 2.6.9) kernels but -218 # we need to work around it. -219 if (type(e.args) is tuple) and (len(e.args) > 0) and (e.args[0] == errno.EAGAIN): -220 got_timeout = True -221 elif (type(e.args) is tuple) and (len(e.args) > 0) and (e.args[0] == errno.EINTR): -222 # syscall interrupted; try again -223 pass -224 elif self.__closed: -225 raise EOFError() -226 else: -227 raise -228 if got_timeout: -229 if self.__closed: -230 raise EOFError() -231 if check_rekey and (len(out) == 0) and self.__need_rekey: -232 raise NeedRekeyException() -233 self._check_keepalive() -234 return out -
235 -
236 - def write_all(self, out): -
237 self.__keepalive_last = time.time() -238 while len(out) > 0: -239 got_timeout = False -240 try: -241 n = self.__socket.send(out) -242 except socket.timeout: -243 got_timeout = True -244 except socket.error, e: -245 if (type(e.args) is tuple) and (len(e.args) > 0) and (e.args[0] == errno.EAGAIN): -246 got_timeout = True -247 elif (type(e.args) is tuple) and (len(e.args) > 0) and (e.args[0] == errno.EINTR): -248 # syscall interrupted; try again -249 pass -250 else: -251 n = -1 -252 except Exception: -253 # could be: (32, 'Broken pipe') -254 n = -1 -255 if got_timeout: -256 n = 0 -257 if self.__closed: -258 n = -1 -259 if n < 0: -260 raise EOFError() -261 if n == len(out): -262 break -263 out = out[n:] -264 return -
265 -
266 - def readline(self, timeout): -
267 """ -268 Read a line from the socket. We assume no data is pending after the -269 line, so it's okay to attempt large reads. -270 """ -271 buf = self.__remainder -272 while not '\n' in buf: -273 buf += self._read_timeout(timeout) -274 n = buf.index('\n') -275 self.__remainder = buf[n+1:] -276 buf = buf[:n] -277 if (len(buf) > 0) and (buf[-1] == '\r'): -278 buf = buf[:-1] -279 return buf -
280 -
281 - def send_message(self, data): -
282 """ -283 Write a block of data using the current cipher, as an SSH block. -284 """ -285 # encrypt this sucka -286 data = str(data) -287 cmd = ord(data[0]) -288 if cmd in MSG_NAMES: -289 cmd_name = MSG_NAMES[cmd] -290 else: -291 cmd_name = '$%x' % cmd -292 orig_len = len(data) -293 self.__write_lock.acquire() -294 try: -295 if self.__compress_engine_out is not None: -296 data = self.__compress_engine_out(data) -297 packet = self._build_packet(data) -298 if self.__dump_packets: -299 self._log(DEBUG, 'Write packet <%s>, length %d' % (cmd_name, orig_len)) -300 self._log(DEBUG, util.format_binary(packet, 'OUT: ')) -301 if self.__block_engine_out != None: -302 out = self.__block_engine_out.encrypt(packet) -303 else: -304 out = packet -305 # + mac -306 if self.__block_engine_out != None: -307 payload = struct.pack('>I', self.__sequence_number_out) + packet -308 out += compute_hmac(self.__mac_key_out, payload, self.__mac_engine_out)[:self.__mac_size_out] -309 self.__sequence_number_out = (self.__sequence_number_out + 1) & 0xffffffffL -310 self.write_all(out) -311 -312 self.__sent_bytes += len(out) -313 self.__sent_packets += 1 -314 if ((self.__sent_packets >= self.REKEY_PACKETS) or (self.__sent_bytes >= self.REKEY_BYTES)) \ -315 and not self.__need_rekey: -316 # only ask once for rekeying -317 self._log(DEBUG, 'Rekeying (hit %d packets, %d bytes sent)' % -318 (self.__sent_packets, self.__sent_bytes)) -319 self.__received_packets_overflow = 0 -320 self._trigger_rekey() -321 finally: -322 self.__write_lock.release() -
323 -
324 - def read_message(self): -
325 """ -326 Only one thread should ever be in this function (no other locking is -327 done). -328 -329 @raise SSHException: if the packet is mangled -330 @raise NeedRekeyException: if the transport should rekey -331 """ -332 header = self.read_all(self.__block_size_in, check_rekey=True) -333 if self.__block_engine_in != None: -334 header = self.__block_engine_in.decrypt(header) -335 if self.__dump_packets: -336 self._log(DEBUG, util.format_binary(header, 'IN: ')); -337 packet_size = struct.unpack('>I', header[:4])[0] -338 # leftover contains decrypted bytes from the first block (after the length field) -339 leftover = header[4:] -340 if (packet_size - len(leftover)) % self.__block_size_in != 0: -341 raise SSHException('Invalid packet blocking') -342 buf = self.read_all(packet_size + self.__mac_size_in - len(leftover)) -343 packet = buf[:packet_size - len(leftover)] -344 post_packet = buf[packet_size - len(leftover):] -345 if self.__block_engine_in != None: -346 packet = self.__block_engine_in.decrypt(packet) -347 if self.__dump_packets: -348 self._log(DEBUG, util.format_binary(packet, 'IN: ')); -349 packet = leftover + packet -350 -351 if self.__mac_size_in > 0: -352 mac = post_packet[:self.__mac_size_in] -353 mac_payload = struct.pack('>II', self.__sequence_number_in, packet_size) + packet -354 my_mac = compute_hmac(self.__mac_key_in, mac_payload, self.__mac_engine_in)[:self.__mac_size_in] -355 if my_mac != mac: -356 raise SSHException('Mismatched MAC') -357 padding = ord(packet[0]) -358 payload = packet[1:packet_size - padding] -359 -360 if self.__dump_packets: -361 self._log(DEBUG, 'Got payload (%d bytes, %d padding)' % (packet_size, padding)) -362 -363 if self.__compress_engine_in is not None: -364 payload = self.__compress_engine_in(payload) -365 -366 msg = Message(payload[1:]) -367 msg.seqno = self.__sequence_number_in -368 self.__sequence_number_in = (self.__sequence_number_in + 1) & 0xffffffffL -369 -370 # check for rekey -371 self.__received_bytes += packet_size + self.__mac_size_in + 4 -372 self.__received_packets += 1 -373 if self.__need_rekey: -374 # we've asked to rekey -- give them 20 packets to comply before -375 # dropping the connection -376 self.__received_packets_overflow += 1 -377 if self.__received_packets_overflow >= 20: -378 raise SSHException('Remote transport is ignoring rekey requests') -379 elif (self.__received_packets >= self.REKEY_PACKETS) or \ -380 (self.__received_bytes >= self.REKEY_BYTES): -381 # only ask once for rekeying -382 self._log(DEBUG, 'Rekeying (hit %d packets, %d bytes received)' % -383 (self.__received_packets, self.__received_bytes)) -384 self.__received_packets_overflow = 0 -385 self._trigger_rekey() -386 -387 cmd = ord(payload[0]) -388 if cmd in MSG_NAMES: -389 cmd_name = MSG_NAMES[cmd] -390 else: -391 cmd_name = '$%x' % cmd -392 if self.__dump_packets: -393 self._log(DEBUG, 'Read packet <%s>, length %d' % (cmd_name, len(payload))) -394 return cmd, msg -
395 -396 -397 ########## protected -398 -399 -
400 - def _log(self, level, msg): -
401 if self.__logger is None: -402 return -403 if issubclass(type(msg), list): -404 for m in msg: -405 self.__logger.log(level, m) -406 else: -407 self.__logger.log(level, msg) -
408 -
409 - def _check_keepalive(self): -
410 if (not self.__keepalive_interval) or (not self.__block_engine_out) or \ -411 self.__need_rekey: -412 # wait till we're encrypting, and not in the middle of rekeying -413 return -414 now = time.time() -415 if now > self.__keepalive_last + self.__keepalive_interval: -416 self.__keepalive_callback() -417 self.__keepalive_last = now -
418 -
419 - def _py22_read_all(self, n, out): -
420 while n > 0: -421 r, w, e = select.select([self.__socket], [], [], 0.1) -422 if self.__socket not in r: -423 if self.__closed: -424 raise EOFError() -425 self._check_keepalive() -426 else: -427 x = self.__socket.recv(n) -428 if len(x) == 0: -429 raise EOFError() -430 out += x -431 n -= len(x) -432 return out -
433 -
434 - def _py22_read_timeout(self, timeout): -
435 start = time.time() -436 while True: -437 r, w, e = select.select([self.__socket], [], [], 0.1) -438 if self.__socket in r: -439 x = self.__socket.recv(1) -440 if len(x) == 0: -441 raise EOFError() -442 break -443 if self.__closed: -444 raise EOFError() -445 now = time.time() -446 if now - start >= timeout: -447 raise socket.timeout() -448 return x -
449 -
450 - def _read_timeout(self, timeout): -
451 if PY22: -452 return self._py22_read_timeout(timeout) -453 start = time.time() -454 while True: -455 try: -456 x = self.__socket.recv(128) -457 if len(x) == 0: -458 raise EOFError() -459 break -460 except socket.timeout: -461 pass -462 if self.__closed: -463 raise EOFError() -464 now = time.time() -465 if now - start >= timeout: -466 raise socket.timeout() -467 return x -
468 -
469 - def _build_packet(self, payload): -
470 # pad up at least 4 bytes, to nearest block-size (usually 8) -471 bsize = self.__block_size_out -472 padding = 3 + bsize - ((len(payload) + 8) % bsize) -473 packet = struct.pack('>IB', len(payload) + padding + 1, padding) -474 packet += payload -475 if self.__block_engine_out is not None: -476 packet += rng.read(padding) -477 else: -478 # cute trick i caught openssh doing: if we're not encrypting, -479 # don't waste random bytes for the padding -480 packet += (chr(0) * padding) -481 return packet -
482 -
483 - def _trigger_rekey(self): -
484 # outside code should check for this flag -485 self.__need_rekey = True -
486 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.packet.NeedRekeyException-class.html b/docs/paramiko.packet.NeedRekeyException-class.html deleted file mode 100644 index 7387922..0000000 --- a/docs/paramiko.packet.NeedRekeyException-class.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - paramiko.packet.NeedRekeyException - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module packet :: - Class NeedRekeyException - - - - - -
[frames] | no frames]
-
- -

Class NeedRekeyException

source code

-
-              object --+        
-                       |        
-exceptions.BaseException --+    
-                           |    
-        exceptions.Exception --+
-                               |
-                              NeedRekeyException
-
- -
- - - - - - - - - -
- Instance Methods
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- Properties
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.pipe-module.html b/docs/paramiko.pipe-module.html deleted file mode 100644 index eb41032..0000000 --- a/docs/paramiko.pipe-module.html +++ /dev/null @@ -1,231 +0,0 @@ - - - - - paramiko.pipe - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module pipe - - - - - -
[frames] | no frames]
-
- -

Module pipe

source code

-

Abstraction of a one-way pipe where the read end can be used in - select(). Normally this is trivial, but Windows makes it nearly - impossible.

-

The pipe acts like an Event, which can be set or cleared. When set, - the pipe will trigger as readable in select().

- - - - - - - - - - - - - - - - -
- Classes
-   - - PosixPipe -
-   - - WindowsPipe
- On Windows, only an OS-level "WinSock" may be used in - select(), but reads and writes must be to the actual socket object. -
-   - - OrPipe -
- - - - - - - - - - - - -
- Functions
-   - - - - - - -
make_pipe() - source code - -
- -
-   - - - - - - -
make_or_pipe(pipe)
- wraps a pipe into two pipe-like objects which are "or"d - together to affect the real pipe.
- source code - -
- -
- - - - - - - - - -
- Variables
-   - - __package__ = 'paramiko' -
- - - - - - -
- Function Details
- -
- -
- - -
-

make_or_pipe(pipe) -

-
source code  -
- -

wraps a pipe into two pipe-like objects which are "or"d - together to affect the real pipe. if either returned pipe is set, the - wrapped pipe is set. when both are cleared, the wrapped pipe is - cleared.

-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.pipe-pysrc.html b/docs/paramiko.pipe-pysrc.html deleted file mode 100644 index c556536..0000000 --- a/docs/paramiko.pipe-pysrc.html +++ /dev/null @@ -1,327 +0,0 @@ - - - - - paramiko.pipe - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module pipe - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.pipe

-
-  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  Abstraction of a one-way pipe where the read end can be used in select(). 
- 21  Normally this is trivial, but Windows makes it nearly impossible. 
- 22   
- 23  The pipe acts like an Event, which can be set or cleared. When set, the pipe 
- 24  will trigger as readable in select(). 
- 25  """ 
- 26   
- 27  import sys 
- 28  import os 
- 29  import socket 
- 30   
- 31   
-
32 -def make_pipe (): -
33 if sys.platform[:3] != 'win': - 34 p = PosixPipe() - 35 else: - 36 p = WindowsPipe() - 37 return p -
38 - 39 -
40 -class PosixPipe (object): -
41 - def __init__ (self): -
42 self._rfd, self._wfd = os.pipe() - 43 self._set = False - 44 self._forever = False - 45 self._closed = False -
46 -
47 - def close (self): -
48 os.close(self._rfd) - 49 os.close(self._wfd) - 50 # used for unit tests: - 51 self._closed = True -
52 -
53 - def fileno (self): -
54 return self._rfd -
55 -
56 - def clear (self): -
57 if not self._set or self._forever: - 58 return - 59 os.read(self._rfd, 1) - 60 self._set = False -
61 -
62 - def set (self): -
63 if self._set or self._closed: - 64 return - 65 self._set = True - 66 os.write(self._wfd, '*') -
67 -
68 - def set_forever (self): -
69 self._forever = True - 70 self.set() -
71 - 72 -
73 -class WindowsPipe (object): -
74 """ - 75 On Windows, only an OS-level "WinSock" may be used in select(), but reads - 76 and writes must be to the actual socket object. - 77 """ -
78 - def __init__ (self): -
79 serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - 80 serv.bind(('127.0.0.1', 0)) - 81 serv.listen(1) - 82 - 83 # need to save sockets in _rsock/_wsock so they don't get closed - 84 self._rsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - 85 self._rsock.connect(('127.0.0.1', serv.getsockname()[1])) - 86 - 87 self._wsock, addr = serv.accept() - 88 serv.close() - 89 self._set = False - 90 self._forever = False - 91 self._closed = False -
92 -
93 - def close (self): -
94 self._rsock.close() - 95 self._wsock.close() - 96 # used for unit tests: - 97 self._closed = True -
98 -
99 - def fileno (self): -
100 return self._rsock.fileno() -
101 -
102 - def clear (self): -
103 if not self._set or self._forever: -104 return -105 self._rsock.recv(1) -106 self._set = False -
107 -
108 - def set (self): -
109 if self._set or self._closed: -110 return -111 self._set = True -112 self._wsock.send('*') -
113 -
114 - def set_forever (self): -
115 self._forever = True -116 self.set() -
117 -118 -
119 -class OrPipe (object): -
120 - def __init__(self, pipe): -
121 self._set = False -122 self._partner = None -123 self._pipe = pipe -
124 -
125 - def set(self): -
126 self._set = True -127 if not self._partner._set: -128 self._pipe.set() -
129 -
130 - def clear(self): -
131 self._set = False -132 if not self._partner._set: -133 self._pipe.clear() -
134 -135 -
136 -def make_or_pipe(pipe): -
137 """ -138 wraps a pipe into two pipe-like objects which are "or"d together to -139 affect the real pipe. if either returned pipe is set, the wrapped pipe -140 is set. when both are cleared, the wrapped pipe is cleared. -141 """ -142 p1 = OrPipe(pipe) -143 p2 = OrPipe(pipe) -144 p1._partner = p2 -145 p2._partner = p1 -146 return p1, p2 -
147 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.pipe.OrPipe-class.html b/docs/paramiko.pipe.OrPipe-class.html deleted file mode 100644 index b6f709c..0000000 --- a/docs/paramiko.pipe.OrPipe-class.html +++ /dev/null @@ -1,239 +0,0 @@ - - - - - paramiko.pipe.OrPipe - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module pipe :: - Class OrPipe - - - - - -
[frames] | no frames]
-
- -

Class OrPipe

source code

-
-object --+
-         |
-        OrPipe
-
- -
- - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - pipe)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
-   - - - - - - -
set(self) - source code - -
- -
-   - - - - - - -
clear(self) - source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - pipe) -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.pipe.PosixPipe-class.html b/docs/paramiko.pipe.PosixPipe-class.html deleted file mode 100644 index e742413..0000000 --- a/docs/paramiko.pipe.PosixPipe-class.html +++ /dev/null @@ -1,285 +0,0 @@ - - - - - paramiko.pipe.PosixPipe - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module pipe :: - Class PosixPipe - - - - - -
[frames] | no frames]
-
- -

Class PosixPipe

source code

-
-object --+
-         |
-        PosixPipe
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
-   - - - - - - -
close(self) - source code - -
- -
-   - - - - - - -
fileno(self) - source code - -
- -
-   - - - - - - -
clear(self) - source code - -
- -
-   - - - - - - -
set(self) - source code - -
- -
-   - - - - - - -
set_forever(self) - source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self) -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.pipe.WindowsPipe-class.html b/docs/paramiko.pipe.WindowsPipe-class.html deleted file mode 100644 index de302d7..0000000 --- a/docs/paramiko.pipe.WindowsPipe-class.html +++ /dev/null @@ -1,288 +0,0 @@ - - - - - paramiko.pipe.WindowsPipe - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module pipe :: - Class WindowsPipe - - - - - -
[frames] | no frames]
-
- -

Class WindowsPipe

source code

-
-object --+
-         |
-        WindowsPipe
-
- -
-

On Windows, only an OS-level "WinSock" may be used in - select(), but reads and writes must be to the actual socket object.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
-   - - - - - - -
close(self) - source code - -
- -
-   - - - - - - -
fileno(self) - source code - -
- -
-   - - - - - - -
clear(self) - source code - -
- -
-   - - - - - - -
set(self) - source code - -
- -
-   - - - - - - -
set_forever(self) - source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self) -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.pkey-module.html b/docs/paramiko.pkey-module.html deleted file mode 100644 index 6688914..0000000 --- a/docs/paramiko.pkey-module.html +++ /dev/null @@ -1,531 +0,0 @@ - - - - - paramiko.pkey - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module pkey - - - - - -
[frames] | no frames]
-
- -

Module pkey

source code

-

Common API for all public keys.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Variables
-   - - AUTH_FAILED = 2 -
-   - - AUTH_PARTIALLY_SUCCESSFUL = 1 -
-   - - AUTH_SUCCESSFUL = 0 -
-   - - CONNECTION_FAILED_CODE = {1: 'Administratively prohibited', 2:... -
-   - - CRITICAL = 50 -
-   - - DEBUG = 10 -
-   - - DISCONNECT_AUTH_CANCELLED_BY_USER = 13 -
-   - - DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14 -
-   - - DISCONNECT_SERVICE_NOT_AVAILABLE = 7 -
-   - - ERROR = 40 -
-   - - INFO = 20 -
-   - - MSG_CHANNEL_CLOSE = 97 -
-   - - MSG_CHANNEL_DATA = 94 -
-   - - MSG_CHANNEL_EOF = 96 -
-   - - MSG_CHANNEL_EXTENDED_DATA = 95 -
-   - - MSG_CHANNEL_FAILURE = 100 -
-   - - MSG_CHANNEL_OPEN = 90 -
-   - - MSG_CHANNEL_OPEN_FAILURE = 92 -
-   - - MSG_CHANNEL_OPEN_SUCCESS = 91 -
-   - - MSG_CHANNEL_REQUEST = 98 -
-   - - MSG_CHANNEL_SUCCESS = 99 -
-   - - MSG_CHANNEL_WINDOW_ADJUST = 93 -
-   - - MSG_DEBUG = 4 -
-   - - MSG_DISCONNECT = 1 -
-   - - MSG_GLOBAL_REQUEST = 80 -
-   - - MSG_IGNORE = 2 -
-   - - MSG_KEXINIT = 20 -
-   - - MSG_NAMES = {1: 'disconnect', 2: 'ignore', 3: 'unimplemented',... -
-   - - MSG_NEWKEYS = 21 -
-   - - MSG_REQUEST_FAILURE = 82 -
-   - - MSG_REQUEST_SUCCESS = 81 -
-   - - MSG_SERVICE_ACCEPT = 6 -
-   - - MSG_SERVICE_REQUEST = 5 -
-   - - MSG_UNIMPLEMENTED = 3 -
-   - - MSG_USERAUTH_BANNER = 53 -
-   - - MSG_USERAUTH_FAILURE = 51 -
-   - - MSG_USERAUTH_INFO_REQUEST = 60 -
-   - - MSG_USERAUTH_INFO_RESPONSE = 61 -
-   - - MSG_USERAUTH_PK_OK = 60 -
-   - - MSG_USERAUTH_REQUEST = 50 -
-   - - MSG_USERAUTH_SUCCESS = 52 -
-   - - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED = 1 -
-   - - OPEN_FAILED_CONNECT_FAILED = 2 -
-   - - OPEN_FAILED_RESOURCE_SHORTAGE = 4 -
-   - - OPEN_FAILED_UNKNOWN_CHANNEL_TYPE = 3 -
-   - - OPEN_SUCCEEDED = 0 -
-   - - PY22 = False -
-   - - WARNING = 30 -
-   - - __package__ = 'paramiko' -
-   - - rng = Random.new() -
- - - - - - -
- Variables Details
- -
- -
-

CONNECTION_FAILED_CODE

- -
-
-
-
Value:
-
-{1: 'Administratively prohibited',
- 2: 'Connect failed',
- 3: 'Unknown channel type',
- 4: 'Resource shortage'}
-
-
-
-
-
- -
- -
-

MSG_NAMES

- -
-
-
-
Value:
-
-{1: 'disconnect',
- 2: 'ignore',
- 3: 'unimplemented',
- 4: 'debug',
- 5: 'service-request',
- 6: 'service-accept',
- 20: 'kexinit',
- 21: 'newkeys',
-...
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.pkey-pysrc.html b/docs/paramiko.pkey-pysrc.html deleted file mode 100644 index 56f0c4b..0000000 --- a/docs/paramiko.pkey-pysrc.html +++ /dev/null @@ -1,542 +0,0 @@ - - - - - paramiko.pkey - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module pkey - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.pkey

-
-  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  Common API for all public keys. 
- 21  """ 
- 22   
- 23  import base64 
- 24  from binascii import hexlify, unhexlify 
- 25  import os 
- 26   
- 27  from Crypto.Hash import MD5 
- 28  from Crypto.Cipher import DES3, AES 
- 29   
- 30  from paramiko.common import * 
- 31  from paramiko import util 
- 32  from paramiko.message import Message 
- 33  from paramiko.ssh_exception import SSHException, PasswordRequiredException 
- 34   
- 35   
-
36 -class PKey (object): -
37 """ - 38 Base class for public keys. - 39 """ - 40 - 41 # known encryption types for private key files: - 42 _CIPHER_TABLE = { - 43 'AES-128-CBC': { 'cipher': AES, 'keysize': 16, 'blocksize': 16, 'mode': AES.MODE_CBC }, - 44 'DES-EDE3-CBC': { 'cipher': DES3, 'keysize': 24, 'blocksize': 8, 'mode': DES3.MODE_CBC }, - 45 } - 46 - 47 -
48 - def __init__(self, msg=None, data=None): -
49 """ - 50 Create a new instance of this public key type. If C{msg} is given, - 51 the key's public part(s) will be filled in from the message. If - 52 C{data} is given, the key's public part(s) will be filled in from - 53 the string. - 54 - 55 @param msg: an optional SSH L{Message} containing a public key of this - 56 type. - 57 @type msg: L{Message} - 58 @param data: an optional string containing a public key of this type - 59 @type data: str - 60 - 61 @raise SSHException: if a key cannot be created from the C{data} or - 62 C{msg} given, or no key was passed in. - 63 """ - 64 pass -
65 -
66 - def __str__(self): -
67 """ - 68 Return a string of an SSH L{Message} made up of the public part(s) of - 69 this key. This string is suitable for passing to L{__init__} to - 70 re-create the key object later. - 71 - 72 @return: string representation of an SSH key message. - 73 @rtype: str - 74 """ - 75 return '' -
76 -
77 - def __cmp__(self, other): -
78 """ - 79 Compare this key to another. Returns 0 if this key is equivalent to - 80 the given key, or non-0 if they are different. Only the public parts - 81 of the key are compared, so a public key will compare equal to its - 82 corresponding private key. - 83 - 84 @param other: key to compare to. - 85 @type other: L{PKey} - 86 @return: 0 if the two keys are equivalent, non-0 otherwise. - 87 @rtype: int - 88 """ - 89 hs = hash(self) - 90 ho = hash(other) - 91 if hs != ho: - 92 return cmp(hs, ho) - 93 return cmp(str(self), str(other)) -
94 -
95 - def get_name(self): -
96 """ - 97 Return the name of this private key implementation. - 98 - 99 @return: name of this private key type, in SSH terminology (for -100 example, C{"ssh-rsa"}). -101 @rtype: str -102 """ -103 return '' -
104 -
105 - def get_bits(self): -
106 """ -107 Return the number of significant bits in this key. This is useful -108 for judging the relative security of a key. -109 -110 @return: bits in the key. -111 @rtype: int -112 """ -113 return 0 -
114 -
115 - def can_sign(self): -
116 """ -117 Return C{True} if this key has the private part necessary for signing -118 data. -119 -120 @return: C{True} if this is a private key. -121 @rtype: bool -122 """ -123 return False -
124 -
125 - def get_fingerprint(self): -
126 """ -127 Return an MD5 fingerprint of the public part of this key. Nothing -128 secret is revealed. -129 -130 @return: a 16-byte string (binary) of the MD5 fingerprint, in SSH -131 format. -132 @rtype: str -133 """ -134 return MD5.new(str(self)).digest() -
135 -
136 - def get_base64(self): -
137 """ -138 Return a base64 string containing the public part of this key. Nothing -139 secret is revealed. This format is compatible with that used to store -140 public key files or recognized host keys. -141 -142 @return: a base64 string containing the public part of the key. -143 @rtype: str -144 """ -145 return base64.encodestring(str(self)).replace('\n', '') -
146 -
147 - def sign_ssh_data(self, rng, data): -
148 """ -149 Sign a blob of data with this private key, and return a L{Message} -150 representing an SSH signature message. -151 -152 @param rng: a secure random number generator. -153 @type rng: L{Crypto.Util.rng.RandomPool} -154 @param data: the data to sign. -155 @type data: str -156 @return: an SSH signature message. -157 @rtype: L{Message} -158 """ -159 return '' -
160 -
161 - def verify_ssh_sig(self, data, msg): -
162 """ -163 Given a blob of data, and an SSH message representing a signature of -164 that data, verify that it was signed with this key. -165 -166 @param data: the data that was signed. -167 @type data: str -168 @param msg: an SSH signature message -169 @type msg: L{Message} -170 @return: C{True} if the signature verifies correctly; C{False} -171 otherwise. -172 @rtype: boolean -173 """ -174 return False -
175 -
176 - def from_private_key_file(cls, filename, password=None): -
177 """ -178 Create a key object by reading a private key file. If the private -179 key is encrypted and C{password} is not C{None}, the given password -180 will be used to decrypt the key (otherwise L{PasswordRequiredException} -181 is thrown). Through the magic of python, this factory method will -182 exist in all subclasses of PKey (such as L{RSAKey} or L{DSSKey}), but -183 is useless on the abstract PKey class. -184 -185 @param filename: name of the file to read -186 @type filename: str -187 @param password: an optional password to use to decrypt the key file, -188 if it's encrypted -189 @type password: str -190 @return: a new key object based on the given private key -191 @rtype: L{PKey} -192 -193 @raise IOError: if there was an error reading the file -194 @raise PasswordRequiredException: if the private key file is -195 encrypted, and C{password} is C{None} -196 @raise SSHException: if the key file is invalid -197 """ -198 key = cls(filename=filename, password=password) -199 return key -
200 from_private_key_file = classmethod(from_private_key_file) -201 -
202 - def from_private_key(cls, file_obj, password=None): -
203 """ -204 Create a key object by reading a private key from a file (or file-like) -205 object. If the private key is encrypted and C{password} is not C{None}, -206 the given password will be used to decrypt the key (otherwise -207 L{PasswordRequiredException} is thrown). -208 -209 @param file_obj: the file to read from -210 @type file_obj: file -211 @param password: an optional password to use to decrypt the key, if it's -212 encrypted -213 @type password: str -214 @return: a new key object based on the given private key -215 @rtype: L{PKey} -216 -217 @raise IOError: if there was an error reading the key -218 @raise PasswordRequiredException: if the private key file is encrypted, -219 and C{password} is C{None} -220 @raise SSHException: if the key file is invalid -221 """ -222 key = cls(file_obj=file_obj, password=password) -223 return key -
224 from_private_key = classmethod(from_private_key) -225 -
226 - def write_private_key_file(self, filename, password=None): -
227 """ -228 Write private key contents into a file. If the password is not -229 C{None}, the key is encrypted before writing. -230 -231 @param filename: name of the file to write -232 @type filename: str -233 @param password: an optional password to use to encrypt the key file -234 @type password: str -235 -236 @raise IOError: if there was an error writing the file -237 @raise SSHException: if the key is invalid -238 """ -239 raise Exception('Not implemented in PKey') -
240 -
241 - def write_private_key(self, file_obj, password=None): -
242 """ -243 Write private key contents into a file (or file-like) object. If the -244 password is not C{None}, the key is encrypted before writing. -245 -246 @param file_obj: the file object to write into -247 @type file_obj: file -248 @param password: an optional password to use to encrypt the key -249 @type password: str -250 -251 @raise IOError: if there was an error writing to the file -252 @raise SSHException: if the key is invalid -253 """ -254 raise Exception('Not implemented in PKey') -
255 -
256 - def _read_private_key_file(self, tag, filename, password=None): -
257 """ -258 Read an SSH2-format private key file, looking for a string of the type -259 C{"BEGIN xxx PRIVATE KEY"} for some C{xxx}, base64-decode the text we -260 find, and return it as a string. If the private key is encrypted and -261 C{password} is not C{None}, the given password will be used to decrypt -262 the key (otherwise L{PasswordRequiredException} is thrown). -263 -264 @param tag: C{"RSA"} or C{"DSA"}, the tag used to mark the data block. -265 @type tag: str -266 @param filename: name of the file to read. -267 @type filename: str -268 @param password: an optional password to use to decrypt the key file, -269 if it's encrypted. -270 @type password: str -271 @return: data blob that makes up the private key. -272 @rtype: str -273 -274 @raise IOError: if there was an error reading the file. -275 @raise PasswordRequiredException: if the private key file is -276 encrypted, and C{password} is C{None}. -277 @raise SSHException: if the key file is invalid. -278 """ -279 f = open(filename, 'r') -280 data = self._read_private_key(tag, f, password) -281 f.close() -282 return data -
283 -
284 - def _read_private_key(self, tag, f, password=None): -
285 lines = f.readlines() -286 start = 0 -287 while (start < len(lines)) and (lines[start].strip() != '-----BEGIN ' + tag + ' PRIVATE KEY-----'): -288 start += 1 -289 if start >= len(lines): -290 raise SSHException('not a valid ' + tag + ' private key file') -291 # parse any headers first -292 headers = {} -293 start += 1 -294 while start < len(lines): -295 l = lines[start].split(': ') -296 if len(l) == 1: -297 break -298 headers[l[0].lower()] = l[1].strip() -299 start += 1 -300 # find end -301 end = start -302 while (lines[end].strip() != '-----END ' + tag + ' PRIVATE KEY-----') and (end < len(lines)): -303 end += 1 -304 # if we trudged to the end of the file, just try to cope. -305 try: -306 data = base64.decodestring(''.join(lines[start:end])) -307 except base64.binascii.Error, e: -308 raise SSHException('base64 decoding error: ' + str(e)) -309 if 'proc-type' not in headers: -310 # unencryped: done -311 return data -312 # encrypted keyfile: will need a password -313 if headers['proc-type'] != '4,ENCRYPTED': -314 raise SSHException('Unknown private key structure "%s"' % headers['proc-type']) -315 try: -316 encryption_type, saltstr = headers['dek-info'].split(',') -317 except: -318 raise SSHException('Can\'t parse DEK-info in private key file') -319 if encryption_type not in self._CIPHER_TABLE: -320 raise SSHException('Unknown private key cipher "%s"' % encryption_type) -321 # if no password was passed in, raise an exception pointing out that we need one -322 if password is None: -323 raise PasswordRequiredException('Private key file is encrypted') -324 cipher = self._CIPHER_TABLE[encryption_type]['cipher'] -325 keysize = self._CIPHER_TABLE[encryption_type]['keysize'] -326 mode = self._CIPHER_TABLE[encryption_type]['mode'] -327 salt = unhexlify(saltstr) -328 key = util.generate_key_bytes(MD5, salt, password, keysize) -329 return cipher.new(key, mode, salt).decrypt(data) -
330 -
331 - def _write_private_key_file(self, tag, filename, data, password=None): -
332 """ -333 Write an SSH2-format private key file in a form that can be read by -334 paramiko or openssh. If no password is given, the key is written in -335 a trivially-encoded format (base64) which is completely insecure. If -336 a password is given, DES-EDE3-CBC is used. -337 -338 @param tag: C{"RSA"} or C{"DSA"}, the tag used to mark the data block. -339 @type tag: str -340 @param filename: name of the file to write. -341 @type filename: str -342 @param data: data blob that makes up the private key. -343 @type data: str -344 @param password: an optional password to use to encrypt the file. -345 @type password: str -346 -347 @raise IOError: if there was an error writing the file. -348 """ -349 f = open(filename, 'w', 0600) -350 # grrr... the mode doesn't always take hold -351 os.chmod(filename, 0600) -352 self._write_private_key(tag, f, data, password) -353 f.close() -
354 -
355 - def _write_private_key(self, tag, f, data, password=None): -
356 f.write('-----BEGIN %s PRIVATE KEY-----\n' % tag) -357 if password is not None: -358 # since we only support one cipher here, use it -359 cipher_name = self._CIPHER_TABLE.keys()[0] -360 cipher = self._CIPHER_TABLE[cipher_name]['cipher'] -361 keysize = self._CIPHER_TABLE[cipher_name]['keysize'] -362 blocksize = self._CIPHER_TABLE[cipher_name]['blocksize'] -363 mode = self._CIPHER_TABLE[cipher_name]['mode'] -364 salt = rng.read(8) -365 key = util.generate_key_bytes(MD5, salt, password, keysize) -366 if len(data) % blocksize != 0: -367 n = blocksize - len(data) % blocksize -368 #data += rng.read(n) -369 # that would make more sense ^, but it confuses openssh. -370 data += '\0' * n -371 data = cipher.new(key, mode, salt).encrypt(data) -372 f.write('Proc-Type: 4,ENCRYPTED\n') -373 f.write('DEK-Info: %s,%s\n' % (cipher_name, hexlify(salt).upper())) -374 f.write('\n') -375 s = base64.encodestring(data) -376 # re-wrap to 64-char lines -377 s = ''.join(s.split('\n')) -378 s = '\n'.join([s[i : i+64] for i in range(0, len(s), 64)]) -379 f.write(s) -380 f.write('\n') -381 f.write('-----END %s PRIVATE KEY-----\n' % tag) -
382 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.primes-module.html b/docs/paramiko.primes-module.html deleted file mode 100644 index c507d4e..0000000 --- a/docs/paramiko.primes-module.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - - paramiko.primes - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module primes - - - - - -
[frames] | no frames]
-
- -

Module primes

source code

-

Utility functions for dealing with primes.

- - - - - - - - - - -
- Classes
-   - - ModulusPack
- convenience object for holding the contents of the /etc/ssh/moduli - file, on systems that have such a file. -
- - - - - - - - - -
- Variables
-   - - __package__ = 'paramiko' -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.primes-pysrc.html b/docs/paramiko.primes-pysrc.html deleted file mode 100644 index eabf841..0000000 --- a/docs/paramiko.primes-pysrc.html +++ /dev/null @@ -1,355 +0,0 @@ - - - - - paramiko.primes - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module primes - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.primes

-
-  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  Utility functions for dealing with primes. 
- 21  """ 
- 22   
- 23  from Crypto.Util import number 
- 24   
- 25  from paramiko import util 
- 26  from paramiko.ssh_exception import SSHException 
- 27   
- 28   
-
29 -def _generate_prime(bits, rng): -
30 "primtive attempt at prime generation" - 31 hbyte_mask = pow(2, bits % 8) - 1 - 32 while True: - 33 # loop catches the case where we increment n into a higher bit-range - 34 x = rng.read((bits+7) // 8) - 35 if hbyte_mask > 0: - 36 x = chr(ord(x[0]) & hbyte_mask) + x[1:] - 37 n = util.inflate_long(x, 1) - 38 n |= 1 - 39 n |= (1 << (bits - 1)) - 40 while not number.isPrime(n): - 41 n += 2 - 42 if util.bit_length(n) == bits: - 43 break - 44 return n -
45 -
46 -def _roll_random(rng, n): -
47 "returns a random # from 0 to N-1" - 48 bits = util.bit_length(n-1) - 49 bytes = (bits + 7) // 8 - 50 hbyte_mask = pow(2, bits % 8) - 1 - 51 - 52 # so here's the plan: - 53 # we fetch as many random bits as we'd need to fit N-1, and if the - 54 # generated number is >= N, we try again. in the worst case (N-1 is a - 55 # power of 2), we have slightly better than 50% odds of getting one that - 56 # fits, so i can't guarantee that this loop will ever finish, but the odds - 57 # of it looping forever should be infinitesimal. - 58 while True: - 59 x = rng.read(bytes) - 60 if hbyte_mask > 0: - 61 x = chr(ord(x[0]) & hbyte_mask) + x[1:] - 62 num = util.inflate_long(x, 1) - 63 if num < n: - 64 break - 65 return num -
66 - 67 -
68 -class ModulusPack (object): -
69 """ - 70 convenience object for holding the contents of the /etc/ssh/moduli file, - 71 on systems that have such a file. - 72 """ - 73 -
74 - def __init__(self, rpool): -
75 # pack is a hash of: bits -> [ (generator, modulus) ... ] - 76 self.pack = {} - 77 self.discarded = [] - 78 self.rng = rpool -
79 -
80 - def _parse_modulus(self, line): -
81 timestamp, mod_type, tests, tries, size, generator, modulus = line.split() - 82 mod_type = int(mod_type) - 83 tests = int(tests) - 84 tries = int(tries) - 85 size = int(size) - 86 generator = int(generator) - 87 modulus = long(modulus, 16) - 88 - 89 # weed out primes that aren't at least: - 90 # type 2 (meets basic structural requirements) - 91 # test 4 (more than just a small-prime sieve) - 92 # tries < 100 if test & 4 (at least 100 tries of miller-rabin) - 93 if (mod_type < 2) or (tests < 4) or ((tests & 4) and (tests < 8) and (tries < 100)): - 94 self.discarded.append((modulus, 'does not meet basic requirements')) - 95 return - 96 if generator == 0: - 97 generator = 2 - 98 - 99 # there's a bug in the ssh "moduli" file (yeah, i know: shock! dismay! -100 # call cnn!) where it understates the bit lengths of these primes by 1. -101 # this is okay. -102 bl = util.bit_length(modulus) -103 if (bl != size) and (bl != size + 1): -104 self.discarded.append((modulus, 'incorrectly reported bit length %d' % size)) -105 return -106 if bl not in self.pack: -107 self.pack[bl] = [] -108 self.pack[bl].append((generator, modulus)) -
109 -
110 - def read_file(self, filename): -
111 """ -112 @raise IOError: passed from any file operations that fail. -113 """ -114 self.pack = {} -115 f = open(filename, 'r') -116 for line in f: -117 line = line.strip() -118 if (len(line) == 0) or (line[0] == '#'): -119 continue -120 try: -121 self._parse_modulus(line) -122 except: -123 continue -124 f.close() -
125 -
126 - def get_modulus(self, min, prefer, max): -
127 bitsizes = self.pack.keys() -128 bitsizes.sort() -129 if len(bitsizes) == 0: -130 raise SSHException('no moduli available') -131 good = -1 -132 # find nearest bitsize >= preferred -133 for b in bitsizes: -134 if (b >= prefer) and (b < max) and ((b < good) or (good == -1)): -135 good = b -136 # if that failed, find greatest bitsize >= min -137 if good == -1: -138 for b in bitsizes: -139 if (b >= min) and (b < max) and (b > good): -140 good = b -141 if good == -1: -142 # their entire (min, max) range has no intersection with our range. -143 # if their range is below ours, pick the smallest. otherwise pick -144 # the largest. it'll be out of their range requirement either way, -145 # but we'll be sending them the closest one we have. -146 good = bitsizes[0] -147 if min > good: -148 good = bitsizes[-1] -149 # now pick a random modulus of this bitsize -150 n = _roll_random(self.rng, len(self.pack[good])) -151 return self.pack[good][n] -
152 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.primes.ModulusPack-class.html b/docs/paramiko.primes.ModulusPack-class.html deleted file mode 100644 index e584c54..0000000 --- a/docs/paramiko.primes.ModulusPack-class.html +++ /dev/null @@ -1,270 +0,0 @@ - - - - - paramiko.primes.ModulusPack - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module primes :: - Class ModulusPack - - - - - -
[frames] | no frames]
-
- -

Class ModulusPack

source code

-
-object --+
-         |
-        ModulusPack
-
- -
-

convenience object for holding the contents of the /etc/ssh/moduli - file, on systems that have such a file.

- - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - rpool)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
-   - - - - - - -
read_file(self, - filename) - source code - -
- -
-   - - - - - - -
get_modulus(self, - min, - prefer, - max) - source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - rpool) -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

read_file(self, - filename) -

-
source code  -
- - -
-
Raises:
-
    -
  • IOError - passed from any file operations that fail.
  • -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.resource-module.html b/docs/paramiko.resource-module.html deleted file mode 100644 index 7bcd6d0..0000000 --- a/docs/paramiko.resource-module.html +++ /dev/null @@ -1,127 +0,0 @@ - - - - - paramiko.resource - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module resource - - - - - -
[frames] | no frames]
-
- -

Module resource

source code

-

Resource manager.

- - - - - - - - - - - - - -
- Variables
-   - - ResourceManager = ResourceManager() -
-   - - __package__ = 'paramiko' -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.resource-pysrc.html b/docs/paramiko.resource-pysrc.html deleted file mode 100644 index 0322572..0000000 --- a/docs/paramiko.resource-pysrc.html +++ /dev/null @@ -1,192 +0,0 @@ - - - - - paramiko.resource - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module resource - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.resource

-
- 1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
- 2  # 
- 3  # This file is part of paramiko. 
- 4  # 
- 5  # Paramiko is free software; you can redistribute it and/or modify it under the 
- 6  # terms of the GNU Lesser General Public License as published by the Free 
- 7  # Software Foundation; either version 2.1 of the License, or (at your option) 
- 8  # any later version. 
- 9  # 
-10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
-11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
-12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
-13  # details. 
-14  # 
-15  # You should have received a copy of the GNU Lesser General Public License 
-16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
-17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
-18   
-19  """ 
-20  Resource manager. 
-21  """ 
-22   
-23  import weakref 
-24   
-25   
-
26 -class ResourceManager (object): -
27 """ -28 A registry of objects and resources that should be closed when those -29 objects are deleted. -30 -31 This is meant to be a safer alternative to python's C{__del__} method, -32 which can cause reference cycles to never be collected. Objects registered -33 with the ResourceManager can be collected but still free resources when -34 they die. -35 -36 Resources are registered using L{register}, and when an object is garbage -37 collected, each registered resource is closed by having its C{close()} -38 method called. Multiple resources may be registered per object, but a -39 resource will only be closed once, even if multiple objects register it. -40 (The last object to register it wins.) -41 """ -42 -
43 - def __init__(self): -
44 self._table = {} -
45 -
46 - def register(self, obj, resource): -
47 """ -48 Register a resource to be closed with an object is collected. -49 -50 When the given C{obj} is garbage-collected by the python interpreter, -51 the C{resource} will be closed by having its C{close()} method called. -52 Any exceptions are ignored. -53 -54 @param obj: the object to track -55 @type obj: object -56 @param resource: the resource to close when the object is collected -57 @type resource: object -58 """ -59 def callback(ref): -60 try: -61 resource.close() -62 except: -63 pass -64 del self._table[id(resource)] -
65 -66 # keep the weakref in a table so it sticks around long enough to get -67 # its callback called. :) -68 self._table[id(resource)] = weakref.ref(obj, callback) -
69 -70 -71 # singleton -72 ResourceManager = ResourceManager() -73 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.rsakey-module.html b/docs/paramiko.rsakey-module.html deleted file mode 100644 index fe3358b..0000000 --- a/docs/paramiko.rsakey-module.html +++ /dev/null @@ -1,531 +0,0 @@ - - - - - paramiko.rsakey - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module rsakey - - - - - -
[frames] | no frames]
-
- -

Module rsakey

source code

-

RSAKey

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Variables
-   - - AUTH_FAILED = 2 -
-   - - AUTH_PARTIALLY_SUCCESSFUL = 1 -
-   - - AUTH_SUCCESSFUL = 0 -
-   - - CONNECTION_FAILED_CODE = {1: 'Administratively prohibited', 2:... -
-   - - CRITICAL = 50 -
-   - - DEBUG = 10 -
-   - - DISCONNECT_AUTH_CANCELLED_BY_USER = 13 -
-   - - DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14 -
-   - - DISCONNECT_SERVICE_NOT_AVAILABLE = 7 -
-   - - ERROR = 40 -
-   - - INFO = 20 -
-   - - MSG_CHANNEL_CLOSE = 97 -
-   - - MSG_CHANNEL_DATA = 94 -
-   - - MSG_CHANNEL_EOF = 96 -
-   - - MSG_CHANNEL_EXTENDED_DATA = 95 -
-   - - MSG_CHANNEL_FAILURE = 100 -
-   - - MSG_CHANNEL_OPEN = 90 -
-   - - MSG_CHANNEL_OPEN_FAILURE = 92 -
-   - - MSG_CHANNEL_OPEN_SUCCESS = 91 -
-   - - MSG_CHANNEL_REQUEST = 98 -
-   - - MSG_CHANNEL_SUCCESS = 99 -
-   - - MSG_CHANNEL_WINDOW_ADJUST = 93 -
-   - - MSG_DEBUG = 4 -
-   - - MSG_DISCONNECT = 1 -
-   - - MSG_GLOBAL_REQUEST = 80 -
-   - - MSG_IGNORE = 2 -
-   - - MSG_KEXINIT = 20 -
-   - - MSG_NAMES = {1: 'disconnect', 2: 'ignore', 3: 'unimplemented',... -
-   - - MSG_NEWKEYS = 21 -
-   - - MSG_REQUEST_FAILURE = 82 -
-   - - MSG_REQUEST_SUCCESS = 81 -
-   - - MSG_SERVICE_ACCEPT = 6 -
-   - - MSG_SERVICE_REQUEST = 5 -
-   - - MSG_UNIMPLEMENTED = 3 -
-   - - MSG_USERAUTH_BANNER = 53 -
-   - - MSG_USERAUTH_FAILURE = 51 -
-   - - MSG_USERAUTH_INFO_REQUEST = 60 -
-   - - MSG_USERAUTH_INFO_RESPONSE = 61 -
-   - - MSG_USERAUTH_PK_OK = 60 -
-   - - MSG_USERAUTH_REQUEST = 50 -
-   - - MSG_USERAUTH_SUCCESS = 52 -
-   - - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED = 1 -
-   - - OPEN_FAILED_CONNECT_FAILED = 2 -
-   - - OPEN_FAILED_RESOURCE_SHORTAGE = 4 -
-   - - OPEN_FAILED_UNKNOWN_CHANNEL_TYPE = 3 -
-   - - OPEN_SUCCEEDED = 0 -
-   - - PY22 = False -
-   - - WARNING = 30 -
-   - - __package__ = 'paramiko' -
-   - - rng = Random.new() -
- - - - - - -
- Variables Details
- -
- -
-

CONNECTION_FAILED_CODE

- -
-
-
-
Value:
-
-{1: 'Administratively prohibited',
- 2: 'Connect failed',
- 3: 'Unknown channel type',
- 4: 'Resource shortage'}
-
-
-
-
-
- -
- -
-

MSG_NAMES

- -
-
-
-
Value:
-
-{1: 'disconnect',
- 2: 'ignore',
- 3: 'unimplemented',
- 4: 'debug',
- 5: 'service-request',
- 6: 'service-accept',
- 20: 'kexinit',
- 21: 'newkeys',
-...
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.rsakey-pysrc.html b/docs/paramiko.rsakey-pysrc.html deleted file mode 100644 index 8deccb5..0000000 --- a/docs/paramiko.rsakey-pysrc.html +++ /dev/null @@ -1,323 +0,0 @@ - - - - - paramiko.rsakey - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module rsakey - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.rsakey

-
-  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  L{RSAKey} 
- 21  """ 
- 22   
- 23  from Crypto.PublicKey import RSA 
- 24  from Crypto.Hash import SHA, MD5 
- 25  from Crypto.Cipher import DES3 
- 26   
- 27  from paramiko.common import * 
- 28  from paramiko import util 
- 29  from paramiko.message import Message 
- 30  from paramiko.ber import BER, BERException 
- 31  from paramiko.pkey import PKey 
- 32  from paramiko.ssh_exception import SSHException 
- 33   
- 34   
-
35 -class RSAKey (PKey): -
36 """ - 37 Representation of an RSA key which can be used to sign and verify SSH2 - 38 data. - 39 """ - 40 -
41 - def __init__(self, msg=None, data=None, filename=None, password=None, vals=None, file_obj=None): -
42 self.n = None - 43 self.e = None - 44 self.d = None - 45 self.p = None - 46 self.q = None - 47 if file_obj is not None: - 48 self._from_private_key(file_obj, password) - 49 return - 50 if filename is not None: - 51 self._from_private_key_file(filename, password) - 52 return - 53 if (msg is None) and (data is not None): - 54 msg = Message(data) - 55 if vals is not None: - 56 self.e, self.n = vals - 57 else: - 58 if msg is None: - 59 raise SSHException('Key object may not be empty') - 60 if msg.get_string() != 'ssh-rsa': - 61 raise SSHException('Invalid key') - 62 self.e = msg.get_mpint() - 63 self.n = msg.get_mpint() - 64 self.size = util.bit_length(self.n) -
65 -
66 - def __str__(self): -
67 m = Message() - 68 m.add_string('ssh-rsa') - 69 m.add_mpint(self.e) - 70 m.add_mpint(self.n) - 71 return str(m) -
72 -
73 - def __hash__(self): -
74 h = hash(self.get_name()) - 75 h = h * 37 + hash(self.e) - 76 h = h * 37 + hash(self.n) - 77 return hash(h) -
78 -
79 - def get_name(self): -
80 return 'ssh-rsa' -
81 -
82 - def get_bits(self): -
83 return self.size -
84 -
85 - def can_sign(self): -
86 return self.d is not None -
87 -
88 - def sign_ssh_data(self, rpool, data): -
89 digest = SHA.new(data).digest() - 90 rsa = RSA.construct((long(self.n), long(self.e), long(self.d))) - 91 sig = util.deflate_long(rsa.sign(self._pkcs1imify(digest), '')[0], 0) - 92 m = Message() - 93 m.add_string('ssh-rsa') - 94 m.add_string(sig) - 95 return m -
96 -
97 - def verify_ssh_sig(self, data, msg): -
98 if msg.get_string() != 'ssh-rsa': - 99 return False -100 sig = util.inflate_long(msg.get_string(), True) -101 # verify the signature by SHA'ing the data and encrypting it using the -102 # public key. some wackiness ensues where we "pkcs1imify" the 20-byte -103 # hash into a string as long as the RSA key. -104 hash_obj = util.inflate_long(self._pkcs1imify(SHA.new(data).digest()), True) -105 rsa = RSA.construct((long(self.n), long(self.e))) -106 return rsa.verify(hash_obj, (sig,)) -
107 -
108 - def _encode_key(self): -
109 if (self.p is None) or (self.q is None): -110 raise SSHException('Not enough key info to write private key file') -111 keylist = [ 0, self.n, self.e, self.d, self.p, self.q, -112 self.d % (self.p - 1), self.d % (self.q - 1), -113 util.mod_inverse(self.q, self.p) ] -114 try: -115 b = BER() -116 b.encode(keylist) -117 except BERException: -118 raise SSHException('Unable to create ber encoding of key') -119 return str(b) -
120 -
121 - def write_private_key_file(self, filename, password=None): -
122 self._write_private_key_file('RSA', filename, self._encode_key(), password) -
123 -
124 - def write_private_key(self, file_obj, password=None): -
125 self._write_private_key('RSA', file_obj, self._encode_key(), password) -
126 -
127 - def generate(bits, progress_func=None): -
128 """ -129 Generate a new private RSA key. This factory function can be used to -130 generate a new host key or authentication key. -131 -132 @param bits: number of bits the generated key should be. -133 @type bits: int -134 @param progress_func: an optional function to call at key points in -135 key generation (used by C{pyCrypto.PublicKey}). -136 @type progress_func: function -137 @return: new private key -138 @rtype: L{RSAKey} -139 """ -140 rsa = RSA.generate(bits, rng.read, progress_func) -141 key = RSAKey(vals=(rsa.e, rsa.n)) -142 key.d = rsa.d -143 key.p = rsa.p -144 key.q = rsa.q -145 return key -
146 generate = staticmethod(generate) -147 -148 -149 ### internals... -150 -151 -
152 - def _pkcs1imify(self, data): -
153 """ -154 turn a 20-byte SHA1 hash into a blob of data as large as the key's N, -155 using PKCS1's \"emsa-pkcs1-v1_5\" encoding. totally bizarre. -156 """ -157 SHA1_DIGESTINFO = '\x30\x21\x30\x09\x06\x05\x2b\x0e\x03\x02\x1a\x05\x00\x04\x14' -158 size = len(util.deflate_long(self.n, 0)) -159 filler = '\xff' * (size - len(SHA1_DIGESTINFO) - len(data) - 3) -160 return '\x00\x01' + filler + '\x00' + SHA1_DIGESTINFO + data -
161 -
162 - def _from_private_key_file(self, filename, password): -
163 data = self._read_private_key_file('RSA', filename, password) -164 self._decode_key(data) -
165 -
166 - def _from_private_key(self, file_obj, password): -
167 data = self._read_private_key('RSA', file_obj, password) -168 self._decode_key(data) -
169 -
170 - def _decode_key(self, data): -
171 # private key file contains: -172 # RSAPrivateKey = { version = 0, n, e, d, p, q, d mod p-1, d mod q-1, q**-1 mod p } -173 try: -174 keylist = BER(data).decode() -175 except BERException: -176 raise SSHException('Unable to parse key file') -177 if (type(keylist) is not list) or (len(keylist) < 4) or (keylist[0] != 0): -178 raise SSHException('Not a valid RSA private key file (bad ber encoding)') -179 self.n = keylist[1] -180 self.e = keylist[2] -181 self.d = keylist[3] -182 # not really needed -183 self.p = keylist[4] -184 self.q = keylist[5] -185 self.size = util.bit_length(self.n) -
186 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.server-module.html b/docs/paramiko.server-module.html deleted file mode 100644 index 0583da6..0000000 --- a/docs/paramiko.server-module.html +++ /dev/null @@ -1,533 +0,0 @@ - - - - - paramiko.server - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module server - - - - - -
[frames] | no frames]
-
- -

Module server

source code

-

ServerInterface is an interface to override for server - support.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Variables
-   - - AUTH_FAILED = 2 -
-   - - AUTH_PARTIALLY_SUCCESSFUL = 1 -
-   - - AUTH_SUCCESSFUL = 0 -
-   - - CONNECTION_FAILED_CODE = {1: 'Administratively prohibited', 2:... -
-   - - CRITICAL = 50 -
-   - - DEBUG = 10 -
-   - - DISCONNECT_AUTH_CANCELLED_BY_USER = 13 -
-   - - DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14 -
-   - - DISCONNECT_SERVICE_NOT_AVAILABLE = 7 -
-   - - ERROR = 40 -
-   - - INFO = 20 -
-   - - MSG_CHANNEL_CLOSE = 97 -
-   - - MSG_CHANNEL_DATA = 94 -
-   - - MSG_CHANNEL_EOF = 96 -
-   - - MSG_CHANNEL_EXTENDED_DATA = 95 -
-   - - MSG_CHANNEL_FAILURE = 100 -
-   - - MSG_CHANNEL_OPEN = 90 -
-   - - MSG_CHANNEL_OPEN_FAILURE = 92 -
-   - - MSG_CHANNEL_OPEN_SUCCESS = 91 -
-   - - MSG_CHANNEL_REQUEST = 98 -
-   - - MSG_CHANNEL_SUCCESS = 99 -
-   - - MSG_CHANNEL_WINDOW_ADJUST = 93 -
-   - - MSG_DEBUG = 4 -
-   - - MSG_DISCONNECT = 1 -
-   - - MSG_GLOBAL_REQUEST = 80 -
-   - - MSG_IGNORE = 2 -
-   - - MSG_KEXINIT = 20 -
-   - - MSG_NAMES = {1: 'disconnect', 2: 'ignore', 3: 'unimplemented',... -
-   - - MSG_NEWKEYS = 21 -
-   - - MSG_REQUEST_FAILURE = 82 -
-   - - MSG_REQUEST_SUCCESS = 81 -
-   - - MSG_SERVICE_ACCEPT = 6 -
-   - - MSG_SERVICE_REQUEST = 5 -
-   - - MSG_UNIMPLEMENTED = 3 -
-   - - MSG_USERAUTH_BANNER = 53 -
-   - - MSG_USERAUTH_FAILURE = 51 -
-   - - MSG_USERAUTH_INFO_REQUEST = 60 -
-   - - MSG_USERAUTH_INFO_RESPONSE = 61 -
-   - - MSG_USERAUTH_PK_OK = 60 -
-   - - MSG_USERAUTH_REQUEST = 50 -
-   - - MSG_USERAUTH_SUCCESS = 52 -
-   - - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED = 1 -
-   - - OPEN_FAILED_CONNECT_FAILED = 2 -
-   - - OPEN_FAILED_RESOURCE_SHORTAGE = 4 -
-   - - OPEN_FAILED_UNKNOWN_CHANNEL_TYPE = 3 -
-   - - OPEN_SUCCEEDED = 0 -
-   - - PY22 = False -
-   - - WARNING = 30 -
-   - - __package__ = 'paramiko' -
-   - - rng = Random.new() -
- - - - - - -
- Variables Details
- -
- -
-

CONNECTION_FAILED_CODE

- -
-
-
-
Value:
-
-{1: 'Administratively prohibited',
- 2: 'Connect failed',
- 3: 'Unknown channel type',
- 4: 'Resource shortage'}
-
-
-
-
-
- -
- -
-

MSG_NAMES

- -
-
-
-
Value:
-
-{1: 'disconnect',
- 2: 'ignore',
- 3: 'unimplemented',
- 4: 'debug',
- 5: 'service-request',
- 6: 'service-accept',
- 20: 'kexinit',
- 21: 'newkeys',
-...
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.server-pysrc.html b/docs/paramiko.server-pysrc.html deleted file mode 100644 index 87a9294..0000000 --- a/docs/paramiko.server-pysrc.html +++ /dev/null @@ -1,1006 +0,0 @@ - - - - - paramiko.server - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module server - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.server

-
-  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  L{ServerInterface} is an interface to override for server support. 
- 21  """ 
- 22   
- 23  import threading 
- 24  from paramiko.common import * 
- 25  from paramiko import util 
- 26   
- 27   
-
28 -class InteractiveQuery (object): -
29 """ - 30 A query (set of prompts) for a user during interactive authentication. - 31 """ - 32 -
33 - def __init__(self, name='', instructions='', *prompts): -
34 """ - 35 Create a new interactive query to send to the client. The name and - 36 instructions are optional, but are generally displayed to the end - 37 user. A list of prompts may be included, or they may be added via - 38 the L{add_prompt} method. - 39 - 40 @param name: name of this query - 41 @type name: str - 42 @param instructions: user instructions (usually short) about this query - 43 @type instructions: str - 44 @param prompts: one or more authentication prompts - 45 @type prompts: str - 46 """ - 47 self.name = name - 48 self.instructions = instructions - 49 self.prompts = [] - 50 for x in prompts: - 51 if (type(x) is str) or (type(x) is unicode): - 52 self.add_prompt(x) - 53 else: - 54 self.add_prompt(x[0], x[1]) -
55 -
56 - def add_prompt(self, prompt, echo=True): -
57 """ - 58 Add a prompt to this query. The prompt should be a (reasonably short) - 59 string. Multiple prompts can be added to the same query. - 60 - 61 @param prompt: the user prompt - 62 @type prompt: str - 63 @param echo: C{True} (default) if the user's response should be echoed; - 64 C{False} if not (for a password or similar) - 65 @type echo: bool - 66 """ - 67 self.prompts.append((prompt, echo)) -
68 - 69 -
70 -class ServerInterface (object): -
71 """ - 72 This class defines an interface for controlling the behavior of paramiko - 73 in server mode. - 74 - 75 Methods on this class are called from paramiko's primary thread, so you - 76 shouldn't do too much work in them. (Certainly nothing that blocks or - 77 sleeps.) - 78 """ - 79 -
80 - def check_channel_request(self, kind, chanid): -
81 """ - 82 Determine if a channel request of a given type will be granted, and - 83 return C{OPEN_SUCCEEDED} or an error code. This method is - 84 called in server mode when the client requests a channel, after - 85 authentication is complete. - 86 - 87 If you allow channel requests (and an ssh server that didn't would be - 88 useless), you should also override some of the channel request methods - 89 below, which are used to determine which services will be allowed on - 90 a given channel: - 91 - L{check_channel_pty_request} - 92 - L{check_channel_shell_request} - 93 - L{check_channel_subsystem_request} - 94 - L{check_channel_window_change_request} - 95 - L{check_channel_x11_request} - 96 - 97 The C{chanid} parameter is a small number that uniquely identifies the - 98 channel within a L{Transport}. A L{Channel} object is not created - 99 unless this method returns C{OPEN_SUCCEEDED} -- once a -100 L{Channel} object is created, you can call L{Channel.get_id} to -101 retrieve the channel ID. -102 -103 The return value should either be C{OPEN_SUCCEEDED} (or -104 C{0}) to allow the channel request, or one of the following error -105 codes to reject it: -106 - C{OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED} -107 - C{OPEN_FAILED_CONNECT_FAILED} -108 - C{OPEN_FAILED_UNKNOWN_CHANNEL_TYPE} -109 - C{OPEN_FAILED_RESOURCE_SHORTAGE} -110 -111 The default implementation always returns -112 C{OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED}. -113 -114 @param kind: the kind of channel the client would like to open -115 (usually C{"session"}). -116 @type kind: str -117 @param chanid: ID of the channel -118 @type chanid: int -119 @return: a success or failure code (listed above) -120 @rtype: int -121 """ -122 return OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -
123 -
124 - def get_allowed_auths(self, username): -
125 """ -126 Return a list of authentication methods supported by the server. -127 This list is sent to clients attempting to authenticate, to inform them -128 of authentication methods that might be successful. -129 -130 The "list" is actually a string of comma-separated names of types of -131 authentication. Possible values are C{"password"}, C{"publickey"}, -132 and C{"none"}. -133 -134 The default implementation always returns C{"password"}. -135 -136 @param username: the username requesting authentication. -137 @type username: str -138 @return: a comma-separated list of authentication types -139 @rtype: str -140 """ -141 return 'password' -
142 -
143 - def check_auth_none(self, username): -
144 """ -145 Determine if a client may open channels with no (further) -146 authentication. -147 -148 Return L{AUTH_FAILED} if the client must authenticate, or -149 L{AUTH_SUCCESSFUL} if it's okay for the client to not -150 authenticate. -151 -152 The default implementation always returns L{AUTH_FAILED}. -153 -154 @param username: the username of the client. -155 @type username: str -156 @return: L{AUTH_FAILED} if the authentication fails; -157 L{AUTH_SUCCESSFUL} if it succeeds. -158 @rtype: int -159 """ -160 return AUTH_FAILED -
161 -
162 - def check_auth_password(self, username, password): -
163 """ -164 Determine if a given username and password supplied by the client is -165 acceptable for use in authentication. -166 -167 Return L{AUTH_FAILED} if the password is not accepted, -168 L{AUTH_SUCCESSFUL} if the password is accepted and completes -169 the authentication, or L{AUTH_PARTIALLY_SUCCESSFUL} if your -170 authentication is stateful, and this key is accepted for -171 authentication, but more authentication is required. (In this latter -172 case, L{get_allowed_auths} will be called to report to the client what -173 options it has for continuing the authentication.) -174 -175 The default implementation always returns L{AUTH_FAILED}. -176 -177 @param username: the username of the authenticating client. -178 @type username: str -179 @param password: the password given by the client. -180 @type password: str -181 @return: L{AUTH_FAILED} if the authentication fails; -182 L{AUTH_SUCCESSFUL} if it succeeds; -183 L{AUTH_PARTIALLY_SUCCESSFUL} if the password auth is -184 successful, but authentication must continue. -185 @rtype: int -186 """ -187 return AUTH_FAILED -
188 -
189 - def check_auth_publickey(self, username, key): -
190 """ -191 Determine if a given key supplied by the client is acceptable for use -192 in authentication. You should override this method in server mode to -193 check the username and key and decide if you would accept a signature -194 made using this key. -195 -196 Return L{AUTH_FAILED} if the key is not accepted, -197 L{AUTH_SUCCESSFUL} if the key is accepted and completes the -198 authentication, or L{AUTH_PARTIALLY_SUCCESSFUL} if your -199 authentication is stateful, and this password is accepted for -200 authentication, but more authentication is required. (In this latter -201 case, L{get_allowed_auths} will be called to report to the client what -202 options it has for continuing the authentication.) -203 -204 Note that you don't have to actually verify any key signtature here. -205 If you're willing to accept the key, paramiko will do the work of -206 verifying the client's signature. -207 -208 The default implementation always returns L{AUTH_FAILED}. -209 -210 @param username: the username of the authenticating client -211 @type username: str -212 @param key: the key object provided by the client -213 @type key: L{PKey <pkey.PKey>} -214 @return: L{AUTH_FAILED} if the client can't authenticate -215 with this key; L{AUTH_SUCCESSFUL} if it can; -216 L{AUTH_PARTIALLY_SUCCESSFUL} if it can authenticate with -217 this key but must continue with authentication -218 @rtype: int -219 """ -220 return AUTH_FAILED -
221 -
222 - def check_auth_interactive(self, username, submethods): -
223 """ -224 Begin an interactive authentication challenge, if supported. You -225 should override this method in server mode if you want to support the -226 C{"keyboard-interactive"} auth type, which requires you to send a -227 series of questions for the client to answer. -228 -229 Return L{AUTH_FAILED} if this auth method isn't supported. Otherwise, -230 you should return an L{InteractiveQuery} object containing the prompts -231 and instructions for the user. The response will be sent via a call -232 to L{check_auth_interactive_response}. -233 -234 The default implementation always returns L{AUTH_FAILED}. -235 -236 @param username: the username of the authenticating client -237 @type username: str -238 @param submethods: a comma-separated list of methods preferred by the -239 client (usually empty) -240 @type submethods: str -241 @return: L{AUTH_FAILED} if this auth method isn't supported; otherwise -242 an object containing queries for the user -243 @rtype: int or L{InteractiveQuery} -244 """ -245 return AUTH_FAILED -
246 -
247 - def check_auth_interactive_response(self, responses): -
248 """ -249 Continue or finish an interactive authentication challenge, if -250 supported. You should override this method in server mode if you want -251 to support the C{"keyboard-interactive"} auth type. -252 -253 Return L{AUTH_FAILED} if the responses are not accepted, -254 L{AUTH_SUCCESSFUL} if the responses are accepted and complete -255 the authentication, or L{AUTH_PARTIALLY_SUCCESSFUL} if your -256 authentication is stateful, and this set of responses is accepted for -257 authentication, but more authentication is required. (In this latter -258 case, L{get_allowed_auths} will be called to report to the client what -259 options it has for continuing the authentication.) -260 -261 If you wish to continue interactive authentication with more questions, -262 you may return an L{InteractiveQuery} object, which should cause the -263 client to respond with more answers, calling this method again. This -264 cycle can continue indefinitely. -265 -266 The default implementation always returns L{AUTH_FAILED}. -267 -268 @param responses: list of responses from the client -269 @type responses: list(str) -270 @return: L{AUTH_FAILED} if the authentication fails; -271 L{AUTH_SUCCESSFUL} if it succeeds; -272 L{AUTH_PARTIALLY_SUCCESSFUL} if the interactive auth is -273 successful, but authentication must continue; otherwise an object -274 containing queries for the user -275 @rtype: int or L{InteractiveQuery} -276 """ -277 return AUTH_FAILED -
278 -
279 - def check_port_forward_request(self, address, port): -
280 """ -281 Handle a request for port forwarding. The client is asking that -282 connections to the given address and port be forwarded back across -283 this ssh connection. An address of C{"0.0.0.0"} indicates a global -284 address (any address associated with this server) and a port of C{0} -285 indicates that no specific port is requested (usually the OS will pick -286 a port). -287 -288 The default implementation always returns C{False}, rejecting the -289 port forwarding request. If the request is accepted, you should return -290 the port opened for listening. -291 -292 @param address: the requested address -293 @type address: str -294 @param port: the requested port -295 @type port: int -296 @return: the port number that was opened for listening, or C{False} to -297 reject -298 @rtype: int -299 """ -300 return False -
301 -
302 - def cancel_port_forward_request(self, address, port): -
303 """ -304 The client would like to cancel a previous port-forwarding request. -305 If the given address and port is being forwarded across this ssh -306 connection, the port should be closed. -307 -308 @param address: the forwarded address -309 @type address: str -310 @param port: the forwarded port -311 @type port: int -312 """ -313 pass -
314 -
315 - def check_global_request(self, kind, msg): -
316 """ -317 Handle a global request of the given C{kind}. This method is called -318 in server mode and client mode, whenever the remote host makes a global -319 request. If there are any arguments to the request, they will be in -320 C{msg}. -321 -322 There aren't any useful global requests defined, aside from port -323 forwarding, so usually this type of request is an extension to the -324 protocol. -325 -326 If the request was successful and you would like to return contextual -327 data to the remote host, return a tuple. Items in the tuple will be -328 sent back with the successful result. (Note that the items in the -329 tuple can only be strings, ints, longs, or bools.) -330 -331 The default implementation always returns C{False}, indicating that it -332 does not support any global requests. -333 -334 @note: Port forwarding requests are handled separately, in -335 L{check_port_forward_request}. -336 -337 @param kind: the kind of global request being made. -338 @type kind: str -339 @param msg: any extra arguments to the request. -340 @type msg: L{Message} -341 @return: C{True} or a tuple of data if the request was granted; -342 C{False} otherwise. -343 @rtype: bool -344 """ -345 return False -
346 -347 -348 ### Channel requests -349 -350 -
351 - def check_channel_pty_request(self, channel, term, width, height, pixelwidth, pixelheight, -352 modes): -
353 """ -354 Determine if a pseudo-terminal of the given dimensions (usually -355 requested for shell access) can be provided on the given channel. -356 -357 The default implementation always returns C{False}. -358 -359 @param channel: the L{Channel} the pty request arrived on. -360 @type channel: L{Channel} -361 @param term: type of terminal requested (for example, C{"vt100"}). -362 @type term: str -363 @param width: width of screen in characters. -364 @type width: int -365 @param height: height of screen in characters. -366 @type height: int -367 @param pixelwidth: width of screen in pixels, if known (may be C{0} if -368 unknown). -369 @type pixelwidth: int -370 @param pixelheight: height of screen in pixels, if known (may be C{0} -371 if unknown). -372 @type pixelheight: int -373 @return: C{True} if the psuedo-terminal has been allocated; C{False} -374 otherwise. -375 @rtype: bool -376 """ -377 return False -
378 -
379 - def check_channel_shell_request(self, channel): -
380 """ -381 Determine if a shell will be provided to the client on the given -382 channel. If this method returns C{True}, the channel should be -383 connected to the stdin/stdout of a shell (or something that acts like -384 a shell). -385 -386 The default implementation always returns C{False}. -387 -388 @param channel: the L{Channel} the request arrived on. -389 @type channel: L{Channel} -390 @return: C{True} if this channel is now hooked up to a shell; C{False} -391 if a shell can't or won't be provided. -392 @rtype: bool -393 """ -394 return False -
395 -
396 - def check_channel_exec_request(self, channel, command): -
397 """ -398 Determine if a shell command will be executed for the client. If this -399 method returns C{True}, the channel should be connected to the stdin, -400 stdout, and stderr of the shell command. -401 -402 The default implementation always returns C{False}. -403 -404 @param channel: the L{Channel} the request arrived on. -405 @type channel: L{Channel} -406 @param command: the command to execute. -407 @type command: str -408 @return: C{True} if this channel is now hooked up to the stdin, -409 stdout, and stderr of the executing command; C{False} if the -410 command will not be executed. -411 @rtype: bool -412 -413 @since: 1.1 -414 """ -415 return False -
416 -
417 - def check_channel_subsystem_request(self, channel, name): -
418 """ -419 Determine if a requested subsystem will be provided to the client on -420 the given channel. If this method returns C{True}, all future I/O -421 through this channel will be assumed to be connected to the requested -422 subsystem. An example of a subsystem is C{sftp}. -423 -424 The default implementation checks for a subsystem handler assigned via -425 L{Transport.set_subsystem_handler}. -426 If one has been set, the handler is invoked and this method returns -427 C{True}. Otherwise it returns C{False}. -428 -429 @note: Because the default implementation uses the L{Transport} to -430 identify valid subsystems, you probably won't need to override this -431 method. -432 -433 @param channel: the L{Channel} the pty request arrived on. -434 @type channel: L{Channel} -435 @param name: name of the requested subsystem. -436 @type name: str -437 @return: C{True} if this channel is now hooked up to the requested -438 subsystem; C{False} if that subsystem can't or won't be provided. -439 @rtype: bool -440 """ -441 handler_class, larg, kwarg = channel.get_transport()._get_subsystem_handler(name) -442 if handler_class is None: -443 return False -444 handler = handler_class(channel, name, self, *larg, **kwarg) -445 handler.start() -446 return True -
447 -
448 - def check_channel_window_change_request(self, channel, width, height, pixelwidth, pixelheight): -
449 """ -450 Determine if the pseudo-terminal on the given channel can be resized. -451 This only makes sense if a pty was previously allocated on it. -452 -453 The default implementation always returns C{False}. -454 -455 @param channel: the L{Channel} the pty request arrived on. -456 @type channel: L{Channel} -457 @param width: width of screen in characters. -458 @type width: int -459 @param height: height of screen in characters. -460 @type height: int -461 @param pixelwidth: width of screen in pixels, if known (may be C{0} if -462 unknown). -463 @type pixelwidth: int -464 @param pixelheight: height of screen in pixels, if known (may be C{0} -465 if unknown). -466 @type pixelheight: int -467 @return: C{True} if the terminal was resized; C{False} if not. -468 @rtype: bool -469 """ -470 return False -
471 -
472 - def check_channel_x11_request(self, channel, single_connection, auth_protocol, auth_cookie, screen_number): -
473 """ -474 Determine if the client will be provided with an X11 session. If this -475 method returns C{True}, X11 applications should be routed through new -476 SSH channels, using L{Transport.open_x11_channel}. -477 -478 The default implementation always returns C{False}. -479 -480 @param channel: the L{Channel} the X11 request arrived on -481 @type channel: L{Channel} -482 @param single_connection: C{True} if only a single X11 channel should -483 be opened -484 @type single_connection: bool -485 @param auth_protocol: the protocol used for X11 authentication -486 @type auth_protocol: str -487 @param auth_cookie: the cookie used to authenticate to X11 -488 @type auth_cookie: str -489 @param screen_number: the number of the X11 screen to connect to -490 @type screen_number: int -491 @return: C{True} if the X11 session was opened; C{False} if not -492 @rtype: bool -493 """ -494 return False -
495 -
496 - def check_channel_direct_tcpip_request(self, chanid, origin, destination): -
497 """ -498 Determine if a local port forwarding channel will be granted, and -499 return C{OPEN_SUCCEEDED} or an error code. This method is -500 called in server mode when the client requests a channel, after -501 authentication is complete. -502 -503 The C{chanid} parameter is a small number that uniquely identifies the -504 channel within a L{Transport}. A L{Channel} object is not created -505 unless this method returns C{OPEN_SUCCEEDED} -- once a -506 L{Channel} object is created, you can call L{Channel.get_id} to -507 retrieve the channel ID. -508 -509 The origin and destination parameters are (ip_address, port) tuples -510 that correspond to both ends of the TCP connection in the forwarding -511 tunnel. -512 -513 The return value should either be C{OPEN_SUCCEEDED} (or -514 C{0}) to allow the channel request, or one of the following error -515 codes to reject it: -516 - C{OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED} -517 - C{OPEN_FAILED_CONNECT_FAILED} -518 - C{OPEN_FAILED_UNKNOWN_CHANNEL_TYPE} -519 - C{OPEN_FAILED_RESOURCE_SHORTAGE} -520 -521 The default implementation always returns -522 C{OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED}. -523 -524 @param chanid: ID of the channel -525 @type chanid: int -526 @param origin: 2-tuple containing the IP address and port of the -527 originator (client side) -528 @type origin: tuple -529 @param destination: 2-tuple containing the IP address and port of the -530 destination (server side) -531 @type destination: tuple -532 @return: a success or failure code (listed above) -533 @rtype: int -534 """ -535 return OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -
536 -537 -
538 -class SubsystemHandler (threading.Thread): -
539 """ -540 Handler for a subsytem in server mode. If you create a subclass of this -541 class and pass it to -542 L{Transport.set_subsystem_handler}, -543 an object of this -544 class will be created for each request for this subsystem. Each new object -545 will be executed within its own new thread by calling L{start_subsystem}. -546 When that method completes, the channel is closed. -547 -548 For example, if you made a subclass C{MP3Handler} and registered it as the -549 handler for subsystem C{"mp3"}, then whenever a client has successfully -550 authenticated and requests subsytem C{"mp3"}, an object of class -551 C{MP3Handler} will be created, and L{start_subsystem} will be called on -552 it from a new thread. -553 """ -
554 - def __init__(self, channel, name, server): -
555 """ -556 Create a new handler for a channel. This is used by L{ServerInterface} -557 to start up a new handler when a channel requests this subsystem. You -558 don't need to override this method, but if you do, be sure to pass the -559 C{channel} and C{name} parameters through to the original C{__init__} -560 method here. -561 -562 @param channel: the channel associated with this subsystem request. -563 @type channel: L{Channel} -564 @param name: name of the requested subsystem. -565 @type name: str -566 @param server: the server object for the session that started this -567 subsystem -568 @type server: L{ServerInterface} -569 """ -570 threading.Thread.__init__(self, target=self._run) -571 self.__channel = channel -572 self.__transport = channel.get_transport() -573 self.__name = name -574 self.__server = server -
575 -
576 - def get_server(self): -
577 """ -578 Return the L{ServerInterface} object associated with this channel and -579 subsystem. -580 -581 @rtype: L{ServerInterface} -582 """ -583 return self.__server -
584 -
585 - def _run(self): -
586 try: -587 self.__transport._log(DEBUG, 'Starting handler for subsystem %s' % self.__name) -588 self.start_subsystem(self.__name, self.__transport, self.__channel) -589 except Exception, e: -590 self.__transport._log(ERROR, 'Exception in subsystem handler for "%s": %s' % -591 (self.__name, str(e))) -592 self.__transport._log(ERROR, util.tb_strings()) -593 try: -594 self.finish_subsystem() -595 except: -596 pass -
597 -
598 - def start_subsystem(self, name, transport, channel): -
599 """ -600 Process an ssh subsystem in server mode. This method is called on a -601 new object (and in a new thread) for each subsystem request. It is -602 assumed that all subsystem logic will take place here, and when the -603 subsystem is finished, this method will return. After this method -604 returns, the channel is closed. -605 -606 The combination of C{transport} and C{channel} are unique; this handler -607 corresponds to exactly one L{Channel} on one L{Transport}. -608 -609 @note: It is the responsibility of this method to exit if the -610 underlying L{Transport} is closed. This can be done by checking -611 L{Transport.is_active} or noticing an EOF -612 on the L{Channel}. If this method loops forever without checking -613 for this case, your python interpreter may refuse to exit because -614 this thread will still be running. -615 -616 @param name: name of the requested subsystem. -617 @type name: str -618 @param transport: the server-mode L{Transport}. -619 @type transport: L{Transport} -620 @param channel: the channel associated with this subsystem request. -621 @type channel: L{Channel} -622 """ -623 pass -
624 -
625 - def finish_subsystem(self): -
626 """ -627 Perform any cleanup at the end of a subsystem. The default -628 implementation just closes the channel. -629 -630 @since: 1.1 -631 """ -632 self.__channel.close() -
633 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.sftp-module.html b/docs/paramiko.sftp-module.html deleted file mode 100644 index 98d25d5..0000000 --- a/docs/paramiko.sftp-module.html +++ /dev/null @@ -1,905 +0,0 @@ - - - - - paramiko.sftp - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp - - - - - -
[frames] | no frames]
-
- -

Module sftp

source code

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Variables
-   - - SFTP_OK = 0 -
-   - - SFTP_DESC = ['Success', 'End of file', 'No such file', 'Permis... -
-   - - SFTP_FLAG_READ = 1 -
-   - - SFTP_FLAG_WRITE = 2 -
-   - - SFTP_FLAG_APPEND = 4 -
-   - - SFTP_FLAG_CREATE = 8 -
-   - - SFTP_FLAG_TRUNC = 16 -
-   - - SFTP_FLAG_EXCL = 32 -
-   - - CMD_NAMES = {1: 'init', 2: 'version', 3: 'open', 4: 'close', 5... -
-   - - AUTH_FAILED = 2 -
-   - - AUTH_PARTIALLY_SUCCESSFUL = 1 -
-   - - AUTH_SUCCESSFUL = 0 -
-   - - CMD_ATTRS = 105 -
-   - - CMD_CLOSE = 4 -
-   - - CMD_DATA = 103 -
-   - - CMD_EXTENDED = 200 -
-   - - CMD_EXTENDED_REPLY = 201 -
-   - - CMD_FSETSTAT = 10 -
-   - - CMD_FSTAT = 8 -
-   - - CMD_HANDLE = 102 -
-   - - CMD_INIT = 1 -
-   - - CMD_LSTAT = 7 -
-   - - CMD_MKDIR = 14 -
-   - - CMD_NAME = 104 -
-   - - CMD_OPEN = 3 -
-   - - CMD_OPENDIR = 11 -
-   - - CMD_READ = 5 -
-   - - CMD_READDIR = 12 -
-   - - CMD_READLINK = 19 -
-   - - CMD_REALPATH = 16 -
-   - - CMD_REMOVE = 13 -
-   - - CMD_RENAME = 18 -
-   - - CMD_RMDIR = 15 -
-   - - CMD_SETSTAT = 9 -
-   - - CMD_STAT = 17 -
-   - - CMD_STATUS = 101 -
-   - - CMD_SYMLINK = 20 -
-   - - CMD_VERSION = 2 -
-   - - CMD_WRITE = 6 -
-   - - CONNECTION_FAILED_CODE = {1: 'Administratively prohibited', 2:... -
-   - - CRITICAL = 50 -
-   - - DEBUG = 10 -
-   - - DISCONNECT_AUTH_CANCELLED_BY_USER = 13 -
-   - - DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14 -
-   - - DISCONNECT_SERVICE_NOT_AVAILABLE = 7 -
-   - - ERROR = 40 -
-   - - INFO = 20 -
-   - - MSG_CHANNEL_CLOSE = 97 -
-   - - MSG_CHANNEL_DATA = 94 -
-   - - MSG_CHANNEL_EOF = 96 -
-   - - MSG_CHANNEL_EXTENDED_DATA = 95 -
-   - - MSG_CHANNEL_FAILURE = 100 -
-   - - MSG_CHANNEL_OPEN = 90 -
-   - - MSG_CHANNEL_OPEN_FAILURE = 92 -
-   - - MSG_CHANNEL_OPEN_SUCCESS = 91 -
-   - - MSG_CHANNEL_REQUEST = 98 -
-   - - MSG_CHANNEL_SUCCESS = 99 -
-   - - MSG_CHANNEL_WINDOW_ADJUST = 93 -
-   - - MSG_DEBUG = 4 -
-   - - MSG_DISCONNECT = 1 -
-   - - MSG_GLOBAL_REQUEST = 80 -
-   - - MSG_IGNORE = 2 -
-   - - MSG_KEXINIT = 20 -
-   - - MSG_NAMES = {1: 'disconnect', 2: 'ignore', 3: 'unimplemented',... -
-   - - MSG_NEWKEYS = 21 -
-   - - MSG_REQUEST_FAILURE = 82 -
-   - - MSG_REQUEST_SUCCESS = 81 -
-   - - MSG_SERVICE_ACCEPT = 6 -
-   - - MSG_SERVICE_REQUEST = 5 -
-   - - MSG_UNIMPLEMENTED = 3 -
-   - - MSG_USERAUTH_BANNER = 53 -
-   - - MSG_USERAUTH_FAILURE = 51 -
-   - - MSG_USERAUTH_INFO_REQUEST = 60 -
-   - - MSG_USERAUTH_INFO_RESPONSE = 61 -
-   - - MSG_USERAUTH_PK_OK = 60 -
-   - - MSG_USERAUTH_REQUEST = 50 -
-   - - MSG_USERAUTH_SUCCESS = 52 -
-   - - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED = 1 -
-   - - OPEN_FAILED_CONNECT_FAILED = 2 -
-   - - OPEN_FAILED_RESOURCE_SHORTAGE = 4 -
-   - - OPEN_FAILED_UNKNOWN_CHANNEL_TYPE = 3 -
-   - - OPEN_SUCCEEDED = 0 -
-   - - PY22 = False -
-   - - SFTP_BAD_MESSAGE = 5 -
-   - - SFTP_CONNECTION_LOST = 7 -
-   - - SFTP_EOF = 1 -
-   - - SFTP_FAILURE = 4 -
-   - - SFTP_NO_CONNECTION = 6 -
-   - - SFTP_NO_SUCH_FILE = 2 -
-   - - SFTP_OP_UNSUPPORTED = 8 -
-   - - SFTP_PERMISSION_DENIED = 3 -
-   - - WARNING = 30 -
-   - - __package__ = 'paramiko' -
-   - - rng = Random.new() -
- - - - - - -
- Variables Details
- -
- -
-

SFTP_DESC

- -
-
-
-
Value:
-
-['Success',
- 'End of file',
- 'No such file',
- 'Permission denied',
- 'Failure',
- 'Bad message',
- 'No connection',
- 'Connection lost',
-...
-
-
-
-
-
- -
- -
-

CMD_NAMES

- -
-
-
-
Value:
-
-{1: 'init',
- 2: 'version',
- 3: 'open',
- 4: 'close',
- 5: 'read',
- 6: 'write',
- 7: 'lstat',
- 8: 'fstat',
-...
-
-
-
-
-
- -
- -
-

CONNECTION_FAILED_CODE

- -
-
-
-
Value:
-
-{1: 'Administratively prohibited',
- 2: 'Connect failed',
- 3: 'Unknown channel type',
- 4: 'Resource shortage'}
-
-
-
-
-
- -
- -
-

MSG_NAMES

- -
-
-
-
Value:
-
-{1: 'disconnect',
- 2: 'ignore',
- 3: 'unimplemented',
- 4: 'debug',
- 5: 'service-request',
- 6: 'service-accept',
- 20: 'kexinit',
- 21: 'newkeys',
-...
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.sftp-pysrc.html b/docs/paramiko.sftp-pysrc.html deleted file mode 100644 index c01fb55..0000000 --- a/docs/paramiko.sftp-pysrc.html +++ /dev/null @@ -1,798 +0,0 @@ - - - - - paramiko.sftp - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.sftp

-
-  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  import select 
- 20  import socket 
- 21  import struct 
- 22   
- 23  from paramiko.common import * 
- 24  from paramiko import util 
- 25  from paramiko.channel import Channel 
- 26  from paramiko.message import Message 
- 27   
- 28   
- 29  CMD_INIT, CMD_VERSION, CMD_OPEN, CMD_CLOSE, CMD_READ, CMD_WRITE, CMD_LSTAT, CMD_FSTAT, \ 
- 30             CMD_SETSTAT, CMD_FSETSTAT, CMD_OPENDIR, CMD_READDIR, CMD_REMOVE, CMD_MKDIR, \ 
- 31             CMD_RMDIR, CMD_REALPATH, CMD_STAT, CMD_RENAME, CMD_READLINK, CMD_SYMLINK \ 
- 32             = range(1, 21) 
- 33  CMD_STATUS, CMD_HANDLE, CMD_DATA, CMD_NAME, CMD_ATTRS = range(101, 106) 
- 34  CMD_EXTENDED, CMD_EXTENDED_REPLY = range(200, 202) 
- 35   
- 36  SFTP_OK = 0 
- 37  SFTP_EOF, SFTP_NO_SUCH_FILE, SFTP_PERMISSION_DENIED, SFTP_FAILURE, SFTP_BAD_MESSAGE, \ 
- 38           SFTP_NO_CONNECTION, SFTP_CONNECTION_LOST, SFTP_OP_UNSUPPORTED = range(1, 9) 
- 39   
- 40  SFTP_DESC = [ 'Success', 
- 41                'End of file', 
- 42                'No such file', 
- 43                'Permission denied', 
- 44                'Failure', 
- 45                'Bad message', 
- 46                'No connection', 
- 47                'Connection lost', 
- 48                'Operation unsupported' ] 
- 49   
- 50  SFTP_FLAG_READ = 0x1 
- 51  SFTP_FLAG_WRITE = 0x2 
- 52  SFTP_FLAG_APPEND = 0x4 
- 53  SFTP_FLAG_CREATE = 0x8 
- 54  SFTP_FLAG_TRUNC = 0x10 
- 55  SFTP_FLAG_EXCL = 0x20 
- 56   
- 57  _VERSION = 3 
- 58   
- 59   
- 60  # for debugging 
- 61  CMD_NAMES = { 
- 62      CMD_INIT: 'init', 
- 63      CMD_VERSION: 'version', 
- 64      CMD_OPEN: 'open', 
- 65      CMD_CLOSE: 'close', 
- 66      CMD_READ: 'read', 
- 67      CMD_WRITE: 'write', 
- 68      CMD_LSTAT: 'lstat', 
- 69      CMD_FSTAT: 'fstat', 
- 70      CMD_SETSTAT: 'setstat', 
- 71      CMD_FSETSTAT: 'fsetstat', 
- 72      CMD_OPENDIR: 'opendir', 
- 73      CMD_READDIR: 'readdir', 
- 74      CMD_REMOVE: 'remove', 
- 75      CMD_MKDIR: 'mkdir', 
- 76      CMD_RMDIR: 'rmdir', 
- 77      CMD_REALPATH: 'realpath', 
- 78      CMD_STAT: 'stat', 
- 79      CMD_RENAME: 'rename', 
- 80      CMD_READLINK: 'readlink', 
- 81      CMD_SYMLINK: 'symlink', 
- 82      CMD_STATUS: 'status', 
- 83      CMD_HANDLE: 'handle', 
- 84      CMD_DATA: 'data', 
- 85      CMD_NAME: 'name', 
- 86      CMD_ATTRS: 'attrs', 
- 87      CMD_EXTENDED: 'extended', 
- 88      CMD_EXTENDED_REPLY: 'extended_reply' 
- 89      } 
- 90   
- 91   
-
92 -class SFTPError (Exception): -
93 pass -
94 - 95 -
96 -class BaseSFTP (object): -
97 - def __init__(self): -
98 self.logger = util.get_logger('paramiko.sftp') - 99 self.sock = None -100 self.ultra_debug = False -
101 -102 -103 ### internals... -104 -105 -
106 - def _send_version(self): -
107 self._send_packet(CMD_INIT, struct.pack('>I', _VERSION)) -108 t, data = self._read_packet() -109 if t != CMD_VERSION: -110 raise SFTPError('Incompatible sftp protocol') -111 version = struct.unpack('>I', data[:4])[0] -112 # if version != _VERSION: -113 # raise SFTPError('Incompatible sftp protocol') -114 return version -
115 -
116 - def _send_server_version(self): -
117 # winscp will freak out if the server sends version info before the -118 # client finishes sending INIT. -119 t, data = self._read_packet() -120 if t != CMD_INIT: -121 raise SFTPError('Incompatible sftp protocol') -122 version = struct.unpack('>I', data[:4])[0] -123 # advertise that we support "check-file" -124 extension_pairs = [ 'check-file', 'md5,sha1' ] -125 msg = Message() -126 msg.add_int(_VERSION) -127 msg.add(*extension_pairs) -128 self._send_packet(CMD_VERSION, str(msg)) -129 return version -
130 -
131 - def _log(self, level, msg, *args): -
132 self.logger.log(level, msg, *args) -
133 -
134 - def _write_all(self, out): -
135 while len(out) > 0: -136 n = self.sock.send(out) -137 if n <= 0: -138 raise EOFError() -139 if n == len(out): -140 return -141 out = out[n:] -142 return -
143 -
144 - def _read_all(self, n): -
145 out = '' -146 while n > 0: -147 if isinstance(self.sock, socket.socket): -148 # sometimes sftp is used directly over a socket instead of -149 # through a paramiko channel. in this case, check periodically -150 # if the socket is closed. (for some reason, recv() won't ever -151 # return or raise an exception, but calling select on a closed -152 # socket will.) -153 while True: -154 read, write, err = select.select([ self.sock ], [], [], 0.1) -155 if len(read) > 0: -156 x = self.sock.recv(n) -157 break -158 else: -159 x = self.sock.recv(n) -160 -161 if len(x) == 0: -162 raise EOFError() -163 out += x -164 n -= len(x) -165 return out -
166 -
167 - def _send_packet(self, t, packet): -
168 #self._log(DEBUG2, 'write: %s (len=%d)' % (CMD_NAMES.get(t, '0x%02x' % t), len(packet))) -169 out = struct.pack('>I', len(packet) + 1) + chr(t) + packet -170 if self.ultra_debug: -171 self._log(DEBUG, util.format_binary(out, 'OUT: ')) -172 self._write_all(out) -
173 -
174 - def _read_packet(self): -
175 x = self._read_all(4) -176 # most sftp servers won't accept packets larger than about 32k, so -177 # anything with the high byte set (> 16MB) is just garbage. -178 if x[0] != '\x00': -179 raise SFTPError('Garbage packet received') -180 size = struct.unpack('>I', x)[0] -181 data = self._read_all(size) -182 if self.ultra_debug: -183 self._log(DEBUG, util.format_binary(data, 'IN: ')); -184 if size > 0: -185 t = ord(data[0]) -186 #self._log(DEBUG2, 'read: %s (len=%d)' % (CMD_NAMES.get(t), '0x%02x' % t, len(data)-1)) -187 return t, data[1:] -188 return 0, '' -
189 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.sftp_attr-module.html b/docs/paramiko.sftp_attr-module.html deleted file mode 100644 index 72994b1..0000000 --- a/docs/paramiko.sftp_attr-module.html +++ /dev/null @@ -1,905 +0,0 @@ - - - - - paramiko.sftp_attr - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_attr - - - - - -
[frames] | no frames]
-
- -

Module sftp_attr

source code

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Variables
-   - - AUTH_FAILED = 2 -
-   - - AUTH_PARTIALLY_SUCCESSFUL = 1 -
-   - - AUTH_SUCCESSFUL = 0 -
-   - - CMD_ATTRS = 105 -
-   - - CMD_CLOSE = 4 -
-   - - CMD_DATA = 103 -
-   - - CMD_EXTENDED = 200 -
-   - - CMD_EXTENDED_REPLY = 201 -
-   - - CMD_FSETSTAT = 10 -
-   - - CMD_FSTAT = 8 -
-   - - CMD_HANDLE = 102 -
-   - - CMD_INIT = 1 -
-   - - CMD_LSTAT = 7 -
-   - - CMD_MKDIR = 14 -
-   - - CMD_NAME = 104 -
-   - - CMD_NAMES = {1: 'init', 2: 'version', 3: 'open', 4: 'close', 5... -
-   - - CMD_OPEN = 3 -
-   - - CMD_OPENDIR = 11 -
-   - - CMD_READ = 5 -
-   - - CMD_READDIR = 12 -
-   - - CMD_READLINK = 19 -
-   - - CMD_REALPATH = 16 -
-   - - CMD_REMOVE = 13 -
-   - - CMD_RENAME = 18 -
-   - - CMD_RMDIR = 15 -
-   - - CMD_SETSTAT = 9 -
-   - - CMD_STAT = 17 -
-   - - CMD_STATUS = 101 -
-   - - CMD_SYMLINK = 20 -
-   - - CMD_VERSION = 2 -
-   - - CMD_WRITE = 6 -
-   - - CONNECTION_FAILED_CODE = {1: 'Administratively prohibited', 2:... -
-   - - CRITICAL = 50 -
-   - - DEBUG = 10 -
-   - - DISCONNECT_AUTH_CANCELLED_BY_USER = 13 -
-   - - DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14 -
-   - - DISCONNECT_SERVICE_NOT_AVAILABLE = 7 -
-   - - ERROR = 40 -
-   - - INFO = 20 -
-   - - MSG_CHANNEL_CLOSE = 97 -
-   - - MSG_CHANNEL_DATA = 94 -
-   - - MSG_CHANNEL_EOF = 96 -
-   - - MSG_CHANNEL_EXTENDED_DATA = 95 -
-   - - MSG_CHANNEL_FAILURE = 100 -
-   - - MSG_CHANNEL_OPEN = 90 -
-   - - MSG_CHANNEL_OPEN_FAILURE = 92 -
-   - - MSG_CHANNEL_OPEN_SUCCESS = 91 -
-   - - MSG_CHANNEL_REQUEST = 98 -
-   - - MSG_CHANNEL_SUCCESS = 99 -
-   - - MSG_CHANNEL_WINDOW_ADJUST = 93 -
-   - - MSG_DEBUG = 4 -
-   - - MSG_DISCONNECT = 1 -
-   - - MSG_GLOBAL_REQUEST = 80 -
-   - - MSG_IGNORE = 2 -
-   - - MSG_KEXINIT = 20 -
-   - - MSG_NAMES = {1: 'disconnect', 2: 'ignore', 3: 'unimplemented',... -
-   - - MSG_NEWKEYS = 21 -
-   - - MSG_REQUEST_FAILURE = 82 -
-   - - MSG_REQUEST_SUCCESS = 81 -
-   - - MSG_SERVICE_ACCEPT = 6 -
-   - - MSG_SERVICE_REQUEST = 5 -
-   - - MSG_UNIMPLEMENTED = 3 -
-   - - MSG_USERAUTH_BANNER = 53 -
-   - - MSG_USERAUTH_FAILURE = 51 -
-   - - MSG_USERAUTH_INFO_REQUEST = 60 -
-   - - MSG_USERAUTH_INFO_RESPONSE = 61 -
-   - - MSG_USERAUTH_PK_OK = 60 -
-   - - MSG_USERAUTH_REQUEST = 50 -
-   - - MSG_USERAUTH_SUCCESS = 52 -
-   - - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED = 1 -
-   - - OPEN_FAILED_CONNECT_FAILED = 2 -
-   - - OPEN_FAILED_RESOURCE_SHORTAGE = 4 -
-   - - OPEN_FAILED_UNKNOWN_CHANNEL_TYPE = 3 -
-   - - OPEN_SUCCEEDED = 0 -
-   - - PY22 = False -
-   - - SFTP_BAD_MESSAGE = 5 -
-   - - SFTP_CONNECTION_LOST = 7 -
-   - - SFTP_DESC = ['Success', 'End of file', 'No such file', 'Permis... -
-   - - SFTP_EOF = 1 -
-   - - SFTP_FAILURE = 4 -
-   - - SFTP_FLAG_APPEND = 4 -
-   - - SFTP_FLAG_CREATE = 8 -
-   - - SFTP_FLAG_EXCL = 32 -
-   - - SFTP_FLAG_READ = 1 -
-   - - SFTP_FLAG_TRUNC = 16 -
-   - - SFTP_FLAG_WRITE = 2 -
-   - - SFTP_NO_CONNECTION = 6 -
-   - - SFTP_NO_SUCH_FILE = 2 -
-   - - SFTP_OK = 0 -
-   - - SFTP_OP_UNSUPPORTED = 8 -
-   - - SFTP_PERMISSION_DENIED = 3 -
-   - - WARNING = 30 -
-   - - __package__ = 'paramiko' -
-   - - rng = Random.new() -
- - - - - - -
- Variables Details
- -
- -
-

CMD_NAMES

- -
-
-
-
Value:
-
-{1: 'init',
- 2: 'version',
- 3: 'open',
- 4: 'close',
- 5: 'read',
- 6: 'write',
- 7: 'lstat',
- 8: 'fstat',
-...
-
-
-
-
-
- -
- -
-

CONNECTION_FAILED_CODE

- -
-
-
-
Value:
-
-{1: 'Administratively prohibited',
- 2: 'Connect failed',
- 3: 'Unknown channel type',
- 4: 'Resource shortage'}
-
-
-
-
-
- -
- -
-

MSG_NAMES

- -
-
-
-
Value:
-
-{1: 'disconnect',
- 2: 'ignore',
- 3: 'unimplemented',
- 4: 'debug',
- 5: 'service-request',
- 6: 'service-accept',
- 20: 'kexinit',
- 21: 'newkeys',
-...
-
-
-
-
-
- -
- -
-

SFTP_DESC

- -
-
-
-
Value:
-
-['Success',
- 'End of file',
- 'No such file',
- 'Permission denied',
- 'Failure',
- 'Bad message',
- 'No connection',
- 'Connection lost',
-...
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.sftp_attr-pysrc.html b/docs/paramiko.sftp_attr-pysrc.html deleted file mode 100644 index 84af991..0000000 --- a/docs/paramiko.sftp_attr-pysrc.html +++ /dev/null @@ -1,367 +0,0 @@ - - - - - paramiko.sftp_attr - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_attr - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.sftp_attr

-
-  1  # Copyright (C) 2003-2006 Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  import stat 
- 20  import time 
- 21  from paramiko.common import * 
- 22  from paramiko.sftp import * 
- 23   
- 24   
-
25 -class SFTPAttributes (object): -
26 """ - 27 Representation of the attributes of a file (or proxied file) for SFTP in - 28 client or server mode. It attemps to mirror the object returned by - 29 C{os.stat} as closely as possible, so it may have the following fields, - 30 with the same meanings as those returned by an C{os.stat} object: - 31 - st_size - 32 - st_uid - 33 - st_gid - 34 - st_mode - 35 - st_atime - 36 - st_mtime - 37 - 38 Because SFTP allows flags to have other arbitrary named attributes, these - 39 are stored in a dict named C{attr}. Occasionally, the filename is also - 40 stored, in C{filename}. - 41 """ - 42 - 43 FLAG_SIZE = 1 - 44 FLAG_UIDGID = 2 - 45 FLAG_PERMISSIONS = 4 - 46 FLAG_AMTIME = 8 - 47 FLAG_EXTENDED = 0x80000000L - 48 -
49 - def __init__(self): -
50 """ - 51 Create a new (empty) SFTPAttributes object. All fields will be empty. - 52 """ - 53 self._flags = 0 - 54 self.st_size = None - 55 self.st_uid = None - 56 self.st_gid = None - 57 self.st_mode = None - 58 self.st_atime = None - 59 self.st_mtime = None - 60 self.attr = {} -
61 -
62 - def from_stat(cls, obj, filename=None): -
63 """ - 64 Create an SFTPAttributes object from an existing C{stat} object (an - 65 object returned by C{os.stat}). - 66 - 67 @param obj: an object returned by C{os.stat} (or equivalent). - 68 @type obj: object - 69 @param filename: the filename associated with this file. - 70 @type filename: str - 71 @return: new L{SFTPAttributes} object with the same attribute fields. - 72 @rtype: L{SFTPAttributes} - 73 """ - 74 attr = cls() - 75 attr.st_size = obj.st_size - 76 attr.st_uid = obj.st_uid - 77 attr.st_gid = obj.st_gid - 78 attr.st_mode = obj.st_mode - 79 attr.st_atime = obj.st_atime - 80 attr.st_mtime = obj.st_mtime - 81 if filename is not None: - 82 attr.filename = filename - 83 return attr -
84 from_stat = classmethod(from_stat) - 85 -
86 - def __repr__(self): -
87 return '<SFTPAttributes: %s>' % self._debug_str() -
88 - 89 - 90 ### internals... - 91 - 92 -
93 - def _from_msg(cls, msg, filename=None, longname=None): -
94 attr = cls() - 95 attr._unpack(msg) - 96 if filename is not None: - 97 attr.filename = filename - 98 if longname is not None: - 99 attr.longname = longname -100 return attr -
101 _from_msg = classmethod(_from_msg) -102 -
103 - def _unpack(self, msg): -
104 self._flags = msg.get_int() -105 if self._flags & self.FLAG_SIZE: -106 self.st_size = msg.get_int64() -107 if self._flags & self.FLAG_UIDGID: -108 self.st_uid = msg.get_int() -109 self.st_gid = msg.get_int() -110 if self._flags & self.FLAG_PERMISSIONS: -111 self.st_mode = msg.get_int() -112 if self._flags & self.FLAG_AMTIME: -113 self.st_atime = msg.get_int() -114 self.st_mtime = msg.get_int() -115 if self._flags & self.FLAG_EXTENDED: -116 count = msg.get_int() -117 for i in range(count): -118 self.attr[msg.get_string()] = msg.get_string() -
119 -
120 - def _pack(self, msg): -
121 self._flags = 0 -122 if self.st_size is not None: -123 self._flags |= self.FLAG_SIZE -124 if (self.st_uid is not None) and (self.st_gid is not None): -125 self._flags |= self.FLAG_UIDGID -126 if self.st_mode is not None: -127 self._flags |= self.FLAG_PERMISSIONS -128 if (self.st_atime is not None) and (self.st_mtime is not None): -129 self._flags |= self.FLAG_AMTIME -130 if len(self.attr) > 0: -131 self._flags |= self.FLAG_EXTENDED -132 msg.add_int(self._flags) -133 if self._flags & self.FLAG_SIZE: -134 msg.add_int64(self.st_size) -135 if self._flags & self.FLAG_UIDGID: -136 msg.add_int(self.st_uid) -137 msg.add_int(self.st_gid) -138 if self._flags & self.FLAG_PERMISSIONS: -139 msg.add_int(self.st_mode) -140 if self._flags & self.FLAG_AMTIME: -141 # throw away any fractional seconds -142 msg.add_int(long(self.st_atime)) -143 msg.add_int(long(self.st_mtime)) -144 if self._flags & self.FLAG_EXTENDED: -145 msg.add_int(len(self.attr)) -146 for key, val in self.attr.iteritems(): -147 msg.add_string(key) -148 msg.add_string(val) -149 return -
150 -
151 - def _debug_str(self): -
152 out = '[ ' -153 if self.st_size is not None: -154 out += 'size=%d ' % self.st_size -155 if (self.st_uid is not None) and (self.st_gid is not None): -156 out += 'uid=%d gid=%d ' % (self.st_uid, self.st_gid) -157 if self.st_mode is not None: -158 out += 'mode=' + oct(self.st_mode) + ' ' -159 if (self.st_atime is not None) and (self.st_mtime is not None): -160 out += 'atime=%d mtime=%d ' % (self.st_atime, self.st_mtime) -161 for k, v in self.attr.iteritems(): -162 out += '"%s"=%r ' % (str(k), v) -163 out += ']' -164 return out -
165 -
166 - def _rwx(n, suid, sticky=False): -
167 if suid: -168 suid = 2 -169 out = '-r'[n >> 2] + '-w'[(n >> 1) & 1] -170 if sticky: -171 out += '-xTt'[suid + (n & 1)] -172 else: -173 out += '-xSs'[suid + (n & 1)] -174 return out -
175 _rwx = staticmethod(_rwx) -176 -
177 - def __str__(self): -
178 "create a unix-style long description of the file (like ls -l)" -179 if self.st_mode is not None: -180 kind = stat.S_IFMT(self.st_mode) -181 if kind == stat.S_IFIFO: -182 ks = 'p' -183 elif kind == stat.S_IFCHR: -184 ks = 'c' -185 elif kind == stat.S_IFDIR: -186 ks = 'd' -187 elif kind == stat.S_IFBLK: -188 ks = 'b' -189 elif kind == stat.S_IFREG: -190 ks = '-' -191 elif kind == stat.S_IFLNK: -192 ks = 'l' -193 elif kind == stat.S_IFSOCK: -194 ks = 's' -195 else: -196 ks = '?' -197 ks += self._rwx((self.st_mode & 0700) >> 6, self.st_mode & stat.S_ISUID) -198 ks += self._rwx((self.st_mode & 070) >> 3, self.st_mode & stat.S_ISGID) -199 ks += self._rwx(self.st_mode & 7, self.st_mode & stat.S_ISVTX, True) -200 else: -201 ks = '?---------' -202 # compute display date -203 if (self.st_mtime is None) or (self.st_mtime == 0xffffffffL): -204 # shouldn't really happen -205 datestr = '(unknown date)' -206 else: -207 if abs(time.time() - self.st_mtime) > 15552000: -208 # (15552000 = 6 months) -209 datestr = time.strftime('%d %b %Y', time.localtime(self.st_mtime)) -210 else: -211 datestr = time.strftime('%d %b %H:%M', time.localtime(self.st_mtime)) -212 filename = getattr(self, 'filename', '?') -213 -214 # not all servers support uid/gid -215 uid = self.st_uid -216 gid = self.st_gid -217 if uid is None: -218 uid = 0 -219 if gid is None: -220 gid = 0 -221 -222 return '%s 1 %-8d %-8d %8d %-12s %s' % (ks, uid, gid, self.st_size, datestr, filename) -
223 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.sftp_client-module.html b/docs/paramiko.sftp_client-module.html deleted file mode 100644 index 36ac458..0000000 --- a/docs/paramiko.sftp_client-module.html +++ /dev/null @@ -1,907 +0,0 @@ - - - - - paramiko.sftp_client - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_client - - - - - -
[frames] | no frames]
-
- -

Module sftp_client

source code

-

Client-mode SFTP support.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Variables
-   - - AUTH_FAILED = 2 -
-   - - AUTH_PARTIALLY_SUCCESSFUL = 1 -
-   - - AUTH_SUCCESSFUL = 0 -
-   - - CMD_ATTRS = 105 -
-   - - CMD_CLOSE = 4 -
-   - - CMD_DATA = 103 -
-   - - CMD_EXTENDED = 200 -
-   - - CMD_EXTENDED_REPLY = 201 -
-   - - CMD_FSETSTAT = 10 -
-   - - CMD_FSTAT = 8 -
-   - - CMD_HANDLE = 102 -
-   - - CMD_INIT = 1 -
-   - - CMD_LSTAT = 7 -
-   - - CMD_MKDIR = 14 -
-   - - CMD_NAME = 104 -
-   - - CMD_NAMES = {1: 'init', 2: 'version', 3: 'open', 4: 'close', 5... -
-   - - CMD_OPEN = 3 -
-   - - CMD_OPENDIR = 11 -
-   - - CMD_READ = 5 -
-   - - CMD_READDIR = 12 -
-   - - CMD_READLINK = 19 -
-   - - CMD_REALPATH = 16 -
-   - - CMD_REMOVE = 13 -
-   - - CMD_RENAME = 18 -
-   - - CMD_RMDIR = 15 -
-   - - CMD_SETSTAT = 9 -
-   - - CMD_STAT = 17 -
-   - - CMD_STATUS = 101 -
-   - - CMD_SYMLINK = 20 -
-   - - CMD_VERSION = 2 -
-   - - CMD_WRITE = 6 -
-   - - CONNECTION_FAILED_CODE = {1: 'Administratively prohibited', 2:... -
-   - - CRITICAL = 50 -
-   - - DEBUG = 10 -
-   - - DISCONNECT_AUTH_CANCELLED_BY_USER = 13 -
-   - - DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14 -
-   - - DISCONNECT_SERVICE_NOT_AVAILABLE = 7 -
-   - - ERROR = 40 -
-   - - INFO = 20 -
-   - - MSG_CHANNEL_CLOSE = 97 -
-   - - MSG_CHANNEL_DATA = 94 -
-   - - MSG_CHANNEL_EOF = 96 -
-   - - MSG_CHANNEL_EXTENDED_DATA = 95 -
-   - - MSG_CHANNEL_FAILURE = 100 -
-   - - MSG_CHANNEL_OPEN = 90 -
-   - - MSG_CHANNEL_OPEN_FAILURE = 92 -
-   - - MSG_CHANNEL_OPEN_SUCCESS = 91 -
-   - - MSG_CHANNEL_REQUEST = 98 -
-   - - MSG_CHANNEL_SUCCESS = 99 -
-   - - MSG_CHANNEL_WINDOW_ADJUST = 93 -
-   - - MSG_DEBUG = 4 -
-   - - MSG_DISCONNECT = 1 -
-   - - MSG_GLOBAL_REQUEST = 80 -
-   - - MSG_IGNORE = 2 -
-   - - MSG_KEXINIT = 20 -
-   - - MSG_NAMES = {1: 'disconnect', 2: 'ignore', 3: 'unimplemented',... -
-   - - MSG_NEWKEYS = 21 -
-   - - MSG_REQUEST_FAILURE = 82 -
-   - - MSG_REQUEST_SUCCESS = 81 -
-   - - MSG_SERVICE_ACCEPT = 6 -
-   - - MSG_SERVICE_REQUEST = 5 -
-   - - MSG_UNIMPLEMENTED = 3 -
-   - - MSG_USERAUTH_BANNER = 53 -
-   - - MSG_USERAUTH_FAILURE = 51 -
-   - - MSG_USERAUTH_INFO_REQUEST = 60 -
-   - - MSG_USERAUTH_INFO_RESPONSE = 61 -
-   - - MSG_USERAUTH_PK_OK = 60 -
-   - - MSG_USERAUTH_REQUEST = 50 -
-   - - MSG_USERAUTH_SUCCESS = 52 -
-   - - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED = 1 -
-   - - OPEN_FAILED_CONNECT_FAILED = 2 -
-   - - OPEN_FAILED_RESOURCE_SHORTAGE = 4 -
-   - - OPEN_FAILED_UNKNOWN_CHANNEL_TYPE = 3 -
-   - - OPEN_SUCCEEDED = 0 -
-   - - PY22 = False -
-   - - SFTP_BAD_MESSAGE = 5 -
-   - - SFTP_CONNECTION_LOST = 7 -
-   - - SFTP_DESC = ['Success', 'End of file', 'No such file', 'Permis... -
-   - - SFTP_EOF = 1 -
-   - - SFTP_FAILURE = 4 -
-   - - SFTP_FLAG_APPEND = 4 -
-   - - SFTP_FLAG_CREATE = 8 -
-   - - SFTP_FLAG_EXCL = 32 -
-   - - SFTP_FLAG_READ = 1 -
-   - - SFTP_FLAG_TRUNC = 16 -
-   - - SFTP_FLAG_WRITE = 2 -
-   - - SFTP_NO_CONNECTION = 6 -
-   - - SFTP_NO_SUCH_FILE = 2 -
-   - - SFTP_OK = 0 -
-   - - SFTP_OP_UNSUPPORTED = 8 -
-   - - SFTP_PERMISSION_DENIED = 3 -
-   - - WARNING = 30 -
-   - - __package__ = 'paramiko' -
-   - - rng = Random.new() -
- - - - - - -
- Variables Details
- -
- -
-

CMD_NAMES

- -
-
-
-
Value:
-
-{1: 'init',
- 2: 'version',
- 3: 'open',
- 4: 'close',
- 5: 'read',
- 6: 'write',
- 7: 'lstat',
- 8: 'fstat',
-...
-
-
-
-
-
- -
- -
-

CONNECTION_FAILED_CODE

- -
-
-
-
Value:
-
-{1: 'Administratively prohibited',
- 2: 'Connect failed',
- 3: 'Unknown channel type',
- 4: 'Resource shortage'}
-
-
-
-
-
- -
- -
-

MSG_NAMES

- -
-
-
-
Value:
-
-{1: 'disconnect',
- 2: 'ignore',
- 3: 'unimplemented',
- 4: 'debug',
- 5: 'service-request',
- 6: 'service-accept',
- 20: 'kexinit',
- 21: 'newkeys',
-...
-
-
-
-
-
- -
- -
-

SFTP_DESC

- -
-
-
-
Value:
-
-['Success',
- 'End of file',
- 'No such file',
- 'Permission denied',
- 'Failure',
- 'Bad message',
- 'No connection',
- 'Connection lost',
-...
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.sftp_client-pysrc.html b/docs/paramiko.sftp_client-pysrc.html deleted file mode 100644 index f55736a..0000000 --- a/docs/paramiko.sftp_client-pysrc.html +++ /dev/null @@ -1,1602 +0,0 @@ - - - - - paramiko.sftp_client - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_client - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.sftp_client

-
-  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  Client-mode SFTP support. 
- 21  """ 
- 22   
- 23  from binascii import hexlify 
- 24  import errno 
- 25  import os 
- 26  import stat 
- 27  import threading 
- 28  import time 
- 29  import weakref 
- 30   
- 31  from paramiko.sftp import * 
- 32  from paramiko.sftp_attr import SFTPAttributes 
- 33  from paramiko.ssh_exception import SSHException 
- 34  from paramiko.sftp_file import SFTPFile 
- 35   
- 36   
-
37 -def _to_unicode(s): -
38 """ - 39 decode a string as ascii or utf8 if possible (as required by the sftp - 40 protocol). if neither works, just return a byte string because the server - 41 probably doesn't know the filename's encoding. - 42 """ - 43 try: - 44 return s.encode('ascii') - 45 except UnicodeError: - 46 try: - 47 return s.decode('utf-8') - 48 except UnicodeError: - 49 return s -
50 - 51 -
52 -class SFTPClient (BaseSFTP): -
53 """ - 54 SFTP client object. C{SFTPClient} is used to open an sftp session across - 55 an open ssh L{Transport} and do remote file operations. - 56 """ - 57 -
58 - def __init__(self, sock): -
59 """ - 60 Create an SFTP client from an existing L{Channel}. The channel - 61 should already have requested the C{"sftp"} subsystem. - 62 - 63 An alternate way to create an SFTP client context is by using - 64 L{from_transport}. - 65 - 66 @param sock: an open L{Channel} using the C{"sftp"} subsystem - 67 @type sock: L{Channel} - 68 - 69 @raise SSHException: if there's an exception while negotiating - 70 sftp - 71 """ - 72 BaseSFTP.__init__(self) - 73 self.sock = sock - 74 self.ultra_debug = False - 75 self.request_number = 1 - 76 # lock for request_number - 77 self._lock = threading.Lock() - 78 self._cwd = None - 79 # request # -> SFTPFile - 80 self._expecting = weakref.WeakValueDictionary() - 81 if type(sock) is Channel: - 82 # override default logger - 83 transport = self.sock.get_transport() - 84 self.logger = util.get_logger(transport.get_log_channel() + '.sftp') - 85 self.ultra_debug = transport.get_hexdump() - 86 try: - 87 server_version = self._send_version() - 88 except EOFError, x: - 89 raise SSHException('EOF during negotiation') - 90 self._log(INFO, 'Opened sftp connection (server version %d)' % server_version) -
91 -
92 - def from_transport(cls, t): -
93 """ - 94 Create an SFTP client channel from an open L{Transport}. - 95 - 96 @param t: an open L{Transport} which is already authenticated - 97 @type t: L{Transport} - 98 @return: a new L{SFTPClient} object, referring to an sftp session - 99 (channel) across the transport -100 @rtype: L{SFTPClient} -101 """ -102 chan = t.open_session() -103 if chan is None: -104 return None -105 chan.invoke_subsystem('sftp') -106 return cls(chan) -
107 from_transport = classmethod(from_transport) -108 -
109 - def _log(self, level, msg, *args): -
110 if isinstance(msg, list): -111 for m in msg: -112 super(SFTPClient, self)._log(level, "[chan %s] " + m, *([ self.sock.get_name() ] + list(args))) -113 else: -114 super(SFTPClient, self)._log(level, "[chan %s] " + msg, *([ self.sock.get_name() ] + list(args))) -
115 -
116 - def close(self): -
117 """ -118 Close the SFTP session and its underlying channel. -119 -120 @since: 1.4 -121 """ -122 self._log(INFO, 'sftp session closed.') -123 self.sock.close() -
124 -
125 - def get_channel(self): -
126 """ -127 Return the underlying L{Channel} object for this SFTP session. This -128 might be useful for doing things like setting a timeout on the channel. -129 -130 @return: the SSH channel -131 @rtype: L{Channel} -132 -133 @since: 1.7.1 -134 """ -135 return self.sock -
136 -
137 - def listdir(self, path='.'): -
138 """ -139 Return a list containing the names of the entries in the given C{path}. -140 The list is in arbitrary order. It does not include the special -141 entries C{'.'} and C{'..'} even if they are present in the folder. -142 This method is meant to mirror C{os.listdir} as closely as possible. -143 For a list of full L{SFTPAttributes} objects, see L{listdir_attr}. -144 -145 @param path: path to list (defaults to C{'.'}) -146 @type path: str -147 @return: list of filenames -148 @rtype: list of str -149 """ -150 return [f.filename for f in self.listdir_attr(path)] -
151 -
152 - def listdir_attr(self, path='.'): -
153 """ -154 Return a list containing L{SFTPAttributes} objects corresponding to -155 files in the given C{path}. The list is in arbitrary order. It does -156 not include the special entries C{'.'} and C{'..'} even if they are -157 present in the folder. -158 -159 The returned L{SFTPAttributes} objects will each have an additional -160 field: C{longname}, which may contain a formatted string of the file's -161 attributes, in unix format. The content of this string will probably -162 depend on the SFTP server implementation. -163 -164 @param path: path to list (defaults to C{'.'}) -165 @type path: str -166 @return: list of attributes -167 @rtype: list of L{SFTPAttributes} -168 -169 @since: 1.2 -170 """ -171 path = self._adjust_cwd(path) -172 self._log(DEBUG, 'listdir(%r)' % path) -173 t, msg = self._request(CMD_OPENDIR, path) -174 if t != CMD_HANDLE: -175 raise SFTPError('Expected handle') -176 handle = msg.get_string() -177 filelist = [] -178 while True: -179 try: -180 t, msg = self._request(CMD_READDIR, handle) -181 except EOFError, e: -182 # done with handle -183 break -184 if t != CMD_NAME: -185 raise SFTPError('Expected name response') -186 count = msg.get_int() -187 for i in range(count): -188 filename = _to_unicode(msg.get_string()) -189 longname = _to_unicode(msg.get_string()) -190 attr = SFTPAttributes._from_msg(msg, filename, longname) -191 if (filename != '.') and (filename != '..'): -192 filelist.append(attr) -193 self._request(CMD_CLOSE, handle) -194 return filelist -
195 -
196 - def open(self, filename, mode='r', bufsize=-1): -
197 """ -198 Open a file on the remote server. The arguments are the same as for -199 python's built-in C{file} (aka C{open}). A file-like object is -200 returned, which closely mimics the behavior of a normal python file -201 object. -202 -203 The mode indicates how the file is to be opened: C{'r'} for reading, -204 C{'w'} for writing (truncating an existing file), C{'a'} for appending, -205 C{'r+'} for reading/writing, C{'w+'} for reading/writing (truncating an -206 existing file), C{'a+'} for reading/appending. The python C{'b'} flag -207 is ignored, since SSH treats all files as binary. The C{'U'} flag is -208 supported in a compatible way. -209 -210 Since 1.5.2, an C{'x'} flag indicates that the operation should only -211 succeed if the file was created and did not previously exist. This has -212 no direct mapping to python's file flags, but is commonly known as the -213 C{O_EXCL} flag in posix. -214 -215 The file will be buffered in standard python style by default, but -216 can be altered with the C{bufsize} parameter. C{0} turns off -217 buffering, C{1} uses line buffering, and any number greater than 1 -218 (C{>1}) uses that specific buffer size. -219 -220 @param filename: name of the file to open -221 @type filename: str -222 @param mode: mode (python-style) to open in -223 @type mode: str -224 @param bufsize: desired buffering (-1 = default buffer size) -225 @type bufsize: int -226 @return: a file object representing the open file -227 @rtype: SFTPFile -228 -229 @raise IOError: if the file could not be opened. -230 """ -231 filename = self._adjust_cwd(filename) -232 self._log(DEBUG, 'open(%r, %r)' % (filename, mode)) -233 imode = 0 -234 if ('r' in mode) or ('+' in mode): -235 imode |= SFTP_FLAG_READ -236 if ('w' in mode) or ('+' in mode) or ('a' in mode): -237 imode |= SFTP_FLAG_WRITE -238 if ('w' in mode): -239 imode |= SFTP_FLAG_CREATE | SFTP_FLAG_TRUNC -240 if ('a' in mode): -241 imode |= SFTP_FLAG_CREATE | SFTP_FLAG_APPEND -242 if ('x' in mode): -243 imode |= SFTP_FLAG_CREATE | SFTP_FLAG_EXCL -244 attrblock = SFTPAttributes() -245 t, msg = self._request(CMD_OPEN, filename, imode, attrblock) -246 if t != CMD_HANDLE: -247 raise SFTPError('Expected handle') -248 handle = msg.get_string() -249 self._log(DEBUG, 'open(%r, %r) -> %s' % (filename, mode, hexlify(handle))) -250 return SFTPFile(self, handle, mode, bufsize) -
251 -252 # python continues to vacillate about "open" vs "file"... -253 file = open -254 -
255 - def remove(self, path): -
256 """ -257 Remove the file at the given path. This only works on files; for -258 removing folders (directories), use L{rmdir}. -259 -260 @param path: path (absolute or relative) of the file to remove -261 @type path: str -262 -263 @raise IOError: if the path refers to a folder (directory) -264 """ -265 path = self._adjust_cwd(path) -266 self._log(DEBUG, 'remove(%r)' % path) -267 self._request(CMD_REMOVE, path) -
268 -269 unlink = remove -270 -
271 - def rename(self, oldpath, newpath): -
272 """ -273 Rename a file or folder from C{oldpath} to C{newpath}. -274 -275 @param oldpath: existing name of the file or folder -276 @type oldpath: str -277 @param newpath: new name for the file or folder -278 @type newpath: str -279 -280 @raise IOError: if C{newpath} is a folder, or something else goes -281 wrong -282 """ -283 oldpath = self._adjust_cwd(oldpath) -284 newpath = self._adjust_cwd(newpath) -285 self._log(DEBUG, 'rename(%r, %r)' % (oldpath, newpath)) -286 self._request(CMD_RENAME, oldpath, newpath) -
287 -
288 - def mkdir(self, path, mode=0777): -
289 """ -290 Create a folder (directory) named C{path} with numeric mode C{mode}. -291 The default mode is 0777 (octal). On some systems, mode is ignored. -292 Where it is used, the current umask value is first masked out. -293 -294 @param path: name of the folder to create -295 @type path: str -296 @param mode: permissions (posix-style) for the newly-created folder -297 @type mode: int -298 """ -299 path = self._adjust_cwd(path) -300 self._log(DEBUG, 'mkdir(%r, %r)' % (path, mode)) -301 attr = SFTPAttributes() -302 attr.st_mode = mode -303 self._request(CMD_MKDIR, path, attr) -
304 -
305 - def rmdir(self, path): -
306 """ -307 Remove the folder named C{path}. -308 -309 @param path: name of the folder to remove -310 @type path: str -311 """ -312 path = self._adjust_cwd(path) -313 self._log(DEBUG, 'rmdir(%r)' % path) -314 self._request(CMD_RMDIR, path) -
315 -
316 - def stat(self, path): -
317 """ -318 Retrieve information about a file on the remote system. The return -319 value is an object whose attributes correspond to the attributes of -320 python's C{stat} structure as returned by C{os.stat}, except that it -321 contains fewer fields. An SFTP server may return as much or as little -322 info as it wants, so the results may vary from server to server. -323 -324 Unlike a python C{stat} object, the result may not be accessed as a -325 tuple. This is mostly due to the author's slack factor. -326 -327 The fields supported are: C{st_mode}, C{st_size}, C{st_uid}, C{st_gid}, -328 C{st_atime}, and C{st_mtime}. -329 -330 @param path: the filename to stat -331 @type path: str -332 @return: an object containing attributes about the given file -333 @rtype: SFTPAttributes -334 """ -335 path = self._adjust_cwd(path) -336 self._log(DEBUG, 'stat(%r)' % path) -337 t, msg = self._request(CMD_STAT, path) -338 if t != CMD_ATTRS: -339 raise SFTPError('Expected attributes') -340 return SFTPAttributes._from_msg(msg) -
341 -
342 - def lstat(self, path): -
343 """ -344 Retrieve information about a file on the remote system, without -345 following symbolic links (shortcuts). This otherwise behaves exactly -346 the same as L{stat}. -347 -348 @param path: the filename to stat -349 @type path: str -350 @return: an object containing attributes about the given file -351 @rtype: SFTPAttributes -352 """ -353 path = self._adjust_cwd(path) -354 self._log(DEBUG, 'lstat(%r)' % path) -355 t, msg = self._request(CMD_LSTAT, path) -356 if t != CMD_ATTRS: -357 raise SFTPError('Expected attributes') -358 return SFTPAttributes._from_msg(msg) -
359 -375 -
376 - def chmod(self, path, mode): -
377 """ -378 Change the mode (permissions) of a file. The permissions are -379 unix-style and identical to those used by python's C{os.chmod} -380 function. -381 -382 @param path: path of the file to change the permissions of -383 @type path: str -384 @param mode: new permissions -385 @type mode: int -386 """ -387 path = self._adjust_cwd(path) -388 self._log(DEBUG, 'chmod(%r, %r)' % (path, mode)) -389 attr = SFTPAttributes() -390 attr.st_mode = mode -391 self._request(CMD_SETSTAT, path, attr) -
392 -
393 - def chown(self, path, uid, gid): -
394 """ -395 Change the owner (C{uid}) and group (C{gid}) of a file. As with -396 python's C{os.chown} function, you must pass both arguments, so if you -397 only want to change one, use L{stat} first to retrieve the current -398 owner and group. -399 -400 @param path: path of the file to change the owner and group of -401 @type path: str -402 @param uid: new owner's uid -403 @type uid: int -404 @param gid: new group id -405 @type gid: int -406 """ -407 path = self._adjust_cwd(path) -408 self._log(DEBUG, 'chown(%r, %r, %r)' % (path, uid, gid)) -409 attr = SFTPAttributes() -410 attr.st_uid, attr.st_gid = uid, gid -411 self._request(CMD_SETSTAT, path, attr) -
412 -
413 - def utime(self, path, times): -
414 """ -415 Set the access and modified times of the file specified by C{path}. If -416 C{times} is C{None}, then the file's access and modified times are set -417 to the current time. Otherwise, C{times} must be a 2-tuple of numbers, -418 of the form C{(atime, mtime)}, which is used to set the access and -419 modified times, respectively. This bizarre API is mimicked from python -420 for the sake of consistency -- I apologize. -421 -422 @param path: path of the file to modify -423 @type path: str -424 @param times: C{None} or a tuple of (access time, modified time) in -425 standard internet epoch time (seconds since 01 January 1970 GMT) -426 @type times: tuple(int) -427 """ -428 path = self._adjust_cwd(path) -429 if times is None: -430 times = (time.time(), time.time()) -431 self._log(DEBUG, 'utime(%r, %r)' % (path, times)) -432 attr = SFTPAttributes() -433 attr.st_atime, attr.st_mtime = times -434 self._request(CMD_SETSTAT, path, attr) -
435 -
436 - def truncate(self, path, size): -
437 """ -438 Change the size of the file specified by C{path}. This usually extends -439 or shrinks the size of the file, just like the C{truncate()} method on -440 python file objects. -441 -442 @param path: path of the file to modify -443 @type path: str -444 @param size: the new size of the file -445 @type size: int or long -446 """ -447 path = self._adjust_cwd(path) -448 self._log(DEBUG, 'truncate(%r, %r)' % (path, size)) -449 attr = SFTPAttributes() -450 attr.st_size = size -451 self._request(CMD_SETSTAT, path, attr) -
452 -475 -
476 - def normalize(self, path): -
477 """ -478 Return the normalized path (on the server) of a given path. This -479 can be used to quickly resolve symbolic links or determine what the -480 server is considering to be the "current folder" (by passing C{'.'} -481 as C{path}). -482 -483 @param path: path to be normalized -484 @type path: str -485 @return: normalized form of the given path -486 @rtype: str -487 -488 @raise IOError: if the path can't be resolved on the server -489 """ -490 path = self._adjust_cwd(path) -491 self._log(DEBUG, 'normalize(%r)' % path) -492 t, msg = self._request(CMD_REALPATH, path) -493 if t != CMD_NAME: -494 raise SFTPError('Expected name response') -495 count = msg.get_int() -496 if count != 1: -497 raise SFTPError('Realpath returned %d results' % count) -498 return _to_unicode(msg.get_string()) -
499 -
500 - def chdir(self, path): -
501 """ -502 Change the "current directory" of this SFTP session. Since SFTP -503 doesn't really have the concept of a current working directory, this -504 is emulated by paramiko. Once you use this method to set a working -505 directory, all operations on this SFTPClient object will be relative -506 to that path. You can pass in C{None} to stop using a current working -507 directory. -508 -509 @param path: new current working directory -510 @type path: str -511 -512 @raise IOError: if the requested path doesn't exist on the server -513 -514 @since: 1.4 -515 """ -516 if path is None: -517 self._cwd = None -518 return -519 if not stat.S_ISDIR(self.stat(path).st_mode): -520 raise SFTPError(errno.ENOTDIR, "%s: %s" % (os.strerror(errno.ENOTDIR), path)) -521 self._cwd = self.normalize(path).encode('utf-8') -
522 -
523 - def getcwd(self): -
524 """ -525 Return the "current working directory" for this SFTP session, as -526 emulated by paramiko. If no directory has been set with L{chdir}, -527 this method will return C{None}. -528 -529 @return: the current working directory on the server, or C{None} -530 @rtype: str -531 -532 @since: 1.4 -533 """ -534 return self._cwd -
535 -
536 - def put(self, localpath, remotepath, callback=None, confirm=True): -
537 """ -538 Copy a local file (C{localpath}) to the SFTP server as C{remotepath}. -539 Any exception raised by operations will be passed through. This -540 method is primarily provided as a convenience. -541 -542 The SFTP operations use pipelining for speed. -543 -544 @param localpath: the local file to copy -545 @type localpath: str -546 @param remotepath: the destination path on the SFTP server -547 @type remotepath: str -548 @param callback: optional callback function that accepts the bytes -549 transferred so far and the total bytes to be transferred -550 (since 1.7.4) -551 @type callback: function(int, int) -552 @param confirm: whether to do a stat() on the file afterwards to -553 confirm the file size (since 1.7.7) -554 @type confirm: bool -555 -556 @return: an object containing attributes about the given file -557 (since 1.7.4) -558 @rtype: SFTPAttributes -559 -560 @since: 1.4 -561 """ -562 file_size = os.stat(localpath).st_size -563 fl = file(localpath, 'rb') -564 try: -565 fr = self.file(remotepath, 'wb') -566 fr.set_pipelined(True) -567 size = 0 -568 try: -569 while True: -570 data = fl.read(32768) -571 if len(data) == 0: -572 break -573 fr.write(data) -574 size += len(data) -575 if callback is not None: -576 callback(size, file_size) -577 finally: -578 fr.close() -579 finally: -580 fl.close() -581 if confirm: -582 s = self.stat(remotepath) -583 if s.st_size != size: -584 raise IOError('size mismatch in put! %d != %d' % (s.st_size, size)) -585 else: -586 s = SFTPAttributes() -587 return s -
588 -
589 - def get(self, remotepath, localpath, callback=None): -
590 """ -591 Copy a remote file (C{remotepath}) from the SFTP server to the local -592 host as C{localpath}. Any exception raised by operations will be -593 passed through. This method is primarily provided as a convenience. -594 -595 @param remotepath: the remote file to copy -596 @type remotepath: str -597 @param localpath: the destination path on the local host -598 @type localpath: str -599 @param callback: optional callback function that accepts the bytes -600 transferred so far and the total bytes to be transferred -601 (since 1.7.4) -602 @type callback: function(int, int) -603 -604 @since: 1.4 -605 """ -606 fr = self.file(remotepath, 'rb') -607 file_size = self.stat(remotepath).st_size -608 fr.prefetch() -609 try: -610 fl = file(localpath, 'wb') -611 try: -612 size = 0 -613 while True: -614 data = fr.read(32768) -615 if len(data) == 0: -616 break -617 fl.write(data) -618 size += len(data) -619 if callback is not None: -620 callback(size, file_size) -621 finally: -622 fl.close() -623 finally: -624 fr.close() -625 s = os.stat(localpath) -626 if s.st_size != size: -627 raise IOError('size mismatch in get! %d != %d' % (s.st_size, size)) -
628 -629 -630 ### internals... -631 -632 -
633 - def _request(self, t, *arg): -
634 num = self._async_request(type(None), t, *arg) -635 return self._read_response(num) -
636 -
637 - def _async_request(self, fileobj, t, *arg): -
638 # this method may be called from other threads (prefetch) -639 self._lock.acquire() -640 try: -641 msg = Message() -642 msg.add_int(self.request_number) -643 for item in arg: -644 if type(item) is int: -645 msg.add_int(item) -646 elif type(item) is long: -647 msg.add_int64(item) -648 elif type(item) is str: -649 msg.add_string(item) -650 elif type(item) is SFTPAttributes: -651 item._pack(msg) -652 else: -653 raise Exception('unknown type for %r type %r' % (item, type(item))) -654 num = self.request_number -655 self._expecting[num] = fileobj -656 self._send_packet(t, str(msg)) -657 self.request_number += 1 -658 finally: -659 self._lock.release() -660 return num -
661 -
662 - def _read_response(self, waitfor=None): -
663 while True: -664 try: -665 t, data = self._read_packet() -666 except EOFError, e: -667 raise SSHException('Server connection dropped: %s' % (str(e),)) -668 msg = Message(data) -669 num = msg.get_int() -670 if num not in self._expecting: -671 # might be response for a file that was closed before responses came back -672 self._log(DEBUG, 'Unexpected response #%d' % (num,)) -673 if waitfor is None: -674 # just doing a single check -675 break -676 continue -677 fileobj = self._expecting[num] -678 del self._expecting[num] -679 if num == waitfor: -680 # synchronous -681 if t == CMD_STATUS: -682 self._convert_status(msg) -683 return t, msg -684 if fileobj is not type(None): -685 fileobj._async_response(t, msg) -686 if waitfor is None: -687 # just doing a single check -688 break -689 return (None, None) -
690 -
691 - def _finish_responses(self, fileobj): -
692 while fileobj in self._expecting.values(): -693 self._read_response() -694 fileobj._check_exception() -
695 -
696 - def _convert_status(self, msg): -
697 """ -698 Raises EOFError or IOError on error status; otherwise does nothing. -699 """ -700 code = msg.get_int() -701 text = msg.get_string() -702 if code == SFTP_OK: -703 return -704 elif code == SFTP_EOF: -705 raise EOFError(text) -706 elif code == SFTP_NO_SUCH_FILE: -707 # clever idea from john a. meinel: map the error codes to errno -708 raise IOError(errno.ENOENT, text) -709 elif code == SFTP_PERMISSION_DENIED: -710 raise IOError(errno.EACCES, text) -711 else: -712 raise IOError(text) -
713 -
714 - def _adjust_cwd(self, path): -
715 """ -716 Return an adjusted path if we're emulating a "current working -717 directory" for the server. -718 """ -719 if type(path) is unicode: -720 path = path.encode('utf-8') -721 if self._cwd is None: -722 return path -723 if (len(path) > 0) and (path[0] == '/'): -724 # absolute path -725 return path -726 if self._cwd == '/': -727 return self._cwd + path -728 return self._cwd + '/' + path -
729 -730 -
731 -class SFTP (SFTPClient): -
732 "an alias for L{SFTPClient} for backwards compatability" -733 pass -
734 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.sftp_file-module.html b/docs/paramiko.sftp_file-module.html deleted file mode 100644 index 2d63a78..0000000 --- a/docs/paramiko.sftp_file-module.html +++ /dev/null @@ -1,907 +0,0 @@ - - - - - paramiko.sftp_file - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_file - - - - - -
[frames] | no frames]
-
- -

Module sftp_file

source code

-

SFTPFile

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Variables
-   - - AUTH_FAILED = 2 -
-   - - AUTH_PARTIALLY_SUCCESSFUL = 1 -
-   - - AUTH_SUCCESSFUL = 0 -
-   - - CMD_ATTRS = 105 -
-   - - CMD_CLOSE = 4 -
-   - - CMD_DATA = 103 -
-   - - CMD_EXTENDED = 200 -
-   - - CMD_EXTENDED_REPLY = 201 -
-   - - CMD_FSETSTAT = 10 -
-   - - CMD_FSTAT = 8 -
-   - - CMD_HANDLE = 102 -
-   - - CMD_INIT = 1 -
-   - - CMD_LSTAT = 7 -
-   - - CMD_MKDIR = 14 -
-   - - CMD_NAME = 104 -
-   - - CMD_NAMES = {1: 'init', 2: 'version', 3: 'open', 4: 'close', 5... -
-   - - CMD_OPEN = 3 -
-   - - CMD_OPENDIR = 11 -
-   - - CMD_READ = 5 -
-   - - CMD_READDIR = 12 -
-   - - CMD_READLINK = 19 -
-   - - CMD_REALPATH = 16 -
-   - - CMD_REMOVE = 13 -
-   - - CMD_RENAME = 18 -
-   - - CMD_RMDIR = 15 -
-   - - CMD_SETSTAT = 9 -
-   - - CMD_STAT = 17 -
-   - - CMD_STATUS = 101 -
-   - - CMD_SYMLINK = 20 -
-   - - CMD_VERSION = 2 -
-   - - CMD_WRITE = 6 -
-   - - CONNECTION_FAILED_CODE = {1: 'Administratively prohibited', 2:... -
-   - - CRITICAL = 50 -
-   - - DEBUG = 10 -
-   - - DISCONNECT_AUTH_CANCELLED_BY_USER = 13 -
-   - - DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14 -
-   - - DISCONNECT_SERVICE_NOT_AVAILABLE = 7 -
-   - - ERROR = 40 -
-   - - INFO = 20 -
-   - - MSG_CHANNEL_CLOSE = 97 -
-   - - MSG_CHANNEL_DATA = 94 -
-   - - MSG_CHANNEL_EOF = 96 -
-   - - MSG_CHANNEL_EXTENDED_DATA = 95 -
-   - - MSG_CHANNEL_FAILURE = 100 -
-   - - MSG_CHANNEL_OPEN = 90 -
-   - - MSG_CHANNEL_OPEN_FAILURE = 92 -
-   - - MSG_CHANNEL_OPEN_SUCCESS = 91 -
-   - - MSG_CHANNEL_REQUEST = 98 -
-   - - MSG_CHANNEL_SUCCESS = 99 -
-   - - MSG_CHANNEL_WINDOW_ADJUST = 93 -
-   - - MSG_DEBUG = 4 -
-   - - MSG_DISCONNECT = 1 -
-   - - MSG_GLOBAL_REQUEST = 80 -
-   - - MSG_IGNORE = 2 -
-   - - MSG_KEXINIT = 20 -
-   - - MSG_NAMES = {1: 'disconnect', 2: 'ignore', 3: 'unimplemented',... -
-   - - MSG_NEWKEYS = 21 -
-   - - MSG_REQUEST_FAILURE = 82 -
-   - - MSG_REQUEST_SUCCESS = 81 -
-   - - MSG_SERVICE_ACCEPT = 6 -
-   - - MSG_SERVICE_REQUEST = 5 -
-   - - MSG_UNIMPLEMENTED = 3 -
-   - - MSG_USERAUTH_BANNER = 53 -
-   - - MSG_USERAUTH_FAILURE = 51 -
-   - - MSG_USERAUTH_INFO_REQUEST = 60 -
-   - - MSG_USERAUTH_INFO_RESPONSE = 61 -
-   - - MSG_USERAUTH_PK_OK = 60 -
-   - - MSG_USERAUTH_REQUEST = 50 -
-   - - MSG_USERAUTH_SUCCESS = 52 -
-   - - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED = 1 -
-   - - OPEN_FAILED_CONNECT_FAILED = 2 -
-   - - OPEN_FAILED_RESOURCE_SHORTAGE = 4 -
-   - - OPEN_FAILED_UNKNOWN_CHANNEL_TYPE = 3 -
-   - - OPEN_SUCCEEDED = 0 -
-   - - PY22 = False -
-   - - SFTP_BAD_MESSAGE = 5 -
-   - - SFTP_CONNECTION_LOST = 7 -
-   - - SFTP_DESC = ['Success', 'End of file', 'No such file', 'Permis... -
-   - - SFTP_EOF = 1 -
-   - - SFTP_FAILURE = 4 -
-   - - SFTP_FLAG_APPEND = 4 -
-   - - SFTP_FLAG_CREATE = 8 -
-   - - SFTP_FLAG_EXCL = 32 -
-   - - SFTP_FLAG_READ = 1 -
-   - - SFTP_FLAG_TRUNC = 16 -
-   - - SFTP_FLAG_WRITE = 2 -
-   - - SFTP_NO_CONNECTION = 6 -
-   - - SFTP_NO_SUCH_FILE = 2 -
-   - - SFTP_OK = 0 -
-   - - SFTP_OP_UNSUPPORTED = 8 -
-   - - SFTP_PERMISSION_DENIED = 3 -
-   - - WARNING = 30 -
-   - - __package__ = 'paramiko' -
-   - - rng = Random.new() -
- - - - - - -
- Variables Details
- -
- -
-

CMD_NAMES

- -
-
-
-
Value:
-
-{1: 'init',
- 2: 'version',
- 3: 'open',
- 4: 'close',
- 5: 'read',
- 6: 'write',
- 7: 'lstat',
- 8: 'fstat',
-...
-
-
-
-
-
- -
- -
-

CONNECTION_FAILED_CODE

- -
-
-
-
Value:
-
-{1: 'Administratively prohibited',
- 2: 'Connect failed',
- 3: 'Unknown channel type',
- 4: 'Resource shortage'}
-
-
-
-
-
- -
- -
-

MSG_NAMES

- -
-
-
-
Value:
-
-{1: 'disconnect',
- 2: 'ignore',
- 3: 'unimplemented',
- 4: 'debug',
- 5: 'service-request',
- 6: 'service-accept',
- 20: 'kexinit',
- 21: 'newkeys',
-...
-
-
-
-
-
- -
- -
-

SFTP_DESC

- -
-
-
-
Value:
-
-['Success',
- 'End of file',
- 'No such file',
- 'Permission denied',
- 'Failure',
- 'Bad message',
- 'No connection',
- 'Connection lost',
-...
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.sftp_file-pysrc.html b/docs/paramiko.sftp_file-pysrc.html deleted file mode 100644 index f4791fa..0000000 --- a/docs/paramiko.sftp_file-pysrc.html +++ /dev/null @@ -1,873 +0,0 @@ - - - - - paramiko.sftp_file - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_file - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.sftp_file

-
-  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  L{SFTPFile} 
- 21  """ 
- 22   
- 23  from binascii import hexlify 
- 24  import socket 
- 25  import threading 
- 26  import time 
- 27   
- 28  from paramiko.common import * 
- 29  from paramiko.sftp import * 
- 30  from paramiko.file import BufferedFile 
- 31  from paramiko.sftp_attr import SFTPAttributes 
- 32   
- 33   
-
34 -class SFTPFile (BufferedFile): -
35 """ - 36 Proxy object for a file on the remote server, in client mode SFTP. - 37 """ - 38 - 39 # Some sftp servers will choke if you send read/write requests larger than - 40 # this size. - 41 MAX_REQUEST_SIZE = 32768 - 42 -
43 - def __init__(self, sftp, handle, mode='r', bufsize=-1): -
44 BufferedFile.__init__(self) - 45 self.sftp = sftp - 46 self.handle = handle - 47 BufferedFile._set_mode(self, mode, bufsize) - 48 self.pipelined = False - 49 self._prefetching = False - 50 self._prefetch_done = False - 51 self._prefetch_data = {} - 52 self._prefetch_reads = [] - 53 self._saved_exception = None -
54 -
55 - def __del__(self): -
56 self._close(async=True) -
57 -
58 - def close(self): -
59 self._close(async=False) -
60 -
61 - def _close(self, async=False): -
62 # We allow double-close without signaling an error, because real - 63 # Python file objects do. However, we must protect against actually - 64 # sending multiple CMD_CLOSE packets, because after we close our - 65 # handle, the same handle may be re-allocated by the server, and we - 66 # may end up mysteriously closing some random other file. (This is - 67 # especially important because we unconditionally call close() from - 68 # __del__.) - 69 if self._closed: - 70 return - 71 self.sftp._log(DEBUG, 'close(%s)' % hexlify(self.handle)) - 72 if self.pipelined: - 73 self.sftp._finish_responses(self) - 74 BufferedFile.close(self) - 75 try: - 76 if async: - 77 # GC'd file handle could be called from an arbitrary thread -- don't wait for a response - 78 self.sftp._async_request(type(None), CMD_CLOSE, self.handle) - 79 else: - 80 self.sftp._request(CMD_CLOSE, self.handle) - 81 except EOFError: - 82 # may have outlived the Transport connection - 83 pass - 84 except (IOError, socket.error): - 85 # may have outlived the Transport connection - 86 pass -
87 -
88 - def _data_in_prefetch_requests(self, offset, size): -
89 k = [i for i in self._prefetch_reads if i[0] <= offset] - 90 if len(k) == 0: - 91 return False - 92 k.sort(lambda x, y: cmp(x[0], y[0])) - 93 buf_offset, buf_size = k[-1] - 94 if buf_offset + buf_size <= offset: - 95 # prefetch request ends before this one begins - 96 return False - 97 if buf_offset + buf_size >= offset + size: - 98 # inclusive - 99 return True -100 # well, we have part of the request. see if another chunk has the rest. -101 return self._data_in_prefetch_requests(buf_offset + buf_size, offset + size - buf_offset - buf_size) -
102 -
103 - def _data_in_prefetch_buffers(self, offset): -
104 """ -105 if a block of data is present in the prefetch buffers, at the given -106 offset, return the offset of the relevant prefetch buffer. otherwise, -107 return None. this guarantees nothing about the number of bytes -108 collected in the prefetch buffer so far. -109 """ -110 k = [i for i in self._prefetch_data.keys() if i <= offset] -111 if len(k) == 0: -112 return None -113 index = max(k) -114 buf_offset = offset - index -115 if buf_offset >= len(self._prefetch_data[index]): -116 # it's not here -117 return None -118 return index -
119 -
120 - def _read_prefetch(self, size): -
121 """ -122 read data out of the prefetch buffer, if possible. if the data isn't -123 in the buffer, return None. otherwise, behaves like a normal read. -124 """ -125 # while not closed, and haven't fetched past the current position, and haven't reached EOF... -126 while True: -127 offset = self._data_in_prefetch_buffers(self._realpos) -128 if offset is not None: -129 break -130 if self._prefetch_done or self._closed: -131 break -132 self.sftp._read_response() -133 self._check_exception() -134 if offset is None: -135 self._prefetching = False -136 return None -137 prefetch = self._prefetch_data[offset] -138 del self._prefetch_data[offset] -139 -140 buf_offset = self._realpos - offset -141 if buf_offset > 0: -142 self._prefetch_data[offset] = prefetch[:buf_offset] -143 prefetch = prefetch[buf_offset:] -144 if size < len(prefetch): -145 self._prefetch_data[self._realpos + size] = prefetch[size:] -146 prefetch = prefetch[:size] -147 return prefetch -
148 -
149 - def _read(self, size): -
150 size = min(size, self.MAX_REQUEST_SIZE) -151 if self._prefetching: -152 data = self._read_prefetch(size) -153 if data is not None: -154 return data -155 t, msg = self.sftp._request(CMD_READ, self.handle, long(self._realpos), int(size)) -156 if t != CMD_DATA: -157 raise SFTPError('Expected data') -158 return msg.get_string() -
159 -
160 - def _write(self, data): -
161 # may write less than requested if it would exceed max packet size -162 chunk = min(len(data), self.MAX_REQUEST_SIZE) -163 req = self.sftp._async_request(type(None), CMD_WRITE, self.handle, long(self._realpos), str(data[:chunk])) -164 if not self.pipelined or self.sftp.sock.recv_ready(): -165 t, msg = self.sftp._read_response(req) -166 if t != CMD_STATUS: -167 raise SFTPError('Expected status') -168 # convert_status already called -169 return chunk -
170 -
171 - def settimeout(self, timeout): -
172 """ -173 Set a timeout on read/write operations on the underlying socket or -174 ssh L{Channel}. -175 -176 @see: L{Channel.settimeout} -177 @param timeout: seconds to wait for a pending read/write operation -178 before raising C{socket.timeout}, or C{None} for no timeout -179 @type timeout: float -180 """ -181 self.sftp.sock.settimeout(timeout) -
182 -
183 - def gettimeout(self): -
184 """ -185 Returns the timeout in seconds (as a float) associated with the socket -186 or ssh L{Channel} used for this file. -187 -188 @see: L{Channel.gettimeout} -189 @rtype: float -190 """ -191 return self.sftp.sock.gettimeout() -
192 -
193 - def setblocking(self, blocking): -
194 """ -195 Set blocking or non-blocking mode on the underiying socket or ssh -196 L{Channel}. -197 -198 @see: L{Channel.setblocking} -199 @param blocking: 0 to set non-blocking mode; non-0 to set blocking -200 mode. -201 @type blocking: int -202 """ -203 self.sftp.sock.setblocking(blocking) -
204 -
205 - def seek(self, offset, whence=0): -
206 self.flush() -207 if whence == self.SEEK_SET: -208 self._realpos = self._pos = offset -209 elif whence == self.SEEK_CUR: -210 self._pos += offset -211 self._realpos = self._pos -212 else: -213 self._realpos = self._pos = self._get_size() + offset -214 self._rbuffer = '' -
215 -
216 - def stat(self): -
217 """ -218 Retrieve information about this file from the remote system. This is -219 exactly like L{SFTP.stat}, except that it operates on an already-open -220 file. -221 -222 @return: an object containing attributes about this file. -223 @rtype: SFTPAttributes -224 """ -225 t, msg = self.sftp._request(CMD_FSTAT, self.handle) -226 if t != CMD_ATTRS: -227 raise SFTPError('Expected attributes') -228 return SFTPAttributes._from_msg(msg) -
229 -
230 - def chmod(self, mode): -
231 """ -232 Change the mode (permissions) of this file. The permissions are -233 unix-style and identical to those used by python's C{os.chmod} -234 function. -235 -236 @param mode: new permissions -237 @type mode: int -238 """ -239 self.sftp._log(DEBUG, 'chmod(%s, %r)' % (hexlify(self.handle), mode)) -240 attr = SFTPAttributes() -241 attr.st_mode = mode -242 self.sftp._request(CMD_FSETSTAT, self.handle, attr) -
243 -
244 - def chown(self, uid, gid): -
245 """ -246 Change the owner (C{uid}) and group (C{gid}) of this file. As with -247 python's C{os.chown} function, you must pass both arguments, so if you -248 only want to change one, use L{stat} first to retrieve the current -249 owner and group. -250 -251 @param uid: new owner's uid -252 @type uid: int -253 @param gid: new group id -254 @type gid: int -255 """ -256 self.sftp._log(DEBUG, 'chown(%s, %r, %r)' % (hexlify(self.handle), uid, gid)) -257 attr = SFTPAttributes() -258 attr.st_uid, attr.st_gid = uid, gid -259 self.sftp._request(CMD_FSETSTAT, self.handle, attr) -
260 -
261 - def utime(self, times): -
262 """ -263 Set the access and modified times of this file. If -264 C{times} is C{None}, then the file's access and modified times are set -265 to the current time. Otherwise, C{times} must be a 2-tuple of numbers, -266 of the form C{(atime, mtime)}, which is used to set the access and -267 modified times, respectively. This bizarre API is mimicked from python -268 for the sake of consistency -- I apologize. -269 -270 @param times: C{None} or a tuple of (access time, modified time) in -271 standard internet epoch time (seconds since 01 January 1970 GMT) -272 @type times: tuple(int) -273 """ -274 if times is None: -275 times = (time.time(), time.time()) -276 self.sftp._log(DEBUG, 'utime(%s, %r)' % (hexlify(self.handle), times)) -277 attr = SFTPAttributes() -278 attr.st_atime, attr.st_mtime = times -279 self.sftp._request(CMD_FSETSTAT, self.handle, attr) -
280 -
281 - def truncate(self, size): -
282 """ -283 Change the size of this file. This usually extends -284 or shrinks the size of the file, just like the C{truncate()} method on -285 python file objects. -286 -287 @param size: the new size of the file -288 @type size: int or long -289 """ -290 self.sftp._log(DEBUG, 'truncate(%s, %r)' % (hexlify(self.handle), size)) -291 attr = SFTPAttributes() -292 attr.st_size = size -293 self.sftp._request(CMD_FSETSTAT, self.handle, attr) -
294 -
295 - def check(self, hash_algorithm, offset=0, length=0, block_size=0): -
296 """ -297 Ask the server for a hash of a section of this file. This can be used -298 to verify a successful upload or download, or for various rsync-like -299 operations. -300 -301 The file is hashed from C{offset}, for C{length} bytes. If C{length} -302 is 0, the remainder of the file is hashed. Thus, if both C{offset} -303 and C{length} are zero, the entire file is hashed. -304 -305 Normally, C{block_size} will be 0 (the default), and this method will -306 return a byte string representing the requested hash (for example, a -307 string of length 16 for MD5, or 20 for SHA-1). If a non-zero -308 C{block_size} is given, each chunk of the file (from C{offset} to -309 C{offset + length}) of C{block_size} bytes is computed as a separate -310 hash. The hash results are all concatenated and returned as a single -311 string. -312 -313 For example, C{check('sha1', 0, 1024, 512)} will return a string of -314 length 40. The first 20 bytes will be the SHA-1 of the first 512 bytes -315 of the file, and the last 20 bytes will be the SHA-1 of the next 512 -316 bytes. -317 -318 @param hash_algorithm: the name of the hash algorithm to use (normally -319 C{"sha1"} or C{"md5"}) -320 @type hash_algorithm: str -321 @param offset: offset into the file to begin hashing (0 means to start -322 from the beginning) -323 @type offset: int or long -324 @param length: number of bytes to hash (0 means continue to the end of -325 the file) -326 @type length: int or long -327 @param block_size: number of bytes to hash per result (must not be less -328 than 256; 0 means to compute only one hash of the entire segment) -329 @type block_size: int -330 @return: string of bytes representing the hash of each block, -331 concatenated together -332 @rtype: str -333 -334 @note: Many (most?) servers don't support this extension yet. -335 -336 @raise IOError: if the server doesn't support the "check-file" -337 extension, or possibly doesn't support the hash algorithm -338 requested -339 -340 @since: 1.4 -341 """ -342 t, msg = self.sftp._request(CMD_EXTENDED, 'check-file', self.handle, -343 hash_algorithm, long(offset), long(length), block_size) -344 ext = msg.get_string() -345 alg = msg.get_string() -346 data = msg.get_remainder() -347 return data -
348 -
349 - def set_pipelined(self, pipelined=True): -
350 """ -351 Turn on/off the pipelining of write operations to this file. When -352 pipelining is on, paramiko won't wait for the server response after -353 each write operation. Instead, they're collected as they come in. -354 At the first non-write operation (including L{close}), all remaining -355 server responses are collected. This means that if there was an error -356 with one of your later writes, an exception might be thrown from -357 within L{close} instead of L{write}. -358 -359 By default, files are I{not} pipelined. -360 -361 @param pipelined: C{True} if pipelining should be turned on for this -362 file; C{False} otherwise -363 @type pipelined: bool -364 -365 @since: 1.5 -366 """ -367 self.pipelined = pipelined -
368 -
369 - def prefetch(self): -
370 """ -371 Pre-fetch the remaining contents of this file in anticipation of -372 future L{read} calls. If reading the entire file, pre-fetching can -373 dramatically improve the download speed by avoiding roundtrip latency. -374 The file's contents are incrementally buffered in a background thread. -375 -376 The prefetched data is stored in a buffer until read via the L{read} -377 method. Once data has been read, it's removed from the buffer. The -378 data may be read in a random order (using L{seek}); chunks of the -379 buffer that haven't been read will continue to be buffered. -380 -381 @since: 1.5.1 -382 """ -383 size = self.stat().st_size -384 # queue up async reads for the rest of the file -385 chunks = [] -386 n = self._realpos -387 while n < size: -388 chunk = min(self.MAX_REQUEST_SIZE, size - n) -389 chunks.append((n, chunk)) -390 n += chunk -391 if len(chunks) > 0: -392 self._start_prefetch(chunks) -
393 -
394 - def readv(self, chunks): -
395 """ -396 Read a set of blocks from the file by (offset, length). This is more -397 efficient than doing a series of L{seek} and L{read} calls, since the -398 prefetch machinery is used to retrieve all the requested blocks at -399 once. -400 -401 @param chunks: a list of (offset, length) tuples indicating which -402 sections of the file to read -403 @type chunks: list(tuple(long, int)) -404 @return: a list of blocks read, in the same order as in C{chunks} -405 @rtype: list(str) -406 -407 @since: 1.5.4 -408 """ -409 self.sftp._log(DEBUG, 'readv(%s, %r)' % (hexlify(self.handle), chunks)) -410 -411 read_chunks = [] -412 for offset, size in chunks: -413 # don't fetch data that's already in the prefetch buffer -414 if self._data_in_prefetch_buffers(offset) or self._data_in_prefetch_requests(offset, size): -415 continue -416 -417 # break up anything larger than the max read size -418 while size > 0: -419 chunk_size = min(size, self.MAX_REQUEST_SIZE) -420 read_chunks.append((offset, chunk_size)) -421 offset += chunk_size -422 size -= chunk_size -423 -424 self._start_prefetch(read_chunks) -425 # now we can just devolve to a bunch of read()s :) -426 for x in chunks: -427 self.seek(x[0]) -428 yield self.read(x[1]) -
429 -430 -431 ### internals... -432 -433 -
434 - def _get_size(self): -
435 try: -436 return self.stat().st_size -437 except: -438 return 0 -
439 -
440 - def _start_prefetch(self, chunks): -
441 self._prefetching = True -442 self._prefetch_done = False -443 self._prefetch_reads.extend(chunks) -444 -445 t = threading.Thread(target=self._prefetch_thread, args=(chunks,)) -446 t.setDaemon(True) -447 t.start() -
448 -
449 - def _prefetch_thread(self, chunks): -
450 # do these read requests in a temporary thread because there may be -451 # a lot of them, so it may block. -452 for offset, length in chunks: -453 self.sftp._async_request(self, CMD_READ, self.handle, long(offset), int(length)) -
454 -
455 - def _async_response(self, t, msg): -
456 if t == CMD_STATUS: -457 # save exception and re-raise it on next file operation -458 try: -459 self.sftp._convert_status(msg) -460 except Exception, x: -461 self._saved_exception = x -462 return -463 if t != CMD_DATA: -464 raise SFTPError('Expected data') -465 data = msg.get_string() -466 offset, length = self._prefetch_reads.pop(0) -467 self._prefetch_data[offset] = data -468 if len(self._prefetch_reads) == 0: -469 self._prefetch_done = True -
470 -
471 - def _check_exception(self): -
472 "if there's a saved exception, raise & clear it" -473 if self._saved_exception is not None: -474 x = self._saved_exception -475 self._saved_exception = None -476 raise x -
477 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.sftp_handle-module.html b/docs/paramiko.sftp_handle-module.html deleted file mode 100644 index cdd3c6a..0000000 --- a/docs/paramiko.sftp_handle-module.html +++ /dev/null @@ -1,907 +0,0 @@ - - - - - paramiko.sftp_handle - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_handle - - - - - -
[frames] | no frames]
-
- -

Module sftp_handle

source code

-

Abstraction of an SFTP file handle (for server mode).

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Variables
-   - - AUTH_FAILED = 2 -
-   - - AUTH_PARTIALLY_SUCCESSFUL = 1 -
-   - - AUTH_SUCCESSFUL = 0 -
-   - - CMD_ATTRS = 105 -
-   - - CMD_CLOSE = 4 -
-   - - CMD_DATA = 103 -
-   - - CMD_EXTENDED = 200 -
-   - - CMD_EXTENDED_REPLY = 201 -
-   - - CMD_FSETSTAT = 10 -
-   - - CMD_FSTAT = 8 -
-   - - CMD_HANDLE = 102 -
-   - - CMD_INIT = 1 -
-   - - CMD_LSTAT = 7 -
-   - - CMD_MKDIR = 14 -
-   - - CMD_NAME = 104 -
-   - - CMD_NAMES = {1: 'init', 2: 'version', 3: 'open', 4: 'close', 5... -
-   - - CMD_OPEN = 3 -
-   - - CMD_OPENDIR = 11 -
-   - - CMD_READ = 5 -
-   - - CMD_READDIR = 12 -
-   - - CMD_READLINK = 19 -
-   - - CMD_REALPATH = 16 -
-   - - CMD_REMOVE = 13 -
-   - - CMD_RENAME = 18 -
-   - - CMD_RMDIR = 15 -
-   - - CMD_SETSTAT = 9 -
-   - - CMD_STAT = 17 -
-   - - CMD_STATUS = 101 -
-   - - CMD_SYMLINK = 20 -
-   - - CMD_VERSION = 2 -
-   - - CMD_WRITE = 6 -
-   - - CONNECTION_FAILED_CODE = {1: 'Administratively prohibited', 2:... -
-   - - CRITICAL = 50 -
-   - - DEBUG = 10 -
-   - - DISCONNECT_AUTH_CANCELLED_BY_USER = 13 -
-   - - DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14 -
-   - - DISCONNECT_SERVICE_NOT_AVAILABLE = 7 -
-   - - ERROR = 40 -
-   - - INFO = 20 -
-   - - MSG_CHANNEL_CLOSE = 97 -
-   - - MSG_CHANNEL_DATA = 94 -
-   - - MSG_CHANNEL_EOF = 96 -
-   - - MSG_CHANNEL_EXTENDED_DATA = 95 -
-   - - MSG_CHANNEL_FAILURE = 100 -
-   - - MSG_CHANNEL_OPEN = 90 -
-   - - MSG_CHANNEL_OPEN_FAILURE = 92 -
-   - - MSG_CHANNEL_OPEN_SUCCESS = 91 -
-   - - MSG_CHANNEL_REQUEST = 98 -
-   - - MSG_CHANNEL_SUCCESS = 99 -
-   - - MSG_CHANNEL_WINDOW_ADJUST = 93 -
-   - - MSG_DEBUG = 4 -
-   - - MSG_DISCONNECT = 1 -
-   - - MSG_GLOBAL_REQUEST = 80 -
-   - - MSG_IGNORE = 2 -
-   - - MSG_KEXINIT = 20 -
-   - - MSG_NAMES = {1: 'disconnect', 2: 'ignore', 3: 'unimplemented',... -
-   - - MSG_NEWKEYS = 21 -
-   - - MSG_REQUEST_FAILURE = 82 -
-   - - MSG_REQUEST_SUCCESS = 81 -
-   - - MSG_SERVICE_ACCEPT = 6 -
-   - - MSG_SERVICE_REQUEST = 5 -
-   - - MSG_UNIMPLEMENTED = 3 -
-   - - MSG_USERAUTH_BANNER = 53 -
-   - - MSG_USERAUTH_FAILURE = 51 -
-   - - MSG_USERAUTH_INFO_REQUEST = 60 -
-   - - MSG_USERAUTH_INFO_RESPONSE = 61 -
-   - - MSG_USERAUTH_PK_OK = 60 -
-   - - MSG_USERAUTH_REQUEST = 50 -
-   - - MSG_USERAUTH_SUCCESS = 52 -
-   - - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED = 1 -
-   - - OPEN_FAILED_CONNECT_FAILED = 2 -
-   - - OPEN_FAILED_RESOURCE_SHORTAGE = 4 -
-   - - OPEN_FAILED_UNKNOWN_CHANNEL_TYPE = 3 -
-   - - OPEN_SUCCEEDED = 0 -
-   - - PY22 = False -
-   - - SFTP_BAD_MESSAGE = 5 -
-   - - SFTP_CONNECTION_LOST = 7 -
-   - - SFTP_DESC = ['Success', 'End of file', 'No such file', 'Permis... -
-   - - SFTP_EOF = 1 -
-   - - SFTP_FAILURE = 4 -
-   - - SFTP_FLAG_APPEND = 4 -
-   - - SFTP_FLAG_CREATE = 8 -
-   - - SFTP_FLAG_EXCL = 32 -
-   - - SFTP_FLAG_READ = 1 -
-   - - SFTP_FLAG_TRUNC = 16 -
-   - - SFTP_FLAG_WRITE = 2 -
-   - - SFTP_NO_CONNECTION = 6 -
-   - - SFTP_NO_SUCH_FILE = 2 -
-   - - SFTP_OK = 0 -
-   - - SFTP_OP_UNSUPPORTED = 8 -
-   - - SFTP_PERMISSION_DENIED = 3 -
-   - - WARNING = 30 -
-   - - __package__ = 'paramiko' -
-   - - rng = Random.new() -
- - - - - - -
- Variables Details
- -
- -
-

CMD_NAMES

- -
-
-
-
Value:
-
-{1: 'init',
- 2: 'version',
- 3: 'open',
- 4: 'close',
- 5: 'read',
- 6: 'write',
- 7: 'lstat',
- 8: 'fstat',
-...
-
-
-
-
-
- -
- -
-

CONNECTION_FAILED_CODE

- -
-
-
-
Value:
-
-{1: 'Administratively prohibited',
- 2: 'Connect failed',
- 3: 'Unknown channel type',
- 4: 'Resource shortage'}
-
-
-
-
-
- -
- -
-

MSG_NAMES

- -
-
-
-
Value:
-
-{1: 'disconnect',
- 2: 'ignore',
- 3: 'unimplemented',
- 4: 'debug',
- 5: 'service-request',
- 6: 'service-accept',
- 20: 'kexinit',
- 21: 'newkeys',
-...
-
-
-
-
-
- -
- -
-

SFTP_DESC

- -
-
-
-
Value:
-
-['Success',
- 'End of file',
- 'No such file',
- 'Permission denied',
- 'Failure',
- 'Bad message',
- 'No connection',
- 'Connection lost',
-...
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.sftp_handle-pysrc.html b/docs/paramiko.sftp_handle-pysrc.html deleted file mode 100644 index 58844a7..0000000 --- a/docs/paramiko.sftp_handle-pysrc.html +++ /dev/null @@ -1,369 +0,0 @@ - - - - - paramiko.sftp_handle - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_handle - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.sftp_handle

-
-  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  Abstraction of an SFTP file handle (for server mode). 
- 21  """ 
- 22   
- 23  import os 
- 24   
- 25  from paramiko.common import * 
- 26  from paramiko.sftp import * 
- 27   
- 28   
-
29 -class SFTPHandle (object): -
30 """ - 31 Abstract object representing a handle to an open file (or folder) in an - 32 SFTP server implementation. Each handle has a string representation used - 33 by the client to refer to the underlying file. - 34 - 35 Server implementations can (and should) subclass SFTPHandle to implement - 36 features of a file handle, like L{stat} or L{chattr}. - 37 """ -
38 - def __init__(self, flags=0): -
39 """ - 40 Create a new file handle representing a local file being served over - 41 SFTP. If C{flags} is passed in, it's used to determine if the file - 42 is open in append mode. - 43 - 44 @param flags: optional flags as passed to L{SFTPServerInterface.open} - 45 @type flags: int - 46 """ - 47 self.__flags = flags - 48 self.__name = None - 49 # only for handles to folders: - 50 self.__files = { } - 51 self.__tell = None -
52 -
53 - def close(self): -
54 """ - 55 When a client closes a file, this method is called on the handle. - 56 Normally you would use this method to close the underlying OS level - 57 file object(s). - 58 - 59 The default implementation checks for attributes on C{self} named - 60 C{readfile} and/or C{writefile}, and if either or both are present, - 61 their C{close()} methods are called. This means that if you are - 62 using the default implementations of L{read} and L{write}, this - 63 method's default implementation should be fine also. - 64 """ - 65 readfile = getattr(self, 'readfile', None) - 66 if readfile is not None: - 67 readfile.close() - 68 writefile = getattr(self, 'writefile', None) - 69 if writefile is not None: - 70 writefile.close() -
71 -
72 - def read(self, offset, length): -
73 """ - 74 Read up to C{length} bytes from this file, starting at position - 75 C{offset}. The offset may be a python long, since SFTP allows it - 76 to be 64 bits. - 77 - 78 If the end of the file has been reached, this method may return an - 79 empty string to signify EOF, or it may also return L{SFTP_EOF}. - 80 - 81 The default implementation checks for an attribute on C{self} named - 82 C{readfile}, and if present, performs the read operation on the python - 83 file-like object found there. (This is meant as a time saver for the - 84 common case where you are wrapping a python file object.) - 85 - 86 @param offset: position in the file to start reading from. - 87 @type offset: int or long - 88 @param length: number of bytes to attempt to read. - 89 @type length: int - 90 @return: data read from the file, or an SFTP error code. - 91 @rtype: str - 92 """ - 93 readfile = getattr(self, 'readfile', None) - 94 if readfile is None: - 95 return SFTP_OP_UNSUPPORTED - 96 try: - 97 if self.__tell is None: - 98 self.__tell = readfile.tell() - 99 if offset != self.__tell: -100 readfile.seek(offset) -101 self.__tell = offset -102 data = readfile.read(length) -103 except IOError, e: -104 self.__tell = None -105 return SFTPServer.convert_errno(e.errno) -106 self.__tell += len(data) -107 return data -
108 -
109 - def write(self, offset, data): -
110 """ -111 Write C{data} into this file at position C{offset}. Extending the -112 file past its original end is expected. Unlike python's normal -113 C{write()} methods, this method cannot do a partial write: it must -114 write all of C{data} or else return an error. -115 -116 The default implementation checks for an attribute on C{self} named -117 C{writefile}, and if present, performs the write operation on the -118 python file-like object found there. The attribute is named -119 differently from C{readfile} to make it easy to implement read-only -120 (or write-only) files, but if both attributes are present, they should -121 refer to the same file. -122 -123 @param offset: position in the file to start reading from. -124 @type offset: int or long -125 @param data: data to write into the file. -126 @type data: str -127 @return: an SFTP error code like L{SFTP_OK}. -128 """ -129 writefile = getattr(self, 'writefile', None) -130 if writefile is None: -131 return SFTP_OP_UNSUPPORTED -132 try: -133 # in append mode, don't care about seeking -134 if (self.__flags & os.O_APPEND) == 0: -135 if self.__tell is None: -136 self.__tell = writefile.tell() -137 if offset != self.__tell: -138 writefile.seek(offset) -139 self.__tell = offset -140 writefile.write(data) -141 writefile.flush() -142 except IOError, e: -143 self.__tell = None -144 return SFTPServer.convert_errno(e.errno) -145 if self.__tell is not None: -146 self.__tell += len(data) -147 return SFTP_OK -
148 -
149 - def stat(self): -
150 """ -151 Return an L{SFTPAttributes} object referring to this open file, or an -152 error code. This is equivalent to L{SFTPServerInterface.stat}, except -153 it's called on an open file instead of a path. -154 -155 @return: an attributes object for the given file, or an SFTP error -156 code (like L{SFTP_PERMISSION_DENIED}). -157 @rtype: L{SFTPAttributes} I{or error code} -158 """ -159 return SFTP_OP_UNSUPPORTED -
160 -
161 - def chattr(self, attr): -
162 """ -163 Change the attributes of this file. The C{attr} object will contain -164 only those fields provided by the client in its request, so you should -165 check for the presence of fields before using them. -166 -167 @param attr: the attributes to change on this file. -168 @type attr: L{SFTPAttributes} -169 @return: an error code like L{SFTP_OK}. -170 @rtype: int -171 """ -172 return SFTP_OP_UNSUPPORTED -
173 -174 -175 ### internals... -176 -177 -
178 - def _set_files(self, files): -
179 """ -180 Used by the SFTP server code to cache a directory listing. (In -181 the SFTP protocol, listing a directory is a multi-stage process -182 requiring a temporary handle.) -183 """ -184 self.__files = files -
185 -
186 - def _get_next_files(self): -
187 """ -188 Used by the SFTP server code to retreive a cached directory -189 listing. -190 """ -191 fnlist = self.__files[:16] -192 self.__files = self.__files[16:] -193 return fnlist -
194 -
195 - def _get_name(self): -
196 return self.__name -
197 -
198 - def _set_name(self, name): -
199 self.__name = name -
200 -201 -202 from paramiko.sftp_server import SFTPServer -203 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.sftp_server-module.html b/docs/paramiko.sftp_server-module.html deleted file mode 100644 index 80561a9..0000000 --- a/docs/paramiko.sftp_server-module.html +++ /dev/null @@ -1,907 +0,0 @@ - - - - - paramiko.sftp_server - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_server - - - - - -
[frames] | no frames]
-
- -

Module sftp_server

source code

-

Server-mode SFTP support.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Variables
-   - - AUTH_FAILED = 2 -
-   - - AUTH_PARTIALLY_SUCCESSFUL = 1 -
-   - - AUTH_SUCCESSFUL = 0 -
-   - - CMD_ATTRS = 105 -
-   - - CMD_CLOSE = 4 -
-   - - CMD_DATA = 103 -
-   - - CMD_EXTENDED = 200 -
-   - - CMD_EXTENDED_REPLY = 201 -
-   - - CMD_FSETSTAT = 10 -
-   - - CMD_FSTAT = 8 -
-   - - CMD_HANDLE = 102 -
-   - - CMD_INIT = 1 -
-   - - CMD_LSTAT = 7 -
-   - - CMD_MKDIR = 14 -
-   - - CMD_NAME = 104 -
-   - - CMD_NAMES = {1: 'init', 2: 'version', 3: 'open', 4: 'close', 5... -
-   - - CMD_OPEN = 3 -
-   - - CMD_OPENDIR = 11 -
-   - - CMD_READ = 5 -
-   - - CMD_READDIR = 12 -
-   - - CMD_READLINK = 19 -
-   - - CMD_REALPATH = 16 -
-   - - CMD_REMOVE = 13 -
-   - - CMD_RENAME = 18 -
-   - - CMD_RMDIR = 15 -
-   - - CMD_SETSTAT = 9 -
-   - - CMD_STAT = 17 -
-   - - CMD_STATUS = 101 -
-   - - CMD_SYMLINK = 20 -
-   - - CMD_VERSION = 2 -
-   - - CMD_WRITE = 6 -
-   - - CONNECTION_FAILED_CODE = {1: 'Administratively prohibited', 2:... -
-   - - CRITICAL = 50 -
-   - - DEBUG = 10 -
-   - - DISCONNECT_AUTH_CANCELLED_BY_USER = 13 -
-   - - DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14 -
-   - - DISCONNECT_SERVICE_NOT_AVAILABLE = 7 -
-   - - ERROR = 40 -
-   - - INFO = 20 -
-   - - MSG_CHANNEL_CLOSE = 97 -
-   - - MSG_CHANNEL_DATA = 94 -
-   - - MSG_CHANNEL_EOF = 96 -
-   - - MSG_CHANNEL_EXTENDED_DATA = 95 -
-   - - MSG_CHANNEL_FAILURE = 100 -
-   - - MSG_CHANNEL_OPEN = 90 -
-   - - MSG_CHANNEL_OPEN_FAILURE = 92 -
-   - - MSG_CHANNEL_OPEN_SUCCESS = 91 -
-   - - MSG_CHANNEL_REQUEST = 98 -
-   - - MSG_CHANNEL_SUCCESS = 99 -
-   - - MSG_CHANNEL_WINDOW_ADJUST = 93 -
-   - - MSG_DEBUG = 4 -
-   - - MSG_DISCONNECT = 1 -
-   - - MSG_GLOBAL_REQUEST = 80 -
-   - - MSG_IGNORE = 2 -
-   - - MSG_KEXINIT = 20 -
-   - - MSG_NAMES = {1: 'disconnect', 2: 'ignore', 3: 'unimplemented',... -
-   - - MSG_NEWKEYS = 21 -
-   - - MSG_REQUEST_FAILURE = 82 -
-   - - MSG_REQUEST_SUCCESS = 81 -
-   - - MSG_SERVICE_ACCEPT = 6 -
-   - - MSG_SERVICE_REQUEST = 5 -
-   - - MSG_UNIMPLEMENTED = 3 -
-   - - MSG_USERAUTH_BANNER = 53 -
-   - - MSG_USERAUTH_FAILURE = 51 -
-   - - MSG_USERAUTH_INFO_REQUEST = 60 -
-   - - MSG_USERAUTH_INFO_RESPONSE = 61 -
-   - - MSG_USERAUTH_PK_OK = 60 -
-   - - MSG_USERAUTH_REQUEST = 50 -
-   - - MSG_USERAUTH_SUCCESS = 52 -
-   - - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED = 1 -
-   - - OPEN_FAILED_CONNECT_FAILED = 2 -
-   - - OPEN_FAILED_RESOURCE_SHORTAGE = 4 -
-   - - OPEN_FAILED_UNKNOWN_CHANNEL_TYPE = 3 -
-   - - OPEN_SUCCEEDED = 0 -
-   - - PY22 = False -
-   - - SFTP_BAD_MESSAGE = 5 -
-   - - SFTP_CONNECTION_LOST = 7 -
-   - - SFTP_DESC = ['Success', 'End of file', 'No such file', 'Permis... -
-   - - SFTP_EOF = 1 -
-   - - SFTP_FAILURE = 4 -
-   - - SFTP_FLAG_APPEND = 4 -
-   - - SFTP_FLAG_CREATE = 8 -
-   - - SFTP_FLAG_EXCL = 32 -
-   - - SFTP_FLAG_READ = 1 -
-   - - SFTP_FLAG_TRUNC = 16 -
-   - - SFTP_FLAG_WRITE = 2 -
-   - - SFTP_NO_CONNECTION = 6 -
-   - - SFTP_NO_SUCH_FILE = 2 -
-   - - SFTP_OK = 0 -
-   - - SFTP_OP_UNSUPPORTED = 8 -
-   - - SFTP_PERMISSION_DENIED = 3 -
-   - - WARNING = 30 -
-   - - __package__ = 'paramiko' -
-   - - rng = Random.new() -
- - - - - - -
- Variables Details
- -
- -
-

CMD_NAMES

- -
-
-
-
Value:
-
-{1: 'init',
- 2: 'version',
- 3: 'open',
- 4: 'close',
- 5: 'read',
- 6: 'write',
- 7: 'lstat',
- 8: 'fstat',
-...
-
-
-
-
-
- -
- -
-

CONNECTION_FAILED_CODE

- -
-
-
-
Value:
-
-{1: 'Administratively prohibited',
- 2: 'Connect failed',
- 3: 'Unknown channel type',
- 4: 'Resource shortage'}
-
-
-
-
-
- -
- -
-

MSG_NAMES

- -
-
-
-
Value:
-
-{1: 'disconnect',
- 2: 'ignore',
- 3: 'unimplemented',
- 4: 'debug',
- 5: 'service-request',
- 6: 'service-accept',
- 20: 'kexinit',
- 21: 'newkeys',
-...
-
-
-
-
-
- -
- -
-

SFTP_DESC

- -
-
-
-
Value:
-
-['Success',
- 'End of file',
- 'No such file',
- 'Permission denied',
- 'Failure',
- 'Bad message',
- 'No connection',
- 'Connection lost',
-...
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.sftp_server-pysrc.html b/docs/paramiko.sftp_server-pysrc.html deleted file mode 100644 index 834740d..0000000 --- a/docs/paramiko.sftp_server-pysrc.html +++ /dev/null @@ -1,1196 +0,0 @@ - - - - - paramiko.sftp_server - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_server - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.sftp_server

-
-  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  Server-mode SFTP support. 
- 21  """ 
- 22   
- 23  import os 
- 24  import errno 
- 25   
- 26  from Crypto.Hash import MD5, SHA 
- 27  from paramiko.common import * 
- 28  from paramiko.server import SubsystemHandler 
- 29  from paramiko.sftp import * 
- 30  from paramiko.sftp_si import * 
- 31  from paramiko.sftp_attr import * 
- 32   
- 33   
- 34  # known hash algorithms for the "check-file" extension 
- 35  _hash_class = { 
- 36      'sha1': SHA, 
- 37      'md5': MD5, 
- 38  } 
- 39   
- 40   
-
41 -class SFTPServer (BaseSFTP, SubsystemHandler): -
42 """ - 43 Server-side SFTP subsystem support. Since this is a L{SubsystemHandler}, - 44 it can be (and is meant to be) set as the handler for C{"sftp"} requests. - 45 Use L{Transport.set_subsystem_handler} to activate this class. - 46 """ - 47 -
48 - def __init__(self, channel, name, server, sftp_si=SFTPServerInterface, *largs, **kwargs): -
49 """ - 50 The constructor for SFTPServer is meant to be called from within the - 51 L{Transport} as a subsystem handler. C{server} and any additional - 52 parameters or keyword parameters are passed from the original call to - 53 L{Transport.set_subsystem_handler}. - 54 - 55 @param channel: channel passed from the L{Transport}. - 56 @type channel: L{Channel} - 57 @param name: name of the requested subsystem. - 58 @type name: str - 59 @param server: the server object associated with this channel and - 60 subsystem - 61 @type server: L{ServerInterface} - 62 @param sftp_si: a subclass of L{SFTPServerInterface} to use for handling - 63 individual requests. - 64 @type sftp_si: class - 65 """ - 66 BaseSFTP.__init__(self) - 67 SubsystemHandler.__init__(self, channel, name, server) - 68 transport = channel.get_transport() - 69 self.logger = util.get_logger(transport.get_log_channel() + '.sftp') - 70 self.ultra_debug = transport.get_hexdump() - 71 self.next_handle = 1 - 72 # map of handle-string to SFTPHandle for files & folders: - 73 self.file_table = { } - 74 self.folder_table = { } - 75 self.server = sftp_si(server, *largs, **kwargs) -
76 -
77 - def _log(self, level, msg): -
78 if issubclass(type(msg), list): - 79 for m in msg: - 80 super(SFTPServer, self)._log(level, "[chan " + self.sock.get_name() + "] " + m) - 81 else: - 82 super(SFTPServer, self)._log(level, "[chan " + self.sock.get_name() + "] " + msg) -
83 -
84 - def start_subsystem(self, name, transport, channel): -
85 self.sock = channel - 86 self._log(DEBUG, 'Started sftp server on channel %s' % repr(channel)) - 87 self._send_server_version() - 88 self.server.session_started() - 89 while True: - 90 try: - 91 t, data = self._read_packet() - 92 except EOFError: - 93 self._log(DEBUG, 'EOF -- end of session') - 94 return - 95 except Exception, e: - 96 self._log(DEBUG, 'Exception on channel: ' + str(e)) - 97 self._log(DEBUG, util.tb_strings()) - 98 return - 99 msg = Message(data) -100 request_number = msg.get_int() -101 try: -102 self._process(t, request_number, msg) -103 except Exception, e: -104 self._log(DEBUG, 'Exception in server processing: ' + str(e)) -105 self._log(DEBUG, util.tb_strings()) -106 # send some kind of failure message, at least -107 try: -108 self._send_status(request_number, SFTP_FAILURE) -109 except: -110 pass -
111 -
112 - def finish_subsystem(self): -
113 self.server.session_ended() -114 super(SFTPServer, self).finish_subsystem() -115 # close any file handles that were left open (so we can return them to the OS quickly) -116 for f in self.file_table.itervalues(): -117 f.close() -118 for f in self.folder_table.itervalues(): -119 f.close() -120 self.file_table = {} -121 self.folder_table = {} -
122 -
123 - def convert_errno(e): -
124 """ -125 Convert an errno value (as from an C{OSError} or C{IOError}) into a -126 standard SFTP result code. This is a convenience function for trapping -127 exceptions in server code and returning an appropriate result. -128 -129 @param e: an errno code, as from C{OSError.errno}. -130 @type e: int -131 @return: an SFTP error code like L{SFTP_NO_SUCH_FILE}. -132 @rtype: int -133 """ -134 if e == errno.EACCES: -135 # permission denied -136 return SFTP_PERMISSION_DENIED -137 elif (e == errno.ENOENT) or (e == errno.ENOTDIR): -138 # no such file -139 return SFTP_NO_SUCH_FILE -140 else: -141 return SFTP_FAILURE -
142 convert_errno = staticmethod(convert_errno) -143 -
144 - def set_file_attr(filename, attr): -
145 """ -146 Change a file's attributes on the local filesystem. The contents of -147 C{attr} are used to change the permissions, owner, group ownership, -148 and/or modification & access time of the file, depending on which -149 attributes are present in C{attr}. -150 -151 This is meant to be a handy helper function for translating SFTP file -152 requests into local file operations. -153 -154 @param filename: name of the file to alter (should usually be an -155 absolute path). -156 @type filename: str -157 @param attr: attributes to change. -158 @type attr: L{SFTPAttributes} -159 """ -160 if sys.platform != 'win32': -161 # mode operations are meaningless on win32 -162 if attr._flags & attr.FLAG_PERMISSIONS: -163 os.chmod(filename, attr.st_mode) -164 if attr._flags & attr.FLAG_UIDGID: -165 os.chown(filename, attr.st_uid, attr.st_gid) -166 if attr._flags & attr.FLAG_AMTIME: -167 os.utime(filename, (attr.st_atime, attr.st_mtime)) -168 if attr._flags & attr.FLAG_SIZE: -169 open(filename, 'w+').truncate(attr.st_size) -
170 set_file_attr = staticmethod(set_file_attr) -171 -172 -173 ### internals... -174 -175 -
176 - def _response(self, request_number, t, *arg): -
177 msg = Message() -178 msg.add_int(request_number) -179 for item in arg: -180 if type(item) is int: -181 msg.add_int(item) -182 elif type(item) is long: -183 msg.add_int64(item) -184 elif type(item) is str: -185 msg.add_string(item) -186 elif type(item) is SFTPAttributes: -187 item._pack(msg) -188 else: -189 raise Exception('unknown type for ' + repr(item) + ' type ' + repr(type(item))) -190 self._send_packet(t, str(msg)) -
191 -
192 - def _send_handle_response(self, request_number, handle, folder=False): -
193 if not issubclass(type(handle), SFTPHandle): -194 # must be error code -195 self._send_status(request_number, handle) -196 return -197 handle._set_name('hx%d' % self.next_handle) -198 self.next_handle += 1 -199 if folder: -200 self.folder_table[handle._get_name()] = handle -201 else: -202 self.file_table[handle._get_name()] = handle -203 self._response(request_number, CMD_HANDLE, handle._get_name()) -
204 -
205 - def _send_status(self, request_number, code, desc=None): -
206 if desc is None: -207 try: -208 desc = SFTP_DESC[code] -209 except IndexError: -210 desc = 'Unknown' -211 # some clients expect a "langauge" tag at the end (but don't mind it being blank) -212 self._response(request_number, CMD_STATUS, code, desc, '') -
213 -
214 - def _open_folder(self, request_number, path): -
215 resp = self.server.list_folder(path) -216 if issubclass(type(resp), list): -217 # got an actual list of filenames in the folder -218 folder = SFTPHandle() -219 folder._set_files(resp) -220 self._send_handle_response(request_number, folder, True) -221 return -222 # must be an error code -223 self._send_status(request_number, resp) -
224 -
225 - def _read_folder(self, request_number, folder): -
226 flist = folder._get_next_files() -227 if len(flist) == 0: -228 self._send_status(request_number, SFTP_EOF) -229 return -230 msg = Message() -231 msg.add_int(request_number) -232 msg.add_int(len(flist)) -233 for attr in flist: -234 msg.add_string(attr.filename) -235 msg.add_string(str(attr)) -236 attr._pack(msg) -237 self._send_packet(CMD_NAME, str(msg)) -
238 -
239 - def _check_file(self, request_number, msg): -
240 # this extension actually comes from v6 protocol, but since it's an -241 # extension, i feel like we can reasonably support it backported. -242 # it's very useful for verifying uploaded files or checking for -243 # rsync-like differences between local and remote files. -244 handle = msg.get_string() -245 alg_list = msg.get_list() -246 start = msg.get_int64() -247 length = msg.get_int64() -248 block_size = msg.get_int() -249 if handle not in self.file_table: -250 self._send_status(request_number, SFTP_BAD_MESSAGE, 'Invalid handle') -251 return -252 f = self.file_table[handle] -253 for x in alg_list: -254 if x in _hash_class: -255 algname = x -256 alg = _hash_class[x] -257 break -258 else: -259 self._send_status(request_number, SFTP_FAILURE, 'No supported hash types found') -260 return -261 if length == 0: -262 st = f.stat() -263 if not issubclass(type(st), SFTPAttributes): -264 self._send_status(request_number, st, 'Unable to stat file') -265 return -266 length = st.st_size - start -267 if block_size == 0: -268 block_size = length -269 if block_size < 256: -270 self._send_status(request_number, SFTP_FAILURE, 'Block size too small') -271 return -272 -273 sum_out = '' -274 offset = start -275 while offset < start + length: -276 blocklen = min(block_size, start + length - offset) -277 # don't try to read more than about 64KB at a time -278 chunklen = min(blocklen, 65536) -279 count = 0 -280 hash_obj = alg.new() -281 while count < blocklen: -282 data = f.read(offset, chunklen) -283 if not type(data) is str: -284 self._send_status(request_number, data, 'Unable to hash file') -285 return -286 hash_obj.update(data) -287 count += len(data) -288 offset += count -289 sum_out += hash_obj.digest() -290 -291 msg = Message() -292 msg.add_int(request_number) -293 msg.add_string('check-file') -294 msg.add_string(algname) -295 msg.add_bytes(sum_out) -296 self._send_packet(CMD_EXTENDED_REPLY, str(msg)) -
297 -
298 - def _convert_pflags(self, pflags): -
299 "convert SFTP-style open() flags to python's os.open() flags" -300 if (pflags & SFTP_FLAG_READ) and (pflags & SFTP_FLAG_WRITE): -301 flags = os.O_RDWR -302 elif pflags & SFTP_FLAG_WRITE: -303 flags = os.O_WRONLY -304 else: -305 flags = os.O_RDONLY -306 if pflags & SFTP_FLAG_APPEND: -307 flags |= os.O_APPEND -308 if pflags & SFTP_FLAG_CREATE: -309 flags |= os.O_CREAT -310 if pflags & SFTP_FLAG_TRUNC: -311 flags |= os.O_TRUNC -312 if pflags & SFTP_FLAG_EXCL: -313 flags |= os.O_EXCL -314 return flags -
315 -
316 - def _process(self, t, request_number, msg): -
317 self._log(DEBUG, 'Request: %s' % CMD_NAMES[t]) -318 if t == CMD_OPEN: -319 path = msg.get_string() -320 flags = self._convert_pflags(msg.get_int()) -321 attr = SFTPAttributes._from_msg(msg) -322 self._send_handle_response(request_number, self.server.open(path, flags, attr)) -323 elif t == CMD_CLOSE: -324 handle = msg.get_string() -325 if handle in self.folder_table: -326 del self.folder_table[handle] -327 self._send_status(request_number, SFTP_OK) -328 return -329 if handle in self.file_table: -330 self.file_table[handle].close() -331 del self.file_table[handle] -332 self._send_status(request_number, SFTP_OK) -333 return -334 self._send_status(request_number, SFTP_BAD_MESSAGE, 'Invalid handle') -335 elif t == CMD_READ: -336 handle = msg.get_string() -337 offset = msg.get_int64() -338 length = msg.get_int() -339 if handle not in self.file_table: -340 self._send_status(request_number, SFTP_BAD_MESSAGE, 'Invalid handle') -341 return -342 data = self.file_table[handle].read(offset, length) -343 if type(data) is str: -344 if len(data) == 0: -345 self._send_status(request_number, SFTP_EOF) -346 else: -347 self._response(request_number, CMD_DATA, data) -348 else: -349 self._send_status(request_number, data) -350 elif t == CMD_WRITE: -351 handle = msg.get_string() -352 offset = msg.get_int64() -353 data = msg.get_string() -354 if handle not in self.file_table: -355 self._send_status(request_number, SFTP_BAD_MESSAGE, 'Invalid handle') -356 return -357 self._send_status(request_number, self.file_table[handle].write(offset, data)) -358 elif t == CMD_REMOVE: -359 path = msg.get_string() -360 self._send_status(request_number, self.server.remove(path)) -361 elif t == CMD_RENAME: -362 oldpath = msg.get_string() -363 newpath = msg.get_string() -364 self._send_status(request_number, self.server.rename(oldpath, newpath)) -365 elif t == CMD_MKDIR: -366 path = msg.get_string() -367 attr = SFTPAttributes._from_msg(msg) -368 self._send_status(request_number, self.server.mkdir(path, attr)) -369 elif t == CMD_RMDIR: -370 path = msg.get_string() -371 self._send_status(request_number, self.server.rmdir(path)) -372 elif t == CMD_OPENDIR: -373 path = msg.get_string() -374 self._open_folder(request_number, path) -375 return -376 elif t == CMD_READDIR: -377 handle = msg.get_string() -378 if handle not in self.folder_table: -379 self._send_status(request_number, SFTP_BAD_MESSAGE, 'Invalid handle') -380 return -381 folder = self.folder_table[handle] -382 self._read_folder(request_number, folder) -383 elif t == CMD_STAT: -384 path = msg.get_string() -385 resp = self.server.stat(path) -386 if issubclass(type(resp), SFTPAttributes): -387 self._response(request_number, CMD_ATTRS, resp) -388 else: -389 self._send_status(request_number, resp) -390 elif t == CMD_LSTAT: -391 path = msg.get_string() -392 resp = self.server.lstat(path) -393 if issubclass(type(resp), SFTPAttributes): -394 self._response(request_number, CMD_ATTRS, resp) -395 else: -396 self._send_status(request_number, resp) -397 elif t == CMD_FSTAT: -398 handle = msg.get_string() -399 if handle not in self.file_table: -400 self._send_status(request_number, SFTP_BAD_MESSAGE, 'Invalid handle') -401 return -402 resp = self.file_table[handle].stat() -403 if issubclass(type(resp), SFTPAttributes): -404 self._response(request_number, CMD_ATTRS, resp) -405 else: -406 self._send_status(request_number, resp) -407 elif t == CMD_SETSTAT: -408 path = msg.get_string() -409 attr = SFTPAttributes._from_msg(msg) -410 self._send_status(request_number, self.server.chattr(path, attr)) -411 elif t == CMD_FSETSTAT: -412 handle = msg.get_string() -413 attr = SFTPAttributes._from_msg(msg) -414 if handle not in self.file_table: -415 self._response(request_number, SFTP_BAD_MESSAGE, 'Invalid handle') -416 return -417 self._send_status(request_number, self.file_table[handle].chattr(attr)) -418 elif t == CMD_READLINK: -419 path = msg.get_string() -420 resp = self.server.readlink(path) -421 if type(resp) is str: -422 self._response(request_number, CMD_NAME, 1, resp, '', SFTPAttributes()) -423 else: -424 self._send_status(request_number, resp) -425 elif t == CMD_SYMLINK: -426 # the sftp 2 draft is incorrect here! path always follows target_path -427 target_path = msg.get_string() -428 path = msg.get_string() -429 self._send_status(request_number, self.server.symlink(target_path, path)) -430 elif t == CMD_REALPATH: -431 path = msg.get_string() -432 rpath = self.server.canonicalize(path) -433 self._response(request_number, CMD_NAME, 1, rpath, '', SFTPAttributes()) -434 elif t == CMD_EXTENDED: -435 tag = msg.get_string() -436 if tag == 'check-file': -437 self._check_file(request_number, msg) -438 else: -439 self._send_status(request_number, SFTP_OP_UNSUPPORTED) -440 else: -441 self._send_status(request_number, SFTP_OP_UNSUPPORTED) -
442 -443 -444 from paramiko.sftp_handle import SFTPHandle -445 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.sftp_si-module.html b/docs/paramiko.sftp_si-module.html deleted file mode 100644 index 38c4bca..0000000 --- a/docs/paramiko.sftp_si-module.html +++ /dev/null @@ -1,909 +0,0 @@ - - - - - paramiko.sftp_si - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_si - - - - - -
[frames] | no frames]
-
- -

Module sftp_si

source code

-

SFTPServerInterface is an interface to override for SFTP - server support.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Variables
-   - - AUTH_FAILED = 2 -
-   - - AUTH_PARTIALLY_SUCCESSFUL = 1 -
-   - - AUTH_SUCCESSFUL = 0 -
-   - - CMD_ATTRS = 105 -
-   - - CMD_CLOSE = 4 -
-   - - CMD_DATA = 103 -
-   - - CMD_EXTENDED = 200 -
-   - - CMD_EXTENDED_REPLY = 201 -
-   - - CMD_FSETSTAT = 10 -
-   - - CMD_FSTAT = 8 -
-   - - CMD_HANDLE = 102 -
-   - - CMD_INIT = 1 -
-   - - CMD_LSTAT = 7 -
-   - - CMD_MKDIR = 14 -
-   - - CMD_NAME = 104 -
-   - - CMD_NAMES = {1: 'init', 2: 'version', 3: 'open', 4: 'close', 5... -
-   - - CMD_OPEN = 3 -
-   - - CMD_OPENDIR = 11 -
-   - - CMD_READ = 5 -
-   - - CMD_READDIR = 12 -
-   - - CMD_READLINK = 19 -
-   - - CMD_REALPATH = 16 -
-   - - CMD_REMOVE = 13 -
-   - - CMD_RENAME = 18 -
-   - - CMD_RMDIR = 15 -
-   - - CMD_SETSTAT = 9 -
-   - - CMD_STAT = 17 -
-   - - CMD_STATUS = 101 -
-   - - CMD_SYMLINK = 20 -
-   - - CMD_VERSION = 2 -
-   - - CMD_WRITE = 6 -
-   - - CONNECTION_FAILED_CODE = {1: 'Administratively prohibited', 2:... -
-   - - CRITICAL = 50 -
-   - - DEBUG = 10 -
-   - - DISCONNECT_AUTH_CANCELLED_BY_USER = 13 -
-   - - DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14 -
-   - - DISCONNECT_SERVICE_NOT_AVAILABLE = 7 -
-   - - ERROR = 40 -
-   - - INFO = 20 -
-   - - MSG_CHANNEL_CLOSE = 97 -
-   - - MSG_CHANNEL_DATA = 94 -
-   - - MSG_CHANNEL_EOF = 96 -
-   - - MSG_CHANNEL_EXTENDED_DATA = 95 -
-   - - MSG_CHANNEL_FAILURE = 100 -
-   - - MSG_CHANNEL_OPEN = 90 -
-   - - MSG_CHANNEL_OPEN_FAILURE = 92 -
-   - - MSG_CHANNEL_OPEN_SUCCESS = 91 -
-   - - MSG_CHANNEL_REQUEST = 98 -
-   - - MSG_CHANNEL_SUCCESS = 99 -
-   - - MSG_CHANNEL_WINDOW_ADJUST = 93 -
-   - - MSG_DEBUG = 4 -
-   - - MSG_DISCONNECT = 1 -
-   - - MSG_GLOBAL_REQUEST = 80 -
-   - - MSG_IGNORE = 2 -
-   - - MSG_KEXINIT = 20 -
-   - - MSG_NAMES = {1: 'disconnect', 2: 'ignore', 3: 'unimplemented',... -
-   - - MSG_NEWKEYS = 21 -
-   - - MSG_REQUEST_FAILURE = 82 -
-   - - MSG_REQUEST_SUCCESS = 81 -
-   - - MSG_SERVICE_ACCEPT = 6 -
-   - - MSG_SERVICE_REQUEST = 5 -
-   - - MSG_UNIMPLEMENTED = 3 -
-   - - MSG_USERAUTH_BANNER = 53 -
-   - - MSG_USERAUTH_FAILURE = 51 -
-   - - MSG_USERAUTH_INFO_REQUEST = 60 -
-   - - MSG_USERAUTH_INFO_RESPONSE = 61 -
-   - - MSG_USERAUTH_PK_OK = 60 -
-   - - MSG_USERAUTH_REQUEST = 50 -
-   - - MSG_USERAUTH_SUCCESS = 52 -
-   - - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED = 1 -
-   - - OPEN_FAILED_CONNECT_FAILED = 2 -
-   - - OPEN_FAILED_RESOURCE_SHORTAGE = 4 -
-   - - OPEN_FAILED_UNKNOWN_CHANNEL_TYPE = 3 -
-   - - OPEN_SUCCEEDED = 0 -
-   - - PY22 = False -
-   - - SFTP_BAD_MESSAGE = 5 -
-   - - SFTP_CONNECTION_LOST = 7 -
-   - - SFTP_DESC = ['Success', 'End of file', 'No such file', 'Permis... -
-   - - SFTP_EOF = 1 -
-   - - SFTP_FAILURE = 4 -
-   - - SFTP_FLAG_APPEND = 4 -
-   - - SFTP_FLAG_CREATE = 8 -
-   - - SFTP_FLAG_EXCL = 32 -
-   - - SFTP_FLAG_READ = 1 -
-   - - SFTP_FLAG_TRUNC = 16 -
-   - - SFTP_FLAG_WRITE = 2 -
-   - - SFTP_NO_CONNECTION = 6 -
-   - - SFTP_NO_SUCH_FILE = 2 -
-   - - SFTP_OK = 0 -
-   - - SFTP_OP_UNSUPPORTED = 8 -
-   - - SFTP_PERMISSION_DENIED = 3 -
-   - - WARNING = 30 -
-   - - __package__ = 'paramiko' -
-   - - rng = Random.new() -
- - - - - - -
- Variables Details
- -
- -
-

CMD_NAMES

- -
-
-
-
Value:
-
-{1: 'init',
- 2: 'version',
- 3: 'open',
- 4: 'close',
- 5: 'read',
- 6: 'write',
- 7: 'lstat',
- 8: 'fstat',
-...
-
-
-
-
-
- -
- -
-

CONNECTION_FAILED_CODE

- -
-
-
-
Value:
-
-{1: 'Administratively prohibited',
- 2: 'Connect failed',
- 3: 'Unknown channel type',
- 4: 'Resource shortage'}
-
-
-
-
-
- -
- -
-

MSG_NAMES

- -
-
-
-
Value:
-
-{1: 'disconnect',
- 2: 'ignore',
- 3: 'unimplemented',
- 4: 'debug',
- 5: 'service-request',
- 6: 'service-accept',
- 20: 'kexinit',
- 21: 'newkeys',
-...
-
-
-
-
-
- -
- -
-

SFTP_DESC

- -
-
-
-
Value:
-
-['Success',
- 'End of file',
- 'No such file',
- 'Permission denied',
- 'Failure',
- 'Bad message',
- 'No connection',
- 'Connection lost',
-...
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.sftp_si-pysrc.html b/docs/paramiko.sftp_si-pysrc.html deleted file mode 100644 index b7b90ed..0000000 --- a/docs/paramiko.sftp_si-pysrc.html +++ /dev/null @@ -1,527 +0,0 @@ - - - - - paramiko.sftp_si - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_si - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.sftp_si

-
-  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  L{SFTPServerInterface} is an interface to override for SFTP server support. 
- 21  """ 
- 22   
- 23  import os 
- 24   
- 25  from paramiko.common import * 
- 26  from paramiko.sftp import * 
- 27   
- 28   
-
29 -class SFTPServerInterface (object): -
30 """ - 31 This class defines an interface for controlling the behavior of paramiko - 32 when using the L{SFTPServer} subsystem to provide an SFTP server. - 33 - 34 Methods on this class are called from the SFTP session's thread, so you can - 35 block as long as necessary without affecting other sessions (even other - 36 SFTP sessions). However, raising an exception will usually cause the SFTP - 37 session to abruptly end, so you will usually want to catch exceptions and - 38 return an appropriate error code. - 39 - 40 All paths are in string form instead of unicode because not all SFTP - 41 clients & servers obey the requirement that paths be encoded in UTF-8. - 42 """ - 43 -
44 - def __init__ (self, server, *largs, **kwargs): -
45 """ - 46 Create a new SFTPServerInterface object. This method does nothing by - 47 default and is meant to be overridden by subclasses. - 48 - 49 @param server: the server object associated with this channel and - 50 SFTP subsystem - 51 @type server: L{ServerInterface} - 52 """ - 53 super(SFTPServerInterface, self).__init__(*largs, **kwargs) -
54 -
55 - def session_started(self): -
56 """ - 57 The SFTP server session has just started. This method is meant to be - 58 overridden to perform any necessary setup before handling callbacks - 59 from SFTP operations. - 60 """ - 61 pass -
62 -
63 - def session_ended(self): -
64 """ - 65 The SFTP server session has just ended, either cleanly or via an - 66 exception. This method is meant to be overridden to perform any - 67 necessary cleanup before this C{SFTPServerInterface} object is - 68 destroyed. - 69 """ - 70 pass -
71 -
72 - def open(self, path, flags, attr): -
73 """ - 74 Open a file on the server and create a handle for future operations - 75 on that file. On success, a new object subclassed from L{SFTPHandle} - 76 should be returned. This handle will be used for future operations - 77 on the file (read, write, etc). On failure, an error code such as - 78 L{SFTP_PERMISSION_DENIED} should be returned. - 79 - 80 C{flags} contains the requested mode for opening (read-only, - 81 write-append, etc) as a bitset of flags from the C{os} module: - 82 - C{os.O_RDONLY} - 83 - C{os.O_WRONLY} - 84 - C{os.O_RDWR} - 85 - C{os.O_APPEND} - 86 - C{os.O_CREAT} - 87 - C{os.O_TRUNC} - 88 - C{os.O_EXCL} - 89 (One of C{os.O_RDONLY}, C{os.O_WRONLY}, or C{os.O_RDWR} will always - 90 be set.) - 91 - 92 The C{attr} object contains requested attributes of the file if it - 93 has to be created. Some or all attribute fields may be missing if - 94 the client didn't specify them. - 95 - 96 @note: The SFTP protocol defines all files to be in "binary" mode. - 97 There is no equivalent to python's "text" mode. - 98 - 99 @param path: the requested path (relative or absolute) of the file -100 to be opened. -101 @type path: str -102 @param flags: flags or'd together from the C{os} module indicating the -103 requested mode for opening the file. -104 @type flags: int -105 @param attr: requested attributes of the file if it is newly created. -106 @type attr: L{SFTPAttributes} -107 @return: a new L{SFTPHandle} I{or error code}. -108 @rtype L{SFTPHandle} -109 """ -110 return SFTP_OP_UNSUPPORTED -
111 -
112 - def list_folder(self, path): -
113 """ -114 Return a list of files within a given folder. The C{path} will use -115 posix notation (C{"/"} separates folder names) and may be an absolute -116 or relative path. -117 -118 The list of files is expected to be a list of L{SFTPAttributes} -119 objects, which are similar in structure to the objects returned by -120 C{os.stat}. In addition, each object should have its C{filename} -121 field filled in, since this is important to a directory listing and -122 not normally present in C{os.stat} results. The method -123 L{SFTPAttributes.from_stat} will usually do what you want. -124 -125 In case of an error, you should return one of the C{SFTP_*} error -126 codes, such as L{SFTP_PERMISSION_DENIED}. -127 -128 @param path: the requested path (relative or absolute) to be listed. -129 @type path: str -130 @return: a list of the files in the given folder, using -131 L{SFTPAttributes} objects. -132 @rtype: list of L{SFTPAttributes} I{or error code} -133 -134 @note: You should normalize the given C{path} first (see the -135 C{os.path} module) and check appropriate permissions before returning -136 the list of files. Be careful of malicious clients attempting to use -137 relative paths to escape restricted folders, if you're doing a direct -138 translation from the SFTP server path to your local filesystem. -139 """ -140 return SFTP_OP_UNSUPPORTED -
141 -
142 - def stat(self, path): -
143 """ -144 Return an L{SFTPAttributes} object for a path on the server, or an -145 error code. If your server supports symbolic links (also known as -146 "aliases"), you should follow them. (L{lstat} is the corresponding -147 call that doesn't follow symlinks/aliases.) -148 -149 @param path: the requested path (relative or absolute) to fetch -150 file statistics for. -151 @type path: str -152 @return: an attributes object for the given file, or an SFTP error -153 code (like L{SFTP_PERMISSION_DENIED}). -154 @rtype: L{SFTPAttributes} I{or error code} -155 """ -156 return SFTP_OP_UNSUPPORTED -
157 -
158 - def lstat(self, path): -
159 """ -160 Return an L{SFTPAttributes} object for a path on the server, or an -161 error code. If your server supports symbolic links (also known as -162 "aliases"), you should I{not} follow them -- instead, you should -163 return data on the symlink or alias itself. (L{stat} is the -164 corresponding call that follows symlinks/aliases.) -165 -166 @param path: the requested path (relative or absolute) to fetch -167 file statistics for. -168 @type path: str -169 @return: an attributes object for the given file, or an SFTP error -170 code (like L{SFTP_PERMISSION_DENIED}). -171 @rtype: L{SFTPAttributes} I{or error code} -172 """ -173 return SFTP_OP_UNSUPPORTED -
174 -
175 - def remove(self, path): -
176 """ -177 Delete a file, if possible. -178 -179 @param path: the requested path (relative or absolute) of the file -180 to delete. -181 @type path: str -182 @return: an SFTP error code like L{SFTP_OK}. -183 @rtype: int -184 """ -185 return SFTP_OP_UNSUPPORTED -
186 -
187 - def rename(self, oldpath, newpath): -
188 """ -189 Rename (or move) a file. The SFTP specification implies that this -190 method can be used to move an existing file into a different folder, -191 and since there's no other (easy) way to move files via SFTP, it's -192 probably a good idea to implement "move" in this method too, even for -193 files that cross disk partition boundaries, if at all possible. -194 -195 @note: You should return an error if a file with the same name as -196 C{newpath} already exists. (The rename operation should be -197 non-desctructive.) -198 -199 @param oldpath: the requested path (relative or absolute) of the -200 existing file. -201 @type oldpath: str -202 @param newpath: the requested new path of the file. -203 @type newpath: str -204 @return: an SFTP error code like L{SFTP_OK}. -205 @rtype: int -206 """ -207 return SFTP_OP_UNSUPPORTED -
208 -
209 - def mkdir(self, path, attr): -
210 """ -211 Create a new directory with the given attributes. The C{attr} -212 object may be considered a "hint" and ignored. -213 -214 The C{attr} object will contain only those fields provided by the -215 client in its request, so you should use C{hasattr} to check for -216 the presense of fields before using them. In some cases, the C{attr} -217 object may be completely empty. -218 -219 @param path: requested path (relative or absolute) of the new -220 folder. -221 @type path: str -222 @param attr: requested attributes of the new folder. -223 @type attr: L{SFTPAttributes} -224 @return: an SFTP error code like L{SFTP_OK}. -225 @rtype: int -226 """ -227 return SFTP_OP_UNSUPPORTED -
228 -
229 - def rmdir(self, path): -
230 """ -231 Remove a directory if it exists. The C{path} should refer to an -232 existing, empty folder -- otherwise this method should return an -233 error. -234 -235 @param path: requested path (relative or absolute) of the folder -236 to remove. -237 @type path: str -238 @return: an SFTP error code like L{SFTP_OK}. -239 @rtype: int -240 """ -241 return SFTP_OP_UNSUPPORTED -
242 -
243 - def chattr(self, path, attr): -
244 """ -245 Change the attributes of a file. The C{attr} object will contain -246 only those fields provided by the client in its request, so you -247 should check for the presence of fields before using them. -248 -249 @param path: requested path (relative or absolute) of the file to -250 change. -251 @type path: str -252 @param attr: requested attributes to change on the file. -253 @type attr: L{SFTPAttributes} -254 @return: an error code like L{SFTP_OK}. -255 @rtype: int -256 """ -257 return SFTP_OP_UNSUPPORTED -
258 -
259 - def canonicalize(self, path): -
260 """ -261 Return the canonical form of a path on the server. For example, -262 if the server's home folder is C{/home/foo}, the path -263 C{"../betty"} would be canonicalized to C{"/home/betty"}. Note -264 the obvious security issues: if you're serving files only from a -265 specific folder, you probably don't want this method to reveal path -266 names outside that folder. -267 -268 You may find the python methods in C{os.path} useful, especially -269 C{os.path.normpath} and C{os.path.realpath}. -270 -271 The default implementation returns C{os.path.normpath('/' + path)}. -272 """ -273 if os.path.isabs(path): -274 out = os.path.normpath(path) -275 else: -276 out = os.path.normpath('/' + path) -277 if sys.platform == 'win32': -278 # on windows, normalize backslashes to sftp/posix format -279 out = out.replace('\\', '/') -280 return out -
281 -295 -
311 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.ssh_exception-module.html b/docs/paramiko.ssh_exception-module.html deleted file mode 100644 index 94b99c1..0000000 --- a/docs/paramiko.ssh_exception-module.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - paramiko.ssh_exception - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module ssh_exception - - - - - -
[frames] | no frames]
-
- -

Module ssh_exception

source code

-

Exceptions defined by paramiko.

- - - - - - - - - - -
- Classes
-   - - PartialAuthentication
- An internal exception thrown in the case of partial authentication. -
- - - - - - - - - -
- Variables
-   - - __package__ = None -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.ssh_exception-pysrc.html b/docs/paramiko.ssh_exception-pysrc.html deleted file mode 100644 index 1fe0c05..0000000 --- a/docs/paramiko.ssh_exception-pysrc.html +++ /dev/null @@ -1,403 +0,0 @@ - - - - - paramiko.ssh_exception - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module ssh_exception - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.ssh_exception

-
-  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  Exceptions defined by paramiko. 
- 21  """ 
- 22   
- 23   
-
24 -class SSHException (Exception): -
25 """ - 26 Exception raised by failures in SSH2 protocol negotiation or logic errors. - 27 """ - 28 pass -
29 - 30 -
31 -class AuthenticationException (SSHException): -
32 """ - 33 Exception raised when authentication failed for some reason. It may be - 34 possible to retry with different credentials. (Other classes specify more - 35 specific reasons.) - 36 - 37 @since: 1.6 - 38 """ - 39 pass -
40 - 41 -
42 -class PasswordRequiredException (AuthenticationException): -
43 """ - 44 Exception raised when a password is needed to unlock a private key file. - 45 """ - 46 pass -
47 - 48 -
49 -class BadAuthenticationType (AuthenticationException): -
50 """ - 51 Exception raised when an authentication type (like password) is used, but - 52 the server isn't allowing that type. (It may only allow public-key, for - 53 example.) - 54 - 55 @ivar allowed_types: list of allowed authentication types provided by the - 56 server (possible values are: C{"none"}, C{"password"}, and - 57 C{"publickey"}). - 58 @type allowed_types: list - 59 - 60 @since: 1.1 - 61 """ - 62 allowed_types = [] - 63 -
64 - def __init__(self, explanation, types): -
65 AuthenticationException.__init__(self, explanation) - 66 self.allowed_types = types -
67 -
68 - def __str__(self): -
69 return SSHException.__str__(self) + ' (allowed_types=%r)' % self.allowed_types -
70 - 71 -
72 -class PartialAuthentication (AuthenticationException): -
73 """ - 74 An internal exception thrown in the case of partial authentication. - 75 """ - 76 allowed_types = [] - 77 -
78 - def __init__(self, types): -
79 AuthenticationException.__init__(self, 'partial authentication') - 80 self.allowed_types = types -
81 - 82 -
83 -class ChannelException (SSHException): -
84 """ - 85 Exception raised when an attempt to open a new L{Channel} fails. - 86 - 87 @ivar code: the error code returned by the server - 88 @type code: int - 89 - 90 @since: 1.6 - 91 """ -
92 - def __init__(self, code, text): -
93 SSHException.__init__(self, text) - 94 self.code = code -
95 - 96 -
97 -class BadHostKeyException (SSHException): -
98 """ - 99 The host key given by the SSH server did not match what we were expecting. -100 -101 @ivar hostname: the hostname of the SSH server -102 @type hostname: str -103 @ivar key: the host key presented by the server -104 @type key: L{PKey} -105 @ivar expected_key: the host key expected -106 @type expected_key: L{PKey} -107 -108 @since: 1.6 -109 """ -
110 - def __init__(self, hostname, got_key, expected_key): -
111 SSHException.__init__(self, 'Host key for server %s does not match!' % hostname) -112 self.hostname = hostname -113 self.key = got_key -114 self.expected_key = expected_key -
115 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.ssh_exception.PartialAuthentication-class.html b/docs/paramiko.ssh_exception.PartialAuthentication-class.html deleted file mode 100644 index 91062e3..0000000 --- a/docs/paramiko.ssh_exception.PartialAuthentication-class.html +++ /dev/null @@ -1,246 +0,0 @@ - - - - - paramiko.ssh_exception.PartialAuthentication - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module ssh_exception :: - Class PartialAuthentication - - - - - -
[frames] | no frames]
-
- -

Class PartialAuthentication

source code

-
-              object --+                
-                       |                
-exceptions.BaseException --+            
-                           |            
-        exceptions.Exception --+        
-                               |        
-                    SSHException --+    
-                                   |    
-             AuthenticationException --+
-                                       |
-                                      PartialAuthentication
-
- -
-

An internal exception thrown in the case of partial - authentication.

- - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - types)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
-

Inherited from exceptions.Exception: - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- Class Variables
-   - - allowed_types = [] -
- - - - - - - - - -
- Properties
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - types) -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.transport-module.html b/docs/paramiko.transport-module.html deleted file mode 100644 index 3bf3152..0000000 --- a/docs/paramiko.transport-module.html +++ /dev/null @@ -1,548 +0,0 @@ - - - - - paramiko.transport - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module transport - - - - - -
[frames] | no frames]
-
- -

Module transport

source code

-

Transport - handles the core SSH2 protocol.

- - - - - - - - - - -
- Classes
-   - - ChannelMap -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Variables
-   - - AUTH_FAILED = 2 -
-   - - AUTH_PARTIALLY_SUCCESSFUL = 1 -
-   - - AUTH_SUCCESSFUL = 0 -
-   - - CONNECTION_FAILED_CODE = {1: 'Administratively prohibited', 2:... -
-   - - CRITICAL = 50 -
-   - - DEBUG = 10 -
-   - - DISCONNECT_AUTH_CANCELLED_BY_USER = 13 -
-   - - DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14 -
-   - - DISCONNECT_SERVICE_NOT_AVAILABLE = 7 -
-   - - ERROR = 40 -
-   - - INFO = 20 -
-   - - MSG_CHANNEL_CLOSE = 97 -
-   - - MSG_CHANNEL_DATA = 94 -
-   - - MSG_CHANNEL_EOF = 96 -
-   - - MSG_CHANNEL_EXTENDED_DATA = 95 -
-   - - MSG_CHANNEL_FAILURE = 100 -
-   - - MSG_CHANNEL_OPEN = 90 -
-   - - MSG_CHANNEL_OPEN_FAILURE = 92 -
-   - - MSG_CHANNEL_OPEN_SUCCESS = 91 -
-   - - MSG_CHANNEL_REQUEST = 98 -
-   - - MSG_CHANNEL_SUCCESS = 99 -
-   - - MSG_CHANNEL_WINDOW_ADJUST = 93 -
-   - - MSG_DEBUG = 4 -
-   - - MSG_DISCONNECT = 1 -
-   - - MSG_GLOBAL_REQUEST = 80 -
-   - - MSG_IGNORE = 2 -
-   - - MSG_KEXINIT = 20 -
-   - - MSG_NAMES = {1: 'disconnect', 2: 'ignore', 3: 'unimplemented',... -
-   - - MSG_NEWKEYS = 21 -
-   - - MSG_REQUEST_FAILURE = 82 -
-   - - MSG_REQUEST_SUCCESS = 81 -
-   - - MSG_SERVICE_ACCEPT = 6 -
-   - - MSG_SERVICE_REQUEST = 5 -
-   - - MSG_UNIMPLEMENTED = 3 -
-   - - MSG_USERAUTH_BANNER = 53 -
-   - - MSG_USERAUTH_FAILURE = 51 -
-   - - MSG_USERAUTH_INFO_REQUEST = 60 -
-   - - MSG_USERAUTH_INFO_RESPONSE = 61 -
-   - - MSG_USERAUTH_PK_OK = 60 -
-   - - MSG_USERAUTH_REQUEST = 50 -
-   - - MSG_USERAUTH_SUCCESS = 52 -
-   - - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED = 1 -
-   - - OPEN_FAILED_CONNECT_FAILED = 2 -
-   - - OPEN_FAILED_RESOURCE_SHORTAGE = 4 -
-   - - OPEN_FAILED_UNKNOWN_CHANNEL_TYPE = 3 -
-   - - OPEN_SUCCEEDED = 0 -
-   - - PY22 = False -
-   - - WARNING = 30 -
-   - - __package__ = 'paramiko' -
-   - - rng = Random.new() -
- - - - - - -
- Variables Details
- -
- -
-

CONNECTION_FAILED_CODE

- -
-
-
-
Value:
-
-{1: 'Administratively prohibited',
- 2: 'Connect failed',
- 3: 'Unknown channel type',
- 4: 'Resource shortage'}
-
-
-
-
-
- -
- -
-

MSG_NAMES

- -
-
-
-
Value:
-
-{1: 'disconnect',
- 2: 'ignore',
- 3: 'unimplemented',
- 4: 'debug',
- 5: 'service-request',
- 6: 'service-accept',
- 20: 'kexinit',
- 21: 'newkeys',
-...
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.transport-pysrc.html b/docs/paramiko.transport-pysrc.html deleted file mode 100644 index de00079..0000000 --- a/docs/paramiko.transport-pysrc.html +++ /dev/null @@ -1,4153 +0,0 @@ - - - - - paramiko.transport - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module transport - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.transport

-
-   1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-   2  # 
-   3  # This file is part of paramiko. 
-   4  # 
-   5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-   6  # terms of the GNU Lesser General Public License as published by the Free 
-   7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-   8  # any later version. 
-   9  # 
-  10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
-  11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
-  12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
-  13  # details. 
-  14  # 
-  15  # You should have received a copy of the GNU Lesser General Public License 
-  16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
-  17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
-  18   
-  19  """ 
-  20  L{Transport} handles the core SSH2 protocol. 
-  21  """ 
-  22   
-  23  import os 
-  24  import socket 
-  25  import string 
-  26  import struct 
-  27  import sys 
-  28  import threading 
-  29  import time 
-  30  import weakref 
-  31   
-  32  from paramiko import util 
-  33  from paramiko.auth_handler import AuthHandler 
-  34  from paramiko.channel import Channel 
-  35  from paramiko.common import * 
-  36  from paramiko.compress import ZlibCompressor, ZlibDecompressor 
-  37  from paramiko.dsskey import DSSKey 
-  38  from paramiko.kex_gex import KexGex 
-  39  from paramiko.kex_group1 import KexGroup1 
-  40  from paramiko.message import Message 
-  41  from paramiko.packet import Packetizer, NeedRekeyException 
-  42  from paramiko.primes import ModulusPack 
-  43  from paramiko.rsakey import RSAKey 
-  44  from paramiko.server import ServerInterface 
-  45  from paramiko.sftp_client import SFTPClient 
-  46  from paramiko.ssh_exception import SSHException, BadAuthenticationType, ChannelException 
-  47   
-  48  from Crypto import Random 
-  49  from Crypto.Cipher import Blowfish, AES, DES3, ARC4 
-  50  from Crypto.Hash import SHA, MD5 
-  51  try: 
-  52      from Crypto.Util import Counter 
-  53  except ImportError: 
-  54      from paramiko.util import Counter 
-  55   
-  56   
-  57  # for thread cleanup 
-  58  _active_threads = [] 
-
60 for thr in _active_threads: - 61 thr.stop_thread() -
62 import atexit - 63 atexit.register(_join_lingering_threads) - 64 - 65 -
66 -class SecurityOptions (object): -
67 """ - 68 Simple object containing the security preferences of an ssh transport. - 69 These are tuples of acceptable ciphers, digests, key types, and key - 70 exchange algorithms, listed in order of preference. - 71 - 72 Changing the contents and/or order of these fields affects the underlying - 73 L{Transport} (but only if you change them before starting the session). - 74 If you try to add an algorithm that paramiko doesn't recognize, - 75 C{ValueError} will be raised. If you try to assign something besides a - 76 tuple to one of the fields, C{TypeError} will be raised. - 77 """ - 78 __slots__ = [ 'ciphers', 'digests', 'key_types', 'kex', 'compression', '_transport' ] - 79 -
80 - def __init__(self, transport): -
81 self._transport = transport -
82 -
83 - def __repr__(self): -
84 """ - 85 Returns a string representation of this object, for debugging. - 86 - 87 @rtype: str - 88 """ - 89 return '<paramiko.SecurityOptions for %s>' % repr(self._transport) -
90 -
91 - def _get_ciphers(self): -
92 return self._transport._preferred_ciphers -
93 -
94 - def _get_digests(self): -
95 return self._transport._preferred_macs -
96 -
97 - def _get_key_types(self): -
98 return self._transport._preferred_keys -
99 -
100 - def _get_kex(self): -
101 return self._transport._preferred_kex -
102 -
103 - def _get_compression(self): -
104 return self._transport._preferred_compression -
105 -
106 - def _set(self, name, orig, x): -
107 if type(x) is list: - 108 x = tuple(x) - 109 if type(x) is not tuple: - 110 raise TypeError('expected tuple or list') - 111 possible = getattr(self._transport, orig).keys() - 112 forbidden = filter(lambda n: n not in possible, x) - 113 if len(forbidden) > 0: - 114 raise ValueError('unknown cipher') - 115 setattr(self._transport, name, x) -
116 -
117 - def _set_ciphers(self, x): -
118 self._set('_preferred_ciphers', '_cipher_info', x) -
119 -
120 - def _set_digests(self, x): -
121 self._set('_preferred_macs', '_mac_info', x) -
122 -
123 - def _set_key_types(self, x): -
124 self._set('_preferred_keys', '_key_info', x) -
125 -
126 - def _set_kex(self, x): -
127 self._set('_preferred_kex', '_kex_info', x) -
128 -
129 - def _set_compression(self, x): -
130 self._set('_preferred_compression', '_compression_info', x) -
131 - 132 ciphers = property(_get_ciphers, _set_ciphers, None, - 133 "Symmetric encryption ciphers") - 134 digests = property(_get_digests, _set_digests, None, - 135 "Digest (one-way hash) algorithms") - 136 key_types = property(_get_key_types, _set_key_types, None, - 137 "Public-key algorithms") - 138 kex = property(_get_kex, _set_kex, None, "Key exchange algorithms") - 139 compression = property(_get_compression, _set_compression, None, - 140 "Compression algorithms") -
141 - 142 -
143 -class ChannelMap (object): -
144 - def __init__(self): -
145 # (id -> Channel) - 146 self._map = weakref.WeakValueDictionary() - 147 self._lock = threading.Lock() -
148 -
149 - def put(self, chanid, chan): -
150 self._lock.acquire() - 151 try: - 152 self._map[chanid] = chan - 153 finally: - 154 self._lock.release() -
155 -
156 - def get(self, chanid): -
157 self._lock.acquire() - 158 try: - 159 return self._map.get(chanid, None) - 160 finally: - 161 self._lock.release() -
162 -
163 - def delete(self, chanid): -
164 self._lock.acquire() - 165 try: - 166 try: - 167 del self._map[chanid] - 168 except KeyError: - 169 pass - 170 finally: - 171 self._lock.release() -
172 -
173 - def values(self): -
174 self._lock.acquire() - 175 try: - 176 return self._map.values() - 177 finally: - 178 self._lock.release() -
179 -
180 - def __len__(self): -
181 self._lock.acquire() - 182 try: - 183 return len(self._map) - 184 finally: - 185 self._lock.release() -
186 - 187 -
188 -class Transport (threading.Thread): -
189 """ - 190 An SSH Transport attaches to a stream (usually a socket), negotiates an - 191 encrypted session, authenticates, and then creates stream tunnels, called - 192 L{Channel}s, across the session. Multiple channels can be multiplexed - 193 across a single session (and often are, in the case of port forwardings). - 194 """ - 195 - 196 _PROTO_ID = '2.0' - 197 _CLIENT_ID = 'paramiko_1.7.7.1' - 198 - 199 _preferred_ciphers = ( 'aes128-ctr', 'aes256-ctr', 'aes128-cbc', 'blowfish-cbc', 'aes256-cbc', '3des-cbc', - 200 'arcfour128', 'arcfour256' ) - 201 _preferred_macs = ( 'hmac-sha1', 'hmac-md5', 'hmac-sha1-96', 'hmac-md5-96' ) - 202 _preferred_keys = ( 'ssh-rsa', 'ssh-dss' ) - 203 _preferred_kex = ( 'diffie-hellman-group1-sha1', 'diffie-hellman-group-exchange-sha1' ) - 204 _preferred_compression = ( 'none', ) - 205 - 206 _cipher_info = { - 207 'aes128-ctr': { 'class': AES, 'mode': AES.MODE_CTR, 'block-size': 16, 'key-size': 16 }, - 208 'aes256-ctr': { 'class': AES, 'mode': AES.MODE_CTR, 'block-size': 16, 'key-size': 32 }, - 209 'blowfish-cbc': { 'class': Blowfish, 'mode': Blowfish.MODE_CBC, 'block-size': 8, 'key-size': 16 }, - 210 'aes128-cbc': { 'class': AES, 'mode': AES.MODE_CBC, 'block-size': 16, 'key-size': 16 }, - 211 'aes256-cbc': { 'class': AES, 'mode': AES.MODE_CBC, 'block-size': 16, 'key-size': 32 }, - 212 '3des-cbc': { 'class': DES3, 'mode': DES3.MODE_CBC, 'block-size': 8, 'key-size': 24 }, - 213 'arcfour128': { 'class': ARC4, 'mode': None, 'block-size': 8, 'key-size': 16 }, - 214 'arcfour256': { 'class': ARC4, 'mode': None, 'block-size': 8, 'key-size': 32 }, - 215 } - 216 - 217 _mac_info = { - 218 'hmac-sha1': { 'class': SHA, 'size': 20 }, - 219 'hmac-sha1-96': { 'class': SHA, 'size': 12 }, - 220 'hmac-md5': { 'class': MD5, 'size': 16 }, - 221 'hmac-md5-96': { 'class': MD5, 'size': 12 }, - 222 } - 223 - 224 _key_info = { - 225 'ssh-rsa': RSAKey, - 226 'ssh-dss': DSSKey, - 227 } - 228 - 229 _kex_info = { - 230 'diffie-hellman-group1-sha1': KexGroup1, - 231 'diffie-hellman-group-exchange-sha1': KexGex, - 232 } - 233 - 234 _compression_info = { - 235 # zlib@openssh.com is just zlib, but only turned on after a successful - 236 # authentication. openssh servers may only offer this type because - 237 # they've had troubles with security holes in zlib in the past. - 238 'zlib@openssh.com': ( ZlibCompressor, ZlibDecompressor ), - 239 'zlib': ( ZlibCompressor, ZlibDecompressor ), - 240 'none': ( None, None ), - 241 } - 242 - 243 - 244 _modulus_pack = None - 245 -
246 - def __init__(self, sock): -
247 """ - 248 Create a new SSH session over an existing socket, or socket-like - 249 object. This only creates the Transport object; it doesn't begin the - 250 SSH session yet. Use L{connect} or L{start_client} to begin a client - 251 session, or L{start_server} to begin a server session. - 252 - 253 If the object is not actually a socket, it must have the following - 254 methods: - 255 - C{send(str)}: Writes from 1 to C{len(str)} bytes, and - 256 returns an int representing the number of bytes written. Returns - 257 0 or raises C{EOFError} if the stream has been closed. - 258 - C{recv(int)}: Reads from 1 to C{int} bytes and returns them as a - 259 string. Returns 0 or raises C{EOFError} if the stream has been - 260 closed. - 261 - C{close()}: Closes the socket. - 262 - C{settimeout(n)}: Sets a (float) timeout on I/O operations. - 263 - 264 For ease of use, you may also pass in an address (as a tuple) or a host - 265 string as the C{sock} argument. (A host string is a hostname with an - 266 optional port (separated by C{":"}) which will be converted into a - 267 tuple of C{(hostname, port)}.) A socket will be connected to this - 268 address and used for communication. Exceptions from the C{socket} call - 269 may be thrown in this case. - 270 - 271 @param sock: a socket or socket-like object to create the session over. - 272 @type sock: socket - 273 """ - 274 if isinstance(sock, (str, unicode)): - 275 # convert "host:port" into (host, port) - 276 hl = sock.split(':', 1) - 277 if len(hl) == 1: - 278 sock = (hl[0], 22) - 279 else: - 280 sock = (hl[0], int(hl[1])) - 281 if type(sock) is tuple: - 282 # connect to the given (host, port) - 283 hostname, port = sock - 284 reason = 'No suitable address family' - 285 for (family, socktype, proto, canonname, sockaddr) in socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM): - 286 if socktype == socket.SOCK_STREAM: - 287 af = family - 288 addr = sockaddr - 289 sock = socket.socket(af, socket.SOCK_STREAM) - 290 try: - 291 sock.connect((hostname, port)) - 292 except socket.error, e: - 293 reason = str(e) - 294 else: - 295 break - 296 else: - 297 raise SSHException( - 298 'Unable to connect to %s: %s' % (hostname, reason)) - 299 # okay, normal socket-ish flow here... - 300 threading.Thread.__init__(self) - 301 self.setDaemon(True) - 302 self.rng = rng - 303 self.sock = sock - 304 # Python < 2.3 doesn't have the settimeout method - RogerB - 305 try: - 306 # we set the timeout so we can check self.active periodically to - 307 # see if we should bail. socket.timeout exception is never - 308 # propagated. - 309 self.sock.settimeout(0.1) - 310 except AttributeError: - 311 pass - 312 - 313 # negotiated crypto parameters - 314 self.packetizer = Packetizer(sock) - 315 self.local_version = 'SSH-' + self._PROTO_ID + '-' + self._CLIENT_ID - 316 self.remote_version = '' - 317 self.local_cipher = self.remote_cipher = '' - 318 self.local_kex_init = self.remote_kex_init = None - 319 self.local_mac = self.remote_mac = None - 320 self.local_compression = self.remote_compression = None - 321 self.session_id = None - 322 self.host_key_type = None - 323 self.host_key = None - 324 - 325 # state used during negotiation - 326 self.kex_engine = None - 327 self.H = None - 328 self.K = None - 329 - 330 self.active = False - 331 self.initial_kex_done = False - 332 self.in_kex = False - 333 self.authenticated = False - 334 self._expected_packet = tuple() - 335 self.lock = threading.Lock() # synchronization (always higher level than write_lock) - 336 - 337 # tracking open channels - 338 self._channels = ChannelMap() - 339 self.channel_events = { } # (id -> Event) - 340 self.channels_seen = { } # (id -> True) - 341 self._channel_counter = 1 - 342 self.window_size = 65536 - 343 self.max_packet_size = 34816 - 344 self._x11_handler = None - 345 self._tcp_handler = None - 346 - 347 self.saved_exception = None - 348 self.clear_to_send = threading.Event() - 349 self.clear_to_send_lock = threading.Lock() - 350 self.clear_to_send_timeout = 30.0 - 351 self.log_name = 'paramiko.transport' - 352 self.logger = util.get_logger(self.log_name) - 353 self.packetizer.set_log(self.logger) - 354 self.auth_handler = None - 355 self.global_response = None # response Message from an arbitrary global request - 356 self.completion_event = None # user-defined event callbacks - 357 self.banner_timeout = 15 # how long (seconds) to wait for the SSH banner - 358 - 359 # server mode: - 360 self.server_mode = False - 361 self.server_object = None - 362 self.server_key_dict = { } - 363 self.server_accepts = [ ] - 364 self.server_accept_cv = threading.Condition(self.lock) - 365 self.subsystem_table = { } -
366 -
367 - def __repr__(self): -
368 """ - 369 Returns a string representation of this object, for debugging. - 370 - 371 @rtype: str - 372 """ - 373 out = '<paramiko.Transport at %s' % hex(long(id(self)) & 0xffffffffL) - 374 if not self.active: - 375 out += ' (unconnected)' - 376 else: - 377 if self.local_cipher != '': - 378 out += ' (cipher %s, %d bits)' % (self.local_cipher, - 379 self._cipher_info[self.local_cipher]['key-size'] * 8) - 380 if self.is_authenticated(): - 381 out += ' (active; %d open channel(s))' % len(self._channels) - 382 elif self.initial_kex_done: - 383 out += ' (connected; awaiting auth)' - 384 else: - 385 out += ' (connecting)' - 386 out += '>' - 387 return out -
388 -
389 - def atfork(self): -
390 """ - 391 Terminate this Transport without closing the session. On posix - 392 systems, if a Transport is open during process forking, both parent - 393 and child will share the underlying socket, but only one process can - 394 use the connection (without corrupting the session). Use this method - 395 to clean up a Transport object without disrupting the other process. - 396 - 397 @since: 1.5.3 - 398 """ - 399 self.sock.close() - 400 self.close() -
401 -
402 - def get_security_options(self): -
403 """ - 404 Return a L{SecurityOptions} object which can be used to tweak the - 405 encryption algorithms this transport will permit, and the order of - 406 preference for them. - 407 - 408 @return: an object that can be used to change the preferred algorithms - 409 for encryption, digest (hash), public key, and key exchange. - 410 @rtype: L{SecurityOptions} - 411 """ - 412 return SecurityOptions(self) -
413 -
414 - def start_client(self, event=None): -
415 """ - 416 Negotiate a new SSH2 session as a client. This is the first step after - 417 creating a new L{Transport}. A separate thread is created for protocol - 418 negotiation. - 419 - 420 If an event is passed in, this method returns immediately. When - 421 negotiation is done (successful or not), the given C{Event} will - 422 be triggered. On failure, L{is_active} will return C{False}. - 423 - 424 (Since 1.4) If C{event} is C{None}, this method will not return until - 425 negotation is done. On success, the method returns normally. - 426 Otherwise an SSHException is raised. - 427 - 428 After a successful negotiation, you will usually want to authenticate, - 429 calling L{auth_password <Transport.auth_password>} or - 430 L{auth_publickey <Transport.auth_publickey>}. - 431 - 432 @note: L{connect} is a simpler method for connecting as a client. - 433 - 434 @note: After calling this method (or L{start_server} or L{connect}), - 435 you should no longer directly read from or write to the original - 436 socket object. - 437 - 438 @param event: an event to trigger when negotiation is complete - 439 (optional) - 440 @type event: threading.Event - 441 - 442 @raise SSHException: if negotiation fails (and no C{event} was passed - 443 in) - 444 """ - 445 self.active = True - 446 if event is not None: - 447 # async, return immediately and let the app poll for completion - 448 self.completion_event = event - 449 self.start() - 450 return - 451 - 452 # synchronous, wait for a result - 453 self.completion_event = event = threading.Event() - 454 self.start() - 455 Random.atfork() - 456 while True: - 457 event.wait(0.1) - 458 if not self.active: - 459 e = self.get_exception() - 460 if e is not None: - 461 raise e - 462 raise SSHException('Negotiation failed.') - 463 if event.isSet(): - 464 break -
465 -
466 - def start_server(self, event=None, server=None): -
467 """ - 468 Negotiate a new SSH2 session as a server. This is the first step after - 469 creating a new L{Transport} and setting up your server host key(s). A - 470 separate thread is created for protocol negotiation. - 471 - 472 If an event is passed in, this method returns immediately. When - 473 negotiation is done (successful or not), the given C{Event} will - 474 be triggered. On failure, L{is_active} will return C{False}. - 475 - 476 (Since 1.4) If C{event} is C{None}, this method will not return until - 477 negotation is done. On success, the method returns normally. - 478 Otherwise an SSHException is raised. - 479 - 480 After a successful negotiation, the client will need to authenticate. - 481 Override the methods - 482 L{get_allowed_auths <ServerInterface.get_allowed_auths>}, - 483 L{check_auth_none <ServerInterface.check_auth_none>}, - 484 L{check_auth_password <ServerInterface.check_auth_password>}, and - 485 L{check_auth_publickey <ServerInterface.check_auth_publickey>} in the - 486 given C{server} object to control the authentication process. - 487 - 488 After a successful authentication, the client should request to open - 489 a channel. Override - 490 L{check_channel_request <ServerInterface.check_channel_request>} in the - 491 given C{server} object to allow channels to be opened. - 492 - 493 @note: After calling this method (or L{start_client} or L{connect}), - 494 you should no longer directly read from or write to the original - 495 socket object. - 496 - 497 @param event: an event to trigger when negotiation is complete. - 498 @type event: threading.Event - 499 @param server: an object used to perform authentication and create - 500 L{Channel}s. - 501 @type server: L{server.ServerInterface} - 502 - 503 @raise SSHException: if negotiation fails (and no C{event} was passed - 504 in) - 505 """ - 506 if server is None: - 507 server = ServerInterface() - 508 self.server_mode = True - 509 self.server_object = server - 510 self.active = True - 511 if event is not None: - 512 # async, return immediately and let the app poll for completion - 513 self.completion_event = event - 514 self.start() - 515 return - 516 - 517 # synchronous, wait for a result - 518 self.completion_event = event = threading.Event() - 519 self.start() - 520 while True: - 521 event.wait(0.1) - 522 if not self.active: - 523 e = self.get_exception() - 524 if e is not None: - 525 raise e - 526 raise SSHException('Negotiation failed.') - 527 if event.isSet(): - 528 break -
529 -
530 - def add_server_key(self, key): -
531 """ - 532 Add a host key to the list of keys used for server mode. When behaving - 533 as a server, the host key is used to sign certain packets during the - 534 SSH2 negotiation, so that the client can trust that we are who we say - 535 we are. Because this is used for signing, the key must contain private - 536 key info, not just the public half. Only one key of each type (RSA or - 537 DSS) is kept. - 538 - 539 @param key: the host key to add, usually an L{RSAKey <rsakey.RSAKey>} or - 540 L{DSSKey <dsskey.DSSKey>}. - 541 @type key: L{PKey <pkey.PKey>} - 542 """ - 543 self.server_key_dict[key.get_name()] = key -
544 -
545 - def get_server_key(self): -
546 """ - 547 Return the active host key, in server mode. After negotiating with the - 548 client, this method will return the negotiated host key. If only one - 549 type of host key was set with L{add_server_key}, that's the only key - 550 that will ever be returned. But in cases where you have set more than - 551 one type of host key (for example, an RSA key and a DSS key), the key - 552 type will be negotiated by the client, and this method will return the - 553 key of the type agreed on. If the host key has not been negotiated - 554 yet, C{None} is returned. In client mode, the behavior is undefined. - 555 - 556 @return: host key of the type negotiated by the client, or C{None}. - 557 @rtype: L{PKey <pkey.PKey>} - 558 """ - 559 try: - 560 return self.server_key_dict[self.host_key_type] - 561 except KeyError: - 562 pass - 563 return None -
564 -
565 - def load_server_moduli(filename=None): -
566 """ - 567 I{(optional)} - 568 Load a file of prime moduli for use in doing group-exchange key - 569 negotiation in server mode. It's a rather obscure option and can be - 570 safely ignored. - 571 - 572 In server mode, the remote client may request "group-exchange" key - 573 negotiation, which asks the server to send a random prime number that - 574 fits certain criteria. These primes are pretty difficult to compute, - 575 so they can't be generated on demand. But many systems contain a file - 576 of suitable primes (usually named something like C{/etc/ssh/moduli}). - 577 If you call C{load_server_moduli} and it returns C{True}, then this - 578 file of primes has been loaded and we will support "group-exchange" in - 579 server mode. Otherwise server mode will just claim that it doesn't - 580 support that method of key negotiation. - 581 - 582 @param filename: optional path to the moduli file, if you happen to - 583 know that it's not in a standard location. - 584 @type filename: str - 585 @return: True if a moduli file was successfully loaded; False - 586 otherwise. - 587 @rtype: bool - 588 - 589 @note: This has no effect when used in client mode. - 590 """ - 591 Transport._modulus_pack = ModulusPack(rng) - 592 # places to look for the openssh "moduli" file - 593 file_list = [ '/etc/ssh/moduli', '/usr/local/etc/moduli' ] - 594 if filename is not None: - 595 file_list.insert(0, filename) - 596 for fn in file_list: - 597 try: - 598 Transport._modulus_pack.read_file(fn) - 599 return True - 600 except IOError: - 601 pass - 602 # none succeeded - 603 Transport._modulus_pack = None - 604 return False -
605 load_server_moduli = staticmethod(load_server_moduli) - 606 -
607 - def close(self): -
608 """ - 609 Close this session, and any open channels that are tied to it. - 610 """ - 611 if not self.active: - 612 return - 613 self.active = False - 614 self.packetizer.close() - 615 self.join() - 616 for chan in self._channels.values(): - 617 chan._unlink() -
618 -
619 - def get_remote_server_key(self): -
620 """ - 621 Return the host key of the server (in client mode). - 622 - 623 @note: Previously this call returned a tuple of (key type, key string). - 624 You can get the same effect by calling - 625 L{PKey.get_name <pkey.PKey.get_name>} for the key type, and - 626 C{str(key)} for the key string. - 627 - 628 @raise SSHException: if no session is currently active. - 629 - 630 @return: public key of the remote server - 631 @rtype: L{PKey <pkey.PKey>} - 632 """ - 633 if (not self.active) or (not self.initial_kex_done): - 634 raise SSHException('No existing session') - 635 return self.host_key -
636 -
637 - def is_active(self): -
638 """ - 639 Return true if this session is active (open). - 640 - 641 @return: True if the session is still active (open); False if the - 642 session is closed - 643 @rtype: bool - 644 """ - 645 return self.active -
646 -
647 - def open_session(self): -
648 """ - 649 Request a new channel to the server, of type C{"session"}. This - 650 is just an alias for C{open_channel('session')}. - 651 - 652 @return: a new L{Channel} - 653 @rtype: L{Channel} - 654 - 655 @raise SSHException: if the request is rejected or the session ends - 656 prematurely - 657 """ - 658 return self.open_channel('session') -
659 -
660 - def open_x11_channel(self, src_addr=None): -
661 """ - 662 Request a new channel to the client, of type C{"x11"}. This - 663 is just an alias for C{open_channel('x11', src_addr=src_addr)}. - 664 - 665 @param src_addr: the source address of the x11 server (port is the - 666 x11 port, ie. 6010) - 667 @type src_addr: (str, int) - 668 @return: a new L{Channel} - 669 @rtype: L{Channel} - 670 - 671 @raise SSHException: if the request is rejected or the session ends - 672 prematurely - 673 """ - 674 return self.open_channel('x11', src_addr=src_addr) -
675 -
676 - def open_forwarded_tcpip_channel(self, (src_addr, src_port), (dest_addr, dest_port)): -
677 """ - 678 Request a new channel back to the client, of type C{"forwarded-tcpip"}. - 679 This is used after a client has requested port forwarding, for sending - 680 incoming connections back to the client. - 681 - 682 @param src_addr: originator's address - 683 @param src_port: originator's port - 684 @param dest_addr: local (server) connected address - 685 @param dest_port: local (server) connected port - 686 """ - 687 return self.open_channel('forwarded-tcpip', (dest_addr, dest_port), (src_addr, src_port)) -
688 -
689 - def open_channel(self, kind, dest_addr=None, src_addr=None): -
690 """ - 691 Request a new channel to the server. L{Channel}s are socket-like - 692 objects used for the actual transfer of data across the session. - 693 You may only request a channel after negotiating encryption (using - 694 L{connect} or L{start_client}) and authenticating. - 695 - 696 @param kind: the kind of channel requested (usually C{"session"}, - 697 C{"forwarded-tcpip"}, C{"direct-tcpip"}, or C{"x11"}) - 698 @type kind: str - 699 @param dest_addr: the destination address of this port forwarding, - 700 if C{kind} is C{"forwarded-tcpip"} or C{"direct-tcpip"} (ignored - 701 for other channel types) - 702 @type dest_addr: (str, int) - 703 @param src_addr: the source address of this port forwarding, if - 704 C{kind} is C{"forwarded-tcpip"}, C{"direct-tcpip"}, or C{"x11"} - 705 @type src_addr: (str, int) - 706 @return: a new L{Channel} on success - 707 @rtype: L{Channel} - 708 - 709 @raise SSHException: if the request is rejected or the session ends - 710 prematurely - 711 """ - 712 if not self.active: - 713 raise SSHException('SSH session not active') - 714 self.lock.acquire() - 715 try: - 716 chanid = self._next_channel() - 717 m = Message() - 718 m.add_byte(chr(MSG_CHANNEL_OPEN)) - 719 m.add_string(kind) - 720 m.add_int(chanid) - 721 m.add_int(self.window_size) - 722 m.add_int(self.max_packet_size) - 723 if (kind == 'forwarded-tcpip') or (kind == 'direct-tcpip'): - 724 m.add_string(dest_addr[0]) - 725 m.add_int(dest_addr[1]) - 726 m.add_string(src_addr[0]) - 727 m.add_int(src_addr[1]) - 728 elif kind == 'x11': - 729 m.add_string(src_addr[0]) - 730 m.add_int(src_addr[1]) - 731 chan = Channel(chanid) - 732 self._channels.put(chanid, chan) - 733 self.channel_events[chanid] = event = threading.Event() - 734 self.channels_seen[chanid] = True - 735 chan._set_transport(self) - 736 chan._set_window(self.window_size, self.max_packet_size) - 737 finally: - 738 self.lock.release() - 739 self._send_user_message(m) - 740 while True: - 741 event.wait(0.1); - 742 if not self.active: - 743 e = self.get_exception() - 744 if e is None: - 745 e = SSHException('Unable to open channel.') - 746 raise e - 747 if event.isSet(): - 748 break - 749 chan = self._channels.get(chanid) - 750 if chan is not None: - 751 return chan - 752 e = self.get_exception() - 753 if e is None: - 754 e = SSHException('Unable to open channel.') - 755 raise e -
756 -
757 - def request_port_forward(self, address, port, handler=None): -
758 """ - 759 Ask the server to forward TCP connections from a listening port on - 760 the server, across this SSH session. - 761 - 762 If a handler is given, that handler is called from a different thread - 763 whenever a forwarded connection arrives. The handler parameters are:: - 764 - 765 handler(channel, (origin_addr, origin_port), (server_addr, server_port)) - 766 - 767 where C{server_addr} and C{server_port} are the address and port that - 768 the server was listening on. - 769 - 770 If no handler is set, the default behavior is to send new incoming - 771 forwarded connections into the accept queue, to be picked up via - 772 L{accept}. - 773 - 774 @param address: the address to bind when forwarding - 775 @type address: str - 776 @param port: the port to forward, or 0 to ask the server to allocate - 777 any port - 778 @type port: int - 779 @param handler: optional handler for incoming forwarded connections - 780 @type handler: function(Channel, (str, int), (str, int)) - 781 @return: the port # allocated by the server - 782 @rtype: int - 783 - 784 @raise SSHException: if the server refused the TCP forward request - 785 """ - 786 if not self.active: - 787 raise SSHException('SSH session not active') - 788 address = str(address) - 789 port = int(port) - 790 response = self.global_request('tcpip-forward', (address, port), wait=True) - 791 if response is None: - 792 raise SSHException('TCP forwarding request denied') - 793 if port == 0: - 794 port = response.get_int() - 795 if handler is None: - 796 def default_handler(channel, (src_addr, src_port), (dest_addr, dest_port)): - 797 self._queue_incoming_channel(channel) -
798 handler = default_handler - 799 self._tcp_handler = handler - 800 return port -
801 -
802 - def cancel_port_forward(self, address, port): -
803 """ - 804 Ask the server to cancel a previous port-forwarding request. No more - 805 connections to the given address & port will be forwarded across this - 806 ssh connection. - 807 - 808 @param address: the address to stop forwarding - 809 @type address: str - 810 @param port: the port to stop forwarding - 811 @type port: int - 812 """ - 813 if not self.active: - 814 return - 815 self._tcp_handler = None - 816 self.global_request('cancel-tcpip-forward', (address, port), wait=True) -
817 -
818 - def open_sftp_client(self): -
819 """ - 820 Create an SFTP client channel from an open transport. On success, - 821 an SFTP session will be opened with the remote host, and a new - 822 SFTPClient object will be returned. - 823 - 824 @return: a new L{SFTPClient} object, referring to an sftp session - 825 (channel) across this transport - 826 @rtype: L{SFTPClient} - 827 """ - 828 return SFTPClient.from_transport(self) -
829 -
830 - def send_ignore(self, bytes=None): -
831 """ - 832 Send a junk packet across the encrypted link. This is sometimes used - 833 to add "noise" to a connection to confuse would-be attackers. It can - 834 also be used as a keep-alive for long lived connections traversing - 835 firewalls. - 836 - 837 @param bytes: the number of random bytes to send in the payload of the - 838 ignored packet -- defaults to a random number from 10 to 41. - 839 @type bytes: int - 840 """ - 841 m = Message() - 842 m.add_byte(chr(MSG_IGNORE)) - 843 if bytes is None: - 844 bytes = (ord(rng.read(1)) % 32) + 10 - 845 m.add_bytes(rng.read(bytes)) - 846 self._send_user_message(m) -
847 -
848 - def renegotiate_keys(self): -
849 """ - 850 Force this session to switch to new keys. Normally this is done - 851 automatically after the session hits a certain number of packets or - 852 bytes sent or received, but this method gives you the option of forcing - 853 new keys whenever you want. Negotiating new keys causes a pause in - 854 traffic both ways as the two sides swap keys and do computations. This - 855 method returns when the session has switched to new keys. - 856 - 857 @raise SSHException: if the key renegotiation failed (which causes the - 858 session to end) - 859 """ - 860 self.completion_event = threading.Event() - 861 self._send_kex_init() - 862 while True: - 863 self.completion_event.wait(0.1) - 864 if not self.active: - 865 e = self.get_exception() - 866 if e is not None: - 867 raise e - 868 raise SSHException('Negotiation failed.') - 869 if self.completion_event.isSet(): - 870 break - 871 return -
872 -
873 - def set_keepalive(self, interval): -
874 """ - 875 Turn on/off keepalive packets (default is off). If this is set, after - 876 C{interval} seconds without sending any data over the connection, a - 877 "keepalive" packet will be sent (and ignored by the remote host). This - 878 can be useful to keep connections alive over a NAT, for example. - 879 - 880 @param interval: seconds to wait before sending a keepalive packet (or - 881 0 to disable keepalives). - 882 @type interval: int - 883 """ - 884 self.packetizer.set_keepalive(interval, - 885 lambda x=weakref.proxy(self): x.global_request('keepalive@lag.net', wait=False)) -
886 -
887 - def global_request(self, kind, data=None, wait=True): -
888 """ - 889 Make a global request to the remote host. These are normally - 890 extensions to the SSH2 protocol. - 891 - 892 @param kind: name of the request. - 893 @type kind: str - 894 @param data: an optional tuple containing additional data to attach - 895 to the request. - 896 @type data: tuple - 897 @param wait: C{True} if this method should not return until a response - 898 is received; C{False} otherwise. - 899 @type wait: bool - 900 @return: a L{Message} containing possible additional data if the - 901 request was successful (or an empty L{Message} if C{wait} was - 902 C{False}); C{None} if the request was denied. - 903 @rtype: L{Message} - 904 """ - 905 if wait: - 906 self.completion_event = threading.Event() - 907 m = Message() - 908 m.add_byte(chr(MSG_GLOBAL_REQUEST)) - 909 m.add_string(kind) - 910 m.add_boolean(wait) - 911 if data is not None: - 912 m.add(*data) - 913 self._log(DEBUG, 'Sending global request "%s"' % kind) - 914 self._send_user_message(m) - 915 if not wait: - 916 return None - 917 while True: - 918 self.completion_event.wait(0.1) - 919 if not self.active: - 920 return None - 921 if self.completion_event.isSet(): - 922 break - 923 return self.global_response -
924 -
925 - def accept(self, timeout=None): -
926 """ - 927 Return the next channel opened by the client over this transport, in - 928 server mode. If no channel is opened before the given timeout, C{None} - 929 is returned. - 930 - 931 @param timeout: seconds to wait for a channel, or C{None} to wait - 932 forever - 933 @type timeout: int - 934 @return: a new Channel opened by the client - 935 @rtype: L{Channel} - 936 """ - 937 self.lock.acquire() - 938 try: - 939 if len(self.server_accepts) > 0: - 940 chan = self.server_accepts.pop(0) - 941 else: - 942 self.server_accept_cv.wait(timeout) - 943 if len(self.server_accepts) > 0: - 944 chan = self.server_accepts.pop(0) - 945 else: - 946 # timeout - 947 chan = None - 948 finally: - 949 self.lock.release() - 950 return chan -
951 -
952 - def connect(self, hostkey=None, username='', password=None, pkey=None): -
953 """ - 954 Negotiate an SSH2 session, and optionally verify the server's host key - 955 and authenticate using a password or private key. This is a shortcut - 956 for L{start_client}, L{get_remote_server_key}, and - 957 L{Transport.auth_password} or L{Transport.auth_publickey}. Use those - 958 methods if you want more control. - 959 - 960 You can use this method immediately after creating a Transport to - 961 negotiate encryption with a server. If it fails, an exception will be - 962 thrown. On success, the method will return cleanly, and an encrypted - 963 session exists. You may immediately call L{open_channel} or - 964 L{open_session} to get a L{Channel} object, which is used for data - 965 transfer. - 966 - 967 @note: If you fail to supply a password or private key, this method may - 968 succeed, but a subsequent L{open_channel} or L{open_session} call may - 969 fail because you haven't authenticated yet. - 970 - 971 @param hostkey: the host key expected from the server, or C{None} if - 972 you don't want to do host key verification. - 973 @type hostkey: L{PKey<pkey.PKey>} - 974 @param username: the username to authenticate as. - 975 @type username: str - 976 @param password: a password to use for authentication, if you want to - 977 use password authentication; otherwise C{None}. - 978 @type password: str - 979 @param pkey: a private key to use for authentication, if you want to - 980 use private key authentication; otherwise C{None}. - 981 @type pkey: L{PKey<pkey.PKey>} - 982 - 983 @raise SSHException: if the SSH2 negotiation fails, the host key - 984 supplied by the server is incorrect, or authentication fails. - 985 """ - 986 if hostkey is not None: - 987 self._preferred_keys = [ hostkey.get_name() ] - 988 - 989 self.start_client() - 990 - 991 # check host key if we were given one - 992 if (hostkey is not None): - 993 key = self.get_remote_server_key() - 994 if (key.get_name() != hostkey.get_name()) or (str(key) != str(hostkey)): - 995 self._log(DEBUG, 'Bad host key from server') - 996 self._log(DEBUG, 'Expected: %s: %s' % (hostkey.get_name(), repr(str(hostkey)))) - 997 self._log(DEBUG, 'Got : %s: %s' % (key.get_name(), repr(str(key)))) - 998 raise SSHException('Bad host key from server') - 999 self._log(DEBUG, 'Host key verified (%s)' % hostkey.get_name()) -1000 -1001 if (pkey is not None) or (password is not None): -1002 if password is not None: -1003 self._log(DEBUG, 'Attempting password auth...') -1004 self.auth_password(username, password) -1005 else: -1006 self._log(DEBUG, 'Attempting public-key auth...') -1007 self.auth_publickey(username, pkey) -1008 -1009 return -
1010 -
1011 - def get_exception(self): -
1012 """ -1013 Return any exception that happened during the last server request. -1014 This can be used to fetch more specific error information after using -1015 calls like L{start_client}. The exception (if any) is cleared after -1016 this call. -1017 -1018 @return: an exception, or C{None} if there is no stored exception. -1019 @rtype: Exception -1020 -1021 @since: 1.1 -1022 """ -1023 self.lock.acquire() -1024 try: -1025 e = self.saved_exception -1026 self.saved_exception = None -1027 return e -1028 finally: -1029 self.lock.release() -
1030 -
1031 - def set_subsystem_handler(self, name, handler, *larg, **kwarg): -
1032 """ -1033 Set the handler class for a subsystem in server mode. If a request -1034 for this subsystem is made on an open ssh channel later, this handler -1035 will be constructed and called -- see L{SubsystemHandler} for more -1036 detailed documentation. -1037 -1038 Any extra parameters (including keyword arguments) are saved and -1039 passed to the L{SubsystemHandler} constructor later. -1040 -1041 @param name: name of the subsystem. -1042 @type name: str -1043 @param handler: subclass of L{SubsystemHandler} that handles this -1044 subsystem. -1045 @type handler: class -1046 """ -1047 try: -1048 self.lock.acquire() -1049 self.subsystem_table[name] = (handler, larg, kwarg) -1050 finally: -1051 self.lock.release() -
1052 -
1053 - def is_authenticated(self): -
1054 """ -1055 Return true if this session is active and authenticated. -1056 -1057 @return: True if the session is still open and has been authenticated -1058 successfully; False if authentication failed and/or the session is -1059 closed. -1060 @rtype: bool -1061 """ -1062 return self.active and (self.auth_handler is not None) and self.auth_handler.is_authenticated() -
1063 -
1064 - def get_username(self): -
1065 """ -1066 Return the username this connection is authenticated for. If the -1067 session is not authenticated (or authentication failed), this method -1068 returns C{None}. -1069 -1070 @return: username that was authenticated, or C{None}. -1071 @rtype: string -1072 """ -1073 if not self.active or (self.auth_handler is None): -1074 return None -1075 return self.auth_handler.get_username() -
1076 -
1077 - def auth_none(self, username): -
1078 """ -1079 Try to authenticate to the server using no authentication at all. -1080 This will almost always fail. It may be useful for determining the -1081 list of authentication types supported by the server, by catching the -1082 L{BadAuthenticationType} exception raised. -1083 -1084 @param username: the username to authenticate as -1085 @type username: string -1086 @return: list of auth types permissible for the next stage of -1087 authentication (normally empty) -1088 @rtype: list -1089 -1090 @raise BadAuthenticationType: if "none" authentication isn't allowed -1091 by the server for this user -1092 @raise SSHException: if the authentication failed due to a network -1093 error -1094 -1095 @since: 1.5 -1096 """ -1097 if (not self.active) or (not self.initial_kex_done): -1098 raise SSHException('No existing session') -1099 my_event = threading.Event() -1100 self.auth_handler = AuthHandler(self) -1101 self.auth_handler.auth_none(username, my_event) -1102 return self.auth_handler.wait_for_response(my_event) -
1103 -
1104 - def auth_password(self, username, password, event=None, fallback=True): -
1105 """ -1106 Authenticate to the server using a password. The username and password -1107 are sent over an encrypted link. -1108 -1109 If an C{event} is passed in, this method will return immediately, and -1110 the event will be triggered once authentication succeeds or fails. On -1111 success, L{is_authenticated} will return C{True}. On failure, you may -1112 use L{get_exception} to get more detailed error information. -1113 -1114 Since 1.1, if no event is passed, this method will block until the -1115 authentication succeeds or fails. On failure, an exception is raised. -1116 Otherwise, the method simply returns. -1117 -1118 Since 1.5, if no event is passed and C{fallback} is C{True} (the -1119 default), if the server doesn't support plain password authentication -1120 but does support so-called "keyboard-interactive" mode, an attempt -1121 will be made to authenticate using this interactive mode. If it fails, -1122 the normal exception will be thrown as if the attempt had never been -1123 made. This is useful for some recent Gentoo and Debian distributions, -1124 which turn off plain password authentication in a misguided belief -1125 that interactive authentication is "more secure". (It's not.) -1126 -1127 If the server requires multi-step authentication (which is very rare), -1128 this method will return a list of auth types permissible for the next -1129 step. Otherwise, in the normal case, an empty list is returned. -1130 -1131 @param username: the username to authenticate as -1132 @type username: str -1133 @param password: the password to authenticate with -1134 @type password: str or unicode -1135 @param event: an event to trigger when the authentication attempt is -1136 complete (whether it was successful or not) -1137 @type event: threading.Event -1138 @param fallback: C{True} if an attempt at an automated "interactive" -1139 password auth should be made if the server doesn't support normal -1140 password auth -1141 @type fallback: bool -1142 @return: list of auth types permissible for the next stage of -1143 authentication (normally empty) -1144 @rtype: list -1145 -1146 @raise BadAuthenticationType: if password authentication isn't -1147 allowed by the server for this user (and no event was passed in) -1148 @raise AuthenticationException: if the authentication failed (and no -1149 event was passed in) -1150 @raise SSHException: if there was a network error -1151 """ -1152 if (not self.active) or (not self.initial_kex_done): -1153 # we should never try to send the password unless we're on a secure link -1154 raise SSHException('No existing session') -1155 if event is None: -1156 my_event = threading.Event() -1157 else: -1158 my_event = event -1159 self.auth_handler = AuthHandler(self) -1160 self.auth_handler.auth_password(username, password, my_event) -1161 if event is not None: -1162 # caller wants to wait for event themselves -1163 return [] -1164 try: -1165 return self.auth_handler.wait_for_response(my_event) -1166 except BadAuthenticationType, x: -1167 # if password auth isn't allowed, but keyboard-interactive *is*, try to fudge it -1168 if not fallback or ('keyboard-interactive' not in x.allowed_types): -1169 raise -1170 try: -1171 def handler(title, instructions, fields): -1172 if len(fields) > 1: -1173 raise SSHException('Fallback authentication failed.') -1174 if len(fields) == 0: -1175 # for some reason, at least on os x, a 2nd request will -1176 # be made with zero fields requested. maybe it's just -1177 # to try to fake out automated scripting of the exact -1178 # type we're doing here. *shrug* :) -1179 return [] -1180 return [ password ] -
1181 return self.auth_interactive(username, handler) -1182 except SSHException, ignored: -1183 # attempt failed; just raise the original exception -1184 raise x -1185 return None -1186 -
1187 - def auth_publickey(self, username, key, event=None): -
1188 """ -1189 Authenticate to the server using a private key. The key is used to -1190 sign data from the server, so it must include the private part. -1191 -1192 If an C{event} is passed in, this method will return immediately, and -1193 the event will be triggered once authentication succeeds or fails. On -1194 success, L{is_authenticated} will return C{True}. On failure, you may -1195 use L{get_exception} to get more detailed error information. -1196 -1197 Since 1.1, if no event is passed, this method will block until the -1198 authentication succeeds or fails. On failure, an exception is raised. -1199 Otherwise, the method simply returns. -1200 -1201 If the server requires multi-step authentication (which is very rare), -1202 this method will return a list of auth types permissible for the next -1203 step. Otherwise, in the normal case, an empty list is returned. -1204 -1205 @param username: the username to authenticate as -1206 @type username: string -1207 @param key: the private key to authenticate with -1208 @type key: L{PKey <pkey.PKey>} -1209 @param event: an event to trigger when the authentication attempt is -1210 complete (whether it was successful or not) -1211 @type event: threading.Event -1212 @return: list of auth types permissible for the next stage of -1213 authentication (normally empty) -1214 @rtype: list -1215 -1216 @raise BadAuthenticationType: if public-key authentication isn't -1217 allowed by the server for this user (and no event was passed in) -1218 @raise AuthenticationException: if the authentication failed (and no -1219 event was passed in) -1220 @raise SSHException: if there was a network error -1221 """ -1222 if (not self.active) or (not self.initial_kex_done): -1223 # we should never try to authenticate unless we're on a secure link -1224 raise SSHException('No existing session') -1225 if event is None: -1226 my_event = threading.Event() -1227 else: -1228 my_event = event -1229 self.auth_handler = AuthHandler(self) -1230 self.auth_handler.auth_publickey(username, key, my_event) -1231 if event is not None: -1232 # caller wants to wait for event themselves -1233 return [] -1234 return self.auth_handler.wait_for_response(my_event) -
1235 -
1236 - def auth_interactive(self, username, handler, submethods=''): -
1237 """ -1238 Authenticate to the server interactively. A handler is used to answer -1239 arbitrary questions from the server. On many servers, this is just a -1240 dumb wrapper around PAM. -1241 -1242 This method will block until the authentication succeeds or fails, -1243 peroidically calling the handler asynchronously to get answers to -1244 authentication questions. The handler may be called more than once -1245 if the server continues to ask questions. -1246 -1247 The handler is expected to be a callable that will handle calls of the -1248 form: C{handler(title, instructions, prompt_list)}. The C{title} is -1249 meant to be a dialog-window title, and the C{instructions} are user -1250 instructions (both are strings). C{prompt_list} will be a list of -1251 prompts, each prompt being a tuple of C{(str, bool)}. The string is -1252 the prompt and the boolean indicates whether the user text should be -1253 echoed. -1254 -1255 A sample call would thus be: -1256 C{handler('title', 'instructions', [('Password:', False)])}. -1257 -1258 The handler should return a list or tuple of answers to the server's -1259 questions. -1260 -1261 If the server requires multi-step authentication (which is very rare), -1262 this method will return a list of auth types permissible for the next -1263 step. Otherwise, in the normal case, an empty list is returned. -1264 -1265 @param username: the username to authenticate as -1266 @type username: string -1267 @param handler: a handler for responding to server questions -1268 @type handler: callable -1269 @param submethods: a string list of desired submethods (optional) -1270 @type submethods: str -1271 @return: list of auth types permissible for the next stage of -1272 authentication (normally empty). -1273 @rtype: list -1274 -1275 @raise BadAuthenticationType: if public-key authentication isn't -1276 allowed by the server for this user -1277 @raise AuthenticationException: if the authentication failed -1278 @raise SSHException: if there was a network error -1279 -1280 @since: 1.5 -1281 """ -1282 if (not self.active) or (not self.initial_kex_done): -1283 # we should never try to authenticate unless we're on a secure link -1284 raise SSHException('No existing session') -1285 my_event = threading.Event() -1286 self.auth_handler = AuthHandler(self) -1287 self.auth_handler.auth_interactive(username, handler, my_event, submethods) -1288 return self.auth_handler.wait_for_response(my_event) -
1289 -
1290 - def set_log_channel(self, name): -
1291 """ -1292 Set the channel for this transport's logging. The default is -1293 C{"paramiko.transport"} but it can be set to anything you want. -1294 (See the C{logging} module for more info.) SSH Channels will log -1295 to a sub-channel of the one specified. -1296 -1297 @param name: new channel name for logging -1298 @type name: str -1299 -1300 @since: 1.1 -1301 """ -1302 self.log_name = name -1303 self.logger = util.get_logger(name) -1304 self.packetizer.set_log(self.logger) -
1305 -
1306 - def get_log_channel(self): -
1307 """ -1308 Return the channel name used for this transport's logging. -1309 -1310 @return: channel name. -1311 @rtype: str -1312 -1313 @since: 1.2 -1314 """ -1315 return self.log_name -
1316 -
1317 - def set_hexdump(self, hexdump): -
1318 """ -1319 Turn on/off logging a hex dump of protocol traffic at DEBUG level in -1320 the logs. Normally you would want this off (which is the default), -1321 but if you are debugging something, it may be useful. -1322 -1323 @param hexdump: C{True} to log protocol traffix (in hex) to the log; -1324 C{False} otherwise. -1325 @type hexdump: bool -1326 """ -1327 self.packetizer.set_hexdump(hexdump) -
1328 -
1329 - def get_hexdump(self): -
1330 """ -1331 Return C{True} if the transport is currently logging hex dumps of -1332 protocol traffic. -1333 -1334 @return: C{True} if hex dumps are being logged -1335 @rtype: bool -1336 -1337 @since: 1.4 -1338 """ -1339 return self.packetizer.get_hexdump() -
1340 -
1341 - def use_compression(self, compress=True): -
1342 """ -1343 Turn on/off compression. This will only have an affect before starting -1344 the transport (ie before calling L{connect}, etc). By default, -1345 compression is off since it negatively affects interactive sessions. -1346 -1347 @param compress: C{True} to ask the remote client/server to compress -1348 traffic; C{False} to refuse compression -1349 @type compress: bool -1350 -1351 @since: 1.5.2 -1352 """ -1353 if compress: -1354 self._preferred_compression = ( 'zlib@openssh.com', 'zlib', 'none' ) -1355 else: -1356 self._preferred_compression = ( 'none', ) -
1357 -
1358 - def getpeername(self): -
1359 """ -1360 Return the address of the remote side of this Transport, if possible. -1361 This is effectively a wrapper around C{'getpeername'} on the underlying -1362 socket. If the socket-like object has no C{'getpeername'} method, -1363 then C{("unknown", 0)} is returned. -1364 -1365 @return: the address if the remote host, if known -1366 @rtype: tuple(str, int) -1367 """ -1368 gp = getattr(self.sock, 'getpeername', None) -1369 if gp is None: -1370 return ('unknown', 0) -1371 return gp() -
1372 -
1373 - def stop_thread(self): -
1374 self.active = False -1375 self.packetizer.close() -
1376 -1377 -1378 ### internals... -1379 -1380 -
1381 - def _log(self, level, msg, *args): -
1382 if issubclass(type(msg), list): -1383 for m in msg: -1384 self.logger.log(level, m) -1385 else: -1386 self.logger.log(level, msg, *args) -
1387 -
1388 - def _get_modulus_pack(self): -
1389 "used by KexGex to find primes for group exchange" -1390 return self._modulus_pack -
1391 -
1392 - def _next_channel(self): -
1393 "you are holding the lock" -1394 chanid = self._channel_counter -1395 while self._channels.get(chanid) is not None: -1396 self._channel_counter = (self._channel_counter + 1) & 0xffffff -1397 chanid = self._channel_counter -1398 self._channel_counter = (self._channel_counter + 1) & 0xffffff -1399 return chanid -
1400 -1404 -
1405 - def _send_message(self, data): -
1406 self.packetizer.send_message(data) -
1407 -
1408 - def _send_user_message(self, data): -
1409 """ -1410 send a message, but block if we're in key negotiation. this is used -1411 for user-initiated requests. -1412 """ -1413 start = time.time() -1414 while True: -1415 self.clear_to_send.wait(0.1) -1416 if not self.active: -1417 self._log(DEBUG, 'Dropping user packet because connection is dead.') -1418 return -1419 self.clear_to_send_lock.acquire() -1420 if self.clear_to_send.isSet(): -1421 break -1422 self.clear_to_send_lock.release() -1423 if time.time() > start + self.clear_to_send_timeout: -1424 raise SSHException('Key-exchange timed out waiting for key negotiation') -1425 try: -1426 self._send_message(data) -1427 finally: -1428 self.clear_to_send_lock.release() -
1429 -
1430 - def _set_K_H(self, k, h): -
1431 "used by a kex object to set the K (root key) and H (exchange hash)" -1432 self.K = k -1433 self.H = h -1434 if self.session_id == None: -1435 self.session_id = h -
1436 -
1437 - def _expect_packet(self, *ptypes): -
1438 "used by a kex object to register the next packet type it expects to see" -1439 self._expected_packet = tuple(ptypes) -
1440 -
1441 - def _verify_key(self, host_key, sig): -
1442 key = self._key_info[self.host_key_type](Message(host_key)) -1443 if key is None: -1444 raise SSHException('Unknown host key type') -1445 if not key.verify_ssh_sig(self.H, Message(sig)): -1446 raise SSHException('Signature verification (%s) failed.' % self.host_key_type) -1447 self.host_key = key -
1448 -
1449 - def _compute_key(self, id, nbytes): -
1450 "id is 'A' - 'F' for the various keys used by ssh" -1451 m = Message() -1452 m.add_mpint(self.K) -1453 m.add_bytes(self.H) -1454 m.add_byte(id) -1455 m.add_bytes(self.session_id) -1456 out = sofar = SHA.new(str(m)).digest() -1457 while len(out) < nbytes: -1458 m = Message() -1459 m.add_mpint(self.K) -1460 m.add_bytes(self.H) -1461 m.add_bytes(sofar) -1462 digest = SHA.new(str(m)).digest() -1463 out += digest -1464 sofar += digest -1465 return out[:nbytes] -
1466 -
1467 - def _get_cipher(self, name, key, iv): -
1468 if name not in self._cipher_info: -1469 raise SSHException('Unknown client cipher ' + name) -1470 if name in ('arcfour128', 'arcfour256'): -1471 # arcfour cipher -1472 cipher = self._cipher_info[name]['class'].new(key) -1473 # as per RFC 4345, the first 1536 bytes of keystream -1474 # generated by the cipher MUST be discarded -1475 cipher.encrypt(" " * 1536) -1476 return cipher -1477 elif name.endswith("-ctr"): -1478 # CTR modes, we need a counter -1479 counter = Counter.new(nbits=self._cipher_info[name]['block-size'] * 8, initial_value=util.inflate_long(iv, True)) -1480 return self._cipher_info[name]['class'].new(key, self._cipher_info[name]['mode'], iv, counter) -1481 else: -1482 return self._cipher_info[name]['class'].new(key, self._cipher_info[name]['mode'], iv) -
1483 -
1484 - def _set_x11_handler(self, handler): -
1485 # only called if a channel has turned on x11 forwarding -1486 if handler is None: -1487 # by default, use the same mechanism as accept() -1488 def default_handler(channel, (src_addr, src_port)): -1489 self._queue_incoming_channel(channel) -
1490 self._x11_handler = default_handler -1491 else: -1492 self._x11_handler = handler -1493 -
1494 - def _queue_incoming_channel(self, channel): -
1495 self.lock.acquire() -1496 try: -1497 self.server_accepts.append(channel) -1498 self.server_accept_cv.notify() -1499 finally: -1500 self.lock.release() -
1501 -
1502 - def run(self): -
1503 # (use the exposed "run" method, because if we specify a thread target -1504 # of a private method, threading.Thread will keep a reference to it -1505 # indefinitely, creating a GC cycle and not letting Transport ever be -1506 # GC'd. it's a bug in Thread.) -1507 -1508 # active=True occurs before the thread is launched, to avoid a race -1509 _active_threads.append(self) -1510 if self.server_mode: -1511 self._log(DEBUG, 'starting thread (server mode): %s' % hex(long(id(self)) & 0xffffffffL)) -1512 else: -1513 self._log(DEBUG, 'starting thread (client mode): %s' % hex(long(id(self)) & 0xffffffffL)) -1514 try: -1515 self.packetizer.write_all(self.local_version + '\r\n') -1516 self._check_banner() -1517 self._send_kex_init() -1518 self._expect_packet(MSG_KEXINIT) -1519 -1520 while self.active: -1521 if self.packetizer.need_rekey() and not self.in_kex: -1522 self._send_kex_init() -1523 try: -1524 ptype, m = self.packetizer.read_message() -1525 except NeedRekeyException: -1526 continue -1527 if ptype == MSG_IGNORE: -1528 continue -1529 elif ptype == MSG_DISCONNECT: -1530 self._parse_disconnect(m) -1531 self.active = False -1532 self.packetizer.close() -1533 break -1534 elif ptype == MSG_DEBUG: -1535 self._parse_debug(m) -1536 continue -1537 if len(self._expected_packet) > 0: -1538 if ptype not in self._expected_packet: -1539 raise SSHException('Expecting packet from %r, got %d' % (self._expected_packet, ptype)) -1540 self._expected_packet = tuple() -1541 if (ptype >= 30) and (ptype <= 39): -1542 self.kex_engine.parse_next(ptype, m) -1543 continue -1544 -1545 if ptype in self._handler_table: -1546 self._handler_table[ptype](self, m) -1547 elif ptype in self._channel_handler_table: -1548 chanid = m.get_int() -1549 chan = self._channels.get(chanid) -1550 if chan is not None: -1551 self._channel_handler_table[ptype](chan, m) -1552 elif chanid in self.channels_seen: -1553 self._log(DEBUG, 'Ignoring message for dead channel %d' % chanid) -1554 else: -1555 self._log(ERROR, 'Channel request for unknown channel %d' % chanid) -1556 self.active = False -1557 self.packetizer.close() -1558 elif (self.auth_handler is not None) and (ptype in self.auth_handler._handler_table): -1559 self.auth_handler._handler_table[ptype](self.auth_handler, m) -1560 else: -1561 self._log(WARNING, 'Oops, unhandled type %d' % ptype) -1562 msg = Message() -1563 msg.add_byte(chr(MSG_UNIMPLEMENTED)) -1564 msg.add_int(m.seqno) -1565 self._send_message(msg) -1566 except SSHException, e: -1567 self._log(ERROR, 'Exception: ' + str(e)) -1568 self._log(ERROR, util.tb_strings()) -1569 self.saved_exception = e -1570 except EOFError, e: -1571 self._log(DEBUG, 'EOF in transport thread') -1572 #self._log(DEBUG, util.tb_strings()) -1573 self.saved_exception = e -1574 except socket.error, e: -1575 if type(e.args) is tuple: -1576 emsg = '%s (%d)' % (e.args[1], e.args[0]) -1577 else: -1578 emsg = e.args -1579 self._log(ERROR, 'Socket exception: ' + emsg) -1580 self.saved_exception = e -1581 except Exception, e: -1582 self._log(ERROR, 'Unknown exception: ' + str(e)) -1583 self._log(ERROR, util.tb_strings()) -1584 self.saved_exception = e -1585 _active_threads.remove(self) -1586 for chan in self._channels.values(): -1587 chan._unlink() -1588 if self.active: -1589 self.active = False -1590 self.packetizer.close() -1591 if self.completion_event != None: -1592 self.completion_event.set() -1593 if self.auth_handler is not None: -1594 self.auth_handler.abort() -1595 for event in self.channel_events.values(): -1596 event.set() -1597 try: -1598 self.lock.acquire() -1599 self.server_accept_cv.notify() -1600 finally: -1601 self.lock.release() -1602 self.sock.close() -
1603 -1604 -1605 ### protocol stages -1606 -1607 -
1608 - def _negotiate_keys(self, m): -
1609 # throws SSHException on anything unusual -1610 self.clear_to_send_lock.acquire() -1611 try: -1612 self.clear_to_send.clear() -1613 finally: -1614 self.clear_to_send_lock.release() -1615 if self.local_kex_init == None: -1616 # remote side wants to renegotiate -1617 self._send_kex_init() -1618 self._parse_kex_init(m) -1619 self.kex_engine.start_kex() -
1620 -
1621 - def _check_banner(self): -
1622 # this is slow, but we only have to do it once -1623 for i in range(100): -1624 # give them 15 seconds for the first line, then just 2 seconds -1625 # each additional line. (some sites have very high latency.) -1626 if i == 0: -1627 timeout = self.banner_timeout -1628 else: -1629 timeout = 2 -1630 try: -1631 buf = self.packetizer.readline(timeout) -1632 except Exception, x: -1633 raise SSHException('Error reading SSH protocol banner' + str(x)) -1634 if buf[:4] == 'SSH-': -1635 break -1636 self._log(DEBUG, 'Banner: ' + buf) -1637 if buf[:4] != 'SSH-': -1638 raise SSHException('Indecipherable protocol version "' + buf + '"') -1639 # save this server version string for later -1640 self.remote_version = buf -1641 # pull off any attached comment -1642 comment = '' -1643 i = string.find(buf, ' ') -1644 if i >= 0: -1645 comment = buf[i+1:] -1646 buf = buf[:i] -1647 # parse out version string and make sure it matches -1648 segs = buf.split('-', 2) -1649 if len(segs) < 3: -1650 raise SSHException('Invalid SSH banner') -1651 version = segs[1] -1652 client = segs[2] -1653 if version != '1.99' and version != '2.0': -1654 raise SSHException('Incompatible version (%s instead of 2.0)' % (version,)) -1655 self._log(INFO, 'Connected (version %s, client %s)' % (version, client)) -
1656 -
1657 - def _send_kex_init(self): -
1658 """ -1659 announce to the other side that we'd like to negotiate keys, and what -1660 kind of key negotiation we support. -1661 """ -1662 self.clear_to_send_lock.acquire() -1663 try: -1664 self.clear_to_send.clear() -1665 finally: -1666 self.clear_to_send_lock.release() -1667 self.in_kex = True -1668 if self.server_mode: -1669 if (self._modulus_pack is None) and ('diffie-hellman-group-exchange-sha1' in self._preferred_kex): -1670 # can't do group-exchange if we don't have a pack of potential primes -1671 pkex = list(self.get_security_options().kex) -1672 pkex.remove('diffie-hellman-group-exchange-sha1') -1673 self.get_security_options().kex = pkex -1674 available_server_keys = filter(self.server_key_dict.keys().__contains__, -1675 self._preferred_keys) -1676 else: -1677 available_server_keys = self._preferred_keys -1678 -1679 m = Message() -1680 m.add_byte(chr(MSG_KEXINIT)) -1681 m.add_bytes(rng.read(16)) -1682 m.add_list(self._preferred_kex) -1683 m.add_list(available_server_keys) -1684 m.add_list(self._preferred_ciphers) -1685 m.add_list(self._preferred_ciphers) -1686 m.add_list(self._preferred_macs) -1687 m.add_list(self._preferred_macs) -1688 m.add_list(self._preferred_compression) -1689 m.add_list(self._preferred_compression) -1690 m.add_string('') -1691 m.add_string('') -1692 m.add_boolean(False) -1693 m.add_int(0) -1694 # save a copy for later (needed to compute a hash) -1695 self.local_kex_init = str(m) -1696 self._send_message(m) -
1697 -
1698 - def _parse_kex_init(self, m): -
1699 cookie = m.get_bytes(16) -1700 kex_algo_list = m.get_list() -1701 server_key_algo_list = m.get_list() -1702 client_encrypt_algo_list = m.get_list() -1703 server_encrypt_algo_list = m.get_list() -1704 client_mac_algo_list = m.get_list() -1705 server_mac_algo_list = m.get_list() -1706 client_compress_algo_list = m.get_list() -1707 server_compress_algo_list = m.get_list() -1708 client_lang_list = m.get_list() -1709 server_lang_list = m.get_list() -1710 kex_follows = m.get_boolean() -1711 unused = m.get_int() -1712 -1713 self._log(DEBUG, 'kex algos:' + str(kex_algo_list) + ' server key:' + str(server_key_algo_list) + \ -1714 ' client encrypt:' + str(client_encrypt_algo_list) + \ -1715 ' server encrypt:' + str(server_encrypt_algo_list) + \ -1716 ' client mac:' + str(client_mac_algo_list) + \ -1717 ' server mac:' + str(server_mac_algo_list) + \ -1718 ' client compress:' + str(client_compress_algo_list) + \ -1719 ' server compress:' + str(server_compress_algo_list) + \ -1720 ' client lang:' + str(client_lang_list) + \ -1721 ' server lang:' + str(server_lang_list) + \ -1722 ' kex follows?' + str(kex_follows)) -1723 -1724 # as a server, we pick the first item in the client's list that we support. -1725 # as a client, we pick the first item in our list that the server supports. -1726 if self.server_mode: -1727 agreed_kex = filter(self._preferred_kex.__contains__, kex_algo_list) -1728 else: -1729 agreed_kex = filter(kex_algo_list.__contains__, self._preferred_kex) -1730 if len(agreed_kex) == 0: -1731 raise SSHException('Incompatible ssh peer (no acceptable kex algorithm)') -1732 self.kex_engine = self._kex_info[agreed_kex[0]](self) -1733 -1734 if self.server_mode: -1735 available_server_keys = filter(self.server_key_dict.keys().__contains__, -1736 self._preferred_keys) -1737 agreed_keys = filter(available_server_keys.__contains__, server_key_algo_list) -1738 else: -1739 agreed_keys = filter(server_key_algo_list.__contains__, self._preferred_keys) -1740 if len(agreed_keys) == 0: -1741 raise SSHException('Incompatible ssh peer (no acceptable host key)') -1742 self.host_key_type = agreed_keys[0] -1743 if self.server_mode and (self.get_server_key() is None): -1744 raise SSHException('Incompatible ssh peer (can\'t match requested host key type)') -1745 -1746 if self.server_mode: -1747 agreed_local_ciphers = filter(self._preferred_ciphers.__contains__, -1748 server_encrypt_algo_list) -1749 agreed_remote_ciphers = filter(self._preferred_ciphers.__contains__, -1750 client_encrypt_algo_list) -1751 else: -1752 agreed_local_ciphers = filter(client_encrypt_algo_list.__contains__, -1753 self._preferred_ciphers) -1754 agreed_remote_ciphers = filter(server_encrypt_algo_list.__contains__, -1755 self._preferred_ciphers) -1756 if (len(agreed_local_ciphers) == 0) or (len(agreed_remote_ciphers) == 0): -1757 raise SSHException('Incompatible ssh server (no acceptable ciphers)') -1758 self.local_cipher = agreed_local_ciphers[0] -1759 self.remote_cipher = agreed_remote_ciphers[0] -1760 self._log(DEBUG, 'Ciphers agreed: local=%s, remote=%s' % (self.local_cipher, self.remote_cipher)) -1761 -1762 if self.server_mode: -1763 agreed_remote_macs = filter(self._preferred_macs.__contains__, client_mac_algo_list) -1764 agreed_local_macs = filter(self._preferred_macs.__contains__, server_mac_algo_list) -1765 else: -1766 agreed_local_macs = filter(client_mac_algo_list.__contains__, self._preferred_macs) -1767 agreed_remote_macs = filter(server_mac_algo_list.__contains__, self._preferred_macs) -1768 if (len(agreed_local_macs) == 0) or (len(agreed_remote_macs) == 0): -1769 raise SSHException('Incompatible ssh server (no acceptable macs)') -1770 self.local_mac = agreed_local_macs[0] -1771 self.remote_mac = agreed_remote_macs[0] -1772 -1773 if self.server_mode: -1774 agreed_remote_compression = filter(self._preferred_compression.__contains__, client_compress_algo_list) -1775 agreed_local_compression = filter(self._preferred_compression.__contains__, server_compress_algo_list) -1776 else: -1777 agreed_local_compression = filter(client_compress_algo_list.__contains__, self._preferred_compression) -1778 agreed_remote_compression = filter(server_compress_algo_list.__contains__, self._preferred_compression) -1779 if (len(agreed_local_compression) == 0) or (len(agreed_remote_compression) == 0): -1780 raise SSHException('Incompatible ssh server (no acceptable compression) %r %r %r' % (agreed_local_compression, agreed_remote_compression, self._preferred_compression)) -1781 self.local_compression = agreed_local_compression[0] -1782 self.remote_compression = agreed_remote_compression[0] -1783 -1784 self._log(DEBUG, 'using kex %s; server key type %s; cipher: local %s, remote %s; mac: local %s, remote %s; compression: local %s, remote %s' % -1785 (agreed_kex[0], self.host_key_type, self.local_cipher, self.remote_cipher, self.local_mac, -1786 self.remote_mac, self.local_compression, self.remote_compression)) -1787 -1788 # save for computing hash later... -1789 # now wait! openssh has a bug (and others might too) where there are -1790 # actually some extra bytes (one NUL byte in openssh's case) added to -1791 # the end of the packet but not parsed. turns out we need to throw -1792 # away those bytes because they aren't part of the hash. -1793 self.remote_kex_init = chr(MSG_KEXINIT) + m.get_so_far() -
1794 -
1795 - def _activate_inbound(self): -
1796 "switch on newly negotiated encryption parameters for inbound traffic" -1797 block_size = self._cipher_info[self.remote_cipher]['block-size'] -1798 if self.server_mode: -1799 IV_in = self._compute_key('A', block_size) -1800 key_in = self._compute_key('C', self._cipher_info[self.remote_cipher]['key-size']) -1801 else: -1802 IV_in = self._compute_key('B', block_size) -1803 key_in = self._compute_key('D', self._cipher_info[self.remote_cipher]['key-size']) -1804 engine = self._get_cipher(self.remote_cipher, key_in, IV_in) -1805 mac_size = self._mac_info[self.remote_mac]['size'] -1806 mac_engine = self._mac_info[self.remote_mac]['class'] -1807 # initial mac keys are done in the hash's natural size (not the potentially truncated -1808 # transmission size) -1809 if self.server_mode: -1810 mac_key = self._compute_key('E', mac_engine.digest_size) -1811 else: -1812 mac_key = self._compute_key('F', mac_engine.digest_size) -1813 self.packetizer.set_inbound_cipher(engine, block_size, mac_engine, mac_size, mac_key) -1814 compress_in = self._compression_info[self.remote_compression][1] -1815 if (compress_in is not None) and ((self.remote_compression != 'zlib@openssh.com') or self.authenticated): -1816 self._log(DEBUG, 'Switching on inbound compression ...') -1817 self.packetizer.set_inbound_compressor(compress_in()) -
1818 -
1819 - def _activate_outbound(self): -
1820 "switch on newly negotiated encryption parameters for outbound traffic" -1821 m = Message() -1822 m.add_byte(chr(MSG_NEWKEYS)) -1823 self._send_message(m) -1824 block_size = self._cipher_info[self.local_cipher]['block-size'] -1825 if self.server_mode: -1826 IV_out = self._compute_key('B', block_size) -1827 key_out = self._compute_key('D', self._cipher_info[self.local_cipher]['key-size']) -1828 else: -1829 IV_out = self._compute_key('A', block_size) -1830 key_out = self._compute_key('C', self._cipher_info[self.local_cipher]['key-size']) -1831 engine = self._get_cipher(self.local_cipher, key_out, IV_out) -1832 mac_size = self._mac_info[self.local_mac]['size'] -1833 mac_engine = self._mac_info[self.local_mac]['class'] -1834 # initial mac keys are done in the hash's natural size (not the potentially truncated -1835 # transmission size) -1836 if self.server_mode: -1837 mac_key = self._compute_key('F', mac_engine.digest_size) -1838 else: -1839 mac_key = self._compute_key('E', mac_engine.digest_size) -1840 self.packetizer.set_outbound_cipher(engine, block_size, mac_engine, mac_size, mac_key) -1841 compress_out = self._compression_info[self.local_compression][0] -1842 if (compress_out is not None) and ((self.local_compression != 'zlib@openssh.com') or self.authenticated): -1843 self._log(DEBUG, 'Switching on outbound compression ...') -1844 self.packetizer.set_outbound_compressor(compress_out()) -1845 if not self.packetizer.need_rekey(): -1846 self.in_kex = False -1847 # we always expect to receive NEWKEYS now -1848 self._expect_packet(MSG_NEWKEYS) -
1849 -
1850 - def _auth_trigger(self): -
1851 self.authenticated = True -1852 # delayed initiation of compression -1853 if self.local_compression == 'zlib@openssh.com': -1854 compress_out = self._compression_info[self.local_compression][0] -1855 self._log(DEBUG, 'Switching on outbound compression ...') -1856 self.packetizer.set_outbound_compressor(compress_out()) -1857 if self.remote_compression == 'zlib@openssh.com': -1858 compress_in = self._compression_info[self.remote_compression][1] -1859 self._log(DEBUG, 'Switching on inbound compression ...') -1860 self.packetizer.set_inbound_compressor(compress_in()) -
1861 -
1862 - def _parse_newkeys(self, m): -
1863 self._log(DEBUG, 'Switch to new keys ...') -1864 self._activate_inbound() -1865 # can also free a bunch of stuff here -1866 self.local_kex_init = self.remote_kex_init = None -1867 self.K = None -1868 self.kex_engine = None -1869 if self.server_mode and (self.auth_handler is None): -1870 # create auth handler for server mode -1871 self.auth_handler = AuthHandler(self) -1872 if not self.initial_kex_done: -1873 # this was the first key exchange -1874 self.initial_kex_done = True -1875 # send an event? -1876 if self.completion_event != None: -1877 self.completion_event.set() -1878 # it's now okay to send data again (if this was a re-key) -1879 if not self.packetizer.need_rekey(): -1880 self.in_kex = False -1881 self.clear_to_send_lock.acquire() -1882 try: -1883 self.clear_to_send.set() -1884 finally: -1885 self.clear_to_send_lock.release() -1886 return -
1887 -
1888 - def _parse_disconnect(self, m): -
1889 code = m.get_int() -1890 desc = m.get_string() -1891 self._log(INFO, 'Disconnect (code %d): %s' % (code, desc)) -
1892 -
1893 - def _parse_global_request(self, m): -
1894 kind = m.get_string() -1895 self._log(DEBUG, 'Received global request "%s"' % kind) -1896 want_reply = m.get_boolean() -1897 if not self.server_mode: -1898 self._log(DEBUG, 'Rejecting "%s" global request from server.' % kind) -1899 ok = False -1900 elif kind == 'tcpip-forward': -1901 address = m.get_string() -1902 port = m.get_int() -1903 ok = self.server_object.check_port_forward_request(address, port) -1904 if ok != False: -1905 ok = (ok,) -1906 elif kind == 'cancel-tcpip-forward': -1907 address = m.get_string() -1908 port = m.get_int() -1909 self.server_object.cancel_port_forward_request(address, port) -1910 ok = True -1911 else: -1912 ok = self.server_object.check_global_request(kind, m) -1913 extra = () -1914 if type(ok) is tuple: -1915 extra = ok -1916 ok = True -1917 if want_reply: -1918 msg = Message() -1919 if ok: -1920 msg.add_byte(chr(MSG_REQUEST_SUCCESS)) -1921 msg.add(*extra) -1922 else: -1923 msg.add_byte(chr(MSG_REQUEST_FAILURE)) -1924 self._send_message(msg) -
1925 -
1926 - def _parse_request_success(self, m): -
1927 self._log(DEBUG, 'Global request successful.') -1928 self.global_response = m -1929 if self.completion_event is not None: -1930 self.completion_event.set() -
1931 -
1932 - def _parse_request_failure(self, m): -
1933 self._log(DEBUG, 'Global request denied.') -1934 self.global_response = None -1935 if self.completion_event is not None: -1936 self.completion_event.set() -
1937 -
1938 - def _parse_channel_open_success(self, m): -
1939 chanid = m.get_int() -1940 server_chanid = m.get_int() -1941 server_window_size = m.get_int() -1942 server_max_packet_size = m.get_int() -1943 chan = self._channels.get(chanid) -1944 if chan is None: -1945 self._log(WARNING, 'Success for unrequested channel! [??]') -1946 return -1947 self.lock.acquire() -1948 try: -1949 chan._set_remote_channel(server_chanid, server_window_size, server_max_packet_size) -1950 self._log(INFO, 'Secsh channel %d opened.' % chanid) -1951 if chanid in self.channel_events: -1952 self.channel_events[chanid].set() -1953 del self.channel_events[chanid] -1954 finally: -1955 self.lock.release() -1956 return -
1957 -
1958 - def _parse_channel_open_failure(self, m): -
1959 chanid = m.get_int() -1960 reason = m.get_int() -1961 reason_str = m.get_string() -1962 lang = m.get_string() -1963 reason_text = CONNECTION_FAILED_CODE.get(reason, '(unknown code)') -1964 self._log(INFO, 'Secsh channel %d open FAILED: %s: %s' % (chanid, reason_str, reason_text)) -1965 self.lock.acquire() -1966 try: -1967 self.saved_exception = ChannelException(reason, reason_text) -1968 if chanid in self.channel_events: -1969 self._channels.delete(chanid) -1970 if chanid in self.channel_events: -1971 self.channel_events[chanid].set() -1972 del self.channel_events[chanid] -1973 finally: -1974 self.lock.release() -1975 return -
1976 -
1977 - def _parse_channel_open(self, m): -
1978 kind = m.get_string() -1979 chanid = m.get_int() -1980 initial_window_size = m.get_int() -1981 max_packet_size = m.get_int() -1982 reject = False -1983 if (kind == 'x11') and (self._x11_handler is not None): -1984 origin_addr = m.get_string() -1985 origin_port = m.get_int() -1986 self._log(DEBUG, 'Incoming x11 connection from %s:%d' % (origin_addr, origin_port)) -1987 self.lock.acquire() -1988 try: -1989 my_chanid = self._next_channel() -1990 finally: -1991 self.lock.release() -1992 elif (kind == 'forwarded-tcpip') and (self._tcp_handler is not None): -1993 server_addr = m.get_string() -1994 server_port = m.get_int() -1995 origin_addr = m.get_string() -1996 origin_port = m.get_int() -1997 self._log(DEBUG, 'Incoming tcp forwarded connection from %s:%d' % (origin_addr, origin_port)) -1998 self.lock.acquire() -1999 try: -2000 my_chanid = self._next_channel() -2001 finally: -2002 self.lock.release() -2003 elif not self.server_mode: -2004 self._log(DEBUG, 'Rejecting "%s" channel request from server.' % kind) -2005 reject = True -2006 reason = OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED -2007 else: -2008 self.lock.acquire() -2009 try: -2010 my_chanid = self._next_channel() -2011 finally: -2012 self.lock.release() -2013 if kind == 'direct-tcpip': -2014 # handle direct-tcpip requests comming from the client -2015 dest_addr = m.get_string() -2016 dest_port = m.get_int() -2017 origin_addr = m.get_string() -2018 origin_port = m.get_int() -2019 reason = self.server_object.check_channel_direct_tcpip_request( -2020 my_chanid, (origin_addr, origin_port), -2021 (dest_addr, dest_port)) -2022 else: -2023 reason = self.server_object.check_channel_request(kind, my_chanid) -2024 if reason != OPEN_SUCCEEDED: -2025 self._log(DEBUG, 'Rejecting "%s" channel request from client.' % kind) -2026 reject = True -2027 if reject: -2028 msg = Message() -2029 msg.add_byte(chr(MSG_CHANNEL_OPEN_FAILURE)) -2030 msg.add_int(chanid) -2031 msg.add_int(reason) -2032 msg.add_string('') -2033 msg.add_string('en') -2034 self._send_message(msg) -2035 return -2036 -2037 chan = Channel(my_chanid) -2038 self.lock.acquire() -2039 try: -2040 self._channels.put(my_chanid, chan) -2041 self.channels_seen[my_chanid] = True -2042 chan._set_transport(self) -2043 chan._set_window(self.window_size, self.max_packet_size) -2044 chan._set_remote_channel(chanid, initial_window_size, max_packet_size) -2045 finally: -2046 self.lock.release() -2047 m = Message() -2048 m.add_byte(chr(MSG_CHANNEL_OPEN_SUCCESS)) -2049 m.add_int(chanid) -2050 m.add_int(my_chanid) -2051 m.add_int(self.window_size) -2052 m.add_int(self.max_packet_size) -2053 self._send_message(m) -2054 self._log(INFO, 'Secsh channel %d (%s) opened.', my_chanid, kind) -2055 if kind == 'x11': -2056 self._x11_handler(chan, (origin_addr, origin_port)) -2057 elif kind == 'forwarded-tcpip': -2058 chan.origin_addr = (origin_addr, origin_port) -2059 self._tcp_handler(chan, (origin_addr, origin_port), (server_addr, server_port)) -2060 else: -2061 self._queue_incoming_channel(chan) -
2062 -
2063 - def _parse_debug(self, m): -
2064 always_display = m.get_boolean() -2065 msg = m.get_string() -2066 lang = m.get_string() -2067 self._log(DEBUG, 'Debug msg: ' + util.safe_string(msg)) -
2068 -
2069 - def _get_subsystem_handler(self, name): -
2070 try: -2071 self.lock.acquire() -2072 if name not in self.subsystem_table: -2073 return (None, [], {}) -2074 return self.subsystem_table[name] -2075 finally: -2076 self.lock.release() -
2077 -2078 _handler_table = { -2079 MSG_NEWKEYS: _parse_newkeys, -2080 MSG_GLOBAL_REQUEST: _parse_global_request, -2081 MSG_REQUEST_SUCCESS: _parse_request_success, -2082 MSG_REQUEST_FAILURE: _parse_request_failure, -2083 MSG_CHANNEL_OPEN_SUCCESS: _parse_channel_open_success, -2084 MSG_CHANNEL_OPEN_FAILURE: _parse_channel_open_failure, -2085 MSG_CHANNEL_OPEN: _parse_channel_open, -2086 MSG_KEXINIT: _negotiate_keys, -2087 } -2088 -2089 _channel_handler_table = { -2090 MSG_CHANNEL_SUCCESS: Channel._request_success, -2091 MSG_CHANNEL_FAILURE: Channel._request_failed, -2092 MSG_CHANNEL_DATA: Channel._feed, -2093 MSG_CHANNEL_EXTENDED_DATA: Channel._feed_extended, -2094 MSG_CHANNEL_WINDOW_ADJUST: Channel._window_adjust, -2095 MSG_CHANNEL_REQUEST: Channel._handle_request, -2096 MSG_CHANNEL_EOF: Channel._handle_eof, -2097 MSG_CHANNEL_CLOSE: Channel._handle_close, -2098 } -2099 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.transport.ChannelMap-class.html b/docs/paramiko.transport.ChannelMap-class.html deleted file mode 100644 index b9d6b70..0000000 --- a/docs/paramiko.transport.ChannelMap-class.html +++ /dev/null @@ -1,289 +0,0 @@ - - - - - paramiko.transport.ChannelMap - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module transport :: - Class ChannelMap - - - - - -
[frames] | no frames]
-
- -

Class ChannelMap

source code

-
-object --+
-         |
-        ChannelMap
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
-   - - - - - - -
put(self, - chanid, - chan) - source code - -
- -
-   - - - - - - -
get(self, - chanid) - source code - -
- -
-   - - - - - - -
delete(self, - chanid) - source code - -
- -
-   - - - - - - -
values(self) - source code - -
- -
-   - - - - - - -
__len__(self) - source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self) -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.util-module.html b/docs/paramiko.util-module.html deleted file mode 100644 index e35440e..0000000 --- a/docs/paramiko.util-module.html +++ /dev/null @@ -1,965 +0,0 @@ - - - - - paramiko.util - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module util - - - - - -
[frames] | no frames]
-
- -

Module util

source code

-

Useful functions used by the rest of paramiko.

- - - - - - - - - - - - - - - - -
- Classes
-   - - enumerate -
-   - - PFilter -
-   - - Counter
- Stateful counter for CTR mode crypto -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Functions
-   - - - - - - -
inflate_long(s, - always_positive=False)
- turns a normalized byte string into a long-int (adapted from - Crypto.Util.number)
- source code - -
- -
-   - - - - - - -
deflate_long(n, - add_sign_padding=True)
- turns a long-int into a normalized byte string (adapted from - Crypto.Util.number)
- source code - -
- -
-   - - - - - - -
format_binary_weird(data) - source code - -
- -
-   - - - - - - -
format_binary(data, - prefix='') - source code - -
- -
-   - - - - - - -
format_binary_line(data) - source code - -
- -
-   - - - - - - -
hexify(s) - source code - -
- -
-   - - - - - - -
unhexify(s) - source code - -
- -
-   - - - - - - -
safe_string(s) - source code - -
- -
-   - - - - - - -
bit_length(n) - source code - -
- -
-   - - - - - - -
tb_strings() - source code - -
- -
- string - - - - - - -
generate_key_bytes(hashclass, - salt, - key, - nbytes)
- Given a password, passphrase, or other human-source key, scramble it - through a secure hash into some keyworthy bytes.
- source code - -
- -
- dict(hostname, dict(keytype, PKey)) - - - - - - -
load_host_keys(filename)
- Read a file of known SSH host keys, in the format used by openssh, - and return a compound dict of hostname -> keytype - -> PKey.
- source code - -
- -
-   - - - - - - -
parse_ssh_config(file_obj)
- Provided only as a backward-compatible wrapper around SSHConfig.
- source code - -
- -
-   - - - - - - -
lookup_ssh_host_config(hostname, - config)
- Provided only as a backward-compatible wrapper around SSHConfig.
- source code - -
- -
-   - - - - - - -
mod_inverse(x, - m) - source code - -
- -
-   - - - - - - -
get_thread_id() - source code - -
- -
-   - - - - - - -
log_to_file(filename, - level=10)
- send paramiko logs to a logfile, if they're not already going - somewhere
- source code - -
- -
-   - - - - - - -
get_logger(name) - source code - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Variables
-   - - AUTH_FAILED = 2 -
-   - - AUTH_PARTIALLY_SUCCESSFUL = 1 -
-   - - AUTH_SUCCESSFUL = 0 -
-   - - CONNECTION_FAILED_CODE = {1: 'Administratively prohibited', 2:... -
-   - - CRITICAL = 50 -
-   - - DEBUG = 10 -
-   - - DISCONNECT_AUTH_CANCELLED_BY_USER = 13 -
-   - - DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14 -
-   - - DISCONNECT_SERVICE_NOT_AVAILABLE = 7 -
-   - - ERROR = 40 -
-   - - INFO = 20 -
-   - - MSG_CHANNEL_CLOSE = 97 -
-   - - MSG_CHANNEL_DATA = 94 -
-   - - MSG_CHANNEL_EOF = 96 -
-   - - MSG_CHANNEL_EXTENDED_DATA = 95 -
-   - - MSG_CHANNEL_FAILURE = 100 -
-   - - MSG_CHANNEL_OPEN = 90 -
-   - - MSG_CHANNEL_OPEN_FAILURE = 92 -
-   - - MSG_CHANNEL_OPEN_SUCCESS = 91 -
-   - - MSG_CHANNEL_REQUEST = 98 -
-   - - MSG_CHANNEL_SUCCESS = 99 -
-   - - MSG_CHANNEL_WINDOW_ADJUST = 93 -
-   - - MSG_DEBUG = 4 -
-   - - MSG_DISCONNECT = 1 -
-   - - MSG_GLOBAL_REQUEST = 80 -
-   - - MSG_IGNORE = 2 -
-   - - MSG_KEXINIT = 20 -
-   - - MSG_NAMES = {1: 'disconnect', 2: 'ignore', 3: 'unimplemented',... -
-   - - MSG_NEWKEYS = 21 -
-   - - MSG_REQUEST_FAILURE = 82 -
-   - - MSG_REQUEST_SUCCESS = 81 -
-   - - MSG_SERVICE_ACCEPT = 6 -
-   - - MSG_SERVICE_REQUEST = 5 -
-   - - MSG_UNIMPLEMENTED = 3 -
-   - - MSG_USERAUTH_BANNER = 53 -
-   - - MSG_USERAUTH_FAILURE = 51 -
-   - - MSG_USERAUTH_INFO_REQUEST = 60 -
-   - - MSG_USERAUTH_INFO_RESPONSE = 61 -
-   - - MSG_USERAUTH_PK_OK = 60 -
-   - - MSG_USERAUTH_REQUEST = 50 -
-   - - MSG_USERAUTH_SUCCESS = 52 -
-   - - OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED = 1 -
-   - - OPEN_FAILED_CONNECT_FAILED = 2 -
-   - - OPEN_FAILED_RESOURCE_SHORTAGE = 4 -
-   - - OPEN_FAILED_UNKNOWN_CHANNEL_TYPE = 3 -
-   - - OPEN_SUCCEEDED = 0 -
-   - - PY22 = False -
-   - - WARNING = 30 -
-   - - __package__ = 'paramiko' -
-   - - rng = Random.new() -
- - - - - - -
- Function Details
- -
- -
- - -
-

generate_key_bytes(hashclass, - salt, - key, - nbytes) -

-
source code  -
- -

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.

-
-
Parameters:
-
    -
  • hashclass (Crypto.Hash) - class from Crypto.Hash that can be used - as a secure hashing function (like MD5 or - SHA).
  • -
  • salt (string) - data to salt the hash with.
  • -
  • key (string) - human-entered password or passphrase.
  • -
  • nbytes (int) - number of bytes to generate.
  • -
-
Returns: string
-
key data
-
-
-
- -
- -
- - -
-

load_host_keys(filename) -

-
source code  -
- -

Read a file of known SSH host keys, in the format used by openssh, and - return a compound dict of hostname -> keytype -> PKey. The hostname may - be an IP address or DNS name. The keytype will be either - "ssh-rsa" or "ssh-dss".

-

This type of file unfortunately doesn't exist on Windows, but on - posix, it will usually be stored in - os.path.expanduser("~/.ssh/known_hosts").

-

Since 1.5.3, this is just a wrapper around HostKeys.

-
-
Parameters:
-
    -
  • filename (str) - name of the file to read host keys from
  • -
-
Returns: dict(hostname, dict(keytype, PKey))
-
dict of host keys, indexed by hostname and then keytype
-
-
-
-
- - - - - - -
- Variables Details
- -
- -
-

CONNECTION_FAILED_CODE

- -
-
-
-
Value:
-
-{1: 'Administratively prohibited',
- 2: 'Connect failed',
- 3: 'Unknown channel type',
- 4: 'Resource shortage'}
-
-
-
-
-
- -
- -
-

MSG_NAMES

- -
-
-
-
Value:
-
-{1: 'disconnect',
- 2: 'ignore',
- 3: 'unimplemented',
- 4: 'debug',
- 5: 'service-request',
- 6: 'service-accept',
- 20: 'kexinit',
- 21: 'newkeys',
-...
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.util-pysrc.html b/docs/paramiko.util-pysrc.html deleted file mode 100644 index 9a922d6..0000000 --- a/docs/paramiko.util-pysrc.html +++ /dev/null @@ -1,434 +0,0 @@ - - - - - paramiko.util - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module util - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.util

-
-  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
- 19  """ 
- 20  Useful functions used by the rest of paramiko. 
- 21  """ 
- 22   
- 23  from __future__ import generators 
- 24   
- 25  import array 
- 26  from binascii import hexlify, unhexlify 
- 27  import sys 
- 28  import struct 
- 29  import traceback 
- 30  import threading 
- 31   
- 32  from paramiko.common import * 
- 33  from paramiko.config import SSHConfig 
- 34   
- 35   
- 36  # Change by RogerB - python < 2.3 doesn't have enumerate so we implement it 
- 37  if sys.version_info < (2,3): 
-
38 - class enumerate: -
39 - def __init__ (self, sequence): -
40 self.sequence = sequence -
41 - def __iter__ (self): -
42 count = 0 - 43 for item in self.sequence: - 44 yield (count, item) - 45 count += 1 -
46 - 47 -
48 -def inflate_long(s, always_positive=False): -
49 "turns a normalized byte string into a long-int (adapted from Crypto.Util.number)" - 50 out = 0L - 51 negative = 0 - 52 if not always_positive and (len(s) > 0) and (ord(s[0]) >= 0x80): - 53 negative = 1 - 54 if len(s) % 4: - 55 filler = '\x00' - 56 if negative: - 57 filler = '\xff' - 58 s = filler * (4 - len(s) % 4) + s - 59 for i in range(0, len(s), 4): - 60 out = (out << 32) + struct.unpack('>I', s[i:i+4])[0] - 61 if negative: - 62 out -= (1L << (8 * len(s))) - 63 return out -
64 -
65 -def deflate_long(n, add_sign_padding=True): -
66 "turns a long-int into a normalized byte string (adapted from Crypto.Util.number)" - 67 # after much testing, this algorithm was deemed to be the fastest - 68 s = '' - 69 n = long(n) - 70 while (n != 0) and (n != -1): - 71 s = struct.pack('>I', n & 0xffffffffL) + s - 72 n = n >> 32 - 73 # strip off leading zeros, FFs - 74 for i in enumerate(s): - 75 if (n == 0) and (i[1] != '\000'): - 76 break - 77 if (n == -1) and (i[1] != '\xff'): - 78 break - 79 else: - 80 # degenerate case, n was either 0 or -1 - 81 i = (0,) - 82 if n == 0: - 83 s = '\000' - 84 else: - 85 s = '\xff' - 86 s = s[i[0]:] - 87 if add_sign_padding: - 88 if (n == 0) and (ord(s[0]) >= 0x80): - 89 s = '\x00' + s - 90 if (n == -1) and (ord(s[0]) < 0x80): - 91 s = '\xff' + s - 92 return s -
93 -
94 -def format_binary_weird(data): -
95 out = '' - 96 for i in enumerate(data): - 97 out += '%02X' % ord(i[1]) - 98 if i[0] % 2: - 99 out += ' ' -100 if i[0] % 16 == 15: -101 out += '\n' -102 return out -
103 -
104 -def format_binary(data, prefix=''): -
105 x = 0 -106 out = [] -107 while len(data) > x + 16: -108 out.append(format_binary_line(data[x:x+16])) -109 x += 16 -110 if x < len(data): -111 out.append(format_binary_line(data[x:])) -112 return [prefix + x for x in out] -
113 -
114 -def format_binary_line(data): -
115 left = ' '.join(['%02X' % ord(c) for c in data]) -116 right = ''.join([('.%c..' % c)[(ord(c)+63)//95] for c in data]) -117 return '%-50s %s' % (left, right) -
118 -
119 -def hexify(s): -
120 return hexlify(s).upper() -
121 -
122 -def unhexify(s): -
123 return unhexlify(s) -
124 -
125 -def safe_string(s): -
126 out = '' -127 for c in s: -128 if (ord(c) >= 32) and (ord(c) <= 127): -129 out += c -130 else: -131 out += '%%%02X' % ord(c) -132 return out -
133 -134 # ''.join([['%%%02X' % ord(c), c][(ord(c) >= 32) and (ord(c) <= 127)] for c in s]) -135 -
136 -def bit_length(n): -
137 norm = deflate_long(n, 0) -138 hbyte = ord(norm[0]) -139 if hbyte == 0: -140 return 1 -141 bitlen = len(norm) * 8 -142 while not (hbyte & 0x80): -143 hbyte <<= 1 -144 bitlen -= 1 -145 return bitlen -
146 -
147 -def tb_strings(): -
148 return ''.join(traceback.format_exception(*sys.exc_info())).split('\n') -
149 -
150 -def generate_key_bytes(hashclass, salt, key, nbytes): -
151 """ -152 Given a password, passphrase, or other human-source key, scramble it -153 through a secure hash into some keyworthy bytes. This specific algorithm -154 is used for encrypting/decrypting private key files. -155 -156 @param hashclass: class from L{Crypto.Hash} that can be used as a secure -157 hashing function (like C{MD5} or C{SHA}). -158 @type hashclass: L{Crypto.Hash} -159 @param salt: data to salt the hash with. -160 @type salt: string -161 @param key: human-entered password or passphrase. -162 @type key: string -163 @param nbytes: number of bytes to generate. -164 @type nbytes: int -165 @return: key data -166 @rtype: string -167 """ -168 keydata = '' -169 digest = '' -170 if len(salt) > 8: -171 salt = salt[:8] -172 while nbytes > 0: -173 hash_obj = hashclass.new() -174 if len(digest) > 0: -175 hash_obj.update(digest) -176 hash_obj.update(key) -177 hash_obj.update(salt) -178 digest = hash_obj.digest() -179 size = min(nbytes, len(digest)) -180 keydata += digest[:size] -181 nbytes -= size -182 return keydata -
183 -
184 -def load_host_keys(filename): -
185 """ -186 Read a file of known SSH host keys, in the format used by openssh, and -187 return a compound dict of C{hostname -> keytype ->} L{PKey <paramiko.pkey.PKey>}. -188 The hostname may be an IP address or DNS name. The keytype will be either -189 C{"ssh-rsa"} or C{"ssh-dss"}. -190 -191 This type of file unfortunately doesn't exist on Windows, but on posix, -192 it will usually be stored in C{os.path.expanduser("~/.ssh/known_hosts")}. -193 -194 Since 1.5.3, this is just a wrapper around L{HostKeys}. -195 -196 @param filename: name of the file to read host keys from -197 @type filename: str -198 @return: dict of host keys, indexed by hostname and then keytype -199 @rtype: dict(hostname, dict(keytype, L{PKey <paramiko.pkey.PKey>})) -200 """ -201 from paramiko.hostkeys import HostKeys -202 return HostKeys(filename) -
203 -
204 -def parse_ssh_config(file_obj): -
205 """ -206 Provided only as a backward-compatible wrapper around L{SSHConfig}. -207 """ -208 config = SSHConfig() -209 config.parse(file_obj) -210 return config -
211 -
212 -def lookup_ssh_host_config(hostname, config): -
213 """ -214 Provided only as a backward-compatible wrapper around L{SSHConfig}. -215 """ -216 return config.lookup(hostname) -
217 -
218 -def mod_inverse(x, m): -
219 # it's crazy how small python can make this function. -220 u1, u2, u3 = 1, 0, m -221 v1, v2, v3 = 0, 1, x -222 -223 while v3 > 0: -224 q = u3 // v3 -225 u1, v1 = v1, u1 - v1 * q -226 u2, v2 = v2, u2 - v2 * q -227 u3, v3 = v3, u3 - v3 * q -228 if u2 < 0: -229 u2 += m -230 return u2 -
231 -232 _g_thread_ids = {} -233 _g_thread_counter = 0 -234 _g_thread_lock = threading.Lock() -
235 -def get_thread_id(): -
236 global _g_thread_ids, _g_thread_counter, _g_thread_lock -237 tid = id(threading.currentThread()) -238 try: -239 return _g_thread_ids[tid] -240 except KeyError: -241 _g_thread_lock.acquire() -242 try: -243 _g_thread_counter += 1 -244 ret = _g_thread_ids[tid] = _g_thread_counter -245 finally: -246 _g_thread_lock.release() -247 return ret -
248 -
249 -def log_to_file(filename, level=DEBUG): -
250 "send paramiko logs to a logfile, if they're not already going somewhere" -251 l = logging.getLogger("paramiko") -252 if len(l.handlers) > 0: -253 return -254 l.setLevel(level) -255 f = open(filename, 'w') -256 lh = logging.StreamHandler(f) -257 lh.setFormatter(logging.Formatter('%(levelname)-.3s [%(asctime)s.%(msecs)03d] thr=%(_threadid)-3d %(name)s: %(message)s', -258 '%Y%m%d-%H:%M:%S')) -259 l.addHandler(lh) -
260 -261 # make only one filter object, so it doesn't get applied more than once -
262 -class PFilter (object): -
263 - def filter(self, record): -
264 record._threadid = get_thread_id() -265 return True -
266 _pfilter = PFilter() -267 -
268 -def get_logger(name): -
269 l = logging.getLogger(name) -270 l.addFilter(_pfilter) -271 return l -
272 -273 -
274 -class Counter (object): -
275 """Stateful counter for CTR mode crypto""" -
276 - def __init__(self, nbits, initial_value=1L, overflow=0L): -
277 self.blocksize = nbits / 8 -278 self.overflow = overflow -279 # start with value - 1 so we don't have to store intermediate values when counting -280 # could the iv be 0? -281 if initial_value == 0: -282 self.value = array.array('c', '\xFF' * self.blocksize) -283 else: -284 x = deflate_long(initial_value - 1, add_sign_padding=False) -285 self.value = array.array('c', '\x00' * (self.blocksize - len(x)) + x) -
286 -
287 - def __call__(self): -
288 """Increament the counter and return the new value""" -289 i = self.blocksize - 1 -290 while i > -1: -291 c = self.value[i] = chr((ord(self.value[i]) + 1) % 256) -292 if c != '\x00': -293 return self.value.tostring() -294 i -= 1 -295 # counter reset -296 x = deflate_long(self.overflow, add_sign_padding=False) -297 self.value = array.array('c', '\x00' * (self.blocksize - len(x)) + x) -298 return self.value.tostring() -
299 -
300 - def new(cls, nbits, initial_value=1L, overflow=0L): -
301 return cls(nbits, initial_value=initial_value, overflow=overflow) -
302 new = classmethod(new) -
303 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.util.Counter-class.html b/docs/paramiko.util.Counter-class.html deleted file mode 100644 index 1469787..0000000 --- a/docs/paramiko.util.Counter-class.html +++ /dev/null @@ -1,258 +0,0 @@ - - - - - paramiko.util.Counter - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module util :: - Class Counter - - - - - -
[frames] | no frames]
-
- -

Class Counter

source code

-
-object --+
-         |
-        Counter
-
- -
-

Stateful counter for CTR mode crypto

- - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - nbits, - initial_value=1, - overflow=0)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
-   - - - - - - -
__call__(self)
- Increament the counter and return the new value
- source code - -
- -
-

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

-
- - - - - - - - - -
- Class Methods
-   - - - - - - -
new(cls, - nbits, - initial_value=1, - overflow=0) - source code - -
- -
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self, - nbits, - initial_value=1, - overflow=0) -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.util.PFilter-class.html b/docs/paramiko.util.PFilter-class.html deleted file mode 100644 index 85db9a9..0000000 --- a/docs/paramiko.util.PFilter-class.html +++ /dev/null @@ -1,171 +0,0 @@ - - - - - paramiko.util.PFilter - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module util :: - Class PFilter - - - - - -
[frames] | no frames]
-
- -

Class PFilter

source code

-
-object --+
-         |
-        PFilter
-
- -
- - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
filter(self, - record) - source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.util.enumerate-class.html b/docs/paramiko.util.enumerate-class.html deleted file mode 100644 index d084c75..0000000 --- a/docs/paramiko.util.enumerate-class.html +++ /dev/null @@ -1,145 +0,0 @@ - - - - - paramiko.util.enumerate - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module util :: - Class enumerate - - - - - -
[frames] | no frames]
-
- -

Class enumerate

source code

- - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self, - sequence) - source code - -
- -
-   - - - - - - -
__iter__(self) - source code - -
- -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.win_pageant-module.html b/docs/paramiko.win_pageant-module.html deleted file mode 100644 index 443dfec..0000000 --- a/docs/paramiko.win_pageant-module.html +++ /dev/null @@ -1,204 +0,0 @@ - - - - - paramiko.win_pageant - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module win_pageant - - - - - -
[frames] | no frames]
-
- -

Module win_pageant

source code

-

Functions for communicating with Pageant, the basic windows ssh agent - program.

- - - - - - - - - - -
- Classes
-   - - PageantConnection
- Mock "connection" to an agent which roughly approximates - the behavior of a unix local-domain socket (as used by Agent). -
- - - - - - - - - -
- Functions
-   - - - - - - -
can_talk_to_agent()
- Check to see if there is a "Pageant" agent we can talk to.
- source code - -
- -
- - - - - - - - - - - - -
- Variables
-   - - win32con_WM_COPYDATA = 74 -
-   - - __package__ = 'paramiko' -
- - - - - - -
- Function Details
- -
- -
- - -
-

can_talk_to_agent() -

-
source code  -
- -

Check to see if there is a "Pageant" agent we can talk - to.

-

This checks both if we have the required libraries (win32all or - ctypes) and if there is a Pageant currently running.

-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.win_pageant-pysrc.html b/docs/paramiko.win_pageant-pysrc.html deleted file mode 100644 index f96c903..0000000 --- a/docs/paramiko.win_pageant-pysrc.html +++ /dev/null @@ -1,287 +0,0 @@ - - - - - paramiko.win_pageant - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module win_pageant - - - - - -
[frames] | no frames]
-
-

Source Code for Module paramiko.win_pageant

-
-  1  # Copyright (C) 2005 John Arbash-Meinel <john@arbash-meinel.com> 
-  2  # Modified up by: Todd Whiteman <ToddW@ActiveState.com> 
-  3  # 
-  4  # This file is part of paramiko. 
-  5  # 
-  6  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  7  # terms of the GNU Lesser General Public License as published by the Free 
-  8  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  9  # any later version. 
- 10  # 
- 11  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 12  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 13  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 14  # details. 
- 15  # 
- 16  # You should have received a copy of the GNU Lesser General Public License 
- 17  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 18  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 19   
- 20  """ 
- 21  Functions for communicating with Pageant, the basic windows ssh agent program. 
- 22  """ 
- 23   
- 24  import os 
- 25  import struct 
- 26  import tempfile 
- 27  import mmap 
- 28  import array 
- 29   
- 30  # if you're on windows, you should have one of these, i guess? 
- 31  # ctypes is part of standard library since Python 2.5 
- 32  _has_win32all = False 
- 33  _has_ctypes = False 
- 34  try: 
- 35      # win32gui is preferred over win32ui to avoid MFC dependencies 
- 36      import win32gui 
- 37      _has_win32all = True 
- 38  except ImportError: 
- 39      try: 
- 40          import ctypes 
- 41          _has_ctypes = True 
- 42      except ImportError: 
- 43          pass 
- 44   
- 45   
- 46  _AGENT_COPYDATA_ID = 0x804e50ba 
- 47  _AGENT_MAX_MSGLEN = 8192 
- 48  # Note: The WM_COPYDATA value is pulled from win32con, as a workaround 
- 49  # so we do not have to import this huge library just for this one variable. 
- 50  win32con_WM_COPYDATA = 74 
- 51   
- 52   
-
54 if _has_win32all: - 55 try: - 56 hwnd = win32gui.FindWindow('Pageant', 'Pageant') - 57 return hwnd - 58 except win32gui.error: - 59 pass - 60 elif _has_ctypes: - 61 # Return 0 if there is no Pageant window. - 62 return ctypes.windll.user32.FindWindowA('Pageant', 'Pageant') - 63 return None -
64 - 65 -
66 -def can_talk_to_agent(): -
67 """ - 68 Check to see if there is a "Pageant" agent we can talk to. - 69 - 70 This checks both if we have the required libraries (win32all or ctypes) - 71 and if there is a Pageant currently running. - 72 """ - 73 if (_has_win32all or _has_ctypes) and _get_pageant_window_object(): - 74 return True - 75 return False -
76 - 77 -
78 -def _query_pageant(msg): -
79 hwnd = _get_pageant_window_object() - 80 if not hwnd: - 81 # Raise a failure to connect exception, pageant isn't running anymore! - 82 return None - 83 - 84 # Write our pageant request string into the file (pageant will read this to determine what to do) - 85 filename = tempfile.mktemp('.pag') - 86 map_filename = os.path.basename(filename) - 87 - 88 f = open(filename, 'w+b') - 89 f.write(msg ) - 90 # Ensure the rest of the file is empty, otherwise pageant will read this - 91 f.write('\0' * (_AGENT_MAX_MSGLEN - len(msg))) - 92 # Create the shared file map that pageant will use to read from - 93 pymap = mmap.mmap(f.fileno(), _AGENT_MAX_MSGLEN, tagname=map_filename, access=mmap.ACCESS_WRITE) - 94 try: - 95 # Create an array buffer containing the mapped filename - 96 char_buffer = array.array("c", map_filename + '\0') - 97 char_buffer_address, char_buffer_size = char_buffer.buffer_info() - 98 # Create a string to use for the SendMessage function call - 99 cds = struct.pack("LLP", _AGENT_COPYDATA_ID, char_buffer_size, char_buffer_address) -100 -101 if _has_win32all: -102 # win32gui.SendMessage should also allow the same pattern as -103 # ctypes, but let's keep it like this for now... -104 response = win32gui.SendMessage(hwnd, win32con_WM_COPYDATA, len(cds), cds) -105 elif _has_ctypes: -106 _buf = array.array('B', cds) -107 _addr, _size = _buf.buffer_info() -108 response = ctypes.windll.user32.SendMessageA(hwnd, win32con_WM_COPYDATA, _size, _addr) -109 else: -110 response = 0 -111 -112 if response > 0: -113 datalen = pymap.read(4) -114 retlen = struct.unpack('>I', datalen)[0] -115 return datalen + pymap.read(retlen) -116 return None -117 finally: -118 pymap.close() -119 f.close() -120 # Remove the file, it was temporary only -121 os.unlink(filename) -
122 -123 -
124 -class PageantConnection (object): -
125 """ -126 Mock "connection" to an agent which roughly approximates the behavior of -127 a unix local-domain socket (as used by Agent). Requests are sent to the -128 pageant daemon via special Windows magick, and responses are buffered back -129 for subsequent reads. -130 """ -131 -
132 - def __init__(self): -
133 self._response = None -
134 -
135 - def send(self, data): -
136 self._response = _query_pageant(data) -
137 -
138 - def recv(self, n): -
139 if self._response is None: -140 return '' -141 ret = self._response[:n] -142 self._response = self._response[n:] -143 if self._response == '': -144 self._response = None -145 return ret -
146 -
147 - def close(self): -
148 pass -
149 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/paramiko.win_pageant.PageantConnection-class.html b/docs/paramiko.win_pageant.PageantConnection-class.html deleted file mode 100644 index 1170e05..0000000 --- a/docs/paramiko.win_pageant.PageantConnection-class.html +++ /dev/null @@ -1,260 +0,0 @@ - - - - - paramiko.win_pageant.PageantConnection - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module win_pageant :: - Class PageantConnection - - - - - -
[frames] | no frames]
-
- -

Class PageantConnection

source code

-
-object --+
-         |
-        PageantConnection
-
- -
-

Mock "connection" to an agent which roughly approximates the - behavior of a unix local-domain socket (as used by Agent). Requests are - sent to the pageant daemon via special Windows magick, and responses are - buffered back for subsequent reads.

- - - - - - - - - - - - - - - - - - - - - - -
- Instance Methods
-   - - - - - - -
__init__(self)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- source code - -
- -
-   - - - - - - -
send(self, - data) - source code - -
- -
-   - - - - - - -
recv(self, - n) - source code - -
- -
-   - - - - - - -
close(self) - source code - -
- -
-

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

-
- - - - - - - - - -
- Properties
-

Inherited from object: - __class__ -

-
- - - - - - -
- Method Details
- -
- -
- - -
-

__init__(self) -
(Constructor) -

-
source code  -
- -

x.__init__(...) initializes x; see x.__class__.__doc__ for - signature

-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/redirect.html b/docs/redirect.html deleted file mode 100644 index c36dbb0..0000000 --- a/docs/redirect.html +++ /dev/null @@ -1,38 +0,0 @@ -Epydoc Redirect Page - - - - - - - - -

Epydoc Auto-redirect page

- -

When javascript is enabled, this page will redirect URLs of -the form redirect.html#dotted.name to the -documentation for the object with the given fully-qualified -dotted name.

-

 

- - - - - diff --git a/docs/since-index.html b/docs/since-index.html deleted file mode 100644 index fc67c2e..0000000 --- a/docs/since-index.html +++ /dev/null @@ -1,302 +0,0 @@ - - - - - Introductions List - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  - - - -
[frames] | no frames]
-
-
[ - Identifiers -| Bugs -| Introductions -]

-

Introductions List

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/toc-everything.html b/docs/toc-everything.html deleted file mode 100644 index 725301a..0000000 --- a/docs/toc-everything.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - Everything - - - - - -

Everything

-
-

All Classes

- paramiko.Agent
paramiko.AgentKey
paramiko.AuthenticationException
paramiko.AutoAddPolicy
paramiko.BadAuthenticationType
paramiko.BadHostKeyException
paramiko.BufferedFile
paramiko.Channel
paramiko.ChannelException
paramiko.DSSKey
paramiko.HostKeys
paramiko.Message
paramiko.MissingHostKeyPolicy
paramiko.PKey
paramiko.PasswordRequiredException
paramiko.RSAKey
paramiko.RejectPolicy
paramiko.SFTP
paramiko.SFTPAttributes
paramiko.SFTPClient
paramiko.SFTPError
paramiko.SFTPFile
paramiko.SFTPHandle
paramiko.SFTPServer
paramiko.SFTPServerInterface
paramiko.SSHClient
paramiko.SSHConfig
paramiko.SSHException
paramiko.SecurityOptions
paramiko.ServerInterface
paramiko.SubsystemHandler
paramiko.Transport
paramiko.WarningPolicy
paramiko.logging22.Formatter
paramiko.logging22.StreamHandler
paramiko.logging22.logger
paramiko.util.Counter
paramiko.util.PFilter
paramiko.util.enumerate
paramiko.win_pageant.PageantConnection

All Functions

- paramiko.logging22.getLogger
paramiko.util.bit_length
paramiko.util.deflate_long
paramiko.util.format_binary
paramiko.util.format_binary_line
paramiko.util.format_binary_weird
paramiko.util.generate_key_bytes
paramiko.util.get_logger
paramiko.util.get_thread_id
paramiko.util.hexify
paramiko.util.inflate_long
paramiko.util.load_host_keys
paramiko.util.log_to_file
paramiko.util.lookup_ssh_host_config
paramiko.util.mod_inverse
paramiko.util.parse_ssh_config
paramiko.util.safe_string
paramiko.util.tb_strings
paramiko.util.unhexify
paramiko.win_pageant.can_talk_to_agent

All Variables

- paramiko.logging22.CRITICAL
paramiko.logging22.DEBUG
paramiko.logging22.ERROR
paramiko.logging22.INFO
paramiko.logging22.WARNING
paramiko.logging22.__package__
paramiko.util.AUTH_FAILED
paramiko.util.AUTH_PARTIALLY_SUCCESSFUL
paramiko.util.AUTH_SUCCESSFUL
paramiko.util.CONNECTION_FAILED_CODE
paramiko.util.CRITICAL
paramiko.util.DEBUG
paramiko.util.DISCONNECT_AUTH_CANCELLED_BY_USER
paramiko.util.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE
paramiko.util.DISCONNECT_SERVICE_NOT_AVAILABLE
paramiko.util.ERROR
paramiko.util.INFO
paramiko.util.MSG_CHANNEL_CLOSE
paramiko.util.MSG_CHANNEL_DATA
paramiko.util.MSG_CHANNEL_EOF
paramiko.util.MSG_CHANNEL_EXTENDED_DATA
paramiko.util.MSG_CHANNEL_FAILURE
paramiko.util.MSG_CHANNEL_OPEN
paramiko.util.MSG_CHANNEL_OPEN_FAILURE
paramiko.util.MSG_CHANNEL_OPEN_SUCCESS
paramiko.util.MSG_CHANNEL_REQUEST
paramiko.util.MSG_CHANNEL_SUCCESS
paramiko.util.MSG_CHANNEL_WINDOW_ADJUST
paramiko.util.MSG_DEBUG
paramiko.util.MSG_DISCONNECT
paramiko.util.MSG_GLOBAL_REQUEST
paramiko.util.MSG_IGNORE
paramiko.util.MSG_KEXINIT
paramiko.util.MSG_NAMES
paramiko.util.MSG_NEWKEYS
paramiko.util.MSG_REQUEST_FAILURE
paramiko.util.MSG_REQUEST_SUCCESS
paramiko.util.MSG_SERVICE_ACCEPT
paramiko.util.MSG_SERVICE_REQUEST
paramiko.util.MSG_UNIMPLEMENTED
paramiko.util.MSG_USERAUTH_BANNER
paramiko.util.MSG_USERAUTH_FAILURE
paramiko.util.MSG_USERAUTH_INFO_REQUEST
paramiko.util.MSG_USERAUTH_INFO_RESPONSE
paramiko.util.MSG_USERAUTH_PK_OK
paramiko.util.MSG_USERAUTH_REQUEST
paramiko.util.MSG_USERAUTH_SUCCESS
paramiko.util.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED
paramiko.util.OPEN_FAILED_CONNECT_FAILED
paramiko.util.OPEN_FAILED_RESOURCE_SHORTAGE
paramiko.util.OPEN_FAILED_UNKNOWN_CHANNEL_TYPE
paramiko.util.OPEN_SUCCEEDED
paramiko.util.PY22
paramiko.util.WARNING
paramiko.util.__package__
paramiko.util.rng
paramiko.win_pageant.__package__
paramiko.win_pageant.win32con_WM_COPYDATA

- - - - diff --git a/docs/toc-paramiko-module.html b/docs/toc-paramiko-module.html deleted file mode 100644 index f6b2876..0000000 --- a/docs/toc-paramiko-module.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - paramiko - - - - - -

Module paramiko

-
-

Classes

- Agent
AgentKey
AuthenticationException
AutoAddPolicy
BadAuthenticationType
BadHostKeyException
BufferedFile
Channel
ChannelException
DSSKey
HostKeys
Message
MissingHostKeyPolicy
PKey
PasswordRequiredException
RSAKey
RejectPolicy
SFTP
SFTPAttributes
SFTPClient
SFTPError
SFTPFile
SFTPHandle
SFTPServer
SFTPServerInterface
SSHClient
SSHConfig
SSHException
SecurityOptions
ServerInterface
SubsystemHandler
Transport
WarningPolicy

- - - - diff --git a/docs/toc-paramiko.agent-module.html b/docs/toc-paramiko.agent-module.html deleted file mode 100644 index 5de5e79..0000000 --- a/docs/toc-paramiko.agent-module.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - agent - - - - - -

Module agent

-
-

Variables

-
- - - - diff --git a/docs/toc-paramiko.auth_handler-module.html b/docs/toc-paramiko.auth_handler-module.html deleted file mode 100644 index 7fa221d..0000000 --- a/docs/toc-paramiko.auth_handler-module.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - auth_handler - - - - - -

Module auth_handler

-
-

Variables

-
- - - - diff --git a/docs/toc-paramiko.ber-module.html b/docs/toc-paramiko.ber-module.html deleted file mode 100644 index 7190335..0000000 --- a/docs/toc-paramiko.ber-module.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - ber - - - - - -

Module ber

-
-

Classes

-

Variables

-
- - - - diff --git a/docs/toc-paramiko.buffered_pipe-module.html b/docs/toc-paramiko.buffered_pipe-module.html deleted file mode 100644 index 338589e..0000000 --- a/docs/toc-paramiko.buffered_pipe-module.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - buffered_pipe - - - - - -

Module buffered_pipe

-
-

Classes

-

Variables

-
- - - - diff --git a/docs/toc-paramiko.channel-module.html b/docs/toc-paramiko.channel-module.html deleted file mode 100644 index 7eaaa97..0000000 --- a/docs/toc-paramiko.channel-module.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - channel - - - - - -

Module channel

-
-

Classes

-

Variables

-
- - - - diff --git a/docs/toc-paramiko.client-module.html b/docs/toc-paramiko.client-module.html deleted file mode 100644 index 577541e..0000000 --- a/docs/toc-paramiko.client-module.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - client - - - - - -

Module client

-
-

Variables

-
- - - - diff --git a/docs/toc-paramiko.common-module.html b/docs/toc-paramiko.common-module.html deleted file mode 100644 index 0d0a848..0000000 --- a/docs/toc-paramiko.common-module.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - common - - - - - -

Module common

-
-

Variables

-
- - - - diff --git a/docs/toc-paramiko.compress-module.html b/docs/toc-paramiko.compress-module.html deleted file mode 100644 index b4243ab..0000000 --- a/docs/toc-paramiko.compress-module.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - compress - - - - - -

Module compress

-
-

Classes

-

Variables

-
- - - - diff --git a/docs/toc-paramiko.config-module.html b/docs/toc-paramiko.config-module.html deleted file mode 100644 index fab1f11..0000000 --- a/docs/toc-paramiko.config-module.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - config - - - - - -

Module config

-
-

Variables

-
- - - - diff --git a/docs/toc-paramiko.dsskey-module.html b/docs/toc-paramiko.dsskey-module.html deleted file mode 100644 index 6e0de13..0000000 --- a/docs/toc-paramiko.dsskey-module.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - dsskey - - - - - -

Module dsskey

-
-

Variables

-
- - - - diff --git a/docs/toc-paramiko.file-module.html b/docs/toc-paramiko.file-module.html deleted file mode 100644 index bb4f7e9..0000000 --- a/docs/toc-paramiko.file-module.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - file - - - - - -

Module file

-
-

Variables

-
- - - - diff --git a/docs/toc-paramiko.hostkeys-module.html b/docs/toc-paramiko.hostkeys-module.html deleted file mode 100644 index d7b93dd..0000000 --- a/docs/toc-paramiko.hostkeys-module.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - hostkeys - - - - - -

Module hostkeys

-
-

Classes

-

Variables

-
- - - - diff --git a/docs/toc-paramiko.kex_gex-module.html b/docs/toc-paramiko.kex_gex-module.html deleted file mode 100644 index 6f341ae..0000000 --- a/docs/toc-paramiko.kex_gex-module.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - kex_gex - - - - - -

Module kex_gex

-
-

Classes

-

Variables

-
- - - - diff --git a/docs/toc-paramiko.kex_group1-module.html b/docs/toc-paramiko.kex_group1-module.html deleted file mode 100644 index 75e12ba..0000000 --- a/docs/toc-paramiko.kex_group1-module.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - kex_group1 - - - - - -

Module kex_group1

-
-

Classes

-

Variables

-
- - - - diff --git a/docs/toc-paramiko.logging22-module.html b/docs/toc-paramiko.logging22-module.html deleted file mode 100644 index df6f73f..0000000 --- a/docs/toc-paramiko.logging22-module.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - logging22 - - - - - -

Module logging22

-
-

Classes

- Formatter
StreamHandler
logger

Functions

- getLogger

Variables

- CRITICAL
DEBUG
ERROR
INFO
WARNING
__package__

- - - - diff --git a/docs/toc-paramiko.message-module.html b/docs/toc-paramiko.message-module.html deleted file mode 100644 index 14c9b27..0000000 --- a/docs/toc-paramiko.message-module.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - message - - - - - -

Module message

-
-

Variables

-
- - - - diff --git a/docs/toc-paramiko.packet-module.html b/docs/toc-paramiko.packet-module.html deleted file mode 100644 index d269a9a..0000000 --- a/docs/toc-paramiko.packet-module.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - packet - - - - - -

Module packet

-
-

Classes

-

Functions

-

Variables

-
- - - - diff --git a/docs/toc-paramiko.pipe-module.html b/docs/toc-paramiko.pipe-module.html deleted file mode 100644 index fc5da49..0000000 --- a/docs/toc-paramiko.pipe-module.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - pipe - - - - - -

Module pipe

-
-

Classes

-

Functions

-

Variables

-
- - - - diff --git a/docs/toc-paramiko.pkey-module.html b/docs/toc-paramiko.pkey-module.html deleted file mode 100644 index af555cb..0000000 --- a/docs/toc-paramiko.pkey-module.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - pkey - - - - - -

Module pkey

-
-

Variables

-
- - - - diff --git a/docs/toc-paramiko.primes-module.html b/docs/toc-paramiko.primes-module.html deleted file mode 100644 index ae93b5c..0000000 --- a/docs/toc-paramiko.primes-module.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - primes - - - - - -

Module primes

-
-

Classes

-

Variables

-
- - - - diff --git a/docs/toc-paramiko.resource-module.html b/docs/toc-paramiko.resource-module.html deleted file mode 100644 index 7e44df7..0000000 --- a/docs/toc-paramiko.resource-module.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - resource - - - - - -

Module resource

-
-

Variables

-
- - - - diff --git a/docs/toc-paramiko.rsakey-module.html b/docs/toc-paramiko.rsakey-module.html deleted file mode 100644 index 6f90edc..0000000 --- a/docs/toc-paramiko.rsakey-module.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - rsakey - - - - - -

Module rsakey

-
-

Variables

-
- - - - diff --git a/docs/toc-paramiko.server-module.html b/docs/toc-paramiko.server-module.html deleted file mode 100644 index 3fa9fa0..0000000 --- a/docs/toc-paramiko.server-module.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - server - - - - - -

Module server

-
-

Variables

-
- - - - diff --git a/docs/toc-paramiko.sftp-module.html b/docs/toc-paramiko.sftp-module.html deleted file mode 100644 index a6f8f10..0000000 --- a/docs/toc-paramiko.sftp-module.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - sftp - - - - - -

Module sftp

-
-

Variables

-
- - - - diff --git a/docs/toc-paramiko.sftp_attr-module.html b/docs/toc-paramiko.sftp_attr-module.html deleted file mode 100644 index ea808a9..0000000 --- a/docs/toc-paramiko.sftp_attr-module.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - sftp_attr - - - - - -

Module sftp_attr

-
-

Variables

-
- - - - diff --git a/docs/toc-paramiko.sftp_client-module.html b/docs/toc-paramiko.sftp_client-module.html deleted file mode 100644 index 5bf3a67..0000000 --- a/docs/toc-paramiko.sftp_client-module.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - sftp_client - - - - - -

Module sftp_client

-
-

Variables

-
- - - - diff --git a/docs/toc-paramiko.sftp_file-module.html b/docs/toc-paramiko.sftp_file-module.html deleted file mode 100644 index c2e2578..0000000 --- a/docs/toc-paramiko.sftp_file-module.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - sftp_file - - - - - -

Module sftp_file

-
-

Variables

-
- - - - diff --git a/docs/toc-paramiko.sftp_handle-module.html b/docs/toc-paramiko.sftp_handle-module.html deleted file mode 100644 index 2b658fe..0000000 --- a/docs/toc-paramiko.sftp_handle-module.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - sftp_handle - - - - - -

Module sftp_handle

-
-

Variables

-
- - - - diff --git a/docs/toc-paramiko.sftp_server-module.html b/docs/toc-paramiko.sftp_server-module.html deleted file mode 100644 index f4020a8..0000000 --- a/docs/toc-paramiko.sftp_server-module.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - sftp_server - - - - - -

Module sftp_server

-
-

Variables

-
- - - - diff --git a/docs/toc-paramiko.sftp_si-module.html b/docs/toc-paramiko.sftp_si-module.html deleted file mode 100644 index ef768fe..0000000 --- a/docs/toc-paramiko.sftp_si-module.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - sftp_si - - - - - -

Module sftp_si

-
-

Variables

-
- - - - diff --git a/docs/toc-paramiko.ssh_exception-module.html b/docs/toc-paramiko.ssh_exception-module.html deleted file mode 100644 index 90172f1..0000000 --- a/docs/toc-paramiko.ssh_exception-module.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - ssh_exception - - - - - -

Module ssh_exception

-
-

Classes

-

Variables

-
- - - - diff --git a/docs/toc-paramiko.transport-module.html b/docs/toc-paramiko.transport-module.html deleted file mode 100644 index f22c4ce..0000000 --- a/docs/toc-paramiko.transport-module.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - transport - - - - - -

Module transport

-
-

Classes

-

Variables

-
- - - - diff --git a/docs/toc-paramiko.util-module.html b/docs/toc-paramiko.util-module.html deleted file mode 100644 index 2d9944f..0000000 --- a/docs/toc-paramiko.util-module.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - util - - - - - -

Module util

-
-

Classes

- Counter
PFilter
enumerate

Functions

- bit_length
deflate_long
format_binary
format_binary_line
format_binary_weird
generate_key_bytes
get_logger
get_thread_id
hexify
inflate_long
load_host_keys
log_to_file
lookup_ssh_host_config
mod_inverse
parse_ssh_config
safe_string
tb_strings
unhexify

Variables

- AUTH_FAILED
AUTH_PARTIALLY_SUCCESSFUL
AUTH_SUCCESSFUL
CONNECTION_FAILED_CODE
CRITICAL
DEBUG
DISCONNECT_AUTH_CANCELLED_BY_USER
DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE
DISCONNECT_SERVICE_NOT_AVAILABLE
ERROR
INFO
MSG_CHANNEL_CLOSE
MSG_CHANNEL_DATA
MSG_CHANNEL_EOF
MSG_CHANNEL_EXTENDED_DATA
MSG_CHANNEL_FAILURE
MSG_CHANNEL_OPEN
MSG_CHANNEL_OPEN_FAILURE
MSG_CHANNEL_OPEN_SUCCESS
MSG_CHANNEL_REQUEST
MSG_CHANNEL_SUCCESS
MSG_CHANNEL_WINDOW_ADJUST
MSG_DEBUG
MSG_DISCONNECT
MSG_GLOBAL_REQUEST
MSG_IGNORE
MSG_KEXINIT
MSG_NAMES
MSG_NEWKEYS
MSG_REQUEST_FAILURE
MSG_REQUEST_SUCCESS
MSG_SERVICE_ACCEPT
MSG_SERVICE_REQUEST
MSG_UNIMPLEMENTED
MSG_USERAUTH_BANNER
MSG_USERAUTH_FAILURE
MSG_USERAUTH_INFO_REQUEST
MSG_USERAUTH_INFO_RESPONSE
MSG_USERAUTH_PK_OK
MSG_USERAUTH_REQUEST
MSG_USERAUTH_SUCCESS
OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED
OPEN_FAILED_CONNECT_FAILED
OPEN_FAILED_RESOURCE_SHORTAGE
OPEN_FAILED_UNKNOWN_CHANNEL_TYPE
OPEN_SUCCEEDED
PY22
WARNING
__package__
rng

- - - - diff --git a/docs/toc-paramiko.win_pageant-module.html b/docs/toc-paramiko.win_pageant-module.html deleted file mode 100644 index 51065be..0000000 --- a/docs/toc-paramiko.win_pageant-module.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - win_pageant - - - - - -

Module win_pageant

-
-

Classes

- PageantConnection

Functions

- can_talk_to_agent

Variables

- __package__
win32con_WM_COPYDATA

- - - - diff --git a/docs/toc.html b/docs/toc.html deleted file mode 100644 index c6a5579..0000000 --- a/docs/toc.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - Table of Contents - - - - - -

Table of Contents

-
- Everything -
-

Modules

- paramiko
paramiko.logging22
paramiko.util
paramiko.win_pageant

- - - - diff --git a/fabfile.py b/fabfile.py new file mode 100644 index 0000000..29394f9 --- /dev/null +++ b/fabfile.py @@ -0,0 +1,13 @@ +from fabric.api import task, sudo, env +from fabric.contrib.project import rsync_project + + +@task +def upload_docs(): + target = "/var/www/paramiko.org" + staging = "/tmp/paramiko_docs" + sudo("mkdir -p %s" % staging) + sudo("chown -R %s %s" % (env.user, staging)) + sudo("rm -rf %s/*" % target) + rsync_project(local_dir='docs/', remote_dir=staging, delete=True) + sudo("cp -R %s/* %s/" % (staging, target)) diff --git a/images/paramiko-banner.png b/images/paramiko-banner.png new file mode 100644 index 0000000..e69fbc6 Binary files /dev/null and b/images/paramiko-banner.png differ diff --git a/images/paramiko-banner.psd b/images/paramiko-banner.psd new file mode 100644 index 0000000..20ebbc8 Binary files /dev/null and b/images/paramiko-banner.psd differ diff --git a/images/paramiko.png b/images/paramiko.png new file mode 100644 index 0000000..c488e2e Binary files /dev/null and b/images/paramiko.png differ diff --git a/paramiko.egg-info/PKG-INFO b/paramiko.egg-info/PKG-INFO deleted file mode 100644 index 319f1c5..0000000 --- a/paramiko.egg-info/PKG-INFO +++ /dev/null @@ -1,24 +0,0 @@ -Metadata-Version: 1.0 -Name: paramiko -Version: 1.7.7.1 -Summary: SSH2 protocol library -Home-page: http://www.lag.net/paramiko/ -Author: Robey Pointer -Author-email: robeypointer@gmail.com -License: LGPL -Description: - This is a library for making SSH2 connections (client or server). - Emphasis is on using SSH2 as an alternative to SSL for making secure - connections between python scripts. All major ciphers and hash methods - are supported. SFTP client and server mode are both supported too. - - Required packages: - pyCrypto - -Platform: Posix; MacOS X; Windows -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL) -Classifier: Operating System :: OS Independent -Classifier: Topic :: Internet -Classifier: Topic :: Security :: Cryptography diff --git a/paramiko.egg-info/SOURCES.txt b/paramiko.egg-info/SOURCES.txt deleted file mode 100644 index 1e53204..0000000 --- a/paramiko.egg-info/SOURCES.txt +++ /dev/null @@ -1,252 +0,0 @@ -LICENSE -MANIFEST.in -README -setup.py -setup_helper.py -test.py -demos/demo.py -demos/demo_server.py -demos/demo_sftp.py -demos/demo_simple.py -demos/forward.py -demos/interactive.py -demos/rforward.py -demos/test_rsa.key -demos/user_rsa_key -demos/user_rsa_key.pub -docs/api-objects.txt -docs/bug-index.html -docs/class-tree.html -docs/crarr.png -docs/epydoc.css -docs/epydoc.js -docs/frames.html -docs/help.html -docs/identifier-index.html -docs/index.html -docs/module-tree.html -docs/paramiko-module.html -docs/paramiko-pysrc.html -docs/paramiko.Agent-class.html -docs/paramiko.AgentKey-class.html -docs/paramiko.AuthenticationException-class.html -docs/paramiko.AutoAddPolicy-class.html -docs/paramiko.BadAuthenticationType-class.html -docs/paramiko.BadHostKeyException-class.html -docs/paramiko.BufferedFile-class.html -docs/paramiko.Channel-class.html -docs/paramiko.ChannelException-class.html -docs/paramiko.DSSKey-class.html -docs/paramiko.HostKeys-class.html -docs/paramiko.Message-class.html -docs/paramiko.MissingHostKeyPolicy-class.html -docs/paramiko.PKey-class.html -docs/paramiko.PasswordRequiredException-class.html -docs/paramiko.RSAKey-class.html -docs/paramiko.RejectPolicy-class.html -docs/paramiko.SFTP-class.html -docs/paramiko.SFTPAttributes-class.html -docs/paramiko.SFTPClient-class.html -docs/paramiko.SFTPError-class.html -docs/paramiko.SFTPFile-class.html -docs/paramiko.SFTPHandle-class.html -docs/paramiko.SFTPServer-class.html -docs/paramiko.SFTPServerInterface-class.html -docs/paramiko.SSHClient-class.html -docs/paramiko.SSHConfig-class.html -docs/paramiko.SSHException-class.html -docs/paramiko.SecurityOptions-class.html -docs/paramiko.ServerInterface-class.html -docs/paramiko.SubsystemHandler-class.html -docs/paramiko.Transport-class.html -docs/paramiko.WarningPolicy-class.html -docs/paramiko.agent-module.html -docs/paramiko.agent-pysrc.html -docs/paramiko.auth_handler-module.html -docs/paramiko.auth_handler-pysrc.html -docs/paramiko.ber-module.html -docs/paramiko.ber-pysrc.html -docs/paramiko.ber.BER-class.html -docs/paramiko.ber.BERException-class.html -docs/paramiko.buffered_pipe-module.html -docs/paramiko.buffered_pipe-pysrc.html -docs/paramiko.buffered_pipe.BufferedPipe-class.html -docs/paramiko.buffered_pipe.PipeTimeout-class.html -docs/paramiko.channel-module.html -docs/paramiko.channel-pysrc.html -docs/paramiko.channel.ChannelStderrFile-class.html -docs/paramiko.client-module.html -docs/paramiko.client-pysrc.html -docs/paramiko.common-module.html -docs/paramiko.common-pysrc.html -docs/paramiko.compress-module.html -docs/paramiko.compress-pysrc.html -docs/paramiko.compress.ZlibCompressor-class.html -docs/paramiko.compress.ZlibDecompressor-class.html -docs/paramiko.config-module.html -docs/paramiko.config-pysrc.html -docs/paramiko.dsskey-module.html -docs/paramiko.dsskey-pysrc.html -docs/paramiko.file-module.html -docs/paramiko.file-pysrc.html -docs/paramiko.hostkeys-module.html -docs/paramiko.hostkeys-pysrc.html -docs/paramiko.hostkeys.HostKeyEntry-class.html -docs/paramiko.kex_gex-module.html -docs/paramiko.kex_gex-pysrc.html -docs/paramiko.kex_gex.KexGex-class.html -docs/paramiko.kex_group1-module.html -docs/paramiko.kex_group1-pysrc.html -docs/paramiko.kex_group1.KexGroup1-class.html -docs/paramiko.logging22-module.html -docs/paramiko.logging22-pysrc.html -docs/paramiko.logging22.Formatter-class.html -docs/paramiko.logging22.StreamHandler-class.html -docs/paramiko.logging22.logger-class.html -docs/paramiko.message-module.html -docs/paramiko.message-pysrc.html -docs/paramiko.packet-module.html -docs/paramiko.packet-pysrc.html -docs/paramiko.packet.NeedRekeyException-class.html -docs/paramiko.pipe-module.html -docs/paramiko.pipe-pysrc.html -docs/paramiko.pipe.OrPipe-class.html -docs/paramiko.pipe.PosixPipe-class.html -docs/paramiko.pipe.WindowsPipe-class.html -docs/paramiko.pkey-module.html -docs/paramiko.pkey-pysrc.html -docs/paramiko.primes-module.html -docs/paramiko.primes-pysrc.html -docs/paramiko.primes.ModulusPack-class.html -docs/paramiko.resource-module.html -docs/paramiko.resource-pysrc.html -docs/paramiko.rsakey-module.html -docs/paramiko.rsakey-pysrc.html -docs/paramiko.server-module.html -docs/paramiko.server-pysrc.html -docs/paramiko.sftp-module.html -docs/paramiko.sftp-pysrc.html -docs/paramiko.sftp_attr-module.html -docs/paramiko.sftp_attr-pysrc.html -docs/paramiko.sftp_client-module.html -docs/paramiko.sftp_client-pysrc.html -docs/paramiko.sftp_file-module.html -docs/paramiko.sftp_file-pysrc.html -docs/paramiko.sftp_handle-module.html -docs/paramiko.sftp_handle-pysrc.html -docs/paramiko.sftp_server-module.html -docs/paramiko.sftp_server-pysrc.html -docs/paramiko.sftp_si-module.html -docs/paramiko.sftp_si-pysrc.html -docs/paramiko.ssh_exception-module.html -docs/paramiko.ssh_exception-pysrc.html -docs/paramiko.ssh_exception.PartialAuthentication-class.html -docs/paramiko.transport-module.html -docs/paramiko.transport-pysrc.html -docs/paramiko.transport.ChannelMap-class.html -docs/paramiko.util-module.html -docs/paramiko.util-pysrc.html -docs/paramiko.util.Counter-class.html -docs/paramiko.util.PFilter-class.html -docs/paramiko.util.enumerate-class.html -docs/paramiko.win_pageant-module.html -docs/paramiko.win_pageant-pysrc.html -docs/paramiko.win_pageant.PageantConnection-class.html -docs/redirect.html -docs/since-index.html -docs/toc-everything.html -docs/toc-paramiko-module.html -docs/toc-paramiko.agent-module.html -docs/toc-paramiko.auth_handler-module.html -docs/toc-paramiko.ber-module.html -docs/toc-paramiko.buffered_pipe-module.html -docs/toc-paramiko.channel-module.html -docs/toc-paramiko.client-module.html -docs/toc-paramiko.common-module.html -docs/toc-paramiko.compress-module.html -docs/toc-paramiko.config-module.html -docs/toc-paramiko.dsskey-module.html -docs/toc-paramiko.file-module.html -docs/toc-paramiko.hostkeys-module.html -docs/toc-paramiko.kex_gex-module.html -docs/toc-paramiko.kex_group1-module.html -docs/toc-paramiko.logging22-module.html -docs/toc-paramiko.message-module.html -docs/toc-paramiko.packet-module.html -docs/toc-paramiko.pipe-module.html -docs/toc-paramiko.pkey-module.html -docs/toc-paramiko.primes-module.html -docs/toc-paramiko.resource-module.html -docs/toc-paramiko.rsakey-module.html -docs/toc-paramiko.server-module.html -docs/toc-paramiko.sftp-module.html -docs/toc-paramiko.sftp_attr-module.html -docs/toc-paramiko.sftp_client-module.html -docs/toc-paramiko.sftp_file-module.html -docs/toc-paramiko.sftp_handle-module.html -docs/toc-paramiko.sftp_server-module.html -docs/toc-paramiko.sftp_si-module.html -docs/toc-paramiko.ssh_exception-module.html -docs/toc-paramiko.transport-module.html -docs/toc-paramiko.util-module.html -docs/toc-paramiko.win_pageant-module.html -docs/toc.html -paramiko/__init__.py -paramiko/agent.py -paramiko/auth_handler.py -paramiko/ber.py -paramiko/buffered_pipe.py -paramiko/channel.py -paramiko/client.py -paramiko/common.py -paramiko/compress.py -paramiko/config.py -paramiko/dsskey.py -paramiko/file.py -paramiko/hostkeys.py -paramiko/kex_gex.py -paramiko/kex_group1.py -paramiko/logging22.py -paramiko/message.py -paramiko/packet.py -paramiko/pipe.py -paramiko/pkey.py -paramiko/primes.py -paramiko/resource.py -paramiko/rsakey.py -paramiko/server.py -paramiko/sftp.py -paramiko/sftp_attr.py -paramiko/sftp_client.py -paramiko/sftp_file.py -paramiko/sftp_handle.py -paramiko/sftp_server.py -paramiko/sftp_si.py -paramiko/ssh_exception.py -paramiko/transport.py -paramiko/util.py -paramiko/win_pageant.py -paramiko.egg-info/PKG-INFO -paramiko.egg-info/SOURCES.txt -paramiko.egg-info/dependency_links.txt -paramiko.egg-info/requires.txt -paramiko.egg-info/top_level.txt -tests/loop.py -tests/stub_sftp.py -tests/test_auth.py -tests/test_buffered_pipe.py -tests/test_client.py -tests/test_dss.key -tests/test_dss_password.key -tests/test_file.py -tests/test_hostkeys.py -tests/test_kex.py -tests/test_message.py -tests/test_packetizer.py -tests/test_pkey.py -tests/test_rsa.key -tests/test_rsa_password.key -tests/test_sftp.py -tests/test_sftp_big.py -tests/test_transport.py -tests/test_util.py \ No newline at end of file diff --git a/paramiko.egg-info/dependency_links.txt b/paramiko.egg-info/dependency_links.txt deleted file mode 100644 index 8b13789..0000000 --- a/paramiko.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/paramiko.egg-info/requires.txt b/paramiko.egg-info/requires.txt deleted file mode 100644 index e3bdf04..0000000 --- a/paramiko.egg-info/requires.txt +++ /dev/null @@ -1 +0,0 @@ -pycrypto >= 2.1 \ No newline at end of file diff --git a/paramiko.egg-info/top_level.txt b/paramiko.egg-info/top_level.txt deleted file mode 100644 index 8608c1b..0000000 --- a/paramiko.egg-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -paramiko diff --git a/paramiko/__init__.py b/paramiko/__init__.py index 96b5943..099314e 100644 --- a/paramiko/__init__.py +++ b/paramiko/__init__.py @@ -18,7 +18,7 @@ """ I{Paramiko} (a combination of the esperanto words for "paranoid" and "friend") -is a module for python 2.3 or greater that implements the SSH2 protocol for +is a module for python 2.5 or greater that implements the SSH2 protocol for secure (encrypted and authenticated) connections to remote machines. Unlike SSL (aka TLS), the SSH2 protocol does not require hierarchical certificates signed by a powerful central authority. You may know SSH2 as the protocol that @@ -45,24 +45,17 @@ receive data over the encrypted session. Paramiko is written entirely in python (no C or platform-dependent code) and is released under the GNU Lesser General Public License (LGPL). -Website: U{http://www.lag.net/paramiko/} - -@version: 1.7.7.1 (George) -@author: Robey Pointer -@contact: robeypointer@gmail.com -@license: GNU Lesser General Public License (LGPL) +Website: U{https://github.com/paramiko/paramiko/} """ import sys -if sys.version_info < (2, 2): - raise RuntimeError('You need python 2.2 for this module.') +if sys.version_info < (2, 5): + raise RuntimeError('You need python 2.5+ for this module.') -__author__ = "Robey Pointer " -__date__ = "21 May 2011" -__version__ = "1.7.7.1 (George)" -__version_info__ = (1, 7, 7, 1) +__author__ = "Jeff Forcier " +__version__ = "1.10.1" __license__ = "GNU Lesser General Public License (LGPL)" @@ -72,7 +65,7 @@ from auth_handler import AuthHandler from channel import Channel, ChannelFile from ssh_exception import SSHException, PasswordRequiredException, \ BadAuthenticationType, ChannelException, BadHostKeyException, \ - AuthenticationException + AuthenticationException, ProxyCommandFailure from server import ServerInterface, SubsystemHandler, InteractiveQuery from rsakey import RSAKey from dsskey import DSSKey @@ -90,6 +83,7 @@ from agent import Agent, AgentKey from pkey import PKey from hostkeys import HostKeys from config import SSHConfig +from proxy import ProxyCommand # fix module names for epydoc for c in locals().values(): @@ -105,6 +99,8 @@ from common import AUTH_SUCCESSFUL, AUTH_PARTIALLY_SUCCESSFUL, AUTH_FAILED, \ from sftp import SFTP_OK, SFTP_EOF, SFTP_NO_SUCH_FILE, SFTP_PERMISSION_DENIED, SFTP_FAILURE, \ SFTP_BAD_MESSAGE, SFTP_NO_CONNECTION, SFTP_CONNECTION_LOST, SFTP_OP_UNSUPPORTED +from common import io_sleep + __all__ = [ 'Transport', 'SSHClient', 'MissingHostKeyPolicy', @@ -124,6 +120,8 @@ __all__ = [ 'Transport', 'BadAuthenticationType', 'ChannelException', 'BadHostKeyException', + 'ProxyCommand', + 'ProxyCommandFailure', 'SFTP', 'SFTPFile', 'SFTPHandle', @@ -138,4 +136,5 @@ __all__ = [ 'Transport', 'AgentKey', 'HostKeys', 'SSHConfig', - 'util' ] + 'util', + 'io_sleep' ] diff --git a/paramiko/agent.py b/paramiko/agent.py index 3bb9426..1dd3063 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -24,39 +24,308 @@ import os import socket import struct import sys +import threading +import time +import tempfile +import stat +from select import select from paramiko.ssh_exception import SSHException from paramiko.message import Message from paramiko.pkey import PKey - +from paramiko.channel import Channel +from paramiko.common import io_sleep +from paramiko.util import retry_on_signal SSH2_AGENTC_REQUEST_IDENTITIES, SSH2_AGENT_IDENTITIES_ANSWER, \ SSH2_AGENTC_SIGN_REQUEST, SSH2_AGENT_SIGN_RESPONSE = range(11, 15) +class AgentSSH(object): + """ + Client interface for using private keys from an SSH agent running on the + local machine. If an SSH agent is running, this class can be used to + connect to it and retreive L{PKey} objects which can be used when + attempting to authenticate to remote SSH servers. + + Because the SSH agent protocol uses environment variables and unix-domain + sockets, this probably doesn't work on Windows. It does work on most + posix platforms though (Linux and MacOS X, for example). + """ + def __init__(self): + self._conn = None + self._keys = () + + def get_keys(self): + """ + Return the list of keys available through the SSH agent, if any. If + no SSH agent was running (or it couldn't be contacted), an empty list + will be returned. + + @return: a list of keys available on the SSH agent + @rtype: tuple of L{AgentKey} + """ + return self._keys + + def _connect(self, conn): + self._conn = conn + ptype, result = self._send_message(chr(SSH2_AGENTC_REQUEST_IDENTITIES)) + if ptype != SSH2_AGENT_IDENTITIES_ANSWER: + raise SSHException('could not get keys from ssh-agent') + keys = [] + for i in range(result.get_int()): + keys.append(AgentKey(self, result.get_string())) + result.get_string() + self._keys = tuple(keys) + + def _close(self): + #self._conn.close() + self._conn = None + self._keys = () + + def _send_message(self, msg): + msg = str(msg) + self._conn.send(struct.pack('>I', len(msg)) + msg) + l = self._read_all(4) + msg = Message(self._read_all(struct.unpack('>I', l)[0])) + return ord(msg.get_byte()), msg + + def _read_all(self, wanted): + result = self._conn.recv(wanted) + while len(result) < wanted: + if len(result) == 0: + raise SSHException('lost ssh-agent') + extra = self._conn.recv(wanted - len(result)) + if len(extra) == 0: + raise SSHException('lost ssh-agent') + result += extra + return result + +class AgentProxyThread(threading.Thread): + """ Class in charge of communication between two chan """ + def __init__(self, agent): + threading.Thread.__init__(self, target=self.run) + self._agent = agent + self._exit = False + + def run(self): + try: + (r,addr) = self.get_connection() + self.__inr = r + self.__addr = addr + self._agent.connect() + self._communicate() + except: + #XXX Not sure what to do here ... raise or pass ? + raise + + def _communicate(self): + import fcntl + oldflags = fcntl.fcntl(self.__inr, fcntl.F_GETFL) + fcntl.fcntl(self.__inr, fcntl.F_SETFL, oldflags | os.O_NONBLOCK) + while not self._exit: + events = select([self._agent._conn, self.__inr], [], [], 0.5) + for fd in events[0]: + if self._agent._conn == fd: + data = self._agent._conn.recv(512) + if len(data) != 0: + self.__inr.send(data) + else: + self._close() + break + elif self.__inr == fd: + data = self.__inr.recv(512) + if len(data) != 0: + self._agent._conn.send(data) + else: + self._close() + break + time.sleep(io_sleep) + + def _close(self): + self._exit = True + self.__inr.close() + self._agent._conn.close() + +class AgentLocalProxy(AgentProxyThread): + """ + Class to be used when wanting to ask a local SSH Agent being + asked from a remote fake agent (so use a unix socket for ex.) + """ + def __init__(self, agent): + AgentProxyThread.__init__(self, agent) + + def get_connection(self): + """ Return a pair of socket object and string address + May Block ! + """ + conn = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + try: + conn.bind(self._agent._get_filename()) + conn.listen(1) + (r,addr) = conn.accept() + return (r, addr) + except: + raise + return None -class Agent: +class AgentRemoteProxy(AgentProxyThread): + """ + Class to be used when wanting to ask a remote SSH Agent + """ + def __init__(self, agent, chan): + AgentProxyThread.__init__(self, agent) + self.__chan = chan + + def get_connection(self): + """ + Class to be used when wanting to ask a local SSH Agent being + asked from a remote fake agent (so use a unix socket for ex.) + """ + return (self.__chan, None) + +class AgentClientProxy(object): + """ + Class proxying request as a client: + -> client ask for a request_forward_agent() + -> server creates a proxy and a fake SSH Agent + -> server ask for establishing a connection when needed, + calling the forward_agent_handler at client side. + -> the forward_agent_handler launch a thread for connecting + the remote fake agent and the local agent + -> Communication occurs ... + """ + def __init__(self, chanRemote): + self._conn = None + self.__chanR = chanRemote + self.thread = AgentRemoteProxy(self, chanRemote) + self.thread.start() + + def __del__(self): + self.close() + + def connect(self): + """ + Method automatically called by the run() method of the AgentProxyThread + """ + if ('SSH_AUTH_SOCK' in os.environ) and (sys.platform != 'win32'): + conn = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + try: + retry_on_signal(lambda: conn.connect(os.environ['SSH_AUTH_SOCK'])) + except: + # probably a dangling env var: the ssh agent is gone + return + elif sys.platform == 'win32': + import win_pageant + if win_pageant.can_talk_to_agent(): + conn = win_pageant.PageantConnection() + else: + return + else: + # no agent support + return + self._conn = conn + + def close(self): + """ + Close the current connection and terminate the agent + Should be called manually + """ + if hasattr(self, "thread"): + self.thread._exit = True + self.thread.join(1000) + if self._conn is not None: + self._conn.close() + +class AgentServerProxy(AgentSSH): + """ + @param t : transport used for the Forward for SSH Agent communication + + @raise SSHException: mostly if we lost the agent + """ + def __init__(self, t): + AgentSSH.__init__(self) + self.__t = t + self._dir = tempfile.mkdtemp('sshproxy') + os.chmod(self._dir, stat.S_IRWXU) + self._file = self._dir + '/sshproxy.ssh' + self.thread = AgentLocalProxy(self) + self.thread.start() + + def __del__(self): + self.close() + + def connect(self): + conn_sock = self.__t.open_forward_agent_channel() + if conn_sock is None: + raise SSHException('lost ssh-agent') + conn_sock.set_name('auth-agent') + self._connect(conn_sock) + + def close(self): + """ + Terminate the agent, clean the files, close connections + Should be called manually + """ + os.remove(self._file) + os.rmdir(self._dir) + self.thread._exit = True + self.thread.join(1000) + self._close() + + def get_env(self): + """ + Helper for the environnement under unix + + @return: the SSH_AUTH_SOCK Environnement variables + @rtype: dict + """ + env = {} + env['SSH_AUTH_SOCK'] = self._get_filename() + return env + + def _get_filename(self): + return self._file + +class AgentRequestHandler(object): + def __init__(self, chanClient): + self._conn = None + self.__chanC = chanClient + chanClient.request_forward_agent(self._forward_agent_handler) + self.__clientProxys = [] + + def _forward_agent_handler(self, chanRemote): + self.__clientProxys.append(AgentClientProxy(chanRemote)) + + def __del__(self): + self.close() + + def close(self): + for p in self.__clientProxys: + p.close() + +class Agent(AgentSSH): """ Client interface for using private keys from an SSH agent running on the local machine. If an SSH agent is running, this class can be used to connect to it and retreive L{PKey} objects which can be used when attempting to authenticate to remote SSH servers. - + Because the SSH agent protocol uses environment variables and unix-domain sockets, this probably doesn't work on Windows. It does work on most posix platforms though (Linux and MacOS X, for example). """ - + def __init__(self): """ Open a session with the local machine's SSH agent, if one is running. If no agent is running, initialization will succeed, but L{get_keys} will return an empty tuple. - + @raise SSHException: if an SSH agent is found, but speaks an incompatible protocol """ - self.conn = None - self.keys = () + AgentSSH.__init__(self) + if ('SSH_AUTH_SOCK' in os.environ) and (sys.platform != 'win32'): conn = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) try: @@ -64,64 +333,22 @@ class Agent: except: # probably a dangling env var: the ssh agent is gone return - self.conn = conn elif sys.platform == 'win32': import win_pageant if win_pageant.can_talk_to_agent(): - self.conn = win_pageant.PageantConnection() + conn = win_pageant.PageantConnection() else: return else: # no agent support return - - ptype, result = self._send_message(chr(SSH2_AGENTC_REQUEST_IDENTITIES)) - if ptype != SSH2_AGENT_IDENTITIES_ANSWER: - raise SSHException('could not get keys from ssh-agent') - keys = [] - for i in range(result.get_int()): - keys.append(AgentKey(self, result.get_string())) - result.get_string() - self.keys = tuple(keys) + self._connect(conn) def close(self): """ Close the SSH agent connection. """ - if self.conn is not None: - self.conn.close() - self.conn = None - self.keys = () - - def get_keys(self): - """ - Return the list of keys available through the SSH agent, if any. If - no SSH agent was running (or it couldn't be contacted), an empty list - will be returned. - - @return: a list of keys available on the SSH agent - @rtype: tuple of L{AgentKey} - """ - return self.keys - - def _send_message(self, msg): - msg = str(msg) - self.conn.send(struct.pack('>I', len(msg)) + msg) - l = self._read_all(4) - msg = Message(self._read_all(struct.unpack('>I', l)[0])) - return ord(msg.get_byte()), msg - - def _read_all(self, wanted): - result = self.conn.recv(wanted) - while len(result) < wanted: - if len(result) == 0: - raise SSHException('lost ssh-agent') - extra = self.conn.recv(wanted - len(result)) - if len(extra) == 0: - raise SSHException('lost ssh-agent') - result += extra - return result - + self._close() class AgentKey(PKey): """ @@ -129,7 +356,7 @@ class AgentKey(PKey): authenticating to a remote server (signing). Most other key operations work as expected. """ - + def __init__(self, agent, blob): self.agent = agent self.blob = blob diff --git a/paramiko/channel.py b/paramiko/channel.py index 6d895fe..0c603c6 100644 --- a/paramiko/channel.py +++ b/paramiko/channel.py @@ -122,7 +122,8 @@ class Channel (object): out += '>' return out - def get_pty(self, term='vt100', width=80, height=24): + def get_pty(self, term='vt100', width=80, height=24, width_pixels=0, + height_pixels=0): """ Request a pseudo-terminal from the server. This is usually used right after creating a client channel, to ask the server to provide some @@ -136,6 +137,10 @@ class Channel (object): @type width: int @param height: height (in characters) of the terminal screen @type height: int + @param width_pixels: width (in pixels) of the terminal screen + @type width_pixels: int + @param height_pixels: height (in pixels) of the terminal screen + @type height_pixels: int @raise SSHException: if the request was rejected or the channel was closed @@ -150,8 +155,8 @@ class Channel (object): m.add_string(term) m.add_int(width) m.add_int(height) - # pixel height, width (usually useless) - m.add_int(0).add_int(0) + m.add_int(width_pixels) + m.add_int(height_pixels) m.add_string('') self._event_pending() self.transport._send_user_message(m) @@ -239,7 +244,7 @@ class Channel (object): self.transport._send_user_message(m) self._wait_for_event() - def resize_pty(self, width=80, height=24): + def resize_pty(self, width=80, height=24, width_pixels=0, height_pixels=0): """ Resize the pseudo-terminal. This can be used to change the width and height of the terminal emulation created in a previous L{get_pty} call. @@ -248,6 +253,10 @@ class Channel (object): @type width: int @param height: new height (in characters) of the terminal screen @type height: int + @param width_pixels: new width (in pixels) of the terminal screen + @type width_pixels: int + @param height_pixels: new height (in pixels) of the terminal screen + @type height_pixels: int @raise SSHException: if the request was rejected or the channel was closed @@ -258,13 +267,12 @@ class Channel (object): m.add_byte(chr(MSG_CHANNEL_REQUEST)) m.add_int(self.remote_chanid) m.add_string('window-change') - m.add_boolean(True) + m.add_boolean(False) m.add_int(width) m.add_int(height) - m.add_int(0).add_int(0) - self._event_pending() + m.add_int(width_pixels) + m.add_int(height_pixels) self.transport._send_user_message(m) - self._wait_for_event() def exit_status_ready(self): """ @@ -381,6 +389,31 @@ class Channel (object): self.transport._set_x11_handler(handler) return auth_cookie + def request_forward_agent(self, handler): + """ + Request for a forward SSH Agent on this channel. + This is only valid for an ssh-agent from openssh !!! + + @param handler: a required handler to use for incoming SSH Agent connections + @type handler: function + + @return: if we are ok or not (at that time we always return ok) + @rtype: boolean + + @raise: SSHException in case of channel problem. + """ + if self.closed or self.eof_received or self.eof_sent or not self.active: + raise SSHException('Channel is not open') + + m = Message() + m.add_byte(chr(MSG_CHANNEL_REQUEST)) + m.add_int(self.remote_chanid) + m.add_string('auth-agent-req@openssh.com') + m.add_boolean(False) + self.transport._send_user_message(m) + self.transport._set_forward_agent_handler(handler) + return True + def get_transport(self): """ Return the L{Transport} associated with this channel. @@ -1026,6 +1059,11 @@ class Channel (object): else: ok = server.check_channel_x11_request(self, single_connection, auth_proto, auth_cookie, screen_number) + elif key == 'auth-agent-req@openssh.com': + if server is None: + ok = False + else: + ok = server.check_channel_forward_agent_request(self) else: self._log(DEBUG, 'Unhandled channel request "%s"' % key) ok = False diff --git a/paramiko/client.py b/paramiko/client.py index 4a65477..5b71958 100644 --- a/paramiko/client.py +++ b/paramiko/client.py @@ -28,16 +28,16 @@ import warnings from paramiko.agent import Agent from paramiko.common import * +from paramiko.config import SSH_PORT from paramiko.dsskey import DSSKey from paramiko.hostkeys import HostKeys from paramiko.resource import ResourceManager from paramiko.rsakey import RSAKey from paramiko.ssh_exception import SSHException, BadHostKeyException from paramiko.transport import Transport +from paramiko.util import retry_on_signal -SSH_PORT = 22 - class MissingHostKeyPolicy (object): """ Interface for defining the policy that L{SSHClient} should use when the @@ -82,7 +82,7 @@ class RejectPolicy (MissingHostKeyPolicy): def missing_host_key(self, client, hostname, key): client._log(DEBUG, 'Rejecting %s host key for %s: %s' % (key.get_name(), hostname, hexlify(key.get_fingerprint()))) - raise SSHException('Unknown server %s' % hostname) + raise SSHException('Server %r not found in known_hosts' % hostname) class WarningPolicy (MissingHostKeyPolicy): @@ -228,7 +228,7 @@ class SSHClient (object): def connect(self, hostname, port=SSH_PORT, username=None, password=None, pkey=None, key_filename=None, timeout=None, allow_agent=True, look_for_keys=True, - compress=False): + compress=False, sock=None): """ Connect to an SSH server and authenticate to it. The server's host key is checked against the system host keys (see L{load_system_host_keys}) @@ -271,6 +271,9 @@ class SSHClient (object): @type look_for_keys: bool @param compress: set to True to turn on compression @type compress: bool + @param sock: an open socket or socket-like object (such as a + L{Channel}) to use for communication to the target host + @type sock: socket @raise BadHostKeyException: if the server's host key could not be verified @@ -279,21 +282,23 @@ class SSHClient (object): establishing an SSH session @raise socket.error: if a socket error occurred while connecting """ - for (family, socktype, proto, canonname, sockaddr) in socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM): - if socktype == socket.SOCK_STREAM: - af = family - addr = sockaddr - break - else: - # some OS like AIX don't indicate SOCK_STREAM support, so just guess. :( - af, _, _, _, addr = socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM) - sock = socket.socket(af, socket.SOCK_STREAM) - if timeout is not None: - try: - sock.settimeout(timeout) - except: - pass - sock.connect(addr) + if not sock: + for (family, socktype, proto, canonname, sockaddr) in socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM): + if socktype == socket.SOCK_STREAM: + af = family + addr = sockaddr + break + else: + # some OS like AIX don't indicate SOCK_STREAM support, so just guess. :( + af, _, _, _, addr = socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM) + sock = socket.socket(af, socket.SOCK_STREAM) + if timeout is not None: + try: + sock.settimeout(timeout) + except: + pass + retry_on_signal(lambda: sock.connect(addr)) + t = self._transport = Transport(sock) t.use_compression(compress=compress) if self._log_channel is not None: @@ -344,7 +349,7 @@ class SSHClient (object): self._agent.close() self._agent = None - def exec_command(self, command, bufsize=-1): + def exec_command(self, command, bufsize=-1, timeout=None, get_pty=False): """ Execute a command on the SSH server. A new L{Channel} is opened and the requested command is executed. The command's input and output @@ -355,19 +360,25 @@ class SSHClient (object): @type command: str @param bufsize: interpreted the same way as by the built-in C{file()} function in python @type bufsize: int + @param timeout: set command's channel timeout. See L{Channel.settimeout}.settimeout + @type timeout: int @return: the stdin, stdout, and stderr of the executing command @rtype: tuple(L{ChannelFile}, L{ChannelFile}, L{ChannelFile}) @raise SSHException: if the server fails to execute the command """ chan = self._transport.open_session() + if(get_pty): + chan.get_pty() + chan.settimeout(timeout) chan.exec_command(command) stdin = chan.makefile('wb', bufsize) stdout = chan.makefile('rb', bufsize) stderr = chan.makefile_stderr('rb', bufsize) return stdin, stdout, stderr - def invoke_shell(self, term='vt100', width=80, height=24): + def invoke_shell(self, term='vt100', width=80, height=24, width_pixels=0, + height_pixels=0): """ Start an interactive shell session on the SSH server. A new L{Channel} is opened and connected to a pseudo-terminal using the requested @@ -379,13 +390,17 @@ class SSHClient (object): @type width: int @param height: the height (in characters) of the terminal window @type height: int + @param width_pixels: the width (in pixels) of the terminal window + @type width_pixels: int + @param height_pixels: the height (in pixels) of the terminal window + @type height_pixels: int @return: a new channel connected to the remote shell @rtype: L{Channel} @raise SSHException: if the server fails to invoke a shell """ chan = self._transport.open_session() - chan.get_pty(term, width, height) + chan.get_pty(term, width, height, width_pixels, height_pixels) chan.invoke_shell() return chan @@ -418,68 +433,86 @@ class SSHClient (object): - Any "id_rsa" or "id_dsa" key discoverable in ~/.ssh/ (if allowed). - Plain username/password auth, if a password was given. - (The password might be needed to unlock a private key.) + (The password might be needed to unlock a private key, or for + two-factor authentication [for which it is required].) """ saved_exception = None + two_factor = False + allowed_types = [] if pkey is not None: try: self._log(DEBUG, 'Trying SSH key %s' % hexlify(pkey.get_fingerprint())) - self._transport.auth_publickey(username, pkey) - return + allowed_types = self._transport.auth_publickey(username, pkey) + two_factor = (allowed_types == ['password']) + if not two_factor: + return except SSHException, e: saved_exception = e - for key_filename in key_filenames: - for pkey_class in (RSAKey, DSSKey): - try: - key = pkey_class.from_private_key_file(key_filename, password) - self._log(DEBUG, 'Trying key %s from %s' % (hexlify(key.get_fingerprint()), key_filename)) - self._transport.auth_publickey(username, key) - return - except SSHException, e: - saved_exception = e - - if allow_agent: + if not two_factor: + for key_filename in key_filenames: + for pkey_class in (RSAKey, DSSKey): + try: + key = pkey_class.from_private_key_file(key_filename, password) + self._log(DEBUG, 'Trying key %s from %s' % (hexlify(key.get_fingerprint()), key_filename)) + self._transport.auth_publickey(username, key) + two_factor = (allowed_types == ['password']) + if not two_factor: + return + break + except SSHException, e: + saved_exception = e + + if not two_factor and allow_agent: if self._agent == None: self._agent = Agent() for key in self._agent.get_keys(): try: self._log(DEBUG, 'Trying SSH agent key %s' % hexlify(key.get_fingerprint())) - self._transport.auth_publickey(username, key) - return + # for 2-factor auth a successfully auth'd key will result in ['password'] + allowed_types = self._transport.auth_publickey(username, key) + two_factor = (allowed_types == ['password']) + if not two_factor: + return + break except SSHException, e: saved_exception = e - keyfiles = [] - rsa_key = os.path.expanduser('~/.ssh/id_rsa') - dsa_key = os.path.expanduser('~/.ssh/id_dsa') - if os.path.isfile(rsa_key): - keyfiles.append((RSAKey, rsa_key)) - if os.path.isfile(dsa_key): - keyfiles.append((DSSKey, dsa_key)) - # look in ~/ssh/ for windows users: - rsa_key = os.path.expanduser('~/ssh/id_rsa') - dsa_key = os.path.expanduser('~/ssh/id_dsa') - if os.path.isfile(rsa_key): - keyfiles.append((RSAKey, rsa_key)) - if os.path.isfile(dsa_key): - keyfiles.append((DSSKey, dsa_key)) - - if not look_for_keys: + if not two_factor: keyfiles = [] - - for pkey_class, filename in keyfiles: - try: - key = pkey_class.from_private_key_file(filename, password) - self._log(DEBUG, 'Trying discovered key %s in %s' % (hexlify(key.get_fingerprint()), filename)) - self._transport.auth_publickey(username, key) - return - except SSHException, e: - saved_exception = e - except IOError, e: - saved_exception = e + rsa_key = os.path.expanduser('~/.ssh/id_rsa') + dsa_key = os.path.expanduser('~/.ssh/id_dsa') + if os.path.isfile(rsa_key): + keyfiles.append((RSAKey, rsa_key)) + if os.path.isfile(dsa_key): + keyfiles.append((DSSKey, dsa_key)) + # look in ~/ssh/ for windows users: + rsa_key = os.path.expanduser('~/ssh/id_rsa') + dsa_key = os.path.expanduser('~/ssh/id_dsa') + if os.path.isfile(rsa_key): + keyfiles.append((RSAKey, rsa_key)) + if os.path.isfile(dsa_key): + keyfiles.append((DSSKey, dsa_key)) + + if not look_for_keys: + keyfiles = [] + + for pkey_class, filename in keyfiles: + try: + key = pkey_class.from_private_key_file(filename, password) + self._log(DEBUG, 'Trying discovered key %s in %s' % (hexlify(key.get_fingerprint()), filename)) + # for 2-factor auth a successfully auth'd key will result in ['password'] + allowed_types = self._transport.auth_publickey(username, key) + two_factor = (allowed_types == ['password']) + if not two_factor: + return + break + except SSHException, e: + saved_exception = e + except IOError, e: + saved_exception = e if password is not None: try: @@ -487,6 +520,8 @@ class SSHClient (object): return except SSHException, e: saved_exception = e + elif two_factor: + raise SSHException('Two-factor authentication requires a password') # if we got an auth-failed exception earlier, re-raise it if saved_exception is not None: diff --git a/paramiko/common.py b/paramiko/common.py index 3323f0a..25d5457 100644 --- a/paramiko/common.py +++ b/paramiko/common.py @@ -124,3 +124,6 @@ INFO = logging.INFO WARNING = logging.WARNING ERROR = logging.ERROR CRITICAL = logging.CRITICAL + +# Common IO/select/etc sleep period, in seconds +io_sleep = 0.01 diff --git a/paramiko/config.py b/paramiko/config.py index 2a2cbff..e41bae4 100644 --- a/paramiko/config.py +++ b/paramiko/config.py @@ -1,4 +1,5 @@ # Copyright (C) 2006-2007 Robey Pointer +# Copyright (C) 2012 Olle Lundberg # # This file is part of paramiko. # @@ -21,6 +22,57 @@ L{SSHConfig}. """ import fnmatch +import os +import re +import socket + +SSH_PORT = 22 +proxy_re = re.compile(r"^(proxycommand)\s*=*\s*(.*)", re.I) + + +class LazyFqdn(object): + """ + Returns the host's fqdn on request as string. + """ + + def __init__(self, config): + self.fqdn = None + self.config = config + + def __str__(self): + if self.fqdn is None: + # + # If the SSH config contains AddressFamily, use that when + # determining the local host's FQDN. Using socket.getfqdn() from + # the standard library is the most general solution, but can + # result in noticeable delays on some platforms when IPv6 is + # misconfigured or not available, as it calls getaddrinfo with no + # address family specified, so both IPv4 and IPv6 are checked. + # + + # Handle specific option + fqdn = None + address_family = self.config.get('addressfamily', 'any').lower() + if address_family != 'any': + family = socket.AF_INET if address_family == 'inet' \ + else socket.AF_INET6 + results = socket.getaddrinfo(host, + None, + family, + socket.SOCK_DGRAM, + socket.IPPROTO_IP, + socket.AI_CANONNAME) + for res in results: + af, socktype, proto, canonname, sa = res + if canonname and '.' in canonname: + fqdn = canonname + break + # Handle 'any' / unspecified + if fqdn is None: + fqdn = socket.getfqdn() + # Cache + self.fqdn = fqdn + return self.fqdn class SSHConfig (object): @@ -38,7 +90,7 @@ class SSHConfig (object): """ Create a new OpenSSH config object. """ - self._config = [ { 'host': '*' } ] + self._config = [] def parse(self, file_obj): """ @@ -47,14 +99,19 @@ class SSHConfig (object): @param file_obj: a file-like object to read the config file from @type file_obj: file """ - configs = [self._config[0]] + host = {"host": ['*'], "config": {}} for line in file_obj: line = line.rstrip('\n').lstrip() if (line == '') or (line[0] == '#'): continue if '=' in line: - key, value = line.split('=', 1) - key = key.strip().lower() + # Ensure ProxyCommand gets properly split + if line.lower().strip().startswith('proxycommand'): + match = proxy_re.match(line) + key, value = match.group(1).lower(), match.group(2) + else: + key, value = line.split('=', 1) + key = key.strip().lower() else: # find first whitespace, and split there i = 0 @@ -66,20 +123,20 @@ class SSHConfig (object): value = line[i:].lstrip() if key == 'host': - del configs[:] - # the value may be multiple hosts, space-delimited - for host in value.split(): - # do we have a pre-existing host config to append to? - matches = [c for c in self._config if c['host'] == host] - if len(matches) > 0: - configs.append(matches[0]) - else: - config = { 'host': host } - self._config.append(config) - configs.append(config) - else: - for config in configs: - config[key] = value + self._config.append(host) + value = value.split() + host = {key: value, 'config': {}} + #identityfile is a special case, since it is allowed to be + # specified multiple times and they should be tried in order + # of specification. + elif key == 'identityfile': + if key in host['config']: + host['config']['identityfile'].append(value) + else: + host['config']['identityfile'] = [value] + elif key not in host['config']: + host['config'].update({key: value}) + self._config.append(host) def lookup(self, hostname): """ @@ -94,17 +151,106 @@ class SSHConfig (object): will win out. The keys in the returned dict are all normalized to lowercase (look for - C{"port"}, not C{"Port"}. No other processing is done to the keys or - values. + C{"port"}, not C{"Port"}. The values are processed according to the + rules for substitution variable expansion in C{ssh_config}. @param hostname: the hostname to lookup @type hostname: str """ - matches = [x for x in self._config if fnmatch.fnmatch(hostname, x['host'])] - # sort in order of shortest match (usually '*') to longest - matches.sort(lambda x,y: cmp(len(x['host']), len(y['host']))) + + matches = [config for config in self._config if + self._allowed(hostname, config['host'])] + ret = {} - for m in matches: - ret.update(m) - del ret['host'] + for match in matches: + for key, value in match['config'].iteritems(): + if key not in ret: + # Create a copy of the original value, + # else it will reference the original list + # in self._config and update that value too + # when the extend() is being called. + ret[key] = value[:] + elif key == 'identityfile': + ret[key].extend(value) + ret = self._expand_variables(ret, hostname) return ret + + def _allowed(self, hostname, hosts): + match = False + for host in hosts: + if host.startswith('!') and fnmatch.fnmatch(hostname, host[1:]): + return False + elif fnmatch.fnmatch(hostname, host): + match = True + return match + + def _expand_variables(self, config, hostname): + """ + Return a dict of config options with expanded substitutions + for a given hostname. + + Please refer to man C{ssh_config} for the parameters that + are replaced. + + @param config: the config for the hostname + @type hostname: dict + @param hostname: the hostname that the config belongs to + @type hostname: str + """ + + if 'hostname' in config: + config['hostname'] = config['hostname'].replace('%h', hostname) + else: + config['hostname'] = hostname + + if 'port' in config: + port = config['port'] + else: + port = SSH_PORT + + user = os.getenv('USER') + if 'user' in config: + remoteuser = config['user'] + else: + remoteuser = user + + host = socket.gethostname().split('.')[0] + fqdn = LazyFqdn(config) + homedir = os.path.expanduser('~') + replacements = {'controlpath': + [ + ('%h', config['hostname']), + ('%l', fqdn), + ('%L', host), + ('%n', hostname), + ('%p', port), + ('%r', remoteuser), + ('%u', user) + ], + 'identityfile': + [ + ('~', homedir), + ('%d', homedir), + ('%h', config['hostname']), + ('%l', fqdn), + ('%u', user), + ('%r', remoteuser) + ], + 'proxycommand': + [ + ('%h', config['hostname']), + ('%p', port), + ('%r', remoteuser) + ] + } + + for k in config: + if k in replacements: + for find, replace in replacements[k]: + if isinstance(config[k], list): + for item in range(len(config[k])): + config[k][item] = config[k][item].\ + replace(find, str(replace)) + else: + config[k] = config[k].replace(find, str(replace)) + return config diff --git a/paramiko/file.py b/paramiko/file.py index d4aec8e..7e2904e 100644 --- a/paramiko/file.py +++ b/paramiko/file.py @@ -354,6 +354,10 @@ class BufferedFile (object): """ return self + @property + def closed(self): + return self._closed + ### overrides... diff --git a/paramiko/hostkeys.py b/paramiko/hostkeys.py index 70ccf43..e739312 100644 --- a/paramiko/hostkeys.py +++ b/paramiko/hostkeys.py @@ -21,6 +21,7 @@ L{HostKeys} """ import base64 +import binascii from Crypto.Hash import SHA, HMAC import UserDict @@ -29,6 +30,14 @@ from paramiko.dsskey import DSSKey from paramiko.rsakey import RSAKey +class InvalidHostKey(Exception): + + def __init__(self, line, exc): + self.line = line + self.exc = exc + self.args = (line, exc) + + class HostKeyEntry: """ Representation of a line in an OpenSSH-style "known hosts" file. @@ -63,12 +72,15 @@ class HostKeyEntry: # Decide what kind of key we're looking at and create an object # to hold it accordingly. - if keytype == 'ssh-rsa': - key = RSAKey(data=base64.decodestring(key)) - elif keytype == 'ssh-dss': - key = DSSKey(data=base64.decodestring(key)) - else: - return None + try: + if keytype == 'ssh-rsa': + key = RSAKey(data=base64.decodestring(key)) + elif keytype == 'ssh-dss': + key = DSSKey(data=base64.decodestring(key)) + else: + return None + except binascii.Error, e: + raise InvalidHostKey(line, e) return cls(names, key) from_line = classmethod(from_line) diff --git a/paramiko/message.py b/paramiko/message.py index 366c43c..47acc34 100644 --- a/paramiko/message.py +++ b/paramiko/message.py @@ -110,7 +110,8 @@ class Message (object): @rtype: string """ b = self.packet.read(n) - if len(b) < n: + max_pad_size = 1<<20 # Limit padding to 1 MB + if len(b) < n and n < max_pad_size: return b + '\x00' * (n - len(b)) return b diff --git a/paramiko/packet.py b/paramiko/packet.py index 391c5d5..38a6d4b 100644 --- a/paramiko/packet.py +++ b/paramiko/packet.py @@ -29,7 +29,7 @@ import time from paramiko.common import * from paramiko import util -from paramiko.ssh_exception import SSHException +from paramiko.ssh_exception import SSHException, ProxyCommandFailure from paramiko.message import Message @@ -57,8 +57,11 @@ class Packetizer (object): # READ the secsh RFC's before raising these values. if anything, # they should probably be lower. - REKEY_PACKETS = pow(2, 30) - REKEY_BYTES = pow(2, 30) + REKEY_PACKETS = pow(2, 29) + REKEY_BYTES = pow(2, 29) + + REKEY_PACKETS_OVERFLOW_MAX = pow(2,29) # Allow receiving this many packets after a re-key request before terminating + REKEY_BYTES_OVERFLOW_MAX = pow(2,29) # Allow receiving this many bytes after a re-key request before terminating def __init__(self, socket): self.__socket = socket @@ -74,6 +77,7 @@ class Packetizer (object): self.__sent_packets = 0 self.__received_bytes = 0 self.__received_packets = 0 + self.__received_bytes_overflow = 0 self.__received_packets_overflow = 0 # current inbound/outbound ciphering: @@ -83,6 +87,7 @@ class Packetizer (object): self.__mac_size_in = 0 self.__block_engine_out = None self.__block_engine_in = None + self.__sdctr_out = False self.__mac_engine_out = None self.__mac_engine_in = None self.__mac_key_out = '' @@ -106,11 +111,12 @@ class Packetizer (object): """ self.__logger = log - def set_outbound_cipher(self, block_engine, block_size, mac_engine, mac_size, mac_key): + def set_outbound_cipher(self, block_engine, block_size, mac_engine, mac_size, mac_key, sdctr=False): """ Switch outbound data cipher. """ self.__block_engine_out = block_engine + self.__sdctr_out = sdctr self.__block_size_out = block_size self.__mac_engine_out = mac_engine self.__mac_size_out = mac_size @@ -134,6 +140,7 @@ class Packetizer (object): self.__mac_key_in = mac_key self.__received_bytes = 0 self.__received_packets = 0 + self.__received_bytes_overflow = 0 self.__received_packets_overflow = 0 # wait until the reset happens in both directions before clearing rekey flag self.__init_count |= 2 @@ -236,23 +243,25 @@ class Packetizer (object): def write_all(self, out): self.__keepalive_last = time.time() while len(out) > 0: - got_timeout = False + retry_write = False try: n = self.__socket.send(out) except socket.timeout: - got_timeout = True + retry_write = True except socket.error, e: if (type(e.args) is tuple) and (len(e.args) > 0) and (e.args[0] == errno.EAGAIN): - got_timeout = True + retry_write = True elif (type(e.args) is tuple) and (len(e.args) > 0) and (e.args[0] == errno.EINTR): # syscall interrupted; try again - pass + retry_write = True else: n = -1 + except ProxyCommandFailure: + raise # so it doesn't get swallowed by the below catchall except Exception: # could be: (32, 'Broken pipe') n = -1 - if got_timeout: + if retry_write: n = 0 if self.__closed: n = -1 @@ -316,6 +325,7 @@ class Packetizer (object): # only ask once for rekeying self._log(DEBUG, 'Rekeying (hit %d packets, %d bytes sent)' % (self.__sent_packets, self.__sent_bytes)) + self.__received_bytes_overflow = 0 self.__received_packets_overflow = 0 self._trigger_rekey() finally: @@ -368,19 +378,23 @@ class Packetizer (object): self.__sequence_number_in = (self.__sequence_number_in + 1) & 0xffffffffL # check for rekey - self.__received_bytes += packet_size + self.__mac_size_in + 4 + raw_packet_size = packet_size + self.__mac_size_in + 4 + self.__received_bytes += raw_packet_size self.__received_packets += 1 if self.__need_rekey: - # we've asked to rekey -- give them 20 packets to comply before + # we've asked to rekey -- give them some packets to comply before # dropping the connection + self.__received_bytes_overflow += raw_packet_size self.__received_packets_overflow += 1 - if self.__received_packets_overflow >= 20: + if (self.__received_packets_overflow >= self.REKEY_PACKETS_OVERFLOW_MAX) or \ + (self.__received_bytes_overflow >= self.REKEY_BYTES_OVERFLOW_MAX): raise SSHException('Remote transport is ignoring rekey requests') elif (self.__received_packets >= self.REKEY_PACKETS) or \ (self.__received_bytes >= self.REKEY_BYTES): # only ask once for rekeying self._log(DEBUG, 'Rekeying (hit %d packets, %d bytes received)' % (self.__received_packets, self.__received_bytes)) + self.__received_bytes_overflow = 0 self.__received_packets_overflow = 0 self._trigger_rekey() @@ -459,6 +473,12 @@ class Packetizer (object): break except socket.timeout: pass + except EnvironmentError, e: + if ((type(e.args) is tuple) and (len(e.args) > 0) and + (e.args[0] == errno.EINTR)): + pass + else: + raise if self.__closed: raise EOFError() now = time.time() @@ -472,12 +492,12 @@ class Packetizer (object): padding = 3 + bsize - ((len(payload) + 8) % bsize) packet = struct.pack('>IB', len(payload) + padding + 1, padding) packet += payload - if self.__block_engine_out is not None: - packet += rng.read(padding) - else: - # cute trick i caught openssh doing: if we're not encrypting, + if self.__sdctr_out or self.__block_engine_out is None: + # cute trick i caught openssh doing: if we're not encrypting or SDCTR mode (RFC4344), # don't waste random bytes for the padding packet += (chr(0) * padding) + else: + packet += rng.read(padding) return packet def _trigger_rekey(self): diff --git a/paramiko/proxy.py b/paramiko/proxy.py new file mode 100644 index 0000000..218b76e --- /dev/null +++ b/paramiko/proxy.py @@ -0,0 +1,91 @@ +# Copyright (C) 2012 Yipit, Inc +# +# This file is part of paramiko. +# +# Paramiko is free software; you can redistribute it and/or modify it under the +# terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; either version 2.1 of the License, or (at your option) +# any later version. +# +# Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +# details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with Paramiko; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +""" +L{ProxyCommand}. +""" + +import os +from shlex import split as shlsplit +import signal +from subprocess import Popen, PIPE + +from paramiko.ssh_exception import ProxyCommandFailure + + +class ProxyCommand(object): + """ + Wraps a subprocess running ProxyCommand-driven programs. + + This class implements a the socket-like interface needed by the + L{Transport} and L{Packetizer} classes. Using this class instead of a + regular socket makes it possible to talk with a Popen'd command that will + proxy traffic between the client and a server hosted in another machine. + """ + def __init__(self, command_line): + """ + Create a new CommandProxy instance. The instance created by this + class can be passed as an argument to the L{Transport} class. + + @param command_line: the command that should be executed and + used as the proxy. + @type command_line: str + """ + self.cmd = shlsplit(command_line) + self.process = Popen(self.cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) + + def send(self, content): + """ + Write the content received from the SSH client to the standard + input of the forked command. + + @param content: string to be sent to the forked command + @type content: str + """ + try: + self.process.stdin.write(content) + except IOError, e: + # There was a problem with the child process. It probably + # died and we can't proceed. The best option here is to + # raise an exception informing the user that the informed + # ProxyCommand is not working. + raise BadProxyCommand(' '.join(self.cmd), e.strerror) + return len(content) + + def recv(self, size): + """ + Read from the standard output of the forked program. + + @param size: how many chars should be read + @type size: int + + @return: the length of the read content + @rtype: int + """ + try: + return os.read(self.process.stdout.fileno(), size) + except IOError, e: + raise BadProxyCommand(' '.join(self.cmd), e.strerror) + + def close(self): + os.kill(self.process.pid, signal.SIGTERM) + + def settimeout(self, timeout): + # Timeouts are meaningless for this implementation, but are part of the + # spec, so must be present. + pass diff --git a/paramiko/server.py b/paramiko/server.py index 6424b63..dac9bf1 100644 --- a/paramiko/server.py +++ b/paramiko/server.py @@ -93,6 +93,7 @@ class ServerInterface (object): - L{check_channel_subsystem_request} - L{check_channel_window_change_request} - L{check_channel_x11_request} + - L{check_channel_forward_agent_request} The C{chanid} parameter is a small number that uniquely identifies the channel within a L{Transport}. A L{Channel} object is not created @@ -492,7 +493,22 @@ class ServerInterface (object): @rtype: bool """ return False - + + def check_channel_forward_agent_request(self, channel): + """ + Determine if the client will be provided with an forward agent session. + If this method returns C{True}, the server will allow SSH Agent + forwarding. + + The default implementation always returns C{False}. + + @param channel: the L{Channel} the request arrived on + @type channel: L{Channel} + @return: C{True} if the AgentForward was loaded; C{False} if not + @rtype: bool + """ + return False + def check_channel_direct_tcpip_request(self, chanid, origin, destination): """ Determine if a local port forwarding channel will be granted, and diff --git a/paramiko/sftp_client.py b/paramiko/sftp_client.py index 79a7761..17ea493 100644 --- a/paramiko/sftp_client.py +++ b/paramiko/sftp_client.py @@ -198,7 +198,7 @@ class SFTPClient (BaseSFTP): Open a file on the remote server. The arguments are the same as for python's built-in C{file} (aka C{open}). A file-like object is returned, which closely mimics the behavior of a normal python file - object. + object, including the ability to be used as a context manager. The mode indicates how the file is to be opened: C{'r'} for reading, C{'w'} for writing (truncating an existing file), C{'a'} for appending, @@ -533,6 +533,56 @@ class SFTPClient (BaseSFTP): """ return self._cwd + def putfo(self, fl, remotepath, file_size=0, callback=None, confirm=True): + """ + Copy the contents of an open file object (C{fl}) to the SFTP server as + C{remotepath}. Any exception raised by operations will be passed through. + + The SFTP operations use pipelining for speed. + + @param fl: opened file or file-like object to copy + @type localpath: object + @param remotepath: the destination path on the SFTP server + @type remotepath: str + @param file_size: optional size parameter passed to callback. If none is + specified, size defaults to 0 + @type file_size: int + @param callback: optional callback function that accepts the bytes + transferred so far and the total bytes to be transferred + (since 1.7.4) + @type callback: function(int, int) + @param confirm: whether to do a stat() on the file afterwards to + confirm the file size (since 1.7.7) + @type confirm: bool + + @return: an object containing attributes about the given file + (since 1.7.4) + @rtype: SFTPAttributes + + @since: 1.4 + """ + fr = self.file(remotepath, 'wb') + fr.set_pipelined(True) + size = 0 + try: + while True: + data = fl.read(32768) + fr.write(data) + size += len(data) + if callback is not None: + callback(size, file_size) + if len(data) == 0: + break + finally: + fr.close() + if confirm: + s = self.stat(remotepath) + if s.st_size != size: + raise IOError('size mismatch in put! %d != %d' % (s.st_size, size)) + else: + s = SFTPAttributes() + return s + def put(self, localpath, remotepath, callback=None, confirm=True): """ Copy a local file (C{localpath}) to the SFTP server as C{remotepath}. @@ -562,29 +612,46 @@ class SFTPClient (BaseSFTP): file_size = os.stat(localpath).st_size fl = file(localpath, 'rb') try: - fr = self.file(remotepath, 'wb') - fr.set_pipelined(True) - size = 0 - try: - while True: - data = fl.read(32768) - if len(data) == 0: - break - fr.write(data) - size += len(data) - if callback is not None: - callback(size, file_size) - finally: - fr.close() + return self.putfo(fl, remotepath, os.stat(localpath).st_size, callback, confirm) finally: fl.close() - if confirm: - s = self.stat(remotepath) - if s.st_size != size: - raise IOError('size mismatch in put! %d != %d' % (s.st_size, size)) - else: - s = SFTPAttributes() - return s + + def getfo(self, remotepath, fl, callback=None): + """ + Copy a remote file (C{remotepath}) from the SFTP server and write to + an open file or file-like object, C{fl}. Any exception raised by + operations will be passed through. This method is primarily provided + as a convenience. + + @param remotepath: opened file or file-like object to copy to + @type remotepath: object + @param fl: the destination path on the local host or open file + object + @type localpath: str + @param callback: optional callback function that accepts the bytes + transferred so far and the total bytes to be transferred + (since 1.7.4) + @type callback: function(int, int) + @return: the number of bytes written to the opened file object + + @since: 1.4 + """ + fr = self.file(remotepath, 'rb') + file_size = self.stat(remotepath).st_size + fr.prefetch() + try: + size = 0 + while True: + data = fr.read(32768) + fl.write(data) + size += len(data) + if callback is not None: + callback(size, file_size) + if len(data) == 0: + break + finally: + fr.close() + return size def get(self, remotepath, localpath, callback=None): """ @@ -603,25 +670,12 @@ class SFTPClient (BaseSFTP): @since: 1.4 """ - fr = self.file(remotepath, 'rb') file_size = self.stat(remotepath).st_size - fr.prefetch() + fl = file(localpath, 'wb') try: - fl = file(localpath, 'wb') - try: - size = 0 - while True: - data = fr.read(32768) - if len(data) == 0: - break - fl.write(data) - size += len(data) - if callback is not None: - callback(size, file_size) - finally: - fl.close() + size = self.getfo(remotepath, fl, callback) finally: - fr.close() + fl.close() s = os.stat(localpath) if s.st_size != size: raise IOError('size mismatch in get! %d != %d' % (s.st_size, size)) @@ -641,13 +695,13 @@ class SFTPClient (BaseSFTP): msg = Message() msg.add_int(self.request_number) for item in arg: - if type(item) is int: + if isinstance(item, int): msg.add_int(item) - elif type(item) is long: + elif isinstance(item, long): msg.add_int64(item) - elif type(item) is str: + elif isinstance(item, str): msg.add_string(item) - elif type(item) is SFTPAttributes: + elif isinstance(item, SFTPAttributes): item._pack(msg) else: raise Exception('unknown type for %r type %r' % (item, type(item))) diff --git a/paramiko/sftp_file.py b/paramiko/sftp_file.py index 8c5c7ac..e056d70 100644 --- a/paramiko/sftp_file.py +++ b/paramiko/sftp_file.py @@ -21,6 +21,7 @@ L{SFTPFile} """ from binascii import hexlify +from collections import deque import socket import threading import time @@ -34,6 +35,9 @@ from paramiko.sftp_attr import SFTPAttributes class SFTPFile (BufferedFile): """ Proxy object for a file on the remote server, in client mode SFTP. + + Instances of this class may be used as context managers in the same way + that built-in Python file objects are. """ # Some sftp servers will choke if you send read/write requests larger than @@ -51,6 +55,7 @@ class SFTPFile (BufferedFile): self._prefetch_data = {} self._prefetch_reads = [] self._saved_exception = None + self._reqs = deque() def __del__(self): self._close(async=True) @@ -160,12 +165,14 @@ class SFTPFile (BufferedFile): def _write(self, data): # may write less than requested if it would exceed max packet size chunk = min(len(data), self.MAX_REQUEST_SIZE) - req = self.sftp._async_request(type(None), CMD_WRITE, self.handle, long(self._realpos), str(data[:chunk])) - if not self.pipelined or self.sftp.sock.recv_ready(): - t, msg = self.sftp._read_response(req) - if t != CMD_STATUS: - raise SFTPError('Expected status') - # convert_status already called + self._reqs.append(self.sftp._async_request(type(None), CMD_WRITE, self.handle, long(self._realpos), str(data[:chunk]))) + if not self.pipelined or (len(self._reqs) > 100 and self.sftp.sock.recv_ready()): + while len(self._reqs): + req = self._reqs.popleft() + t, msg = self.sftp._read_response(req) + if t != CMD_STATUS: + raise SFTPError('Expected status') + # convert_status already called return chunk def settimeout(self, timeout): @@ -474,3 +481,9 @@ class SFTPFile (BufferedFile): x = self._saved_exception self._saved_exception = None raise x + + def __enter__(self): + return self + + def __exit__(self, type, value, traceback): + self.close() diff --git a/paramiko/ssh_exception.py b/paramiko/ssh_exception.py index 68924d0..f2406dc 100644 --- a/paramiko/ssh_exception.py +++ b/paramiko/ssh_exception.py @@ -113,3 +113,20 @@ class BadHostKeyException (SSHException): self.key = got_key self.expected_key = expected_key + +class ProxyCommandFailure (SSHException): + """ + The "ProxyCommand" found in the .ssh/config file returned an error. + + @ivar command: The command line that is generating this exception. + @type command: str + @ivar error: The error captured from the proxy command output. + @type error: str + """ + def __init__(self, command, error): + SSHException.__init__(self, + '"ProxyCommand (%s)" returned non-zero exit status: %s' % ( + command, error + ) + ) + self.error = error diff --git a/paramiko/transport.py b/paramiko/transport.py index 30de295..fd6dab7 100644 --- a/paramiko/transport.py +++ b/paramiko/transport.py @@ -29,6 +29,7 @@ import threading import time import weakref +import paramiko from paramiko import util from paramiko.auth_handler import AuthHandler from paramiko.channel import Channel @@ -43,7 +44,9 @@ from paramiko.primes import ModulusPack from paramiko.rsakey import RSAKey from paramiko.server import ServerInterface from paramiko.sftp_client import SFTPClient -from paramiko.ssh_exception import SSHException, BadAuthenticationType, ChannelException +from paramiko.ssh_exception import (SSHException, BadAuthenticationType, + ChannelException, ProxyCommandFailure) +from paramiko.util import retry_on_signal from Crypto import Random from Crypto.Cipher import Blowfish, AES, DES3, ARC4 @@ -194,7 +197,7 @@ class Transport (threading.Thread): """ _PROTO_ID = '2.0' - _CLIENT_ID = 'paramiko_1.7.7.1' + _CLIENT_ID = 'paramiko_%s' % (paramiko.__version__) _preferred_ciphers = ( 'aes128-ctr', 'aes256-ctr', 'aes128-cbc', 'blowfish-cbc', 'aes256-cbc', '3des-cbc', 'arcfour128', 'arcfour256' ) @@ -288,7 +291,7 @@ class Transport (threading.Thread): addr = sockaddr sock = socket.socket(af, socket.SOCK_STREAM) try: - sock.connect((hostname, port)) + retry_on_signal(lambda: sock.connect((hostname, port))) except socket.error, e: reason = str(e) else: @@ -341,6 +344,7 @@ class Transport (threading.Thread): self._channel_counter = 1 self.window_size = 65536 self.max_packet_size = 34816 + self._forward_agent_handler = None self._x11_handler = None self._tcp_handler = None @@ -673,6 +677,20 @@ class Transport (threading.Thread): """ return self.open_channel('x11', src_addr=src_addr) + def open_forward_agent_channel(self): + """ + Request a new channel to the client, of type + C{"auth-agent@openssh.com"}. + + This is just an alias for C{open_channel('auth-agent@openssh.com')}. + @return: a new L{Channel} + @rtype: L{Channel} + + @raise SSHException: if the request is rejected or the session ends + prematurely + """ + return self.open_channel('auth-agent@openssh.com') + def open_forwarded_tcpip_channel(self, (src_addr, src_port), (dest_addr, dest_port)): """ Request a new channel back to the client, of type C{"forwarded-tcpip"}. @@ -1481,6 +1499,14 @@ class Transport (threading.Thread): else: return self._cipher_info[name]['class'].new(key, self._cipher_info[name]['mode'], iv) + def _set_forward_agent_handler(self, handler): + if handler is None: + def default_handler(channel): + self._queue_incoming_channel(channel) + self._forward_agent_handler = default_handler + else: + self._forward_agent_handler = handler + def _set_x11_handler(self, handler): # only called if a channel has turned on x11 forwarding if handler is None: @@ -1505,6 +1531,18 @@ class Transport (threading.Thread): # indefinitely, creating a GC cycle and not letting Transport ever be # GC'd. it's a bug in Thread.) + # Hold reference to 'sys' so we can test sys.modules to detect + # interpreter shutdown. + self.sys = sys + + # Required to prevent RNG errors when running inside many subprocess + # containers. + Random.atfork() + + # Hold reference to 'sys' so we can test sys.modules to detect + # interpreter shutdown. + self.sys = sys + # active=True occurs before the thread is launched, to avoid a race _active_threads.append(self) if self.server_mode: @@ -1512,94 +1550,102 @@ class Transport (threading.Thread): else: self._log(DEBUG, 'starting thread (client mode): %s' % hex(long(id(self)) & 0xffffffffL)) try: - self.packetizer.write_all(self.local_version + '\r\n') - self._check_banner() - self._send_kex_init() - self._expect_packet(MSG_KEXINIT) - - while self.active: - if self.packetizer.need_rekey() and not self.in_kex: - self._send_kex_init() - try: - ptype, m = self.packetizer.read_message() - except NeedRekeyException: - continue - if ptype == MSG_IGNORE: - continue - elif ptype == MSG_DISCONNECT: - self._parse_disconnect(m) - self.active = False - self.packetizer.close() - break - elif ptype == MSG_DEBUG: - self._parse_debug(m) - continue - if len(self._expected_packet) > 0: - if ptype not in self._expected_packet: - raise SSHException('Expecting packet from %r, got %d' % (self._expected_packet, ptype)) - self._expected_packet = tuple() - if (ptype >= 30) and (ptype <= 39): - self.kex_engine.parse_next(ptype, m) + try: + self.packetizer.write_all(self.local_version + '\r\n') + self._check_banner() + self._send_kex_init() + self._expect_packet(MSG_KEXINIT) + + while self.active: + if self.packetizer.need_rekey() and not self.in_kex: + self._send_kex_init() + try: + ptype, m = self.packetizer.read_message() + except NeedRekeyException: continue - - if ptype in self._handler_table: - self._handler_table[ptype](self, m) - elif ptype in self._channel_handler_table: - chanid = m.get_int() - chan = self._channels.get(chanid) - if chan is not None: - self._channel_handler_table[ptype](chan, m) - elif chanid in self.channels_seen: - self._log(DEBUG, 'Ignoring message for dead channel %d' % chanid) - else: - self._log(ERROR, 'Channel request for unknown channel %d' % chanid) + if ptype == MSG_IGNORE: + continue + elif ptype == MSG_DISCONNECT: + self._parse_disconnect(m) self.active = False self.packetizer.close() - elif (self.auth_handler is not None) and (ptype in self.auth_handler._handler_table): - self.auth_handler._handler_table[ptype](self.auth_handler, m) + break + elif ptype == MSG_DEBUG: + self._parse_debug(m) + continue + if len(self._expected_packet) > 0: + if ptype not in self._expected_packet: + raise SSHException('Expecting packet from %r, got %d' % (self._expected_packet, ptype)) + self._expected_packet = tuple() + if (ptype >= 30) and (ptype <= 39): + self.kex_engine.parse_next(ptype, m) + continue + + if ptype in self._handler_table: + self._handler_table[ptype](self, m) + elif ptype in self._channel_handler_table: + chanid = m.get_int() + chan = self._channels.get(chanid) + if chan is not None: + self._channel_handler_table[ptype](chan, m) + elif chanid in self.channels_seen: + self._log(DEBUG, 'Ignoring message for dead channel %d' % chanid) + else: + self._log(ERROR, 'Channel request for unknown channel %d' % chanid) + self.active = False + self.packetizer.close() + elif (self.auth_handler is not None) and (ptype in self.auth_handler._handler_table): + self.auth_handler._handler_table[ptype](self.auth_handler, m) + else: + self._log(WARNING, 'Oops, unhandled type %d' % ptype) + msg = Message() + msg.add_byte(chr(MSG_UNIMPLEMENTED)) + msg.add_int(m.seqno) + self._send_message(msg) + except SSHException, e: + self._log(ERROR, 'Exception: ' + str(e)) + self._log(ERROR, util.tb_strings()) + self.saved_exception = e + except EOFError, e: + self._log(DEBUG, 'EOF in transport thread') + #self._log(DEBUG, util.tb_strings()) + self.saved_exception = e + except socket.error, e: + if type(e.args) is tuple: + emsg = '%s (%d)' % (e.args[1], e.args[0]) else: - self._log(WARNING, 'Oops, unhandled type %d' % ptype) - msg = Message() - msg.add_byte(chr(MSG_UNIMPLEMENTED)) - msg.add_int(m.seqno) - self._send_message(msg) - except SSHException, e: - self._log(ERROR, 'Exception: ' + str(e)) - self._log(ERROR, util.tb_strings()) - self.saved_exception = e - except EOFError, e: - self._log(DEBUG, 'EOF in transport thread') - #self._log(DEBUG, util.tb_strings()) - self.saved_exception = e - except socket.error, e: - if type(e.args) is tuple: - emsg = '%s (%d)' % (e.args[1], e.args[0]) - else: - emsg = e.args - self._log(ERROR, 'Socket exception: ' + emsg) - self.saved_exception = e - except Exception, e: - self._log(ERROR, 'Unknown exception: ' + str(e)) - self._log(ERROR, util.tb_strings()) - self.saved_exception = e - _active_threads.remove(self) - for chan in self._channels.values(): - chan._unlink() - if self.active: - self.active = False - self.packetizer.close() - if self.completion_event != None: - self.completion_event.set() - if self.auth_handler is not None: - self.auth_handler.abort() - for event in self.channel_events.values(): - event.set() - try: - self.lock.acquire() - self.server_accept_cv.notify() - finally: - self.lock.release() - self.sock.close() + emsg = e.args + self._log(ERROR, 'Socket exception: ' + emsg) + self.saved_exception = e + except Exception, e: + self._log(ERROR, 'Unknown exception: ' + str(e)) + self._log(ERROR, util.tb_strings()) + self.saved_exception = e + _active_threads.remove(self) + for chan in self._channels.values(): + chan._unlink() + if self.active: + self.active = False + self.packetizer.close() + if self.completion_event != None: + self.completion_event.set() + if self.auth_handler is not None: + self.auth_handler.abort() + for event in self.channel_events.values(): + event.set() + try: + self.lock.acquire() + self.server_accept_cv.notify() + finally: + self.lock.release() + self.sock.close() + except: + # Don't raise spurious 'NoneType has no attribute X' errors when we + # wake up during interpreter shutdown. Or rather -- raise + # everything *if* sys.modules (used as a convenient sentinel) + # appears to still exist. + if self.sys.modules is not None: + raise ### protocol stages @@ -1629,6 +1675,8 @@ class Transport (threading.Thread): timeout = 2 try: buf = self.packetizer.readline(timeout) + except ProxyCommandFailure: + raise except Exception, x: raise SSHException('Error reading SSH protocol banner' + str(x)) if buf[:4] == 'SSH-': @@ -1837,7 +1885,8 @@ class Transport (threading.Thread): mac_key = self._compute_key('F', mac_engine.digest_size) else: mac_key = self._compute_key('E', mac_engine.digest_size) - self.packetizer.set_outbound_cipher(engine, block_size, mac_engine, mac_size, mac_key) + sdctr = self.local_cipher.endswith('-ctr') + self.packetizer.set_outbound_cipher(engine, block_size, mac_engine, mac_size, mac_key, sdctr) compress_out = self._compression_info[self.local_compression][0] if (compress_out is not None) and ((self.local_compression != 'zlib@openssh.com') or self.authenticated): self._log(DEBUG, 'Switching on outbound compression ...') @@ -1980,7 +2029,14 @@ class Transport (threading.Thread): initial_window_size = m.get_int() max_packet_size = m.get_int() reject = False - if (kind == 'x11') and (self._x11_handler is not None): + if (kind == 'auth-agent@openssh.com') and (self._forward_agent_handler is not None): + self._log(DEBUG, 'Incoming forward agent connection') + self.lock.acquire() + try: + my_chanid = self._next_channel() + finally: + self.lock.release() + elif (kind == 'x11') and (self._x11_handler is not None): origin_addr = m.get_string() origin_port = m.get_int() self._log(DEBUG, 'Incoming x11 connection from %s:%d' % (origin_addr, origin_port)) @@ -2052,7 +2108,9 @@ class Transport (threading.Thread): m.add_int(self.max_packet_size) self._send_message(m) self._log(INFO, 'Secsh channel %d (%s) opened.', my_chanid, kind) - if kind == 'x11': + if kind == 'auth-agent@openssh.com': + self._forward_agent_handler(chan) + elif kind == 'x11': self._x11_handler(chan, (origin_addr, origin_port)) elif kind == 'forwarded-tcpip': chan.origin_addr = (origin_addr, origin_port) diff --git a/paramiko/util.py b/paramiko/util.py index 0d6a534..f4bfbec 100644 --- a/paramiko/util.py +++ b/paramiko/util.py @@ -24,6 +24,7 @@ from __future__ import generators import array from binascii import hexlify, unhexlify +import errno import sys import struct import traceback @@ -270,6 +271,14 @@ def get_logger(name): l.addFilter(_pfilter) return l +def retry_on_signal(function): + """Retries function until it doesn't raise an EINTR error""" + while True: + try: + return function() + except EnvironmentError, e: + if e.errno != errno.EINTR: + raise class Counter (object): """Stateful counter for CTR mode crypto""" diff --git a/paramiko/win_pageant.py b/paramiko/win_pageant.py index 787032b..d77d58f 100644 --- a/paramiko/win_pageant.py +++ b/paramiko/win_pageant.py @@ -26,6 +26,8 @@ import struct import tempfile import mmap import array +import platform +import ctypes.wintypes # if you're on windows, you should have one of these, i guess? # ctypes is part of standard library since Python 2.5 @@ -42,7 +44,6 @@ except ImportError: except ImportError: pass - _AGENT_COPYDATA_ID = 0x804e50ba _AGENT_MAX_MSGLEN = 8192 # Note: The WM_COPYDATA value is pulled from win32con, as a workaround @@ -74,6 +75,17 @@ def can_talk_to_agent(): return True return False +ULONG_PTR = ctypes.c_uint64 if platform.architecture()[0] == '64bit' else ctypes.c_uint32 +class COPYDATASTRUCT(ctypes.Structure): + """ + ctypes implementation of + http://msdn.microsoft.com/en-us/library/windows/desktop/ms649010%28v=vs.85%29.aspx + """ + _fields_ = [ + ('num_data', ULONG_PTR), + ('data_size', ctypes.wintypes.DWORD), + ('data_loc', ctypes.c_void_p), + ] def _query_pageant(msg): hwnd = _get_pageant_window_object() @@ -96,19 +108,17 @@ def _query_pageant(msg): char_buffer = array.array("c", map_filename + '\0') char_buffer_address, char_buffer_size = char_buffer.buffer_info() # Create a string to use for the SendMessage function call - cds = struct.pack("LLP", _AGENT_COPYDATA_ID, char_buffer_size, char_buffer_address) + cds = COPYDATASTRUCT(_AGENT_COPYDATA_ID, char_buffer_size, char_buffer_address) if _has_win32all: # win32gui.SendMessage should also allow the same pattern as # ctypes, but let's keep it like this for now... - response = win32gui.SendMessage(hwnd, win32con_WM_COPYDATA, len(cds), cds) + response = win32gui.SendMessage(hwnd, win32con_WM_COPYDATA, ctypes.sizeof(cds), ctypes.addressof(cds)) elif _has_ctypes: - _buf = array.array('B', cds) - _addr, _size = _buf.buffer_info() - response = ctypes.windll.user32.SendMessageA(hwnd, win32con_WM_COPYDATA, _size, _addr) + response = ctypes.windll.user32.SendMessageA(hwnd, win32con_WM_COPYDATA, ctypes.sizeof(cds), ctypes.byref(cds)) else: response = 0 - + if response > 0: datalen = pymap.read(4) retlen = struct.unpack('>I', datalen)[0] @@ -131,10 +141,10 @@ class PageantConnection (object): def __init__(self): self._response = None - + def send(self, data): self._response = _query_pageant(data) - + def recv(self, n): if self._response is None: return '' diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..75112a2 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +pycrypto +tox diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 861a9f5..0000000 --- a/setup.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[egg_info] -tag_build = -tag_date = 0 -tag_svn_revision = 0 - diff --git a/setup.py b/setup.py index 4537a8a..d6caccf 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ # # You should have received a copy of the GNU Lesser General Public License # along with Paramiko; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA. longdesc = ''' @@ -25,6 +25,10 @@ are supported. SFTP client and server mode are both supported too. Required packages: pyCrypto + +To install the `in-development version +`_, use +`pip install paramiko==dev`. ''' # if someday we want to *require* setuptools, uncomment this: @@ -36,23 +40,23 @@ import sys try: from setuptools import setup kw = { - 'install_requires': 'pycrypto >= 2.1', + 'install_requires': 'pycrypto >= 2.1, != 2.4', } except ImportError: from distutils.core import setup kw = {} if sys.platform == 'darwin': - import setup_helper - setup_helper.install_custom_make_tarball() + import setup_helper + setup_helper.install_custom_make_tarball() setup(name = "paramiko", - version = "1.7.7.1", + version = "1.10.1", description = "SSH2 protocol library", - author = "Robey Pointer", - author_email = "robeypointer@gmail.com", - url = "http://www.lag.net/paramiko/", + author = "Jeff Forcier", + author_email = "jeff@bitprophet.org", + url = "https://github.com/paramiko/paramiko/", packages = [ 'paramiko' ], license = 'LGPL', platforms = 'Posix; MacOS X; Windows', diff --git a/test.py b/test.py index c0e9d15..f3dd4d2 100755 --- a/test.py +++ b/test.py @@ -28,6 +28,7 @@ import sys import unittest from optparse import OptionParser import paramiko +import threading sys.path.append('tests') @@ -141,7 +142,15 @@ def main(): if len(args) > 0: filter = '|'.join(args) suite = filter_suite_by_re(suite, filter) - runner.run(suite) + result = runner.run(suite) + # Clean up stale threads from poorly cleaned-up tests. + # TODO: make that not a problem, jeez + for thread in threading.enumerate(): + if thread is not threading.currentThread(): + thread._Thread__stop() + # Exit correctly + if not result.wasSuccessful(): + sys.exit(1) if __name__ == '__main__': diff --git a/tests/loop.py b/tests/loop.py index bdc2f2d..ffa8e3c 100644 --- a/tests/loop.py +++ b/tests/loop.py @@ -62,12 +62,8 @@ class LoopSocket (object): self.__cv.wait(self.__timeout) if len(self.__in_buffer) == 0: raise socket.timeout - if n < self.__in_buffer: - out = self.__in_buffer[:n] - self.__in_buffer = self.__in_buffer[n:] - else: - out = self.__in_buffer - self.__in_buffer = '' + out = self.__in_buffer[:n] + self.__in_buffer = self.__in_buffer[n:] return out finally: self.__lock.release() diff --git a/tests/test_buffered_pipe.py b/tests/test_buffered_pipe.py index f285d05..b9d91f6 100644 --- a/tests/test_buffered_pipe.py +++ b/tests/test_buffered_pipe.py @@ -26,6 +26,8 @@ import unittest from paramiko.buffered_pipe import BufferedPipe, PipeTimeout from paramiko import pipe +from util import ParamikoTest + def delay_thread(pipe): pipe.feed('a') @@ -39,11 +41,7 @@ def close_thread(pipe): pipe.close() -class BufferedPipeTest (unittest.TestCase): - - assertTrue = unittest.TestCase.failUnless # for Python 2.3 and below - assertFalse = unittest.TestCase.failIf # for Python 2.3 and below - +class BufferedPipeTest(ParamikoTest): def test_1_buffered_pipe(self): p = BufferedPipe() self.assert_(not p.read_ready()) diff --git a/tests/test_client.py b/tests/test_client.py index 2f9b9a7..08ef1f9 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -68,11 +68,9 @@ class SSHClientTest (unittest.TestCase): thread.start() def tearDown(self): - if hasattr(self, 'tc'): - self.tc.close() - self.ts.close() - self.socks.close() - self.sockl.close() + for attr in "tc ts socks sockl".split(): + if hasattr(self, attr): + getattr(self, attr).close() def _run(self): self.socks, addr = self.sockl.accept() diff --git a/tests/test_sftp.py b/tests/test_sftp.py index 2eadabc..b1697ea 100755 --- a/tests/test_sftp.py +++ b/tests/test_sftp.py @@ -23,15 +23,15 @@ a real actual sftp server is contacted, and a new folder is created there to do test file operations in (so no existing files will be harmed). """ +from __future__ import with_statement + from binascii import hexlify -import logging import os -import random -import struct +import warnings import sys import threading -import time import unittest +import StringIO import paramiko from stub_sftp import StubServer, StubSFTPServer @@ -188,6 +188,17 @@ class SFTPTest (unittest.TestCase): finally: sftp.remove(FOLDER + '/duck.txt') + def test_3_sftp_file_can_be_used_as_context_manager(self): + """ + verify that an opened file can be used as a context manager + """ + try: + with sftp.open(FOLDER + '/duck.txt', 'w') as f: + f.write(ARTICLE) + self.assertEqual(sftp.stat(FOLDER + '/duck.txt').st_size, 1483) + finally: + sftp.remove(FOLDER + '/duck.txt') + def test_4_append(self): """ verify that a file can be opened for append, and tell() still works. @@ -214,7 +225,7 @@ class SFTPTest (unittest.TestCase): """ f = sftp.open(FOLDER + '/first.txt', 'w') try: - f.write('content!\n'); + f.write('content!\n') f.close() sftp.rename(FOLDER + '/first.txt', FOLDER + '/second.txt') try: @@ -425,7 +436,7 @@ class SFTPTest (unittest.TestCase): self.assertEqual(sftp.readlink(FOLDER + '/link.txt'), 'original.txt') f = sftp.open(FOLDER + '/link.txt', 'r') - self.assertEqual(f.readlines(), [ 'original\n' ]) + self.assertEqual(f.readlines(), ['original\n']) f.close() cwd = sftp.normalize('.') @@ -553,7 +564,6 @@ class SFTPTest (unittest.TestCase): """ verify that get/put work. """ - import os, warnings warnings.filterwarnings('ignore', 'tempnam.*') localname = os.tempnam() @@ -618,7 +628,7 @@ class SFTPTest (unittest.TestCase): try: f = sftp.open(FOLDER + '/unusual.txt', 'wx') self.fail('expected exception') - except IOError, x: + except IOError: pass finally: sftp.unlink(FOLDER + '/unusual.txt') @@ -658,12 +668,12 @@ class SFTPTest (unittest.TestCase): f.close() try: f = sftp.open(FOLDER + '/zero', 'r') - data = f.readv([(0, 12)]) + f.readv([(0, 12)]) f.close() f = sftp.open(FOLDER + '/zero', 'r') f.prefetch() - data = f.read(100) + f.read(100) f.close() finally: sftp.unlink(FOLDER + '/zero') @@ -672,7 +682,6 @@ class SFTPTest (unittest.TestCase): """ verify that get/put work without confirmation. """ - import os, warnings warnings.filterwarnings('ignore', 'tempnam.*') localname = os.tempnam() @@ -684,7 +693,7 @@ class SFTPTest (unittest.TestCase): def progress_callback(x, y): saved_progress.append((x, y)) res = sftp.put(localname, FOLDER + '/bunny.txt', progress_callback, False) - + self.assertEquals(SFTPAttributes().attr, res.attr) f = sftp.open(FOLDER + '/bunny.txt', 'r') @@ -717,3 +726,15 @@ class SFTPTest (unittest.TestCase): finally: sftp.remove(FOLDER + '/append.txt') + def test_putfo_empty_file(self): + """ + Send an empty file and confirm it is sent. + """ + target = FOLDER + '/empty file.txt' + stream = StringIO.StringIO() + try: + attrs = sftp.putfo(stream, target) + # the returned attributes should not be null + self.assertNotEqual(attrs, None) + finally: + sftp.remove(target) diff --git a/tests/test_transport.py b/tests/test_transport.py index cea4a1d..1c57d18 100644 --- a/tests/test_transport.py +++ b/tests/test_transport.py @@ -36,6 +36,7 @@ from paramiko import OPEN_SUCCEEDED, OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED from paramiko.common import MSG_KEXINIT, MSG_CHANNEL_WINDOW_ADJUST from paramiko.message import Message from loop import LoopSocket +from util import ParamikoTest LONG_BANNER = """\ @@ -105,11 +106,7 @@ class NullServer (ServerInterface): return OPEN_SUCCEEDED -class TransportTest (unittest.TestCase): - - assertTrue = unittest.TestCase.failUnless # for Python 2.3 and below - assertFalse = unittest.TestCase.failIf # for Python 2.3 and below - +class TransportTest(ParamikoTest): def setUp(self): self.socks = LoopSocket() self.sockc = LoopSocket() diff --git a/tests/test_util.py b/tests/test_util.py index 256c3d7..efda9b2 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -22,11 +22,14 @@ Some unit tests for utility functions. from binascii import hexlify import cStringIO +import errno import os import unittest from Crypto.Hash import SHA import paramiko.util +from paramiko.util import lookup_ssh_host_config as host_config +from util import ParamikoTest test_config_file = """\ Host * @@ -57,17 +60,7 @@ BGQ3GQ/Fc7SX6gkpXkwcZryoi4kNFhHu5LvHcZPdxXV1D+uTMfGS1eyd2Yz/DoNWXNAl8TI0cAsW\ from paramiko import * -class UtilTest (unittest.TestCase): - - assertTrue = unittest.TestCase.failUnless # for Python 2.3 and below - assertFalse = unittest.TestCase.failIf # for Python 2.3 and below - - def setUp(self): - pass - - def tearDown(self): - pass - +class UtilTest(ParamikoTest): def test_1_import(self): """ verify that all the classes can be imported from paramiko. @@ -111,21 +104,37 @@ class UtilTest (unittest.TestCase): f = cStringIO.StringIO(test_config_file) config = paramiko.util.parse_ssh_config(f) self.assertEquals(config._config, - [ {'identityfile': '~/.ssh/id_rsa', 'host': '*', 'user': 'robey', - 'crazy': 'something dumb '}, - {'host': '*.example.com', 'user': 'bjork', 'port': '3333'}, - {'host': 'spoo.example.com', 'crazy': 'something else'}]) + [{'host': ['*'], 'config': {}}, {'host': ['*'], 'config': {'identityfile': ['~/.ssh/id_rsa'], 'user': 'robey'}}, + {'host': ['*.example.com'], 'config': {'user': 'bjork', 'port': '3333'}}, + {'host': ['*'], 'config': {'crazy': 'something dumb '}}, + {'host': ['spoo.example.com'], 'config': {'crazy': 'something else'}}]) def test_3_host_config(self): global test_config_file f = cStringIO.StringIO(test_config_file) config = paramiko.util.parse_ssh_config(f) - c = paramiko.util.lookup_ssh_host_config('irc.danger.com', config) - self.assertEquals(c, {'identityfile': '~/.ssh/id_rsa', 'user': 'robey', 'crazy': 'something dumb '}) - c = paramiko.util.lookup_ssh_host_config('irc.example.com', config) - self.assertEquals(c, {'identityfile': '~/.ssh/id_rsa', 'user': 'bjork', 'crazy': 'something dumb ', 'port': '3333'}) - c = paramiko.util.lookup_ssh_host_config('spoo.example.com', config) - self.assertEquals(c, {'identityfile': '~/.ssh/id_rsa', 'user': 'bjork', 'crazy': 'something else', 'port': '3333'}) + + for host, values in { + 'irc.danger.com': {'crazy': 'something dumb ', + 'hostname': 'irc.danger.com', + 'user': 'robey'}, + 'irc.example.com': {'crazy': 'something dumb ', + 'hostname': 'irc.example.com', + 'user': 'robey', + 'port': '3333'}, + 'spoo.example.com': {'crazy': 'something dumb ', + 'hostname': 'spoo.example.com', + 'user': 'robey', + 'port': '3333'} + }.items(): + values = dict(values, + hostname=host, + identityfile=[os.path.expanduser("~/.ssh/id_rsa")] + ) + self.assertEquals( + paramiko.util.lookup_ssh_host_config(host, config), + values + ) def test_4_generate_key_bytes(self): x = paramiko.util.generate_key_bytes(SHA, 'ABCDEFGH', 'This is my secret passphrase.', 64) @@ -151,4 +160,172 @@ class UtilTest (unittest.TestCase): # just verify that we can pull out 32 bytes and not get an exception. x = rng.read(32) self.assertEquals(len(x), 32) - + + def test_7_host_config_expose_issue_33(self): + test_config_file = """ +Host www13.* + Port 22 + +Host *.example.com + Port 2222 + +Host * + Port 3333 + """ + f = cStringIO.StringIO(test_config_file) + config = paramiko.util.parse_ssh_config(f) + host = 'www13.example.com' + self.assertEquals( + paramiko.util.lookup_ssh_host_config(host, config), + {'hostname': host, 'port': '22'} + ) + + def test_8_eintr_retry(self): + self.assertEquals('foo', paramiko.util.retry_on_signal(lambda: 'foo')) + + # Variables that are set by raises_intr + intr_errors_remaining = [3] + call_count = [0] + def raises_intr(): + call_count[0] += 1 + if intr_errors_remaining[0] > 0: + intr_errors_remaining[0] -= 1 + raise IOError(errno.EINTR, 'file', 'interrupted system call') + self.assertTrue(paramiko.util.retry_on_signal(raises_intr) is None) + self.assertEquals(0, intr_errors_remaining[0]) + self.assertEquals(4, call_count[0]) + + def raises_ioerror_not_eintr(): + raise IOError(errno.ENOENT, 'file', 'file not found') + self.assertRaises(IOError, + lambda: paramiko.util.retry_on_signal(raises_ioerror_not_eintr)) + + def raises_other_exception(): + raise AssertionError('foo') + self.assertRaises(AssertionError, + lambda: paramiko.util.retry_on_signal(raises_other_exception)) + + def test_9_proxycommand_config_equals_parsing(self): + """ + ProxyCommand should not split on equals signs within the value. + """ + conf = """ +Host space-delimited + ProxyCommand foo bar=biz baz + +Host equals-delimited + ProxyCommand=foo bar=biz baz +""" + f = cStringIO.StringIO(conf) + config = paramiko.util.parse_ssh_config(f) + for host in ('space-delimited', 'equals-delimited'): + self.assertEquals( + host_config(host, config)['proxycommand'], + 'foo bar=biz baz' + ) + + def test_10_proxycommand_interpolation(self): + """ + ProxyCommand should perform interpolation on the value + """ + config = paramiko.util.parse_ssh_config(cStringIO.StringIO(""" +Host specific + Port 37 + ProxyCommand host %h port %p lol + +Host portonly + Port 155 + +Host * + Port 25 + ProxyCommand host %h port %p +""")) + for host, val in ( + ('foo.com', "host foo.com port 25"), + ('specific', "host specific port 37 lol"), + ('portonly', "host portonly port 155"), + ): + self.assertEquals( + host_config(host, config)['proxycommand'], + val + ) + + def test_11_host_config_test_negation(self): + test_config_file = """ +Host www13.* !*.example.com + Port 22 + +Host *.example.com !www13.* + Port 2222 + +Host www13.* + Port 8080 + +Host * + Port 3333 + """ + f = cStringIO.StringIO(test_config_file) + config = paramiko.util.parse_ssh_config(f) + host = 'www13.example.com' + self.assertEquals( + paramiko.util.lookup_ssh_host_config(host, config), + {'hostname': host, 'port': '8080'} + ) + + def test_12_host_config_test_proxycommand(self): + test_config_file = """ +Host proxy-with-equal-divisor-and-space +ProxyCommand = foo=bar + +Host proxy-with-equal-divisor-and-no-space +ProxyCommand=foo=bar + +Host proxy-without-equal-divisor +ProxyCommand foo=bar:%h-%p + """ + for host, values in { + 'proxy-with-equal-divisor-and-space' :{'hostname': 'proxy-with-equal-divisor-and-space', + 'proxycommand': 'foo=bar'}, + 'proxy-with-equal-divisor-and-no-space':{'hostname': 'proxy-with-equal-divisor-and-no-space', + 'proxycommand': 'foo=bar'}, + 'proxy-without-equal-divisor' :{'hostname': 'proxy-without-equal-divisor', + 'proxycommand': + 'foo=bar:proxy-without-equal-divisor-22'} + }.items(): + + f = cStringIO.StringIO(test_config_file) + config = paramiko.util.parse_ssh_config(f) + self.assertEquals( + paramiko.util.lookup_ssh_host_config(host, config), + values + ) + + def test_11_host_config_test_identityfile(self): + test_config_file = """ + +IdentityFile id_dsa0 + +Host * +IdentityFile id_dsa1 + +Host dsa2 +IdentityFile id_dsa2 + +Host dsa2* +IdentityFile id_dsa22 + """ + for host, values in { + 'foo' :{'hostname': 'foo', + 'identityfile': ['id_dsa0', 'id_dsa1']}, + 'dsa2' :{'hostname': 'dsa2', + 'identityfile': ['id_dsa0', 'id_dsa1', 'id_dsa2', 'id_dsa22']}, + 'dsa22' :{'hostname': 'dsa22', + 'identityfile': ['id_dsa0', 'id_dsa1', 'id_dsa22']} + }.items(): + + f = cStringIO.StringIO(test_config_file) + config = paramiko.util.parse_ssh_config(f) + self.assertEquals( + paramiko.util.lookup_ssh_host_config(host, config), + values + ) diff --git a/tests/util.py b/tests/util.py new file mode 100644 index 0000000..2e0be08 --- /dev/null +++ b/tests/util.py @@ -0,0 +1,10 @@ +import unittest + + +class ParamikoTest(unittest.TestCase): + # for Python 2.3 and below + if not hasattr(unittest.TestCase, 'assertTrue'): + assertTrue = unittest.TestCase.failUnless + if not hasattr(unittest.TestCase, 'assertFalse'): + assertFalse = unittest.TestCase.failIf + diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..6cb8001 --- /dev/null +++ b/tox.ini @@ -0,0 +1,6 @@ +[tox] +envlist = py25,py26,py27 + +[testenv] +commands = pip install --use-mirrors -q -r requirements.txt + python test.py -- cgit v1.2.3