From ed280d5ac360e2af796e9bd973d7b4df89f0c449 Mon Sep 17 00:00:00 2001 From: "Jeremy T. Bouse" Date: Fri, 27 Nov 2009 16:20:12 -0500 Subject: Imported Upstream version 1.7.4 --- MANIFEST.in | 4 + PKG-INFO | 6 +- README | 245 +- demo.py | 210 - demo_server.py | 138 - demo_simple.py | 128 - demos/demo.py | 180 + demos/demo_server.py | 146 + demos/demo_sftp.py | 119 + demos/demo_simple.py | 101 + demos/forward.py | 180 + demos/interactive.py | 97 + demos/rforward.py | 167 + demos/test_rsa.key | 15 + demos/user_rsa_key | 15 + demos/user_rsa_key.pub | 1 + docs/api-objects.txt | 2179 ++++++++ docs/bug-index.html | 107 + docs/class-tree.html | 368 ++ docs/crarr.png | Bin 0 -> 340 bytes docs/epydoc.css | 418 +- docs/epydoc.js | 293 ++ docs/frames.html | 17 + docs/help.html | 266 + docs/identifier-index.html | 5420 ++++++++++++++++++++ docs/index.html | 14 +- docs/module-tree.html | 158 + docs/paramiko-module.html | 516 ++ docs/paramiko-pysrc.html | 485 ++ docs/paramiko.Agent-class.html | 233 + docs/paramiko.AgentKey-class.html | 396 ++ docs/paramiko.AuthenticationException-class.html | 180 + docs/paramiko.AutoAddPolicy-class.html | 221 + docs/paramiko.BadAuthenticationType-class.html | 291 ++ docs/paramiko.BadHostKeyException-class.html | 263 + docs/paramiko.BufferedFile-class.html | 853 +++ docs/paramiko.Channel-class.html | 1995 +++++++ docs/paramiko.ChannelException-class.html | 245 + docs/paramiko.DSSKey-class.html | 747 +++ docs/paramiko.HostKeys-class.html | 643 +++ docs/paramiko.Message-class.html | 1098 ++++ docs/paramiko.MissingHostKeyPolicy-class.html | 229 + docs/paramiko.PKey-class.html | 854 +++ docs/paramiko.PasswordRequiredException-class.html | 171 + docs/paramiko.RSAKey-class.html | 747 +++ docs/paramiko.RejectPolicy-class.html | 220 + docs/paramiko.SFTP-class.html | 199 + docs/paramiko.SFTPAttributes-class.html | 415 ++ docs/paramiko.SFTPClient-class.html | 1528 ++++++ docs/paramiko.SFTPError-class.html | 164 + docs/paramiko.SFTPFile-class.html | 1008 ++++ docs/paramiko.SFTPHandle-class.html | 473 ++ docs/paramiko.SFTPServer-class.html | 468 ++ docs/paramiko.SFTPServerInterface-class.html | 976 ++++ docs/paramiko.SSHClient-class.html | 839 +++ docs/paramiko.SSHConfig-class.html | 306 ++ docs/paramiko.SSHException-class.html | 173 + docs/paramiko.SecurityOptions-class.html | 394 ++ docs/paramiko.ServerInterface-class.html | 1244 +++++ docs/paramiko.SubsystemHandler-class.html | 384 ++ docs/paramiko.Transport-class.html | 2343 +++++++++ docs/paramiko.WarningPolicy-class.html | 220 + docs/paramiko.agent-module.html | 141 + docs/paramiko.agent-pysrc.html | 277 + docs/paramiko.auth_handler-module.html | 524 ++ docs/paramiko.auth_handler-pysrc.html | 1514 ++++++ docs/paramiko.ber-module.html | 126 + docs/paramiko.ber-pysrc.html | 238 + docs/paramiko.ber.BER-class.html | 394 ++ docs/paramiko.ber.BERException-class.html | 165 + docs/paramiko.buffered_pipe-module.html | 136 + docs/paramiko.buffered_pipe-pysrc.html | 323 ++ .../paramiko.buffered_pipe.BufferedPipe-class.html | 513 ++ docs/paramiko.buffered_pipe.PipeTimeout-class.html | 182 + docs/paramiko.channel-module.html | 547 ++ docs/paramiko.channel-pysrc.html | 2083 ++++++++ docs/paramiko.channel.ChannelStderrFile-class.html | 254 + docs/paramiko.client-module.html | 525 ++ docs/paramiko.client-pysrc.html | 766 +++ docs/paramiko.common-module.html | 524 ++ docs/paramiko.common-pysrc.html | 1905 +++++++ docs/paramiko.compress-module.html | 127 + docs/paramiko.compress-pysrc.html | 148 + docs/paramiko.compress.ZlibCompressor-class.html | 219 + docs/paramiko.compress.ZlibDecompressor-class.html | 219 + docs/paramiko.config-module.html | 105 + docs/paramiko.config-pysrc.html | 214 + docs/paramiko.dsskey-module.html | 524 ++ docs/paramiko.dsskey-pysrc.html | 355 ++ docs/paramiko.file-module.html | 104 + docs/paramiko.file-pysrc.html | 579 +++ docs/paramiko.hostkeys-module.html | 542 ++ docs/paramiko.hostkeys-pysrc.html | 499 ++ docs/paramiko.hostkeys.HostKeyEntry-class.html | 255 + docs/paramiko.kex_gex-module.html | 543 ++ docs/paramiko.kex_gex-pysrc.html | 483 ++ docs/paramiko.kex_gex.KexGex-class.html | 276 + docs/paramiko.kex_group1-module.html | 582 +++ docs/paramiko.kex_group1-pysrc.html | 312 ++ docs/paramiko.kex_group1.KexGroup1-class.html | 254 + docs/paramiko.logging22-module.html | 203 + docs/paramiko.logging22-pysrc.html | 302 ++ docs/paramiko.logging22.Formatter-class.html | 206 + docs/paramiko.logging22.StreamHandler-class.html | 221 + docs/paramiko.logging22.logger-class.html | 271 + docs/paramiko.message-module.html | 104 + docs/paramiko.message-pysrc.html | 428 ++ docs/paramiko.packet-module.html | 574 +++ docs/paramiko.packet-pysrc.html | 964 ++++ docs/paramiko.packet.NeedRekeyException-class.html | 165 + docs/paramiko.pipe-module.html | 215 + docs/paramiko.pipe-pysrc.html | 327 ++ docs/paramiko.pipe.OrPipe-class.html | 236 + docs/paramiko.pipe.PosixPipe-class.html | 282 + docs/paramiko.pipe.WindowsPipe-class.html | 285 + docs/paramiko.pkey-module.html | 524 ++ docs/paramiko.pkey-pysrc.html | 540 ++ docs/paramiko.primes-module.html | 122 + docs/paramiko.primes-pysrc.html | 333 ++ docs/paramiko.primes.ModulusPack-class.html | 267 + docs/paramiko.resource-module.html | 120 + docs/paramiko.resource-pysrc.html | 192 + docs/paramiko.rng-module.html | 135 + docs/paramiko.rng-pysrc.html | 368 ++ ...paramiko.rng.StrongLockingRandomPool-class.html | 281 + docs/paramiko.rng_posix-module.html | 144 + docs/paramiko.rng_posix-pysrc.html | 285 + docs/paramiko.rng_posix.error-class.html | 165 + docs/paramiko.rng_win32-module.html | 143 + docs/paramiko.rng_win32-pysrc.html | 249 + docs/paramiko.rng_win32.error-class.html | 165 + docs/paramiko.rsakey-module.html | 524 ++ docs/paramiko.rsakey-pysrc.html | 343 ++ docs/paramiko.server-module.html | 526 ++ docs/paramiko.server-pysrc.html | 1006 ++++ docs/paramiko.sftp-module.html | 898 ++++ docs/paramiko.sftp-pysrc.html | 798 +++ docs/paramiko.sftp_attr-module.html | 898 ++++ docs/paramiko.sftp_attr-pysrc.html | 367 ++ docs/paramiko.sftp_client-module.html | 900 ++++ docs/paramiko.sftp_client-pysrc.html | 1563 ++++++ docs/paramiko.sftp_file-module.html | 900 ++++ docs/paramiko.sftp_file-pysrc.html | 874 ++++ docs/paramiko.sftp_handle-module.html | 900 ++++ docs/paramiko.sftp_handle-pysrc.html | 369 ++ docs/paramiko.sftp_server-module.html | 900 ++++ docs/paramiko.sftp_server-pysrc.html | 1196 +++++ docs/paramiko.sftp_si-module.html | 902 ++++ docs/paramiko.sftp_si-pysrc.html | 527 ++ docs/paramiko.ssh_exception-module.html | 121 + docs/paramiko.ssh_exception-pysrc.html | 403 ++ ....ssh_exception.PartialAuthentication-class.html | 241 + docs/paramiko.transport-module.html | 541 ++ docs/paramiko.transport-pysrc.html | 4154 +++++++++++++++ docs/paramiko.transport.ChannelMap-class.html | 286 ++ docs/paramiko.util-module.html | 950 ++++ docs/paramiko.util-pysrc.html | 400 ++ docs/paramiko.util.PFilter-class.html | 168 + docs/paramiko.util.enumerate-class.html | 145 + docs/paramiko.win_pageant-module.html | 197 + docs/paramiko.win_pageant-pysrc.html | 288 ++ ...ramiko.win_pageant.PageantConnection-class.html | 257 + docs/private/__builtin__.object-class.html | 286 -- docs/private/__builtin__.type-class.html | 504 -- docs/private/epydoc.css | 100 - docs/private/exceptions.Exception-class.html | 87 - docs/private/frames.html | 13 - docs/private/help.html | 224 - docs/private/index.html | 13 - docs/private/indices.html | 1635 ------ docs/private/paramiko-module.html | 407 -- docs/private/paramiko.Agent-class.html | 155 - docs/private/paramiko.AgentKey-class.html | 319 -- docs/private/paramiko.AuthHandler-class.html | 282 - .../paramiko.BadAuthenticationType-class.html | 141 - docs/private/paramiko.BaseSFTP-class.html | 149 - docs/private/paramiko.BufferedFile-class.html | 656 --- docs/private/paramiko.Channel-class.html | 1329 ----- docs/private/paramiko.ChannelFile-class.html | 347 -- docs/private/paramiko.DSSKey-class.html | 486 -- docs/private/paramiko.Message-class.html | 654 --- docs/private/paramiko.PKey-class.html | 696 --- docs/private/paramiko.Packetizer-class.html | 441 -- .../paramiko.PasswordRequiredException-class.html | 91 - docs/private/paramiko.RSAKey-class.html | 504 -- docs/private/paramiko.SFTP-class.html | 347 -- docs/private/paramiko.SFTPAttributes-class.html | 385 -- docs/private/paramiko.SFTPClient-class.html | 1091 ---- docs/private/paramiko.SFTPError-class.html | 85 - docs/private/paramiko.SFTPFile-class.html | 667 --- docs/private/paramiko.SFTPHandle-class.html | 364 -- docs/private/paramiko.SFTPServer-class.html | 511 -- .../paramiko.SFTPServerInterface-class.html | 744 --- docs/private/paramiko.SSHException-class.html | 95 - docs/private/paramiko.SecurityOptions-class.html | 373 -- docs/private/paramiko.ServerInterface-class.html | 894 ---- docs/private/paramiko.SubsystemHandler-class.html | 352 -- docs/private/paramiko.Transport-class.html | 2151 -------- docs/private/paramiko.agent-module.html | 164 - docs/private/paramiko.auth_handler-module.html | 62 - docs/private/paramiko.ber-module.html | 79 - docs/private/paramiko.ber.BER-class.html | 145 - docs/private/paramiko.ber.BERException-class.html | 86 - docs/private/paramiko.channel-module.html | 71 - .../paramiko.channel.ChannelStderrFile-class.html | 282 - docs/private/paramiko.common-module.html | 1013 ---- docs/private/paramiko.compress-module.html | 74 - .../paramiko.compress.ZlibCompressor-class.html | 122 - .../paramiko.compress.ZlibDecompressor-class.html | 122 - docs/private/paramiko.dsskey-module.html | 62 - docs/private/paramiko.file-module.html | 230 - docs/private/paramiko.kex_gex-module.html | 179 - docs/private/paramiko.kex_gex.KexGex-class.html | 250 - docs/private/paramiko.kex_group1-module.html | 181 - .../paramiko.kex_group1.KexGroup1-class.html | 176 - docs/private/paramiko.logging22-module.html | 235 - .../paramiko.logging22.Formatter-class.html | 120 - .../paramiko.logging22.StreamHandler-class.html | 123 - docs/private/paramiko.logging22.logger-class.html | 135 - docs/private/paramiko.message-module.html | 61 - docs/private/paramiko.packet-module.html | 71 - .../paramiko.packet.NeedRekeyException-class.html | 86 - docs/private/paramiko.pipe-module.html | 87 - docs/private/paramiko.pipe.PosixPipe-class.html | 133 - docs/private/paramiko.pipe.WindowsPipe-class.html | 137 - docs/private/paramiko.pkey-module.html | 61 - docs/private/paramiko.primes-module.html | 117 - .../private/paramiko.primes.ModulusPack-class.html | 158 - docs/private/paramiko.rsakey-module.html | 62 - docs/private/paramiko.server-module.html | 74 - .../paramiko.server.InteractiveQuery-class.html | 195 - docs/private/paramiko.sftp-module.html | 1082 ---- docs/private/paramiko.sftp_attr-module.html | 59 - docs/private/paramiko.sftp_client-module.html | 89 - docs/private/paramiko.sftp_file-module.html | 62 - docs/private/paramiko.sftp_handle-module.html | 61 - docs/private/paramiko.sftp_server-module.html | 102 - docs/private/paramiko.sftp_si-module.html | 63 - docs/private/paramiko.ssh_exception-module.html | 72 - ....ssh_exception.PartialAuthentication-class.html | 131 - docs/private/paramiko.transport-module.html | 111 - docs/private/paramiko.util-module.html | 475 -- docs/private/paramiko.util.PFilter-class.html | 124 - docs/private/threading.Thread-class.html | 237 - docs/private/threading._Verbose-class.html | 127 - docs/private/toc-everything.html | 224 - docs/private/toc-paramiko-module.html | 94 - docs/private/toc-paramiko.agent-module.html | 25 - docs/private/toc-paramiko.auth_handler-module.html | 17 - docs/private/toc-paramiko.ber-module.html | 27 - docs/private/toc-paramiko.channel-module.html | 22 - docs/private/toc-paramiko.common-module.html | 63 - docs/private/toc-paramiko.compress-module.html | 23 - docs/private/toc-paramiko.dsskey-module.html | 17 - docs/private/toc-paramiko.file-module.html | 28 - docs/private/toc-paramiko.kex_gex-module.html | 30 - docs/private/toc-paramiko.kex_group1-module.html | 30 - docs/private/toc-paramiko.logging22-module.html | 39 - docs/private/toc-paramiko.message-module.html | 17 - docs/private/toc-paramiko.packet-module.html | 22 - docs/private/toc-paramiko.pipe-module.html | 28 - docs/private/toc-paramiko.pkey-module.html | 17 - docs/private/toc-paramiko.primes-module.html | 28 - docs/private/toc-paramiko.rsakey-module.html | 17 - docs/private/toc-paramiko.server-module.html | 22 - docs/private/toc-paramiko.sftp-module.html | 66 - docs/private/toc-paramiko.sftp_attr-module.html | 17 - docs/private/toc-paramiko.sftp_client-module.html | 22 - docs/private/toc-paramiko.sftp_file-module.html | 17 - docs/private/toc-paramiko.sftp_handle-module.html | 17 - docs/private/toc-paramiko.sftp_server-module.html | 22 - docs/private/toc-paramiko.sftp_si-module.html | 17 - .../private/toc-paramiko.ssh_exception-module.html | 22 - docs/private/toc-paramiko.transport-module.html | 27 - docs/private/toc-paramiko.util-module.html | 52 - docs/private/toc.html | 53 - docs/private/trees.html | 243 - docs/public/__builtin__.object-class.html | 268 - docs/public/__builtin__.type-class.html | 504 -- docs/public/epydoc.css | 100 - docs/public/exceptions.Exception-class.html | 85 - docs/public/frames.html | 13 - docs/public/help.html | 224 - docs/public/index.html | 13 - docs/public/indices.html | 803 --- docs/public/paramiko-module.html | 229 - docs/public/paramiko.Agent-class.html | 147 - docs/public/paramiko.AgentKey-class.html | 236 - .../paramiko.BadAuthenticationType-class.html | 141 - docs/public/paramiko.BufferedFile-class.html | 554 -- docs/public/paramiko.Channel-class.html | 1241 ----- docs/public/paramiko.DSSKey-class.html | 423 -- docs/public/paramiko.Message-class.html | 650 --- .../paramiko.PasswordRequiredException-class.html | 91 - docs/public/paramiko.RSAKey-class.html | 423 -- docs/public/paramiko.SFTP-class.html | 287 -- docs/public/paramiko.SFTPAttributes-class.html | 360 -- docs/public/paramiko.SFTPClient-class.html | 1009 ---- docs/public/paramiko.SFTPError-class.html | 85 - docs/public/paramiko.SFTPFile-class.html | 560 -- docs/public/paramiko.SFTPHandle-class.html | 325 -- docs/public/paramiko.SFTPServer-class.html | 403 -- docs/public/paramiko.SSHException-class.html | 94 - docs/public/paramiko.SecurityOptions-class.html | 274 - docs/public/paramiko.SubsystemHandler-class.html | 327 -- docs/public/paramiko.Transport-class.html | 1524 ------ docs/public/paramiko.agent-module.html | 164 - docs/public/paramiko.dsskey-module.html | 62 - docs/public/paramiko.file-module.html | 61 - docs/public/paramiko.message-module.html | 61 - docs/public/paramiko.pkey-module.html | 61 - docs/public/paramiko.rsakey-module.html | 62 - docs/public/paramiko.server-module.html | 74 - .../paramiko.server.InteractiveQuery-class.html | 195 - docs/public/paramiko.sftp-module.html | 1060 ---- docs/public/paramiko.sftp_attr-module.html | 59 - docs/public/paramiko.sftp_client-module.html | 61 - docs/public/paramiko.sftp_file-module.html | 62 - docs/public/paramiko.sftp_handle-module.html | 61 - docs/public/paramiko.sftp_server-module.html | 61 - docs/public/paramiko.sftp_si-module.html | 63 - docs/public/paramiko.transport-module.html | 63 - docs/public/paramiko.util-module.html | 369 -- docs/public/paramiko.util.PFilter-class.html | 124 - docs/public/threading.Thread-class.html | 161 - docs/public/toc-everything.html | 121 - docs/public/toc-paramiko-module.html | 69 - docs/public/toc-paramiko.agent-module.html | 25 - docs/public/toc-paramiko.dsskey-module.html | 17 - docs/public/toc-paramiko.file-module.html | 21 - docs/public/toc-paramiko.message-module.html | 17 - docs/public/toc-paramiko.pkey-module.html | 17 - docs/public/toc-paramiko.rsakey-module.html | 17 - docs/public/toc-paramiko.server-module.html | 22 - docs/public/toc-paramiko.sftp-module.html | 65 - docs/public/toc-paramiko.sftp_attr-module.html | 17 - docs/public/toc-paramiko.sftp_client-module.html | 21 - docs/public/toc-paramiko.sftp_file-module.html | 17 - docs/public/toc-paramiko.sftp_handle-module.html | 17 - docs/public/toc-paramiko.sftp_server-module.html | 21 - docs/public/toc-paramiko.sftp_si-module.html | 17 - docs/public/toc-paramiko.transport-module.html | 25 - docs/public/toc-paramiko.util-module.html | 48 - docs/public/toc.html | 41 - docs/public/trees.html | 151 - docs/redirect.html | 38 + docs/since-index.html | 302 ++ docs/toc-everything.html | 146 + 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 | 28 + docs/toc-paramiko.buffered_pipe-module.html | 28 + 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 | 28 + docs/toc-paramiko.config-module.html | 27 + docs/toc-paramiko.dsskey-module.html | 28 + docs/toc-paramiko.file-module.html | 27 + 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 | 39 + docs/toc-paramiko.message-module.html | 27 + docs/toc-paramiko.packet-module.html | 30 + docs/toc-paramiko.pipe-module.html | 29 + docs/toc-paramiko.pkey-module.html | 28 + docs/toc-paramiko.primes-module.html | 28 + docs/toc-paramiko.resource-module.html | 28 + docs/toc-paramiko.rng-module.html | 29 + docs/toc-paramiko.rng_posix-module.html | 29 + docs/toc-paramiko.rng_win32-module.html | 31 + 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 | 28 + docs/toc-paramiko.transport-module.html | 29 + docs/toc-paramiko.util-module.html | 99 + docs/toc-paramiko.win_pageant-module.html | 33 + docs/toc.html | 35 + forward.py | 219 - paramiko.egg-info/PKG-INFO | 25 + paramiko.egg-info/SOURCES.txt | 266 + paramiko.egg-info/dependency_links.txt | 1 + paramiko.egg-info/requires.txt | 1 + paramiko.egg-info/top_level.txt | 1 + paramiko/__init__.py | 67 +- paramiko/agent.py | 39 +- paramiko/auth_handler.py | 42 +- paramiko/ber.py | 7 +- paramiko/buffered_pipe.py | 200 + paramiko/channel.py | 471 +- paramiko/client.py | 474 ++ paramiko/common.py | 26 +- paramiko/compress.py | 2 +- paramiko/config.py | 105 + paramiko/dsskey.py | 37 +- paramiko/file.py | 82 +- paramiko/hostkeys.py | 315 ++ paramiko/kex_gex.py | 68 +- paramiko/kex_group1.py | 2 +- paramiko/logging22.py | 2 +- paramiko/message.py | 4 +- paramiko/packet.py | 116 +- paramiko/pipe.py | 52 +- paramiko/pkey.py | 93 +- paramiko/primes.py | 17 +- paramiko/resource.py | 72 + paramiko/rng.py | 112 + paramiko/rng_posix.py | 97 + paramiko/rng_win32.py | 121 + paramiko/rsakey.py | 41 +- paramiko/server.py | 111 +- paramiko/sftp.py | 48 +- paramiko/sftp_attr.py | 75 +- paramiko/sftp_client.py | 229 +- paramiko/sftp_file.py | 241 +- paramiko/sftp_handle.py | 44 +- paramiko/sftp_server.py | 76 +- paramiko/sftp_si.py | 13 +- paramiko/ssh_exception.py | 58 +- paramiko/transport.py | 574 ++- paramiko/util.py | 131 +- paramiko/win_pageant.py | 148 + setup.cfg | 5 + setup.py | 31 +- setup_helper.py | 102 + test.py | 163 +- tests/loop.py | 4 +- tests/stub_sftp.py | 32 +- tests/test_auth.py | 231 + tests/test_buffered_pipe.py | 95 + tests/test_client.py | 214 + tests/test_file.py | 4 +- tests/test_hostkeys.py | 117 + tests/test_kex.py | 101 +- tests/test_message.py | 4 +- tests/test_packetizer.py | 2 +- tests/test_pkey.py | 61 +- tests/test_sftp.py | 339 +- tests/test_sftp_big.py | 385 ++ tests/test_transport.py | 723 ++- tests/test_util.py | 96 +- 450 files changed, 88215 insertions(+), 44416 deletions(-) create mode 100644 MANIFEST.in delete mode 100644 demo.py delete mode 100644 demo_server.py delete mode 100644 demo_simple.py create mode 100755 demos/demo.py create mode 100755 demos/demo_server.py create mode 100755 demos/demo_sftp.py create mode 100755 demos/demo_simple.py create mode 100755 demos/forward.py create mode 100644 demos/interactive.py create mode 100755 demos/rforward.py create mode 100644 demos/test_rsa.key create mode 100644 demos/user_rsa_key create mode 100644 demos/user_rsa_key.pub create mode 100644 docs/api-objects.txt create mode 100644 docs/bug-index.html create mode 100644 docs/class-tree.html create mode 100644 docs/crarr.png create mode 100644 docs/epydoc.js create mode 100644 docs/frames.html create mode 100644 docs/help.html create mode 100644 docs/identifier-index.html create mode 100644 docs/module-tree.html create mode 100644 docs/paramiko-module.html create mode 100644 docs/paramiko-pysrc.html create mode 100644 docs/paramiko.Agent-class.html create mode 100644 docs/paramiko.AgentKey-class.html create mode 100644 docs/paramiko.AuthenticationException-class.html create mode 100644 docs/paramiko.AutoAddPolicy-class.html create mode 100644 docs/paramiko.BadAuthenticationType-class.html create mode 100644 docs/paramiko.BadHostKeyException-class.html create mode 100644 docs/paramiko.BufferedFile-class.html create mode 100644 docs/paramiko.Channel-class.html create mode 100644 docs/paramiko.ChannelException-class.html create mode 100644 docs/paramiko.DSSKey-class.html create mode 100644 docs/paramiko.HostKeys-class.html create mode 100644 docs/paramiko.Message-class.html create mode 100644 docs/paramiko.MissingHostKeyPolicy-class.html create mode 100644 docs/paramiko.PKey-class.html create mode 100644 docs/paramiko.PasswordRequiredException-class.html create mode 100644 docs/paramiko.RSAKey-class.html create mode 100644 docs/paramiko.RejectPolicy-class.html create mode 100644 docs/paramiko.SFTP-class.html create mode 100644 docs/paramiko.SFTPAttributes-class.html create mode 100644 docs/paramiko.SFTPClient-class.html create mode 100644 docs/paramiko.SFTPError-class.html create mode 100644 docs/paramiko.SFTPFile-class.html create mode 100644 docs/paramiko.SFTPHandle-class.html create mode 100644 docs/paramiko.SFTPServer-class.html create mode 100644 docs/paramiko.SFTPServerInterface-class.html create mode 100644 docs/paramiko.SSHClient-class.html create mode 100644 docs/paramiko.SSHConfig-class.html create mode 100644 docs/paramiko.SSHException-class.html create mode 100644 docs/paramiko.SecurityOptions-class.html create mode 100644 docs/paramiko.ServerInterface-class.html create mode 100644 docs/paramiko.SubsystemHandler-class.html create mode 100644 docs/paramiko.Transport-class.html create mode 100644 docs/paramiko.WarningPolicy-class.html create mode 100644 docs/paramiko.agent-module.html create mode 100644 docs/paramiko.agent-pysrc.html create mode 100644 docs/paramiko.auth_handler-module.html create mode 100644 docs/paramiko.auth_handler-pysrc.html create mode 100644 docs/paramiko.ber-module.html create mode 100644 docs/paramiko.ber-pysrc.html create mode 100644 docs/paramiko.ber.BER-class.html create mode 100644 docs/paramiko.ber.BERException-class.html create mode 100644 docs/paramiko.buffered_pipe-module.html create mode 100644 docs/paramiko.buffered_pipe-pysrc.html create mode 100644 docs/paramiko.buffered_pipe.BufferedPipe-class.html create mode 100644 docs/paramiko.buffered_pipe.PipeTimeout-class.html create mode 100644 docs/paramiko.channel-module.html create mode 100644 docs/paramiko.channel-pysrc.html create mode 100644 docs/paramiko.channel.ChannelStderrFile-class.html create mode 100644 docs/paramiko.client-module.html create mode 100644 docs/paramiko.client-pysrc.html create mode 100644 docs/paramiko.common-module.html create mode 100644 docs/paramiko.common-pysrc.html create mode 100644 docs/paramiko.compress-module.html create mode 100644 docs/paramiko.compress-pysrc.html create mode 100644 docs/paramiko.compress.ZlibCompressor-class.html create mode 100644 docs/paramiko.compress.ZlibDecompressor-class.html create mode 100644 docs/paramiko.config-module.html create mode 100644 docs/paramiko.config-pysrc.html create mode 100644 docs/paramiko.dsskey-module.html create mode 100644 docs/paramiko.dsskey-pysrc.html create mode 100644 docs/paramiko.file-module.html create mode 100644 docs/paramiko.file-pysrc.html create mode 100644 docs/paramiko.hostkeys-module.html create mode 100644 docs/paramiko.hostkeys-pysrc.html create mode 100644 docs/paramiko.hostkeys.HostKeyEntry-class.html create mode 100644 docs/paramiko.kex_gex-module.html create mode 100644 docs/paramiko.kex_gex-pysrc.html create mode 100644 docs/paramiko.kex_gex.KexGex-class.html create mode 100644 docs/paramiko.kex_group1-module.html create mode 100644 docs/paramiko.kex_group1-pysrc.html create mode 100644 docs/paramiko.kex_group1.KexGroup1-class.html create mode 100644 docs/paramiko.logging22-module.html create mode 100644 docs/paramiko.logging22-pysrc.html create mode 100644 docs/paramiko.logging22.Formatter-class.html create mode 100644 docs/paramiko.logging22.StreamHandler-class.html create mode 100644 docs/paramiko.logging22.logger-class.html create mode 100644 docs/paramiko.message-module.html create mode 100644 docs/paramiko.message-pysrc.html create mode 100644 docs/paramiko.packet-module.html create mode 100644 docs/paramiko.packet-pysrc.html create mode 100644 docs/paramiko.packet.NeedRekeyException-class.html create mode 100644 docs/paramiko.pipe-module.html create mode 100644 docs/paramiko.pipe-pysrc.html create mode 100644 docs/paramiko.pipe.OrPipe-class.html create mode 100644 docs/paramiko.pipe.PosixPipe-class.html create mode 100644 docs/paramiko.pipe.WindowsPipe-class.html create mode 100644 docs/paramiko.pkey-module.html create mode 100644 docs/paramiko.pkey-pysrc.html create mode 100644 docs/paramiko.primes-module.html create mode 100644 docs/paramiko.primes-pysrc.html create mode 100644 docs/paramiko.primes.ModulusPack-class.html create mode 100644 docs/paramiko.resource-module.html create mode 100644 docs/paramiko.resource-pysrc.html create mode 100644 docs/paramiko.rng-module.html create mode 100644 docs/paramiko.rng-pysrc.html create mode 100644 docs/paramiko.rng.StrongLockingRandomPool-class.html create mode 100644 docs/paramiko.rng_posix-module.html create mode 100644 docs/paramiko.rng_posix-pysrc.html create mode 100644 docs/paramiko.rng_posix.error-class.html create mode 100644 docs/paramiko.rng_win32-module.html create mode 100644 docs/paramiko.rng_win32-pysrc.html create mode 100644 docs/paramiko.rng_win32.error-class.html create mode 100644 docs/paramiko.rsakey-module.html create mode 100644 docs/paramiko.rsakey-pysrc.html create mode 100644 docs/paramiko.server-module.html create mode 100644 docs/paramiko.server-pysrc.html create mode 100644 docs/paramiko.sftp-module.html create mode 100644 docs/paramiko.sftp-pysrc.html create mode 100644 docs/paramiko.sftp_attr-module.html create mode 100644 docs/paramiko.sftp_attr-pysrc.html create mode 100644 docs/paramiko.sftp_client-module.html create mode 100644 docs/paramiko.sftp_client-pysrc.html create mode 100644 docs/paramiko.sftp_file-module.html create mode 100644 docs/paramiko.sftp_file-pysrc.html create mode 100644 docs/paramiko.sftp_handle-module.html create mode 100644 docs/paramiko.sftp_handle-pysrc.html create mode 100644 docs/paramiko.sftp_server-module.html create mode 100644 docs/paramiko.sftp_server-pysrc.html create mode 100644 docs/paramiko.sftp_si-module.html create mode 100644 docs/paramiko.sftp_si-pysrc.html create mode 100644 docs/paramiko.ssh_exception-module.html create mode 100644 docs/paramiko.ssh_exception-pysrc.html create mode 100644 docs/paramiko.ssh_exception.PartialAuthentication-class.html create mode 100644 docs/paramiko.transport-module.html create mode 100644 docs/paramiko.transport-pysrc.html create mode 100644 docs/paramiko.transport.ChannelMap-class.html create mode 100644 docs/paramiko.util-module.html create mode 100644 docs/paramiko.util-pysrc.html create mode 100644 docs/paramiko.util.PFilter-class.html create mode 100644 docs/paramiko.util.enumerate-class.html create mode 100644 docs/paramiko.win_pageant-module.html create mode 100644 docs/paramiko.win_pageant-pysrc.html create mode 100644 docs/paramiko.win_pageant.PageantConnection-class.html delete mode 100644 docs/private/__builtin__.object-class.html delete mode 100644 docs/private/__builtin__.type-class.html delete mode 100644 docs/private/epydoc.css delete mode 100644 docs/private/exceptions.Exception-class.html delete mode 100644 docs/private/frames.html delete mode 100644 docs/private/help.html delete mode 100644 docs/private/index.html delete mode 100644 docs/private/indices.html delete mode 100644 docs/private/paramiko-module.html delete mode 100644 docs/private/paramiko.Agent-class.html delete mode 100644 docs/private/paramiko.AgentKey-class.html delete mode 100644 docs/private/paramiko.AuthHandler-class.html delete mode 100644 docs/private/paramiko.BadAuthenticationType-class.html delete mode 100644 docs/private/paramiko.BaseSFTP-class.html delete mode 100644 docs/private/paramiko.BufferedFile-class.html delete mode 100644 docs/private/paramiko.Channel-class.html delete mode 100644 docs/private/paramiko.ChannelFile-class.html delete mode 100644 docs/private/paramiko.DSSKey-class.html delete mode 100644 docs/private/paramiko.Message-class.html delete mode 100644 docs/private/paramiko.PKey-class.html delete mode 100644 docs/private/paramiko.Packetizer-class.html delete mode 100644 docs/private/paramiko.PasswordRequiredException-class.html delete mode 100644 docs/private/paramiko.RSAKey-class.html delete mode 100644 docs/private/paramiko.SFTP-class.html delete mode 100644 docs/private/paramiko.SFTPAttributes-class.html delete mode 100644 docs/private/paramiko.SFTPClient-class.html delete mode 100644 docs/private/paramiko.SFTPError-class.html delete mode 100644 docs/private/paramiko.SFTPFile-class.html delete mode 100644 docs/private/paramiko.SFTPHandle-class.html delete mode 100644 docs/private/paramiko.SFTPServer-class.html delete mode 100644 docs/private/paramiko.SFTPServerInterface-class.html delete mode 100644 docs/private/paramiko.SSHException-class.html delete mode 100644 docs/private/paramiko.SecurityOptions-class.html delete mode 100644 docs/private/paramiko.ServerInterface-class.html delete mode 100644 docs/private/paramiko.SubsystemHandler-class.html delete mode 100644 docs/private/paramiko.Transport-class.html delete mode 100644 docs/private/paramiko.agent-module.html delete mode 100644 docs/private/paramiko.auth_handler-module.html delete mode 100644 docs/private/paramiko.ber-module.html delete mode 100644 docs/private/paramiko.ber.BER-class.html delete mode 100644 docs/private/paramiko.ber.BERException-class.html delete mode 100644 docs/private/paramiko.channel-module.html delete mode 100644 docs/private/paramiko.channel.ChannelStderrFile-class.html delete mode 100644 docs/private/paramiko.common-module.html delete mode 100644 docs/private/paramiko.compress-module.html delete mode 100644 docs/private/paramiko.compress.ZlibCompressor-class.html delete mode 100644 docs/private/paramiko.compress.ZlibDecompressor-class.html delete mode 100644 docs/private/paramiko.dsskey-module.html delete mode 100644 docs/private/paramiko.file-module.html delete mode 100644 docs/private/paramiko.kex_gex-module.html delete mode 100644 docs/private/paramiko.kex_gex.KexGex-class.html delete mode 100644 docs/private/paramiko.kex_group1-module.html delete mode 100644 docs/private/paramiko.kex_group1.KexGroup1-class.html delete mode 100644 docs/private/paramiko.logging22-module.html delete mode 100644 docs/private/paramiko.logging22.Formatter-class.html delete mode 100644 docs/private/paramiko.logging22.StreamHandler-class.html delete mode 100644 docs/private/paramiko.logging22.logger-class.html delete mode 100644 docs/private/paramiko.message-module.html delete mode 100644 docs/private/paramiko.packet-module.html delete mode 100644 docs/private/paramiko.packet.NeedRekeyException-class.html delete mode 100644 docs/private/paramiko.pipe-module.html delete mode 100644 docs/private/paramiko.pipe.PosixPipe-class.html delete mode 100644 docs/private/paramiko.pipe.WindowsPipe-class.html delete mode 100644 docs/private/paramiko.pkey-module.html delete mode 100644 docs/private/paramiko.primes-module.html delete mode 100644 docs/private/paramiko.primes.ModulusPack-class.html delete mode 100644 docs/private/paramiko.rsakey-module.html delete mode 100644 docs/private/paramiko.server-module.html delete mode 100644 docs/private/paramiko.server.InteractiveQuery-class.html delete mode 100644 docs/private/paramiko.sftp-module.html delete mode 100644 docs/private/paramiko.sftp_attr-module.html delete mode 100644 docs/private/paramiko.sftp_client-module.html delete mode 100644 docs/private/paramiko.sftp_file-module.html delete mode 100644 docs/private/paramiko.sftp_handle-module.html delete mode 100644 docs/private/paramiko.sftp_server-module.html delete mode 100644 docs/private/paramiko.sftp_si-module.html delete mode 100644 docs/private/paramiko.ssh_exception-module.html delete mode 100644 docs/private/paramiko.ssh_exception.PartialAuthentication-class.html delete mode 100644 docs/private/paramiko.transport-module.html delete mode 100644 docs/private/paramiko.util-module.html delete mode 100644 docs/private/paramiko.util.PFilter-class.html delete mode 100644 docs/private/threading.Thread-class.html delete mode 100644 docs/private/threading._Verbose-class.html delete mode 100644 docs/private/toc-everything.html delete mode 100644 docs/private/toc-paramiko-module.html delete mode 100644 docs/private/toc-paramiko.agent-module.html delete mode 100644 docs/private/toc-paramiko.auth_handler-module.html delete mode 100644 docs/private/toc-paramiko.ber-module.html delete mode 100644 docs/private/toc-paramiko.channel-module.html delete mode 100644 docs/private/toc-paramiko.common-module.html delete mode 100644 docs/private/toc-paramiko.compress-module.html delete mode 100644 docs/private/toc-paramiko.dsskey-module.html delete mode 100644 docs/private/toc-paramiko.file-module.html delete mode 100644 docs/private/toc-paramiko.kex_gex-module.html delete mode 100644 docs/private/toc-paramiko.kex_group1-module.html delete mode 100644 docs/private/toc-paramiko.logging22-module.html delete mode 100644 docs/private/toc-paramiko.message-module.html delete mode 100644 docs/private/toc-paramiko.packet-module.html delete mode 100644 docs/private/toc-paramiko.pipe-module.html delete mode 100644 docs/private/toc-paramiko.pkey-module.html delete mode 100644 docs/private/toc-paramiko.primes-module.html delete mode 100644 docs/private/toc-paramiko.rsakey-module.html delete mode 100644 docs/private/toc-paramiko.server-module.html delete mode 100644 docs/private/toc-paramiko.sftp-module.html delete mode 100644 docs/private/toc-paramiko.sftp_attr-module.html delete mode 100644 docs/private/toc-paramiko.sftp_client-module.html delete mode 100644 docs/private/toc-paramiko.sftp_file-module.html delete mode 100644 docs/private/toc-paramiko.sftp_handle-module.html delete mode 100644 docs/private/toc-paramiko.sftp_server-module.html delete mode 100644 docs/private/toc-paramiko.sftp_si-module.html delete mode 100644 docs/private/toc-paramiko.ssh_exception-module.html delete mode 100644 docs/private/toc-paramiko.transport-module.html delete mode 100644 docs/private/toc-paramiko.util-module.html delete mode 100644 docs/private/toc.html delete mode 100644 docs/private/trees.html delete mode 100644 docs/public/__builtin__.object-class.html delete mode 100644 docs/public/__builtin__.type-class.html delete mode 100644 docs/public/epydoc.css delete mode 100644 docs/public/exceptions.Exception-class.html delete mode 100644 docs/public/frames.html delete mode 100644 docs/public/help.html delete mode 100644 docs/public/index.html delete mode 100644 docs/public/indices.html delete mode 100644 docs/public/paramiko-module.html delete mode 100644 docs/public/paramiko.Agent-class.html delete mode 100644 docs/public/paramiko.AgentKey-class.html delete mode 100644 docs/public/paramiko.BadAuthenticationType-class.html delete mode 100644 docs/public/paramiko.BufferedFile-class.html delete mode 100644 docs/public/paramiko.Channel-class.html delete mode 100644 docs/public/paramiko.DSSKey-class.html delete mode 100644 docs/public/paramiko.Message-class.html delete mode 100644 docs/public/paramiko.PasswordRequiredException-class.html delete mode 100644 docs/public/paramiko.RSAKey-class.html delete mode 100644 docs/public/paramiko.SFTP-class.html delete mode 100644 docs/public/paramiko.SFTPAttributes-class.html delete mode 100644 docs/public/paramiko.SFTPClient-class.html delete mode 100644 docs/public/paramiko.SFTPError-class.html delete mode 100644 docs/public/paramiko.SFTPFile-class.html delete mode 100644 docs/public/paramiko.SFTPHandle-class.html delete mode 100644 docs/public/paramiko.SFTPServer-class.html delete mode 100644 docs/public/paramiko.SSHException-class.html delete mode 100644 docs/public/paramiko.SecurityOptions-class.html delete mode 100644 docs/public/paramiko.SubsystemHandler-class.html delete mode 100644 docs/public/paramiko.Transport-class.html delete mode 100644 docs/public/paramiko.agent-module.html delete mode 100644 docs/public/paramiko.dsskey-module.html delete mode 100644 docs/public/paramiko.file-module.html delete mode 100644 docs/public/paramiko.message-module.html delete mode 100644 docs/public/paramiko.pkey-module.html delete mode 100644 docs/public/paramiko.rsakey-module.html delete mode 100644 docs/public/paramiko.server-module.html delete mode 100644 docs/public/paramiko.server.InteractiveQuery-class.html delete mode 100644 docs/public/paramiko.sftp-module.html delete mode 100644 docs/public/paramiko.sftp_attr-module.html delete mode 100644 docs/public/paramiko.sftp_client-module.html delete mode 100644 docs/public/paramiko.sftp_file-module.html delete mode 100644 docs/public/paramiko.sftp_handle-module.html delete mode 100644 docs/public/paramiko.sftp_server-module.html delete mode 100644 docs/public/paramiko.sftp_si-module.html delete mode 100644 docs/public/paramiko.transport-module.html delete mode 100644 docs/public/paramiko.util-module.html delete mode 100644 docs/public/paramiko.util.PFilter-class.html delete mode 100644 docs/public/threading.Thread-class.html delete mode 100644 docs/public/toc-everything.html delete mode 100644 docs/public/toc-paramiko-module.html delete mode 100644 docs/public/toc-paramiko.agent-module.html delete mode 100644 docs/public/toc-paramiko.dsskey-module.html delete mode 100644 docs/public/toc-paramiko.file-module.html delete mode 100644 docs/public/toc-paramiko.message-module.html delete mode 100644 docs/public/toc-paramiko.pkey-module.html delete mode 100644 docs/public/toc-paramiko.rsakey-module.html delete mode 100644 docs/public/toc-paramiko.server-module.html delete mode 100644 docs/public/toc-paramiko.sftp-module.html delete mode 100644 docs/public/toc-paramiko.sftp_attr-module.html delete mode 100644 docs/public/toc-paramiko.sftp_client-module.html delete mode 100644 docs/public/toc-paramiko.sftp_file-module.html delete mode 100644 docs/public/toc-paramiko.sftp_handle-module.html delete mode 100644 docs/public/toc-paramiko.sftp_server-module.html delete mode 100644 docs/public/toc-paramiko.sftp_si-module.html delete mode 100644 docs/public/toc-paramiko.transport-module.html delete mode 100644 docs/public/toc-paramiko.util-module.html delete mode 100644 docs/public/toc.html delete mode 100644 docs/public/trees.html create mode 100644 docs/redirect.html create mode 100644 docs/since-index.html create mode 100644 docs/toc-everything.html create mode 100644 docs/toc-paramiko-module.html create mode 100644 docs/toc-paramiko.agent-module.html create mode 100644 docs/toc-paramiko.auth_handler-module.html create mode 100644 docs/toc-paramiko.ber-module.html create mode 100644 docs/toc-paramiko.buffered_pipe-module.html create mode 100644 docs/toc-paramiko.channel-module.html create mode 100644 docs/toc-paramiko.client-module.html create mode 100644 docs/toc-paramiko.common-module.html create mode 100644 docs/toc-paramiko.compress-module.html create mode 100644 docs/toc-paramiko.config-module.html create mode 100644 docs/toc-paramiko.dsskey-module.html create mode 100644 docs/toc-paramiko.file-module.html create mode 100644 docs/toc-paramiko.hostkeys-module.html create mode 100644 docs/toc-paramiko.kex_gex-module.html create mode 100644 docs/toc-paramiko.kex_group1-module.html create mode 100644 docs/toc-paramiko.logging22-module.html create mode 100644 docs/toc-paramiko.message-module.html create mode 100644 docs/toc-paramiko.packet-module.html create mode 100644 docs/toc-paramiko.pipe-module.html create mode 100644 docs/toc-paramiko.pkey-module.html create mode 100644 docs/toc-paramiko.primes-module.html create mode 100644 docs/toc-paramiko.resource-module.html create mode 100644 docs/toc-paramiko.rng-module.html create mode 100644 docs/toc-paramiko.rng_posix-module.html create mode 100644 docs/toc-paramiko.rng_win32-module.html create mode 100644 docs/toc-paramiko.rsakey-module.html create mode 100644 docs/toc-paramiko.server-module.html create mode 100644 docs/toc-paramiko.sftp-module.html create mode 100644 docs/toc-paramiko.sftp_attr-module.html create mode 100644 docs/toc-paramiko.sftp_client-module.html create mode 100644 docs/toc-paramiko.sftp_file-module.html create mode 100644 docs/toc-paramiko.sftp_handle-module.html create mode 100644 docs/toc-paramiko.sftp_server-module.html create mode 100644 docs/toc-paramiko.sftp_si-module.html create mode 100644 docs/toc-paramiko.ssh_exception-module.html create mode 100644 docs/toc-paramiko.transport-module.html create mode 100644 docs/toc-paramiko.util-module.html create mode 100644 docs/toc-paramiko.win_pageant-module.html create mode 100644 docs/toc.html delete mode 100644 forward.py create mode 100644 paramiko.egg-info/PKG-INFO create mode 100644 paramiko.egg-info/SOURCES.txt create mode 100644 paramiko.egg-info/dependency_links.txt create mode 100644 paramiko.egg-info/requires.txt create mode 100644 paramiko.egg-info/top_level.txt create mode 100644 paramiko/buffered_pipe.py create mode 100644 paramiko/client.py create mode 100644 paramiko/config.py create mode 100644 paramiko/hostkeys.py create mode 100644 paramiko/resource.py create mode 100644 paramiko/rng.py create mode 100644 paramiko/rng_posix.py create mode 100644 paramiko/rng_win32.py create mode 100644 paramiko/win_pageant.py create mode 100644 setup.cfg create mode 100644 setup_helper.py mode change 100644 => 100755 test.py create mode 100644 tests/test_auth.py create mode 100644 tests/test_buffered_pipe.py create mode 100644 tests/test_client.py mode change 100644 => 100755 tests/test_file.py create mode 100644 tests/test_hostkeys.py mode change 100644 => 100755 tests/test_sftp.py create mode 100644 tests/test_sftp_big.py diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..e718ea2 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,4 @@ +include LICENSE test.py setup_helper.py +recursive-include docs * +recursive-include tests *.py *.key +recursive-include demos *.py *.key user_rsa_key user_rsa_key.pub diff --git a/PKG-INFO b/PKG-INFO index a0ec679..f40d53f 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,12 +1,12 @@ Metadata-Version: 1.0 Name: paramiko -Version: 1.5.2 +Version: 1.7.4 Summary: SSH2 protocol library Home-page: http://www.lag.net/paramiko/ Author: Robey Pointer Author-email: robey@lag.net License: LGPL -Download-URL: http://www.lag.net/paramiko/download/paramiko-1.5.2.zip +Download-URL: http://www.lag.net/paramiko/download/paramiko-1.7.4.zip 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 @@ -14,7 +14,7 @@ Description: are supported. SFTP client and server mode are both supported too. Required packages: - pyCrypt + pyCrypto Platform: Posix; MacOS X; Windows Classifier: Development Status :: 5 - Production/Stable diff --git a/README b/README index 45997ac..6a4c69d 100644 --- a/README +++ b/README @@ -1,12 +1,22 @@ -paramiko 1.5.2 -"rhydon" release, 04 dec 2005 -Copyright (c) 2003-2005 Robey Pointer +======== +paramiko +======== -http://www.lag.net/paramiko/ +:Paramiko: Python SSH module +:Copyright: Copyright (c) 2003-2008 Robey Pointer +:License: LGPL +:Homepage: http://www.lag.net/paramiko/ -*** WHAT +paramiko 1.7.4 +============== + +"Desmond" release, 06 july 2008 + + +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 @@ -25,97 +35,124 @@ the package and its API is fairly well documented in the "doc/" folder that should have come with this archive. -*** REQUIREMENTS +Requirements +------------ -python 2.3 + - python 2.3 (python 2.2 is also supported, but not recommended) -pycrypto 1.9+ + - pycrypto 1.9+ (2.0 works too) pycrypto compiled for Win32 can be downloaded from the HashTar homepage: http://nitace.bsd.uchicago.edu:8080/hashtar + you can also build it yourself using the free MinGW tools and this command -line (thanks to Roger Binns for the info): +line (thanks to Roger Binns for the info):: + python setup.py build --compiler=mingw32 bdist_wininst +If you have setuptools, you can build and install paramiko and all its +dependencies with this command (as root):: -*** PORTABILITY + easy_install ./ + + +Portability +----------- i code and test this library on Linux and MacOS X. for that reason, i'm -pretty sure that it works for all posix platforms, including MacOS. i -also think it will work on Windows, though i've never tested it there. if -you run into Windows problems, send me a patch: portability is important +pretty sure that it works for all posix platforms, including MacOS. it +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 + + * 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: +missing encodings, you'll see an error like this:: -LookupError: no codec search functions registered: can't find encoding + LookupError: no codec search functions registered: can't find encoding this means you need to copy string encodings over from a working system. (it probably only happens on embedded systems, not normal python -installls.) -Valeriy Pogrebitskiy says the best place to look is -'.../lib/python*/encodings/__init__.py'. +installs.) Valeriy Pogrebitskiy says the best place to look is +``.../lib/python*/encodings/__init__.py``. + +Bugs & Support +-------------- -*** DEMO +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 + + +Demo +---- several demo scripts come with paramiko to demonstrate how to use it. -probably the simplest demo of all is this: +probably the simplest demo of all is this:: import paramiko, base64 key = paramiko.RSAKey(data=base64.decodestring('AAA...')) - t = paramiko.Transport('ssh.example.com') - t.connect(username='strongbad', password='thecheat', hostkey=key) - chan = t.open_session() - chan.exec_command('ls') - for line in chan.makefile('r+'): + client = paramiko.SSHClient() + client.get_host_keys().add('ssh.example.com', 'ssh-rsa', key) + client.connect('ssh.example.com', username='strongbad', password='thecheat') + stdin, stdout, stderr = client.exec_command('ls') + for line in stdout: print '... ' + line.strip('\n') - chan.close() - t.close() + client.close() -...which prints out the results of executing 'ls' on a remote server. +...which prints out the results of executing ``ls`` on a remote server. (the host key 'AAA...' should of course be replaced by the actual base64 encoding of the host key. if you skip host key verification, the connection is not secure!) -the following example scripts get progressively more detailed: +the following example scripts (in demos/) get progressively more detailed: -demo_simple.py +:demo_simple.py: calls invoke_shell() and emulates a terminal/tty through which you can execute commands interactively on a remote server. think of it as a poor man's ssh command-line client. -demo.py +:demo.py: same as demo_simple.py, but allows you to authenticiate using a private key, attempts to use an SSH-agent if present, and uses the long form of some of the API calls. -forward.py +:forward.py: command-line script to set up port-forwarding across an ssh transport. (requires python 2.3.) -demo_server.py +:demo_sftp.py: + opens an sftp session and does a few simple file operations. + +:demo_server.py: an ssh server that listens on port 2200 and accepts a login for 'robey' (password 'foo'), and pretends to be a BBS. meant to be a very simple demo of writing an ssh server. -*** USE +Use +--- the demo scripts are probably the best example of how to use this package. there is also a lot of documentation, generated with epydoc, in the doc/ @@ -123,126 +160,8 @@ folder. point your browser there. seriously, do it. mad props to epydoc, which actually motivated me to write more documentation than i ever would have before. -there are also unit tests here: +there are also unit tests here:: + $ python ./test.py -which will verify that some of the core components are working correctly. -not much is tested yet, but it's a start. the tests for SFTP are probably -the best and easiest examples of how to use the SFTP class. - - -*** WHAT'S NEW - -highlights of what's new in each release: - -v1.5.2 RHYDON -* 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 -* 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 -* 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 -* 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 -* 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 -* 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 -* 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 -* 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 -* 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 - - -*** MISSING LINKS - -* host-based auth (yuck!) -* SFTP implicit file locking? -* ChannelException like the java version has -* would be nice to have windows putty "pagent" support -- looks very hard - -* ctr forms of ciphers are missing (blowfish-ctr, aes128-ctr, aes256-ctr) -* sftp protocol 6 support (ugh....) -- once it settles down more - -* make a simple example demonstrating use of SocketServer (besides forward.py?) - -* make a function to parse .ssh/config files: - User, Hostname, Port, ProxyCommand, IdentityFile, HostKeyAlias - ProxyCommand: %h = host, %p = port, "none" = disable + +which will verify that most of the core components are working correctly. diff --git a/demo.py b/demo.py deleted file mode 100644 index a02e886..0000000 --- a/demo.py +++ /dev/null @@ -1,210 +0,0 @@ -#!/usr/bin/python - -# Copyright (C) 2003-2005 Robey Pointer -# -# 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. - - -# ----- WINDOWS USERS PLEASE NOTE ----- -# This demo won't work on Windows because it uses pseudo-terminals, which -# are a posix-only feature. check out the README file for a simpler demo. - - -import sys, os, socket, threading, getpass, time, base64, select, termios, tty, traceback -import paramiko - - -##### utility functions - -def agent_auth(username, t, event): - agent = paramiko.Agent() - agent_keys = agent.get_keys() - if len(agent_keys) > 0: - for key in agent_keys: - print 'Trying ssh-agent key %s' % paramiko.util.hexify(key.get_fingerprint()), - t.auth_publickey(username, key, event) - event.wait(10) - if t.is_authenticated(): - print '... success!' - return - print '... nope.' - -def manual_auth(username, hostname, event): - default_auth = 'p' - auth = raw_input('Auth by (p)assword, (r)sa key, or (d)ss key? [%s] ' % default_auth) - if len(auth) == 0: - auth = default_auth - - if auth == 'r': - default_path = os.environ['HOME'] + '/.ssh/id_rsa' - path = raw_input('RSA key [%s]: ' % default_path) - if len(path) == 0: - path = default_path - try: - key = paramiko.RSAKey.from_private_key_file(path) - except paramiko.PasswordRequiredException: - password = getpass.getpass('RSA key password: ') - key = paramiko.RSAKey.from_private_key_file(path, password) - t.auth_publickey(username, key, event) - elif auth == 'd': - default_path = os.environ['HOME'] + '/.ssh/id_dsa' - path = raw_input('DSS key [%s]: ' % default_path) - if len(path) == 0: - path = default_path - try: - key = paramiko.DSSKey.from_private_key_file(path) - except paramiko.PasswordRequiredException: - password = getpass.getpass('DSS key password: ') - key = paramiko.DSSKey.from_private_key_file(path, password) - t.auth_publickey(username, key, event) - else: - pw = getpass.getpass('Password for %s@%s: ' % (username, hostname)) - t.auth_password(username, pw, event) - - -##### main demo - -# setup logging -paramiko.util.log_to_file('demo.log') - - -username = '' -if len(sys.argv) > 1: - hostname = sys.argv[1] - if hostname.find('@') >= 0: - username, hostname = hostname.split('@') -else: - hostname = raw_input('Hostname: ') -if len(hostname) == 0: - print '*** Hostname required.' - sys.exit(1) -port = 22 -if hostname.find(':') >= 0: - hostname, portstr = hostname.split(':') - port = int(portstr) - -# now connect -try: - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.connect((hostname, port)) -except Exception, e: - print '*** Connect failed: ' + str(e) - traceback.print_exc() - sys.exit(1) - -try: - event = threading.Event() - t = paramiko.Transport(sock) - t.start_client(event) - # print repr(t) - event.wait(15) - if not t.is_active(): - print '*** SSH negotiation failed.' - sys.exit(1) - # print repr(t) - - try: - keys = paramiko.util.load_host_keys(os.path.expanduser('~/.ssh/known_hosts')) - except IOError: - try: - keys = paramiko.util.load_host_keys(os.path.expanduser('~/ssh/known_hosts')) - except IOError: - print '*** Unable to open host keys file' - keys = {} - - key = t.get_remote_server_key() - if not keys.has_key(hostname): - print '*** WARNING: Unknown host key!' - elif not keys[hostname].has_key(key.get_name()): - print '*** WARNING: Unknown host key!' - elif keys[hostname][key.get_name()] != key: - print '*** WARNING: Host key has changed!!!' - sys.exit(1) - else: - print '*** Host key OK.' - - event.clear() - - # get username - if username == '': - default_username = getpass.getuser() - username = raw_input('Username [%s]: ' % default_username) - if len(username) == 0: - username = default_username - - agent_auth(username, t, event) - - # ask for what kind of authentication to try - if not t.is_authenticated(): - manual_auth(username, hostname, event) - - event.wait(10) - # print repr(t) - if not t.is_authenticated(): - print '*** Authentication failed. :(' - t.close() - sys.exit(1) - - chan = t.open_session() - chan.get_pty() - chan.invoke_shell() - print '*** Here we go!' - print - - try: - oldtty = termios.tcgetattr(sys.stdin) - tty.setraw(sys.stdin.fileno()) - tty.setcbreak(sys.stdin.fileno()) - chan.settimeout(0.0) - - while 1: - r, w, e = select.select([chan, sys.stdin], [], []) - if chan in r: - try: - x = chan.recv(1024) - if len(x) == 0: - print - print '*** EOF\r\n', - break - sys.stdout.write(x) - sys.stdout.flush() - except socket.timeout: - pass - if sys.stdin in r: - # FIXME: reading 1 byte at a time is incredibly dumb. - x = sys.stdin.read(1) - if len(x) == 0: - print - print '*** Bye.\r\n', - break - chan.send(x) - - finally: - termios.tcsetattr(sys.stdin, termios.TCSADRAIN, oldtty) - - chan.close() - t.close() - -except Exception, e: - print '*** Caught exception: ' + str(e.__class__) + ': ' + str(e) - traceback.print_exc() - try: - t.close() - except: - pass - sys.exit(1) - diff --git a/demo_server.py b/demo_server.py deleted file mode 100644 index 599eb46..0000000 --- a/demo_server.py +++ /dev/null @@ -1,138 +0,0 @@ -#!/usr/bin/python - -# Copyright (C) 2003-2005 Robey Pointer -# -# 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. - -import sys, os, socket, threading, traceback, base64 -import paramiko - -# setup logging -paramiko.util.log_to_file('demo_server.log') - -#host_key = paramiko.RSAKey(filename='tests/test_rsa.key') -host_key = paramiko.DSSKey(filename='tests/test_dss.key') - -print 'Read key: ' + paramiko.util.hexify(host_key.get_fingerprint()) - - -class Server (paramiko.ServerInterface): - # 'data' is the output of base64.encodestring(str(key)) - data = 'AAAAB3NzaC1yc2EAAAABIwAAAIEAyO4it3fHlmGZWJaGrfeHOVY7RWO3P9M7hpfAu7jJ2d7eothvfeuoRFtJwhUmZDluRdFyhFY/hFAh76PJKGAusIqIQKlkJxMCKDqIexkgHAfID/6mqvmnSJf0b5W8v5h2pI/stOSwTQ+pxVhwJ9ctYDhRSlF0iTUWT10hcuO4Ks8=' - good_pub_key = paramiko.RSAKey(data=base64.decodestring(data)) - - def __init__(self): - self.event = threading.Event() - - def check_channel_request(self, kind, chanid): - if kind == 'session': - return paramiko.OPEN_SUCCEEDED - return paramiko.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED - - def check_auth_password(self, username, password): - if (username == 'robey') and (password == 'foo'): - return paramiko.AUTH_SUCCESSFUL - return paramiko.AUTH_FAILED - - def check_auth_publickey(self, username, key): - print 'Auth attempt with key: ' + paramiko.util.hexify(key.get_fingerprint()) - if (username == 'robey') and (key == self.good_pub_key): - return paramiko.AUTH_SUCCESSFUL - return paramiko.AUTH_FAILED - - def get_allowed_auths(self, username): - return 'password,publickey' - - def check_channel_shell_request(self, channel): - self.event.set() - return True - - def check_channel_pty_request(self, channel, term, width, height, pixelwidth, - pixelheight, modes): - return True - - -# now connect -try: - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - sock.bind(('', 2200)) -except Exception, e: - print '*** Bind failed: ' + str(e) - traceback.print_exc() - sys.exit(1) - -try: - sock.listen(100) - print 'Listening for connection ...' - client, addr = sock.accept() -except Exception, e: - print '*** Listen/accept failed: ' + str(e) - traceback.print_exc() - sys.exit(1) - -print 'Got a connection!' - -try: - event = threading.Event() - t = paramiko.Transport(client) - try: - t.load_server_moduli() - except: - print '(Failed to load moduli -- gex will be unsupported.)' - raise - t.add_server_key(host_key) - server = Server() - t.start_server(event, server) - while 1: - event.wait(0.1) - if not t.is_active(): - print '*** SSH negotiation failed.' - sys.exit(1) - if event.isSet(): - break - # print repr(t) - - # wait for auth - chan = t.accept(20) - if chan is None: - print '*** No channel.' - sys.exit(1) - print 'Authenticated!' - server.event.wait(10) - if not server.event.isSet(): - print '*** Client never asked for a shell.' - sys.exit(1) - - chan.send('\r\n\r\nWelcome to my dorky little BBS!\r\n\r\n') - chan.send('We are on fire all the time! Hooray! Candy corn for everyone!\r\n') - chan.send('Happy birthday to Robot Dave!\r\n\r\n') - chan.send('Username: ') - f = chan.makefile('rU') - username = f.readline().strip('\r\n') - chan.send('\r\nI don\'t like you, ' + username + '.\r\n') - chan.close() - -except Exception, e: - print '*** Caught exception: ' + str(e.__class__) + ': ' + str(e) - traceback.print_exc() - try: - t.close() - except: - pass - sys.exit(1) - diff --git a/demo_simple.py b/demo_simple.py deleted file mode 100644 index 655a1a4..0000000 --- a/demo_simple.py +++ /dev/null @@ -1,128 +0,0 @@ -#!/usr/bin/python - -# Copyright (C) 2003-2005 Robey Pointer -# -# 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. - - -# ----- WINDOWS USERS PLEASE NOTE ----- -# This demo won't work on Windows because it uses pseudo-terminals, which -# are a posix-only feature. check out the README file for a simpler demo. - - -import sys, os, base64, getpass, socket, traceback, termios, tty, select -import paramiko - - -# setup logging -paramiko.util.log_to_file('demo_simple.log') - -# get hostname -username = '' -if len(sys.argv) > 1: - hostname = sys.argv[1] - if hostname.find('@') >= 0: - username, hostname = hostname.split('@') -else: - hostname = raw_input('Hostname: ') -if len(hostname) == 0: - print '*** Hostname required.' - sys.exit(1) -port = 22 -if hostname.find(':') >= 0: - hostname, portstr = hostname.split(':') - port = int(portstr) - - -# get username -if username == '': - default_username = getpass.getuser() - username = raw_input('Username [%s]: ' % default_username) - if len(username) == 0: - username = default_username -password = getpass.getpass('Password for %s@%s: ' % (username, hostname)) - - -# get host key, if we know one -hostkeytype = None -hostkey = None -try: - hkeys = paramiko.util.load_host_keys(os.path.expanduser('~/.ssh/known_hosts')) -except IOError: - try: - hkeys = paramiko.util.load_host_keys(os.path.expanduser('~/ssh/known_hosts')) - except IOError: - print '*** Unable to open host keys file' - hkeys = {} - -if hkeys.has_key(hostname): - hostkeytype = hkeys[hostname].keys()[0] - hostkey = hkeys[hostname][hostkeytype] - print 'Using host key of type %s' % hostkeytype - - -# now, connect and use paramiko Transport to negotiate SSH2 across the connection -try: - t = paramiko.Transport((hostname, port)) - t.connect(username=username, password=password, hostkey=hostkey) - chan = t.open_session() - chan.get_pty() - chan.invoke_shell() - print '*** Here we go!' - print - - try: - oldtty = termios.tcgetattr(sys.stdin) - tty.setraw(sys.stdin.fileno()) - tty.setcbreak(sys.stdin.fileno()) - chan.settimeout(0.0) - - while True: - r, w, e = select.select([chan, sys.stdin], [], []) - if chan in r: - try: - x = chan.recv(1024) - if len(x) == 0: - print '\r\n*** EOF\r\n', - break - sys.stdout.write(x) - sys.stdout.flush() - except socket.timeout: - pass - if sys.stdin in r: - # FIXME: reading 1 byte at a time is incredibly dumb. - x = sys.stdin.read(1) - if len(x) == 0: - print - print '*** Bye.\r\n', - break - chan.send(x) - - finally: - termios.tcsetattr(sys.stdin, termios.TCSADRAIN, oldtty) - - chan.close() - t.close() - -except Exception, e: - print '*** Caught exception: %s: %s' % (e.__class__, e) - traceback.print_exc() - try: - t.close() - except: - pass - sys.exit(1) diff --git a/demos/demo.py b/demos/demo.py new file mode 100755 index 0000000..c8346ce --- /dev/null +++ b/demos/demo.py @@ -0,0 +1,180 @@ +#!/usr/bin/env python + +# Copyright (C) 2003-2007 Robey Pointer +# +# 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. + + +import base64 +from binascii import hexlify +import getpass +import os +import select +import socket +import sys +import threading +import time +import traceback + +import paramiko +import interactive + + +def agent_auth(transport, username): + """ + Attempt to authenticate to the given transport using any of the private + keys available from an SSH agent. + """ + + agent = paramiko.Agent() + agent_keys = agent.get_keys() + if len(agent_keys) == 0: + return + + for key in agent_keys: + print 'Trying ssh-agent key %s' % hexlify(key.get_fingerprint()), + try: + transport.auth_publickey(username, key) + print '... success!' + return + except paramiko.SSHException: + print '... nope.' + + +def manual_auth(username, hostname): + default_auth = 'p' + auth = raw_input('Auth by (p)assword, (r)sa key, or (d)ss key? [%s] ' % default_auth) + if len(auth) == 0: + auth = default_auth + + if auth == 'r': + default_path = os.path.join(os.environ['HOME'], '.ssh', 'id_rsa') + path = raw_input('RSA key [%s]: ' % default_path) + if len(path) == 0: + path = default_path + try: + key = paramiko.RSAKey.from_private_key_file(path) + except paramiko.PasswordRequiredException: + password = getpass.getpass('RSA key password: ') + key = paramiko.RSAKey.from_private_key_file(path, password) + t.auth_publickey(username, key) + elif auth == 'd': + default_path = os.path.join(os.environ['HOME'], '.ssh', 'id_dsa') + path = raw_input('DSS key [%s]: ' % default_path) + if len(path) == 0: + path = default_path + try: + key = paramiko.DSSKey.from_private_key_file(path) + except paramiko.PasswordRequiredException: + password = getpass.getpass('DSS key password: ') + key = paramiko.DSSKey.from_private_key_file(path, password) + t.auth_publickey(username, key) + else: + pw = getpass.getpass('Password for %s@%s: ' % (username, hostname)) + t.auth_password(username, pw) + + +# setup logging +paramiko.util.log_to_file('demo.log') + +username = '' +if len(sys.argv) > 1: + hostname = sys.argv[1] + if hostname.find('@') >= 0: + username, hostname = hostname.split('@') +else: + hostname = raw_input('Hostname: ') +if len(hostname) == 0: + print '*** Hostname required.' + sys.exit(1) +port = 22 +if hostname.find(':') >= 0: + hostname, portstr = hostname.split(':') + port = int(portstr) + +# now connect +try: + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + sock.connect((hostname, port)) +except Exception, e: + print '*** Connect failed: ' + str(e) + traceback.print_exc() + sys.exit(1) + +try: + t = paramiko.Transport(sock) + try: + t.start_client() + except paramiko.SSHException: + print '*** SSH negotiation failed.' + sys.exit(1) + + try: + keys = paramiko.util.load_host_keys(os.path.expanduser('~/.ssh/known_hosts')) + except IOError: + try: + keys = paramiko.util.load_host_keys(os.path.expanduser('~/ssh/known_hosts')) + except IOError: + print '*** Unable to open host keys file' + keys = {} + + # check server's host key -- this is important. + key = t.get_remote_server_key() + if not keys.has_key(hostname): + print '*** WARNING: Unknown host key!' + elif not keys[hostname].has_key(key.get_name()): + print '*** WARNING: Unknown host key!' + elif keys[hostname][key.get_name()] != key: + print '*** WARNING: Host key has changed!!!' + sys.exit(1) + else: + print '*** Host key OK.' + + # get username + if username == '': + default_username = getpass.getuser() + username = raw_input('Username [%s]: ' % default_username) + if len(username) == 0: + username = default_username + + agent_auth(t, username) + if not t.is_authenticated(): + manual_auth(username, hostname) + if not t.is_authenticated(): + print '*** Authentication failed. :(' + t.close() + sys.exit(1) + + chan = t.open_session() + chan.get_pty() + chan.invoke_shell() + print '*** Here we go!' + print + interactive.interactive_shell(chan) + chan.close() + t.close() + +except Exception, e: + print '*** Caught exception: ' + str(e.__class__) + ': ' + str(e) + traceback.print_exc() + try: + t.close() + except: + pass + sys.exit(1) + + diff --git a/demos/demo_server.py b/demos/demo_server.py new file mode 100755 index 0000000..e7b0e61 --- /dev/null +++ b/demos/demo_server.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python + +# Copyright (C) 2003-2007 Robey Pointer +# +# 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. + +import base64 +from binascii import hexlify +import os +import socket +import sys +import threading +import traceback + +import paramiko + + +# setup logging +paramiko.util.log_to_file('demo_server.log') + +host_key = paramiko.RSAKey(filename='test_rsa.key') +#host_key = paramiko.DSSKey(filename='test_dss.key') + +print 'Read key: ' + hexlify(host_key.get_fingerprint()) + + +class Server (paramiko.ServerInterface): + # 'data' is the output of base64.encodestring(str(key)) + # (using the "user_rsa_key" files) + data = 'AAAAB3NzaC1yc2EAAAABIwAAAIEAyO4it3fHlmGZWJaGrfeHOVY7RWO3P9M7hp' + \ + 'fAu7jJ2d7eothvfeuoRFtJwhUmZDluRdFyhFY/hFAh76PJKGAusIqIQKlkJxMC' + \ + 'KDqIexkgHAfID/6mqvmnSJf0b5W8v5h2pI/stOSwTQ+pxVhwJ9ctYDhRSlF0iT' + \ + 'UWT10hcuO4Ks8=' + good_pub_key = paramiko.RSAKey(data=base64.decodestring(data)) + + def __init__(self): + self.event = threading.Event() + + def check_channel_request(self, kind, chanid): + if kind == 'session': + return paramiko.OPEN_SUCCEEDED + return paramiko.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED + + def check_auth_password(self, username, password): + if (username == 'robey') and (password == 'foo'): + return paramiko.AUTH_SUCCESSFUL + return paramiko.AUTH_FAILED + + def check_auth_publickey(self, username, key): + print 'Auth attempt with key: ' + hexlify(key.get_fingerprint()) + if (username == 'robey') and (key == self.good_pub_key): + return paramiko.AUTH_SUCCESSFUL + return paramiko.AUTH_FAILED + + def get_allowed_auths(self, username): + return 'password,publickey' + + def check_channel_shell_request(self, channel): + self.event.set() + return True + + def check_channel_pty_request(self, channel, term, width, height, pixelwidth, + pixelheight, modes): + return True + + +# now connect +try: + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + sock.bind(('', 2200)) +except Exception, e: + print '*** Bind failed: ' + str(e) + traceback.print_exc() + sys.exit(1) + +try: + sock.listen(100) + print 'Listening for connection ...' + client, addr = sock.accept() +except Exception, e: + print '*** Listen/accept failed: ' + str(e) + traceback.print_exc() + sys.exit(1) + +print 'Got a connection!' + +try: + t = paramiko.Transport(client) + try: + t.load_server_moduli() + except: + print '(Failed to load moduli -- gex will be unsupported.)' + raise + t.add_server_key(host_key) + server = Server() + try: + t.start_server(server=server) + except paramiko.SSHException, x: + print '*** SSH negotiation failed.' + sys.exit(1) + + # wait for auth + chan = t.accept(20) + if chan is None: + print '*** No channel.' + sys.exit(1) + print 'Authenticated!' + + server.event.wait(10) + if not server.event.isSet(): + print '*** Client never asked for a shell.' + sys.exit(1) + + chan.send('\r\n\r\nWelcome to my dorky little BBS!\r\n\r\n') + chan.send('We are on fire all the time! Hooray! Candy corn for everyone!\r\n') + chan.send('Happy birthday to Robot Dave!\r\n\r\n') + chan.send('Username: ') + f = chan.makefile('rU') + username = f.readline().strip('\r\n') + chan.send('\r\nI don\'t like you, ' + username + '.\r\n') + chan.close() + +except Exception, e: + print '*** Caught exception: ' + str(e.__class__) + ': ' + str(e) + traceback.print_exc() + try: + t.close() + except: + pass + sys.exit(1) + diff --git a/demos/demo_sftp.py b/demos/demo_sftp.py new file mode 100755 index 0000000..a823fb3 --- /dev/null +++ b/demos/demo_sftp.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python + +# Copyright (C) 2003-2007 Robey Pointer +# +# 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. + +# based on code provided by raymond mosteller (thanks!) + +import base64 +import getpass +import os +import socket +import sys +import traceback + +import paramiko + + +# setup logging +paramiko.util.log_to_file('demo_sftp.log') + +# get hostname +username = '' +if len(sys.argv) > 1: + hostname = sys.argv[1] + if hostname.find('@') >= 0: + username, hostname = hostname.split('@') +else: + hostname = raw_input('Hostname: ') +if len(hostname) == 0: + print '*** Hostname required.' + sys.exit(1) +port = 22 +if hostname.find(':') >= 0: + hostname, portstr = hostname.split(':') + port = int(portstr) + + +# get username +if username == '': + default_username = getpass.getuser() + username = raw_input('Username [%s]: ' % default_username) + if len(username) == 0: + username = default_username +password = getpass.getpass('Password for %s@%s: ' % (username, hostname)) + + +# get host key, if we know one +hostkeytype = None +hostkey = None +try: + host_keys = paramiko.util.load_host_keys(os.path.expanduser('~/.ssh/known_hosts')) +except IOError: + try: + # try ~/ssh/ too, because windows can't have a folder named ~/.ssh/ + host_keys = paramiko.util.load_host_keys(os.path.expanduser('~/ssh/known_hosts')) + except IOError: + print '*** Unable to open host keys file' + host_keys = {} + +if host_keys.has_key(hostname): + hostkeytype = host_keys[hostname].keys()[0] + hostkey = host_keys[hostname][hostkeytype] + print 'Using host key of type %s' % hostkeytype + + +# now, connect and use paramiko Transport to negotiate SSH2 across the connection +try: + t = paramiko.Transport((hostname, port)) + t.connect(username=username, password=password, hostkey=hostkey) + sftp = paramiko.SFTPClient.from_transport(t) + + # dirlist on remote host + dirlist = sftp.listdir('.') + print "Dirlist:", dirlist + + # copy this demo onto the server + try: + sftp.mkdir("demo_sftp_folder") + except IOError: + print '(assuming demo_sftp_folder/ already exists)' + sftp.open('demo_sftp_folder/README', 'w').write('This was created by demo_sftp.py.\n') + data = open('demo_sftp.py', 'r').read() + sftp.open('demo_sftp_folder/demo_sftp.py', 'w').write(data) + print 'created demo_sftp_folder/ on the server' + + # copy the README back here + data = sftp.open('demo_sftp_folder/README', 'r').read() + open('README_demo_sftp', 'w').write(data) + print 'copied README back here' + + # BETTER: use the get() and put() methods + sftp.put('demo_sftp.py', 'demo_sftp_folder/demo_sftp.py') + sftp.get('demo_sftp_folder/README', 'README_demo_sftp') + + t.close() + +except Exception, e: + print '*** Caught exception: %s: %s' % (e.__class__, e) + traceback.print_exc() + try: + t.close() + except: + pass + sys.exit(1) diff --git a/demos/demo_simple.py b/demos/demo_simple.py new file mode 100755 index 0000000..5bcc214 --- /dev/null +++ b/demos/demo_simple.py @@ -0,0 +1,101 @@ +#!/usr/bin/env python + +# Copyright (C) 2003-2007 Robey Pointer +# +# 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. + + +import base64 +import getpass +import os +import socket +import sys +import traceback + +import paramiko +import interactive + + +# setup logging +paramiko.util.log_to_file('demo_simple.log') + +# get hostname +username = '' +if len(sys.argv) > 1: + hostname = sys.argv[1] + if hostname.find('@') >= 0: + username, hostname = hostname.split('@') +else: + hostname = raw_input('Hostname: ') +if len(hostname) == 0: + print '*** Hostname required.' + sys.exit(1) +port = 22 +if hostname.find(':') >= 0: + hostname, portstr = hostname.split(':') + port = int(portstr) + + +# get username +if username == '': + default_username = getpass.getuser() + username = raw_input('Username [%s]: ' % default_username) + if len(username) == 0: + username = default_username +password = getpass.getpass('Password for %s@%s: ' % (username, hostname)) + + +# get host key, if we know one +hostkeytype = None +hostkey = None +try: + host_keys = paramiko.util.load_host_keys(os.path.expanduser('~/.ssh/known_hosts')) +except IOError: + try: + # try ~/ssh/ too, because windows can't have a folder named ~/.ssh/ + host_keys = paramiko.util.load_host_keys(os.path.expanduser('~/ssh/known_hosts')) + except IOError: + print '*** Unable to open host keys file' + host_keys = {} + +if host_keys.has_key(hostname): + hostkeytype = host_keys[hostname].keys()[0] + hostkey = host_keys[hostname][hostkeytype] + print 'Using host key of type %s' % hostkeytype + + +# now, connect and use paramiko Transport to negotiate SSH2 across the connection +try: + t = paramiko.Transport((hostname, port)) + t.connect(username=username, password=password, hostkey=hostkey) + chan = t.open_session() + chan.get_pty() + chan.invoke_shell() + print '*** Here we go!' + print + interactive.interactive_shell(chan) + chan.close() + t.close() + +except Exception, e: + print '*** Caught exception: %s: %s' % (e.__class__, e) + traceback.print_exc() + try: + t.close() + except: + pass + sys.exit(1) diff --git a/demos/forward.py b/demos/forward.py new file mode 100755 index 0000000..33c98ab --- /dev/null +++ b/demos/forward.py @@ -0,0 +1,180 @@ +#!/usr/bin/env python + +# Copyright (C) 2003-2007 Robey Pointer +# +# 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. + +""" +Sample script showing how to do local port forwarding over paramiko. + +This script connects to the requested SSH server and sets up local port +forwarding (the openssh -L option) from a local port through a tunneled +connection to a destination reachable from the SSH server machine. +""" + +import getpass +import os +import socket +import select +import SocketServer +import sys +from optparse import OptionParser + +import paramiko + +SSH_PORT = 22 +DEFAULT_PORT = 4000 + +g_verbose = True + + +class ForwardServer (SocketServer.ThreadingTCPServer): + daemon_threads = True + allow_reuse_address = True + + +class Handler (SocketServer.BaseRequestHandler): + + def handle(self): + try: + chan = self.ssh_transport.open_channel('direct-tcpip', + (self.chain_host, self.chain_port), + self.request.getpeername()) + except Exception, e: + verbose('Incoming request to %s:%d failed: %s' % (self.chain_host, + self.chain_port, + repr(e))) + return + if chan is None: + verbose('Incoming request to %s:%d was rejected by the SSH server.' % + (self.chain_host, self.chain_port)) + return + + verbose('Connected! Tunnel open %r -> %r -> %r' % (self.request.getpeername(), + chan.getpeername(), (self.chain_host, self.chain_port))) + while True: + r, w, x = select.select([self.request, chan], [], []) + if self.request in r: + data = self.request.recv(1024) + if len(data) == 0: + break + chan.send(data) + if chan in r: + data = chan.recv(1024) + if len(data) == 0: + break + self.request.send(data) + chan.close() + self.request.close() + verbose('Tunnel closed from %r' % (self.request.getpeername(),)) + + +def forward_tunnel(local_port, remote_host, remote_port, transport): + # this is a little convoluted, but lets me configure things for the Handler + # object. (SocketServer doesn't give Handlers any way to access the outer + # server normally.) + class SubHander (Handler): + chain_host = remote_host + chain_port = remote_port + ssh_transport = transport + ForwardServer(('', local_port), SubHander).serve_forever() + + +def verbose(s): + if g_verbose: + print s + + +HELP = """\ +Set up a forward tunnel across an SSH server, using paramiko. A local port +(given with -p) is forwarded across an SSH session to an address:port from +the SSH server. This is similar to the openssh -L option. +""" + + +def get_host_port(spec, default_port): + "parse 'hostname:22' into a host and port, with the port optional" + args = (spec.split(':', 1) + [default_port])[:2] + args[1] = int(args[1]) + return args[0], args[1] + + +def parse_options(): + global g_verbose + + parser = OptionParser(usage='usage: %prog [options] [:]', + version='%prog 1.0', description=HELP) + parser.add_option('-q', '--quiet', action='store_false', dest='verbose', default=True, + help='squelch all informational output') + parser.add_option('-p', '--local-port', action='store', type='int', dest='port', + default=DEFAULT_PORT, + help='local port to forward (default: %d)' % DEFAULT_PORT) + parser.add_option('-u', '--user', action='store', type='string', dest='user', + default=getpass.getuser(), + help='username for SSH authentication (default: %s)' % getpass.getuser()) + parser.add_option('-K', '--key', action='store', type='string', dest='keyfile', + default=None, + help='private key file to use for SSH authentication') + parser.add_option('', '--no-key', action='store_false', dest='look_for_keys', default=True, + help='don\'t look for or use a private key file') + parser.add_option('-P', '--password', action='store_true', dest='readpass', default=False, + help='read password (for key or password auth) from stdin') + parser.add_option('-r', '--remote', action='store', type='string', dest='remote', default=None, metavar='host:port', + help='remote host and port to forward to') + options, args = parser.parse_args() + + if len(args) != 1: + parser.error('Incorrect number of arguments.') + if options.remote is None: + parser.error('Remote address required (-r).') + + g_verbose = options.verbose + server_host, server_port = get_host_port(args[0], SSH_PORT) + remote_host, remote_port = get_host_port(options.remote, SSH_PORT) + return options, (server_host, server_port), (remote_host, remote_port) + + +def main(): + options, server, remote = parse_options() + + password = None + if options.readpass: + password = getpass.getpass('Enter SSH password: ') + + client = paramiko.SSHClient() + client.load_system_host_keys() + client.set_missing_host_key_policy(paramiko.WarningPolicy()) + + verbose('Connecting to ssh host %s:%d ...' % (server[0], server[1])) + try: + client.connect(server[0], server[1], username=options.user, key_filename=options.keyfile, + look_for_keys=options.look_for_keys, password=password) + except Exception, e: + print '*** Failed to connect to %s:%d: %r' % (server[0], server[1], e) + sys.exit(1) + + verbose('Now forwarding port %d to %s:%d ...' % (options.port, remote[0], remote[1])) + + try: + forward_tunnel(options.port, remote[0], remote[1], client.get_transport()) + except KeyboardInterrupt: + print 'C-c: Port forwarding stopped.' + sys.exit(0) + + +if __name__ == '__main__': + main() diff --git a/demos/interactive.py b/demos/interactive.py new file mode 100644 index 0000000..b80e661 --- /dev/null +++ b/demos/interactive.py @@ -0,0 +1,97 @@ +# Copyright (C) 2003-2007 Robey Pointer +# +# 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. + + +import socket +import sys + +# windows does not have termios... +try: + import termios + import tty + has_termios = True +except ImportError: + has_termios = False + + +def interactive_shell(chan): + if has_termios: + posix_shell(chan) + else: + windows_shell(chan) + + +def posix_shell(chan): + import select + + oldtty = termios.tcgetattr(sys.stdin) + try: + tty.setraw(sys.stdin.fileno()) + tty.setcbreak(sys.stdin.fileno()) + chan.settimeout(0.0) + + while True: + r, w, e = select.select([chan, sys.stdin], [], []) + if chan in r: + try: + x = chan.recv(1024) + if len(x) == 0: + print '\r\n*** EOF\r\n', + break + sys.stdout.write(x) + sys.stdout.flush() + except socket.timeout: + pass + if sys.stdin in r: + x = sys.stdin.read(1) + if len(x) == 0: + break + chan.send(x) + + finally: + termios.tcsetattr(sys.stdin, termios.TCSADRAIN, oldtty) + + +# thanks to Mike Looijmans for this code +def windows_shell(chan): + import threading + + sys.stdout.write("Line-buffered terminal emulation. Press F6 or ^Z to send EOF.\r\n\r\n") + + def writeall(sock): + while True: + data = sock.recv(256) + if not data: + sys.stdout.write('\r\n*** EOF ***\r\n\r\n') + sys.stdout.flush() + break + sys.stdout.write(data) + sys.stdout.flush() + + writer = threading.Thread(target=writeall, args=(chan,)) + writer.start() + + try: + while True: + d = sys.stdin.read(1) + if not d: + break + chan.send(d) + except EOFError: + # user hit ^Z or F6 + pass diff --git a/demos/rforward.py b/demos/rforward.py new file mode 100755 index 0000000..810fea6 --- /dev/null +++ b/demos/rforward.py @@ -0,0 +1,167 @@ +#!/usr/bin/env python + +# Copyright (C) 2008 Robey Pointer +# +# 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. + +""" +Sample script showing how to do remote port forwarding over paramiko. + +This script connects to the requested SSH server and sets up remote port +forwarding (the openssh -R option) from a remote port through a tunneled +connection to a destination reachable from the local machine. +""" + +import getpass +import os +import socket +import select +import sys +import threading +from optparse import OptionParser + +import paramiko + +SSH_PORT = 22 +DEFAULT_PORT = 4000 + +g_verbose = True + + +def handler(chan, host, port): + sock = socket.socket() + try: + sock.connect((host, port)) + except Exception, e: + verbose('Forwarding request to %s:%d failed: %r' % (host, port, e)) + return + + verbose('Connected! Tunnel open %r -> %r -> %r' % (chan.origin_addr, + chan.getpeername(), (host, port))) + while True: + r, w, x = select.select([sock, chan], [], []) + if sock in r: + data = sock.recv(1024) + if len(data) == 0: + break + chan.send(data) + if chan in r: + data = chan.recv(1024) + if len(data) == 0: + break + sock.send(data) + chan.close() + sock.close() + verbose('Tunnel closed from %r' % (chan.origin_addr,)) + + +def reverse_forward_tunnel(server_port, remote_host, remote_port, transport): + transport.request_port_forward('', server_port) + while True: + chan = transport.accept(1000) + if chan is None: + continue + thr = threading.Thread(target=handler, args=(chan, remote_host, remote_port)) + thr.setDaemon(True) + thr.start() + + +def verbose(s): + if g_verbose: + print s + + +HELP = """\ +Set up a reverse forwarding tunnel across an SSH server, using paramiko. A +port on the SSH server (given with -p) is forwarded across an SSH session +back to the local machine, and out to a remote site reachable from this +network. This is similar to the openssh -R option. +""" + + +def get_host_port(spec, default_port): + "parse 'hostname:22' into a host and port, with the port optional" + args = (spec.split(':', 1) + [default_port])[:2] + args[1] = int(args[1]) + return args[0], args[1] + + +def parse_options(): + global g_verbose + + parser = OptionParser(usage='usage: %prog [options] [:]', + version='%prog 1.0', description=HELP) + parser.add_option('-q', '--quiet', action='store_false', dest='verbose', default=True, + help='squelch all informational output') + parser.add_option('-p', '--remote-port', action='store', type='int', dest='port', + default=DEFAULT_PORT, + help='port on server to forward (default: %d)' % DEFAULT_PORT) + parser.add_option('-u', '--user', action='store', type='string', dest='user', + default=getpass.getuser(), + help='username for SSH authentication (default: %s)' % getpass.getuser()) + parser.add_option('-K', '--key', action='store', type='string', dest='keyfile', + default=None, + help='private key file to use for SSH authentication') + parser.add_option('', '--no-key', action='store_false', dest='look_for_keys', default=True, + help='don\'t look for or use a private key file') + parser.add_option('-P', '--password', action='store_true', dest='readpass', default=False, + help='read password (for key or password auth) from stdin') + parser.add_option('-r', '--remote', action='store', type='string', dest='remote', default=None, metavar='host:port', + help='remote host and port to forward to') + options, args = parser.parse_args() + + if len(args) != 1: + parser.error('Incorrect number of arguments.') + if options.remote is None: + parser.error('Remote address required (-r).') + + g_verbose = options.verbose + server_host, server_port = get_host_port(args[0], SSH_PORT) + remote_host, remote_port = get_host_port(options.remote, SSH_PORT) + return options, (server_host, server_port), (remote_host, remote_port) + + +def main(): + options, server, remote = parse_options() + + password = None + if options.readpass: + password = getpass.getpass('Enter SSH password: ') + + client = paramiko.SSHClient() + client.load_system_host_keys() + client.set_missing_host_key_policy(paramiko.WarningPolicy()) + + verbose('Connecting to ssh host %s:%d ...' % (server[0], server[1])) + try: + client.connect(server[0], server[1], username=options.user, key_filename=options.keyfile, + look_for_keys=options.look_for_keys, password=password) + except Exception, e: + print '*** Failed to connect to %s:%d: %r' % (server[0], server[1], e) + sys.exit(1) + + verbose('Now forwarding remote port %d to %s:%d ...' % (options.port, remote[0], remote[1])) + + try: + reverse_forward_tunnel(options.port, remote[0], remote[1], client.get_transport()) + except KeyboardInterrupt: + print 'C-c: Port forwarding stopped.' + sys.exit(0) + + +if __name__ == '__main__': + main() diff --git a/demos/test_rsa.key b/demos/test_rsa.key new file mode 100644 index 0000000..f50e9c5 --- /dev/null +++ b/demos/test_rsa.key @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICWgIBAAKBgQDTj1bqB4WmayWNPB+8jVSYpZYk80Ujvj680pOTh2bORBjbIAyz +oWGW+GUjzKxTiiPvVmxFgx5wdsFvF03v34lEVVhMpouqPAYQ15N37K/ir5XY+9m/ +d8ufMCkjeXsQkKqFbAlQcnWMCRnOoPHS3I4vi6hmnDDeeYTSRvfLbW0fhwIBIwKB +gBIiOqZYaoqbeD9OS9z2K9KR2atlTxGxOJPXiP4ESqP3NVScWNwyZ3NXHpyrJLa0 +EbVtzsQhLn6rF+TzXnOlcipFvjsem3iYzCpuChfGQ6SovTcOjHV9z+hnpXvQ/fon +soVRZY65wKnF7IAoUwTmJS9opqgrN6kRgCd3DASAMd1bAkEA96SBVWFt/fJBNJ9H +tYnBKZGw0VeHOYmVYbvMSstssn8un+pQpUm9vlG/bp7Oxd/m+b9KWEh2xPfv6zqU +avNwHwJBANqzGZa/EpzF4J8pGti7oIAPUIDGMtfIcmqNXVMckrmzQ2vTfqtkEZsA +4rE1IERRyiJQx6EJsz21wJmGV9WJQ5kCQQDwkS0uXqVdFzgHO6S++tjmjYcxwr3g +H0CoFYSgbddOT6miqRskOQF3DZVkJT3kyuBgU2zKygz52ukQZMqxCb1fAkASvuTv +qfpH87Qq5kQhNKdbbwbmd2NxlNabazPijWuphGTdW0VfJdWfklyS2Kr+iqrs/5wV +HhathJt636Eg7oIjAkA8ht3MQ+XSl9yIJIS8gVpbPxSw5OMfw0PjVE7tBdQruiSc +nvuQES5C9BMHjF39LZiGH1iLQy7FgdHyoP+eodI7 +-----END RSA PRIVATE KEY----- diff --git a/demos/user_rsa_key b/demos/user_rsa_key new file mode 100644 index 0000000..ee64f23 --- /dev/null +++ b/demos/user_rsa_key @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQDI7iK3d8eWYZlYloat94c5VjtFY7c/0zuGl8C7uMnZ3t6i2G99 +66hEW0nCFSZkOW5F0XKEVj+EUCHvo8koYC6wiohAqWQnEwIoOoh7GSAcB8gP/qaq ++adIl/Rvlby/mHakj+y05LBND6nFWHAn1y1gOFFKUXSJNRZPXSFy47gqzwIBIwKB +gQCbANjz7q/pCXZLp1Hz6tYHqOvlEmjK1iabB1oqafrMpJ0eibUX/u+FMHq6StR5 +M5413BaDWHokPdEJUnabfWXXR3SMlBUKrck0eAer1O8m78yxu3OEdpRk+znVo4DL +guMeCdJB/qcF0kEsx+Q8HP42MZU1oCmk3PbfXNFwaHbWuwJBAOQ/ry/hLD7AqB8x +DmCM82A9E59ICNNlHOhxpJoh6nrNTPCsBAEu/SmqrL8mS6gmbRKUaya5Lx1pkxj2 +s/kWOokCQQDhXCcYXjjWiIfxhl6Rlgkk1vmI0l6785XSJNv4P7pXjGmShXfIzroh +S8uWK3tL0GELY7+UAKDTUEVjjQdGxYSXAkEA3bo1JzKCwJ3lJZ1ebGuqmADRO6UP +40xH977aadfN1mEI6cusHmgpISl0nG5YH7BMsvaT+bs1FUH8m+hXDzoqOwJBAK3Z +X/za+KV/REya2z0b+GzgWhkXUGUa/owrEBdHGriQ47osclkUgPUdNqcLmaDilAF4 +1Z4PHPrI5RJIONAx+JECQQC/fChqjBgFpk6iJ+BOdSexQpgfxH/u/457W10Y43HR +soS+8btbHqjQkowQ/2NTlUfWvqIlfxs6ZbFsIp/HrhZL +-----END RSA PRIVATE KEY----- diff --git a/demos/user_rsa_key.pub b/demos/user_rsa_key.pub new file mode 100644 index 0000000..ac722f1 --- /dev/null +++ b/demos/user_rsa_key.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAyO4it3fHlmGZWJaGrfeHOVY7RWO3P9M7hpfAu7jJ2d7eothvfeuoRFtJwhUmZDluRdFyhFY/hFAh76PJKGAusIqIQKlkJxMCKDqIexkgHAfID/6mqvmnSJf0b5W8v5h2pI/stOSwTQ+pxVhwJ9ctYDhRSlF0iTUWT10hcuO4Ks8= robey@ralph.lag.net diff --git a/docs/api-objects.txt b/docs/api-objects.txt new file mode 100644 index 0000000..5ef02ce --- /dev/null +++ b/docs/api-objects.txt @@ -0,0 +1,2179 @@ +paramiko paramiko-module.html +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.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.randpool paramiko.auth_handler-module.html#randpool +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.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.buffered_pipe paramiko.buffered_pipe-module.html +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.randpool paramiko.channel-module.html#randpool +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.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.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.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.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.randpool paramiko.client-module.html#randpool +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.randpool paramiko.common-module.html#randpool +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.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.config paramiko.config-module.html +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.randpool paramiko.dsskey-module.html#randpool +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.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.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.randpool paramiko.hostkeys-module.html#randpool +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.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.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.randpool paramiko.kex_gex-module.html#randpool +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.randpool paramiko.kex_group1-module.html#randpool +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.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.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.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.randpool paramiko.packet-module.html#randpool +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.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.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.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.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.randpool paramiko.pkey-module.html#randpool +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.resource paramiko.resource-module.html +paramiko.resource.ResourceManager paramiko.resource-module.html#ResourceManager +paramiko.rng paramiko.rng-module.html +paramiko.rng.rng_device paramiko.rng-module.html#rng_device +paramiko.rng._strxor paramiko.rng-module.html#_strxor +paramiko.rng_posix paramiko.rng_posix-module.html +paramiko.rng_posix.open_rng_device paramiko.rng_posix-module.html#open_rng_device +paramiko.rng_win32 paramiko.rng_win32-module.html +paramiko.rng_win32._winrandom paramiko.rng_win32-module.html#_winrandom +paramiko.rng_win32._open_winrandom paramiko.rng_win32-module.html#_open_winrandom +paramiko.rng_win32.open_rng_device paramiko.rng_win32-module.html#open_rng_device +paramiko.rng_win32._open_urandom paramiko.rng_win32-module.html#_open_urandom +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.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.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.randpool paramiko.rsakey-module.html#randpool +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.randpool paramiko.server-module.html#randpool +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.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.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.randpool paramiko.sftp-module.html#randpool +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.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.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.randpool paramiko.sftp_attr-module.html#randpool +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.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.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.randpool paramiko.sftp_client-module.html#randpool +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.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.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.randpool paramiko.sftp_file-module.html#randpool +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.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.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.randpool paramiko.sftp_handle-module.html#randpool +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.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.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.randpool paramiko.sftp_server-module.html#randpool +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.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.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.randpool paramiko.sftp_si-module.html#randpool +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.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.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.randpool paramiko.transport-module.html#randpool +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.MSG_REQUEST_SUCCESS paramiko.transport-module.html#MSG_REQUEST_SUCCESS +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.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.MSG_CHANNEL_CLOSE paramiko.transport-module.html#MSG_CHANNEL_CLOSE +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_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.log_to_file paramiko.util-module.html#log_to_file +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.get_thread_id paramiko.util-module.html#get_thread_id +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._g_thread_ids paramiko.util-module.html#_g_thread_ids +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.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.safe_string paramiko.util-module.html#safe_string +paramiko.util.format_binary_line paramiko.util-module.html#format_binary_line +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.format_binary_weird paramiko.util-module.html#format_binary_weird +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.randpool paramiko.util-module.html#randpool +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.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._has_win32all paramiko.win_pageant-module.html#_has_win32all +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_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.hostname paramiko.BadHostKeyException-class.html#hostname +paramiko.BadHostKeyException.expected_key paramiko.BadHostKeyException-class.html#expected_key +paramiko.BadHostKeyException.key paramiko.BadHostKeyException-class.html#key +paramiko.BadHostKeyException.__init__ paramiko.BadHostKeyException-class.html#__init__ +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.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.request_x11 paramiko.Channel-class.html#request_x11 +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._from_msg paramiko.SFTPAttributes-class.html#_from_msg +paramiko.SFTPAttributes._rwx paramiko.SFTPAttributes-class.html#_rwx +paramiko.SFTPAttributes.FLAG_UIDGID paramiko.SFTPAttributes-class.html#FLAG_UIDGID +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.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._read_prefetch paramiko.SFTPFile-class.html#_read_prefetch +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.check paramiko.SFTPFile-class.html#check +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._get_next_files paramiko.SFTPHandle-class.html#_get_next_files +paramiko.SFTPHandle.stat paramiko.SFTPHandle-class.html#stat +paramiko.SFTPHandle.read paramiko.SFTPHandle-class.html#read +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_files paramiko.SFTPHandle-class.html#_set_files +paramiko.SFTPHandle._set_name paramiko.SFTPHandle-class.html#_set_name +paramiko.SFTPHandle.close paramiko.SFTPHandle-class.html#close +paramiko.SFTPHandle.__init__ paramiko.SFTPHandle-class.html#__init__ +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.rng.StrongLockingRandomPool paramiko.rng.StrongLockingRandomPool-class.html +paramiko.rng.StrongLockingRandomPool.stir paramiko.rng.StrongLockingRandomPool-class.html#stir +paramiko.rng.StrongLockingRandomPool.get_bytes paramiko.rng.StrongLockingRandomPool-class.html#get_bytes +paramiko.rng.StrongLockingRandomPool.randomize paramiko.rng.StrongLockingRandomPool-class.html#randomize +paramiko.rng.StrongLockingRandomPool.add_event paramiko.rng.StrongLockingRandomPool-class.html#add_event +paramiko.rng.StrongLockingRandomPool.__init__ paramiko.rng.StrongLockingRandomPool-class.html#__init__ +paramiko.rng_posix.error paramiko.rng_posix.error-class.html +paramiko.rng_win32.error paramiko.rng_win32.error-class.html +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.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 new file mode 100644 index 0000000..d66129c --- /dev/null +++ b/docs/bug-index.html @@ -0,0 +1,107 @@ + + + + + Bug List + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + +
[frames] | no frames]
+
+
[ + Identifiers +| Bugs +| Introductions +]

+

Bug List

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

+

Class Hierarchy

+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/crarr.png b/docs/crarr.png new file mode 100644 index 0000000..26b43c5 Binary files /dev/null and b/docs/crarr.png differ diff --git a/docs/epydoc.css b/docs/epydoc.css index 46080bd..86d4170 100644 --- a/docs/epydoc.css +++ b/docs/epydoc.css @@ -1,100 +1,322 @@ -/* Body color */ -body { background: #ffffff; color: #000000; } - -/* Tables */ -table.summary, table.details, table.index - { background: #e8f0f8; color: #000000; } -tr.summary, tr.details, tr.index - { background: #70b0f0; color: #000000; - text-align: left; font-size: 120%; } -tr.group { background: #c0e0f8; color: #000000; - text-align: left; font-size: 120%; - font-style: italic; } - -/* Documentation page titles */ -h2.module { margin-top: 0.2em; } -h2.class { margin-top: 0.2em; } + +/* 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; } -/* Headings */ -h1.heading { font-size: +140%; font-style: italic; - font-weight: bold; } -h2.heading { font-size: +125%; font-style: italic; - font-weight: bold; } -h3.heading { font-size: +110%; font-style: italic; - font-weight: normal; } - -/* Base tree */ -pre.base-tree { font-size: 80%; margin: 0; } - -/* Details Sections */ -table.func-details { background: #e8f0f8; color: #000000; - border: 2px groove #c0d0d0; - padding: 0 1em 0 1em; margin: 0.4em 0 0 0; } -h3.func-detail { background: transparent; color: #000000; - margin: 0 0 1em 0; } - -table.var-details { background: #e8f0f8; color: #000000; - border: 2px groove #c0d0d0; - padding: 0 1em 0 1em; margin: 0.4em 0 0 0; } -h3.var-details { background: transparent; color: #000000; - margin: 0 0 1em 0; } - -/* Function signatures */ -.sig { background: transparent; color: #000000; - font-weight: bold; } -.sig-name { background: transparent; color: #006080; } -.sig-arg, .sig-kwarg, .sig-vararg - { background: transparent; color: #008060; } -.sig-default { background: transparent; color: #602000; } -.summary-sig { background: transparent; color: #000000; } -.summary-sig-name { background: transparent; color: #204080; } -.summary-sig-arg, .summary-sig-kwarg, .summary-sig-vararg - { background: transparent; color: #008060; } - -/* Doctest blocks */ -.py-src { background: transparent; color: #000000; } -.py-prompt { background: transparent; color: #005050; - font-weight: bold;} -.py-string { background: transparent; color: #006030; } -.py-comment { background: transparent; color: #003060; } -.py-keyword { background: transparent; color: #600000; } -.py-output { background: transparent; color: #404040; } -pre.doctestblock { background: #f4faff; color: #000000; - padding: .5em; margin: 1em; - border: 1px solid #708890; } -table pre.doctestblock - { background: #dce4ec; color: #000000; - padding: .5em; margin: 1em; - border: 1px solid #708890; } - -/* Variable values */ -pre.variable { background: #dce4ec; color: #000000; - padding: .5em; margin: 0; - border: 1px solid #708890; } -.variable-linewrap { background: transparent; color: #604000; } -.variable-ellipsis { background: transparent; color: #604000; } -.variable-quote { background: transparent; color: #604000; } -.re { background: transparent; color: #000000; } -.re-char { background: transparent; color: #006030; } -.re-op { background: transparent; color: #600000; } -.re-group { background: transparent; color: #003060; } -.re-ref { background: transparent; color: #404040; } - -/* Navigation bar */ -table.navbar { background: #a0c0ff; color: #0000ff; - border: 2px groove #c0d0d0; } -th.navbar { background: #a0c0ff; color: #0000ff; } -th.navselect { background: #70b0ff; color: #000000; } -.nomargin { margin: 0; } - -/* Links */ -a:link { background: transparent; color: #0000ff; } -a:visited { background: transparent; color: #204080; } -a.navbar:link { background: transparent; color: #0000ff; - text-decoration: none; } -a.navbar:visited { background: transparent; color: #204080; - text-decoration: none; } - -/* Lists */ -ul { margin-top: 0; } +/* 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 new file mode 100644 index 0000000..e787dbc --- /dev/null +++ b/docs/epydoc.js @@ -0,0 +1,293 @@ +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 new file mode 100644 index 0000000..d1e8877 --- /dev/null +++ b/docs/frames.html @@ -0,0 +1,17 @@ + + + + + API Documentation + + + + + + + + + diff --git a/docs/help.html b/docs/help.html new file mode 100644 index 0000000..ec1c7dc --- /dev/null +++ b/docs/help.html @@ -0,0 +1,266 @@ + + + + + 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 new file mode 100644 index 0000000..5976d1a --- /dev/null +++ b/docs/identifier-index.html @@ -0,0 +1,5420 @@ + + + + + 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 index d2fca35..d1e8877 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,13 +1,17 @@ - - + + + API Documentation - - + + - + diff --git a/docs/module-tree.html b/docs/module-tree.html new file mode 100644 index 0000000..10ad60b --- /dev/null +++ b/docs/module-tree.html @@ -0,0 +1,158 @@ + + + + + Module Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + +
[frames] | no frames]
+
+
+ [ Module Hierarchy + | Class Hierarchy ] +

+

Module Hierarchy

+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko-module.html b/docs/paramiko-module.html new file mode 100644 index 0000000..4c88f2e --- /dev/null +++ b/docs/paramiko-module.html @@ -0,0 +1,516 @@ + + + + + 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 heirarchical 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.4 (Desmond) +

+

Author: + Robey Pointer +

+

Contact: + robey@lag.net +

+

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

+

Date: + 06 Jul 2008 +

+
+ + + + + + +
+ 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 new file mode 100644 index 0000000..a81648d --- /dev/null +++ b/docs/paramiko-pysrc.html @@ -0,0 +1,485 @@ + + + + + paramiko + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko + + + + + +
[frames] | no frames]
+
+

Source Code for Package paramiko

+
+  1  # Copyright (C) 2003-2008  Robey Pointer <robey@lag.net> 
+  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 heirarchical 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.4 (Desmond) 
+ 51  @author: Robey Pointer 
+ 52  @contact: robey@lag.net 
+ 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 <robey@lag.net>" 
+ 63  __date__ = "06 Jul 2008" 
+ 64  __version__ = "1.7.4 (Desmond)" 
+ 65  __version_info__ = (1, 7, 4) 
+ 66  __license__ = "GNU Lesser General Public License (LGPL)" 
+ 67   
+ 68   
+ 69  from transport import randpool, 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 new file mode 100644 index 0000000..18e1f3a --- /dev/null +++ b/docs/paramiko.Agent-class.html @@ -0,0 +1,233 @@ + + + + + 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 new file mode 100644 index 0000000..7b09946 --- /dev/null +++ b/docs/paramiko.AgentKey-class.html @@ -0,0 +1,396 @@ + + + + + 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, + randpool, + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__ +

+
+ + + + + + + + + +
+ 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, + randpool, + data) +

+
source code  +
+ +

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

+
+
Parameters:
+
    +
  • randpool - 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 new file mode 100644 index 0000000..9056815 --- /dev/null +++ b/docs/paramiko.AuthenticationException-class.html @@ -0,0 +1,180 @@ + + + + + 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__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..36cecb0 --- /dev/null +++ b/docs/paramiko.AutoAddPolicy-class.html @@ -0,0 +1,221 @@ + + + + + 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__, + __getattribute__, + __hash__, + __init__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..bf7ba8a --- /dev/null +++ b/docs/paramiko.BadAuthenticationType-class.html @@ -0,0 +1,291 @@ + + + + + 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__, + __reduce__, + __repr__, + __setattr__, + __setstate__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..20d2814 --- /dev/null +++ b/docs/paramiko.BadHostKeyException-class.html @@ -0,0 +1,263 @@ + + + + + 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__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + + + + + + + +
+ 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 new file mode 100644 index 0000000..f3fe0f5 --- /dev/null +++ b/docs/paramiko.BufferedFile-class.html @@ -0,0 +1,853 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ 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 new file mode 100644 index 0000000..41ff545 --- /dev/null +++ b/docs/paramiko.Channel-class.html @@ -0,0 +1,1995 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..8a02d64 --- /dev/null +++ b/docs/paramiko.ChannelException-class.html @@ -0,0 +1,245 @@ + + + + + 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__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..29c5115 --- /dev/null +++ b/docs/paramiko.DSSKey-class.html @@ -0,0 +1,747 @@ + + + + + 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, + 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__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__ +

+
+ + + + + + + + + +
+ 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, + rpool, + data) +

+
source code  +
+ +

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

+
+
Parameters:
+
    +
  • randpool - 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 new file mode 100644 index 0000000..e4db6c8 --- /dev/null +++ b/docs/paramiko.HostKeys-class.html @@ -0,0 +1,643 @@ + + + + + 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 new file mode 100644 index 0000000..7edfd13 --- /dev/null +++ b/docs/paramiko.Message-class.html @@ -0,0 +1,1098 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..29eaf1a --- /dev/null +++ b/docs/paramiko.MissingHostKeyPolicy-class.html @@ -0,0 +1,229 @@ + + + + + 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__, + __getattribute__, + __hash__, + __init__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..0e9bd2a --- /dev/null +++ b/docs/paramiko.PKey-class.html @@ -0,0 +1,854 @@ + + + + + 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, + randpool, + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__ +

+
+ + + + + + + + + + + + +
+ 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, + randpool, + data) +

+
source code  +
+ +

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

+
+
Parameters:
+
    +
  • randpool (Crypto.Util.randpool.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 new file mode 100644 index 0000000..4de6bcb --- /dev/null +++ b/docs/paramiko.PasswordRequiredException-class.html @@ -0,0 +1,171 @@ + + + + + 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__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..a611e3f --- /dev/null +++ b/docs/paramiko.RSAKey-class.html @@ -0,0 +1,747 @@ + + + + + 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__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__ +

+
+ + + + + + + + + +
+ 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:
+
    +
  • randpool - 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 new file mode 100644 index 0000000..8d38bec --- /dev/null +++ b/docs/paramiko.RejectPolicy-class.html @@ -0,0 +1,220 @@ + + + + + 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__, + __getattribute__, + __hash__, + __init__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..3a7f52d --- /dev/null +++ b/docs/paramiko.SFTP-class.html @@ -0,0 +1,199 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..568b910 --- /dev/null +++ b/docs/paramiko.SFTPAttributes-class.html @@ -0,0 +1,415 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..41043ac --- /dev/null +++ b/docs/paramiko.SFTPClient-class.html @@ -0,0 +1,1528 @@ + + + + + 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)
+ 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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.

+
+
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) +

+
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)
  • +
+
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 new file mode 100644 index 0000000..0c1d9f1 --- /dev/null +++ b/docs/paramiko.SFTPError-class.html @@ -0,0 +1,164 @@ + + + + + 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__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..d15b74d --- /dev/null +++ b/docs/paramiko.SFTPFile-class.html @@ -0,0 +1,1008 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + +
+ 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 new file mode 100644 index 0000000..63a4491 --- /dev/null +++ b/docs/paramiko.SFTPHandle-class.html @@ -0,0 +1,473 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..514d31e --- /dev/null +++ b/docs/paramiko.SFTPServer-class.html @@ -0,0 +1,468 @@ + + + + + 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, + join, + run, + setDaemon, + setName, + start +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + +
+ 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 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 new file mode 100644 index 0000000..df785ad --- /dev/null +++ b/docs/paramiko.SFTPServerInterface-class.html @@ -0,0 +1,976 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..4e3ec8e --- /dev/null +++ b/docs/paramiko.SSHClient-class.html @@ -0,0 +1,839 @@ + + + + + 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)
+ 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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) +

+
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/
  • +
+
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 new file mode 100644 index 0000000..b568e27 --- /dev/null +++ b/docs/paramiko.SSHConfig-class.html @@ -0,0 +1,306 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..75c6138 --- /dev/null +++ b/docs/paramiko.SSHException-class.html @@ -0,0 +1,173 @@ + + + + + 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__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..adfff52 --- /dev/null +++ b/docs/paramiko.SecurityOptions-class.html @@ -0,0 +1,394 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ 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 new file mode 100644 index 0000000..06d75de --- /dev/null +++ b/docs/paramiko.ServerInterface-class.html @@ -0,0 +1,1244 @@ + + + + + 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__, + __getattribute__, + __hash__, + __init__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..407b7f4 --- /dev/null +++ b/docs/paramiko.SubsystemHandler-class.html @@ -0,0 +1,384 @@ + + + + + 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, + join, + run, + setDaemon, + setName, + start +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ Properties
+

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 new file mode 100644 index 0000000..98758da --- /dev/null +++ b/docs/paramiko.Transport-class.html @@ -0,0 +1,2343 @@ + + + + + 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, + join, + setDaemon, + setName, + start +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 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 new file mode 100644 index 0000000..e752ca5 --- /dev/null +++ b/docs/paramiko.WarningPolicy-class.html @@ -0,0 +1,220 @@ + + + + + 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__, + __getattribute__, + __hash__, + __init__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..91611cd --- /dev/null +++ b/docs/paramiko.agent-module.html @@ -0,0 +1,141 @@ + + + + + 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 +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.agent-pysrc.html b/docs/paramiko.agent-pysrc.html new file mode 100644 index 0000000..1c6bc72 --- /dev/null +++ b/docs/paramiko.agent-pysrc.html @@ -0,0 +1,277 @@ + + + + + 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.keys = () + 59 if ('SSH_AUTH_SOCK' in os.environ) and (sys.platform != 'win32'): + 60 conn = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + 61 try: + 62 conn.connect(os.environ['SSH_AUTH_SOCK']) + 63 except: + 64 # probably a dangling env var: the ssh agent is gone + 65 return + 66 self.conn = conn + 67 elif sys.platform == 'win32': + 68 import win_pageant + 69 if win_pageant.can_talk_to_agent(): + 70 self.conn = win_pageant.PageantConnection() + 71 else: + 72 return + 73 else: + 74 # no agent support + 75 return + 76 + 77 ptype, result = self._send_message(chr(SSH2_AGENTC_REQUEST_IDENTITIES)) + 78 if ptype != SSH2_AGENT_IDENTITIES_ANSWER: + 79 raise SSHException('could not get keys from ssh-agent') + 80 keys = [] + 81 for i in range(result.get_int()): + 82 keys.append(AgentKey(self, result.get_string())) + 83 result.get_string() + 84 self.keys = tuple(keys) +
85 +
86 - def close(self): +
87 """ + 88 Close the SSH agent connection. + 89 """ + 90 self.conn.close() + 91 self.conn = None + 92 self.keys = () +
93 +
94 - def get_keys(self): +
95 """ + 96 Return the list of keys available through the SSH agent, if any. If + 97 no SSH agent was running (or it couldn't be contacted), an empty list + 98 will be returned. + 99 +100 @return: a list of keys available on the SSH agent +101 @rtype: tuple of L{AgentKey} +102 """ +103 return self.keys +
104 +
105 - def _send_message(self, msg): +
106 msg = str(msg) +107 self.conn.send(struct.pack('>I', len(msg)) + msg) +108 l = self._read_all(4) +109 msg = Message(self._read_all(struct.unpack('>I', l)[0])) +110 return ord(msg.get_byte()), msg +
111 +
112 - def _read_all(self, wanted): +
113 result = self.conn.recv(wanted) +114 while len(result) < wanted: +115 if len(result) == 0: +116 raise SSHException('lost ssh-agent') +117 extra = self.conn.recv(wanted - len(result)) +118 if len(extra) == 0: +119 raise SSHException('lost ssh-agent') +120 result += extra +121 return result +
122 +123 +
124 -class AgentKey(PKey): +
125 """ +126 Private key held in a local SSH agent. This type of key can be used for +127 authenticating to a remote server (signing). Most other key operations +128 work as expected. +129 """ +130 +
131 - def __init__(self, agent, blob): +
132 self.agent = agent +133 self.blob = blob +134 self.name = Message(blob).get_string() +
135 +
136 - def __str__(self): +
137 return self.blob +
138 +
139 - def get_name(self): +
140 return self.name +
141 +
142 - def sign_ssh_data(self, randpool, data): +
143 msg = Message() +144 msg.add_byte(chr(SSH2_AGENTC_SIGN_REQUEST)) +145 msg.add_string(self.blob) +146 msg.add_string(data) +147 msg.add_int(0) +148 ptype, result = self.agent._send_message(msg) +149 if ptype != SSH2_AGENT_SIGN_RESPONSE: +150 raise SSHException('key cannot be used for signing') +151 return result.get_string() +
152 +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.auth_handler-module.html b/docs/paramiko.auth_handler-module.html new file mode 100644 index 0000000..11c62df --- /dev/null +++ b/docs/paramiko.auth_handler-module.html @@ -0,0 +1,524 @@ + + + + + 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 +
+   + + randpool = StrongLockingRandomPool() +
+ + + + + + +
+ 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 new file mode 100644 index 0000000..9373338 --- /dev/null +++ b/docs/paramiko.auth_handler-pysrc.html @@ -0,0 +1,1514 @@ + + + + + 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 <robey@lag.net> 
+  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.randpool, 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(INFO, '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 new file mode 100644 index 0000000..08a43d4 --- /dev/null +++ b/docs/paramiko.ber-module.html @@ -0,0 +1,126 @@ + + + + + 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. +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.ber-pysrc.html b/docs/paramiko.ber-pysrc.html new file mode 100644 index 0000000..d6d4e84 --- /dev/null +++ b/docs/paramiko.ber-pysrc.html @@ -0,0 +1,238 @@ + + + + + paramiko.ber + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module ber + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.ber

+
+  1  # Copyright (C) 2003-2007  Robey Pointer <robey@lag.net> 
+  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 new file mode 100644 index 0000000..e376084 --- /dev/null +++ b/docs/paramiko.ber.BER-class.html @@ -0,0 +1,394 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + + + + +
+ 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 new file mode 100644 index 0000000..d1815d3 --- /dev/null +++ b/docs/paramiko.ber.BERException-class.html @@ -0,0 +1,165 @@ + + + + + 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__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..b427eaa --- /dev/null +++ b/docs/paramiko.buffered_pipe-module.html @@ -0,0 +1,136 @@ + + + + + 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. +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.buffered_pipe-pysrc.html b/docs/paramiko.buffered_pipe-pysrc.html new file mode 100644 index 0000000..4fed6e8 --- /dev/null +++ b/docs/paramiko.buffered_pipe-pysrc.html @@ -0,0 +1,323 @@ + + + + + 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 <robey@lag.net> 
+  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 new file mode 100644 index 0000000..97b4486 --- /dev/null +++ b/docs/paramiko.buffered_pipe.BufferedPipe-class.html @@ -0,0 +1,513 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..60ec323 --- /dev/null +++ b/docs/paramiko.buffered_pipe.PipeTimeout-class.html @@ -0,0 +1,182 @@ + + + + + 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__, + __repr__, + __setattr__, + __setstate__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ Properties
+

Inherited from exceptions.EnvironmentError: + errno, + filename, + message, + strerror +

+

Inherited from exceptions.BaseException: + args +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.channel-module.html b/docs/paramiko.channel-module.html new file mode 100644 index 0000000..f8c74ce --- /dev/null +++ b/docs/paramiko.channel-module.html @@ -0,0 +1,547 @@ + + + + + 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 +
+   + + randpool = StrongLockingRandomPool() +
+ + + + + + +
+ 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 new file mode 100644 index 0000000..614cab3 --- /dev/null +++ b/docs/paramiko.channel-pysrc.html @@ -0,0 +1,2083 @@ + + + + + paramiko.channel + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module channel + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.channel

+
+   1  # Copyright (C) 2003-2007  Robey Pointer <robey@lag.net> 
+   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.combine_stderr = False + 94 self.exit_status = -1 + 95 self.origin_addr = None +
96 +
97 - def __del__(self): +
98 try: + 99 self.close() + 100 except: + 101 pass +
102 +
103 - def __repr__(self): +
104 """ + 105 Return a string representation of this object, for debugging. + 106 + 107 @rtype: str + 108 """ + 109 out = '<paramiko.Channel %d' % self.chanid + 110 if self.closed: + 111 out += ' (closed)' + 112 elif self.active: + 113 if self.eof_received: + 114 out += ' (EOF received)' + 115 if self.eof_sent: + 116 out += ' (EOF sent)' + 117 out += ' (open) window=%d' % (self.out_window_size) + 118 if len(self.in_buffer) > 0: + 119 out += ' in-buffer=%d' % (len(self.in_buffer),) + 120 out += ' -> ' + repr(self.transport) + 121 out += '>' + 122 return out +
123 +
124 - def get_pty(self, term='vt100', width=80, height=24): +
125 """ + 126 Request a pseudo-terminal from the server. This is usually used right + 127 after creating a client channel, to ask the server to provide some + 128 basic terminal semantics for a shell invoked with L{invoke_shell}. + 129 It isn't necessary (or desirable) to call this method if you're going + 130 to exectue a single command with L{exec_command}. + 131 + 132 @param term: the terminal type to emulate (for example, C{'vt100'}) + 133 @type term: str + 134 @param width: width (in characters) of the terminal screen + 135 @type width: int + 136 @param height: height (in characters) of the terminal screen + 137 @type height: int + 138 + 139 @raise SSHException: if the request was rejected or the channel was + 140 closed + 141 """ + 142 if self.closed or self.eof_received or self.eof_sent or not self.active: + 143 raise SSHException('Channel is not open') + 144 m = Message() + 145 m.add_byte(chr(MSG_CHANNEL_REQUEST)) + 146 m.add_int(self.remote_chanid) + 147 m.add_string('pty-req') + 148 m.add_boolean(True) + 149 m.add_string(term) + 150 m.add_int(width) + 151 m.add_int(height) + 152 # pixel height, width (usually useless) + 153 m.add_int(0).add_int(0) + 154 m.add_string('') + 155 self.event.clear() + 156 self.transport._send_user_message(m) + 157 self._wait_for_event() +
158 +
159 - def invoke_shell(self): +
160 """ + 161 Request an interactive shell session on this channel. If the server + 162 allows it, the channel will then be directly connected to the stdin, + 163 stdout, and stderr of the shell. + 164 + 165 Normally you would call L{get_pty} before this, in which case the + 166 shell will operate through the pty, and the channel will be connected + 167 to the stdin and stdout of the pty. + 168 + 169 When the shell exits, the channel will be closed and can't be reused. + 170 You must open a new channel if you wish to open another shell. + 171 + 172 @raise SSHException: if the request was rejected or the channel was + 173 closed + 174 """ + 175 if self.closed or self.eof_received or self.eof_sent or not self.active: + 176 raise SSHException('Channel is not open') + 177 m = Message() + 178 m.add_byte(chr(MSG_CHANNEL_REQUEST)) + 179 m.add_int(self.remote_chanid) + 180 m.add_string('shell') + 181 m.add_boolean(1) + 182 self.event.clear() + 183 self.transport._send_user_message(m) + 184 self._wait_for_event() +
185 +
186 - def exec_command(self, command): +
187 """ + 188 Execute a command on the server. If the server allows it, the channel + 189 will then be directly connected to the stdin, stdout, and stderr of + 190 the command being executed. + 191 + 192 When the command finishes executing, the channel will be closed and + 193 can't be reused. You must open a new channel if you wish to execute + 194 another command. + 195 + 196 @param command: a shell command to execute. + 197 @type command: str + 198 + 199 @raise SSHException: if the request was rejected or the channel was + 200 closed + 201 """ + 202 if self.closed or self.eof_received or self.eof_sent or not self.active: + 203 raise SSHException('Channel is not open') + 204 m = Message() + 205 m.add_byte(chr(MSG_CHANNEL_REQUEST)) + 206 m.add_int(self.remote_chanid) + 207 m.add_string('exec') + 208 m.add_boolean(True) + 209 m.add_string(command) + 210 self.event.clear() + 211 self.transport._send_user_message(m) + 212 self._wait_for_event() +
213 +
214 - def invoke_subsystem(self, subsystem): +
215 """ + 216 Request a subsystem on the server (for example, C{sftp}). If the + 217 server allows it, the channel will then be directly connected to the + 218 requested subsystem. + 219 + 220 When the subsystem finishes, the channel will be closed and can't be + 221 reused. + 222 + 223 @param subsystem: name of the subsystem being requested. + 224 @type subsystem: str + 225 + 226 @raise SSHException: if the request was rejected or the channel was + 227 closed + 228 """ + 229 if self.closed or self.eof_received or self.eof_sent or not self.active: + 230 raise SSHException('Channel is not open') + 231 m = Message() + 232 m.add_byte(chr(MSG_CHANNEL_REQUEST)) + 233 m.add_int(self.remote_chanid) + 234 m.add_string('subsystem') + 235 m.add_boolean(True) + 236 m.add_string(subsystem) + 237 self.event.clear() + 238 self.transport._send_user_message(m) + 239 self._wait_for_event() +
240 +
241 - def resize_pty(self, width=80, height=24): +
242 """ + 243 Resize the pseudo-terminal. This can be used to change the width and + 244 height of the terminal emulation created in a previous L{get_pty} call. + 245 + 246 @param width: new width (in characters) of the terminal screen + 247 @type width: int + 248 @param height: new height (in characters) of the terminal screen + 249 @type height: int + 250 + 251 @raise SSHException: if the request was rejected or the channel was + 252 closed + 253 """ + 254 if self.closed or self.eof_received or self.eof_sent or not self.active: + 255 raise SSHException('Channel is not open') + 256 m = Message() + 257 m.add_byte(chr(MSG_CHANNEL_REQUEST)) + 258 m.add_int(self.remote_chanid) + 259 m.add_string('window-change') + 260 m.add_boolean(True) + 261 m.add_int(width) + 262 m.add_int(height) + 263 m.add_int(0).add_int(0) + 264 self.event.clear() + 265 self.transport._send_user_message(m) + 266 self._wait_for_event() +
267 +
268 - def exit_status_ready(self): +
269 """ + 270 Return true if the remote process has exited and returned an exit + 271 status. You may use this to poll the process status if you don't + 272 want to block in L{recv_exit_status}. Note that the server may not + 273 return an exit status in some cases (like bad servers). + 274 + 275 @return: True if L{recv_exit_status} will return immediately + 276 @rtype: bool + 277 @since: 1.7.3 + 278 """ + 279 return self.closed or self.status_event.isSet() +
280 +
281 - def recv_exit_status(self): +
282 """ + 283 Return the exit status from the process on the server. This is + 284 mostly useful for retrieving the reults of an L{exec_command}. + 285 If the command hasn't finished yet, this method will wait until + 286 it does, or until the channel is closed. If no exit status is + 287 provided by the server, -1 is returned. + 288 + 289 @return: the exit code of the process on the server. + 290 @rtype: int + 291 + 292 @since: 1.2 + 293 """ + 294 while True: + 295 if self.closed or self.status_event.isSet(): + 296 break + 297 self.status_event.wait(0.1) + 298 return self.exit_status +
299 +
300 - def send_exit_status(self, status): +
301 """ + 302 Send the exit status of an executed command to the client. (This + 303 really only makes sense in server mode.) Many clients expect to + 304 get some sort of status code back from an executed command after + 305 it completes. + 306 + 307 @param status: the exit code of the process + 308 @type status: int + 309 + 310 @since: 1.2 + 311 """ + 312 # in many cases, the channel will not still be open here. + 313 # that's fine. + 314 m = Message() + 315 m.add_byte(chr(MSG_CHANNEL_REQUEST)) + 316 m.add_int(self.remote_chanid) + 317 m.add_string('exit-status') + 318 m.add_boolean(False) + 319 m.add_int(status) + 320 self.transport._send_user_message(m) +
321 +
322 - def request_x11(self, screen_number=0, auth_protocol=None, auth_cookie=None, + 323 single_connection=False, handler=None): +
324 """ + 325 Request an x11 session on this channel. If the server allows it, + 326 further x11 requests can be made from the server to the client, + 327 when an x11 application is run in a shell session. + 328 + 329 From RFC4254:: + 330 + 331 It is RECOMMENDED that the 'x11 authentication cookie' that is + 332 sent be a fake, random cookie, and that the cookie be checked and + 333 replaced by the real cookie when a connection request is received. + 334 + 335 If you omit the auth_cookie, a new secure random 128-bit value will be + 336 generated, used, and returned. You will need to use this value to + 337 verify incoming x11 requests and replace them with the actual local + 338 x11 cookie (which requires some knoweldge of the x11 protocol). + 339 + 340 If a handler is passed in, the handler is called from another thread + 341 whenever a new x11 connection arrives. The default handler queues up + 342 incoming x11 connections, which may be retrieved using + 343 L{Transport.accept}. The handler's calling signature is:: + 344 + 345 handler(channel: Channel, (address: str, port: int)) + 346 + 347 @param screen_number: the x11 screen number (0, 10, etc) + 348 @type screen_number: int + 349 @param auth_protocol: the name of the X11 authentication method used; + 350 if none is given, C{"MIT-MAGIC-COOKIE-1"} is used + 351 @type auth_protocol: str + 352 @param auth_cookie: hexadecimal string containing the x11 auth cookie; + 353 if none is given, a secure random 128-bit value is generated + 354 @type auth_cookie: str + 355 @param single_connection: if True, only a single x11 connection will be + 356 forwarded (by default, any number of x11 connections can arrive + 357 over this session) + 358 @type single_connection: bool + 359 @param handler: an optional handler to use for incoming X11 connections + 360 @type handler: function + 361 @return: the auth_cookie used + 362 """ + 363 if self.closed or self.eof_received or self.eof_sent or not self.active: + 364 raise SSHException('Channel is not open') + 365 if auth_protocol is None: + 366 auth_protocol = 'MIT-MAGIC-COOKIE-1' + 367 if auth_cookie is None: + 368 auth_cookie = binascii.hexlify(self.transport.randpool.get_bytes(16)) + 369 + 370 m = Message() + 371 m.add_byte(chr(MSG_CHANNEL_REQUEST)) + 372 m.add_int(self.remote_chanid) + 373 m.add_string('x11-req') + 374 m.add_boolean(True) + 375 m.add_boolean(single_connection) + 376 m.add_string(auth_protocol) + 377 m.add_string(auth_cookie) + 378 m.add_int(screen_number) + 379 self.event.clear() + 380 self.transport._send_user_message(m) + 381 self._wait_for_event() + 382 self.transport._set_x11_handler(handler) + 383 return auth_cookie +
384 +
385 - def get_transport(self): +
386 """ + 387 Return the L{Transport} associated with this channel. + 388 + 389 @return: the L{Transport} that was used to create this channel. + 390 @rtype: L{Transport} + 391 """ + 392 return self.transport +
393 +
394 - def set_name(self, name): +
395 """ + 396 Set a name for this channel. Currently it's only used to set the name + 397 of the channel in logfile entries. The name can be fetched with the + 398 L{get_name} method. + 399 + 400 @param name: new channel name + 401 @type name: str + 402 """ + 403 self._name = name +
404 +
405 - def get_name(self): +
406 """ + 407 Get the name of this channel that was previously set by L{set_name}. + 408 + 409 @return: the name of this channel. + 410 @rtype: str + 411 """ + 412 return self._name +
413 +
414 - def get_id(self): +
415 """ + 416 Return the ID # for this channel. The channel ID is unique across + 417 a L{Transport} and usually a small number. It's also the number + 418 passed to L{ServerInterface.check_channel_request} when determining + 419 whether to accept a channel request in server mode. + 420 + 421 @return: the ID of this channel. + 422 @rtype: int + 423 """ + 424 return self.chanid +
425 +
426 - def set_combine_stderr(self, combine): +
427 """ + 428 Set whether stderr should be combined into stdout on this channel. + 429 The default is C{False}, but in some cases it may be convenient to + 430 have both streams combined. + 431 + 432 If this is C{False}, and L{exec_command} is called (or C{invoke_shell} + 433 with no pty), output to stderr will not show up through the L{recv} + 434 and L{recv_ready} calls. You will have to use L{recv_stderr} and + 435 L{recv_stderr_ready} to get stderr output. + 436 + 437 If this is C{True}, data will never show up via L{recv_stderr} or + 438 L{recv_stderr_ready}. + 439 + 440 @param combine: C{True} if stderr output should be combined into + 441 stdout on this channel. + 442 @type combine: bool + 443 @return: previous setting. + 444 @rtype: bool + 445 + 446 @since: 1.1 + 447 """ + 448 data = '' + 449 self.lock.acquire() + 450 try: + 451 old = self.combine_stderr + 452 self.combine_stderr = combine + 453 if combine and not old: + 454 # copy old stderr buffer into primary buffer + 455 data = self.in_stderr_buffer.empty() + 456 finally: + 457 self.lock.release() + 458 if len(data) > 0: + 459 self._feed(data) + 460 return old +
461 + 462 + 463 ### socket API + 464 + 465 +
466 - def settimeout(self, timeout): +
467 """ + 468 Set a timeout on blocking read/write operations. The C{timeout} + 469 argument can be a nonnegative float expressing seconds, or C{None}. If + 470 a float is given, subsequent channel read/write operations will raise + 471 a timeout exception if the timeout period value has elapsed before the + 472 operation has completed. Setting a timeout of C{None} disables + 473 timeouts on socket operations. + 474 + 475 C{chan.settimeout(0.0)} is equivalent to C{chan.setblocking(0)}; + 476 C{chan.settimeout(None)} is equivalent to C{chan.setblocking(1)}. + 477 + 478 @param timeout: seconds to wait for a pending read/write operation + 479 before raising C{socket.timeout}, or C{None} for no timeout. + 480 @type timeout: float + 481 """ + 482 self.timeout = timeout +
483 +
484 - def gettimeout(self): +
485 """ + 486 Returns the timeout in seconds (as a float) associated with socket + 487 operations, or C{None} if no timeout is set. This reflects the last + 488 call to L{setblocking} or L{settimeout}. + 489 + 490 @return: timeout in seconds, or C{None}. + 491 @rtype: float + 492 """ + 493 return self.timeout +
494 +
495 - def setblocking(self, blocking): +
496 """ + 497 Set blocking or non-blocking mode of the channel: if C{blocking} is 0, + 498 the channel is set to non-blocking mode; otherwise it's set to blocking + 499 mode. Initially all channels are in blocking mode. + 500 + 501 In non-blocking mode, if a L{recv} call doesn't find any data, or if a + 502 L{send} call can't immediately dispose of the data, an error exception + 503 is raised. In blocking mode, the calls block until they can proceed. An + 504 EOF condition is considered "immediate data" for L{recv}, so if the + 505 channel is closed in the read direction, it will never block. + 506 + 507 C{chan.setblocking(0)} is equivalent to C{chan.settimeout(0)}; + 508 C{chan.setblocking(1)} is equivalent to C{chan.settimeout(None)}. + 509 + 510 @param blocking: 0 to set non-blocking mode; non-0 to set blocking + 511 mode. + 512 @type blocking: int + 513 """ + 514 if blocking: + 515 self.settimeout(None) + 516 else: + 517 self.settimeout(0.0) +
518 +
519 - def getpeername(self): +
520 """ + 521 Return the address of the remote side of this Channel, if possible. + 522 This is just a wrapper around C{'getpeername'} on the Transport, used + 523 to provide enough of a socket-like interface to allow asyncore to work. + 524 (asyncore likes to call C{'getpeername'}.) + 525 + 526 @return: the address if the remote host, if known + 527 @rtype: tuple(str, int) + 528 """ + 529 return self.transport.getpeername() +
530 +
531 - def close(self): +
532 """ + 533 Close the channel. All future read/write operations on the channel + 534 will fail. The remote end will receive no more data (after queued data + 535 is flushed). Channels are automatically closed when their L{Transport} + 536 is closed or when they are garbage collected. + 537 """ + 538 self.lock.acquire() + 539 try: + 540 # only close the pipe when the user explicitly closes the channel. + 541 # otherwise they will get unpleasant surprises. (and do it before + 542 # checking self.closed, since the remote host may have already + 543 # closed the connection.) + 544 if self._pipe is not None: + 545 self._pipe.close() + 546 self._pipe = None + 547 + 548 if not self.active or self.closed: + 549 return + 550 msgs = self._close_internal() + 551 finally: + 552 self.lock.release() + 553 for m in msgs: + 554 if m is not None: + 555 self.transport._send_user_message(m) +
556 +
557 - def recv_ready(self): +
558 """ + 559 Returns true if data is buffered and ready to be read from this + 560 channel. A C{False} result does not mean that the channel has closed; + 561 it means you may need to wait before more data arrives. + 562 + 563 @return: C{True} if a L{recv} call on this channel would immediately + 564 return at least one byte; C{False} otherwise. + 565 @rtype: boolean + 566 """ + 567 return self.in_buffer.read_ready() +
568 +
569 - def recv(self, nbytes): +
570 """ + 571 Receive data from the channel. The return value is a string + 572 representing the data received. The maximum amount of data to be + 573 received at once is specified by C{nbytes}. If a string of length zero + 574 is returned, the channel stream has closed. + 575 + 576 @param nbytes: maximum number of bytes to read. + 577 @type nbytes: int + 578 @return: data. + 579 @rtype: str + 580 + 581 @raise socket.timeout: if no data is ready before the timeout set by + 582 L{settimeout}. + 583 """ + 584 try: + 585 out = self.in_buffer.read(nbytes, self.timeout) + 586 except PipeTimeout, e: + 587 raise socket.timeout() + 588 + 589 ack = self._check_add_window(len(out)) + 590 # no need to hold the channel lock when sending this + 591 if ack > 0: + 592 m = Message() + 593 m.add_byte(chr(MSG_CHANNEL_WINDOW_ADJUST)) + 594 m.add_int(self.remote_chanid) + 595 m.add_int(ack) + 596 self.transport._send_user_message(m) + 597 + 598 return out +
599 +
600 - def recv_stderr_ready(self): +
601 """ + 602 Returns true if data is buffered and ready to be read from this + 603 channel's stderr stream. Only channels using L{exec_command} or + 604 L{invoke_shell} without a pty will ever have data on the stderr + 605 stream. + 606 + 607 @return: C{True} if a L{recv_stderr} call on this channel would + 608 immediately return at least one byte; C{False} otherwise. + 609 @rtype: boolean + 610 + 611 @since: 1.1 + 612 """ + 613 return self.in_stderr_buffer.read_ready() +
614 +
615 - def recv_stderr(self, nbytes): +
616 """ + 617 Receive data from the channel's stderr stream. Only channels using + 618 L{exec_command} or L{invoke_shell} without a pty will ever have data + 619 on the stderr stream. The return value is a string representing the + 620 data received. The maximum amount of data to be received at once is + 621 specified by C{nbytes}. If a string of length zero is returned, the + 622 channel stream has closed. + 623 + 624 @param nbytes: maximum number of bytes to read. + 625 @type nbytes: int + 626 @return: data. + 627 @rtype: str + 628 + 629 @raise socket.timeout: if no data is ready before the timeout set by + 630 L{settimeout}. + 631 + 632 @since: 1.1 + 633 """ + 634 try: + 635 out = self.in_stderr_buffer.read(nbytes, self.timeout) + 636 except PipeTimeout, e: + 637 raise socket.timeout() + 638 + 639 ack = self._check_add_window(len(out)) + 640 # no need to hold the channel lock when sending this + 641 if ack > 0: + 642 m = Message() + 643 m.add_byte(chr(MSG_CHANNEL_WINDOW_ADJUST)) + 644 m.add_int(self.remote_chanid) + 645 m.add_int(ack) + 646 self.transport._send_user_message(m) + 647 + 648 return out +
649 +
650 - def send_ready(self): +
651 """ + 652 Returns true if data can be written to this channel without blocking. + 653 This means the channel is either closed (so any write attempt would + 654 return immediately) or there is at least one byte of space in the + 655 outbound buffer. If there is at least one byte of space in the + 656 outbound buffer, a L{send} call will succeed immediately and return + 657 the number of bytes actually written. + 658 + 659 @return: C{True} if a L{send} call on this channel would immediately + 660 succeed or fail + 661 @rtype: boolean + 662 """ + 663 self.lock.acquire() + 664 try: + 665 if self.closed or self.eof_sent: + 666 return True + 667 return self.out_window_size > 0 + 668 finally: + 669 self.lock.release() +
670 +
671 - def send(self, s): +
672 """ + 673 Send data to the channel. Returns the number of bytes sent, or 0 if + 674 the channel stream is closed. Applications are responsible for + 675 checking that all data has been sent: if only some of the data was + 676 transmitted, the application needs to attempt delivery of the remaining + 677 data. + 678 + 679 @param s: data to send + 680 @type s: str + 681 @return: number of bytes actually sent + 682 @rtype: int + 683 + 684 @raise socket.timeout: if no data could be sent before the timeout set + 685 by L{settimeout}. + 686 """ + 687 size = len(s) + 688 self.lock.acquire() + 689 try: + 690 size = self._wait_for_send_window(size) + 691 if size == 0: + 692 # eof or similar + 693 return 0 + 694 m = Message() + 695 m.add_byte(chr(MSG_CHANNEL_DATA)) + 696 m.add_int(self.remote_chanid) + 697 m.add_string(s[:size]) + 698 finally: + 699 self.lock.release() + 700 # Note: We release self.lock before calling _send_user_message. + 701 # Otherwise, we can deadlock during re-keying. + 702 self.transport._send_user_message(m) + 703 return size +
704 +
705 - def send_stderr(self, s): +
706 """ + 707 Send data to the channel on the "stderr" stream. This is normally + 708 only used by servers to send output from shell commands -- clients + 709 won't use this. Returns the number of bytes sent, or 0 if the channel + 710 stream is closed. Applications are responsible for checking that all + 711 data has been sent: if only some of the data was transmitted, the + 712 application needs to attempt delivery of the remaining data. + 713 + 714 @param s: data to send. + 715 @type s: str + 716 @return: number of bytes actually sent. + 717 @rtype: int + 718 + 719 @raise socket.timeout: if no data could be sent before the timeout set + 720 by L{settimeout}. + 721 + 722 @since: 1.1 + 723 """ + 724 size = len(s) + 725 self.lock.acquire() + 726 try: + 727 size = self._wait_for_send_window(size) + 728 if size == 0: + 729 # eof or similar + 730 return 0 + 731 m = Message() + 732 m.add_byte(chr(MSG_CHANNEL_EXTENDED_DATA)) + 733 m.add_int(self.remote_chanid) + 734 m.add_int(1) + 735 m.add_string(s[:size]) + 736 finally: + 737 self.lock.release() + 738 # Note: We release self.lock before calling _send_user_message. + 739 # Otherwise, we can deadlock during re-keying. + 740 self.transport._send_user_message(m) + 741 return size +
742 +
743 - def sendall(self, s): +
744 """ + 745 Send data to the channel, without allowing partial results. Unlike + 746 L{send}, this method continues to send data from the given string until + 747 either all data has been sent or an error occurs. Nothing is returned. + 748 + 749 @param s: data to send. + 750 @type s: str + 751 + 752 @raise socket.timeout: if sending stalled for longer than the timeout + 753 set by L{settimeout}. + 754 @raise socket.error: if an error occured before the entire string was + 755 sent. + 756 + 757 @note: If the channel is closed while only part of the data hase been + 758 sent, there is no way to determine how much data (if any) was sent. + 759 This is irritating, but identically follows python's API. + 760 """ + 761 while s: + 762 if self.closed: + 763 # this doesn't seem useful, but it is the documented behavior of Socket + 764 raise socket.error('Socket is closed') + 765 sent = self.send(s) + 766 s = s[sent:] + 767 return None +
768 +
769 - def sendall_stderr(self, s): +
770 """ + 771 Send data to the channel's "stderr" stream, without allowing partial + 772 results. Unlike L{send_stderr}, this method continues to send data + 773 from the given string until all data has been sent or an error occurs. + 774 Nothing is returned. + 775 + 776 @param s: data to send to the client as "stderr" output. + 777 @type s: str + 778 + 779 @raise socket.timeout: if sending stalled for longer than the timeout + 780 set by L{settimeout}. + 781 @raise socket.error: if an error occured before the entire string was + 782 sent. + 783 + 784 @since: 1.1 + 785 """ + 786 while s: + 787 if self.closed: + 788 raise socket.error('Socket is closed') + 789 sent = self.send_stderr(s) + 790 s = s[sent:] + 791 return None +
792 +
793 - def makefile(self, *params): +
794 """ + 795 Return a file-like object associated with this channel. The optional + 796 C{mode} and C{bufsize} arguments are interpreted the same way as by + 797 the built-in C{file()} function in python. + 798 + 799 @return: object which can be used for python file I/O. + 800 @rtype: L{ChannelFile} + 801 """ + 802 return ChannelFile(*([self] + list(params))) +
803 +
804 - def makefile_stderr(self, *params): +
805 """ + 806 Return a file-like object associated with this channel's stderr + 807 stream. Only channels using L{exec_command} or L{invoke_shell} + 808 without a pty will ever have data on the stderr stream. + 809 + 810 The optional C{mode} and C{bufsize} arguments are interpreted the + 811 same way as by the built-in C{file()} function in python. For a + 812 client, it only makes sense to open this file for reading. For a + 813 server, it only makes sense to open this file for writing. + 814 + 815 @return: object which can be used for python file I/O. + 816 @rtype: L{ChannelFile} + 817 + 818 @since: 1.1 + 819 """ + 820 return ChannelStderrFile(*([self] + list(params))) +
821 +
822 - def fileno(self): +
823 """ + 824 Returns an OS-level file descriptor which can be used for polling, but + 825 but I{not} for reading or writing. This is primaily to allow python's + 826 C{select} module to work. + 827 + 828 The first time C{fileno} is called on a channel, a pipe is created to + 829 simulate real OS-level file descriptor (FD) behavior. Because of this, + 830 two OS-level FDs are created, which will use up FDs faster than normal. + 831 (You won't notice this effect unless you have hundreds of channels + 832 open at the same time.) + 833 + 834 @return: an OS-level file descriptor + 835 @rtype: int + 836 + 837 @warning: This method causes channel reads to be slightly less + 838 efficient. + 839 """ + 840 self.lock.acquire() + 841 try: + 842 if self._pipe is not None: + 843 return self._pipe.fileno() + 844 # create the pipe and feed in any existing data + 845 self._pipe = pipe.make_pipe() + 846 p1, p2 = pipe.make_or_pipe(self._pipe) + 847 self.in_buffer.set_event(p1) + 848 self.in_stderr_buffer.set_event(p2) + 849 return self._pipe.fileno() + 850 finally: + 851 self.lock.release() +
852 +
853 - def shutdown(self, how): +
854 """ + 855 Shut down one or both halves of the connection. If C{how} is 0, + 856 further receives are disallowed. If C{how} is 1, further sends + 857 are disallowed. If C{how} is 2, further sends and receives are + 858 disallowed. This closes the stream in one or both directions. + 859 + 860 @param how: 0 (stop receiving), 1 (stop sending), or 2 (stop + 861 receiving and sending). + 862 @type how: int + 863 """ + 864 if (how == 0) or (how == 2): + 865 # feign "read" shutdown + 866 self.eof_received = 1 + 867 if (how == 1) or (how == 2): + 868 self.lock.acquire() + 869 try: + 870 m = self._send_eof() + 871 finally: + 872 self.lock.release() + 873 if m is not None: + 874 self.transport._send_user_message(m) +
875 +
876 - def shutdown_read(self): +
877 """ + 878 Shutdown the receiving side of this socket, closing the stream in + 879 the incoming direction. After this call, future reads on this + 880 channel will fail instantly. This is a convenience method, equivalent + 881 to C{shutdown(0)}, for people who don't make it a habit to + 882 memorize unix constants from the 1970s. + 883 + 884 @since: 1.2 + 885 """ + 886 self.shutdown(0) +
887 +
888 - def shutdown_write(self): +
889 """ + 890 Shutdown the sending side of this socket, closing the stream in + 891 the outgoing direction. After this call, future writes on this + 892 channel will fail instantly. This is a convenience method, equivalent + 893 to C{shutdown(1)}, for people who don't make it a habit to + 894 memorize unix constants from the 1970s. + 895 + 896 @since: 1.2 + 897 """ + 898 self.shutdown(1) +
899 + 900 + 901 ### calls from Transport + 902 + 903 +
904 - def _set_transport(self, transport): +
907 +
908 - def _set_window(self, window_size, max_packet_size): +
909 self.in_window_size = window_size + 910 self.in_max_packet_size = max_packet_size + 911 # threshold of bytes we receive before we bother to send a window update + 912 self.in_window_threshold = window_size // 10 + 913 self.in_window_sofar = 0 + 914 self._log(DEBUG, 'Max packet in: %d bytes' % max_packet_size) +
915 +
916 - def _set_remote_channel(self, chanid, window_size, max_packet_size): +
917 self.remote_chanid = chanid + 918 self.out_window_size = window_size + 919 self.out_max_packet_size = max(max_packet_size, MIN_PACKET_SIZE) + 920 self.active = 1 + 921 self._log(DEBUG, 'Max packet out: %d bytes' % max_packet_size) +
922 +
923 - def _request_success(self, m): +
924 self._log(DEBUG, 'Sesch channel %d request ok' % self.chanid) + 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 _wait_for_event(self): +
1073 while True: +1074 self.event.wait(0.1) +1075 if self.event.isSet(): +1076 return +1077 if self.closed: +1078 e = self.transport.get_exception() +1079 if e is None: +1080 e = SSHException('Channel closed.') +1081 raise e +1082 return +
1083 +
1084 - def _set_closed(self): +
1085 # you are holding the lock. +1086 self.closed = True +1087 self.in_buffer.close() +1088 self.in_stderr_buffer.close() +1089 self.out_buffer_cv.notifyAll() +1090 if self._pipe is not None: +1091 self._pipe.set_forever() +
1092 +
1093 - def _send_eof(self): +
1094 # you are holding the lock. +1095 if self.eof_sent: +1096 return None +1097 m = Message() +1098 m.add_byte(chr(MSG_CHANNEL_EOF)) +1099 m.add_int(self.remote_chanid) +1100 self.eof_sent = True +1101 self._log(DEBUG, 'EOF sent (%s)', self._name) +1102 return m +
1103 +
1104 - def _close_internal(self): +
1105 # you are holding the lock. +1106 if not self.active or self.closed: +1107 return None, None +1108 m1 = self._send_eof() +1109 m2 = Message() +1110 m2.add_byte(chr(MSG_CHANNEL_CLOSE)) +1111 m2.add_int(self.remote_chanid) +1112 self._set_closed() +1113 # can't unlink from the Transport yet -- the remote side may still +1114 # try to send meta-data (exit-status, etc) +1115 return m1, m2 +
1116 +1127 +
1128 - def _check_add_window(self, n): +
1129 self.lock.acquire() +1130 try: +1131 if self.closed or self.eof_received or not self.active: +1132 return 0 +1133 if self.ultra_debug: +1134 self._log(DEBUG, 'addwindow %d' % n) +1135 self.in_window_sofar += n +1136 if self.in_window_sofar <= self.in_window_threshold: +1137 return 0 +1138 if self.ultra_debug: +1139 self._log(DEBUG, 'addwindow send %d' % self.in_window_sofar) +1140 out = self.in_window_sofar +1141 self.in_window_sofar = 0 +1142 return out +1143 finally: +1144 self.lock.release() +
1145 +
1146 - def _wait_for_send_window(self, size): +
1147 """ +1148 (You are already holding the lock.) +1149 Wait for the send window to open up, and allocate up to C{size} bytes +1150 for transmission. If no space opens up before the timeout, a timeout +1151 exception is raised. Returns the number of bytes available to send +1152 (may be less than requested). +1153 """ +1154 # you are already holding the lock +1155 if self.closed or self.eof_sent: +1156 return 0 +1157 if self.out_window_size == 0: +1158 # should we block? +1159 if self.timeout == 0.0: +1160 raise socket.timeout() +1161 # loop here in case we get woken up but a different thread has filled the buffer +1162 timeout = self.timeout +1163 while self.out_window_size == 0: +1164 if self.closed or self.eof_sent: +1165 return 0 +1166 then = time.time() +1167 self.out_buffer_cv.wait(timeout) +1168 if timeout != None: +1169 timeout -= time.time() - then +1170 if timeout <= 0.0: +1171 raise socket.timeout() +1172 # we have some window to squeeze into +1173 if self.closed or self.eof_sent: +1174 return 0 +1175 if self.out_window_size < size: +1176 size = self.out_window_size +1177 if self.out_max_packet_size - 64 < size: +1178 size = self.out_max_packet_size - 64 +1179 self.out_window_size -= size +1180 if self.ultra_debug: +1181 self._log(DEBUG, 'window down to %d' % self.out_window_size) +1182 return size +
1183 +1184 +
1185 -class ChannelFile (BufferedFile): +
1186 """ +1187 A file-like wrapper around L{Channel}. A ChannelFile is created by calling +1188 L{Channel.makefile}. +1189 +1190 @bug: To correctly emulate the file object created from a socket's +1191 C{makefile} method, a L{Channel} and its C{ChannelFile} should be able +1192 to be closed or garbage-collected independently. Currently, closing +1193 the C{ChannelFile} does nothing but flush the buffer. +1194 """ +1195 +
1196 - def __init__(self, channel, mode = 'r', bufsize = -1): +
1197 self.channel = channel +1198 BufferedFile.__init__(self) +1199 self._set_mode(mode, bufsize) +
1200 +
1201 - def __repr__(self): +
1202 """ +1203 Returns a string representation of this object, for debugging. +1204 +1205 @rtype: str +1206 """ +1207 return '<paramiko.ChannelFile from ' + repr(self.channel) + '>' +
1208 +
1209 - def _read(self, size): +
1210 return self.channel.recv(size) +
1211 +
1212 - def _write(self, data): +
1213 self.channel.sendall(data) +1214 return len(data) +
1215 +1216 +
1217 -class ChannelStderrFile (ChannelFile): +
1218 - def __init__(self, channel, mode = 'r', bufsize = -1): +
1219 ChannelFile.__init__(self, channel, mode, bufsize) +
1220 +
1221 - def _read(self, size): +
1222 return self.channel.recv_stderr(size) +
1223 +
1224 - def _write(self, data): +
1225 self.channel.sendall_stderr(data) +1226 return len(data) +
1227 +1228 +1229 # vim: set shiftwidth=4 expandtab : +1230 +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.channel.ChannelStderrFile-class.html b/docs/paramiko.channel.ChannelStderrFile-class.html new file mode 100644 index 0000000..c9faf36 --- /dev/null +++ b/docs/paramiko.channel.ChannelStderrFile-class.html @@ -0,0 +1,254 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..a5a17b2 --- /dev/null +++ b/docs/paramiko.client-module.html @@ -0,0 +1,525 @@ + + + + + paramiko.client + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module client + + + + + +
[frames] | no frames]
+
+ +

Module client

source code

+

SSHClient.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ 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 +
+   + + randpool = StrongLockingRandomPool() +
+ + + + + + +
+ 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 new file mode 100644 index 0000000..760992c --- /dev/null +++ b/docs/paramiko.client-pysrc.html @@ -0,0 +1,766 @@ + + + + + paramiko.client + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module client + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.client

+
+  1  # Copyright (C) 2006-2007  Robey Pointer <robey@lag.net> 
+  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 -class MissingHostKeyPolicy (object): +
40 """ + 41 Interface for defining the policy that L{SSHClient} should use when the + 42 SSH server's hostname is not in either the system host keys or the + 43 application's keys. Pre-made classes implement policies for automatically + 44 adding the key to the application's L{HostKeys} object (L{AutoAddPolicy}), + 45 and for automatically rejecting the key (L{RejectPolicy}). + 46 + 47 This function may be used to ask the user to verify the key, for example. + 48 """ + 49 +
50 - def missing_host_key(self, client, hostname, key): +
51 """ + 52 Called when an L{SSHClient} receives a server key for a server that + 53 isn't in either the system or local L{HostKeys} object. To accept + 54 the key, simply return. To reject, raised an exception (which will + 55 be passed to the calling application). + 56 """ + 57 pass +
58 + 59 +
60 -class AutoAddPolicy (MissingHostKeyPolicy): +
61 """ + 62 Policy for automatically adding the hostname and new host key to the + 63 local L{HostKeys} object, and saving it. This is used by L{SSHClient}. + 64 """ + 65 +
66 - def missing_host_key(self, client, hostname, key): +
67 client._host_keys.add(hostname, key.get_name(), key) + 68 if client._host_keys_filename is not None: + 69 client.save_host_keys(client._host_keys_filename) + 70 client._log(DEBUG, 'Adding %s host key for %s: %s' % + 71 (key.get_name(), hostname, hexlify(key.get_fingerprint()))) +
72 + 73 +
74 -class RejectPolicy (MissingHostKeyPolicy): +
75 """ + 76 Policy for automatically rejecting the unknown hostname & key. This is + 77 used by L{SSHClient}. + 78 """ + 79 +
80 - def missing_host_key(self, client, hostname, key): +
81 client._log(DEBUG, 'Rejecting %s host key for %s: %s' % + 82 (key.get_name(), hostname, hexlify(key.get_fingerprint()))) + 83 raise SSHException('Unknown server %s' % hostname) +
84 + 85 +
86 -class WarningPolicy (MissingHostKeyPolicy): +
87 """ + 88 Policy for logging a python-style warning for an unknown host key, but + 89 accepting it. This is used by L{SSHClient}. + 90 """ +
91 - def missing_host_key(self, client, hostname, key): +
92 warnings.warn('Unknown %s host key for %s: %s' % + 93 (key.get_name(), hostname, hexlify(key.get_fingerprint()))) +
94 + 95 +
96 -class SSHClient (object): +
97 """ + 98 A high-level representation of a session with an SSH server. This class + 99 wraps L{Transport}, L{Channel}, and L{SFTPClient} to take care of most +100 aspects of authenticating and opening channels. A typical use case is:: +101 +102 client = SSHClient() +103 client.load_system_host_keys() +104 client.connect('ssh.example.com') +105 stdin, stdout, stderr = client.exec_command('ls -l') +106 +107 You may pass in explicit overrides for authentication and server host key +108 checking. The default mechanism is to try to use local key files or an +109 SSH agent (if one is running). +110 +111 @since: 1.6 +112 """ +113 +
114 - def __init__(self): +
115 """ +116 Create a new SSHClient. +117 """ +118 self._system_host_keys = HostKeys() +119 self._host_keys = HostKeys() +120 self._host_keys_filename = None +121 self._log_channel = None +122 self._policy = RejectPolicy() +123 self._transport = None +
124 +
125 - def load_system_host_keys(self, filename=None): +
126 """ +127 Load host keys from a system (read-only) file. Host keys read with +128 this method will not be saved back by L{save_host_keys}. +129 +130 This method can be called multiple times. Each new set of host keys +131 will be merged with the existing set (new replacing old if there are +132 conflicts). +133 +134 If C{filename} is left as C{None}, an attempt will be made to read +135 keys from the user's local "known hosts" file, as used by OpenSSH, +136 and no exception will be raised if the file can't be read. This is +137 probably only useful on posix. +138 +139 @param filename: the filename to read, or C{None} +140 @type filename: str +141 +142 @raise IOError: if a filename was provided and the file could not be +143 read +144 """ +145 if filename is None: +146 # try the user's .ssh key file, and mask exceptions +147 filename = os.path.expanduser('~/.ssh/known_hosts') +148 try: +149 self._system_host_keys.load(filename) +150 except IOError: +151 pass +152 return +153 self._system_host_keys.load(filename) +
154 +
155 - def load_host_keys(self, filename): +
156 """ +157 Load host keys from a local host-key file. Host keys read with this +158 method will be checked I{after} keys loaded via L{load_system_host_keys}, +159 but will be saved back by L{save_host_keys} (so they can be modified). +160 The missing host key policy L{AutoAddPolicy} adds keys to this set and +161 saves them, when connecting to a previously-unknown server. +162 +163 This method can be called multiple times. Each new set of host keys +164 will be merged with the existing set (new replacing old if there are +165 conflicts). When automatically saving, the last hostname is used. +166 +167 @param filename: the filename to read +168 @type filename: str +169 +170 @raise IOError: if the filename could not be read +171 """ +172 self._host_keys_filename = filename +173 self._host_keys.load(filename) +
174 +
175 - def save_host_keys(self, filename): +
176 """ +177 Save the host keys back to a file. Only the host keys loaded with +178 L{load_host_keys} (plus any added directly) will be saved -- not any +179 host keys loaded with L{load_system_host_keys}. +180 +181 @param filename: the filename to save to +182 @type filename: str +183 +184 @raise IOError: if the file could not be written +185 """ +186 f = open(filename, 'w') +187 f.write('# SSH host keys collected by paramiko\n') +188 for hostname, keys in self._host_keys.iteritems(): +189 for keytype, key in keys.iteritems(): +190 f.write('%s %s %s\n' % (hostname, keytype, key.get_base64())) +191 f.close() +
192 +
193 - def get_host_keys(self): +
194 """ +195 Get the local L{HostKeys} object. This can be used to examine the +196 local host keys or change them. +197 +198 @return: the local host keys +199 @rtype: L{HostKeys} +200 """ +201 return self._host_keys +
202 +
203 - def set_log_channel(self, name): +
204 """ +205 Set the channel for logging. The default is C{"paramiko.transport"} +206 but it can be set to anything you want. +207 +208 @param name: new channel name for logging +209 @type name: str +210 """ +211 self._log_channel = name +
212 +
213 - def set_missing_host_key_policy(self, policy): +
214 """ +215 Set the policy to use when connecting to a server that doesn't have a +216 host key in either the system or local L{HostKeys} objects. The +217 default policy is to reject all unknown servers (using L{RejectPolicy}). +218 You may substitute L{AutoAddPolicy} or write your own policy class. +219 +220 @param policy: the policy to use when receiving a host key from a +221 previously-unknown server +222 @type policy: L{MissingHostKeyPolicy} +223 """ +224 self._policy = policy +
225 +
226 - def connect(self, hostname, port=22, username=None, password=None, pkey=None, +227 key_filename=None, timeout=None, allow_agent=True, look_for_keys=True): +
228 """ +229 Connect to an SSH server and authenticate to it. The server's host key +230 is checked against the system host keys (see L{load_system_host_keys}) +231 and any local host keys (L{load_host_keys}). If the server's hostname +232 is not found in either set of host keys, the missing host key policy +233 is used (see L{set_missing_host_key_policy}). The default policy is +234 to reject the key and raise an L{SSHException}. +235 +236 Authentication is attempted in the following order of priority: +237 +238 - The C{pkey} or C{key_filename} passed in (if any) +239 - Any key we can find through an SSH agent +240 - Any "id_rsa" or "id_dsa" key discoverable in C{~/.ssh/} +241 - Plain username/password auth, if a password was given +242 +243 If a private key requires a password to unlock it, and a password is +244 passed in, that password will be used to attempt to unlock the key. +245 +246 @param hostname: the server to connect to +247 @type hostname: str +248 @param port: the server port to connect to +249 @type port: int +250 @param username: the username to authenticate as (defaults to the +251 current local username) +252 @type username: str +253 @param password: a password to use for authentication or for unlocking +254 a private key +255 @type password: str +256 @param pkey: an optional private key to use for authentication +257 @type pkey: L{PKey} +258 @param key_filename: the filename, or list of filenames, of optional +259 private key(s) to try for authentication +260 @type key_filename: str or list(str) +261 @param timeout: an optional timeout (in seconds) for the TCP connect +262 @type timeout: float +263 @param allow_agent: set to False to disable connecting to the SSH agent +264 @type allow_agent: bool +265 @param look_for_keys: set to False to disable searching for discoverable +266 private key files in C{~/.ssh/} +267 @type look_for_keys: bool +268 +269 @raise BadHostKeyException: if the server's host key could not be +270 verified +271 @raise AuthenticationException: if authentication failed +272 @raise SSHException: if there was any other error connecting or +273 establishing an SSH session +274 @raise socket.error: if a socket error occurred while connecting +275 """ +276 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +277 if timeout is not None: +278 try: +279 sock.settimeout(timeout) +280 except: +281 pass +282 +283 sock.connect((hostname, port)) +284 t = self._transport = Transport(sock) +285 +286 if self._log_channel is not None: +287 t.set_log_channel(self._log_channel) +288 t.start_client() +289 ResourceManager.register(self, t) +290 +291 server_key = t.get_remote_server_key() +292 keytype = server_key.get_name() +293 +294 our_server_key = self._system_host_keys.get(hostname, {}).get(keytype, None) +295 if our_server_key is None: +296 our_server_key = self._host_keys.get(hostname, {}).get(keytype, None) +297 if our_server_key is None: +298 # will raise exception if the key is rejected; let that fall out +299 self._policy.missing_host_key(self, hostname, server_key) +300 # if the callback returns, assume the key is ok +301 our_server_key = server_key +302 +303 if server_key != our_server_key: +304 raise BadHostKeyException(hostname, server_key, our_server_key) +305 +306 if username is None: +307 username = getpass.getuser() +308 +309 if key_filename is None: +310 key_filenames = [] +311 elif isinstance(key_filename, (str, unicode)): +312 key_filenames = [ key_filename ] +313 else: +314 key_filenames = key_filename +315 self._auth(username, password, pkey, key_filenames, allow_agent, look_for_keys) +
316 +
317 - def close(self): +
318 """ +319 Close this SSHClient and its underlying L{Transport}. +320 """ +321 if self._transport is None: +322 return +323 self._transport.close() +324 self._transport = None +
325 +
326 - def exec_command(self, command, bufsize=-1): +
327 """ +328 Execute a command on the SSH server. A new L{Channel} is opened and +329 the requested command is executed. The command's input and output +330 streams are returned as python C{file}-like objects representing +331 stdin, stdout, and stderr. +332 +333 @param command: the command to execute +334 @type command: str +335 @param bufsize: interpreted the same way as by the built-in C{file()} function in python +336 @type bufsize: int +337 @return: the stdin, stdout, and stderr of the executing command +338 @rtype: tuple(L{ChannelFile}, L{ChannelFile}, L{ChannelFile}) +339 +340 @raise SSHException: if the server fails to execute the command +341 """ +342 chan = self._transport.open_session() +343 chan.exec_command(command) +344 stdin = chan.makefile('wb', bufsize) +345 stdout = chan.makefile('rb', bufsize) +346 stderr = chan.makefile_stderr('rb', bufsize) +347 return stdin, stdout, stderr +
348 +
349 - def invoke_shell(self, term='vt100', width=80, height=24): +
350 """ +351 Start an interactive shell session on the SSH server. A new L{Channel} +352 is opened and connected to a pseudo-terminal using the requested +353 terminal type and size. +354 +355 @param term: the terminal type to emulate (for example, C{"vt100"}) +356 @type term: str +357 @param width: the width (in characters) of the terminal window +358 @type width: int +359 @param height: the height (in characters) of the terminal window +360 @type height: int +361 @return: a new channel connected to the remote shell +362 @rtype: L{Channel} +363 +364 @raise SSHException: if the server fails to invoke a shell +365 """ +366 chan = self._transport.open_session() +367 chan.get_pty(term, width, height) +368 chan.invoke_shell() +369 return chan +
370 +
371 - def open_sftp(self): +
372 """ +373 Open an SFTP session on the SSH server. +374 +375 @return: a new SFTP session object +376 @rtype: L{SFTPClient} +377 """ +378 return self._transport.open_sftp_client() +
379 +
380 - def get_transport(self): +
381 """ +382 Return the underlying L{Transport} object for this SSH connection. +383 This can be used to perform lower-level tasks, like opening specific +384 kinds of channels. +385 +386 @return: the Transport for this connection +387 @rtype: L{Transport} +388 """ +389 return self._transport +
390 +
391 - def _auth(self, username, password, pkey, key_filenames, allow_agent, look_for_keys): +
392 """ +393 Try, in order: +394 +395 - The key passed in, if one was passed in. +396 - Any key we can find through an SSH agent (if allowed). +397 - Any "id_rsa" or "id_dsa" key discoverable in ~/.ssh/ (if allowed). +398 - Plain username/password auth, if a password was given. +399 +400 (The password might be needed to unlock a private key.) +401 """ +402 saved_exception = None +403 +404 if pkey is not None: +405 try: +406 self._log(DEBUG, 'Trying SSH key %s' % hexlify(pkey.get_fingerprint())) +407 self._transport.auth_publickey(username, pkey) +408 return +409 except SSHException, e: +410 saved_exception = e +411 +412 for key_filename in key_filenames: +413 for pkey_class in (RSAKey, DSSKey): +414 try: +415 key = pkey_class.from_private_key_file(key_filename, password) +416 self._log(DEBUG, 'Trying key %s from %s' % (hexlify(key.get_fingerprint()), key_filename)) +417 self._transport.auth_publickey(username, key) +418 return +419 except SSHException, e: +420 saved_exception = e +421 +422 if allow_agent: +423 for key in Agent().get_keys(): +424 try: +425 self._log(DEBUG, 'Trying SSH agent key %s' % hexlify(key.get_fingerprint())) +426 self._transport.auth_publickey(username, key) +427 return +428 except SSHException, e: +429 saved_exception = e +430 +431 keyfiles = [] +432 rsa_key = os.path.expanduser('~/.ssh/id_rsa') +433 dsa_key = os.path.expanduser('~/.ssh/id_dsa') +434 if os.path.isfile(rsa_key): +435 keyfiles.append((RSAKey, rsa_key)) +436 if os.path.isfile(dsa_key): +437 keyfiles.append((DSSKey, dsa_key)) +438 # look in ~/ssh/ for windows users: +439 rsa_key = os.path.expanduser('~/ssh/id_rsa') +440 dsa_key = os.path.expanduser('~/ssh/id_dsa') +441 if os.path.isfile(rsa_key): +442 keyfiles.append((RSAKey, rsa_key)) +443 if os.path.isfile(dsa_key): +444 keyfiles.append((DSSKey, dsa_key)) +445 +446 if not look_for_keys: +447 keyfiles = [] +448 +449 for pkey_class, filename in keyfiles: +450 try: +451 key = pkey_class.from_private_key_file(filename, password) +452 self._log(DEBUG, 'Trying discovered key %s in %s' % (hexlify(key.get_fingerprint()), filename)) +453 self._transport.auth_publickey(username, key) +454 return +455 except SSHException, e: +456 saved_exception = e +457 except IOError, e: +458 saved_exception = e +459 +460 if password is not None: +461 try: +462 self._transport.auth_password(username, password) +463 return +464 except SSHException, e: +465 saved_exception = e +466 +467 # if we got an auth-failed exception earlier, re-raise it +468 if saved_exception is not None: +469 raise saved_exception +470 raise SSHException('No authentication methods available') +
471 +
472 - def _log(self, level, msg): +
473 self._transport._log(level, msg) +
474 +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.common-module.html b/docs/paramiko.common-module.html new file mode 100644 index 0000000..75d880c --- /dev/null +++ b/docs/paramiko.common-module.html @@ -0,0 +1,524 @@ + + + + + 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:... +
+   + + randpool = StrongLockingRandomPool() +
+   + + 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 +
+ + + + + + +
+ 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 new file mode 100644 index 0000000..31c5a24 --- /dev/null +++ b/docs/paramiko.common-pysrc.html @@ -0,0 +1,1905 @@ + + + + + paramiko.common + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module common + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.common

+
+  1  # Copyright (C) 2003-2007  Robey Pointer <robey@lag.net> 
+  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 rng import StrongLockingRandomPool 
+ 99   
+100  # keep a crypto-strong PRNG nearby 
+101  randpool = StrongLockingRandomPool() 
+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 new file mode 100644 index 0000000..2c8066b --- /dev/null +++ b/docs/paramiko.compress-module.html @@ -0,0 +1,127 @@ + + + + + paramiko.compress + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module compress + + + + + +
[frames] | no frames]
+
+ +

Module compress

source code

+

Compression implementations for a Transport.

+ + + + + + + + + + + + + +
+ Classes
+   + + ZlibCompressor +
+   + + ZlibDecompressor +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.compress-pysrc.html b/docs/paramiko.compress-pysrc.html new file mode 100644 index 0000000..47f4de1 --- /dev/null +++ b/docs/paramiko.compress-pysrc.html @@ -0,0 +1,148 @@ + + + + + paramiko.compress + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module compress + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.compress

+
+ 1  # Copyright (C) 2003-2007  Robey Pointer <robey@lag.net> 
+ 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 new file mode 100644 index 0000000..a908778 --- /dev/null +++ b/docs/paramiko.compress.ZlibCompressor-class.html @@ -0,0 +1,219 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..2b17b39 --- /dev/null +++ b/docs/paramiko.compress.ZlibDecompressor-class.html @@ -0,0 +1,219 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..36e5820 --- /dev/null +++ b/docs/paramiko.config-module.html @@ -0,0 +1,105 @@ + + + + + paramiko.config + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module config + + + + + +
[frames] | no frames]
+
+ +

Module config

source code

+

SSHConfig.

+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.config-pysrc.html b/docs/paramiko.config-pysrc.html new file mode 100644 index 0000000..d832929 --- /dev/null +++ b/docs/paramiko.config-pysrc.html @@ -0,0 +1,214 @@ + + + + + paramiko.config + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module config + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.config

+
+  1  # Copyright (C) 2006-2007  Robey Pointer <robey@lag.net> 
+  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 config = 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 # do we have a pre-existing host config to append to? + 70 matches = [c for c in self._config if c['host'] == value] + 71 if len(matches) > 0: + 72 config = matches[0] + 73 else: + 74 config = { 'host': value } + 75 self._config.append(config) + 76 else: + 77 config[key] = value +
78 +
79 - def lookup(self, hostname): +
80 """ + 81 Return a dict of config options for a given hostname. + 82 + 83 The host-matching rules of OpenSSH's C{ssh_config} man page are used, + 84 which means that all configuration options from matching host + 85 specifications are merged, with more specific hostmasks taking + 86 precedence. In other words, if C{"Port"} is set under C{"Host *"} + 87 and also C{"Host *.example.com"}, and the lookup is for + 88 C{"ssh.example.com"}, then the port entry for C{"Host *.example.com"} + 89 will win out. + 90 + 91 The keys in the returned dict are all normalized to lowercase (look for + 92 C{"port"}, not C{"Port"}. No other processing is done to the keys or + 93 values. + 94 + 95 @param hostname: the hostname to lookup + 96 @type hostname: str + 97 """ + 98 matches = [x for x in self._config if fnmatch.fnmatch(hostname, x['host'])] + 99 # sort in order of shortest match (usually '*') to longest +100 matches.sort(lambda x,y: cmp(len(x['host']), len(y['host']))) +101 ret = {} +102 for m in matches: +103 ret.update(m) +104 del ret['host'] +105 return ret +
106 +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.dsskey-module.html b/docs/paramiko.dsskey-module.html new file mode 100644 index 0000000..60963b7 --- /dev/null +++ b/docs/paramiko.dsskey-module.html @@ -0,0 +1,524 @@ + + + + + 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 +
+   + + randpool = StrongLockingRandomPool() +
+ + + + + + +
+ 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 new file mode 100644 index 0000000..1346b99 --- /dev/null +++ b/docs/paramiko.dsskey-pysrc.html @@ -0,0 +1,355 @@ + + + + + paramiko.dsskey + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module dsskey + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.dsskey

+
+  1  # Copyright (C) 2003-2007  Robey Pointer <robey@lag.net> 
+  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, rpool, 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(rpool.get_bytes(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 randpool.stir() +165 dsa = DSA.generate(bits, randpool.get_bytes, progress_func) +166 key = DSSKey(vals=(dsa.p, dsa.q, dsa.g, dsa.y)) +167 key.x = dsa.x +168 return key +
169 generate = staticmethod(generate) +170 +171 +172 ### internals... +173 +174 +
175 - def _from_private_key_file(self, filename, password): +
176 data = self._read_private_key_file('DSA', filename, password) +177 self._decode_key(data) +
178 +
179 - def _from_private_key(self, file_obj, password): +
180 data = self._read_private_key('DSA', file_obj, password) +181 self._decode_key(data) +
182 +
183 - def _decode_key(self, data): +
184 # private key file contains: +185 # DSAPrivateKey = { version = 0, p, q, g, y, x } +186 try: +187 keylist = BER(data).decode() +188 except BERException, x: +189 raise SSHException('Unable to parse key file: ' + str(x)) +190 if (type(keylist) is not list) or (len(keylist) < 6) or (keylist[0] != 0): +191 raise SSHException('not a valid DSA private key file (bad ber encoding)') +192 self.p = keylist[1] +193 self.q = keylist[2] +194 self.g = keylist[3] +195 self.y = keylist[4] +196 self.x = keylist[5] +197 self.size = util.bit_length(self.p) +
198 +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.file-module.html b/docs/paramiko.file-module.html new file mode 100644 index 0000000..cd4f9e7 --- /dev/null +++ b/docs/paramiko.file-module.html @@ -0,0 +1,104 @@ + + + + + paramiko.file + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module file + + + + + +
[frames] | no frames]
+
+ +

Module file

source code

+

BufferedFile.

+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.file-pysrc.html b/docs/paramiko.file-pysrc.html new file mode 100644 index 0000000..0679425 --- /dev/null +++ b/docs/paramiko.file-pysrc.html @@ -0,0 +1,579 @@ + + + + + paramiko.file + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module file + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.file

+
+  1  # Copyright (C) 2003-2007  Robey Pointer <robey@lag.net> 
+  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 new file mode 100644 index 0000000..397bafa --- /dev/null +++ b/docs/paramiko.hostkeys-module.html @@ -0,0 +1,542 @@ + + + + + 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 +
+   + + randpool = StrongLockingRandomPool() +
+ + + + + + +
+ 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 new file mode 100644 index 0000000..4bf0c59 --- /dev/null +++ b/docs/paramiko.hostkeys-pysrc.html @@ -0,0 +1,499 @@ + + + + + paramiko.hostkeys + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module hostkeys + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.hostkeys

+
+  1  # Copyright (C) 2006-2007  Robey Pointer <robey@lag.net> 
+  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 + 60 names, keytype, key = fields + 61 names = names.split(',') + 62 + 63 # Decide what kind of key we're looking at and create an object + 64 # to hold it accordingly. + 65 if keytype == 'ssh-rsa': + 66 key = RSAKey(data=base64.decodestring(key)) + 67 elif keytype == 'ssh-dss': + 68 key = DSSKey(data=base64.decodestring(key)) + 69 else: + 70 return None + 71 + 72 return cls(names, key) +
73 from_line = classmethod(from_line) + 74 +
75 - def to_line(self): +
76 """ + 77 Returns a string in OpenSSH known_hosts file format, or None if + 78 the object is not in a valid state. A trailing newline is + 79 included. + 80 """ + 81 if self.valid: + 82 return '%s %s %s\n' % (','.join(self.hostnames), self.key.get_name(), + 83 self.key.get_base64()) + 84 return None +
85 +
86 - def __repr__(self): +
87 return '<HostKeyEntry %r: %r>' % (self.hostnames, self.key) +
88 + 89 +
90 -class HostKeys (UserDict.DictMixin): +
91 """ + 92 Representation of an openssh-style "known hosts" file. Host keys can be + 93 read from one or more files, and then individual hosts can be looked up to + 94 verify server keys during SSH negotiation. + 95 + 96 A HostKeys object can be treated like a dict; any dict lookup is equivalent + 97 to calling L{lookup}. + 98 + 99 @since: 1.5.3 +100 """ +101 +
102 - def __init__(self, filename=None): +
103 """ +104 Create a new HostKeys object, optionally loading keys from an openssh +105 style host-key file. +106 +107 @param filename: filename to load host keys from, or C{None} +108 @type filename: str +109 """ +110 # emulate a dict of { hostname: { keytype: PKey } } +111 self._entries = [] +112 if filename is not None: +113 self.load(filename) +
114 +
115 - def add(self, hostname, keytype, key): +
116 """ +117 Add a host key entry to the table. Any existing entry for a +118 C{(hostname, keytype)} pair will be replaced. +119 +120 @param hostname: the hostname (or IP) to add +121 @type hostname: str +122 @param keytype: key type (C{"ssh-rsa"} or C{"ssh-dss"}) +123 @type keytype: str +124 @param key: the key to add +125 @type key: L{PKey} +126 """ +127 for e in self._entries: +128 if (hostname in e.hostnames) and (e.key.get_name() == keytype): +129 e.key = key +130 return +131 self._entries.append(HostKeyEntry([hostname], key)) +
132 +
133 - def load(self, filename): +
134 """ +135 Read a file of known SSH host keys, in the format used by openssh. +136 This type of file unfortunately doesn't exist on Windows, but on +137 posix, it will usually be stored in +138 C{os.path.expanduser("~/.ssh/known_hosts")}. +139 +140 If this method is called multiple times, the host keys are merged, +141 not cleared. So multiple calls to C{load} will just call L{add}, +142 replacing any existing entries and adding new ones. +143 +144 @param filename: name of the file to read host keys from +145 @type filename: str +146 +147 @raise IOError: if there was an error reading the file +148 """ +149 f = open(filename, 'r') +150 for line in f: +151 line = line.strip() +152 if (len(line) == 0) or (line[0] == '#'): +153 continue +154 e = HostKeyEntry.from_line(line) +155 if e is not None: +156 self._entries.append(e) +157 f.close() +
158 +
159 - def save(self, filename): +
160 """ +161 Save host keys into a file, in the format used by openssh. The order of +162 keys in the file will be preserved when possible (if these keys were +163 loaded from a file originally). The single exception is that combined +164 lines will be split into individual key lines, which is arguably a bug. +165 +166 @param filename: name of the file to write +167 @type filename: str +168 +169 @raise IOError: if there was an error writing the file +170 +171 @since: 1.6.1 +172 """ +173 f = open(filename, 'w') +174 for e in self._entries: +175 line = e.to_line() +176 if line: +177 f.write(line) +178 f.close() +
179 +
180 - def lookup(self, hostname): +
181 """ +182 Find a hostkey entry for a given hostname or IP. If no entry is found, +183 C{None} is returned. Otherwise a dictionary of keytype to key is +184 returned. The keytype will be either C{"ssh-rsa"} or C{"ssh-dss"}. +185 +186 @param hostname: the hostname (or IP) to lookup +187 @type hostname: str +188 @return: keys associated with this host (or C{None}) +189 @rtype: dict(str, L{PKey}) +190 """ +191 class SubDict (UserDict.DictMixin): +192 def __init__(self, hostname, entries, hostkeys): +193 self._hostname = hostname +194 self._entries = entries +195 self._hostkeys = hostkeys +
196 +197 def __getitem__(self, key): +198 for e in self._entries: +199 if e.key.get_name() == key: +200 return e.key +201 raise KeyError(key) +
202 +203 def __setitem__(self, key, val): +204 for e in self._entries: +205 if e.key is None: +206 continue +207 if e.key.get_name() == key: +208 # replace +209 e.key = val +210 break +211 else: +212 # add a new one +213 e = HostKeyEntry([hostname], val) +214 self._entries.append(e) +215 self._hostkeys._entries.append(e) +216 +217 def keys(self): +218 return [e.key.get_name() for e in self._entries if e.key is not None] +219 +220 entries = [] +221 for e in self._entries: +222 for h in e.hostnames: +223 if (h.startswith('|1|') and (self.hash_host(hostname, h) == h)) or (h == hostname): +224 entries.append(e) +225 if len(entries) == 0: +226 return None +227 return SubDict(hostname, entries, self) +228 +
229 - def check(self, hostname, key): +
230 """ +231 Return True if the given key is associated with the given hostname +232 in this dictionary. +233 +234 @param hostname: hostname (or IP) of the SSH server +235 @type hostname: str +236 @param key: the key to check +237 @type key: L{PKey} +238 @return: C{True} if the key is associated with the hostname; C{False} +239 if not +240 @rtype: bool +241 """ +242 k = self.lookup(hostname) +243 if k is None: +244 return False +245 host_key = k.get(key.get_name(), None) +246 if host_key is None: +247 return False +248 return str(host_key) == str(key) +
249 +
250 - def clear(self): +
251 """ +252 Remove all host keys from the dictionary. +253 """ +254 self._entries = [] +
255 +
256 - def __getitem__(self, key): +
257 ret = self.lookup(key) +258 if ret is None: +259 raise KeyError(key) +260 return ret +
261 +
262 - def __setitem__(self, hostname, entry): +
263 # don't use this please. +264 if len(entry) == 0: +265 self._entries.append(HostKeyEntry([hostname], None)) +266 return +267 for key_type in entry.keys(): +268 found = False +269 for e in self._entries: +270 if (hostname in e.hostnames) and (e.key.get_name() == key_type): +271 # replace +272 e.key = entry[key_type] +273 found = True +274 if not found: +275 self._entries.append(HostKeyEntry([hostname], entry[key_type])) +
276 +
277 - def keys(self): +
278 # python 2.4 sets would be nice here. +279 ret = [] +280 for e in self._entries: +281 for h in e.hostnames: +282 if h not in ret: +283 ret.append(h) +284 return ret +
285 +
286 - def values(self): +
287 ret = [] +288 for k in self.keys(): +289 ret.append(self.lookup(k)) +290 return ret +
291 +
292 - def hash_host(hostname, salt=None): +
293 """ +294 Return a "hashed" form of the hostname, as used by openssh when storing +295 hashed hostnames in the known_hosts file. +296 +297 @param hostname: the hostname to hash +298 @type hostname: str +299 @param salt: optional salt to use when hashing (must be 20 bytes long) +300 @type salt: str +301 @return: the hashed hostname +302 @rtype: str +303 """ +304 if salt is None: +305 salt = randpool.get_bytes(SHA.digest_size) +306 else: +307 if salt.startswith('|1|'): +308 salt = salt.split('|')[2] +309 salt = base64.decodestring(salt) +310 assert len(salt) == SHA.digest_size +311 hmac = HMAC.HMAC(salt, hostname, SHA).digest() +312 hostkey = '|1|%s|%s' % (base64.encodestring(salt), base64.encodestring(hmac)) +313 return hostkey.replace('\n', '') +
314 hash_host = staticmethod(hash_host) +315 +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.hostkeys.HostKeyEntry-class.html b/docs/paramiko.hostkeys.HostKeyEntry-class.html new file mode 100644 index 0000000..99256a7 --- /dev/null +++ b/docs/paramiko.hostkeys.HostKeyEntry-class.html @@ -0,0 +1,255 @@ + + + + + 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 new file mode 100644 index 0000000..b2d8668 --- /dev/null +++ b/docs/paramiko.kex_gex-module.html @@ -0,0 +1,543 @@ + + + + + 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 +
+   + + randpool = StrongLockingRandomPool() +
+ + + + + + +
+ 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 new file mode 100644 index 0000000..2bc411e --- /dev/null +++ b/docs/paramiko.kex_gex-pysrc.html @@ -0,0 +1,483 @@ + + + + + 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 <robey@lag.net> 
+  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 self.transport.randpool.stir() +105 x_bytes = self.transport.randpool.get_bytes(bytes) +106 x_bytes = chr(ord(x_bytes[0]) & qmask) + x_bytes[1:] +107 x = util.inflate_long(x_bytes, 1) +108 if (x > 1) and (x < q): +109 break +110 self.x = x +
111 +
112 - def _parse_kexdh_gex_request(self, m): +
113 minbits = m.get_int() +114 preferredbits = m.get_int() +115 maxbits = m.get_int() +116 # smoosh the user's preferred size into our own limits +117 if preferredbits > self.max_bits: +118 preferredbits = self.max_bits +119 if preferredbits < self.min_bits: +120 preferredbits = self.min_bits +121 # fix min/max if they're inconsistent. technically, we could just pout +122 # and hang up, but there's no harm in giving them the benefit of the +123 # doubt and just picking a bitsize for them. +124 if minbits > preferredbits: +125 minbits = preferredbits +126 if maxbits < preferredbits: +127 maxbits = preferredbits +128 # now save a copy +129 self.min_bits = minbits +130 self.preferred_bits = preferredbits +131 self.max_bits = maxbits +132 # generate prime +133 pack = self.transport._get_modulus_pack() +134 if pack is None: +135 raise SSHException('Can\'t do server-side gex with no modulus pack') +136 self.transport._log(DEBUG, 'Picking p (%d <= %d <= %d bits)' % (minbits, preferredbits, maxbits)) +137 self.g, self.p = pack.get_modulus(minbits, preferredbits, maxbits) +138 m = Message() +139 m.add_byte(chr(_MSG_KEXDH_GEX_GROUP)) +140 m.add_mpint(self.p) +141 m.add_mpint(self.g) +142 self.transport._send_message(m) +143 self.transport._expect_packet(_MSG_KEXDH_GEX_INIT) +
144 +
145 - def _parse_kexdh_gex_request_old(self, m): +
146 # same as above, but without min_bits or max_bits (used by older clients like putty) +147 self.preferred_bits = m.get_int() +148 # smoosh the user's preferred size into our own limits +149 if self.preferred_bits > self.max_bits: +150 self.preferred_bits = self.max_bits +151 if self.preferred_bits < self.min_bits: +152 self.preferred_bits = self.min_bits +153 # generate prime +154 pack = self.transport._get_modulus_pack() +155 if pack is None: +156 raise SSHException('Can\'t do server-side gex with no modulus pack') +157 self.transport._log(DEBUG, 'Picking p (~ %d bits)' % (self.preferred_bits,)) +158 self.g, self.p = pack.get_modulus(self.min_bits, self.preferred_bits, self.max_bits) +159 m = Message() +160 m.add_byte(chr(_MSG_KEXDH_GEX_GROUP)) +161 m.add_mpint(self.p) +162 m.add_mpint(self.g) +163 self.transport._send_message(m) +164 self.transport._expect_packet(_MSG_KEXDH_GEX_INIT) +165 self.old_style = True +
166 +
167 - def _parse_kexdh_gex_group(self, m): +
168 self.p = m.get_mpint() +169 self.g = m.get_mpint() +170 # reject if p's bit length < 1024 or > 8192 +171 bitlen = util.bit_length(self.p) +172 if (bitlen < 1024) or (bitlen > 8192): +173 raise SSHException('Server-generated gex p (don\'t ask) is out of range (%d bits)' % bitlen) +174 self.transport._log(DEBUG, 'Got server p (%d bits)' % bitlen) +175 self._generate_x() +176 # now compute e = g^x mod p +177 self.e = pow(self.g, self.x, self.p) +178 m = Message() +179 m.add_byte(chr(_MSG_KEXDH_GEX_INIT)) +180 m.add_mpint(self.e) +181 self.transport._send_message(m) +182 self.transport._expect_packet(_MSG_KEXDH_GEX_REPLY) +
183 +
184 - def _parse_kexdh_gex_init(self, m): +
185 self.e = m.get_mpint() +186 if (self.e < 1) or (self.e > self.p - 1): +187 raise SSHException('Client kex "e" is out of range') +188 self._generate_x() +189 self.f = pow(self.g, self.x, self.p) +190 K = pow(self.e, self.x, self.p) +191 key = str(self.transport.get_server_key()) +192 # 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) +193 hm = Message() +194 hm.add(self.transport.remote_version, self.transport.local_version, +195 self.transport.remote_kex_init, self.transport.local_kex_init, +196 key) +197 if not self.old_style: +198 hm.add_int(self.min_bits) +199 hm.add_int(self.preferred_bits) +200 if not self.old_style: +201 hm.add_int(self.max_bits) +202 hm.add_mpint(self.p) +203 hm.add_mpint(self.g) +204 hm.add_mpint(self.e) +205 hm.add_mpint(self.f) +206 hm.add_mpint(K) +207 H = SHA.new(str(hm)).digest() +208 self.transport._set_K_H(K, H) +209 # sign it +210 sig = self.transport.get_server_key().sign_ssh_data(self.transport.randpool, H) +211 # send reply +212 m = Message() +213 m.add_byte(chr(_MSG_KEXDH_GEX_REPLY)) +214 m.add_string(key) +215 m.add_mpint(self.f) +216 m.add_string(str(sig)) +217 self.transport._send_message(m) +218 self.transport._activate_outbound() +
219 +
220 - def _parse_kexdh_gex_reply(self, m): +
221 host_key = m.get_string() +222 self.f = m.get_mpint() +223 sig = m.get_string() +224 if (self.f < 1) or (self.f > self.p - 1): +225 raise SSHException('Server kex "f" is out of range') +226 K = pow(self.f, self.x, self.p) +227 # 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) +228 hm = Message() +229 hm.add(self.transport.local_version, self.transport.remote_version, +230 self.transport.local_kex_init, self.transport.remote_kex_init, +231 host_key) +232 if not self.old_style: +233 hm.add_int(self.min_bits) +234 hm.add_int(self.preferred_bits) +235 if not self.old_style: +236 hm.add_int(self.max_bits) +237 hm.add_mpint(self.p) +238 hm.add_mpint(self.g) +239 hm.add_mpint(self.e) +240 hm.add_mpint(self.f) +241 hm.add_mpint(K) +242 self.transport._set_K_H(K, SHA.new(str(hm)).digest()) +243 self.transport._verify_key(host_key, sig) +244 self.transport._activate_outbound() +
245 +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.kex_gex.KexGex-class.html b/docs/paramiko.kex_gex.KexGex-class.html new file mode 100644 index 0000000..02b53fc --- /dev/null +++ b/docs/paramiko.kex_gex.KexGex-class.html @@ -0,0 +1,276 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + + + + +
+ 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 new file mode 100644 index 0000000..0c6b972 --- /dev/null +++ b/docs/paramiko.kex_group1-module.html @@ -0,0 +1,582 @@ + + + + + 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 +
+   + + randpool = StrongLockingRandomPool() +
+ + + + + + +
+ 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 new file mode 100644 index 0000000..1d32b96 --- /dev/null +++ b/docs/paramiko.kex_group1-pysrc.html @@ -0,0 +1,312 @@ + + + + + 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 <robey@lag.net> 
+  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 self.transport.randpool.stir() + 83 x_bytes = self.transport.randpool.get_bytes(128) + 84 x_bytes = chr(ord(x_bytes[0]) & 0x7f) + x_bytes[1:] + 85 if (x_bytes[:8] != '\x7F\xFF\xFF\xFF\xFF\xFF\xFF\xFF') and \ + 86 (x_bytes[:8] != '\x00\x00\x00\x00\x00\x00\x00\x00'): + 87 break + 88 self.x = util.inflate_long(x_bytes) +
89 +
90 - def _parse_kexdh_reply(self, m): +
91 # client mode + 92 host_key = m.get_string() + 93 self.f = m.get_mpint() + 94 if (self.f < 1) or (self.f > P - 1): + 95 raise SSHException('Server kex "f" is out of range') + 96 sig = m.get_string() + 97 K = pow(self.f, self.x, P) + 98 # okay, build up the hash H of (V_C || V_S || I_C || I_S || K_S || e || f || K) + 99 hm = Message() +100 hm.add(self.transport.local_version, self.transport.remote_version, +101 self.transport.local_kex_init, self.transport.remote_kex_init) +102 hm.add_string(host_key) +103 hm.add_mpint(self.e) +104 hm.add_mpint(self.f) +105 hm.add_mpint(K) +106 self.transport._set_K_H(K, SHA.new(str(hm)).digest()) +107 self.transport._verify_key(host_key, sig) +108 self.transport._activate_outbound() +
109 +
110 - def _parse_kexdh_init(self, m): +
111 # server mode +112 self.e = m.get_mpint() +113 if (self.e < 1) or (self.e > P - 1): +114 raise SSHException('Client kex "e" is out of range') +115 K = pow(self.e, self.x, P) +116 key = str(self.transport.get_server_key()) +117 # okay, build up the hash H of (V_C || V_S || I_C || I_S || K_S || e || f || K) +118 hm = Message() +119 hm.add(self.transport.remote_version, self.transport.local_version, +120 self.transport.remote_kex_init, self.transport.local_kex_init) +121 hm.add_string(key) +122 hm.add_mpint(self.e) +123 hm.add_mpint(self.f) +124 hm.add_mpint(K) +125 H = SHA.new(str(hm)).digest() +126 self.transport._set_K_H(K, H) +127 # sign it +128 sig = self.transport.get_server_key().sign_ssh_data(self.transport.randpool, H) +129 # send reply +130 m = Message() +131 m.add_byte(chr(_MSG_KEXDH_REPLY)) +132 m.add_string(key) +133 m.add_mpint(self.f) +134 m.add_string(str(sig)) +135 self.transport._send_message(m) +136 self.transport._activate_outbound() +
137 +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.kex_group1.KexGroup1-class.html b/docs/paramiko.kex_group1.KexGroup1-class.html new file mode 100644 index 0000000..14f5fee --- /dev/null +++ b/docs/paramiko.kex_group1.KexGroup1-class.html @@ -0,0 +1,254 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..4788f11 --- /dev/null +++ b/docs/paramiko.logging22-module.html @@ -0,0 +1,203 @@ + + + + + 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 +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.logging22-pysrc.html b/docs/paramiko.logging22-pysrc.html new file mode 100644 index 0000000..32675d6 --- /dev/null +++ b/docs/paramiko.logging22-pysrc.html @@ -0,0 +1,302 @@ + + + + + paramiko.logging22 + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module logging22 + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.logging22

+
+ 1  # Copyright (C) 2003-2007  Robey Pointer <robey@lag.net> 
+ 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 new file mode 100644 index 0000000..a125a5d --- /dev/null +++ b/docs/paramiko.logging22.Formatter-class.html @@ -0,0 +1,206 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..b00bc52 --- /dev/null +++ b/docs/paramiko.logging22.StreamHandler-class.html @@ -0,0 +1,221 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..56195b7 --- /dev/null +++ b/docs/paramiko.logging22.logger-class.html @@ -0,0 +1,271 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..0d0fa78 --- /dev/null +++ b/docs/paramiko.message-module.html @@ -0,0 +1,104 @@ + + + + + paramiko.message + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module message + + + + + +
[frames] | no frames]
+
+ +

Module message

source code

+

Implementation of an SSH2 "message".

+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.message-pysrc.html b/docs/paramiko.message-pysrc.html new file mode 100644 index 0000000..a612fd0 --- /dev/null +++ b/docs/paramiko.message-pysrc.html @@ -0,0 +1,428 @@ + + + + + paramiko.message + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module message + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.message

+
+  1  # Copyright (C) 2003-2007  Robey Pointer <robey@lag.net> 
+  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 '\x00'*n +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 new file mode 100644 index 0000000..ae7f499 --- /dev/null +++ b/docs/paramiko.packet-module.html @@ -0,0 +1,574 @@ + + + + + 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 +
+   + + randpool = StrongLockingRandomPool() +
+ + + + + + +
+ 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 new file mode 100644 index 0000000..1571204 --- /dev/null +++ b/docs/paramiko.packet-pysrc.html @@ -0,0 +1,964 @@ + + + + + paramiko.packet + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module packet + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.packet

+
+  1  # Copyright (C) 2003-2007  Robey Pointer <robey@lag.net> 
+  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 = '' +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 % 100) == 0: +315 # stirring the randpool takes 30ms on my ibook!! +316 randpool.stir() +317 if ((self.__sent_packets >= self.REKEY_PACKETS) or (self.__sent_bytes >= self.REKEY_BYTES)) \ +318 and not self.__need_rekey: +319 # only ask once for rekeying +320 self._log(DEBUG, 'Rekeying (hit %d packets, %d bytes sent)' % +321 (self.__sent_packets, self.__sent_bytes)) +322 self.__received_packets_overflow = 0 +323 self._trigger_rekey() +324 finally: +325 self.__write_lock.release() +
326 +
327 - def read_message(self): +
328 """ +329 Only one thread should ever be in this function (no other locking is +330 done). +331 +332 @raise SSHException: if the packet is mangled +333 @raise NeedRekeyException: if the transport should rekey +334 """ +335 header = self.read_all(self.__block_size_in, check_rekey=True) +336 if self.__block_engine_in != None: +337 header = self.__block_engine_in.decrypt(header) +338 if self.__dump_packets: +339 self._log(DEBUG, util.format_binary(header, 'IN: ')); +340 packet_size = struct.unpack('>I', header[:4])[0] +341 # leftover contains decrypted bytes from the first block (after the length field) +342 leftover = header[4:] +343 if (packet_size - len(leftover)) % self.__block_size_in != 0: +344 raise SSHException('Invalid packet blocking') +345 buf = self.read_all(packet_size + self.__mac_size_in - len(leftover)) +346 packet = buf[:packet_size - len(leftover)] +347 post_packet = buf[packet_size - len(leftover):] +348 if self.__block_engine_in != None: +349 packet = self.__block_engine_in.decrypt(packet) +350 if self.__dump_packets: +351 self._log(DEBUG, util.format_binary(packet, 'IN: ')); +352 packet = leftover + packet +353 +354 if self.__mac_size_in > 0: +355 mac = post_packet[:self.__mac_size_in] +356 mac_payload = struct.pack('>II', self.__sequence_number_in, packet_size) + packet +357 my_mac = compute_hmac(self.__mac_key_in, mac_payload, self.__mac_engine_in)[:self.__mac_size_in] +358 if my_mac != mac: +359 raise SSHException('Mismatched MAC') +360 padding = ord(packet[0]) +361 payload = packet[1:packet_size - padding] +362 randpool.add_event() +363 if self.__dump_packets: +364 self._log(DEBUG, 'Got payload (%d bytes, %d padding)' % (packet_size, padding)) +365 +366 if self.__compress_engine_in is not None: +367 payload = self.__compress_engine_in(payload) +368 +369 msg = Message(payload[1:]) +370 msg.seqno = self.__sequence_number_in +371 self.__sequence_number_in = (self.__sequence_number_in + 1) & 0xffffffffL +372 +373 # check for rekey +374 self.__received_bytes += packet_size + self.__mac_size_in + 4 +375 self.__received_packets += 1 +376 if self.__need_rekey: +377 # we've asked to rekey -- give them 20 packets to comply before +378 # dropping the connection +379 self.__received_packets_overflow += 1 +380 if self.__received_packets_overflow >= 20: +381 raise SSHException('Remote transport is ignoring rekey requests') +382 elif (self.__received_packets >= self.REKEY_PACKETS) or \ +383 (self.__received_bytes >= self.REKEY_BYTES): +384 # only ask once for rekeying +385 self._log(DEBUG, 'Rekeying (hit %d packets, %d bytes received)' % +386 (self.__received_packets, self.__received_bytes)) +387 self.__received_packets_overflow = 0 +388 self._trigger_rekey() +389 +390 cmd = ord(payload[0]) +391 if cmd in MSG_NAMES: +392 cmd_name = MSG_NAMES[cmd] +393 else: +394 cmd_name = '$%x' % cmd +395 if self.__dump_packets: +396 self._log(DEBUG, 'Read packet <%s>, length %d' % (cmd_name, len(payload))) +397 return cmd, msg +
398 +399 +400 ########## protected +401 +402 +
403 - def _log(self, level, msg): +
404 if self.__logger is None: +405 return +406 if issubclass(type(msg), list): +407 for m in msg: +408 self.__logger.log(level, m) +409 else: +410 self.__logger.log(level, msg) +
411 +
412 - def _check_keepalive(self): +
413 if (not self.__keepalive_interval) or (not self.__block_engine_out) or \ +414 self.__need_rekey: +415 # wait till we're encrypting, and not in the middle of rekeying +416 return +417 now = time.time() +418 if now > self.__keepalive_last + self.__keepalive_interval: +419 self.__keepalive_callback() +420 self.__keepalive_last = now +
421 +
422 - def _py22_read_all(self, n, out): +
423 while n > 0: +424 r, w, e = select.select([self.__socket], [], [], 0.1) +425 if self.__socket not in r: +426 if self.__closed: +427 raise EOFError() +428 self._check_keepalive() +429 else: +430 x = self.__socket.recv(n) +431 if len(x) == 0: +432 raise EOFError() +433 out += x +434 n -= len(x) +435 return out +
436 +
437 - def _py22_read_timeout(self, timeout): +
438 start = time.time() +439 while True: +440 r, w, e = select.select([self.__socket], [], [], 0.1) +441 if self.__socket in r: +442 x = self.__socket.recv(1) +443 if len(x) == 0: +444 raise EOFError() +445 break +446 if self.__closed: +447 raise EOFError() +448 now = time.time() +449 if now - start >= timeout: +450 raise socket.timeout() +451 return x +
452 +
453 - def _read_timeout(self, timeout): +
454 if PY22: +455 return self._py22_read_timeout(timeout) +456 start = time.time() +457 while True: +458 try: +459 x = self.__socket.recv(128) +460 if len(x) == 0: +461 raise EOFError() +462 break +463 except socket.timeout: +464 pass +465 if self.__closed: +466 raise EOFError() +467 now = time.time() +468 if now - start >= timeout: +469 raise socket.timeout() +470 return x +
471 +
472 - def _build_packet(self, payload): +
473 # pad up at least 4 bytes, to nearest block-size (usually 8) +474 bsize = self.__block_size_out +475 padding = 3 + bsize - ((len(payload) + 8) % bsize) +476 packet = struct.pack('>IB', len(payload) + padding + 1, padding) +477 packet += payload +478 if self.__block_engine_out is not None: +479 packet += randpool.get_bytes(padding) +480 else: +481 # cute trick i caught openssh doing: if we're not encrypting, +482 # don't waste random bytes for the padding +483 packet += (chr(0) * padding) +484 return packet +
485 +
486 - def _trigger_rekey(self): +
487 # outside code should check for this flag +488 self.__need_rekey = True +
489 +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.packet.NeedRekeyException-class.html b/docs/paramiko.packet.NeedRekeyException-class.html new file mode 100644 index 0000000..fbfd820 --- /dev/null +++ b/docs/paramiko.packet.NeedRekeyException-class.html @@ -0,0 +1,165 @@ + + + + + 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__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..808764c --- /dev/null +++ b/docs/paramiko.pipe-module.html @@ -0,0 +1,215 @@ + + + + + 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 + +
+ +
+ + + + + + +
+ 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 new file mode 100644 index 0000000..4a16395 --- /dev/null +++ b/docs/paramiko.pipe-pysrc.html @@ -0,0 +1,327 @@ + + + + + paramiko.pipe + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module pipe + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.pipe

+
+  1  # Copyright (C) 2003-2007  Robey Pointer <robey@lag.net> 
+  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 new file mode 100644 index 0000000..225310f --- /dev/null +++ b/docs/paramiko.pipe.OrPipe-class.html @@ -0,0 +1,236 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..b0b67eb --- /dev/null +++ b/docs/paramiko.pipe.PosixPipe-class.html @@ -0,0 +1,282 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..7e20560 --- /dev/null +++ b/docs/paramiko.pipe.WindowsPipe-class.html @@ -0,0 +1,285 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..baa61f7 --- /dev/null +++ b/docs/paramiko.pkey-module.html @@ -0,0 +1,524 @@ + + + + + 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 +
+   + + randpool = StrongLockingRandomPool() +
+ + + + + + +
+ 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 new file mode 100644 index 0000000..8a9e368 --- /dev/null +++ b/docs/paramiko.pkey-pysrc.html @@ -0,0 +1,540 @@ + + + + + paramiko.pkey + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module pkey + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.pkey

+
+  1  # Copyright (C) 2003-2007  Robey Pointer <robey@lag.net> 
+  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 
+ 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 'DES-EDE3-CBC': { 'cipher': DES3, 'keysize': 24, 'blocksize': 8, 'mode': DES3.MODE_CBC } + 44 } + 45 + 46 +
47 - def __init__(self, msg=None, data=None): +
48 """ + 49 Create a new instance of this public key type. If C{msg} is given, + 50 the key's public part(s) will be filled in from the message. If + 51 C{data} is given, the key's public part(s) will be filled in from + 52 the string. + 53 + 54 @param msg: an optional SSH L{Message} containing a public key of this + 55 type. + 56 @type msg: L{Message} + 57 @param data: an optional string containing a public key of this type + 58 @type data: str + 59 + 60 @raise SSHException: if a key cannot be created from the C{data} or + 61 C{msg} given, or no key was passed in. + 62 """ + 63 pass +
64 +
65 - def __str__(self): +
66 """ + 67 Return a string of an SSH L{Message} made up of the public part(s) of + 68 this key. This string is suitable for passing to L{__init__} to + 69 re-create the key object later. + 70 + 71 @return: string representation of an SSH key message. + 72 @rtype: str + 73 """ + 74 return '' +
75 +
76 - def __cmp__(self, other): +
77 """ + 78 Compare this key to another. Returns 0 if this key is equivalent to + 79 the given key, or non-0 if they are different. Only the public parts + 80 of the key are compared, so a public key will compare equal to its + 81 corresponding private key. + 82 + 83 @param other: key to compare to. + 84 @type other: L{PKey} + 85 @return: 0 if the two keys are equivalent, non-0 otherwise. + 86 @rtype: int + 87 """ + 88 hs = hash(self) + 89 ho = hash(other) + 90 if hs != ho: + 91 return cmp(hs, ho) + 92 return cmp(str(self), str(other)) +
93 +
94 - def get_name(self): +
95 """ + 96 Return the name of this private key implementation. + 97 + 98 @return: name of this private key type, in SSH terminology (for + 99 example, C{"ssh-rsa"}). +100 @rtype: str +101 """ +102 return '' +
103 +
104 - def get_bits(self): +
105 """ +106 Return the number of significant bits in this key. This is useful +107 for judging the relative security of a key. +108 +109 @return: bits in the key. +110 @rtype: int +111 """ +112 return 0 +
113 +
114 - def can_sign(self): +
115 """ +116 Return C{True} if this key has the private part necessary for signing +117 data. +118 +119 @return: C{True} if this is a private key. +120 @rtype: bool +121 """ +122 return False +
123 +
124 - def get_fingerprint(self): +
125 """ +126 Return an MD5 fingerprint of the public part of this key. Nothing +127 secret is revealed. +128 +129 @return: a 16-byte string (binary) of the MD5 fingerprint, in SSH +130 format. +131 @rtype: str +132 """ +133 return MD5.new(str(self)).digest() +
134 +
135 - def get_base64(self): +
136 """ +137 Return a base64 string containing the public part of this key. Nothing +138 secret is revealed. This format is compatible with that used to store +139 public key files or recognized host keys. +140 +141 @return: a base64 string containing the public part of the key. +142 @rtype: str +143 """ +144 return base64.encodestring(str(self)).replace('\n', '') +
145 +
146 - def sign_ssh_data(self, randpool, data): +
147 """ +148 Sign a blob of data with this private key, and return a L{Message} +149 representing an SSH signature message. +150 +151 @param randpool: a secure random number generator. +152 @type randpool: L{Crypto.Util.randpool.RandomPool} +153 @param data: the data to sign. +154 @type data: str +155 @return: an SSH signature message. +156 @rtype: L{Message} +157 """ +158 return '' +
159 +
160 - def verify_ssh_sig(self, data, msg): +
161 """ +162 Given a blob of data, and an SSH message representing a signature of +163 that data, verify that it was signed with this key. +164 +165 @param data: the data that was signed. +166 @type data: str +167 @param msg: an SSH signature message +168 @type msg: L{Message} +169 @return: C{True} if the signature verifies correctly; C{False} +170 otherwise. +171 @rtype: boolean +172 """ +173 return False +
174 +
175 - def from_private_key_file(cls, filename, password=None): +
176 """ +177 Create a key object by reading a private key file. If the private +178 key is encrypted and C{password} is not C{None}, the given password +179 will be used to decrypt the key (otherwise L{PasswordRequiredException} +180 is thrown). Through the magic of python, this factory method will +181 exist in all subclasses of PKey (such as L{RSAKey} or L{DSSKey}), but +182 is useless on the abstract PKey class. +183 +184 @param filename: name of the file to read +185 @type filename: str +186 @param password: an optional password to use to decrypt the key file, +187 if it's encrypted +188 @type password: str +189 @return: a new key object based on the given private key +190 @rtype: L{PKey} +191 +192 @raise IOError: if there was an error reading the file +193 @raise PasswordRequiredException: if the private key file is +194 encrypted, and C{password} is C{None} +195 @raise SSHException: if the key file is invalid +196 """ +197 key = cls(filename=filename, password=password) +198 return key +
199 from_private_key_file = classmethod(from_private_key_file) +200 +
201 - def from_private_key(cls, file_obj, password=None): +
202 """ +203 Create a key object by reading a private key from a file (or file-like) +204 object. If the private key is encrypted and C{password} is not C{None}, +205 the given password will be used to decrypt the key (otherwise +206 L{PasswordRequiredException} is thrown). +207 +208 @param file_obj: the file to read from +209 @type file_obj: file +210 @param password: an optional password to use to decrypt the key, if it's +211 encrypted +212 @type password: str +213 @return: a new key object based on the given private key +214 @rtype: L{PKey} +215 +216 @raise IOError: if there was an error reading the key +217 @raise PasswordRequiredException: if the private key file is encrypted, +218 and C{password} is C{None} +219 @raise SSHException: if the key file is invalid +220 """ +221 key = cls(file_obj=file_obj, password=password) +222 return key +
223 from_private_key = classmethod(from_private_key) +224 +
225 - def write_private_key_file(self, filename, password=None): +
226 """ +227 Write private key contents into a file. If the password is not +228 C{None}, the key is encrypted before writing. +229 +230 @param filename: name of the file to write +231 @type filename: str +232 @param password: an optional password to use to encrypt the key file +233 @type password: str +234 +235 @raise IOError: if there was an error writing the file +236 @raise SSHException: if the key is invalid +237 """ +238 raise Exception('Not implemented in PKey') +
239 +
240 - def write_private_key(self, file_obj, password=None): +
241 """ +242 Write private key contents into a file (or file-like) object. If the +243 password is not C{None}, the key is encrypted before writing. +244 +245 @param file_obj: the file object to write into +246 @type file_obj: file +247 @param password: an optional password to use to encrypt the key +248 @type password: str +249 +250 @raise IOError: if there was an error writing to the file +251 @raise SSHException: if the key is invalid +252 """ +253 raise Exception('Not implemented in PKey') +
254 +
255 - def _read_private_key_file(self, tag, filename, password=None): +
256 """ +257 Read an SSH2-format private key file, looking for a string of the type +258 C{"BEGIN xxx PRIVATE KEY"} for some C{xxx}, base64-decode the text we +259 find, and return it as a string. If the private key is encrypted and +260 C{password} is not C{None}, the given password will be used to decrypt +261 the key (otherwise L{PasswordRequiredException} is thrown). +262 +263 @param tag: C{"RSA"} or C{"DSA"}, the tag used to mark the data block. +264 @type tag: str +265 @param filename: name of the file to read. +266 @type filename: str +267 @param password: an optional password to use to decrypt the key file, +268 if it's encrypted. +269 @type password: str +270 @return: data blob that makes up the private key. +271 @rtype: str +272 +273 @raise IOError: if there was an error reading the file. +274 @raise PasswordRequiredException: if the private key file is +275 encrypted, and C{password} is C{None}. +276 @raise SSHException: if the key file is invalid. +277 """ +278 f = open(filename, 'r') +279 data = self._read_private_key(tag, f, password) +280 f.close() +281 return data +
282 +
283 - def _read_private_key(self, tag, f, password=None): +
284 lines = f.readlines() +285 start = 0 +286 while (start < len(lines)) and (lines[start].strip() != '-----BEGIN ' + tag + ' PRIVATE KEY-----'): +287 start += 1 +288 if start >= len(lines): +289 raise SSHException('not a valid ' + tag + ' private key file') +290 # parse any headers first +291 headers = {} +292 start += 1 +293 while start < len(lines): +294 l = lines[start].split(': ') +295 if len(l) == 1: +296 break +297 headers[l[0].lower()] = l[1].strip() +298 start += 1 +299 # find end +300 end = start +301 while (lines[end].strip() != '-----END ' + tag + ' PRIVATE KEY-----') and (end < len(lines)): +302 end += 1 +303 # if we trudged to the end of the file, just try to cope. +304 try: +305 data = base64.decodestring(''.join(lines[start:end])) +306 except base64.binascii.Error, e: +307 raise SSHException('base64 decoding error: ' + str(e)) +308 if 'proc-type' not in headers: +309 # unencryped: done +310 return data +311 # encrypted keyfile: will need a password +312 if headers['proc-type'] != '4,ENCRYPTED': +313 raise SSHException('Unknown private key structure "%s"' % headers['proc-type']) +314 try: +315 encryption_type, saltstr = headers['dek-info'].split(',') +316 except: +317 raise SSHException('Can\'t parse DEK-info in private key file') +318 if encryption_type not in self._CIPHER_TABLE: +319 raise SSHException('Unknown private key cipher "%s"' % encryption_type) +320 # if no password was passed in, raise an exception pointing out that we need one +321 if password is None: +322 raise PasswordRequiredException('Private key file is encrypted') +323 cipher = self._CIPHER_TABLE[encryption_type]['cipher'] +324 keysize = self._CIPHER_TABLE[encryption_type]['keysize'] +325 mode = self._CIPHER_TABLE[encryption_type]['mode'] +326 salt = unhexlify(saltstr) +327 key = util.generate_key_bytes(MD5, salt, password, keysize) +328 return cipher.new(key, mode, salt).decrypt(data) +
329 +
330 - def _write_private_key_file(self, tag, filename, data, password=None): +
331 """ +332 Write an SSH2-format private key file in a form that can be read by +333 paramiko or openssh. If no password is given, the key is written in +334 a trivially-encoded format (base64) which is completely insecure. If +335 a password is given, DES-EDE3-CBC is used. +336 +337 @param tag: C{"RSA"} or C{"DSA"}, the tag used to mark the data block. +338 @type tag: str +339 @param filename: name of the file to write. +340 @type filename: str +341 @param data: data blob that makes up the private key. +342 @type data: str +343 @param password: an optional password to use to encrypt the file. +344 @type password: str +345 +346 @raise IOError: if there was an error writing the file. +347 """ +348 f = open(filename, 'w', 0600) +349 # grrr... the mode doesn't always take hold +350 os.chmod(filename, 0600) +351 self._write_private_key(tag, f, data, password) +352 f.close() +
353 +
354 - def _write_private_key(self, tag, f, data, password=None): +
355 f.write('-----BEGIN %s PRIVATE KEY-----\n' % tag) +356 if password is not None: +357 # since we only support one cipher here, use it +358 cipher_name = self._CIPHER_TABLE.keys()[0] +359 cipher = self._CIPHER_TABLE[cipher_name]['cipher'] +360 keysize = self._CIPHER_TABLE[cipher_name]['keysize'] +361 blocksize = self._CIPHER_TABLE[cipher_name]['blocksize'] +362 mode = self._CIPHER_TABLE[cipher_name]['mode'] +363 salt = randpool.get_bytes(8) +364 key = util.generate_key_bytes(MD5, salt, password, keysize) +365 if len(data) % blocksize != 0: +366 n = blocksize - len(data) % blocksize +367 #data += randpool.get_bytes(n) +368 # that would make more sense ^, but it confuses openssh. +369 data += '\0' * n +370 data = cipher.new(key, mode, salt).encrypt(data) +371 f.write('Proc-Type: 4,ENCRYPTED\n') +372 f.write('DEK-Info: %s,%s\n' % (cipher_name, hexlify(salt).upper())) +373 f.write('\n') +374 s = base64.encodestring(data) +375 # re-wrap to 64-char lines +376 s = ''.join(s.split('\n')) +377 s = '\n'.join([s[i : i+64] for i in range(0, len(s), 64)]) +378 f.write(s) +379 f.write('\n') +380 f.write('-----END %s PRIVATE KEY-----\n' % tag) +
381 +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.primes-module.html b/docs/paramiko.primes-module.html new file mode 100644 index 0000000..8ce7a25 --- /dev/null +++ b/docs/paramiko.primes-module.html @@ -0,0 +1,122 @@ + + + + + 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. +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.primes-pysrc.html b/docs/paramiko.primes-pysrc.html new file mode 100644 index 0000000..41800d7 --- /dev/null +++ b/docs/paramiko.primes-pysrc.html @@ -0,0 +1,333 @@ + + + + + paramiko.primes + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module primes + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.primes

+
+  1  # Copyright (C) 2003-2007  Robey Pointer <robey@lag.net> 
+  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, randpool): +
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 = randpool.get_bytes((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(rpool, 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 = rpool.get_bytes(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.randpool = 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.randpool, 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 new file mode 100644 index 0000000..6789760 --- /dev/null +++ b/docs/paramiko.primes.ModulusPack-class.html @@ -0,0 +1,267 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..2219925 --- /dev/null +++ b/docs/paramiko.resource-module.html @@ -0,0 +1,120 @@ + + + + + paramiko.resource + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module resource + + + + + +
[frames] | no frames]
+
+ +

Module resource

source code

+

Resource manager.

+ + + + + + + + + + +
+ Variables
+   + + ResourceManager = ResourceManager() +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.resource-pysrc.html b/docs/paramiko.resource-pysrc.html new file mode 100644 index 0000000..86d5279 --- /dev/null +++ b/docs/paramiko.resource-pysrc.html @@ -0,0 +1,192 @@ + + + + + paramiko.resource + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module resource + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.resource

+
+ 1  # Copyright (C) 2003-2007  Robey Pointer <robey@lag.net> 
+ 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.rng-module.html b/docs/paramiko.rng-module.html new file mode 100644 index 0000000..bb81ec3 --- /dev/null +++ b/docs/paramiko.rng-module.html @@ -0,0 +1,135 @@ + + + + + paramiko.rng + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module rng + + + + + +
[frames] | no frames]
+
+ +

Module rng

source code

+ + + + + + + + + +
+ Classes
+   + + StrongLockingRandomPool
+ Wrapper around RandomPool guaranteeing strong random numbers. +
+ + + + + + + + + +
+ Variables
+   + + rng_device = rng_posix.open_rng_device() +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.rng-pysrc.html b/docs/paramiko.rng-pysrc.html new file mode 100644 index 0000000..1e91cb8 --- /dev/null +++ b/docs/paramiko.rng-pysrc.html @@ -0,0 +1,368 @@ + + + + + paramiko.rng + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module rng + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.rng

+
+  1  #!/usr/bin/python 
+  2  # -*- coding: ascii -*- 
+  3  # Copyright (C) 2008  Dwayne C. Litzenberger <dlitz@dlitz.net> 
+  4  # 
+  5  # This file is part of paramiko. 
+  6  # 
+  7  # Paramiko is free software; you can redistribute it and/or modify it under the 
+  8  # terms of the GNU Lesser General Public License as published by the Free 
+  9  # Software Foundation; either version 2.1 of the License, or (at your option) 
+ 10  # any later version. 
+ 11  # 
+ 12  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
+ 13  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
+ 14  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
+ 15  # details. 
+ 16  # 
+ 17  # You should have received a copy of the GNU Lesser General Public License 
+ 18  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
+ 19  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 
+ 20   
+ 21  import sys 
+ 22  import threading 
+ 23  from Crypto.Util.randpool import RandomPool as _RandomPool 
+ 24   
+ 25  try: 
+ 26      import platform 
+ 27  except ImportError: 
+ 28      platform = None     # Not available using Python 2.2 
+ 29   
+
30 -def _strxor(a, b): +
31 assert len(a) == len(b) + 32 return "".join(map(lambda x, y: chr(ord(x) ^ ord(y)), a, b)) +
33 + 34 ## + 35 ## Find a strong random entropy source, depending on the detected platform. + 36 ## WARNING TO DEVELOPERS: This will fail on some systems, but do NOT use + 37 ## Crypto.Util.randpool.RandomPool as a fall-back. RandomPool will happily run + 38 ## with very little entropy, thus _silently_ defeating any security that + 39 ## Paramiko attempts to provide. (This is current as of PyCrypto 2.0.1). + 40 ## See http://www.lag.net/pipermail/paramiko/2008-January/000599.html + 41 ## and http://www.lag.net/pipermail/paramiko/2008-April/000678.html + 42 ## + 43 + 44 if ((platform is not None and platform.system().lower() == 'windows') or + 45 sys.platform == 'win32'): + 46 # MS Windows + 47 from paramiko import rng_win32 + 48 rng_device = rng_win32.open_rng_device() + 49 else: + 50 # Assume POSIX (any system where /dev/urandom exists) + 51 from paramiko import rng_posix + 52 rng_device = rng_posix.open_rng_device() + 53 + 54 +
55 -class StrongLockingRandomPool(object): +
56 """Wrapper around RandomPool guaranteeing strong random numbers. + 57 + 58 Crypto.Util.randpool.RandomPool will silently operate even if it is seeded + 59 with little or no entropy, and it provides no prediction resistance if its + 60 state is ever compromised throughout its runtime. It is also not thread-safe. + 61 + 62 This wrapper augments RandomPool by XORing its output with random bits from + 63 the operating system, and by controlling access to the underlying + 64 RandomPool using an exclusive lock. + 65 """ + 66 +
67 - def __init__(self, instance=None): +
68 if instance is None: + 69 instance = _RandomPool() + 70 self.randpool = instance + 71 self.randpool_lock = threading.Lock() + 72 self.entropy = rng_device + 73 + 74 # Stir 256 bits of entropy from the RNG device into the RandomPool. + 75 self.randpool.stir(self.entropy.read(32)) + 76 self.entropy.randomize() +
77 +
78 - def stir(self, s=''): +
79 self.randpool_lock.acquire() + 80 try: + 81 self.randpool.stir(s) + 82 finally: + 83 self.randpool_lock.release() + 84 self.entropy.randomize() +
85 +
86 - def randomize(self, N=0): +
87 self.randpool_lock.acquire() + 88 try: + 89 self.randpool.randomize(N) + 90 finally: + 91 self.randpool_lock.release() + 92 self.entropy.randomize() +
93 +
94 - def add_event(self, s=''): +
95 self.randpool_lock.acquire() + 96 try: + 97 self.randpool.add_event(s) + 98 finally: + 99 self.randpool_lock.release() +
100 +
101 - def get_bytes(self, N): +
102 self.randpool_lock.acquire() +103 try: +104 randpool_data = self.randpool.get_bytes(N) +105 finally: +106 self.randpool_lock.release() +107 entropy_data = self.entropy.read(N) +108 result = _strxor(randpool_data, entropy_data) +109 assert len(randpool_data) == N and len(entropy_data) == N and len(result) == N +110 return result +
111 +112 # vim:set ts=4 sw=4 sts=4 expandtab: +113 +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.rng.StrongLockingRandomPool-class.html b/docs/paramiko.rng.StrongLockingRandomPool-class.html new file mode 100644 index 0000000..a1d792a --- /dev/null +++ b/docs/paramiko.rng.StrongLockingRandomPool-class.html @@ -0,0 +1,281 @@ + + + + + paramiko.rng.StrongLockingRandomPool + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module rng :: + Class StrongLockingRandomPool + + + + + +
[frames] | no frames]
+
+ +

Class StrongLockingRandomPool

source code

+
+object --+
+         |
+        StrongLockingRandomPool
+
+ +
+

Wrapper around RandomPool guaranteeing strong random numbers.

+

Crypto.Util.randpool.RandomPool will silently operate even if it is + seeded with little or no entropy, and it provides no prediction + resistance if its state is ever compromised throughout its runtime. It + is also not thread-safe.

+

This wrapper augments RandomPool by XORing its output with random bits + from the operating system, and by controlling access to the underlying + RandomPool using an exclusive lock.

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ Instance Methods
+   + + + + + + +
__init__(self, + instance=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
stir(self, + s='') + source code + +
+ +
+   + + + + + + +
randomize(self, + N=0) + source code + +
+ +
+   + + + + + + +
add_event(self, + s='') + source code + +
+ +
+   + + + + + + +
get_bytes(self, + N) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ Properties
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ Method Details
+ +
+ +
+ + +
+

__init__(self, + instance=None) +
(Constructor) +

+
source code  +
+ +

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

+
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.rng_posix-module.html b/docs/paramiko.rng_posix-module.html new file mode 100644 index 0000000..cb912ad --- /dev/null +++ b/docs/paramiko.rng_posix-module.html @@ -0,0 +1,144 @@ + + + + + paramiko.rng_posix + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module rng_posix + + + + + +
[frames] | no frames]
+
+ +

Module rng_posix

source code

+ + + + + + + + + +
+ Classes
+   + + error +
+ + + + + + + + + +
+ Functions
+   + + + + + + +
open_rng_device(device_path=None)
+ Open /dev/urandom and perform some sanity checks.
+ source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.rng_posix-pysrc.html b/docs/paramiko.rng_posix-pysrc.html new file mode 100644 index 0000000..108ba64 --- /dev/null +++ b/docs/paramiko.rng_posix-pysrc.html @@ -0,0 +1,285 @@ + + + + + paramiko.rng_posix + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module rng_posix + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.rng_posix

+
+ 1  #!/usr/bin/python 
+ 2  # -*- coding: ascii -*- 
+ 3  # Copyright (C) 2008  Dwayne C. Litzenberger <dlitz@dlitz.net> 
+ 4  # Copyright (C) 2008  Open Systems Canada Limited 
+ 5  # 
+ 6  # This file is part of paramiko. 
+ 7  # 
+ 8  # Paramiko is free software; you can redistribute it and/or modify it under the 
+ 9  # terms of the GNU Lesser General Public License as published by the Free 
+10  # Software Foundation; either version 2.1 of the License, or (at your option) 
+11  # any later version. 
+12  # 
+13  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
+14  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
+15  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
+16  # details. 
+17  # 
+18  # You should have received a copy of the GNU Lesser General Public License 
+19  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
+20  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 
+21   
+22  import os 
+23  import stat 
+24   
+
25 -class error(Exception): +
26 pass +
27 +
28 -class _RNG(object): +
29 - def __init__(self, file): +
30 self.file = file +
31 +
32 - def read(self, bytes): +
33 return self.file.read(bytes) +
34 +
35 - def close(self): +
36 return self.file.close() +
37 +
38 - def randomize(self): +
39 return +
40 +
41 -def open_rng_device(device_path=None): +
42 """Open /dev/urandom and perform some sanity checks.""" +43 +44 f = None +45 g = None +46 +47 if device_path is None: +48 device_path = "/dev/urandom" +49 +50 try: +51 # Try to open /dev/urandom now so that paramiko will be able to access +52 # it even if os.chroot() is invoked later. +53 try: +54 f = open(device_path, "rb", 0) +55 except EnvironmentError: +56 raise error("Unable to open /dev/urandom") +57 +58 # Open a second file descriptor for sanity checking later. +59 try: +60 g = open(device_path, "rb", 0) +61 except EnvironmentError: +62 raise error("Unable to open /dev/urandom") +63 +64 # Check that /dev/urandom is a character special device, not a regular file. +65 st = os.fstat(f.fileno()) # f +66 if stat.S_ISREG(st.st_mode) or not stat.S_ISCHR(st.st_mode): +67 raise error("/dev/urandom is not a character special device") +68 +69 st = os.fstat(g.fileno()) # g +70 if stat.S_ISREG(st.st_mode) or not stat.S_ISCHR(st.st_mode): +71 raise error("/dev/urandom is not a character special device") +72 +73 # Check that /dev/urandom always returns the number of bytes requested +74 x = f.read(20) +75 y = g.read(20) +76 if len(x) != 20 or len(y) != 20: +77 raise error("Error reading from /dev/urandom: input truncated") +78 +79 # Check that different reads return different data +80 if x == y: +81 raise error("/dev/urandom is broken; returning identical data: %r == %r" % (x, y)) +82 +83 # Close the duplicate file object +84 g.close() +85 +86 # Return the first file object +87 return _RNG(f) +88 +89 except error: +90 if f is not None: +91 f.close() +92 if g is not None: +93 g.close() +94 raise +
95 +96 # vim:set ts=4 sw=4 sts=4 expandtab: +97 +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.rng_posix.error-class.html b/docs/paramiko.rng_posix.error-class.html new file mode 100644 index 0000000..6224757 --- /dev/null +++ b/docs/paramiko.rng_posix.error-class.html @@ -0,0 +1,165 @@ + + + + + paramiko.rng_posix.error + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module rng_posix :: + Class error + + + + + +
[frames] | no frames]
+
+ +

Class error

source code

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

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

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ Properties
+

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

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.rng_win32-module.html b/docs/paramiko.rng_win32-module.html new file mode 100644 index 0000000..3bbbfa8 --- /dev/null +++ b/docs/paramiko.rng_win32-module.html @@ -0,0 +1,143 @@ + + + + + paramiko.rng_win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module rng_win32 + + + + + +
[frames] | no frames]
+
+ +

Module rng_win32

source code

+ + + + + + + + + +
+ Classes
+   + + error +
+ + + + + + + + + +
+ Functions
+   + + + + + + +
open_rng_device() + source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.rng_win32-pysrc.html b/docs/paramiko.rng_win32-pysrc.html new file mode 100644 index 0000000..450e713 --- /dev/null +++ b/docs/paramiko.rng_win32-pysrc.html @@ -0,0 +1,249 @@ + + + + + paramiko.rng_win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module rng_win32 + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.rng_win32

+
+  1  #!/usr/bin/python 
+  2  # -*- coding: ascii -*- 
+  3  # Copyright (C) 2008  Dwayne C. Litzenberger <dlitz@dlitz.net> 
+  4  # Copyright (C) 2008  Open Systems Canada Limited 
+  5  # 
+  6  # This file is part of paramiko. 
+  7  # 
+  8  # Paramiko is free software; you can redistribute it and/or modify it under the 
+  9  # terms of the GNU Lesser General Public License as published by the Free 
+ 10  # Software Foundation; either version 2.1 of the License, or (at your option) 
+ 11  # any later version. 
+ 12  # 
+ 13  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
+ 14  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
+ 15  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
+ 16  # details. 
+ 17  # 
+ 18  # You should have received a copy of the GNU Lesser General Public License 
+ 19  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
+ 20  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 
+ 21   
+
22 -class error(Exception): +
23 pass +
24 + 25 # Try to import the "winrandom" module + 26 try: + 27 from Crypto.Util import winrandom as _winrandom + 28 except ImportError: + 29 _winrandom = None + 30 + 31 # Try to import the "urandom" module + 32 try: + 33 from os import urandom as _urandom + 34 except ImportError: + 35 _urandom = None + 36 + 37 +
38 -class _RNG(object): +
39 - def __init__(self, readfunc): +
40 self.read = readfunc +
41 +
42 - def randomize(self): +
43 # According to "Cryptanalysis of the Random Number Generator of the + 44 # Windows Operating System", by Leo Dorrendorf and Zvi Gutterman + 45 # and Benny Pinkas <http://eprint.iacr.org/2007/419>, + 46 # CryptGenRandom only updates its internal state using kernel-provided + 47 # random data every 128KiB of output. + 48 self.read(128*1024) # discard 128 KiB of output +
49 +
50 -def _open_winrandom(): +
51 if _winrandom is None: + 52 raise error("Crypto.Util.winrandom module not found") + 53 + 54 # Check that we can open the winrandom module + 55 try: + 56 r0 = _winrandom.new() + 57 r1 = _winrandom.new() + 58 except Exception, exc: + 59 raise error("winrandom.new() failed: %s" % str(exc), exc) + 60 + 61 # Check that we can read from the winrandom module + 62 try: + 63 x = r0.get_bytes(20) + 64 y = r1.get_bytes(20) + 65 except Exception, exc: + 66 raise error("winrandom get_bytes failed: %s" % str(exc), exc) + 67 + 68 # Check that the requested number of bytes are returned + 69 if len(x) != 20 or len(y) != 20: + 70 raise error("Error reading from winrandom: input truncated") + 71 + 72 # Check that different reads return different data + 73 if x == y: + 74 raise error("winrandom broken: returning identical data") + 75 + 76 return _RNG(r0.get_bytes) +
77 +
78 -def _open_urandom(): +
79 if _urandom is None: + 80 raise error("os.urandom function not found") + 81 + 82 # Check that we can read from os.urandom() + 83 try: + 84 x = _urandom(20) + 85 y = _urandom(20) + 86 except Exception, exc: + 87 raise error("os.urandom failed: %s" % str(exc), exc) + 88 + 89 # Check that the requested number of bytes are returned + 90 if len(x) != 20 or len(y) != 20: + 91 raise error("os.urandom failed: input truncated") + 92 + 93 # Check that different reads return different data + 94 if x == y: + 95 raise error("os.urandom failed: returning identical data") + 96 + 97 return _RNG(_urandom) +
98 +
99 -def open_rng_device(): +
100 # Try using the Crypto.Util.winrandom module +101 try: +102 return _open_winrandom() +103 except error: +104 pass +105 +106 # Several versions of PyCrypto do not contain the winrandom module, but +107 # Python >= 2.4 has os.urandom, so try to use that. +108 try: +109 return _open_urandom() +110 except error: +111 pass +112 +113 # SECURITY NOTE: DO NOT USE Crypto.Util.randpool.RandomPool HERE! +114 # If we got to this point, RandomPool will silently run with very little +115 # entropy. (This is current as of PyCrypto 2.0.1). +116 # See http://www.lag.net/pipermail/paramiko/2008-January/000599.html +117 # and http://www.lag.net/pipermail/paramiko/2008-April/000678.html +118 +119 raise error("Unable to find a strong random entropy source. You cannot run this software securely under the current configuration.") +
120 +121 # vim:set ts=4 sw=4 sts=4 expandtab: +122 +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.rng_win32.error-class.html b/docs/paramiko.rng_win32.error-class.html new file mode 100644 index 0000000..6f5c6a7 --- /dev/null +++ b/docs/paramiko.rng_win32.error-class.html @@ -0,0 +1,165 @@ + + + + + paramiko.rng_win32.error + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module rng_win32 :: + Class error + + + + + +
[frames] | no frames]
+
+ +

Class error

source code

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

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

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ Properties
+

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

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.rsakey-module.html b/docs/paramiko.rsakey-module.html new file mode 100644 index 0000000..3c810da --- /dev/null +++ b/docs/paramiko.rsakey-module.html @@ -0,0 +1,524 @@ + + + + + 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 +
+   + + randpool = StrongLockingRandomPool() +
+ + + + + + +
+ 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 new file mode 100644 index 0000000..8e1c42b --- /dev/null +++ b/docs/paramiko.rsakey-pysrc.html @@ -0,0 +1,343 @@ + + + + + paramiko.rsakey + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module rsakey + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.rsakey

+
+  1  # Copyright (C) 2003-2007  Robey Pointer <robey@lag.net> 
+  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 randpool.stir() +141 rsa = RSA.generate(bits, randpool.get_bytes, progress_func) +142 key = RSAKey(vals=(rsa.e, rsa.n)) +143 key.d = rsa.d +144 key.p = rsa.p +145 key.q = rsa.q +146 return key +
147 generate = staticmethod(generate) +148 +149 +150 ### internals... +151 +152 +
153 - def _pkcs1imify(self, data): +
154 """ +155 turn a 20-byte SHA1 hash into a blob of data as large as the key's N, +156 using PKCS1's \"emsa-pkcs1-v1_5\" encoding. totally bizarre. +157 """ +158 SHA1_DIGESTINFO = '\x30\x21\x30\x09\x06\x05\x2b\x0e\x03\x02\x1a\x05\x00\x04\x14' +159 size = len(util.deflate_long(self.n, 0)) +160 filler = '\xff' * (size - len(SHA1_DIGESTINFO) - len(data) - 3) +161 return '\x00\x01' + filler + '\x00' + SHA1_DIGESTINFO + data +
162 +
163 - def _from_private_key_file(self, filename, password): +
164 data = self._read_private_key_file('RSA', filename, password) +165 self._decode_key(data) +
166 +
167 - def _from_private_key(self, file_obj, password): +
168 data = self._read_private_key('RSA', file_obj, password) +169 self._decode_key(data) +
170 +
171 - def _decode_key(self, data): +
172 # private key file contains: +173 # RSAPrivateKey = { version = 0, n, e, d, p, q, d mod p-1, d mod q-1, q**-1 mod p } +174 try: +175 keylist = BER(data).decode() +176 except BERException: +177 raise SSHException('Unable to parse key file') +178 if (type(keylist) is not list) or (len(keylist) < 4) or (keylist[0] != 0): +179 raise SSHException('Not a valid RSA private key file (bad ber encoding)') +180 self.n = keylist[1] +181 self.e = keylist[2] +182 self.d = keylist[3] +183 # not really needed +184 self.p = keylist[4] +185 self.q = keylist[5] +186 self.size = util.bit_length(self.n) +
187 +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.server-module.html b/docs/paramiko.server-module.html new file mode 100644 index 0000000..7f452ac --- /dev/null +++ b/docs/paramiko.server-module.html @@ -0,0 +1,526 @@ + + + + + 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 +
+   + + randpool = StrongLockingRandomPool() +
+ + + + + + +
+ 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 new file mode 100644 index 0000000..56ce4b9 --- /dev/null +++ b/docs/paramiko.server-pysrc.html @@ -0,0 +1,1006 @@ + + + + + paramiko.server + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module server + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.server

+
+  1  # Copyright (C) 2003-2007  Robey Pointer <robey@lag.net> 
+  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 new file mode 100644 index 0000000..f65cd15 --- /dev/null +++ b/docs/paramiko.sftp-module.html @@ -0,0 +1,898 @@ + + + + + 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 +
+   + + randpool = StrongLockingRandomPool() +
+ + + + + + +
+ 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 new file mode 100644 index 0000000..a1b987c --- /dev/null +++ b/docs/paramiko.sftp-pysrc.html @@ -0,0 +1,798 @@ + + + + + paramiko.sftp + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module sftp + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.sftp

+
+  1  # Copyright (C) 2003-2007  Robey Pointer <robey@lag.net> 
+  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 new file mode 100644 index 0000000..f13bc2f --- /dev/null +++ b/docs/paramiko.sftp_attr-module.html @@ -0,0 +1,898 @@ + + + + + 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 +
+   + + randpool = StrongLockingRandomPool() +
+ + + + + + +
+ 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 new file mode 100644 index 0000000..b1f7411 --- /dev/null +++ b/docs/paramiko.sftp_attr-pysrc.html @@ -0,0 +1,367 @@ + + + + + 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 <robey@lag.net> 
+  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 == 0xffffffff): +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 new file mode 100644 index 0000000..8f975d6 --- /dev/null +++ b/docs/paramiko.sftp_client-module.html @@ -0,0 +1,900 @@ + + + + + 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 +
+   + + randpool = StrongLockingRandomPool() +
+ + + + + + +
+ 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 new file mode 100644 index 0000000..0b17480 --- /dev/null +++ b/docs/paramiko.sftp_client-pysrc.html @@ -0,0 +1,1563 @@ + + + + + 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 <robey@lag.net> 
+  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 threading 
+ 27  import time 
+ 28  import weakref 
+ 29   
+ 30  from paramiko.sftp import * 
+ 31  from paramiko.sftp_attr import SFTPAttributes 
+ 32  from paramiko.ssh_exception import SSHException 
+ 33  from paramiko.sftp_file import SFTPFile 
+ 34   
+ 35   
+
36 -def _to_unicode(s): +
37 """ + 38 decode a string as ascii or utf8 if possible (as required by the sftp + 39 protocol). if neither works, just return a byte string because the server + 40 probably doesn't know the filename's encoding. + 41 """ + 42 try: + 43 return s.encode('ascii') + 44 except UnicodeError: + 45 try: + 46 return s.decode('utf-8') + 47 except UnicodeError: + 48 return s +
49 + 50 +
51 -class SFTPClient (BaseSFTP): +
52 """ + 53 SFTP client object. C{SFTPClient} is used to open an sftp session across + 54 an open ssh L{Transport} and do remote file operations. + 55 """ + 56 +
57 - def __init__(self, sock): +
58 """ + 59 Create an SFTP client from an existing L{Channel}. The channel + 60 should already have requested the C{"sftp"} subsystem. + 61 + 62 An alternate way to create an SFTP client context is by using + 63 L{from_transport}. + 64 + 65 @param sock: an open L{Channel} using the C{"sftp"} subsystem + 66 @type sock: L{Channel} + 67 + 68 @raise SSHException: if there's an exception while negotiating + 69 sftp + 70 """ + 71 BaseSFTP.__init__(self) + 72 self.sock = sock + 73 self.ultra_debug = False + 74 self.request_number = 1 + 75 # lock for request_number + 76 self._lock = threading.Lock() + 77 self._cwd = None + 78 # request # -> SFTPFile + 79 self._expecting = weakref.WeakValueDictionary() + 80 if type(sock) is Channel: + 81 # override default logger + 82 transport = self.sock.get_transport() + 83 self.logger = util.get_logger(transport.get_log_channel() + '.sftp') + 84 self.ultra_debug = transport.get_hexdump() + 85 try: + 86 server_version = self._send_version() + 87 except EOFError, x: + 88 raise SSHException('EOF during negotiation') + 89 self._log(INFO, 'Opened sftp connection (server version %d)' % server_version) +
90 +
91 - def from_transport(cls, t): +
92 """ + 93 Create an SFTP client channel from an open L{Transport}. + 94 + 95 @param t: an open L{Transport} which is already authenticated + 96 @type t: L{Transport} + 97 @return: a new L{SFTPClient} object, referring to an sftp session + 98 (channel) across the transport + 99 @rtype: L{SFTPClient} +100 """ +101 chan = t.open_session() +102 if chan is None: +103 return None +104 chan.invoke_subsystem('sftp') +105 return cls(chan) +
106 from_transport = classmethod(from_transport) +107 +
108 - def _log(self, level, msg, *args): +
109 super(SFTPClient, self)._log(level, "[chan %s] " + msg, *([ self.sock.get_name() ] + list(args))) +
110 +
111 - def close(self): +
112 """ +113 Close the SFTP session and its underlying channel. +114 +115 @since: 1.4 +116 """ +117 self._log(INFO, 'sftp session closed.') +118 self.sock.close() +
119 +
120 - def get_channel(self): +
121 """ +122 Return the underlying L{Channel} object for this SFTP session. This +123 might be useful for doing things like setting a timeout on the channel. +124 +125 @return: the SSH channel +126 @rtype: L{Channel} +127 +128 @since: 1.7.1 +129 """ +130 return self.sock +
131 +
132 - def listdir(self, path='.'): +
133 """ +134 Return a list containing the names of the entries in the given C{path}. +135 The list is in arbitrary order. It does not include the special +136 entries C{'.'} and C{'..'} even if they are present in the folder. +137 This method is meant to mirror C{os.listdir} as closely as possible. +138 For a list of full L{SFTPAttributes} objects, see L{listdir_attr}. +139 +140 @param path: path to list (defaults to C{'.'}) +141 @type path: str +142 @return: list of filenames +143 @rtype: list of str +144 """ +145 return [f.filename for f in self.listdir_attr(path)] +
146 +
147 - def listdir_attr(self, path='.'): +
148 """ +149 Return a list containing L{SFTPAttributes} objects corresponding to +150 files in the given C{path}. The list is in arbitrary order. It does +151 not include the special entries C{'.'} and C{'..'} even if they are +152 present in the folder. +153 +154 The returned L{SFTPAttributes} objects will each have an additional +155 field: C{longname}, which may contain a formatted string of the file's +156 attributes, in unix format. The content of this string will probably +157 depend on the SFTP server implementation. +158 +159 @param path: path to list (defaults to C{'.'}) +160 @type path: str +161 @return: list of attributes +162 @rtype: list of L{SFTPAttributes} +163 +164 @since: 1.2 +165 """ +166 path = self._adjust_cwd(path) +167 self._log(DEBUG, 'listdir(%r)' % path) +168 t, msg = self._request(CMD_OPENDIR, path) +169 if t != CMD_HANDLE: +170 raise SFTPError('Expected handle') +171 handle = msg.get_string() +172 filelist = [] +173 while True: +174 try: +175 t, msg = self._request(CMD_READDIR, handle) +176 except EOFError, e: +177 # done with handle +178 break +179 if t != CMD_NAME: +180 raise SFTPError('Expected name response') +181 count = msg.get_int() +182 for i in range(count): +183 filename = _to_unicode(msg.get_string()) +184 longname = _to_unicode(msg.get_string()) +185 attr = SFTPAttributes._from_msg(msg, filename, longname) +186 if (filename != '.') and (filename != '..'): +187 filelist.append(attr) +188 self._request(CMD_CLOSE, handle) +189 return filelist +
190 +
191 - def open(self, filename, mode='r', bufsize=-1): +
192 """ +193 Open a file on the remote server. The arguments are the same as for +194 python's built-in C{file} (aka C{open}). A file-like object is +195 returned, which closely mimics the behavior of a normal python file +196 object. +197 +198 The mode indicates how the file is to be opened: C{'r'} for reading, +199 C{'w'} for writing (truncating an existing file), C{'a'} for appending, +200 C{'r+'} for reading/writing, C{'w+'} for reading/writing (truncating an +201 existing file), C{'a+'} for reading/appending. The python C{'b'} flag +202 is ignored, since SSH treats all files as binary. The C{'U'} flag is +203 supported in a compatible way. +204 +205 Since 1.5.2, an C{'x'} flag indicates that the operation should only +206 succeed if the file was created and did not previously exist. This has +207 no direct mapping to python's file flags, but is commonly known as the +208 C{O_EXCL} flag in posix. +209 +210 The file will be buffered in standard python style by default, but +211 can be altered with the C{bufsize} parameter. C{0} turns off +212 buffering, C{1} uses line buffering, and any number greater than 1 +213 (C{>1}) uses that specific buffer size. +214 +215 @param filename: name of the file to open +216 @type filename: str +217 @param mode: mode (python-style) to open in +218 @type mode: str +219 @param bufsize: desired buffering (-1 = default buffer size) +220 @type bufsize: int +221 @return: a file object representing the open file +222 @rtype: SFTPFile +223 +224 @raise IOError: if the file could not be opened. +225 """ +226 filename = self._adjust_cwd(filename) +227 self._log(DEBUG, 'open(%r, %r)' % (filename, mode)) +228 imode = 0 +229 if ('r' in mode) or ('+' in mode): +230 imode |= SFTP_FLAG_READ +231 if ('w' in mode) or ('+' in mode) or ('a' in mode): +232 imode |= SFTP_FLAG_WRITE +233 if ('w' in mode): +234 imode |= SFTP_FLAG_CREATE | SFTP_FLAG_TRUNC +235 if ('a' in mode): +236 imode |= SFTP_FLAG_CREATE | SFTP_FLAG_APPEND +237 if ('x' in mode): +238 imode |= SFTP_FLAG_CREATE | SFTP_FLAG_EXCL +239 attrblock = SFTPAttributes() +240 t, msg = self._request(CMD_OPEN, filename, imode, attrblock) +241 if t != CMD_HANDLE: +242 raise SFTPError('Expected handle') +243 handle = msg.get_string() +244 self._log(DEBUG, 'open(%r, %r) -> %s' % (filename, mode, hexlify(handle))) +245 return SFTPFile(self, handle, mode, bufsize) +
246 +247 # python continues to vacillate about "open" vs "file"... +248 file = open +249 +
250 - def remove(self, path): +
251 """ +252 Remove the file at the given path. This only works on files; for +253 removing folders (directories), use L{rmdir}. +254 +255 @param path: path (absolute or relative) of the file to remove +256 @type path: str +257 +258 @raise IOError: if the path refers to a folder (directory) +259 """ +260 path = self._adjust_cwd(path) +261 self._log(DEBUG, 'remove(%r)' % path) +262 self._request(CMD_REMOVE, path) +
263 +264 unlink = remove +265 +
266 - def rename(self, oldpath, newpath): +
267 """ +268 Rename a file or folder from C{oldpath} to C{newpath}. +269 +270 @param oldpath: existing name of the file or folder +271 @type oldpath: str +272 @param newpath: new name for the file or folder +273 @type newpath: str +274 +275 @raise IOError: if C{newpath} is a folder, or something else goes +276 wrong +277 """ +278 oldpath = self._adjust_cwd(oldpath) +279 newpath = self._adjust_cwd(newpath) +280 self._log(DEBUG, 'rename(%r, %r)' % (oldpath, newpath)) +281 self._request(CMD_RENAME, oldpath, newpath) +
282 +
283 - def mkdir(self, path, mode=0777): +
284 """ +285 Create a folder (directory) named C{path} with numeric mode C{mode}. +286 The default mode is 0777 (octal). On some systems, mode is ignored. +287 Where it is used, the current umask value is first masked out. +288 +289 @param path: name of the folder to create +290 @type path: str +291 @param mode: permissions (posix-style) for the newly-created folder +292 @type mode: int +293 """ +294 path = self._adjust_cwd(path) +295 self._log(DEBUG, 'mkdir(%r, %r)' % (path, mode)) +296 attr = SFTPAttributes() +297 attr.st_mode = mode +298 self._request(CMD_MKDIR, path, attr) +
299 +
300 - def rmdir(self, path): +
301 """ +302 Remove the folder named C{path}. +303 +304 @param path: name of the folder to remove +305 @type path: str +306 """ +307 path = self._adjust_cwd(path) +308 self._log(DEBUG, 'rmdir(%r)' % path) +309 self._request(CMD_RMDIR, path) +
310 +
311 - def stat(self, path): +
312 """ +313 Retrieve information about a file on the remote system. The return +314 value is an object whose attributes correspond to the attributes of +315 python's C{stat} structure as returned by C{os.stat}, except that it +316 contains fewer fields. An SFTP server may return as much or as little +317 info as it wants, so the results may vary from server to server. +318 +319 Unlike a python C{stat} object, the result may not be accessed as a +320 tuple. This is mostly due to the author's slack factor. +321 +322 The fields supported are: C{st_mode}, C{st_size}, C{st_uid}, C{st_gid}, +323 C{st_atime}, and C{st_mtime}. +324 +325 @param path: the filename to stat +326 @type path: str +327 @return: an object containing attributes about the given file +328 @rtype: SFTPAttributes +329 """ +330 path = self._adjust_cwd(path) +331 self._log(DEBUG, 'stat(%r)' % path) +332 t, msg = self._request(CMD_STAT, path) +333 if t != CMD_ATTRS: +334 raise SFTPError('Expected attributes') +335 return SFTPAttributes._from_msg(msg) +
336 +
337 - def lstat(self, path): +
338 """ +339 Retrieve information about a file on the remote system, without +340 following symbolic links (shortcuts). This otherwise behaves exactly +341 the same as L{stat}. +342 +343 @param path: the filename to stat +344 @type path: str +345 @return: an object containing attributes about the given file +346 @rtype: SFTPAttributes +347 """ +348 path = self._adjust_cwd(path) +349 self._log(DEBUG, 'lstat(%r)' % path) +350 t, msg = self._request(CMD_LSTAT, path) +351 if t != CMD_ATTRS: +352 raise SFTPError('Expected attributes') +353 return SFTPAttributes._from_msg(msg) +
354 +370 +
371 - def chmod(self, path, mode): +
372 """ +373 Change the mode (permissions) of a file. The permissions are +374 unix-style and identical to those used by python's C{os.chmod} +375 function. +376 +377 @param path: path of the file to change the permissions of +378 @type path: str +379 @param mode: new permissions +380 @type mode: int +381 """ +382 path = self._adjust_cwd(path) +383 self._log(DEBUG, 'chmod(%r, %r)' % (path, mode)) +384 attr = SFTPAttributes() +385 attr.st_mode = mode +386 self._request(CMD_SETSTAT, path, attr) +
387 +
388 - def chown(self, path, uid, gid): +
389 """ +390 Change the owner (C{uid}) and group (C{gid}) of a file. As with +391 python's C{os.chown} function, you must pass both arguments, so if you +392 only want to change one, use L{stat} first to retrieve the current +393 owner and group. +394 +395 @param path: path of the file to change the owner and group of +396 @type path: str +397 @param uid: new owner's uid +398 @type uid: int +399 @param gid: new group id +400 @type gid: int +401 """ +402 path = self._adjust_cwd(path) +403 self._log(DEBUG, 'chown(%r, %r, %r)' % (path, uid, gid)) +404 attr = SFTPAttributes() +405 attr.st_uid, attr.st_gid = uid, gid +406 self._request(CMD_SETSTAT, path, attr) +
407 +
408 - def utime(self, path, times): +
409 """ +410 Set the access and modified times of the file specified by C{path}. If +411 C{times} is C{None}, then the file's access and modified times are set +412 to the current time. Otherwise, C{times} must be a 2-tuple of numbers, +413 of the form C{(atime, mtime)}, which is used to set the access and +414 modified times, respectively. This bizarre API is mimicked from python +415 for the sake of consistency -- I apologize. +416 +417 @param path: path of the file to modify +418 @type path: str +419 @param times: C{None} or a tuple of (access time, modified time) in +420 standard internet epoch time (seconds since 01 January 1970 GMT) +421 @type times: tuple(int) +422 """ +423 path = self._adjust_cwd(path) +424 if times is None: +425 times = (time.time(), time.time()) +426 self._log(DEBUG, 'utime(%r, %r)' % (path, times)) +427 attr = SFTPAttributes() +428 attr.st_atime, attr.st_mtime = times +429 self._request(CMD_SETSTAT, path, attr) +
430 +
431 - def truncate(self, path, size): +
432 """ +433 Change the size of the file specified by C{path}. This usually extends +434 or shrinks the size of the file, just like the C{truncate()} method on +435 python file objects. +436 +437 @param path: path of the file to modify +438 @type path: str +439 @param size: the new size of the file +440 @type size: int or long +441 """ +442 path = self._adjust_cwd(path) +443 self._log(DEBUG, 'truncate(%r, %r)' % (path, size)) +444 attr = SFTPAttributes() +445 attr.st_size = size +446 self._request(CMD_SETSTAT, path, attr) +
447 +470 +
471 - def normalize(self, path): +
472 """ +473 Return the normalized path (on the server) of a given path. This +474 can be used to quickly resolve symbolic links or determine what the +475 server is considering to be the "current folder" (by passing C{'.'} +476 as C{path}). +477 +478 @param path: path to be normalized +479 @type path: str +480 @return: normalized form of the given path +481 @rtype: str +482 +483 @raise IOError: if the path can't be resolved on the server +484 """ +485 path = self._adjust_cwd(path) +486 self._log(DEBUG, 'normalize(%r)' % path) +487 t, msg = self._request(CMD_REALPATH, path) +488 if t != CMD_NAME: +489 raise SFTPError('Expected name response') +490 count = msg.get_int() +491 if count != 1: +492 raise SFTPError('Realpath returned %d results' % count) +493 return _to_unicode(msg.get_string()) +
494 +
495 - def chdir(self, path): +
496 """ +497 Change the "current directory" of this SFTP session. Since SFTP +498 doesn't really have the concept of a current working directory, this +499 is emulated by paramiko. Once you use this method to set a working +500 directory, all operations on this SFTPClient object will be relative +501 to that path. +502 +503 @param path: new current working directory +504 @type path: str +505 +506 @raise IOError: if the requested path doesn't exist on the server +507 +508 @since: 1.4 +509 """ +510 self._cwd = self.normalize(path) +
511 +
512 - def getcwd(self): +
513 """ +514 Return the "current working directory" for this SFTP session, as +515 emulated by paramiko. If no directory has been set with L{chdir}, +516 this method will return C{None}. +517 +518 @return: the current working directory on the server, or C{None} +519 @rtype: str +520 +521 @since: 1.4 +522 """ +523 return self._cwd +
524 +
525 - def put(self, localpath, remotepath, callback=None): +
526 """ +527 Copy a local file (C{localpath}) to the SFTP server as C{remotepath}. +528 Any exception raised by operations will be passed through. This +529 method is primarily provided as a convenience. +530 +531 The SFTP operations use pipelining for speed. +532 +533 @param localpath: the local file to copy +534 @type localpath: str +535 @param remotepath: the destination path on the SFTP server +536 @type remotepath: str +537 @param callback: optional callback function that accepts the bytes +538 transferred so far and the total bytes to be transferred +539 (since 1.7.4) +540 @type callback: function(int, int) +541 @return: an object containing attributes about the given file +542 (since 1.7.4) +543 @rtype: SFTPAttributes +544 +545 @since: 1.4 +546 """ +547 file_size = os.stat(localpath).st_size +548 fl = file(localpath, 'rb') +549 fr = self.file(remotepath, 'wb') +550 fr.set_pipelined(True) +551 size = 0 +552 while True: +553 data = fl.read(32768) +554 if len(data) == 0: +555 break +556 fr.write(data) +557 size += len(data) +558 if callback is not None: +559 callback(size, file_size) +560 fl.close() +561 fr.close() +562 s = self.stat(remotepath) +563 if s.st_size != size: +564 raise IOError('size mismatch in put! %d != %d' % (s.st_size, size)) +565 return s +
566 +
567 - def get(self, remotepath, localpath, callback=None): +
568 """ +569 Copy a remote file (C{remotepath}) from the SFTP server to the local +570 host as C{localpath}. Any exception raised by operations will be +571 passed through. This method is primarily provided as a convenience. +572 +573 @param remotepath: the remote file to copy +574 @type remotepath: str +575 @param localpath: the destination path on the local host +576 @type localpath: str +577 @param callback: optional callback function that accepts the bytes +578 transferred so far and the total bytes to be transferred +579 (since 1.7.4) +580 @type callback: function(int, int) +581 +582 @since: 1.4 +583 """ +584 fr = self.file(remotepath, 'rb') +585 file_size = self.stat(remotepath).st_size +586 fr.prefetch() +587 fl = file(localpath, 'wb') +588 size = 0 +589 while True: +590 data = fr.read(32768) +591 if len(data) == 0: +592 break +593 fl.write(data) +594 size += len(data) +595 if callback is not None: +596 callback(size, file_size) +597 fl.close() +598 fr.close() +599 s = os.stat(localpath) +600 if s.st_size != size: +601 raise IOError('size mismatch in get! %d != %d' % (s.st_size, size)) +
602 +603 +604 ### internals... +605 +606 +
607 - def _request(self, t, *arg): +
608 num = self._async_request(type(None), t, *arg) +609 return self._read_response(num) +
610 +
611 - def _async_request(self, fileobj, t, *arg): +
612 # this method may be called from other threads (prefetch) +613 self._lock.acquire() +614 try: +615 msg = Message() +616 msg.add_int(self.request_number) +617 for item in arg: +618 if type(item) is int: +619 msg.add_int(item) +620 elif type(item) is long: +621 msg.add_int64(item) +622 elif type(item) is str: +623 msg.add_string(item) +624 elif type(item) is SFTPAttributes: +625 item._pack(msg) +626 else: +627 raise Exception('unknown type for %r type %r' % (item, type(item))) +628 num = self.request_number +629 self._expecting[num] = fileobj +630 self._send_packet(t, str(msg)) +631 self.request_number += 1 +632 finally: +633 self._lock.release() +634 return num +
635 +
636 - def _read_response(self, waitfor=None): +
637 while True: +638 try: +639 t, data = self._read_packet() +640 except EOFError, e: +641 raise SSHException('Server connection dropped: %s' % (str(e),)) +642 msg = Message(data) +643 num = msg.get_int() +644 if num not in self._expecting: +645 # might be response for a file that was closed before responses came back +646 self._log(DEBUG, 'Unexpected response #%d' % (num,)) +647 if waitfor is None: +648 # just doing a single check +649 break +650 continue +651 fileobj = self._expecting[num] +652 del self._expecting[num] +653 if num == waitfor: +654 # synchronous +655 if t == CMD_STATUS: +656 self._convert_status(msg) +657 return t, msg +658 if fileobj is not type(None): +659 fileobj._async_response(t, msg) +660 if waitfor is None: +661 # just doing a single check +662 break +663 return (None, None) +
664 +
665 - def _finish_responses(self, fileobj): +
666 while fileobj in self._expecting.values(): +667 self._read_response() +668 fileobj._check_exception() +
669 +
670 - def _convert_status(self, msg): +
671 """ +672 Raises EOFError or IOError on error status; otherwise does nothing. +673 """ +674 code = msg.get_int() +675 text = msg.get_string() +676 if code == SFTP_OK: +677 return +678 elif code == SFTP_EOF: +679 raise EOFError(text) +680 elif code == SFTP_NO_SUCH_FILE: +681 # clever idea from john a. meinel: map the error codes to errno +682 raise IOError(errno.ENOENT, text) +683 elif code == SFTP_PERMISSION_DENIED: +684 raise IOError(errno.EACCES, text) +685 else: +686 raise IOError(text) +
687 +
688 - def _adjust_cwd(self, path): +
689 """ +690 Return an adjusted path if we're emulating a "current working +691 directory" for the server. +692 """ +693 if type(path) is unicode: +694 path = path.encode('utf-8') +695 if self._cwd is None: +696 return path +697 if (len(path) > 0) and (path[0] == '/'): +698 # absolute path +699 return path +700 if self._cwd == '/': +701 return self._cwd + path +702 return self._cwd + '/' + path +
703 +704 +
705 -class SFTP (SFTPClient): +
706 "an alias for L{SFTPClient} for backwards compatability" +707 pass +
708 +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.sftp_file-module.html b/docs/paramiko.sftp_file-module.html new file mode 100644 index 0000000..664b692 --- /dev/null +++ b/docs/paramiko.sftp_file-module.html @@ -0,0 +1,900 @@ + + + + + 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 +
+   + + randpool = StrongLockingRandomPool() +
+ + + + + + +
+ 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 new file mode 100644 index 0000000..5e9b4c7 --- /dev/null +++ b/docs/paramiko.sftp_file-pysrc.html @@ -0,0 +1,874 @@ + + + + + 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 <robey@lag.net> 
+  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 new file mode 100644 index 0000000..60b436d --- /dev/null +++ b/docs/paramiko.sftp_handle-module.html @@ -0,0 +1,900 @@ + + + + + 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 +
+   + + randpool = StrongLockingRandomPool() +
+ + + + + + +
+ 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 new file mode 100644 index 0000000..ca22a01 --- /dev/null +++ b/docs/paramiko.sftp_handle-pysrc.html @@ -0,0 +1,369 @@ + + + + + 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 <robey@lag.net> 
+  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 new file mode 100644 index 0000000..a2343f6 --- /dev/null +++ b/docs/paramiko.sftp_server-module.html @@ -0,0 +1,900 @@ + + + + + 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 +
+   + + randpool = StrongLockingRandomPool() +
+ + + + + + +
+ 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 new file mode 100644 index 0000000..cd77999 --- /dev/null +++ b/docs/paramiko.sftp_server-pysrc.html @@ -0,0 +1,1196 @@ + + + + + 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 <robey@lag.net> 
+  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 new file mode 100644 index 0000000..4907504 --- /dev/null +++ b/docs/paramiko.sftp_si-module.html @@ -0,0 +1,902 @@ + + + + + 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 +
+   + + randpool = StrongLockingRandomPool() +
+ + + + + + +
+ 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 new file mode 100644 index 0000000..d28e3f1 --- /dev/null +++ b/docs/paramiko.sftp_si-pysrc.html @@ -0,0 +1,527 @@ + + + + + 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 <robey@lag.net> 
+  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 new file mode 100644 index 0000000..b679a41 --- /dev/null +++ b/docs/paramiko.ssh_exception-module.html @@ -0,0 +1,121 @@ + + + + + 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. +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.ssh_exception-pysrc.html b/docs/paramiko.ssh_exception-pysrc.html new file mode 100644 index 0000000..e140015 --- /dev/null +++ b/docs/paramiko.ssh_exception-pysrc.html @@ -0,0 +1,403 @@ + + + + + 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 <robey@lag.net> 
+  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 new file mode 100644 index 0000000..5f7d526 --- /dev/null +++ b/docs/paramiko.ssh_exception.PartialAuthentication-class.html @@ -0,0 +1,241 @@ + + + + + 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__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..9c93b3c --- /dev/null +++ b/docs/paramiko.transport-module.html @@ -0,0 +1,541 @@ + + + + + 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 +
+   + + randpool = StrongLockingRandomPool() +
+ + + + + + +
+ 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 new file mode 100644 index 0000000..f0d6fb1 --- /dev/null +++ b/docs/paramiko.transport-pysrc.html @@ -0,0 +1,4154 @@ + + + + + paramiko.transport + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module transport + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.transport

+
+   1  # Copyright (C) 2003-2007  Robey Pointer <robey@lag.net> 
+   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  # these come from PyCrypt 
+  49  #     http://www.amk.ca/python/writing/pycrypt/ 
+  50  # i believe this on the standards track. 
+  51  # PyCrypt compiled for Win32 can be downloaded from the HashTar homepage: 
+  52  #     http://nitace.bsd.uchicago.edu:8080/hashtar 
+  53  from Crypto.Cipher import Blowfish, AES, DES3 
+  54  from Crypto.Hash import SHA, MD5 
+  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.4' + 198 + 199 _preferred_ciphers = ( 'aes128-cbc', 'blowfish-cbc', 'aes256-cbc', '3des-cbc' ) + 200 _preferred_macs = ( 'hmac-sha1', 'hmac-md5', 'hmac-sha1-96', 'hmac-md5-96' ) + 201 _preferred_keys = ( 'ssh-rsa', 'ssh-dss' ) + 202 _preferred_kex = ( 'diffie-hellman-group1-sha1', 'diffie-hellman-group-exchange-sha1' ) + 203 _preferred_compression = ( 'none', ) + 204 + 205 _cipher_info = { + 206 'blowfish-cbc': { 'class': Blowfish, 'mode': Blowfish.MODE_CBC, 'block-size': 8, 'key-size': 16 }, + 207 'aes128-cbc': { 'class': AES, 'mode': AES.MODE_CBC, 'block-size': 16, 'key-size': 16 }, + 208 'aes256-cbc': { 'class': AES, 'mode': AES.MODE_CBC, 'block-size': 16, 'key-size': 32 }, + 209 '3des-cbc': { 'class': DES3, 'mode': DES3.MODE_CBC, 'block-size': 8, 'key-size': 24 }, + 210 } + 211 + 212 _mac_info = { + 213 'hmac-sha1': { 'class': SHA, 'size': 20 }, + 214 'hmac-sha1-96': { 'class': SHA, 'size': 12 }, + 215 'hmac-md5': { 'class': MD5, 'size': 16 }, + 216 'hmac-md5-96': { 'class': MD5, 'size': 12 }, + 217 } + 218 + 219 _key_info = { + 220 'ssh-rsa': RSAKey, + 221 'ssh-dss': DSSKey, + 222 } + 223 + 224 _kex_info = { + 225 'diffie-hellman-group1-sha1': KexGroup1, + 226 'diffie-hellman-group-exchange-sha1': KexGex, + 227 } + 228 + 229 _compression_info = { + 230 # zlib@openssh.com is just zlib, but only turned on after a successful + 231 # authentication. openssh servers may only offer this type because + 232 # they've had troubles with security holes in zlib in the past. + 233 'zlib@openssh.com': ( ZlibCompressor, ZlibDecompressor ), + 234 'zlib': ( ZlibCompressor, ZlibDecompressor ), + 235 'none': ( None, None ), + 236 } + 237 + 238 + 239 _modulus_pack = None + 240 +
241 - def __init__(self, sock): +
242 """ + 243 Create a new SSH session over an existing socket, or socket-like + 244 object. This only creates the Transport object; it doesn't begin the + 245 SSH session yet. Use L{connect} or L{start_client} to begin a client + 246 session, or L{start_server} to begin a server session. + 247 + 248 If the object is not actually a socket, it must have the following + 249 methods: + 250 - C{send(str)}: Writes from 1 to C{len(str)} bytes, and + 251 returns an int representing the number of bytes written. Returns + 252 0 or raises C{EOFError} if the stream has been closed. + 253 - C{recv(int)}: Reads from 1 to C{int} bytes and returns them as a + 254 string. Returns 0 or raises C{EOFError} if the stream has been + 255 closed. + 256 - C{close()}: Closes the socket. + 257 - C{settimeout(n)}: Sets a (float) timeout on I/O operations. + 258 + 259 For ease of use, you may also pass in an address (as a tuple) or a host + 260 string as the C{sock} argument. (A host string is a hostname with an + 261 optional port (separated by C{":"}) which will be converted into a + 262 tuple of C{(hostname, port)}.) A socket will be connected to this + 263 address and used for communication. Exceptions from the C{socket} call + 264 may be thrown in this case. + 265 + 266 @param sock: a socket or socket-like object to create the session over. + 267 @type sock: socket + 268 """ + 269 if type(sock) is str: + 270 # convert "host:port" into (host, port) + 271 hl = sock.split(':', 1) + 272 if len(hl) == 1: + 273 sock = (hl[0], 22) + 274 else: + 275 sock = (hl[0], int(hl[1])) + 276 if type(sock) is tuple: + 277 # connect to the given (host, port) + 278 hostname, port = sock + 279 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + 280 sock.connect((hostname, port)) + 281 # okay, normal socket-ish flow here... + 282 threading.Thread.__init__(self) + 283 self.randpool = randpool + 284 self.sock = sock + 285 # Python < 2.3 doesn't have the settimeout method - RogerB + 286 try: + 287 # we set the timeout so we can check self.active periodically to + 288 # see if we should bail. socket.timeout exception is never + 289 # propagated. + 290 self.sock.settimeout(0.1) + 291 except AttributeError: + 292 pass + 293 + 294 # negotiated crypto parameters + 295 self.packetizer = Packetizer(sock) + 296 self.local_version = 'SSH-' + self._PROTO_ID + '-' + self._CLIENT_ID + 297 self.remote_version = '' + 298 self.local_cipher = self.remote_cipher = '' + 299 self.local_kex_init = self.remote_kex_init = None + 300 self.local_mac = self.remote_mac = None + 301 self.local_compression = self.remote_compression = None + 302 self.session_id = None + 303 self.host_key_type = None + 304 self.host_key = None + 305 + 306 # state used during negotiation + 307 self.kex_engine = None + 308 self.H = None + 309 self.K = None + 310 + 311 self.active = False + 312 self.initial_kex_done = False + 313 self.in_kex = False + 314 self.authenticated = False + 315 self._expected_packet = tuple() + 316 self.lock = threading.Lock() # synchronization (always higher level than write_lock) + 317 + 318 # tracking open channels + 319 self._channels = ChannelMap() + 320 self.channel_events = { } # (id -> Event) + 321 self.channels_seen = { } # (id -> True) + 322 self._channel_counter = 1 + 323 self.window_size = 65536 + 324 self.max_packet_size = 34816 + 325 self._x11_handler = None + 326 self._tcp_handler = None + 327 + 328 self.saved_exception = None + 329 self.clear_to_send = threading.Event() + 330 self.clear_to_send_lock = threading.Lock() + 331 self.log_name = 'paramiko.transport' + 332 self.logger = util.get_logger(self.log_name) + 333 self.packetizer.set_log(self.logger) + 334 self.auth_handler = None + 335 self.global_response = None # response Message from an arbitrary global request + 336 self.completion_event = None # user-defined event callbacks + 337 self.banner_timeout = 15 # how long (seconds) to wait for the SSH banner + 338 + 339 # server mode: + 340 self.server_mode = False + 341 self.server_object = None + 342 self.server_key_dict = { } + 343 self.server_accepts = [ ] + 344 self.server_accept_cv = threading.Condition(self.lock) + 345 self.subsystem_table = { } +
346 +
347 - def __repr__(self): +
348 """ + 349 Returns a string representation of this object, for debugging. + 350 + 351 @rtype: str + 352 """ + 353 out = '<paramiko.Transport at %s' % hex(long(id(self)) & 0xffffffffL) + 354 if not self.active: + 355 out += ' (unconnected)' + 356 else: + 357 if self.local_cipher != '': + 358 out += ' (cipher %s, %d bits)' % (self.local_cipher, + 359 self._cipher_info[self.local_cipher]['key-size'] * 8) + 360 if self.is_authenticated(): + 361 out += ' (active; %d open channel(s))' % len(self._channels) + 362 elif self.initial_kex_done: + 363 out += ' (connected; awaiting auth)' + 364 else: + 365 out += ' (connecting)' + 366 out += '>' + 367 return out +
368 +
369 - def atfork(self): +
370 """ + 371 Terminate this Transport without closing the session. On posix + 372 systems, if a Transport is open during process forking, both parent + 373 and child will share the underlying socket, but only one process can + 374 use the connection (without corrupting the session). Use this method + 375 to clean up a Transport object without disrupting the other process. + 376 + 377 @since: 1.5.3 + 378 """ + 379 self.sock.close() + 380 self.close() +
381 +
382 - def get_security_options(self): +
383 """ + 384 Return a L{SecurityOptions} object which can be used to tweak the + 385 encryption algorithms this transport will permit, and the order of + 386 preference for them. + 387 + 388 @return: an object that can be used to change the preferred algorithms + 389 for encryption, digest (hash), public key, and key exchange. + 390 @rtype: L{SecurityOptions} + 391 """ + 392 return SecurityOptions(self) +
393 +
394 - def start_client(self, event=None): +
395 """ + 396 Negotiate a new SSH2 session as a client. This is the first step after + 397 creating a new L{Transport}. A separate thread is created for protocol + 398 negotiation. + 399 + 400 If an event is passed in, this method returns immediately. When + 401 negotiation is done (successful or not), the given C{Event} will + 402 be triggered. On failure, L{is_active} will return C{False}. + 403 + 404 (Since 1.4) If C{event} is C{None}, this method will not return until + 405 negotation is done. On success, the method returns normally. + 406 Otherwise an SSHException is raised. + 407 + 408 After a successful negotiation, you will usually want to authenticate, + 409 calling L{auth_password <Transport.auth_password>} or + 410 L{auth_publickey <Transport.auth_publickey>}. + 411 + 412 @note: L{connect} is a simpler method for connecting as a client. + 413 + 414 @note: After calling this method (or L{start_server} or L{connect}), + 415 you should no longer directly read from or write to the original + 416 socket object. + 417 + 418 @param event: an event to trigger when negotiation is complete + 419 (optional) + 420 @type event: threading.Event + 421 + 422 @raise SSHException: if negotiation fails (and no C{event} was passed + 423 in) + 424 """ + 425 self.active = True + 426 if event is not None: + 427 # async, return immediately and let the app poll for completion + 428 self.completion_event = event + 429 self.start() + 430 return + 431 + 432 # synchronous, wait for a result + 433 self.completion_event = event = threading.Event() + 434 self.start() + 435 while True: + 436 event.wait(0.1) + 437 if not self.active: + 438 e = self.get_exception() + 439 if e is not None: + 440 raise e + 441 raise SSHException('Negotiation failed.') + 442 if event.isSet(): + 443 break +
444 +
445 - def start_server(self, event=None, server=None): +
446 """ + 447 Negotiate a new SSH2 session as a server. This is the first step after + 448 creating a new L{Transport} and setting up your server host key(s). A + 449 separate thread is created for protocol negotiation. + 450 + 451 If an event is passed in, this method returns immediately. When + 452 negotiation is done (successful or not), the given C{Event} will + 453 be triggered. On failure, L{is_active} will return C{False}. + 454 + 455 (Since 1.4) If C{event} is C{None}, this method will not return until + 456 negotation is done. On success, the method returns normally. + 457 Otherwise an SSHException is raised. + 458 + 459 After a successful negotiation, the client will need to authenticate. + 460 Override the methods + 461 L{get_allowed_auths <ServerInterface.get_allowed_auths>}, + 462 L{check_auth_none <ServerInterface.check_auth_none>}, + 463 L{check_auth_password <ServerInterface.check_auth_password>}, and + 464 L{check_auth_publickey <ServerInterface.check_auth_publickey>} in the + 465 given C{server} object to control the authentication process. + 466 + 467 After a successful authentication, the client should request to open + 468 a channel. Override + 469 L{check_channel_request <ServerInterface.check_channel_request>} in the + 470 given C{server} object to allow channels to be opened. + 471 + 472 @note: After calling this method (or L{start_client} or L{connect}), + 473 you should no longer directly read from or write to the original + 474 socket object. + 475 + 476 @param event: an event to trigger when negotiation is complete. + 477 @type event: threading.Event + 478 @param server: an object used to perform authentication and create + 479 L{Channel}s. + 480 @type server: L{server.ServerInterface} + 481 + 482 @raise SSHException: if negotiation fails (and no C{event} was passed + 483 in) + 484 """ + 485 if server is None: + 486 server = ServerInterface() + 487 self.server_mode = True + 488 self.server_object = server + 489 self.active = True + 490 if event is not None: + 491 # async, return immediately and let the app poll for completion + 492 self.completion_event = event + 493 self.start() + 494 return + 495 + 496 # synchronous, wait for a result + 497 self.completion_event = event = threading.Event() + 498 self.start() + 499 while True: + 500 event.wait(0.1) + 501 if not self.active: + 502 e = self.get_exception() + 503 if e is not None: + 504 raise e + 505 raise SSHException('Negotiation failed.') + 506 if event.isSet(): + 507 break +
508 +
509 - def add_server_key(self, key): +
510 """ + 511 Add a host key to the list of keys used for server mode. When behaving + 512 as a server, the host key is used to sign certain packets during the + 513 SSH2 negotiation, so that the client can trust that we are who we say + 514 we are. Because this is used for signing, the key must contain private + 515 key info, not just the public half. Only one key of each type (RSA or + 516 DSS) is kept. + 517 + 518 @param key: the host key to add, usually an L{RSAKey <rsakey.RSAKey>} or + 519 L{DSSKey <dsskey.DSSKey>}. + 520 @type key: L{PKey <pkey.PKey>} + 521 """ + 522 self.server_key_dict[key.get_name()] = key +
523 +
524 - def get_server_key(self): +
525 """ + 526 Return the active host key, in server mode. After negotiating with the + 527 client, this method will return the negotiated host key. If only one + 528 type of host key was set with L{add_server_key}, that's the only key + 529 that will ever be returned. But in cases where you have set more than + 530 one type of host key (for example, an RSA key and a DSS key), the key + 531 type will be negotiated by the client, and this method will return the + 532 key of the type agreed on. If the host key has not been negotiated + 533 yet, C{None} is returned. In client mode, the behavior is undefined. + 534 + 535 @return: host key of the type negotiated by the client, or C{None}. + 536 @rtype: L{PKey <pkey.PKey>} + 537 """ + 538 try: + 539 return self.server_key_dict[self.host_key_type] + 540 except KeyError: + 541 pass + 542 return None +
543 +
544 - def load_server_moduli(filename=None): +
545 """ + 546 I{(optional)} + 547 Load a file of prime moduli for use in doing group-exchange key + 548 negotiation in server mode. It's a rather obscure option and can be + 549 safely ignored. + 550 + 551 In server mode, the remote client may request "group-exchange" key + 552 negotiation, which asks the server to send a random prime number that + 553 fits certain criteria. These primes are pretty difficult to compute, + 554 so they can't be generated on demand. But many systems contain a file + 555 of suitable primes (usually named something like C{/etc/ssh/moduli}). + 556 If you call C{load_server_moduli} and it returns C{True}, then this + 557 file of primes has been loaded and we will support "group-exchange" in + 558 server mode. Otherwise server mode will just claim that it doesn't + 559 support that method of key negotiation. + 560 + 561 @param filename: optional path to the moduli file, if you happen to + 562 know that it's not in a standard location. + 563 @type filename: str + 564 @return: True if a moduli file was successfully loaded; False + 565 otherwise. + 566 @rtype: bool + 567 + 568 @note: This has no effect when used in client mode. + 569 """ + 570 Transport._modulus_pack = ModulusPack(randpool) + 571 # places to look for the openssh "moduli" file + 572 file_list = [ '/etc/ssh/moduli', '/usr/local/etc/moduli' ] + 573 if filename is not None: + 574 file_list.insert(0, filename) + 575 for fn in file_list: + 576 try: + 577 Transport._modulus_pack.read_file(fn) + 578 return True + 579 except IOError: + 580 pass + 581 # none succeeded + 582 Transport._modulus_pack = None + 583 return False +
584 load_server_moduli = staticmethod(load_server_moduli) + 585 +
586 - def close(self): +
587 """ + 588 Close this session, and any open channels that are tied to it. + 589 """ + 590 if not self.active: + 591 return + 592 self.active = False + 593 self.packetizer.close() + 594 self.join() + 595 for chan in self._channels.values(): + 596 chan._unlink() +
597 +
598 - def get_remote_server_key(self): +
599 """ + 600 Return the host key of the server (in client mode). + 601 + 602 @note: Previously this call returned a tuple of (key type, key string). + 603 You can get the same effect by calling + 604 L{PKey.get_name <pkey.PKey.get_name>} for the key type, and + 605 C{str(key)} for the key string. + 606 + 607 @raise SSHException: if no session is currently active. + 608 + 609 @return: public key of the remote server + 610 @rtype: L{PKey <pkey.PKey>} + 611 """ + 612 if (not self.active) or (not self.initial_kex_done): + 613 raise SSHException('No existing session') + 614 return self.host_key +
615 +
616 - def is_active(self): +
617 """ + 618 Return true if this session is active (open). + 619 + 620 @return: True if the session is still active (open); False if the + 621 session is closed + 622 @rtype: bool + 623 """ + 624 return self.active +
625 +
626 - def open_session(self): +
627 """ + 628 Request a new channel to the server, of type C{"session"}. This + 629 is just an alias for C{open_channel('session')}. + 630 + 631 @return: a new L{Channel} + 632 @rtype: L{Channel} + 633 + 634 @raise SSHException: if the request is rejected or the session ends + 635 prematurely + 636 """ + 637 return self.open_channel('session') +
638 +
639 - def open_x11_channel(self, src_addr=None): +
640 """ + 641 Request a new channel to the client, of type C{"x11"}. This + 642 is just an alias for C{open_channel('x11', src_addr=src_addr)}. + 643 + 644 @param src_addr: the source address of the x11 server (port is the + 645 x11 port, ie. 6010) + 646 @type src_addr: (str, int) + 647 @return: a new L{Channel} + 648 @rtype: L{Channel} + 649 + 650 @raise SSHException: if the request is rejected or the session ends + 651 prematurely + 652 """ + 653 return self.open_channel('x11', src_addr=src_addr) +
654 +
655 - def open_forwarded_tcpip_channel(self, (src_addr, src_port), (dest_addr, dest_port)): +
656 """ + 657 Request a new channel back to the client, of type C{"forwarded-tcpip"}. + 658 This is used after a client has requested port forwarding, for sending + 659 incoming connections back to the client. + 660 + 661 @param src_addr: originator's address + 662 @param src_port: originator's port + 663 @param dest_addr: local (server) connected address + 664 @param dest_port: local (server) connected port + 665 """ + 666 return self.open_channel('forwarded-tcpip', (dest_addr, dest_port), (src_addr, src_port)) +
667 +
668 - def open_channel(self, kind, dest_addr=None, src_addr=None): +
669 """ + 670 Request a new channel to the server. L{Channel}s are socket-like + 671 objects used for the actual transfer of data across the session. + 672 You may only request a channel after negotiating encryption (using + 673 L{connect} or L{start_client}) and authenticating. + 674 + 675 @param kind: the kind of channel requested (usually C{"session"}, + 676 C{"forwarded-tcpip"}, C{"direct-tcpip"}, or C{"x11"}) + 677 @type kind: str + 678 @param dest_addr: the destination address of this port forwarding, + 679 if C{kind} is C{"forwarded-tcpip"} or C{"direct-tcpip"} (ignored + 680 for other channel types) + 681 @type dest_addr: (str, int) + 682 @param src_addr: the source address of this port forwarding, if + 683 C{kind} is C{"forwarded-tcpip"}, C{"direct-tcpip"}, or C{"x11"} + 684 @type src_addr: (str, int) + 685 @return: a new L{Channel} on success + 686 @rtype: L{Channel} + 687 + 688 @raise SSHException: if the request is rejected or the session ends + 689 prematurely + 690 """ + 691 chan = None + 692 if not self.active: + 693 # don't bother trying to allocate a channel + 694 return None + 695 self.lock.acquire() + 696 try: + 697 chanid = self._next_channel() + 698 m = Message() + 699 m.add_byte(chr(MSG_CHANNEL_OPEN)) + 700 m.add_string(kind) + 701 m.add_int(chanid) + 702 m.add_int(self.window_size) + 703 m.add_int(self.max_packet_size) + 704 if (kind == 'forwarded-tcpip') or (kind == 'direct-tcpip'): + 705 m.add_string(dest_addr[0]) + 706 m.add_int(dest_addr[1]) + 707 m.add_string(src_addr[0]) + 708 m.add_int(src_addr[1]) + 709 elif kind == 'x11': + 710 m.add_string(src_addr[0]) + 711 m.add_int(src_addr[1]) + 712 chan = Channel(chanid) + 713 self._channels.put(chanid, chan) + 714 self.channel_events[chanid] = event = threading.Event() + 715 self.channels_seen[chanid] = True + 716 chan._set_transport(self) + 717 chan._set_window(self.window_size, self.max_packet_size) + 718 finally: + 719 self.lock.release() + 720 self._send_user_message(m) + 721 while True: + 722 event.wait(0.1); + 723 if not self.active: + 724 e = self.get_exception() + 725 if e is None: + 726 e = SSHException('Unable to open channel.') + 727 raise e + 728 if event.isSet(): + 729 break + 730 chan = self._channels.get(chanid) + 731 if chan is not None: + 732 return chan + 733 e = self.get_exception() + 734 if e is None: + 735 e = SSHException('Unable to open channel.') + 736 raise e +
737 +
738 - def request_port_forward(self, address, port, handler=None): +
739 """ + 740 Ask the server to forward TCP connections from a listening port on + 741 the server, across this SSH session. + 742 + 743 If a handler is given, that handler is called from a different thread + 744 whenever a forwarded connection arrives. The handler parameters are:: + 745 + 746 handler(channel, (origin_addr, origin_port), (server_addr, server_port)) + 747 + 748 where C{server_addr} and C{server_port} are the address and port that + 749 the server was listening on. + 750 + 751 If no handler is set, the default behavior is to send new incoming + 752 forwarded connections into the accept queue, to be picked up via + 753 L{accept}. + 754 + 755 @param address: the address to bind when forwarding + 756 @type address: str + 757 @param port: the port to forward, or 0 to ask the server to allocate + 758 any port + 759 @type port: int + 760 @param handler: optional handler for incoming forwarded connections + 761 @type handler: function(Channel, (str, int), (str, int)) + 762 @return: the port # allocated by the server + 763 @rtype: int + 764 + 765 @raise SSHException: if the server refused the TCP forward request + 766 """ + 767 if not self.active: + 768 raise SSHException('SSH session not active') + 769 address = str(address) + 770 port = int(port) + 771 response = self.global_request('tcpip-forward', (address, port), wait=True) + 772 if response is None: + 773 raise SSHException('TCP forwarding request denied') + 774 if port == 0: + 775 port = response.get_int() + 776 if handler is None: + 777 def default_handler(channel, (src_addr, src_port), (dest_addr, dest_port)): + 778 self._queue_incoming_channel(channel) +
779 handler = default_handler + 780 self._tcp_handler = handler + 781 return port +
782 +
783 - def cancel_port_forward(self, address, port): +
784 """ + 785 Ask the server to cancel a previous port-forwarding request. No more + 786 connections to the given address & port will be forwarded across this + 787 ssh connection. + 788 + 789 @param address: the address to stop forwarding + 790 @type address: str + 791 @param port: the port to stop forwarding + 792 @type port: int + 793 """ + 794 if not self.active: + 795 return + 796 self._tcp_handler = None + 797 self.global_request('cancel-tcpip-forward', (address, port), wait=True) +
798 +
799 - def open_sftp_client(self): +
800 """ + 801 Create an SFTP client channel from an open transport. On success, + 802 an SFTP session will be opened with the remote host, and a new + 803 SFTPClient object will be returned. + 804 + 805 @return: a new L{SFTPClient} object, referring to an sftp session + 806 (channel) across this transport + 807 @rtype: L{SFTPClient} + 808 """ + 809 return SFTPClient.from_transport(self) +
810 +
811 - def send_ignore(self, bytes=None): +
812 """ + 813 Send a junk packet across the encrypted link. This is sometimes used + 814 to add "noise" to a connection to confuse would-be attackers. It can + 815 also be used as a keep-alive for long lived connections traversing + 816 firewalls. + 817 + 818 @param bytes: the number of random bytes to send in the payload of the + 819 ignored packet -- defaults to a random number from 10 to 41. + 820 @type bytes: int + 821 """ + 822 m = Message() + 823 m.add_byte(chr(MSG_IGNORE)) + 824 randpool.stir() + 825 if bytes is None: + 826 bytes = (ord(randpool.get_bytes(1)) % 32) + 10 + 827 m.add_bytes(randpool.get_bytes(bytes)) + 828 self._send_user_message(m) +
829 +
830 - def renegotiate_keys(self): +
831 """ + 832 Force this session to switch to new keys. Normally this is done + 833 automatically after the session hits a certain number of packets or + 834 bytes sent or received, but this method gives you the option of forcing + 835 new keys whenever you want. Negotiating new keys causes a pause in + 836 traffic both ways as the two sides swap keys and do computations. This + 837 method returns when the session has switched to new keys. + 838 + 839 @raise SSHException: if the key renegotiation failed (which causes the + 840 session to end) + 841 """ + 842 self.completion_event = threading.Event() + 843 self._send_kex_init() + 844 while True: + 845 self.completion_event.wait(0.1) + 846 if not self.active: + 847 e = self.get_exception() + 848 if e is not None: + 849 raise e + 850 raise SSHException('Negotiation failed.') + 851 if self.completion_event.isSet(): + 852 break + 853 return +
854 +
855 - def set_keepalive(self, interval): +
856 """ + 857 Turn on/off keepalive packets (default is off). If this is set, after + 858 C{interval} seconds without sending any data over the connection, a + 859 "keepalive" packet will be sent (and ignored by the remote host). This + 860 can be useful to keep connections alive over a NAT, for example. + 861 + 862 @param interval: seconds to wait before sending a keepalive packet (or + 863 0 to disable keepalives). + 864 @type interval: int + 865 """ + 866 self.packetizer.set_keepalive(interval, + 867 lambda x=weakref.proxy(self): x.global_request('keepalive@lag.net', wait=False)) +
868 +
869 - def global_request(self, kind, data=None, wait=True): +
870 """ + 871 Make a global request to the remote host. These are normally + 872 extensions to the SSH2 protocol. + 873 + 874 @param kind: name of the request. + 875 @type kind: str + 876 @param data: an optional tuple containing additional data to attach + 877 to the request. + 878 @type data: tuple + 879 @param wait: C{True} if this method should not return until a response + 880 is received; C{False} otherwise. + 881 @type wait: bool + 882 @return: a L{Message} containing possible additional data if the + 883 request was successful (or an empty L{Message} if C{wait} was + 884 C{False}); C{None} if the request was denied. + 885 @rtype: L{Message} + 886 """ + 887 if wait: + 888 self.completion_event = threading.Event() + 889 m = Message() + 890 m.add_byte(chr(MSG_GLOBAL_REQUEST)) + 891 m.add_string(kind) + 892 m.add_boolean(wait) + 893 if data is not None: + 894 m.add(*data) + 895 self._log(DEBUG, 'Sending global request "%s"' % kind) + 896 self._send_user_message(m) + 897 if not wait: + 898 return None + 899 while True: + 900 self.completion_event.wait(0.1) + 901 if not self.active: + 902 return None + 903 if self.completion_event.isSet(): + 904 break + 905 return self.global_response +
906 +
907 - def accept(self, timeout=None): +
908 """ + 909 Return the next channel opened by the client over this transport, in + 910 server mode. If no channel is opened before the given timeout, C{None} + 911 is returned. + 912 + 913 @param timeout: seconds to wait for a channel, or C{None} to wait + 914 forever + 915 @type timeout: int + 916 @return: a new Channel opened by the client + 917 @rtype: L{Channel} + 918 """ + 919 self.lock.acquire() + 920 try: + 921 if len(self.server_accepts) > 0: + 922 chan = self.server_accepts.pop(0) + 923 else: + 924 self.server_accept_cv.wait(timeout) + 925 if len(self.server_accepts) > 0: + 926 chan = self.server_accepts.pop(0) + 927 else: + 928 # timeout + 929 chan = None + 930 finally: + 931 self.lock.release() + 932 return chan +
933 +
934 - def connect(self, hostkey=None, username='', password=None, pkey=None): +
935 """ + 936 Negotiate an SSH2 session, and optionally verify the server's host key + 937 and authenticate using a password or private key. This is a shortcut + 938 for L{start_client}, L{get_remote_server_key}, and + 939 L{Transport.auth_password} or L{Transport.auth_publickey}. Use those + 940 methods if you want more control. + 941 + 942 You can use this method immediately after creating a Transport to + 943 negotiate encryption with a server. If it fails, an exception will be + 944 thrown. On success, the method will return cleanly, and an encrypted + 945 session exists. You may immediately call L{open_channel} or + 946 L{open_session} to get a L{Channel} object, which is used for data + 947 transfer. + 948 + 949 @note: If you fail to supply a password or private key, this method may + 950 succeed, but a subsequent L{open_channel} or L{open_session} call may + 951 fail because you haven't authenticated yet. + 952 + 953 @param hostkey: the host key expected from the server, or C{None} if + 954 you don't want to do host key verification. + 955 @type hostkey: L{PKey<pkey.PKey>} + 956 @param username: the username to authenticate as. + 957 @type username: str + 958 @param password: a password to use for authentication, if you want to + 959 use password authentication; otherwise C{None}. + 960 @type password: str + 961 @param pkey: a private key to use for authentication, if you want to + 962 use private key authentication; otherwise C{None}. + 963 @type pkey: L{PKey<pkey.PKey>} + 964 + 965 @raise SSHException: if the SSH2 negotiation fails, the host key + 966 supplied by the server is incorrect, or authentication fails. + 967 """ + 968 if hostkey is not None: + 969 self._preferred_keys = [ hostkey.get_name() ] + 970 + 971 self.start_client() + 972 + 973 # check host key if we were given one + 974 if (hostkey is not None): + 975 key = self.get_remote_server_key() + 976 if (key.get_name() != hostkey.get_name()) or (str(key) != str(hostkey)): + 977 self._log(DEBUG, 'Bad host key from server') + 978 self._log(DEBUG, 'Expected: %s: %s' % (hostkey.get_name(), repr(str(hostkey)))) + 979 self._log(DEBUG, 'Got : %s: %s' % (key.get_name(), repr(str(key)))) + 980 raise SSHException('Bad host key from server') + 981 self._log(DEBUG, 'Host key verified (%s)' % hostkey.get_name()) + 982 + 983 if (pkey is not None) or (password is not None): + 984 if password is not None: + 985 self._log(DEBUG, 'Attempting password auth...') + 986 self.auth_password(username, password) + 987 else: + 988 self._log(DEBUG, 'Attempting public-key auth...') + 989 self.auth_publickey(username, pkey) + 990 + 991 return +
992 +
993 - def get_exception(self): +
994 """ + 995 Return any exception that happened during the last server request. + 996 This can be used to fetch more specific error information after using + 997 calls like L{start_client}. The exception (if any) is cleared after + 998 this call. + 999 +1000 @return: an exception, or C{None} if there is no stored exception. +1001 @rtype: Exception +1002 +1003 @since: 1.1 +1004 """ +1005 self.lock.acquire() +1006 try: +1007 e = self.saved_exception +1008 self.saved_exception = None +1009 return e +1010 finally: +1011 self.lock.release() +
1012 +
1013 - def set_subsystem_handler(self, name, handler, *larg, **kwarg): +
1014 """ +1015 Set the handler class for a subsystem in server mode. If a request +1016 for this subsystem is made on an open ssh channel later, this handler +1017 will be constructed and called -- see L{SubsystemHandler} for more +1018 detailed documentation. +1019 +1020 Any extra parameters (including keyword arguments) are saved and +1021 passed to the L{SubsystemHandler} constructor later. +1022 +1023 @param name: name of the subsystem. +1024 @type name: str +1025 @param handler: subclass of L{SubsystemHandler} that handles this +1026 subsystem. +1027 @type handler: class +1028 """ +1029 try: +1030 self.lock.acquire() +1031 self.subsystem_table[name] = (handler, larg, kwarg) +1032 finally: +1033 self.lock.release() +
1034 +
1035 - def is_authenticated(self): +
1036 """ +1037 Return true if this session is active and authenticated. +1038 +1039 @return: True if the session is still open and has been authenticated +1040 successfully; False if authentication failed and/or the session is +1041 closed. +1042 @rtype: bool +1043 """ +1044 return self.active and (self.auth_handler is not None) and self.auth_handler.is_authenticated() +
1045 +
1046 - def get_username(self): +
1047 """ +1048 Return the username this connection is authenticated for. If the +1049 session is not authenticated (or authentication failed), this method +1050 returns C{None}. +1051 +1052 @return: username that was authenticated, or C{None}. +1053 @rtype: string +1054 """ +1055 if not self.active or (self.auth_handler is None): +1056 return None +1057 return self.auth_handler.get_username() +
1058 +
1059 - def auth_none(self, username): +
1060 """ +1061 Try to authenticate to the server using no authentication at all. +1062 This will almost always fail. It may be useful for determining the +1063 list of authentication types supported by the server, by catching the +1064 L{BadAuthenticationType} exception raised. +1065 +1066 @param username: the username to authenticate as +1067 @type username: string +1068 @return: list of auth types permissible for the next stage of +1069 authentication (normally empty) +1070 @rtype: list +1071 +1072 @raise BadAuthenticationType: if "none" authentication isn't allowed +1073 by the server for this user +1074 @raise SSHException: if the authentication failed due to a network +1075 error +1076 +1077 @since: 1.5 +1078 """ +1079 if (not self.active) or (not self.initial_kex_done): +1080 raise SSHException('No existing session') +1081 my_event = threading.Event() +1082 self.auth_handler = AuthHandler(self) +1083 self.auth_handler.auth_none(username, my_event) +1084 return self.auth_handler.wait_for_response(my_event) +
1085 +
1086 - def auth_password(self, username, password, event=None, fallback=True): +
1087 """ +1088 Authenticate to the server using a password. The username and password +1089 are sent over an encrypted link. +1090 +1091 If an C{event} is passed in, this method will return immediately, and +1092 the event will be triggered once authentication succeeds or fails. On +1093 success, L{is_authenticated} will return C{True}. On failure, you may +1094 use L{get_exception} to get more detailed error information. +1095 +1096 Since 1.1, if no event is passed, this method will block until the +1097 authentication succeeds or fails. On failure, an exception is raised. +1098 Otherwise, the method simply returns. +1099 +1100 Since 1.5, if no event is passed and C{fallback} is C{True} (the +1101 default), if the server doesn't support plain password authentication +1102 but does support so-called "keyboard-interactive" mode, an attempt +1103 will be made to authenticate using this interactive mode. If it fails, +1104 the normal exception will be thrown as if the attempt had never been +1105 made. This is useful for some recent Gentoo and Debian distributions, +1106 which turn off plain password authentication in a misguided belief +1107 that interactive authentication is "more secure". (It's not.) +1108 +1109 If the server requires multi-step authentication (which is very rare), +1110 this method will return a list of auth types permissible for the next +1111 step. Otherwise, in the normal case, an empty list is returned. +1112 +1113 @param username: the username to authenticate as +1114 @type username: str +1115 @param password: the password to authenticate with +1116 @type password: str or unicode +1117 @param event: an event to trigger when the authentication attempt is +1118 complete (whether it was successful or not) +1119 @type event: threading.Event +1120 @param fallback: C{True} if an attempt at an automated "interactive" +1121 password auth should be made if the server doesn't support normal +1122 password auth +1123 @type fallback: bool +1124 @return: list of auth types permissible for the next stage of +1125 authentication (normally empty) +1126 @rtype: list +1127 +1128 @raise BadAuthenticationType: if password authentication isn't +1129 allowed by the server for this user (and no event was passed in) +1130 @raise AuthenticationException: if the authentication failed (and no +1131 event was passed in) +1132 @raise SSHException: if there was a network error +1133 """ +1134 if (not self.active) or (not self.initial_kex_done): +1135 # we should never try to send the password unless we're on a secure link +1136 raise SSHException('No existing session') +1137 if event is None: +1138 my_event = threading.Event() +1139 else: +1140 my_event = event +1141 self.auth_handler = AuthHandler(self) +1142 self.auth_handler.auth_password(username, password, my_event) +1143 if event is not None: +1144 # caller wants to wait for event themselves +1145 return [] +1146 try: +1147 return self.auth_handler.wait_for_response(my_event) +1148 except BadAuthenticationType, x: +1149 # if password auth isn't allowed, but keyboard-interactive *is*, try to fudge it +1150 if not fallback or ('keyboard-interactive' not in x.allowed_types): +1151 raise +1152 try: +1153 def handler(title, instructions, fields): +1154 if len(fields) > 1: +1155 raise SSHException('Fallback authentication failed.') +1156 if len(fields) == 0: +1157 # for some reason, at least on os x, a 2nd request will +1158 # be made with zero fields requested. maybe it's just +1159 # to try to fake out automated scripting of the exact +1160 # type we're doing here. *shrug* :) +1161 return [] +1162 return [ password ] +
1163 return self.auth_interactive(username, handler) +1164 except SSHException, ignored: +1165 # attempt failed; just raise the original exception +1166 raise x +1167 return None +1168 +
1169 - def auth_publickey(self, username, key, event=None): +
1170 """ +1171 Authenticate to the server using a private key. The key is used to +1172 sign data from the server, so it must include the private part. +1173 +1174 If an C{event} is passed in, this method will return immediately, and +1175 the event will be triggered once authentication succeeds or fails. On +1176 success, L{is_authenticated} will return C{True}. On failure, you may +1177 use L{get_exception} to get more detailed error information. +1178 +1179 Since 1.1, if no event is passed, this method will block until the +1180 authentication succeeds or fails. On failure, an exception is raised. +1181 Otherwise, the method simply returns. +1182 +1183 If the server requires multi-step authentication (which is very rare), +1184 this method will return a list of auth types permissible for the next +1185 step. Otherwise, in the normal case, an empty list is returned. +1186 +1187 @param username: the username to authenticate as +1188 @type username: string +1189 @param key: the private key to authenticate with +1190 @type key: L{PKey <pkey.PKey>} +1191 @param event: an event to trigger when the authentication attempt is +1192 complete (whether it was successful or not) +1193 @type event: threading.Event +1194 @return: list of auth types permissible for the next stage of +1195 authentication (normally empty) +1196 @rtype: list +1197 +1198 @raise BadAuthenticationType: if public-key authentication isn't +1199 allowed by the server for this user (and no event was passed in) +1200 @raise AuthenticationException: if the authentication failed (and no +1201 event was passed in) +1202 @raise SSHException: if there was a network error +1203 """ +1204 if (not self.active) or (not self.initial_kex_done): +1205 # we should never try to authenticate unless we're on a secure link +1206 raise SSHException('No existing session') +1207 if event is None: +1208 my_event = threading.Event() +1209 else: +1210 my_event = event +1211 self.auth_handler = AuthHandler(self) +1212 self.auth_handler.auth_publickey(username, key, my_event) +1213 if event is not None: +1214 # caller wants to wait for event themselves +1215 return [] +1216 return self.auth_handler.wait_for_response(my_event) +
1217 +
1218 - def auth_interactive(self, username, handler, submethods=''): +
1219 """ +1220 Authenticate to the server interactively. A handler is used to answer +1221 arbitrary questions from the server. On many servers, this is just a +1222 dumb wrapper around PAM. +1223 +1224 This method will block until the authentication succeeds or fails, +1225 peroidically calling the handler asynchronously to get answers to +1226 authentication questions. The handler may be called more than once +1227 if the server continues to ask questions. +1228 +1229 The handler is expected to be a callable that will handle calls of the +1230 form: C{handler(title, instructions, prompt_list)}. The C{title} is +1231 meant to be a dialog-window title, and the C{instructions} are user +1232 instructions (both are strings). C{prompt_list} will be a list of +1233 prompts, each prompt being a tuple of C{(str, bool)}. The string is +1234 the prompt and the boolean indicates whether the user text should be +1235 echoed. +1236 +1237 A sample call would thus be: +1238 C{handler('title', 'instructions', [('Password:', False)])}. +1239 +1240 The handler should return a list or tuple of answers to the server's +1241 questions. +1242 +1243 If the server requires multi-step authentication (which is very rare), +1244 this method will return a list of auth types permissible for the next +1245 step. Otherwise, in the normal case, an empty list is returned. +1246 +1247 @param username: the username to authenticate as +1248 @type username: string +1249 @param handler: a handler for responding to server questions +1250 @type handler: callable +1251 @param submethods: a string list of desired submethods (optional) +1252 @type submethods: str +1253 @return: list of auth types permissible for the next stage of +1254 authentication (normally empty). +1255 @rtype: list +1256 +1257 @raise BadAuthenticationType: if public-key authentication isn't +1258 allowed by the server for this user +1259 @raise AuthenticationException: if the authentication failed +1260 @raise SSHException: if there was a network error +1261 +1262 @since: 1.5 +1263 """ +1264 if (not self.active) or (not self.initial_kex_done): +1265 # we should never try to authenticate unless we're on a secure link +1266 raise SSHException('No existing session') +1267 my_event = threading.Event() +1268 self.auth_handler = AuthHandler(self) +1269 self.auth_handler.auth_interactive(username, handler, my_event, submethods) +1270 return self.auth_handler.wait_for_response(my_event) +
1271 +
1272 - def set_log_channel(self, name): +
1273 """ +1274 Set the channel for this transport's logging. The default is +1275 C{"paramiko.transport"} but it can be set to anything you want. +1276 (See the C{logging} module for more info.) SSH Channels will log +1277 to a sub-channel of the one specified. +1278 +1279 @param name: new channel name for logging +1280 @type name: str +1281 +1282 @since: 1.1 +1283 """ +1284 self.log_name = name +1285 self.logger = util.get_logger(name) +1286 self.packetizer.set_log(self.logger) +
1287 +
1288 - def get_log_channel(self): +
1289 """ +1290 Return the channel name used for this transport's logging. +1291 +1292 @return: channel name. +1293 @rtype: str +1294 +1295 @since: 1.2 +1296 """ +1297 return self.log_name +
1298 +
1299 - def set_hexdump(self, hexdump): +
1300 """ +1301 Turn on/off logging a hex dump of protocol traffic at DEBUG level in +1302 the logs. Normally you would want this off (which is the default), +1303 but if you are debugging something, it may be useful. +1304 +1305 @param hexdump: C{True} to log protocol traffix (in hex) to the log; +1306 C{False} otherwise. +1307 @type hexdump: bool +1308 """ +1309 self.packetizer.set_hexdump(hexdump) +
1310 +
1311 - def get_hexdump(self): +
1312 """ +1313 Return C{True} if the transport is currently logging hex dumps of +1314 protocol traffic. +1315 +1316 @return: C{True} if hex dumps are being logged +1317 @rtype: bool +1318 +1319 @since: 1.4 +1320 """ +1321 return self.packetizer.get_hexdump() +
1322 +
1323 - def use_compression(self, compress=True): +
1324 """ +1325 Turn on/off compression. This will only have an affect before starting +1326 the transport (ie before calling L{connect}, etc). By default, +1327 compression is off since it negatively affects interactive sessions. +1328 +1329 @param compress: C{True} to ask the remote client/server to compress +1330 traffic; C{False} to refuse compression +1331 @type compress: bool +1332 +1333 @since: 1.5.2 +1334 """ +1335 if compress: +1336 self._preferred_compression = ( 'zlib@openssh.com', 'zlib', 'none' ) +1337 else: +1338 self._preferred_compression = ( 'none', ) +
1339 +
1340 - def getpeername(self): +
1341 """ +1342 Return the address of the remote side of this Transport, if possible. +1343 This is effectively a wrapper around C{'getpeername'} on the underlying +1344 socket. If the socket-like object has no C{'getpeername'} method, +1345 then C{("unknown", 0)} is returned. +1346 +1347 @return: the address if the remote host, if known +1348 @rtype: tuple(str, int) +1349 """ +1350 gp = getattr(self.sock, 'getpeername', None) +1351 if gp is None: +1352 return ('unknown', 0) +1353 return gp() +
1354 +
1355 - def stop_thread(self): +
1356 self.active = False +1357 self.packetizer.close() +
1358 +1359 +1360 ### internals... +1361 +1362 +
1363 - def _log(self, level, msg, *args): +
1364 if issubclass(type(msg), list): +1365 for m in msg: +1366 self.logger.log(level, m) +1367 else: +1368 self.logger.log(level, msg, *args) +
1369 +
1370 - def _get_modulus_pack(self): +
1371 "used by KexGex to find primes for group exchange" +1372 return self._modulus_pack +
1373 +
1374 - def _next_channel(self): +
1375 "you are holding the lock" +1376 chanid = self._channel_counter +1377 while self._channels.get(chanid) is not None: +1378 self._channel_counter = (self._channel_counter + 1) & 0xffffff +1379 chanid = self._channel_counter +1380 self._channel_counter = (self._channel_counter + 1) & 0xffffff +1381 return chanid +
1382 +1386 +
1387 - def _send_message(self, data): +
1388 self.packetizer.send_message(data) +
1389 +
1390 - def _send_user_message(self, data): +
1391 """ +1392 send a message, but block if we're in key negotiation. this is used +1393 for user-initiated requests. +1394 """ +1395 while True: +1396 self.clear_to_send.wait(0.1) +1397 if not self.active: +1398 self._log(DEBUG, 'Dropping user packet because connection is dead.') +1399 return +1400 self.clear_to_send_lock.acquire() +1401 if self.clear_to_send.isSet(): +1402 break +1403 self.clear_to_send_lock.release() +1404 try: +1405 self._send_message(data) +1406 finally: +1407 self.clear_to_send_lock.release() +
1408 +
1409 - def _set_K_H(self, k, h): +
1410 "used by a kex object to set the K (root key) and H (exchange hash)" +1411 self.K = k +1412 self.H = h +1413 if self.session_id == None: +1414 self.session_id = h +
1415 +
1416 - def _expect_packet(self, *ptypes): +
1417 "used by a kex object to register the next packet type it expects to see" +1418 self._expected_packet = tuple(ptypes) +
1419 +
1420 - def _verify_key(self, host_key, sig): +
1421 key = self._key_info[self.host_key_type](Message(host_key)) +1422 if key is None: +1423 raise SSHException('Unknown host key type') +1424 if not key.verify_ssh_sig(self.H, Message(sig)): +1425 raise SSHException('Signature verification (%s) failed. Boo. Robey should debug this.' % self.host_key_type) +1426 self.host_key = key +
1427 +
1428 - def _compute_key(self, id, nbytes): +
1429 "id is 'A' - 'F' for the various keys used by ssh" +1430 m = Message() +1431 m.add_mpint(self.K) +1432 m.add_bytes(self.H) +1433 m.add_byte(id) +1434 m.add_bytes(self.session_id) +1435 out = sofar = SHA.new(str(m)).digest() +1436 while len(out) < nbytes: +1437 m = Message() +1438 m.add_mpint(self.K) +1439 m.add_bytes(self.H) +1440 m.add_bytes(sofar) +1441 digest = SHA.new(str(m)).digest() +1442 out += digest +1443 sofar += digest +1444 return out[:nbytes] +
1445 +
1446 - def _get_cipher(self, name, key, iv): +
1447 if name not in self._cipher_info: +1448 raise SSHException('Unknown client cipher ' + name) +1449 return self._cipher_info[name]['class'].new(key, self._cipher_info[name]['mode'], iv) +
1450 +
1451 - def _set_x11_handler(self, handler): +
1452 # only called if a channel has turned on x11 forwarding +1453 if handler is None: +1454 # by default, use the same mechanism as accept() +1455 def default_handler(channel, (src_addr, src_port)): +1456 self._queue_incoming_channel(channel) +
1457 self._x11_handler = default_handler +1458 else: +1459 self._x11_handler = handler +1460 +
1461 - def _queue_incoming_channel(self, channel): +
1462 self.lock.acquire() +1463 try: +1464 self.server_accepts.append(channel) +1465 self.server_accept_cv.notify() +1466 finally: +1467 self.lock.release() +
1468 +
1469 - def run(self): +
1470 # (use the exposed "run" method, because if we specify a thread target +1471 # of a private method, threading.Thread will keep a reference to it +1472 # indefinitely, creating a GC cycle and not letting Transport ever be +1473 # GC'd. it's a bug in Thread.) +1474 +1475 # active=True occurs before the thread is launched, to avoid a race +1476 _active_threads.append(self) +1477 if self.server_mode: +1478 self._log(DEBUG, 'starting thread (server mode): %s' % hex(long(id(self)) & 0xffffffffL)) +1479 else: +1480 self._log(DEBUG, 'starting thread (client mode): %s' % hex(long(id(self)) & 0xffffffffL)) +1481 try: +1482 self.packetizer.write_all(self.local_version + '\r\n') +1483 self._check_banner() +1484 self._send_kex_init() +1485 self._expect_packet(MSG_KEXINIT) +1486 +1487 while self.active: +1488 if self.packetizer.need_rekey() and not self.in_kex: +1489 self._send_kex_init() +1490 try: +1491 ptype, m = self.packetizer.read_message() +1492 except NeedRekeyException: +1493 continue +1494 if ptype == MSG_IGNORE: +1495 continue +1496 elif ptype == MSG_DISCONNECT: +1497 self._parse_disconnect(m) +1498 self.active = False +1499 self.packetizer.close() +1500 break +1501 elif ptype == MSG_DEBUG: +1502 self._parse_debug(m) +1503 continue +1504 if len(self._expected_packet) > 0: +1505 if ptype not in self._expected_packet: +1506 raise SSHException('Expecting packet from %r, got %d' % (self._expected_packet, ptype)) +1507 self._expected_packet = tuple() +1508 if (ptype >= 30) and (ptype <= 39): +1509 self.kex_engine.parse_next(ptype, m) +1510 continue +1511 +1512 if ptype in self._handler_table: +1513 self._handler_table[ptype](self, m) +1514 elif ptype in self._channel_handler_table: +1515 chanid = m.get_int() +1516 chan = self._channels.get(chanid) +1517 if chan is not None: +1518 self._channel_handler_table[ptype](chan, m) +1519 elif chanid in self.channels_seen: +1520 self._log(DEBUG, 'Ignoring message for dead channel %d' % chanid) +1521 else: +1522 self._log(ERROR, 'Channel request for unknown channel %d' % chanid) +1523 self.active = False +1524 self.packetizer.close() +1525 elif (self.auth_handler is not None) and (ptype in self.auth_handler._handler_table): +1526 self.auth_handler._handler_table[ptype](self.auth_handler, m) +1527 else: +1528 self._log(WARNING, 'Oops, unhandled type %d' % ptype) +1529 msg = Message() +1530 msg.add_byte(chr(MSG_UNIMPLEMENTED)) +1531 msg.add_int(m.seqno) +1532 self._send_message(msg) +1533 except SSHException, e: +1534 self._log(ERROR, 'Exception: ' + str(e)) +1535 self._log(ERROR, util.tb_strings()) +1536 self.saved_exception = e +1537 except EOFError, e: +1538 self._log(DEBUG, 'EOF in transport thread') +1539 #self._log(DEBUG, util.tb_strings()) +1540 self.saved_exception = e +1541 except socket.error, e: +1542 if type(e.args) is tuple: +1543 emsg = '%s (%d)' % (e.args[1], e.args[0]) +1544 else: +1545 emsg = e.args +1546 self._log(ERROR, 'Socket exception: ' + emsg) +1547 self.saved_exception = e +1548 except Exception, e: +1549 self._log(ERROR, 'Unknown exception: ' + str(e)) +1550 self._log(ERROR, util.tb_strings()) +1551 self.saved_exception = e +1552 _active_threads.remove(self) +1553 for chan in self._channels.values(): +1554 chan._unlink() +1555 if self.active: +1556 self.active = False +1557 self.packetizer.close() +1558 if self.completion_event != None: +1559 self.completion_event.set() +1560 if self.auth_handler is not None: +1561 self.auth_handler.abort() +1562 for event in self.channel_events.values(): +1563 event.set() +1564 try: +1565 self.lock.acquire() +1566 self.server_accept_cv.notify() +1567 finally: +1568 self.lock.release() +1569 self.sock.close() +
1570 +1571 +1572 ### protocol stages +1573 +1574 +
1575 - def _negotiate_keys(self, m): +
1576 # throws SSHException on anything unusual +1577 self.clear_to_send_lock.acquire() +1578 try: +1579 self.clear_to_send.clear() +1580 finally: +1581 self.clear_to_send_lock.release() +1582 if self.local_kex_init == None: +1583 # remote side wants to renegotiate +1584 self._send_kex_init() +1585 self._parse_kex_init(m) +1586 self.kex_engine.start_kex() +
1587 +
1588 - def _check_banner(self): +
1589 # this is slow, but we only have to do it once +1590 for i in range(5): +1591 # give them 15 seconds for the first line, then just 2 seconds +1592 # each additional line. (some sites have very high latency.) +1593 if i == 0: +1594 timeout = self.banner_timeout +1595 else: +1596 timeout = 2 +1597 try: +1598 buf = self.packetizer.readline(timeout) +1599 except Exception, x: +1600 raise SSHException('Error reading SSH protocol banner' + str(x)) +1601 if buf[:4] == 'SSH-': +1602 break +1603 self._log(DEBUG, 'Banner: ' + buf) +1604 if buf[:4] != 'SSH-': +1605 raise SSHException('Indecipherable protocol version "' + buf + '"') +1606 # save this server version string for later +1607 self.remote_version = buf +1608 # pull off any attached comment +1609 comment = '' +1610 i = string.find(buf, ' ') +1611 if i >= 0: +1612 comment = buf[i+1:] +1613 buf = buf[:i] +1614 # parse out version string and make sure it matches +1615 segs = buf.split('-', 2) +1616 if len(segs) < 3: +1617 raise SSHException('Invalid SSH banner') +1618 version = segs[1] +1619 client = segs[2] +1620 if version != '1.99' and version != '2.0': +1621 raise SSHException('Incompatible version (%s instead of 2.0)' % (version,)) +1622 self._log(INFO, 'Connected (version %s, client %s)' % (version, client)) +
1623 +
1624 - def _send_kex_init(self): +
1625 """ +1626 announce to the other side that we'd like to negotiate keys, and what +1627 kind of key negotiation we support. +1628 """ +1629 self.clear_to_send_lock.acquire() +1630 try: +1631 self.clear_to_send.clear() +1632 finally: +1633 self.clear_to_send_lock.release() +1634 self.in_kex = True +1635 if self.server_mode: +1636 if (self._modulus_pack is None) and ('diffie-hellman-group-exchange-sha1' in self._preferred_kex): +1637 # can't do group-exchange if we don't have a pack of potential primes +1638 pkex = list(self.get_security_options().kex) +1639 pkex.remove('diffie-hellman-group-exchange-sha1') +1640 self.get_security_options().kex = pkex +1641 available_server_keys = filter(self.server_key_dict.keys().__contains__, +1642 self._preferred_keys) +1643 else: +1644 available_server_keys = self._preferred_keys +1645 +1646 randpool.stir() +1647 m = Message() +1648 m.add_byte(chr(MSG_KEXINIT)) +1649 m.add_bytes(randpool.get_bytes(16)) +1650 m.add_list(self._preferred_kex) +1651 m.add_list(available_server_keys) +1652 m.add_list(self._preferred_ciphers) +1653 m.add_list(self._preferred_ciphers) +1654 m.add_list(self._preferred_macs) +1655 m.add_list(self._preferred_macs) +1656 m.add_list(self._preferred_compression) +1657 m.add_list(self._preferred_compression) +1658 m.add_string('') +1659 m.add_string('') +1660 m.add_boolean(False) +1661 m.add_int(0) +1662 # save a copy for later (needed to compute a hash) +1663 self.local_kex_init = str(m) +1664 self._send_message(m) +
1665 +
1666 - def _parse_kex_init(self, m): +
1667 cookie = m.get_bytes(16) +1668 kex_algo_list = m.get_list() +1669 server_key_algo_list = m.get_list() +1670 client_encrypt_algo_list = m.get_list() +1671 server_encrypt_algo_list = m.get_list() +1672 client_mac_algo_list = m.get_list() +1673 server_mac_algo_list = m.get_list() +1674 client_compress_algo_list = m.get_list() +1675 server_compress_algo_list = m.get_list() +1676 client_lang_list = m.get_list() +1677 server_lang_list = m.get_list() +1678 kex_follows = m.get_boolean() +1679 unused = m.get_int() +1680 +1681 self._log(DEBUG, 'kex algos:' + str(kex_algo_list) + ' server key:' + str(server_key_algo_list) + \ +1682 ' client encrypt:' + str(client_encrypt_algo_list) + \ +1683 ' server encrypt:' + str(server_encrypt_algo_list) + \ +1684 ' client mac:' + str(client_mac_algo_list) + \ +1685 ' server mac:' + str(server_mac_algo_list) + \ +1686 ' client compress:' + str(client_compress_algo_list) + \ +1687 ' server compress:' + str(server_compress_algo_list) + \ +1688 ' client lang:' + str(client_lang_list) + \ +1689 ' server lang:' + str(server_lang_list) + \ +1690 ' kex follows?' + str(kex_follows)) +1691 +1692 # as a server, we pick the first item in the client's list that we support. +1693 # as a client, we pick the first item in our list that the server supports. +1694 if self.server_mode: +1695 agreed_kex = filter(self._preferred_kex.__contains__, kex_algo_list) +1696 else: +1697 agreed_kex = filter(kex_algo_list.__contains__, self._preferred_kex) +1698 if len(agreed_kex) == 0: +1699 raise SSHException('Incompatible ssh peer (no acceptable kex algorithm)') +1700 self.kex_engine = self._kex_info[agreed_kex[0]](self) +1701 +1702 if self.server_mode: +1703 available_server_keys = filter(self.server_key_dict.keys().__contains__, +1704 self._preferred_keys) +1705 agreed_keys = filter(available_server_keys.__contains__, server_key_algo_list) +1706 else: +1707 agreed_keys = filter(server_key_algo_list.__contains__, self._preferred_keys) +1708 if len(agreed_keys) == 0: +1709 raise SSHException('Incompatible ssh peer (no acceptable host key)') +1710 self.host_key_type = agreed_keys[0] +1711 if self.server_mode and (self.get_server_key() is None): +1712 raise SSHException('Incompatible ssh peer (can\'t match requested host key type)') +1713 +1714 if self.server_mode: +1715 agreed_local_ciphers = filter(self._preferred_ciphers.__contains__, +1716 server_encrypt_algo_list) +1717 agreed_remote_ciphers = filter(self._preferred_ciphers.__contains__, +1718 client_encrypt_algo_list) +1719 else: +1720 agreed_local_ciphers = filter(client_encrypt_algo_list.__contains__, +1721 self._preferred_ciphers) +1722 agreed_remote_ciphers = filter(server_encrypt_algo_list.__contains__, +1723 self._preferred_ciphers) +1724 if (len(agreed_local_ciphers) == 0) or (len(agreed_remote_ciphers) == 0): +1725 raise SSHException('Incompatible ssh server (no acceptable ciphers)') +1726 self.local_cipher = agreed_local_ciphers[0] +1727 self.remote_cipher = agreed_remote_ciphers[0] +1728 self._log(DEBUG, 'Ciphers agreed: local=%s, remote=%s' % (self.local_cipher, self.remote_cipher)) +1729 +1730 if self.server_mode: +1731 agreed_remote_macs = filter(self._preferred_macs.__contains__, client_mac_algo_list) +1732 agreed_local_macs = filter(self._preferred_macs.__contains__, server_mac_algo_list) +1733 else: +1734 agreed_local_macs = filter(client_mac_algo_list.__contains__, self._preferred_macs) +1735 agreed_remote_macs = filter(server_mac_algo_list.__contains__, self._preferred_macs) +1736 if (len(agreed_local_macs) == 0) or (len(agreed_remote_macs) == 0): +1737 raise SSHException('Incompatible ssh server (no acceptable macs)') +1738 self.local_mac = agreed_local_macs[0] +1739 self.remote_mac = agreed_remote_macs[0] +1740 +1741 if self.server_mode: +1742 agreed_remote_compression = filter(self._preferred_compression.__contains__, client_compress_algo_list) +1743 agreed_local_compression = filter(self._preferred_compression.__contains__, server_compress_algo_list) +1744 else: +1745 agreed_local_compression = filter(client_compress_algo_list.__contains__, self._preferred_compression) +1746 agreed_remote_compression = filter(server_compress_algo_list.__contains__, self._preferred_compression) +1747 if (len(agreed_local_compression) == 0) or (len(agreed_remote_compression) == 0): +1748 raise SSHException('Incompatible ssh server (no acceptable compression) %r %r %r' % (agreed_local_compression, agreed_remote_compression, self._preferred_compression)) +1749 self.local_compression = agreed_local_compression[0] +1750 self.remote_compression = agreed_remote_compression[0] +1751 +1752 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' % +1753 (agreed_kex[0], self.host_key_type, self.local_cipher, self.remote_cipher, self.local_mac, +1754 self.remote_mac, self.local_compression, self.remote_compression)) +1755 +1756 # save for computing hash later... +1757 # now wait! openssh has a bug (and others might too) where there are +1758 # actually some extra bytes (one NUL byte in openssh's case) added to +1759 # the end of the packet but not parsed. turns out we need to throw +1760 # away those bytes because they aren't part of the hash. +1761 self.remote_kex_init = chr(MSG_KEXINIT) + m.get_so_far() +
1762 +
1763 - def _activate_inbound(self): +
1764 "switch on newly negotiated encryption parameters for inbound traffic" +1765 block_size = self._cipher_info[self.remote_cipher]['block-size'] +1766 if self.server_mode: +1767 IV_in = self._compute_key('A', block_size) +1768 key_in = self._compute_key('C', self._cipher_info[self.remote_cipher]['key-size']) +1769 else: +1770 IV_in = self._compute_key('B', block_size) +1771 key_in = self._compute_key('D', self._cipher_info[self.remote_cipher]['key-size']) +1772 engine = self._get_cipher(self.remote_cipher, key_in, IV_in) +1773 mac_size = self._mac_info[self.remote_mac]['size'] +1774 mac_engine = self._mac_info[self.remote_mac]['class'] +1775 # initial mac keys are done in the hash's natural size (not the potentially truncated +1776 # transmission size) +1777 if self.server_mode: +1778 mac_key = self._compute_key('E', mac_engine.digest_size) +1779 else: +1780 mac_key = self._compute_key('F', mac_engine.digest_size) +1781 self.packetizer.set_inbound_cipher(engine, block_size, mac_engine, mac_size, mac_key) +1782 compress_in = self._compression_info[self.remote_compression][1] +1783 if (compress_in is not None) and ((self.remote_compression != 'zlib@openssh.com') or self.authenticated): +1784 self._log(DEBUG, 'Switching on inbound compression ...') +1785 self.packetizer.set_inbound_compressor(compress_in()) +
1786 +
1787 - def _activate_outbound(self): +
1788 "switch on newly negotiated encryption parameters for outbound traffic" +1789 m = Message() +1790 m.add_byte(chr(MSG_NEWKEYS)) +1791 self._send_message(m) +1792 block_size = self._cipher_info[self.local_cipher]['block-size'] +1793 if self.server_mode: +1794 IV_out = self._compute_key('B', block_size) +1795 key_out = self._compute_key('D', self._cipher_info[self.local_cipher]['key-size']) +1796 else: +1797 IV_out = self._compute_key('A', block_size) +1798 key_out = self._compute_key('C', self._cipher_info[self.local_cipher]['key-size']) +1799 engine = self._get_cipher(self.local_cipher, key_out, IV_out) +1800 mac_size = self._mac_info[self.local_mac]['size'] +1801 mac_engine = self._mac_info[self.local_mac]['class'] +1802 # initial mac keys are done in the hash's natural size (not the potentially truncated +1803 # transmission size) +1804 if self.server_mode: +1805 mac_key = self._compute_key('F', mac_engine.digest_size) +1806 else: +1807 mac_key = self._compute_key('E', mac_engine.digest_size) +1808 self.packetizer.set_outbound_cipher(engine, block_size, mac_engine, mac_size, mac_key) +1809 compress_out = self._compression_info[self.local_compression][0] +1810 if (compress_out is not None) and ((self.local_compression != 'zlib@openssh.com') or self.authenticated): +1811 self._log(DEBUG, 'Switching on outbound compression ...') +1812 self.packetizer.set_outbound_compressor(compress_out()) +1813 if not self.packetizer.need_rekey(): +1814 self.in_kex = False +1815 # we always expect to receive NEWKEYS now +1816 self._expect_packet(MSG_NEWKEYS) +
1817 +
1818 - def _auth_trigger(self): +
1819 self.authenticated = True +1820 # delayed initiation of compression +1821 if self.local_compression == 'zlib@openssh.com': +1822 compress_out = self._compression_info[self.local_compression][0] +1823 self._log(DEBUG, 'Switching on outbound compression ...') +1824 self.packetizer.set_outbound_compressor(compress_out()) +1825 if self.remote_compression == 'zlib@openssh.com': +1826 compress_in = self._compression_info[self.remote_compression][1] +1827 self._log(DEBUG, 'Switching on inbound compression ...') +1828 self.packetizer.set_inbound_compressor(compress_in()) +
1829 +
1830 - def _parse_newkeys(self, m): +
1831 self._log(DEBUG, 'Switch to new keys ...') +1832 self._activate_inbound() +1833 # can also free a bunch of stuff here +1834 self.local_kex_init = self.remote_kex_init = None +1835 self.K = None +1836 self.kex_engine = None +1837 if self.server_mode and (self.auth_handler is None): +1838 # create auth handler for server mode +1839 self.auth_handler = AuthHandler(self) +1840 if not self.initial_kex_done: +1841 # this was the first key exchange +1842 self.initial_kex_done = True +1843 # send an event? +1844 if self.completion_event != None: +1845 self.completion_event.set() +1846 # it's now okay to send data again (if this was a re-key) +1847 if not self.packetizer.need_rekey(): +1848 self.in_kex = False +1849 self.clear_to_send_lock.acquire() +1850 try: +1851 self.clear_to_send.set() +1852 finally: +1853 self.clear_to_send_lock.release() +1854 return +
1855 +
1856 - def _parse_disconnect(self, m): +
1857 code = m.get_int() +1858 desc = m.get_string() +1859 self._log(INFO, 'Disconnect (code %d): %s' % (code, desc)) +
1860 +
1861 - def _parse_global_request(self, m): +
1862 kind = m.get_string() +1863 self._log(DEBUG, 'Received global request "%s"' % kind) +1864 want_reply = m.get_boolean() +1865 if not self.server_mode: +1866 self._log(DEBUG, 'Rejecting "%s" global request from server.' % kind) +1867 ok = False +1868 elif kind == 'tcpip-forward': +1869 address = m.get_string() +1870 port = m.get_int() +1871 ok = self.server_object.check_port_forward_request(address, port) +1872 if ok != False: +1873 ok = (ok,) +1874 elif kind == 'cancel-tcpip-forward': +1875 address = m.get_string() +1876 port = m.get_int() +1877 self.server_object.cancel_port_forward_request(address, port) +1878 ok = True +1879 else: +1880 ok = self.server_object.check_global_request(kind, m) +1881 extra = () +1882 if type(ok) is tuple: +1883 extra = ok +1884 ok = True +1885 if want_reply: +1886 msg = Message() +1887 if ok: +1888 msg.add_byte(chr(MSG_REQUEST_SUCCESS)) +1889 msg.add(*extra) +1890 else: +1891 msg.add_byte(chr(MSG_REQUEST_FAILURE)) +1892 self._send_message(msg) +
1893 +
1894 - def _parse_request_success(self, m): +
1895 self._log(DEBUG, 'Global request successful.') +1896 self.global_response = m +1897 if self.completion_event is not None: +1898 self.completion_event.set() +
1899 +
1900 - def _parse_request_failure(self, m): +
1901 self._log(DEBUG, 'Global request denied.') +1902 self.global_response = None +1903 if self.completion_event is not None: +1904 self.completion_event.set() +
1905 +
1906 - def _parse_channel_open_success(self, m): +
1907 chanid = m.get_int() +1908 server_chanid = m.get_int() +1909 server_window_size = m.get_int() +1910 server_max_packet_size = m.get_int() +1911 chan = self._channels.get(chanid) +1912 if chan is None: +1913 self._log(WARNING, 'Success for unrequested channel! [??]') +1914 return +1915 self.lock.acquire() +1916 try: +1917 chan._set_remote_channel(server_chanid, server_window_size, server_max_packet_size) +1918 self._log(INFO, 'Secsh channel %d opened.' % chanid) +1919 if chanid in self.channel_events: +1920 self.channel_events[chanid].set() +1921 del self.channel_events[chanid] +1922 finally: +1923 self.lock.release() +1924 return +
1925 +
1926 - def _parse_channel_open_failure(self, m): +
1927 chanid = m.get_int() +1928 reason = m.get_int() +1929 reason_str = m.get_string() +1930 lang = m.get_string() +1931 reason_text = CONNECTION_FAILED_CODE.get(reason, '(unknown code)') +1932 self._log(INFO, 'Secsh channel %d open FAILED: %s: %s' % (chanid, reason_str, reason_text)) +1933 self.lock.acquire() +1934 try: +1935 self.saved_exception = ChannelException(reason, reason_text) +1936 if chanid in self.channel_events: +1937 self._channels.delete(chanid) +1938 if chanid in self.channel_events: +1939 self.channel_events[chanid].set() +1940 del self.channel_events[chanid] +1941 finally: +1942 self.lock.release() +1943 return +
1944 +
1945 - def _parse_channel_open(self, m): +
1946 kind = m.get_string() +1947 chanid = m.get_int() +1948 initial_window_size = m.get_int() +1949 max_packet_size = m.get_int() +1950 reject = False +1951 if (kind == 'x11') and (self._x11_handler is not None): +1952 origin_addr = m.get_string() +1953 origin_port = m.get_int() +1954 self._log(DEBUG, 'Incoming x11 connection from %s:%d' % (origin_addr, origin_port)) +1955 self.lock.acquire() +1956 try: +1957 my_chanid = self._next_channel() +1958 finally: +1959 self.lock.release() +1960 elif (kind == 'forwarded-tcpip') and (self._tcp_handler is not None): +1961 server_addr = m.get_string() +1962 server_port = m.get_int() +1963 origin_addr = m.get_string() +1964 origin_port = m.get_int() +1965 self._log(DEBUG, 'Incoming tcp forwarded connection from %s:%d' % (origin_addr, origin_port)) +1966 self.lock.acquire() +1967 try: +1968 my_chanid = self._next_channel() +1969 finally: +1970 self.lock.release() +1971 elif not self.server_mode: +1972 self._log(DEBUG, 'Rejecting "%s" channel request from server.' % kind) +1973 reject = True +1974 reason = OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED +1975 else: +1976 self.lock.acquire() +1977 try: +1978 my_chanid = self._next_channel() +1979 finally: +1980 self.lock.release() +1981 if kind == 'direct-tcpip': +1982 # handle direct-tcpip requests comming from the client +1983 dest_addr = m.get_string() +1984 dest_port = m.get_int() +1985 origin_addr = m.get_string() +1986 origin_port = m.get_int() +1987 reason = self.server_object.check_channel_direct_tcpip_request( +1988 my_chanid, (origin_addr, origin_port), +1989 (dest_addr, dest_port)) +1990 else: +1991 reason = self.server_object.check_channel_request(kind, my_chanid) +1992 if reason != OPEN_SUCCEEDED: +1993 self._log(DEBUG, 'Rejecting "%s" channel request from client.' % kind) +1994 reject = True +1995 if reject: +1996 msg = Message() +1997 msg.add_byte(chr(MSG_CHANNEL_OPEN_FAILURE)) +1998 msg.add_int(chanid) +1999 msg.add_int(reason) +2000 msg.add_string('') +2001 msg.add_string('en') +2002 self._send_message(msg) +2003 return +2004 +2005 chan = Channel(my_chanid) +2006 self.lock.acquire() +2007 try: +2008 self._channels.put(my_chanid, chan) +2009 self.channels_seen[my_chanid] = True +2010 chan._set_transport(self) +2011 chan._set_window(self.window_size, self.max_packet_size) +2012 chan._set_remote_channel(chanid, initial_window_size, max_packet_size) +2013 finally: +2014 self.lock.release() +2015 m = Message() +2016 m.add_byte(chr(MSG_CHANNEL_OPEN_SUCCESS)) +2017 m.add_int(chanid) +2018 m.add_int(my_chanid) +2019 m.add_int(self.window_size) +2020 m.add_int(self.max_packet_size) +2021 self._send_message(m) +2022 self._log(INFO, 'Secsh channel %d (%s) opened.', my_chanid, kind) +2023 if kind == 'x11': +2024 self._x11_handler(chan, (origin_addr, origin_port)) +2025 elif kind == 'forwarded-tcpip': +2026 chan.origin_addr = (origin_addr, origin_port) +2027 self._tcp_handler(chan, (origin_addr, origin_port), (server_addr, server_port)) +2028 else: +2029 self._queue_incoming_channel(chan) +
2030 +
2031 - def _parse_debug(self, m): +
2032 always_display = m.get_boolean() +2033 msg = m.get_string() +2034 lang = m.get_string() +2035 self._log(DEBUG, 'Debug msg: ' + util.safe_string(msg)) +
2036 +
2037 - def _get_subsystem_handler(self, name): +
2038 try: +2039 self.lock.acquire() +2040 if name not in self.subsystem_table: +2041 return (None, [], {}) +2042 return self.subsystem_table[name] +2043 finally: +2044 self.lock.release() +
2045 +2046 _handler_table = { +2047 MSG_NEWKEYS: _parse_newkeys, +2048 MSG_GLOBAL_REQUEST: _parse_global_request, +2049 MSG_REQUEST_SUCCESS: _parse_request_success, +2050 MSG_REQUEST_FAILURE: _parse_request_failure, +2051 MSG_CHANNEL_OPEN_SUCCESS: _parse_channel_open_success, +2052 MSG_CHANNEL_OPEN_FAILURE: _parse_channel_open_failure, +2053 MSG_CHANNEL_OPEN: _parse_channel_open, +2054 MSG_KEXINIT: _negotiate_keys, +2055 } +2056 +2057 _channel_handler_table = { +2058 MSG_CHANNEL_SUCCESS: Channel._request_success, +2059 MSG_CHANNEL_FAILURE: Channel._request_failed, +2060 MSG_CHANNEL_DATA: Channel._feed, +2061 MSG_CHANNEL_EXTENDED_DATA: Channel._feed_extended, +2062 MSG_CHANNEL_WINDOW_ADJUST: Channel._window_adjust, +2063 MSG_CHANNEL_REQUEST: Channel._handle_request, +2064 MSG_CHANNEL_EOF: Channel._handle_eof, +2065 MSG_CHANNEL_CLOSE: Channel._handle_close, +2066 } +2067 +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.transport.ChannelMap-class.html b/docs/paramiko.transport.ChannelMap-class.html new file mode 100644 index 0000000..c00478a --- /dev/null +++ b/docs/paramiko.transport.ChannelMap-class.html @@ -0,0 +1,286 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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 new file mode 100644 index 0000000..297ca6d --- /dev/null +++ b/docs/paramiko.util-module.html @@ -0,0 +1,950 @@ + + + + + paramiko.util + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module util + + + + + +
[frames] | no frames]
+
+ +

Module util

source code

+

Useful functions used by the rest of paramiko.

+ + + + + + + + + + + + + +
+ Classes
+   + + enumerate +
+   + + PFilter +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ 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 +
+   + + randpool = StrongLockingRandomPool() +
+ + + + + + +
+ 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 new file mode 100644 index 0000000..a7bdc07 --- /dev/null +++ b/docs/paramiko.util-pysrc.html @@ -0,0 +1,400 @@ + + + + + paramiko.util + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package paramiko :: + Module util + + + + + +
[frames] | no frames]
+
+

Source Code for Module paramiko.util

+
+  1  # Copyright (C) 2003-2007  Robey Pointer <robey@lag.net> 
+  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  from binascii import hexlify, unhexlify 
+ 26  import sys 
+ 27  import struct 
+ 28  import traceback 
+ 29  import threading 
+ 30   
+ 31  from paramiko.common import * 
+ 32  from paramiko.config import SSHConfig 
+ 33   
+ 34   
+ 35  # Change by RogerB - python < 2.3 doesn't have enumerate so we implement it 
+ 36  if sys.version_info < (2,3): 
+
37 - class enumerate: +
38 - def __init__ (self, sequence): +
39 self.sequence = sequence +
40 - def __iter__ (self): +
41 count = 0 + 42 for item in self.sequence: + 43 yield (count, item) + 44 count += 1 +
45 + 46 +
47 -def inflate_long(s, always_positive=False): +
48 "turns a normalized byte string into a long-int (adapted from Crypto.Util.number)" + 49 out = 0L + 50 negative = 0 + 51 if not always_positive and (len(s) > 0) and (ord(s[0]) >= 0x80): + 52 negative = 1 + 53 if len(s) % 4: + 54 filler = '\x00' + 55 if negative: + 56 filler = '\xff' + 57 s = filler * (4 - len(s) % 4) + s + 58 for i in range(0, len(s), 4): + 59 out = (out << 32) + struct.unpack('>I', s[i:i+4])[0] + 60 if negative: + 61 out -= (1L << (8 * len(s))) + 62 return out +
63 +
64 -def deflate_long(n, add_sign_padding=True): +
65 "turns a long-int into a normalized byte string (adapted from Crypto.Util.number)" + 66 # after much testing, this algorithm was deemed to be the fastest + 67 s = '' + 68 n = long(n) + 69 while (n != 0) and (n != -1): + 70 s = struct.pack('>I', n & 0xffffffffL) + s + 71 n = n >> 32 + 72 # strip off leading zeros, FFs + 73 for i in enumerate(s): + 74 if (n == 0) and (i[1] != '\000'): + 75 break + 76 if (n == -1) and (i[1] != '\xff'): + 77 break + 78 else: + 79 # degenerate case, n was either 0 or -1 + 80 i = (0,) + 81 if n == 0: + 82 s = '\000' + 83 else: + 84 s = '\xff' + 85 s = s[i[0]:] + 86 if add_sign_padding: + 87 if (n == 0) and (ord(s[0]) >= 0x80): + 88 s = '\x00' + s + 89 if (n == -1) and (ord(s[0]) < 0x80): + 90 s = '\xff' + s + 91 return s +
92 +
93 -def format_binary_weird(data): +
94 out = '' + 95 for i in enumerate(data): + 96 out += '%02X' % ord(i[1]) + 97 if i[0] % 2: + 98 out += ' ' + 99 if i[0] % 16 == 15: +100 out += '\n' +101 return out +
102 +
103 -def format_binary(data, prefix=''): +
104 x = 0 +105 out = [] +106 while len(data) > x + 16: +107 out.append(format_binary_line(data[x:x+16])) +108 x += 16 +109 if x < len(data): +110 out.append(format_binary_line(data[x:])) +111 return [prefix + x for x in out] +
112 +
113 -def format_binary_line(data): +
114 left = ' '.join(['%02X' % ord(c) for c in data]) +115 right = ''.join([('.%c..' % c)[(ord(c)+63)//95] for c in data]) +116 return '%-50s %s' % (left, right) +
117 +
118 -def hexify(s): +
119 return hexlify(s).upper() +
120 +
121 -def unhexify(s): +
122 return unhexlify(s) +
123 +
124 -def safe_string(s): +
125 out = '' +126 for c in s: +127 if (ord(c) >= 32) and (ord(c) <= 127): +128 out += c +129 else: +130 out += '%%%02X' % ord(c) +131 return out +
132 +133 # ''.join([['%%%02X' % ord(c), c][(ord(c) >= 32) and (ord(c) <= 127)] for c in s]) +134 +
135 -def bit_length(n): +
136 norm = deflate_long(n, 0) +137 hbyte = ord(norm[0]) +138 bitlen = len(norm) * 8 +139 while not (hbyte & 0x80): +140 hbyte <<= 1 +141 bitlen -= 1 +142 return bitlen +
143 +
144 -def tb_strings(): +
145 return ''.join(traceback.format_exception(*sys.exc_info())).split('\n') +
146 +
147 -def generate_key_bytes(hashclass, salt, key, nbytes): +
148 """ +149 Given a password, passphrase, or other human-source key, scramble it +150 through a secure hash into some keyworthy bytes. This specific algorithm +151 is used for encrypting/decrypting private key files. +152 +153 @param hashclass: class from L{Crypto.Hash} that can be used as a secure +154 hashing function (like C{MD5} or C{SHA}). +155 @type hashclass: L{Crypto.Hash} +156 @param salt: data to salt the hash with. +157 @type salt: string +158 @param key: human-entered password or passphrase. +159 @type key: string +160 @param nbytes: number of bytes to generate. +161 @type nbytes: int +162 @return: key data +163 @rtype: string +164 """ +165 keydata = '' +166 digest = '' +167 if len(salt) > 8: +168 salt = salt[:8] +169 while nbytes > 0: +170 hash_obj = hashclass.new() +171 if len(digest) > 0: +172 hash_obj.update(digest) +173 hash_obj.update(key) +174 hash_obj.update(salt) +175 digest = hash_obj.digest() +176 size = min(nbytes, len(digest)) +177 keydata += digest[:size] +178 nbytes -= size +179 return keydata +
180 +
181 -def load_host_keys(filename): +
182 """ +183 Read a file of known SSH host keys, in the format used by openssh, and +184 return a compound dict of C{hostname -> keytype ->} L{PKey <paramiko.pkey.PKey>}. +185 The hostname may be an IP address or DNS name. The keytype will be either +186 C{"ssh-rsa"} or C{"ssh-dss"}. +187 +188 This type of file unfortunately doesn't exist on Windows, but on posix, +189 it will usually be stored in C{os.path.expanduser("~/.ssh/known_hosts")}. +190 +191 Since 1.5.3, this is just a wrapper around L{HostKeys}. +192 +193 @param filename: name of the file to read host keys from +194 @type filename: str +195 @return: dict of host keys, indexed by hostname and then keytype +196 @rtype: dict(hostname, dict(keytype, L{PKey <paramiko.pkey.PKey>})) +197 """ +198 from paramiko.hostkeys import HostKeys +199 return HostKeys(filename) +
200 +
201 -def parse_ssh_config(file_obj): +
202 """ +203 Provided only as a backward-compatible wrapper around L{SSHConfig}. +204 """ +205 config = SSHConfig() +206 config.parse(file_obj) +207 return config +
208 +
209 -def lookup_ssh_host_config(hostname, config): +
210 """ +211 Provided only as a backward-compatible wrapper around L{SSHConfig}. +212 """ +213 return config.lookup(hostname) +
214 +
215 -def mod_inverse(x, m): +
216 # it's crazy how small python can make this function. +217 u1, u2, u3 = 1, 0, m +218 v1, v2, v3 = 0, 1, x +219 +220 while v3 > 0: +221 q = u3 // v3 +222 u1, v1 = v1, u1 - v1 * q +223 u2, v2 = v2, u2 - v2 * q +224 u3, v3 = v3, u3 - v3 * q +225 if u2 < 0: +226 u2 += m +227 return u2 +
228 +229 _g_thread_ids = {} +230 _g_thread_counter = 0 +231 _g_thread_lock = threading.Lock() +
232 -def get_thread_id(): +
233 global _g_thread_ids, _g_thread_counter, _g_thread_lock +234 tid = id(threading.currentThread()) +235 try: +236 return _g_thread_ids[tid] +237 except KeyError: +238 _g_thread_lock.acquire() +239 try: +240 _g_thread_counter += 1 +241 ret = _g_thread_ids[tid] = _g_thread_counter +242 finally: +243 _g_thread_lock.release() +244 return ret +
245 +
246 -def log_to_file(filename, level=DEBUG): +
247 "send paramiko logs to a logfile, if they're not already going somewhere" +248 l = logging.getLogger("paramiko") +249 if len(l.handlers) > 0: +250 return +251 l.setLevel(level) +252 f = open(filename, 'w') +253 lh = logging.StreamHandler(f) +254 lh.setFormatter(logging.Formatter('%(levelname)-.3s [%(asctime)s.%(msecs)03d] thr=%(_threadid)-3d %(name)s: %(message)s', +255 '%Y%m%d-%H:%M:%S')) +256 l.addHandler(lh) +
257 +258 # make only one filter object, so it doesn't get applied more than once +
259 -class PFilter (object): +
260 - def filter(self, record): +
261 record._threadid = get_thread_id() +262 return True +
263 _pfilter = PFilter() +264 +
265 -def get_logger(name): +
266 l = logging.getLogger(name) +267 l.addFilter(_pfilter) +268 return l +
269 +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.util.PFilter-class.html b/docs/paramiko.util.PFilter-class.html new file mode 100644 index 0000000..c68bd23 --- /dev/null +++ b/docs/paramiko.util.PFilter-class.html @@ -0,0 +1,168 @@ + + + + + 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__, + __getattribute__, + __hash__, + __init__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ Properties
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/paramiko.util.enumerate-class.html b/docs/paramiko.util.enumerate-class.html new file mode 100644 index 0000000..9553b31 --- /dev/null +++ b/docs/paramiko.util.enumerate-class.html @@ -0,0 +1,145 @@ + + + + + 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 new file mode 100644 index 0000000..cc3bbf0 --- /dev/null +++ b/docs/paramiko.win_pageant-module.html @@ -0,0 +1,197 @@ + + + + + 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 +
+ + + + + + +
+ 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 new file mode 100644 index 0000000..6b062ee --- /dev/null +++ b/docs/paramiko.win_pageant-pysrc.html @@ -0,0 +1,288 @@ + + + + + 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 new file mode 100644 index 0000000..40eb0af --- /dev/null +++ b/docs/paramiko.win_pageant.PageantConnection-class.html @@ -0,0 +1,257 @@ + + + + + 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__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ 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/private/__builtin__.object-class.html b/docs/private/__builtin__.object-class.html deleted file mode 100644 index 1ac54de..0000000 --- a/docs/private/__builtin__.object-class.html +++ /dev/null @@ -1,286 +0,0 @@ - - - - - __builtin__.object - - - - - - - - - - - - - - - - - - -
- - Module __builtin__ :: - Class object -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type object

- -
Known Subclasses:
-
- BufferedFile, - Channel, - InteractiveQuery, - Message, - PFilter, - SecurityOptions, - SFTPAttributes, - SFTPHandle, - type, - _Verbose, - AuthHandler, - BaseSFTP, - BER, - Formatter, - KexGex, - KexGroup1, - logger, - ModulusPack, - Packetizer, - PKey, - PosixPipe, - ServerInterface, - SFTPServerInterface, - StreamHandler, - WindowsPipe, - ZlibCompressor, - ZlibDecompressor
- -
- -The most base type -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(...) -
-x.__init__(...) initializes x; see x.__class__.__doc__ for -signature
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - -
Class Variable Summary
type__class__ = __builtin__.type

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

__init__(...) -
(Constructor) -

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

__delattr__(...) -

- x.__delattr__('name') <==> del x.name -
-
-
- - -
-

__getattribute__(...) -

- x.__getattribute__('name') <==> x.name -
-
-
- - -
-

__hash__(x) -
(Hashing function) -

- x.__hash__() <==> hash(x) -
-
Returns:
-
-
-hash(x)
-
-
-
-
-
- - -
-

__new__(T, - S, - ...) -

- T.__new__(S, ...) -> a new object with type S, a subtype of T -
-
Returns:
-
-
-a new object with type S, a subtype of T
-
-
-
-
-
- - -
-

__reduce__(...) -

- helper for pickle -
-
-
- - -
-

__reduce_ex__(...) -

- helper for pickle -
-
-
- - -
-

__repr__(x) -
(Representation operator) -

- x.__repr__() <==> repr(x) -
-
Returns:
-
-
-repr(x)
-
-
-
-
-
- - -
-

__setattr__(...) -

- x.__setattr__('name', value) <==> x.name = value -
-
-
- - -
-

__str__(x) -
(Informal representation operator) -

- x.__str__() <==> str(x) -
-
Returns:
-
-
-str(x)
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:46 2005http://epydoc.sf.net
- - diff --git a/docs/private/__builtin__.type-class.html b/docs/private/__builtin__.type-class.html deleted file mode 100644 index 0f1957a..0000000 --- a/docs/private/__builtin__.type-class.html +++ /dev/null @@ -1,504 +0,0 @@ - - - - - __builtin__.type - - - - - - - - - - - - - - - - - - -
- - Module __builtin__ :: - Class type -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type type

- -
-object --+
-         |
-        type
-

- -
- -type(object) -> the object's type type(name, bases, dict) -> a -new type -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __call__(x, - ...) -
-x.__call__(...) <==> x(...)
 __cmp__(x, - y) -
-x.__cmp__(y) <==> cmp(x,y)
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
list of immediate subclasses__subclasses__() -
-__subclasses__() -> list of immediate subclasses
listmro() -
-return a type's method resolution order
    Inherited from object
 __init__(...) -
-x.__init__(...) initializes x; see x.__class__.__doc__ for -signature
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - - - - - - - - - - - - - -
Class Variable Summary
type__base__ = __builtin__.object
tuple__bases__ = (<type 'object'>,) -
int__basicsize__ = 420                                                                   
int__dictoffset__ = 132                                                                   
int__flags__ = 21995                                                                 
int__itemsize__ = 20                                                                    
tuple__mro__ = (<type 'type'>, <type 'object'>) -
str__name__ = 'type' -
int__weakrefoffset__ = 184                                                                   

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

__call__(x, - ...) -
(Call operator) -

- x.__call__(...) <==> x(...) -
-
Returns:
-
-
-x(...)
-
-
-
-
-
- - -
-

__cmp__(x, - y) -
(Comparison operator) -

- x.__cmp__(y) <==> cmp(x,y) -
-
Returns:
-
-
-cmp(x,y)
-
-
-
-
-
- - -
-

__delattr__(...) -

- x.__delattr__('name') <==> del x.name -
-
Overrides:
-
__builtin__.object.__delattr__
-
-
-
- - -
-

__getattribute__(...) -

- x.__getattribute__('name') <==> x.name -
-
Overrides:
-
__builtin__.object.__getattribute__
-
-
-
- - -
-

__hash__(x) -
(Hashing function) -

- x.__hash__() <==> hash(x) -
-
Returns:
-
-
-hash(x)
-
-
-
-
Overrides:
-
__builtin__.object.__hash__
-
-
-
- - -
-

__new__(T, - S, - ...) -

- T.__new__(S, ...) -> a new object with type S, a subtype of T -
-
Returns:
-
-
-a new object with type S, a subtype of T
-
-
-
-
Overrides:
-
__builtin__.object.__new__
-
-
-
- - -
-

__repr__(x) -
(Representation operator) -

- x.__repr__() <==> repr(x) -
-
Returns:
-
-
-repr(x)
-
-
-
-
Overrides:
-
__builtin__.object.__repr__
-
-
-
- - -
-

__setattr__(...) -

- x.__setattr__('name', value) <==> x.name = value -
-
Overrides:
-
__builtin__.object.__setattr__
-
-
-
- - -
-

__subclasses__() -

- __subclasses__() -> list of immediate subclasses -
-
Returns:
-
-list of immediate subclasses
-
-
-
- - -
-

mro() -

- return a type's method resolution order -
-
Returns:
-
-list
-
-
-
-
- - - - - - -
Class Variable Details
-
- -

__bases__

-
-
-
-
-
Type:
-
- tuple - -
-
Value:
-
-
-(<type 'object'>,)                                                     
-
-
-
-
-
- -

__basicsize__

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-420                                                                   
-
-
-
-
-
- -

__dictoffset__

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-132                                                                   
-
-
-
-
-
- -

__flags__

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-21995                                                                 
-
-
-
-
-
- -

__itemsize__

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-20                                                                    
-
-
-
-
-
- -

__mro__

-
-
-
-
-
Type:
-
- tuple - -
-
Value:
-
-
-(<type 'type'>, <type 'object'>)                                       
-
-
-
-
-
- -

__name__

-
-
-
-
-
Type:
-
- str - -
-
Value:
-
-
-'type'                                                                 
-
-
-
-
-
- -

__weakrefoffset__

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-184                                                                   
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/epydoc.css b/docs/private/epydoc.css deleted file mode 100644 index 46080bd..0000000 --- a/docs/private/epydoc.css +++ /dev/null @@ -1,100 +0,0 @@ - -/* Body color */ -body { background: #ffffff; color: #000000; } - -/* Tables */ -table.summary, table.details, table.index - { background: #e8f0f8; color: #000000; } -tr.summary, tr.details, tr.index - { background: #70b0f0; color: #000000; - text-align: left; font-size: 120%; } -tr.group { background: #c0e0f8; color: #000000; - text-align: left; font-size: 120%; - font-style: italic; } - -/* Documentation page titles */ -h2.module { margin-top: 0.2em; } -h2.class { margin-top: 0.2em; } - -/* Headings */ -h1.heading { font-size: +140%; font-style: italic; - font-weight: bold; } -h2.heading { font-size: +125%; font-style: italic; - font-weight: bold; } -h3.heading { font-size: +110%; font-style: italic; - font-weight: normal; } - -/* Base tree */ -pre.base-tree { font-size: 80%; margin: 0; } - -/* Details Sections */ -table.func-details { background: #e8f0f8; color: #000000; - border: 2px groove #c0d0d0; - padding: 0 1em 0 1em; margin: 0.4em 0 0 0; } -h3.func-detail { background: transparent; color: #000000; - margin: 0 0 1em 0; } - -table.var-details { background: #e8f0f8; color: #000000; - border: 2px groove #c0d0d0; - padding: 0 1em 0 1em; margin: 0.4em 0 0 0; } -h3.var-details { background: transparent; color: #000000; - margin: 0 0 1em 0; } - -/* Function signatures */ -.sig { background: transparent; color: #000000; - font-weight: bold; } -.sig-name { background: transparent; color: #006080; } -.sig-arg, .sig-kwarg, .sig-vararg - { background: transparent; color: #008060; } -.sig-default { background: transparent; color: #602000; } -.summary-sig { background: transparent; color: #000000; } -.summary-sig-name { background: transparent; color: #204080; } -.summary-sig-arg, .summary-sig-kwarg, .summary-sig-vararg - { background: transparent; color: #008060; } - -/* Doctest blocks */ -.py-src { background: transparent; color: #000000; } -.py-prompt { background: transparent; color: #005050; - font-weight: bold;} -.py-string { background: transparent; color: #006030; } -.py-comment { background: transparent; color: #003060; } -.py-keyword { background: transparent; color: #600000; } -.py-output { background: transparent; color: #404040; } -pre.doctestblock { background: #f4faff; color: #000000; - padding: .5em; margin: 1em; - border: 1px solid #708890; } -table pre.doctestblock - { background: #dce4ec; color: #000000; - padding: .5em; margin: 1em; - border: 1px solid #708890; } - -/* Variable values */ -pre.variable { background: #dce4ec; color: #000000; - padding: .5em; margin: 0; - border: 1px solid #708890; } -.variable-linewrap { background: transparent; color: #604000; } -.variable-ellipsis { background: transparent; color: #604000; } -.variable-quote { background: transparent; color: #604000; } -.re { background: transparent; color: #000000; } -.re-char { background: transparent; color: #006030; } -.re-op { background: transparent; color: #600000; } -.re-group { background: transparent; color: #003060; } -.re-ref { background: transparent; color: #404040; } - -/* Navigation bar */ -table.navbar { background: #a0c0ff; color: #0000ff; - border: 2px groove #c0d0d0; } -th.navbar { background: #a0c0ff; color: #0000ff; } -th.navselect { background: #70b0ff; color: #000000; } -.nomargin { margin: 0; } - -/* Links */ -a:link { background: transparent; color: #0000ff; } -a:visited { background: transparent; color: #204080; } -a.navbar:link { background: transparent; color: #0000ff; - text-decoration: none; } -a.navbar:visited { background: transparent; color: #204080; - text-decoration: none; } - -/* Lists */ -ul { margin-top: 0; } diff --git a/docs/private/exceptions.Exception-class.html b/docs/private/exceptions.Exception-class.html deleted file mode 100644 index 4b99d99..0000000 --- a/docs/private/exceptions.Exception-class.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - exceptions.Exception - - - - - - - - - - - - - - - - - - -
- - Module exceptions :: - Class Exception -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Class Exception

- -
Known Subclasses:
-
- SFTPError, - SSHException, - BERException, - NeedRekeyException
- -
- -Common base class for all exceptions. -
- - - - - - - - - - - - -
Method Summary
 __init__(...) -
 __getitem__(...) -
 __str__(...) -

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/frames.html b/docs/private/frames.html deleted file mode 100644 index 77678a0..0000000 --- a/docs/private/frames.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - API Documentation - - - - - - - - - diff --git a/docs/private/help.html b/docs/private/help.html deleted file mode 100644 index 5aab6d0..0000000 --- a/docs/private/help.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - - Help - - - - - - - - - - - - - - - - - - -
- - - -
[show private | hide private]
[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.

- - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/private/index.html b/docs/private/index.html deleted file mode 100644 index 77678a0..0000000 --- a/docs/private/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - API Documentation - - - - - - - - - diff --git a/docs/private/indices.html b/docs/private/indices.html deleted file mode 100644 index 752a39a..0000000 --- a/docs/private/indices.html +++ /dev/null @@ -1,1635 +0,0 @@ - - - - - Index - - - - - - - - - - - - - - - - - - -
- - - -
[show private | hide private]
[frames | no frames]
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Identifier Index
__author__Variable in package paramiko
objectClass in module __builtin__
__bases__Variable in class __builtin__.type
__basicsize__Variable in class __builtin__.type
__bootstrapMethod in class threading.Thread
__call__Method in class __builtin__.type
__call__Method in class paramiko.compress.ZlibCompressor
__call__Method in class paramiko.compress.ZlibDecompressor
typeClass in module __builtin__
__cmp__Method in class __builtin__.type
__cmp__Method in class paramiko.PKey
__date__Variable in package paramiko
__del__Method in class paramiko.BufferedFile
__del__Method in class paramiko.Channel
__del__Method in class paramiko.Packetizer
__del__Method in class paramiko.SFTPClient
__del__Method in class paramiko.SFTPFile
__del__Method in class paramiko.Transport
__delattr__Method in class __builtin__.object
__delattr__Method in class __builtin__.type
__deleteMethod in class threading.Thread
__dictoffset__Variable in class __builtin__.type
__flags__Variable in class __builtin__.type
__getattribute__Method in class __builtin__.object
__getattribute__Method in class __builtin__.type
__getitem__Method in class exceptions.Exception
__hash__Method in class __builtin__.object
__hash__Method in class __builtin__.type
__hash__Method in class paramiko.DSSKey
__hash__Method in class paramiko.RSAKey
__init__Method in class __builtin__.object
__init__Method in class exceptions.Exception
__init__Method in class paramiko.Agent
__init__Method in class paramiko.AgentKey
__init__Method in class paramiko.AuthHandler
__init__Method in class paramiko.BadAuthenticationType
__init__Method in class paramiko.BaseSFTP
__init__Method in class paramiko.BufferedFile
__init__Method in class paramiko.Channel
__init__Method in class paramiko.ChannelFile
__init__Method in class paramiko.DSSKey
__init__Method in class paramiko.Message
__init__Method in class paramiko.PKey
__init__Method in class paramiko.Packetizer
__init__Method in class paramiko.RSAKey
__init__Method in class paramiko.SFTPAttributes
__init__Method in class paramiko.SFTPClient
__init__Method in class paramiko.SFTPFile
__init__Method in class paramiko.SFTPHandle
__init__Method in class paramiko.SFTPServer
__init__Method in class paramiko.SFTPServerInterface
__init__Method in class paramiko.SecurityOptions
__init__Method in class paramiko.SubsystemHandler
__init__Method in class paramiko.Transport
__init__Method in class paramiko.ber.BER
__init__Method in class paramiko.channel.ChannelStderrFile
__init__Method in class paramiko.compress.ZlibCompressor
__init__Method in class paramiko.compress.ZlibDecompressor
__init__Method in class paramiko.kex_gex.KexGex
__init__Method in class paramiko.kex_group1.KexGroup1
__init__Method in class paramiko.logging22.Formatter
__init__Method in class paramiko.logging22.StreamHandler
__init__Method in class paramiko.logging22.logger
__init__Method in class paramiko.pipe.PosixPipe
__init__Method in class paramiko.pipe.WindowsPipe
__init__Method in class paramiko.primes.ModulusPack
__init__Method in class paramiko.server.InteractiveQuery
__init__Method in class paramiko.ssh_exception.PartialAuthentication
__init__Method in class threading.Thread
__init__Method in class threading._Verbose
__itemsize__Variable in class __builtin__.type
__iter__Method in class paramiko.BufferedFile
__license__Variable in package paramiko
__mro__Variable in class __builtin__.type
__name__Variable in class __builtin__.type
__new__Method in class __builtin__.object
__new__Method in class __builtin__.type
__reduce__Method in class __builtin__.object
__reduce_ex__Method in class __builtin__.object
__repr__Method in class __builtin__.object
__repr__Method in class __builtin__.type
__repr__Method in class paramiko.Channel
__repr__Method in class paramiko.ChannelFile
__repr__Method in class paramiko.Message
__repr__Method in class paramiko.SFTPAttributes
__repr__Method in class paramiko.SecurityOptions
__repr__Method in class paramiko.Transport
__repr__Method in class paramiko.ber.BER
__repr__Method in class threading.Thread
__setattr__Method in class __builtin__.object
__setattr__Method in class __builtin__.type
__slots__Variable in class paramiko.SecurityOptions
__stopMethod in class threading.Thread
__str__Method in class __builtin__.object
__str__Method in class exceptions.Exception
__str__Method in class paramiko.AgentKey
__str__Method in class paramiko.BadAuthenticationType
__str__Method in class paramiko.DSSKey
__str__Method in class paramiko.Message
__str__Method in class paramiko.PKey
__str__Method in class paramiko.RSAKey
__str__Method in class paramiko.SFTPAttributes
__str__Method in class paramiko.ber.BER
__subclasses__Method in class __builtin__.type
__version__Variable in package paramiko
__version_info__Variable in package paramiko
__weakrefoffset__Variable in class __builtin__.type
_activate_inboundMethod in class paramiko.Transport
_activate_outboundMethod in class paramiko.Transport
_active_threadsVariable in module paramiko.transport
_addMethod in class paramiko.Message
_adjust_cwdMethod in class paramiko.SFTPClient
_async_requestMethod in class paramiko.SFTPClient
_async_responseMethod in class paramiko.SFTPFile
_auth_triggerMethod in class paramiko.Transport
_build_packetMethod in class paramiko.Packetizer
_channel_handler_tableVariable in class paramiko.Transport
_check_add_windowMethod in class paramiko.Channel
_check_bannerMethod in class paramiko.Transport
_check_exceptionMethod in class paramiko.SFTPFile
_check_fileMethod in class paramiko.SFTPServer
_check_keepaliveMethod in class paramiko.Packetizer
_cipher_infoVariable in class paramiko.Transport
_CIPHER_TABLEVariable in class paramiko.PKey
_CIPHER_TABLEVariable in class paramiko.PKey
_CIPHER_TABLEVariable in class paramiko.PKey
_CIPHER_TABLEVariable in class paramiko.PKey
_CLIENT_IDVariable in class paramiko.Transport
_close_internalMethod in class paramiko.Channel
_compression_infoVariable in class paramiko.Transport
_compute_keyMethod in class paramiko.Transport
_convert_pflagsMethod in class paramiko.SFTPServer
_convert_statusMethod in class paramiko.SFTPClient
_debug_strMethod in class paramiko.SFTPAttributes
_DEFAULT_BUFSIZEVariable in class paramiko.BufferedFile
_DEFAULT_BUFSIZEVariable in class paramiko.BufferedFile
_DEFAULT_BUFSIZEVariable in class paramiko.BufferedFile
_DEFAULT_BUFSIZEVariable in class paramiko.BufferedFile
_disconnect_no_more_authMethod in class paramiko.AuthHandler
_disconnect_service_not_availableMethod in class paramiko.AuthHandler
_expect_packetMethod in class paramiko.Transport
_feedMethod in class paramiko.Channel
_feed_extendedMethod in class paramiko.Channel
_finish_responsesMethod in class paramiko.SFTPClient
_FLAG_APPENDVariable in module paramiko.file
_FLAG_BINARYVariable in module paramiko.file
_FLAG_BUFFEREDVariable in module paramiko.file
_FLAG_LINE_BUFFEREDVariable in module paramiko.file
_FLAG_READVariable in module paramiko.file
_FLAG_UNIVERSAL_NEWLINEVariable in module paramiko.file
_FLAG_WRITEVariable in module paramiko.file
_from_msgMethod in class paramiko.SFTPAttributes
_from_private_key_fileMethod in class paramiko.DSSKey
_from_private_key_fileMethod in class paramiko.RSAKey
_g_thread_counterVariable in module paramiko.util
_g_thread_idsVariable in module paramiko.util
_g_thread_lockVariable in module paramiko.util
_generate_primeFunction in module paramiko.primes
_generate_xMethod in class paramiko.kex_gex.KexGex
_generate_xMethod in class paramiko.kex_group1.KexGroup1
_get_cipherMethod in class paramiko.Transport
_get_ciphersMethod in class paramiko.SecurityOptions
_get_compressionMethod in class paramiko.SecurityOptions
_get_digestsMethod in class paramiko.SecurityOptions
_get_kexMethod in class paramiko.SecurityOptions
_get_key_typesMethod in class paramiko.SecurityOptions
_get_modulus_packMethod in class paramiko.Transport
_get_nameMethod in class paramiko.SFTPHandle
_get_next_filesMethod in class paramiko.SFTPHandle
_get_session_blobMethod in class paramiko.AuthHandler
_get_sizeMethod in class paramiko.BufferedFile
_get_sizeMethod in class paramiko.SFTPFile
_get_subsystem_handlerMethod in class paramiko.Transport
_handle_closeMethod in class paramiko.Channel
_handle_eofMethod in class paramiko.Channel
_handle_requestMethod in class paramiko.Channel
_handler_tableVariable in class paramiko.AuthHandler
_handler_tableVariable in class paramiko.Transport
_hash_classVariable in module paramiko.sftp_server
_interactive_queryMethod in class paramiko.AuthHandler
_join_lingering_threadsFunction in module paramiko.transport
_kex_infoVariable in class paramiko.Transport
_key_infoVariable in class paramiko.Transport
_logMethod in class paramiko.BaseSFTP
_logMethod in class paramiko.Channel
_logMethod in class paramiko.Packetizer
_logMethod in class paramiko.Transport
_loggerVariable in module paramiko.logging22
_mac_infoVariable in class paramiko.Transport
_modulus_packVariable in class paramiko.Transport
_MSG_KEXDH_GEX_GROUPVariable in module paramiko.kex_gex
_MSG_KEXDH_GEX_INITVariable in module paramiko.kex_gex
_MSG_KEXDH_GEX_REPLYVariable in module paramiko.kex_gex
_MSG_KEXDH_GEX_REQUESTVariable in module paramiko.kex_gex
_MSG_KEXDH_INITVariable in module paramiko.kex_group1
_MSG_KEXDH_REPLYVariable in module paramiko.kex_group1
_negotiate_keysMethod in class paramiko.Transport
_noteMethod in class threading._Verbose
_open_folderMethod in class paramiko.SFTPServer
_packMethod in class paramiko.SFTPAttributes
_parse_channel_openMethod in class paramiko.Transport
_parse_channel_open_failureMethod in class paramiko.Transport
_parse_channel_open_successMethod in class paramiko.Transport
_parse_debugMethod in class paramiko.Transport
_parse_disconnectMethod in class paramiko.Transport
_parse_global_requestMethod in class paramiko.Transport
_parse_kex_initMethod in class paramiko.Transport
_parse_kexdh_gex_groupMethod in class paramiko.kex_gex.KexGex
_parse_kexdh_gex_initMethod in class paramiko.kex_gex.KexGex
_parse_kexdh_gex_replyMethod in class paramiko.kex_gex.KexGex
_parse_kexdh_gex_requestMethod in class paramiko.kex_gex.KexGex
_parse_kexdh_initMethod in class paramiko.kex_group1.KexGroup1
_parse_kexdh_replyMethod in class paramiko.kex_group1.KexGroup1
_parse_modulusMethod in class paramiko.primes.ModulusPack
_parse_newkeysMethod in class paramiko.Transport
_parse_request_failureMethod in class paramiko.Transport
_parse_request_successMethod in class paramiko.Transport
_parse_service_acceptMethod in class paramiko.AuthHandler
_parse_service_requestMethod in class paramiko.AuthHandler
_parse_userauth_bannerMethod in class paramiko.AuthHandler
_parse_userauth_failureMethod in class paramiko.AuthHandler
_parse_userauth_info_requestMethod in class paramiko.AuthHandler
_parse_userauth_info_responseMethod in class paramiko.AuthHandler
_parse_userauth_requestMethod in class paramiko.AuthHandler
_parse_userauth_successMethod in class paramiko.AuthHandler
_pfilterVariable in module paramiko.util
_pkcs1imifyMethod in class paramiko.RSAKey
_preferred_ciphersVariable in class paramiko.Transport
_preferred_compressionVariable in class paramiko.Transport
_preferred_kexVariable in class paramiko.Transport
_preferred_keysVariable in class paramiko.Transport
_preferred_macsVariable in class paramiko.Transport
_prefetchMethod in class paramiko.SFTPFile
_processMethod in class paramiko.SFTPServer
_PROTO_IDVariable in class paramiko.Transport
_py22_read_allMethod in class paramiko.Packetizer
_py22_read_timeoutMethod in class paramiko.Packetizer
_readMethod in class paramiko.BufferedFile
_readMethod in class paramiko.ChannelFile
_readMethod in class paramiko.SFTPFile
_readMethod in class paramiko.channel.ChannelStderrFile
_read_allMethod in class paramiko.Agent
_read_allMethod in class paramiko.BaseSFTP
_read_folderMethod in class paramiko.SFTPServer
_read_packetMethod in class paramiko.BaseSFTP
_read_prefetchMethod in class paramiko.SFTPFile
_read_private_key_fileMethod in class paramiko.PKey
_read_responseMethod in class paramiko.SFTPClient
_read_timeoutMethod in class paramiko.Packetizer
_record_newlineMethod in class paramiko.BufferedFile
_requestMethod in class paramiko.SFTPClient
_request_authMethod in class paramiko.AuthHandler
_request_failedMethod in class paramiko.Channel
_request_successMethod in class paramiko.Channel
_responseMethod in class paramiko.SFTPServer
_roll_randomFunction in module paramiko.primes
_runMethod in class paramiko.SubsystemHandler
_rwxMethod in class paramiko.SFTPAttributes
_send_auth_resultMethod in class paramiko.AuthHandler
_send_eofMethod in class paramiko.Channel
_send_handle_responseMethod in class paramiko.SFTPServer
_send_kex_initMethod in class paramiko.Transport
_send_messageMethod in class paramiko.Agent
_send_messageMethod in class paramiko.Transport
_send_packetMethod in class paramiko.BaseSFTP
_send_server_versionMethod in class paramiko.BaseSFTP
_send_statusMethod in class paramiko.SFTPServer
_send_user_messageMethod in class paramiko.Transport
_send_versionMethod in class paramiko.BaseSFTP
_setMethod in class paramiko.SecurityOptions
_set_ciphersMethod in class paramiko.SecurityOptions
_set_closedMethod in class paramiko.Channel
_set_compressionMethod in class paramiko.SecurityOptions
_set_daemonMethod in class threading.Thread
_set_digestsMethod in class paramiko.SecurityOptions
_set_filesMethod in class paramiko.SFTPHandle
_set_K_HMethod in class paramiko.Transport
_set_kexMethod in class paramiko.SecurityOptions
_set_key_typesMethod in class paramiko.SecurityOptions
_set_modeMethod in class paramiko.BufferedFile
_set_nameMethod in class paramiko.SFTPHandle
_set_remote_channelMethod in class paramiko.Channel
_set_transportMethod in class paramiko.Channel
_set_windowMethod in class paramiko.Channel
__initializedVariable in class threading.Thread
__initializedVariable in class threading.Thread
__initializedVariable in class threading.Thread
__initializedVariable in class threading.Thread
_to_unicodeFunction in module paramiko.sftp_client
_transportVariable in class paramiko.SecurityOptions
_trigger_rekeyMethod in class paramiko.Packetizer
_unlinkMethod in class paramiko.Channel
_unlink_channelMethod in class paramiko.Transport
_unpackMethod in class paramiko.SFTPAttributes
_VerboseClass in module threading
_verify_keyMethod in class paramiko.Transport
_VERSIONVariable in module paramiko.sftp
_wait_for_send_windowMethod in class paramiko.Channel
_window_adjustMethod in class paramiko.Channel
_writeMethod in class paramiko.BufferedFile
_writeMethod in class paramiko.ChannelFile
_writeMethod in class paramiko.SFTPFile
_writeMethod in class paramiko.channel.ChannelStderrFile
_write_allMethod in class paramiko.BaseSFTP
_write_allMethod in class paramiko.BufferedFile
_write_private_key_fileMethod in class paramiko.PKey
abortMethod in class paramiko.AuthHandler
acceptMethod in class paramiko.Transport
addMethod in class paramiko.Message
add_booleanMethod in class paramiko.Message
add_byteMethod in class paramiko.Message
add_bytesMethod in class paramiko.Message
add_intMethod in class paramiko.Message
add_int64Method in class paramiko.Message
add_listMethod in class paramiko.Message
add_mpintMethod in class paramiko.Message
add_promptMethod in class paramiko.server.InteractiveQuery
add_server_keyMethod in class paramiko.Transport
add_stringMethod in class paramiko.Message
addFilterMethod in class paramiko.logging22.logger
addHandlerMethod in class paramiko.logging22.logger
AgentClass in package paramiko
agentModule in package paramiko
AgentKeyClass in package paramiko
allowed_typesVariable in class paramiko.BadAuthenticationType
allowed_typesVariable in class paramiko.ssh_exception.PartialAuthentication
AUTH_FAILEDVariable in module paramiko.common
auth_handlerModule in package paramiko
auth_interactiveMethod in class paramiko.AuthHandler
auth_interactiveMethod in class paramiko.Transport
auth_noneMethod in class paramiko.AuthHandler
auth_noneMethod in class paramiko.Transport
AUTH_PARTIALLY_SUCCESSFULVariable in module paramiko.common
auth_passwordMethod in class paramiko.AuthHandler
auth_passwordMethod in class paramiko.Transport
auth_publickeyMethod in class paramiko.AuthHandler
auth_publickeyMethod in class paramiko.Transport
AUTH_SUCCESSFULVariable in module paramiko.common
AuthHandlerClass in package paramiko
BadAuthenticationTypeClass in package paramiko
BaseSFTPClass in package paramiko
berModule in package paramiko
BERClass in module paramiko.ber
BERExceptionClass in module paramiko.ber
bit_lengthFunction in module paramiko.util
BufferedFileClass in package paramiko
can_signMethod in class paramiko.DSSKey
can_signMethod in class paramiko.PKey
can_signMethod in class paramiko.RSAKey
canonicalizeMethod in class paramiko.SFTPServerInterface
ChannelClass in package paramiko
channelModule in package paramiko
ChannelFileClass in package paramiko
ChannelStderrFileClass in module paramiko.channel
chattrMethod in class paramiko.SFTPHandle
chattrMethod in class paramiko.SFTPServerInterface
chdirMethod in class paramiko.SFTPClient
checkMethod in class paramiko.SFTPFile
check_auth_interactiveMethod in class paramiko.ServerInterface
check_auth_interactive_responseMethod in class paramiko.ServerInterface
check_auth_noneMethod in class paramiko.ServerInterface
check_auth_passwordMethod in class paramiko.ServerInterface
check_auth_publickeyMethod in class paramiko.ServerInterface
check_channel_exec_requestMethod in class paramiko.ServerInterface
check_channel_pty_requestMethod in class paramiko.ServerInterface
check_channel_requestMethod in class paramiko.ServerInterface
check_channel_shell_requestMethod in class paramiko.ServerInterface
check_channel_subsystem_requestMethod in class paramiko.ServerInterface
check_channel_window_change_requestMethod in class paramiko.ServerInterface
check_global_requestMethod in class paramiko.ServerInterface
chmodMethod in class paramiko.SFTPClient
chownMethod in class paramiko.SFTPClient
ciphersMethod in class paramiko.SFTPClient in class paramiko.SecurityOptions
clearMethod in class paramiko.pipe.PosixPipe
clearMethod in class paramiko.pipe.WindowsPipe
closeMethod in class paramiko.Agent
closeMethod in class paramiko.BufferedFile
closeMethod in class paramiko.Channel
closeMethod in class paramiko.Packetizer
closeMethod in class paramiko.SFTPClient
closeMethod in class paramiko.SFTPFile
closeMethod in class paramiko.SFTPHandle
closeMethod in class paramiko.Transport
closeMethod in class paramiko.pipe.PosixPipe
closeMethod in class paramiko.pipe.WindowsPipe
CMD_ATTRSVariable in module paramiko.sftp
CMD_CLOSEVariable in module paramiko.sftp
CMD_DATAVariable in module paramiko.sftp
CMD_EXTENDEDVariable in module paramiko.sftp
CMD_EXTENDED_REPLYVariable in module paramiko.sftp
CMD_FSETSTATVariable in module paramiko.sftp
CMD_FSTATVariable in module paramiko.sftp
CMD_HANDLEVariable in module paramiko.sftp
CMD_INITVariable in module paramiko.sftp
CMD_LSTATVariable in module paramiko.sftp
CMD_MKDIRVariable in module paramiko.sftp
CMD_NAMEVariable in module paramiko.sftp
CMD_NAMESVariable in module paramiko.sftp
CMD_OPENVariable in module paramiko.sftp
CMD_OPENDIRVariable in module paramiko.sftp
CMD_READVariable in module paramiko.sftp
CMD_READDIRVariable in module paramiko.sftp
CMD_READLINKVariable in module paramiko.sftp
CMD_REALPATHVariable in module paramiko.sftp
CMD_REMOVEVariable in module paramiko.sftp
CMD_RENAMEVariable in module paramiko.sftp
CMD_RMDIRVariable in module paramiko.sftp
CMD_SETSTATVariable in module paramiko.sftp
CMD_STATVariable in module paramiko.sftp
CMD_STATUSVariable in module paramiko.sftp
CMD_SYMLINKVariable in module paramiko.sftp
CMD_VERSIONVariable in module paramiko.sftp
CMD_WRITEVariable in module paramiko.sftp
commonModule in package paramiko
compressModule in package paramiko
compressionModule in package paramiko in class paramiko.SecurityOptions
connectMethod in class paramiko.Transport
CONNECTION_FAILED_CODEVariable in module paramiko.common
convert_errnoMethod in class paramiko.SFTPServer
CRITICALVariable in module paramiko.common
CRITICALVariable in module paramiko.logging22
DEBUGVariable in module paramiko.common
DEBUGVariable in module paramiko.logging22
decodeMethod in class paramiko.ber.BER
decode_nextMethod in class paramiko.ber.BER
decode_sequenceMethod in class paramiko.ber.BER
deflate_longFunction in module paramiko.util
digestsFunction in module paramiko.util in class paramiko.SecurityOptions
DISCONNECT_AUTH_CANCELLED_BY_USERVariable in module paramiko.common
DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLEVariable in module paramiko.common
DISCONNECT_SERVICE_NOT_AVAILABLEVariable in module paramiko.common
DSSKeyClass in package paramiko
dsskeyModule in package paramiko
encodeMethod in class paramiko.ber.BER
encode_sequenceMethod in class paramiko.ber.BER
encode_tlvMethod in class paramiko.ber.BER
ERRORVariable in module paramiko.common
ERRORVariable in module paramiko.logging22
exc_infoFunction in module sys
ExceptionClass in module exceptions
exec_commandMethod in class paramiko.Channel
fileMethod in class paramiko.SFTPClient
fileModule in package paramiko
filenoMethod in class paramiko.Channel
filenoMethod in class paramiko.pipe.PosixPipe
filenoMethod in class paramiko.pipe.WindowsPipe
filterMethod in class paramiko.util.PFilter
finish_subsystemMethod in class paramiko.SFTPServer
finish_subsystemMethod in class paramiko.SubsystemHandler
FLAG_AMTIMEVariable in class paramiko.SFTPAttributes
FLAG_EXTENDEDVariable in class paramiko.SFTPAttributes
FLAG_PERMISSIONSVariable in class paramiko.SFTPAttributes
FLAG_SIZEVariable in class paramiko.SFTPAttributes
FLAG_UIDGIDVariable in class paramiko.SFTPAttributes
flushMethod in class paramiko.BufferedFile
format_binaryFunction in module paramiko.util
format_binary_lineFunction in module paramiko.util
format_binary_weirdFunction in module paramiko.util
FormatterClass in module paramiko.logging22
from_private_key_fileMethod in class paramiko.PKey
from_statMethod in class paramiko.SFTPAttributes
from_transportMethod in class paramiko.SFTPClient
GVariable in module paramiko.kex_group1
generateMethod in class paramiko.DSSKey
generateMethod in class paramiko.RSAKey
generate_key_bytesFunction in module paramiko.util
getMethod in class paramiko.SFTPClient
get_allowed_authsMethod in class paramiko.ServerInterface
get_base64Method in class paramiko.PKey
get_bitsMethod in class paramiko.DSSKey
get_bitsMethod in class paramiko.PKey
get_bitsMethod in class paramiko.RSAKey
get_booleanMethod in class paramiko.Message
get_byteMethod in class paramiko.Message
get_bytesMethod in class paramiko.Message
get_exceptionMethod in class paramiko.Transport
get_fingerprintMethod in class paramiko.PKey
get_hexdumpMethod in class paramiko.Packetizer
get_hexdumpMethod in class paramiko.Transport
get_idMethod in class paramiko.Channel
get_intMethod in class paramiko.Message
get_int64Method in class paramiko.Message
get_keysMethod in class paramiko.Agent
get_listMethod in class paramiko.Message
get_log_channelMethod in class paramiko.Transport
get_loggerFunction in module paramiko.util
get_mac_size_inMethod in class paramiko.Packetizer
get_mac_size_outMethod in class paramiko.Packetizer
get_modulusMethod in class paramiko.primes.ModulusPack
get_mpintMethod in class paramiko.Message
get_nameMethod in class paramiko.AgentKey
get_nameMethod in class paramiko.Channel
get_nameMethod in class paramiko.DSSKey
get_nameMethod in class paramiko.PKey
get_nameMethod in class paramiko.RSAKey
get_ptyMethod in class paramiko.Channel
get_remainderMethod in class paramiko.Message
get_remote_server_keyMethod in class paramiko.Transport
get_security_optionsMethod in class paramiko.Transport
get_serverMethod in class paramiko.SubsystemHandler
get_server_keyMethod in class paramiko.Transport
get_so_farMethod in class paramiko.Message
get_stringMethod in class paramiko.Message
get_thread_idFunction in module paramiko.util
get_transportMethod in class paramiko.Channel
get_usernameMethod in class paramiko.AuthHandler
get_usernameMethod in class paramiko.Transport
getcwdMethod in class paramiko.SFTPClient
getLoggerFunction in module paramiko.logging22
getNameMethod in class threading.Thread
gettimeoutMethod in class paramiko.Channel
gettimeoutMethod in class paramiko.SFTPFile
global_requestMethod in class paramiko.Transport
hexifyFunction in module paramiko.util
inflate_longFunction in module paramiko.util
INFOVariable in module paramiko.common
INFOVariable in module paramiko.logging22
InteractiveQueryClass in module paramiko.server
invoke_shellMethod in class paramiko.Channel
invoke_subsystemMethod in class paramiko.Channel
is_activeMethod in class paramiko.Transport
is_authenticatedMethod in class paramiko.AuthHandler
is_authenticatedMethod in class paramiko.Transport
isAliveMethod in class threading.Thread
isDaemonMethod in class threading.Thread
joinMethod in class threading.Thread
kexMethod in class threading.Thread in class paramiko.SecurityOptions
kex_gexModule in package paramiko
kex_group1Module in package paramiko
KexGexClass in module paramiko.kex_gex
KexGroup1Class in module paramiko.kex_group1
key_typesClass in module paramiko.kex_group1 in class paramiko.SecurityOptions
list_folderMethod in class paramiko.SFTPServerInterface
listdirMethod in class paramiko.SFTPClient
listdir_attrMethod in class paramiko.SFTPClient
load_host_keysFunction in module paramiko.util
load_server_moduliMethod in class paramiko.Transport
logMethod in class paramiko.logging22.logger
log_to_fileFunction in module paramiko.util
loggerClass in module paramiko.logging22
logging22Module in package paramiko
lookup_ssh_host_configFunction in module paramiko.util
lstatMethod in class paramiko.SFTPClient
lstatMethod in class paramiko.SFTPServerInterface
make_pipeFunction in module paramiko.pipe
makefileMethod in class paramiko.Channel
makefile_stderrMethod in class paramiko.Channel
max_bitsVariable in class paramiko.kex_gex.KexGex
MAX_REQUEST_SIZEVariable in class paramiko.SFTPFile
MessageClass in package paramiko
messageModule in package paramiko
min_bitsVariable in class paramiko.kex_gex.KexGex
MIN_PACKET_SIZEVariable in class paramiko.Channel
mkdirMethod in class paramiko.SFTPClient
mkdirMethod in class paramiko.SFTPServerInterface
mod_inverseFunction in module paramiko.util
ModulusPackClass in module paramiko.primes
mroMethod in class __builtin__.type
MSG_CHANNEL_CLOSEVariable in module paramiko.common
MSG_CHANNEL_DATAVariable in module paramiko.common
MSG_CHANNEL_EOFVariable in module paramiko.common
MSG_CHANNEL_EXTENDED_DATAVariable in module paramiko.common
MSG_CHANNEL_FAILUREVariable in module paramiko.common
MSG_CHANNEL_OPENVariable in module paramiko.common
MSG_CHANNEL_OPEN_FAILUREVariable in module paramiko.common
MSG_CHANNEL_OPEN_SUCCESSVariable in module paramiko.common
MSG_CHANNEL_REQUESTVariable in module paramiko.common
MSG_CHANNEL_SUCCESSVariable in module paramiko.common
MSG_CHANNEL_WINDOW_ADJUSTVariable in module paramiko.common
MSG_DEBUGVariable in module paramiko.common
MSG_DISCONNECTVariable in module paramiko.common
MSG_GLOBAL_REQUESTVariable in module paramiko.common
MSG_IGNOREVariable in module paramiko.common
MSG_KEXINITVariable in module paramiko.common
MSG_NAMESVariable in module paramiko.common
MSG_NEWKEYSVariable in module paramiko.common
MSG_REQUEST_FAILUREVariable in module paramiko.common
MSG_REQUEST_SUCCESSVariable in module paramiko.common
MSG_SERVICE_ACCEPTVariable in module paramiko.common
MSG_SERVICE_REQUESTVariable in module paramiko.common
MSG_UNIMPLEMENTEDVariable in module paramiko.common
MSG_USERAUTH_BANNERVariable in module paramiko.common
MSG_USERAUTH_FAILUREVariable in module paramiko.common
MSG_USERAUTH_INFO_REQUESTVariable in module paramiko.common
MSG_USERAUTH_INFO_RESPONSEVariable in module paramiko.common
MSG_USERAUTH_PK_OKVariable in module paramiko.common
MSG_USERAUTH_REQUESTVariable in module paramiko.common
MSG_USERAUTH_SUCCESSVariable in module paramiko.common
nameVariable in class paramiko.kex_gex.KexGex
nameVariable in class paramiko.kex_group1.KexGroup1
need_rekeyMethod in class paramiko.Packetizer
NeedRekeyExceptionClass in module paramiko.packet
nextMethod in class paramiko.BufferedFile
normalizeMethod in class paramiko.SFTPClient
objectClass in module __builtin__
openMethod in class paramiko.SFTPServerInterface
open_channelMethod in class paramiko.Transport
open_sessionMethod in class paramiko.Transport
open_sftp_clientMethod in class paramiko.Transport
PVariable in module paramiko.kex_group1
packetModule in package paramiko
PacketizerClass in package paramiko
paramikoPackage
parse_nextMethod in class paramiko.kex_gex.KexGex
parse_nextMethod in class paramiko.kex_group1.KexGroup1
parse_ssh_configFunction in module paramiko.util
PartialAuthenticationClass in module paramiko.ssh_exception
PasswordRequiredExceptionClass in package paramiko
PFilterClass in module paramiko.util
pipeModule in package paramiko
PKeyClass in package paramiko
pkeyModule in package paramiko
PosixPipeClass in module paramiko.pipe
preferred_bitsVariable in class paramiko.kex_gex.KexGex
prefetchMethod in class paramiko.SFTPFile
primesModule in package paramiko
putMethod in class paramiko.SFTPClient
readMethod in class paramiko.BufferedFile
readMethod in class paramiko.SFTPHandle
read_allMethod in class paramiko.Packetizer
read_fileMethod in class paramiko.primes.ModulusPack
read_messageMethod in class paramiko.Packetizer
readlineMethod in class paramiko.BufferedFile
readlineMethod in class paramiko.Packetizer
readlinesMethod in class paramiko.BufferedFile
readlinkMethod in class paramiko.SFTPClient
readlinkMethod in class paramiko.SFTPServerInterface
recvMethod in class paramiko.Channel
recv_exit_statusMethod in class paramiko.Channel
recv_readyMethod in class paramiko.Channel
recv_stderrMethod in class paramiko.Channel
recv_stderr_readyMethod in class paramiko.Channel
REKEY_BYTESVariable in class paramiko.Packetizer
REKEY_PACKETSVariable in class paramiko.Packetizer
removeMethod in class paramiko.SFTPClient
removeMethod in class paramiko.SFTPServerInterface
renameMethod in class paramiko.SFTPClient
renameMethod in class paramiko.SFTPServerInterface
renegotiate_keysMethod in class paramiko.Transport
resize_ptyMethod in class paramiko.Channel
rewindMethod in class paramiko.Message
rmdirMethod in class paramiko.SFTPClient
rmdirMethod in class paramiko.SFTPServerInterface
RSAKeyClass in package paramiko
rsakeyModule in package paramiko
runMethod in class paramiko.Transport
runMethod in class threading.Thread
safe_stringFunction in module paramiko.util
SecurityOptionsClass in package paramiko
seekMethod in class paramiko.BufferedFile
seekMethod in class paramiko.SFTPFile
SEEK_CURVariable in class paramiko.BufferedFile
SEEK_CURVariable in class paramiko.BufferedFile
SEEK_CURVariable in class paramiko.BufferedFile
SEEK_CURVariable in class paramiko.BufferedFile
SEEK_ENDVariable in class paramiko.BufferedFile
SEEK_ENDVariable in class paramiko.BufferedFile
SEEK_ENDVariable in class paramiko.BufferedFile
SEEK_ENDVariable in class paramiko.BufferedFile
SEEK_SETVariable in class paramiko.BufferedFile
SEEK_SETVariable in class paramiko.BufferedFile
SEEK_SETVariable in class paramiko.BufferedFile
SEEK_SETVariable in class paramiko.BufferedFile
sendMethod in class paramiko.Channel
send_exit_statusMethod in class paramiko.Channel
send_ignoreMethod in class paramiko.Transport
send_messageMethod in class paramiko.Packetizer
send_stderrMethod in class paramiko.Channel
sendallMethod in class paramiko.Channel
sendall_stderrMethod in class paramiko.Channel
serverModule in package paramiko
ServerInterfaceClass in package paramiko
session_endedMethod in class paramiko.SFTPServerInterface
session_startedMethod in class paramiko.SFTPServerInterface
setMethod in class paramiko.pipe.PosixPipe
setMethod in class paramiko.pipe.WindowsPipe
set_combine_stderrMethod in class paramiko.Channel
set_file_attrMethod in class paramiko.SFTPServer
set_foreverMethod in class paramiko.pipe.PosixPipe
set_foreverMethod in class paramiko.pipe.WindowsPipe
set_hexdumpMethod in class paramiko.Packetizer
set_hexdumpMethod in class paramiko.Transport
set_inbound_cipherMethod in class paramiko.Packetizer
set_inbound_compressorMethod in class paramiko.Packetizer
set_keepaliveMethod in class paramiko.Packetizer
set_keepaliveMethod in class paramiko.Transport
set_logMethod in class paramiko.Packetizer
set_log_channelMethod in class paramiko.Transport
set_nameMethod in class paramiko.Channel
set_outbound_cipherMethod in class paramiko.Packetizer
set_outbound_compressorMethod in class paramiko.Packetizer
set_pipelinedMethod in class paramiko.SFTPFile
set_subsystem_handlerMethod in class paramiko.Transport
setblockingMethod in class paramiko.Channel
setblockingMethod in class paramiko.SFTPFile
setDaemonMethod in class threading.Thread
setFormatterMethod in class paramiko.logging22.StreamHandler
setLevelMethod in class paramiko.logging22.logger
setNameMethod in class threading.Thread
settimeoutMethod in class paramiko.Channel
settimeoutMethod in class paramiko.SFTPFile
SFTPClass in package paramiko
sftpModule in package paramiko
sftp_attrModule in package paramiko
SFTP_BAD_MESSAGEVariable in module paramiko.sftp
sftp_clientModule in package paramiko
SFTP_CONNECTION_LOSTVariable in module paramiko.sftp
SFTP_DESCVariable in module paramiko.sftp
SFTP_EOFVariable in module paramiko.sftp
SFTP_FAILUREVariable in module paramiko.sftp
sftp_fileModule in package paramiko
SFTP_FLAG_APPENDVariable in module paramiko.sftp
SFTP_FLAG_CREATEVariable in module paramiko.sftp
SFTP_FLAG_EXCLVariable in module paramiko.sftp
SFTP_FLAG_READVariable in module paramiko.sftp
SFTP_FLAG_TRUNCVariable in module paramiko.sftp
SFTP_FLAG_WRITEVariable in module paramiko.sftp
sftp_handleModule in package paramiko
SFTP_NO_CONNECTIONVariable in module paramiko.sftp
SFTP_NO_SUCH_FILEVariable in module paramiko.sftp
SFTP_OKVariable in module paramiko.sftp
SFTP_OP_UNSUPPORTEDVariable in module paramiko.sftp
SFTP_PERMISSION_DENIEDVariable in module paramiko.sftp
sftp_serverModule in package paramiko
sftp_siModule in package paramiko
SFTPAttributesClass in package paramiko
SFTPClientClass in package paramiko
SFTPErrorClass in package paramiko
SFTPFileClass in package paramiko
SFTPHandleClass in package paramiko
SFTPServerClass in package paramiko
SFTPServerInterfaceClass in package paramiko
shutdownMethod in class paramiko.Channel
shutdown_readMethod in class paramiko.Channel
shutdown_writeMethod in class paramiko.Channel
sign_ssh_dataMethod in class paramiko.AgentKey
sign_ssh_dataMethod in class paramiko.DSSKey
sign_ssh_dataMethod in class paramiko.PKey
sign_ssh_dataMethod in class paramiko.RSAKey
SSH2_AGENT_IDENTITIES_ANSWERVariable in module paramiko.agent
SSH2_AGENT_SIGN_RESPONSEVariable in module paramiko.agent
SSH2_AGENTC_REQUEST_IDENTITIESVariable in module paramiko.agent
SSH2_AGENTC_SIGN_REQUESTVariable in module paramiko.agent
ssh_exceptionModule in package paramiko
SSHExceptionClass in package paramiko
startMethod in class threading.Thread
start_clientMethod in class paramiko.Transport
start_kexMethod in class paramiko.kex_gex.KexGex
start_kexMethod in class paramiko.kex_group1.KexGroup1
start_serverMethod in class paramiko.Transport
start_subsystemMethod in class paramiko.SFTPServer
start_subsystemMethod in class paramiko.SubsystemHandler
statMethod in class paramiko.SFTPClient
statMethod in class paramiko.SFTPFile
statMethod in class paramiko.SFTPHandle
statMethod in class paramiko.SFTPServerInterface
stop_threadMethod in class paramiko.Transport
StreamHandlerClass in module paramiko.logging22
SubsystemHandlerClass in package paramiko
symlinkMethod in class paramiko.SFTPClient
symlinkMethod in class paramiko.SFTPServerInterface
tb_stringsFunction in module paramiko.util
tellMethod in class paramiko.BufferedFile
ThreadClass in module threading
TransportClass in package paramiko
transportModule in package paramiko
typeClass in module __builtin__
unhexifyFunction in module paramiko.util
use_compressionMethod in class paramiko.Transport
utilModule in package paramiko
utimeMethod in class paramiko.SFTPClient
verify_ssh_sigMethod in class paramiko.DSSKey
verify_ssh_sigMethod in class paramiko.PKey
verify_ssh_sigMethod in class paramiko.RSAKey
wait_for_responseMethod in class paramiko.AuthHandler
WARNINGVariable in module paramiko.common
WARNINGVariable in module paramiko.logging22
WindowsPipeClass in module paramiko.pipe
writeMethod in class paramiko.BufferedFile
writeMethod in class paramiko.SFTPHandle
write_allMethod in class paramiko.Packetizer
write_private_key_fileMethod in class paramiko.DSSKey
write_private_key_fileMethod in class paramiko.PKey
write_private_key_fileMethod in class paramiko.RSAKey
writelinesMethod in class paramiko.BufferedFile
xreadlinesMethod in class paramiko.BufferedFile
ZlibCompressorClass in module paramiko.compress
ZlibDecompressorClass in module paramiko.compress
-
- - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko-module.html b/docs/private/paramiko-module.html deleted file mode 100644 index 4e9f899..0000000 --- a/docs/private/paramiko-module.html +++ /dev/null @@ -1,407 +0,0 @@ - - - - - paramiko - - - - - - - - - - - - - - - - - - -
- - Package paramiko -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Package paramiko

- -

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 heirarchical 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.)

-

To use this package, 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.5.2 (rhydon) -

- -

Author: Robey Pointer -

- -

Contact: robey@lag.net -

- -

License: GNU Lesser General Public License (LGPL) -

- - - - - - - -
Submodules

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Classes
- AgentClient interface for using private keys from an SSH agent running on -the local machine.
- AgentKeyPrivate key held in a local SSH agent.
- BufferedFileReusable base class to implement python-style file buffering around a -simpler stream.
- ChannelA secure tunnel across an SSH Transport.
- DSSKeyRepresentation of a DSS key which can be used to sign an verify SSH2 -data.
- MessageAn SSH2 Message is a stream of bytes that encodes some -combination of strings, integers, bools, and infinite-precision integers -(known in python as longs).
- RSAKeyRepresentation of an RSA key which can be used to sign and verify SSH2 -data.
- SecurityOptionsSimple object containing the security preferences of an ssh -transport.
- SFTPan alias for SFTPClient for backwards compatability
- SFTPAttributesRepresentation of the attributes of a file (or proxied file) for SFTP -in client or server mode.
- SFTPClientSFTP client object.
- SFTPFileProxy object for a file on the remote server, in client mode SFTP.
- SFTPHandleAbstract object representing a handle to an open file (or folder) in -an SFTP server implementation.
- SFTPServerServer-side SFTP subsystem support.
- SubsystemHandlerHandler for a subsytem in server mode.
- TransportAn SSH Transport attaches to a stream (usually a socket), negotiates -an encrypted session, authenticates, and then creates stream tunnels, -called Channels, across the session.
- AuthHandlerInternal class to handle the mechanics of authentication.
- BaseSFTP 
- ChannelFileA file-like wrapper around Channel.
- PacketizerImplementation of the base SSH packet protocol.
- PKeyBase class for public keys.
- ServerInterfaceThis class defines an interface for controlling the behavior of -paramiko in server mode.
- SFTPServerInterfaceThis class defines an interface for controlling the behavior of -paramiko when using the SFTPServer subsystem to provide an SFTP -server.
- xThis class defines an interface for controlling the behavior of -paramiko in server mode.

- - - - - - - - - - - - - - -
Exceptions
- BadAuthenticationTypeException raised when an authentication type (like password) is used, -but the server isn't allowing that type.
- PasswordRequiredExceptionException raised when a password is needed to unlock a private key -file.
- SFTPError 
- SSHExceptionException raised by failures in SSH2 protocol negotiation or logic -errors.

- - - - - - - - - - - - - - - - -
Variable Summary
str__author__ = 'Robey Pointer <robey@lag.net>' -
str__date__ = '04 Dec 2005' -
str__license__ = 'GNU Lesser General Public License (LGPL)'... -
str__version__ = '1.5.2 (rhydon)' -
tuple__version_info__ = (1, 5, 2) -

- - - - - - -
Variable Details
-
- -

__author__

-
-
-
-
-
Type:
-
- str - -
-
Value:
-
-
-'Robey Pointer <robey@lag.net>'                                        
-
-
-
-
-
- -

__date__

-
-
-
-
-
Type:
-
- str - -
-
Value:
-
-
-'04 Dec 2005'                                                          
-
-
-
-
-
- -

__license__

-
-
-
-
-
Type:
-
- str - -
-
Value:
-
-
-'GNU Lesser General Public License (LGPL)'                             
-
-
-
-
-
- -

__version__

-
-
-
-
-
Type:
-
- str - -
-
Value:
-
-
-'1.5.2 (rhydon)'                                                       
-
-
-
-
-
- -

__version_info__

-
-
-
-
-
Type:
-
- tuple - -
-
Value:
-
-
-(1, 5, 2)                                                              
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.Agent-class.html b/docs/private/paramiko.Agent-class.html deleted file mode 100644 index 1f4e20b..0000000 --- a/docs/private/paramiko.Agent-class.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - paramiko.Agent - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class Agent -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Class Agent

- -
- -

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). -
- - - - - - - - - - - - - - - - -
Method Summary
 __init__(self) -
-Open a session with the local machine's SSH agent, if one is -running.
 close(self) -
-Close the SSH agent connection.
tuple of AgentKey -get_keys(self) -
-Return the list of keys available through the SSH agent, if any.
 _read_all(self, - wanted) -
 _send_message(self, - msg) -

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

__init__(self) -
(Constructor) -

- 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 -
-
-
- - -
-

close(self) -

- Close the SSH agent connection. -
-
-
- - -
-

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. -
-
Returns:
-
- a list of keys available on the SSH agent -
           - (type=tuple of AgentKey) -
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.AgentKey-class.html b/docs/private/paramiko.AgentKey-class.html deleted file mode 100644 index 28b1659..0000000 --- a/docs/private/paramiko.AgentKey-class.html +++ /dev/null @@ -1,319 +0,0 @@ - - - - - paramiko.AgentKey - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class AgentKey -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type AgentKey

- -
-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. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - agent, - blob) -
str -__str__(self) -
-Return a string of an SSH Message made up of the public part(s) of -this key.
str -get_name(self) -
-Return the name of this private key implementation.
Message -sign_ssh_data(self, - randpool, - data) -
-Sign a blob of data with this private key, and return a Message -representing an SSH signature message.
    Inherited from PKey
int -__cmp__(self, - other) -
-Compare this key to another.
str -_read_private_key_file(self, - tag, - filename, - password) -
-Read an SSH2-format private key file, looking for a string of the type -"BEGIN xxx PRIVATE KEY" for some xxx, -base64-decode the text we find, and return it as a string.
 _write_private_key_file(self, - tag, - filename, - data, - password) -
-Write an SSH2-format private key file in a form that can be read by -paramiko or openssh.
bool -can_sign(self) -
-Return True if this key has the private part necessary -for signing data.
PKey -from_private_key_file(cl, - filename, - password) -
-Create a key object by reading a private key file. (Class method) -
str -get_base64(self) -
-Return a base64 string containing the public part of this key.
int -get_bits(self) -
-Return the number of significant bits in this key.
str -get_fingerprint(self) -
-Return an MD5 fingerprint of the public part of this key.
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.
 write_private_key_file(self, - filename, - password) -
-Write private key contents into a file.
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value

- - - - - - - - - - -
Class Variable Summary
    Inherited from PKey
dict_CIPHER_TABLE = {'DES-EDE3-CBC': {'blocksize': 8, 'ciphe... -

- - - - - - -
Instance Method Details
- - -
-

__str__(self) -
(Informal representation operator) -

- 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:
-
- string representation of an SSH key message. -
           - (type=str) -
-
-
Overrides:
-
paramiko.PKey.__str__ (inherited documentation) -
-
-
-
- - -
-

get_name(self) -

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

sign_ssh_data(self, - randpool, - data) -

- Sign a blob of data with this private key, and return a Message representing an SSH signature - message. -
-
Parameters:
-
randpool - - a secure random number generator. -
           - (type=Crypto.Util.randpool.RandomPool) -
data - - the data to sign. -
           - (type=str) -
-
-
Returns:
-
- an SSH signature message. -
           - (type=Message) -
-
-
Overrides:
-
paramiko.PKey.sign_ssh_data (inherited documentation) -
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.AuthHandler-class.html b/docs/private/paramiko.AuthHandler-class.html deleted file mode 100644 index 7c2b235..0000000 --- a/docs/private/paramiko.AuthHandler-class.html +++ /dev/null @@ -1,282 +0,0 @@ - - - - - paramiko.AuthHandler - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class AuthHandler -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type AuthHandler

- -
-object --+
-         |
-        AuthHandler
-

- -
- -Internal class to handle the mechanics of authentication. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - transport) -
 _disconnect_no_more_auth(self) -
 _disconnect_service_not_available(self) -
 _get_session_blob(self, - key, - service, - username) -
 _interactive_query(self, - q) -
 _parse_service_accept(self, - m) -
 _parse_service_request(self, - m) -
 _parse_userauth_banner(self, - m) -
 _parse_userauth_failure(self, - m) -
 _parse_userauth_info_request(self, - m) -
 _parse_userauth_info_response(self, - m) -
 _parse_userauth_request(self, - m) -
 _parse_userauth_success(self, - m) -
 _request_auth(self) -
 _send_auth_result(self, - username, - method, - result) -
 abort(self) -
 auth_interactive(self, - username, - handler, - event, - submethods) -
-response_list = handler(title, instructions, prompt_list)
 auth_none(self, - username, - event) -
 auth_password(self, - username, - password, - event) -
 auth_publickey(self, - username, - key, - event) -
 get_username(self) -
 is_authenticated(self) -
 wait_for_response(self, - event) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - -
Class Variable Summary
dict_handler_table = {5: <function _parse_service_request at... -

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

auth_interactive(self, - username, - handler, - event, - submethods='') -

- response_list = handler(title, instructions, prompt_list) -
-
-
-
- - - - - - -
Class Variable Details
-
- -

_handler_table

-
-
-
-
-
Type:
-
- dict - -
-
Value:
-
-
-{5: <function _parse_service_request at 0xb7b0ae2c>,
- 6: <function _parse_service_accept at 0xb7b0ae64>,
- 50: <function _parse_userauth_request at 0xb7b0af0c>,
- 51: <function _parse_userauth_failure at 0xb7b0af7c>,
- 52: <function _parse_userauth_success at 0xb7b0af44>,
- 53: <function _parse_userauth_banner at 0xb7b0afb4>,
- 60: <function _parse_userauth_info_request at 0xb7b1302c>,
- 61: <function _parse_userauth_info_response at 0xb7b13064>}           
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.BadAuthenticationType-class.html b/docs/private/paramiko.BadAuthenticationType-class.html deleted file mode 100644 index 023879a..0000000 --- a/docs/private/paramiko.BadAuthenticationType-class.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - paramiko.BadAuthenticationType - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class BadAuthenticationType -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Class BadAuthenticationType

- -
-Exception --+    
-            |    
- SSHException --+
-                |
-               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 -

- - - - - - - - - - - - - - -
Method Summary
 __init__(self, - explanation, - types) -
 __str__(self) -
    Inherited from Exception
 __getitem__(...) -

- - - - - - - - -
Instance Variable Summary
listallowed_types: list of allowed authentication types provided by the server (possible -values are: "none", -"password", and -"publickey").

- - - - - - -
Instance Variable Details
-
- -

allowed_types

-list of allowed authentication types provided by the server (possible -values are: "none", -"password", and -"publickey"). -
-
-
-
-
Type:
-
- list - -
-
Value:
-
-
-[]                                                                     
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.BaseSFTP-class.html b/docs/private/paramiko.BaseSFTP-class.html deleted file mode 100644 index 18917f0..0000000 --- a/docs/private/paramiko.BaseSFTP-class.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - paramiko.BaseSFTP - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class BaseSFTP -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type BaseSFTP

- -
-object --+
-         |
-        BaseSFTP
-

- -
Known Subclasses:
-
- SFTPClient, - SFTPServer
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self) -
 _log(self, - level, - msg) -
 _read_all(self, - n) -
 _read_packet(self) -
 _send_packet(self, - t, - packet) -
 _send_server_version(self) -
 _send_version(self) -
 _write_all(self, - out) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:46 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.BufferedFile-class.html b/docs/private/paramiko.BufferedFile-class.html deleted file mode 100644 index 2ab7785..0000000 --- a/docs/private/paramiko.BufferedFile-class.html +++ /dev/null @@ -1,656 +0,0 @@ - - - - - paramiko.BufferedFile - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class BufferedFile -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type BufferedFile

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

- -
Known Subclasses:
-
- SFTPFile, - ChannelFile
- -
- -Reusable base class to implement python-style file buffering around a -simpler stream. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self) -
 __del__(self) -
iterator -__iter__(self) -
-Returns an iterator that can be used to iterate over the lines in this -file.
 close(self) -
-Close the file.
 flush(self) -
-Write out any data in the write buffer.
str -next(self) -
-Returns the next line from the input, or raises -StopIteration when EOF is hit.
str -read(self, - size) -
-Read at most size bytes from the file (less if we hit the -end of the file first).
str -readline(self, - size) -
-Read one entire line from the file.
list -readlines(self, - sizehint) -
-Read all remaining lines using readline and return them as a list.
 seek(self, - offset, - whence) -
-Set the file's current position, like stdio's fseek.
int -tell(self) -
-Return the file's current position.
 write(self, - data) -
-Write data to the file.
 writelines(self, - sequence) -
-Write a sequence of strings to the file.
iterator -xreadlines(self) -
-Identical to iter(f).
 _get_size(self) -
-(subclass override) Return the size of the file.
 _read(self, - size) -
-(subclass override) Read data from the stream.
 _record_newline(self, - newline) -
 _set_mode(self, - mode, - bufsize) -
-Subclasses call this method to initialize the BufferedFile.
 _write(self, - data) -
-(subclass override) Write data into the stream.
 _write_all(self, - data) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - - - -
Class Variable Summary
intSEEK_CUR = 1                                                                     
intSEEK_END = 2                                                                     
intSEEK_SET = 0                                                                     
int_DEFAULT_BUFSIZE = 8192                                                                  

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

__iter__(self) -

- 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:
-
- an interator. -
           - (type=iterator) -
-
-
Raises:
-
ValueError - - if the file is closed. -
-
-
- - -
-

close(self) -

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

flush(self) -

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

next(self) -

- 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:
-
- a line read from the file. -
           - (type=str) -
-
-
Raises:
-
StopIteration - - when the end of the file is reached. -
-
-
- - -
-

read(self, - size=None) -

- 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 - - maximum number of bytes to read. -
           - (type=int) -
-
-
Returns:
-
- data read from the file, or an empty string if EOF was - encountered immediately. -
           - (type=str) -
-
-
-
- - -
-

readline(self, - size=None) -

- 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 - - maximum length of returned string. -
           - (type=int) -
-
-
Returns:
-
- next line of the file, or an empty string if the end of the - file has been reached. -
           - (type=str) -
-
-

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

- -
-
- - -
-

readlines(self, - sizehint=None) -

- 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 - - desired maximum number of bytes to read. -
           - (type=int) -
-
-
Returns:
-
- list of lines read from the file. -
           - (type=list) -
-
-
-
- - -
-

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

- 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. -
           - (type=int) -
whence - - type of movement: 0 = absolute; 1 = relative to the current - position; 2 = relative to the end of the file. -
           - (type=int) -
-
-
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) -

- 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:
-
- file position (in bytes). -
           - (type=int) -
-
-
-
- - -
-

write(self, - data) -

- 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 - - data to write. -
           - (type=str) -
-
-
-
- - -
-

writelines(self, - sequence) -

- 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 - - an iterable sequence of strings. -
           - (type=sequence) -
-
-
-
- - -
-

xreadlines(self) -

- Identical to iter(f). This is a deprecated file - interface that predates python iterator support. -
-
Returns:
-
- an iterator. -
           - (type=iterator) -
-
-
-
- - -
-

_get_size(self) -

- (subclass override) Return the size of the file. This is - called from within _set_mode if the file is opened in append - mode, so the file position can be tracked and seek and tell will work correctly. If the file is - a stream that can't be randomly accessed, you don't need to override - this method, -
-
-
- - -
-

_read(self, - size) -

- (subclass override) Read data from the stream. Return - None or raise EOFError to indicate EOF. -
-
-
- - -
-

_set_mode(self, - mode='r', - bufsize=-1) -

- Subclasses call this method to initialize the BufferedFile. -
-
-
- - -
-

_write(self, - data) -

- (subclass override) Write data into the stream. -
-
-
-
- - - - - - -
Class Variable Details
-
- -

SEEK_CUR

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-1                                                                     
-
-
-
-
-
- -

SEEK_END

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-2                                                                     
-
-
-
-
-
- -

SEEK_SET

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-0                                                                     
-
-
-
-
-
- -

_DEFAULT_BUFSIZE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-8192                                                                  
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.Channel-class.html b/docs/private/paramiko.Channel-class.html deleted file mode 100644 index 83ac46e..0000000 --- a/docs/private/paramiko.Channel-class.html +++ /dev/null @@ -1,1329 +0,0 @@ - - - - - paramiko.Channel - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class Channel -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type Channel

- -
-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. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - chanid) -
-Create a new channel.
 __del__(self) -
str -__repr__(self) -
-Return a string representation of this object, for debugging.
 close(self) -
-Close the channel.
bool -exec_command(self, - command) -
-Execute a command on the server.
int -fileno(self) -
-Returns an OS-level file descriptor which can be used for polling, but -but not for reading or writing).
int -get_id(self) -
-Return the ID # for this channel.
str -get_name(self) -
-Get the name of this channel that was previously set by set_name.
bool -get_pty(self, - term, - width, - height) -
-Request a pseudo-terminal from the server.
Transport -get_transport(self) -
-Return the Transport associated with this channel.
float -gettimeout(self) -
-Returns the timeout in seconds (as a float) associated with socket -operations, or None if no timeout is set.
bool -invoke_shell(self) -
-Request an interactive shell session on this channel.
bool -invoke_subsystem(self, - subsystem) -
-Request a subsystem on the server (for example, -sftp).
ChannelFile -makefile(self, - *params) -
-Return a file-like object associated with this channel.
ChannelFile -makefile_stderr(self, - *params) -
-Return a file-like object associated with this channel's stderr -stream.
str -recv(self, - nbytes) -
-Receive data from the channel.
int -recv_exit_status(self) -
-Return the exit status from the process on the server.
boolean -recv_ready(self) -
-Returns true if data is buffered and ready to be read from this -channel.
str -recv_stderr(self, - nbytes) -
-Receive data from the channel's stderr stream.
boolean -recv_stderr_ready(self) -
-Returns true if data is buffered and ready to be read from this -channel's stderr stream.
bool -resize_pty(self, - width, - height) -
-Resize the pseudo-terminal.
int -send(self, - s) -
-Send data to the channel.
 send_exit_status(self, - status) -
-Send the exit status of an executed command to the client.
int -send_stderr(self, - s) -
-Send data to the channel on the "stderr" stream.
 sendall(self, - s) -
-Send data to the channel, without allowing partial results.
 sendall_stderr(self, - s) -
-Send data to the channel's "stderr" stream, without allowing -partial results.
bool -set_combine_stderr(self, - combine) -
-Set whether stderr should be combined into stdout on this channel.
 set_name(self, - name) -
-Set a name for this channel.
 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.
 settimeout(self, - timeout) -
-Set a timeout on blocking read/write operations.
 shutdown(self, - how) -
-Shut down one or both halves of the connection.
 shutdown_read(self) -
-Shutdown the receiving side of this socket, closing the stream in the -incoming direction.
 shutdown_write(self) -
-Shutdown the sending side of this socket, closing the stream in the -outgoing direction.
 _check_add_window(self, - n) -
 _close_internal(self) -
 _feed(self, - m) -
 _feed_extended(self, - m) -
 _handle_close(self, - m) -
 _handle_eof(self, - m) -
 _handle_request(self, - m) -
 _log(self, - level, - msg) -
 _request_failed(self, - m) -
 _request_success(self, - m) -
 _send_eof(self) -
 _set_closed(self) -
 _set_remote_channel(self, - chanid, - window_size, - max_packet_size) -
 _set_transport(self, - transport) -
 _set_window(self, - window_size, - max_packet_size) -
 _unlink(self) -
 _wait_for_send_window(self, - size) -
-(You are already holding the lock.) Wait for the send window to open -up, and allocate up to size bytes for transmission.
 _window_adjust(self, - m) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - -
Class Variable Summary
intMIN_PACKET_SIZE = 1024                                                                  

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

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

- 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 - - the ID of this channel, as passed by an existing Transport. -
           - (type=int) -
-
-
Overrides:
-
__builtin__.object.__init__
-
-
-
- - -
-

__repr__(self) -
(Representation operator) -

- Return a string representation of this object, for debugging. -
-
Returns:
-
- str -
-
-
Overrides:
-
__builtin__.object.__repr__
-
-
-
- - -
-

close(self) -

- 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) -

-

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 - - a shell command to execute. -
           - (type=str) -
-
-
Returns:
-
- True if the operation succeeded; - False if not. -
           - (type=bool) -
-
-
-
- - -
-

fileno(self) -

-

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 open - hundreds or thousands of channels simultaneously, but it's still - notable. -
-
Returns:
-
- an OS-level file descriptor -
           - (type=int) -
-
-

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

- -
-
- - -
-

get_id(self) -

- 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:
-
- the ID of this channel. -
           - (type=int) -
-
-

Since: ivysaur -

- -
-
- - -
-

get_name(self) -

- Get the name of this channel that was previously set by set_name. -
-
Returns:
-
- the name of this channel. -
           - (type=str) -
-
-
-
- - -
-

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

- 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 - - the terminal type to emulate (for example, - 'vt100'). -
           - (type=str) -
width - - width (in characters) of the terminal screen -
           - (type=int) -
height - - height (in characters) of the terminal screen -
           - (type=int) -
-
-
Returns:
-
- True if the operation succeeded; - False if not. -
           - (type=bool) -
-
-
-
- - -
-

get_transport(self) -

- Return the Transport associated with this - channel. -
-
Returns:
-
- the Transport that was used to create - this channel. -
           - (type=Transport) -
-
-
-
- - -
-

gettimeout(self) -

- 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:
-
- timeout in seconds, or None. -
           - (type=float) -
-
-
-
- - -
-

invoke_shell(self) -

-

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. -
-
Returns:
-
- True if the operation succeeded; - False if not. -
           - (type=bool) -
-
-
-
- - -
-

invoke_subsystem(self, - subsystem) -

-

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 - - name of the subsystem being requested. -
           - (type=str) -
-
-
Returns:
-
- True if the operation succeeded; - False if not. -
           - (type=bool) -
-
-
-
- - -
-

makefile(self, - *params) -

- 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:
-
- object which can be used for python file I/O. -
           - (type=ChannelFile) -
-
-
-
- - -
-

makefile_stderr(self, - *params) -

-

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:
-
- object which can be used for python file I/O. -
           - (type=ChannelFile) -
-
-

Since: 1.1 -

- -
-
- - -
-

recv(self, - nbytes) -

- 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 - - maximum number of bytes to read. -
           - (type=int) -
-
-
Returns:
-
- data. -
           - (type=str) -
-
-
Raises:
-
socket.timeout - - if no data is ready before the timeout set by settimeout. -
-
-
- - -
-

recv_exit_status(self) -

- 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:
-
- the exit code of the process on the server. -
           - (type=int) -
-
-

Since: 1.2 -

- -
-
- - -
-

recv_ready(self) -

- 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:
-
- True if a recv call on this channel would - immediately return at least one byte; False - otherwise. -
           - (type=boolean) -
-
-
-
- - -
-

recv_stderr(self, - nbytes) -

- 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 - - maximum number of bytes to read. -
           - (type=int) -
-
-
Returns:
-
- data. -
           - (type=str) -
-
-
Raises:
-
socket.timeout - - if no data is ready before the timeout set by settimeout. -
-

Since: 1.1 -

- -
-
- - -
-

recv_stderr_ready(self) -

- 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:
-
- True if a recv_stderr call on this channel - would immediately return at least one byte; False - otherwise. -
           - (type=boolean) -
-
-

Since: 1.1 -

- -
-
- - -
-

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

- 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 - - new width (in characters) of the terminal screen -
           - (type=int) -
height - - new height (in characters) of the terminal screen -
           - (type=int) -
-
-
Returns:
-
- True if the operation succeeded; - False if not. -
           - (type=bool) -
-
-
-
- - -
-

send(self, - s) -

- 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 - - data to send. -
           - (type=str) -
-
-
Returns:
-
- number of bytes actually sent. -
           - (type=int) -
-
-
Raises:
-
socket.timeout - - if no data could be sent before the timeout set by settimeout. -
-
-
- - -
-

send_exit_status(self, - status) -

- 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 - - the exit code of the process -
           - (type=int) -
-
-

Since: 1.2 -

- -
-
- - -
-

send_stderr(self, - s) -

- 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 - - data to send. -
           - (type=str) -
-
-
Returns:
-
- number of bytes actually sent. -
           - (type=int) -
-
-
Raises:
-
socket.timeout - - if no data could be sent before the timeout set by settimeout. -
-

Since: 1.1 -

- -
-
- - -
-

sendall(self, - s) -

- 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 - - data to send. -
           - (type=str) -
-
-
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) -

- 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 - - data to send to the client as "stderr" output. -
           - (type=str) -
-
-
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) -

-

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 - - True if stderr output should be combined into - stdout on this channel. -
           - (type=bool) -
-
-
Returns:
-
- previous setting. -
           - (type=bool) -
-
-

Since: 1.1 -

- -
-
- - -
-

set_name(self, - name) -

- Set a name for this channel. Currently it's only used to set the - name of the log level used for debugging. The name can be fetched with - the get_name method. -
-
Parameters:
-
name - - new channel name. -
           - (type=str) -
-
-
-
- - -
-

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. 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.

- chan.setblocking(0) is equivalent to - chan.settimeout(0); chan.setblocking(1) is - equivalent to chan.settimeout(None). -
-
Parameters:
-
blocking - - 0 to set non-blocking mode; non-0 to set blocking mode. -
           - (type=int) -
-
-
-
- - -
-

settimeout(self, - timeout) -

-

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 - - seconds to wait for a pending read/write operation before - raising socket.timeout, or None for no - timeout. -
           - (type=float) -
-
-
-
- - -
-

shutdown(self, - how) -

- 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 - - 0 (stop receiving), 1 (stop sending), or 2 (stop receiving and - sending). -
           - (type=int) -
-
-
-
- - -
-

shutdown_read(self) -

- 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) -

- 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 -

- -
-
- - -
-

_wait_for_send_window(self, - size) -

- (You are already holding the lock.) Wait for the send window to open - up, and allocate up to size bytes for transmission. If no - space opens up before the timeout, a timeout exception is raised. - Returns the number of bytes available to send (may be less than - requested). -
-
-
-
- - - - - - -
Class Variable Details
-
- -

MIN_PACKET_SIZE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-1024                                                                  
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.ChannelFile-class.html b/docs/private/paramiko.ChannelFile-class.html deleted file mode 100644 index c3c4fea..0000000 --- a/docs/private/paramiko.ChannelFile-class.html +++ /dev/null @@ -1,347 +0,0 @@ - - - - - paramiko.ChannelFile - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class ChannelFile -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type ChannelFile

- -
-  object --+    
-           |    
-BufferedFile --+
-               |
-              ChannelFile
-

- -
Known Subclasses:
-
- ChannelStderrFile
- -
- -A file-like wrapper around Channel. A ChannelFile is created by -calling Channel.makefile. -
- -

Bug: To correctly emulate the file object created from a socket's -makefile method, a Channel and its ChannelFile -should be able to be closed or garbage-collected independently. -Currently, closing the ChannelFile does nothing but flush -the buffer. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - channel, - mode, - bufsize) -
str -__repr__(self) -
-Returns a string representation of this object, for debugging.
 _read(self, - size) -
-(subclass override) Read data from the stream.
 _write(self, - data) -
-(subclass override) Write data into the stream.
 seek(self, - offset, - whence) -
-Set the file's current position, like stdio's fseek.
    Inherited from BufferedFile
 __del__(self) -
iterator -__iter__(self) -
-Returns an iterator that can be used to iterate over the lines in this -file.
 close(self) -
-Close the file.
 flush(self) -
-Write out any data in the write buffer.
str -next(self) -
-Returns the next line from the input, or raises -StopIteration when EOF is hit.
str -read(self, - size) -
-Read at most size bytes from the file (less if we hit the -end of the file first).
str -readline(self, - size) -
-Read one entire line from the file.
list -readlines(self, - sizehint) -
-Read all remaining lines using readline and return them as a list.
int -tell(self) -
-Return the file's current position.
 write(self, - data) -
-Write data to the file.
 writelines(self, - sequence) -
-Write a sequence of strings to the file.
iterator -xreadlines(self) -
-Identical to iter(f).
 _get_size(self) -
-(subclass override) Return the size of the file.
 _record_newline(self, - newline) -
 _set_mode(self, - mode, - bufsize) -
-Subclasses call this method to initialize the BufferedFile.
 _write_all(self, - data) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - - - - - -
Class Variable Summary
    Inherited from BufferedFile
intSEEK_CUR = 1                                                                     
intSEEK_END = 2                                                                     
intSEEK_SET = 0                                                                     
int_DEFAULT_BUFSIZE = 8192                                                                  

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

__repr__(self) -
(Representation operator) -

- Returns a string representation of this object, for debugging. -
-
Returns:
-
- str -
-
-
Overrides:
-
__builtin__.object.__repr__
-
-
-
- - -
-

_read(self, - size) -

- (subclass override) Read data from the stream. Return - None or raise EOFError to indicate EOF. -
-
Overrides:
-
paramiko.BufferedFile._read (inherited documentation) -
-
-
-
- - -
-

_write(self, - data) -

- (subclass override) Write data into the stream. -
-
Overrides:
-
paramiko.BufferedFile._write (inherited documentation) -
-
-
-
- - -
-

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

- 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. -
           - (type=int) -
whence - - type of movement: 0 = absolute; 1 = relative to the current - position; 2 = relative to the end of the file. -
           - (type=int) -
-
-
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). -

- -
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.DSSKey-class.html b/docs/private/paramiko.DSSKey-class.html deleted file mode 100644 index 9d87ee1..0000000 --- a/docs/private/paramiko.DSSKey-class.html +++ /dev/null @@ -1,486 +0,0 @@ - - - - - paramiko.DSSKey - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class DSSKey -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type DSSKey

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

- -
- -Representation of a DSS key which can be used to sign an verify SSH2 -data. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - msg, - data) -
-Create a new instance of this public key type.
 __hash__(self) -
str -__str__(self) -
-Return a string of an SSH Message made up of the public part(s) of -this key.
bool -can_sign(self) -
-Return True if this key has the private part necessary -for signing data.
DSSKey -generate(bits, - progress_func) -
-Generate a new private DSS key. (Static method) -
int -get_bits(self) -
-Return the number of significant bits in this key.
str -get_name(self) -
-Return the name of this private key implementation.
 sign_ssh_data(self, - rpool, - data) -
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.
 write_private_key_file(self, - filename, - password) -
-Write private key contents into a file.
 _from_private_key_file(self, - filename, - password) -
    Inherited from PKey
int -__cmp__(self, - other) -
-Compare this key to another.
str -_read_private_key_file(self, - tag, - filename, - password) -
-Read an SSH2-format private key file, looking for a string of the type -"BEGIN xxx PRIVATE KEY" for some xxx, -base64-decode the text we find, and return it as a string.
 _write_private_key_file(self, - tag, - filename, - data, - password) -
-Write an SSH2-format private key file in a form that can be read by -paramiko or openssh.
PKey -from_private_key_file(cl, - filename, - password) -
-Create a key object by reading a private key file. (Class method) -
str -get_base64(self) -
-Return a base64 string containing the public part of this key.
str -get_fingerprint(self) -
-Return an MD5 fingerprint of the public part of this key.
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value

- - - - - - - - - - -
Class Variable Summary
    Inherited from PKey
dict_CIPHER_TABLE = {'DES-EDE3-CBC': {'blocksize': 8, 'ciphe... -

- - - - - - -
Instance Method Details
- - -
-

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

- 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. -
           - (type=Message) -
data - - an optional string containing a public key of this type -
           - (type=str) -
-
-
Raises:
-
SSHException - - if a key cannot be created from the data or - msg given, or no key was passed in. -
-
Overrides:
-
paramiko.PKey.__init__ (inherited documentation) -
-
-
-
- - -
-

__str__(self) -
(Informal representation operator) -

- 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:
-
- string representation of an SSH key message. -
           - (type=str) -
-
-
Overrides:
-
paramiko.PKey.__str__ (inherited documentation) -
-
-
-
- - -
-

can_sign(self) -

- Return True if this key has the private part necessary - for signing data. -
-
Returns:
-
- True if this is a private key. -
           - (type=bool) -
-
-
Overrides:
-
paramiko.PKey.can_sign (inherited documentation) -
-
-
-
- - -
-

get_bits(self) -

- Return the number of significant bits in this key. This is useful - for judging the relative security of a key. -
-
Returns:
-
- bits in the key. -
           - (type=int) -
-
-
Overrides:
-
paramiko.PKey.get_bits (inherited documentation) -
-
-
-
- - -
-

get_name(self) -

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

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. -
-
Parameters:
-
data - - the data that was signed. -
           - (type=str) -
msg - - an SSH signature message -
           - (type=Message) -
-
-
Returns:
-
- True if the signature verifies correctly; - False otherwise. -
           - (type=boolean) -
-
-
Overrides:
-
paramiko.PKey.verify_ssh_sig (inherited documentation) -
-
-
-
- - -
-

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

- 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. -
           - (type=str) -
password - - an optional password to use to encrypt the key file. -
           - (type=str) -
-
-
Raises:
-
IOError - - if there was an error writing the file. -
SSHException - - if the key is invalid. -
-
Overrides:
-
paramiko.PKey.write_private_key_file (inherited documentation) -
-
-

Since: fearow -

- -
-
-
- - - - - - -
Static Method Details
- - -
-

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

- Generate a new private DSS key. This factory function can be used to - generate a new host key or authentication key. -
-
Parameters:
-
bits - - number of bits the generated key should be. -
           - (type=int) -
progress_func - - an optional function to call at key points in key generation - (used by pyCrypto.PublicKey). -
           - (type=function) -
-
-
Returns:
-
- new private key -
           - (type=DSSKey) -
-
-

Since: fearow -

- -
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.Message-class.html b/docs/private/paramiko.Message-class.html deleted file mode 100644 index d6934e3..0000000 --- a/docs/private/paramiko.Message-class.html +++ /dev/null @@ -1,654 +0,0 @@ - - - - - paramiko.Message - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class Message -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type Message

- -
-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. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - content) -
-Create a new SSH2 Message.
string -__repr__(self) -
-Returns a string representation of this object, for debugging.
string -__str__(self) -
-Return the byte stream content of this Message, as a string.
 add(self, - *seq) -
-Add a sequence of items to the stream.
 add_boolean(self, - b) -
-Add a boolean value to the stream.
 add_byte(self, - b) -
-Write a single byte to the stream, without any formatting.
 add_bytes(self, - b) -
-Write bytes to the stream, without any formatting.
 add_int(self, - n) -
-Add an integer to the stream.
 add_int64(self, - n) -
-Add a 64-bit int to the stream.
 add_list(self, - l) -
-Add a list of strings to the stream.
 add_mpint(self, - z) -
-Add a long int to the stream, encoded as an infinite-precision -integer.
 add_string(self, - s) -
-Add a string to the stream.
bool -get_boolean(self) -
-Fetch a boolean from the stream.
string -get_byte(self) -
-Return the next byte of the Message, without decomposing it.
string -get_bytes(self, - n) -
-Return the next n bytes of the Message, without -decomposing into an int, string, etc.
int -get_int(self) -
-Fetch an int from the stream.
long -get_int64(self) -
-Fetch a 64-bit int from the stream.
list of strings -get_list(self) -
-Fetch a list of strings from the stream.
long -get_mpint(self) -
-Fetch a long int (mpint) from the stream.
string -get_remainder(self) -
-Return the bytes of this Message that haven't already been parsed and -returned.
string -get_so_far(self) -
-Returns the bytes of this Message that have been parsed and -returned.
string -get_string(self) -
-Fetch a string from the stream.
 rewind(self) -
-Rewind the message to the beginning as if no items had been parsed out -of it yet.
 _add(self, - i) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value

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

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

- Create a new SSH2 Message. -
-
Parameters:
-
content - - the byte stream to use as the Message content (passed in only - when decomposing a Message). -
           - (type=string) -
-
-
Overrides:
-
__builtin__.object.__init__
-
-
-
- - -
-

__repr__(self) -
(Representation operator) -

- Returns a string representation of this object, for debugging. -
-
Returns:
-
- string -
-
-
Overrides:
-
__builtin__.object.__repr__
-
-
-
- - -
-

__str__(self) -
(Informal representation operator) -

- Return the byte stream content of this Message, as a string. -
-
Returns:
-
- the contents of this Message. -
           - (type=string) -
-
-
Overrides:
-
__builtin__.object.__str__
-
-
-
- - -
-

add(self, - *seq) -

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

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

- -
-
- - -
-

add_boolean(self, - b) -

- Add a boolean value to the stream. -
-
Parameters:
-
b - - boolean value to add -
           - (type=bool) -
-
-
-
- - -
-

add_byte(self, - b) -

- Write a single byte to the stream, without any formatting. -
-
Parameters:
-
b - - byte to add -
           - (type=str) -
-
-
-
- - -
-

add_bytes(self, - b) -

- Write bytes to the stream, without any formatting. -
-
Parameters:
-
b - - bytes to add -
           - (type=str) -
-
-
-
- - -
-

add_int(self, - n) -

- Add an integer to the stream. -
-
Parameters:
-
n - - integer to add -
           - (type=int) -
-
-
-
- - -
-

add_int64(self, - n) -

- Add a 64-bit int to the stream. -
-
Parameters:
-
n - - long int to add -
           - (type=long) -
-
-
-
- - -
-

add_list(self, - l) -

- 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 of strings to add -
           - (type=list(str)) -
-
-
-
- - -
-

add_mpint(self, - z) -

- Add a long int to the stream, encoded as an infinite-precision - integer. This method only works on positive numbers. -
-
Parameters:
-
z - - long int to add -
           - (type=long) -
-
-
-
- - -
-

add_string(self, - s) -

- Add a string to the stream. -
-
Parameters:
-
s - - string to add -
           - (type=str) -
-
-
-
- - -
-

get_boolean(self) -

- Fetch a boolean from the stream. -
-
Returns:
-
- True or False (from the - Message). -
           - (type=bool) -
-
-
-
- - -
-

get_byte(self) -

- Return the next byte of the Message, without decomposing it. This is - equivalent to get_bytes(1). -
-
Returns:
-
- the next byte of the Message, or '' if there - aren't any bytes remaining. -
           - (type=string) -
-
-
-
- - -
-

get_bytes(self, - n) -

- Return the next n bytes of the Message, without - decomposing into an int, string, etc. Just the raw bytes are - returned. -
-
Returns:
-
- a string of the next n bytes of the Message, or a - string of n zero bytes, if there aren't - n bytes remaining. -
           - (type=string) -
-
-
-
- - -
-

get_int(self) -

- Fetch an int from the stream. -
-
Returns:
-
- a 32-bit unsigned integer. -
           - (type=int) -
-
-
-
- - -
-

get_int64(self) -

- Fetch a 64-bit int from the stream. -
-
Returns:
-
- a 64-bit unsigned integer. -
           - (type=long) -
-
-
-
- - -
-

get_list(self) -

- Fetch a list of strings from the stream. These are trivially encoded - as comma-separated values in a string. -
-
Returns:
-
- a list of strings. -
           - (type=list of strings) -
-
-
-
- - -
-

get_mpint(self) -

- Fetch a long int (mpint) from the stream. -
-
Returns:
-
- an arbitrary-length integer. -
           - (type=long) -
-
-
-
- - -
-

get_remainder(self) -

- Return the bytes of this Message that haven't already been parsed - and returned. -
-
Returns:
-
- a string of the bytes not parsed yet. -
           - (type=string) -
-
-
-
- - -
-

get_so_far(self) -

- 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:
-
- a string of the bytes parsed so far. -
           - (type=string) -
-
-
-
- - -
-

get_string(self) -

- 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:
-
- a string. -
           - (type=string) -
-
-
-
- - -
-

rewind(self) -

- Rewind the message to the beginning as if no items had been parsed - out of it yet. -
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:46 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.PKey-class.html b/docs/private/paramiko.PKey-class.html deleted file mode 100644 index 3ed3e5f..0000000 --- a/docs/private/paramiko.PKey-class.html +++ /dev/null @@ -1,696 +0,0 @@ - - - - - paramiko.PKey - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class PKey -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type PKey

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

- -
Known Subclasses:
-
- AgentKey, - DSSKey, - RSAKey
- -
- -Base class for public keys. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - msg, - data) -
-Create a new instance of this public key type.
int -__cmp__(self, - other) -
-Compare this key to another.
str -__str__(self) -
-Return a string of an SSH Message made up of the public part(s) of -this key.
str -_read_private_key_file(self, - tag, - filename, - password) -
-Read an SSH2-format private key file, looking for a string of the type -"BEGIN xxx PRIVATE KEY" for some xxx, -base64-decode the text we find, and return it as a string.
 _write_private_key_file(self, - tag, - filename, - data, - password) -
-Write an SSH2-format private key file in a form that can be read by -paramiko or openssh.
bool -can_sign(self) -
-Return True if this key has the private part necessary -for signing data.
PKey -from_private_key_file(cl, - filename, - password) -
-Create a key object by reading a private key file. (Class method) -
str -get_base64(self) -
-Return a base64 string containing the public part of this key.
int -get_bits(self) -
-Return the number of significant bits in this key.
str -get_fingerprint(self) -
-Return an MD5 fingerprint of the public part of this key.
str -get_name(self) -
-Return the name of this private key implementation.
Message -sign_ssh_data(self, - randpool, - data) -
-Sign a blob of data with this private key, and return a Message -representing an SSH signature message.
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.
 write_private_key_file(self, - filename, - password) -
-Write private key contents into a file.
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value

- - - - - - - - -
Class Variable Summary
dict_CIPHER_TABLE = {'DES-EDE3-CBC': {'blocksize': 8, 'ciphe... -

- - - - - - -
Instance Method Details
- - -
-

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

- 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. -
           - (type=Message) -
data - - an optional string containing a public key of this type -
           - (type=str) -
-
-
Raises:
-
SSHException - - if a key cannot be created from the data or - msg given, or no key was passed in. -
-
Overrides:
-
__builtin__.object.__init__
-
-
-
- - -
-

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

- 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 - - key to compare to. -
           - (type=PKey) -
-
-
Returns:
-
- 0 if the two keys are equivalent, non-0 otherwise. -
           - (type=int) -
-
-
-
- - -
-

__str__(self) -
(Informal representation operator) -

- 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:
-
- string representation of an SSH key message. -
           - (type=str) -
-
-
Overrides:
-
__builtin__.object.__str__
-
-
-
- - -
-

_read_private_key_file(self, - tag, - filename, - password=None) -

- Read an SSH2-format private key file, looking for a string of the - type "BEGIN xxx PRIVATE KEY" for some - xxx, base64-decode the text we find, and return it as a - string. 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:
-
tag - - "RSA" or "DSA", - the tag used to mark the data block. -
           - (type=str) -
filename - - name of the file to read. -
           - (type=str) -
password - - an optional password to use to decrypt the key file, if it's - encrypted. -
           - (type=str) -
-
-
Returns:
-
- data blob that makes up the private key. -
           - (type=str) -
-
-
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. -
-
-
- - -
-

_write_private_key_file(self, - tag, - filename, - data, - password=None) -

- Write an SSH2-format private key file in a form that can be read by - paramiko or openssh. If no password is given, the key is written in a - trivially-encoded format (base64) which is completely insecure. If a - password is given, DES-EDE3-CBC is used. -
-
Parameters:
-
tag - - "RSA" or "DSA", - the tag used to mark the data block. -
           - (type=str) -
filename - - name of the file to write. -
           - (type=str) -
data - - data blob that makes up the private key. -
           - (type=str) -
password - - an optional password to use to encrypt the file. -
           - (type=str) -
-
-
Raises:
-
IOError - - if there was an error writing the file. -
-
-
- - -
-

can_sign(self) -

- Return True if this key has the private part necessary - for signing data. -
-
Returns:
-
- True if this is a private key. -
           - (type=bool) -
-
-
-
- - -
-

get_base64(self) -

- 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:
-
- a base64 string containing the public part of the key. -
           - (type=str) -
-
-

Since: fearow -

- -
-
- - -
-

get_bits(self) -

- Return the number of significant bits in this key. This is useful - for judging the relative security of a key. -
-
Returns:
-
- bits in the key. -
           - (type=int) -
-
-
-
- - -
-

get_fingerprint(self) -

- Return an MD5 fingerprint of the public part of this key. Nothing - secret is revealed. -
-
Returns:
-
- a 16-byte string (binary) of the MD5 fingerprint, in SSH - format. -
           - (type=str) -
-
-
-
- - -
-

get_name(self) -

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

sign_ssh_data(self, - randpool, - data) -

- Sign a blob of data with this private key, and return a Message representing an SSH signature - message. -
-
Parameters:
-
randpool - - a secure random number generator. -
           - (type=Crypto.Util.randpool.RandomPool) -
data - - the data to sign. -
           - (type=str) -
-
-
Returns:
-
- an SSH signature message. -
           - (type=Message) -
-
-
-
- - -
-

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. -
-
Parameters:
-
data - - the data that was signed. -
           - (type=str) -
msg - - an SSH signature message -
           - (type=Message) -
-
-
Returns:
-
- True if the signature verifies correctly; - False otherwise. -
           - (type=boolean) -
-
-
-
- - -
-

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

- 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. -
           - (type=str) -
password - - an optional password to use to encrypt the key file. -
           - (type=str) -
-
-
Raises:
-
IOError - - if there was an error writing the file. -
SSHException - - if the key is invalid. -
-

Since: fearow -

- -
-
-
- - - - - - -
Class Method Details
- - -
-

from_private_key_file(cl, - filename, - password=None) -

- 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 - - name of the file to read. -
           - (type=str) -
password - - an optional password to use to decrypt the key file, if it's - encrypted -
           - (type=str) -
-
-
Returns:
-
- a new key object based on the given private key. -
           - (type=PKey) -
-
-
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. -
-

Since: fearow -

- -
-
-
- - - - - - -
Class Variable Details
-
- -

_CIPHER_TABLE

-
-
-
-
-
Type:
-
- dict - -
-
Value:
-
-
-{'DES-EDE3-CBC': {'blocksize': 8,
-                  'cipher': <module 'Crypto.Cipher.DES3' from '/usr/li\
-b/python2.4/site-packages/Crypto/Cipher/DES3.so'>,
-                  'keysize': 24,
-                  'mode': 2}}                                          
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.Packetizer-class.html b/docs/private/paramiko.Packetizer-class.html deleted file mode 100644 index f3be97b..0000000 --- a/docs/private/paramiko.Packetizer-class.html +++ /dev/null @@ -1,441 +0,0 @@ - - - - - paramiko.Packetizer - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class Packetizer -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type Packetizer

- -
-object --+
-         |
-        Packetizer
-

- -
- -Implementation of the base SSH packet protocol. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - socket) -
 __del__(self) -
 _build_packet(self, - payload) -
 _check_keepalive(self) -
 _log(self, - level, - msg) -
 _py22_read_all(self, - n) -
 _py22_read_timeout(self, - timeout) -
 _read_timeout(self, - timeout) -
 _trigger_rekey(self) -
 close(self) -
 get_hexdump(self) -
 get_mac_size_in(self) -
 get_mac_size_out(self) -
 need_rekey(self) -
-Returns True if a new set of keys needs to be -negotiated.
str -read_all(self, - n, - check_rekey) -
-Read as close to N bytes as possible, blocking as long as -necessary.
 read_message(self) -
-Only one thread should ever be in this function (no other locking is -done).
 readline(self, - timeout) -
-Read a line from the socket.
 send_message(self, - data) -
-Write a block of data using the current cipher, as an SSH block.
 set_hexdump(self, - hexdump) -
 set_inbound_cipher(self, - block_engine, - block_size, - mac_engine, - mac_size, - mac_key) -
-Switch inbound data cipher.
 set_inbound_compressor(self, - compressor) -
 set_keepalive(self, - interval, - callback) -
-Turn on/off the callback keepalive.
 set_log(self, - log) -
-Set the python log object to use for logging.
 set_outbound_cipher(self, - block_engine, - block_size, - mac_engine, - mac_size, - mac_key) -
-Switch outbound data cipher.
 set_outbound_compressor(self, - compressor) -
 write_all(self, - out) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - -
Class Variable Summary
intREKEY_BYTES = 1073741824                                                            
intREKEY_PACKETS = 1073741824                                                            

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

need_rekey(self) -

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

read_all(self, - n, - check_rekey=False) -

- Read as close to N bytes as possible, blocking as long as - necessary. -
-
Parameters:
-
n - - number of bytes to read -
           - (type=int) -
-
-
Returns:
-
- the data read -
           - (type=str) -
-
-
Raises:
-
EOFError - - if the socket was closed before all the bytes could be - read -
-
-
- - -
-

read_message(self) -

- Only one thread should ever be in this function (no other locking is - done). -
-
Raises:
-
SSHException - - if the packet is mangled -
NeedRekeyException - - if the transport should rekey -
-
-
- - -
-

readline(self, - timeout) -

- Read a line from the socket. This is done in a fairly inefficient - way, but is only used for initial banner negotiation so it's not worth - optimising. -
-
-
- - -
-

send_message(self, - data) -

- Write a block of data using the current cipher, as an SSH block. -
-
-
- - -
-

set_inbound_cipher(self, - block_engine, - block_size, - mac_engine, - mac_size, - mac_key) -

- Switch inbound data cipher. -
-
-
- - -
-

set_keepalive(self, - interval, - callback) -

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

set_log(self, - log) -

- Set the python log object to use for logging. -
-
-
- - -
-

set_outbound_cipher(self, - block_engine, - block_size, - mac_engine, - mac_size, - mac_key) -

- Switch outbound data cipher. -
-
-
-
- - - - - - -
Class Variable Details
-
- -

REKEY_BYTES

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-1073741824                                                            
-
-
-
-
-
- -

REKEY_PACKETS

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-1073741824                                                            
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:46 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.PasswordRequiredException-class.html b/docs/private/paramiko.PasswordRequiredException-class.html deleted file mode 100644 index 2b7fb88..0000000 --- a/docs/private/paramiko.PasswordRequiredException-class.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - paramiko.PasswordRequiredException - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class PasswordRequiredException -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Class PasswordRequiredException

- -
-Exception --+    
-            |    
- SSHException --+
-                |
-               PasswordRequiredException
-

- -
- -Exception raised when a password is needed to unlock a private key -file. -
- - - - - - - - - - - - - - -
Method Summary
    Inherited from Exception
 __init__(...) -
 __getitem__(...) -
 __str__(...) -

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.RSAKey-class.html b/docs/private/paramiko.RSAKey-class.html deleted file mode 100644 index 0550d72..0000000 --- a/docs/private/paramiko.RSAKey-class.html +++ /dev/null @@ -1,504 +0,0 @@ - - - - - paramiko.RSAKey - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class RSAKey -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type RSAKey

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

- -
- -Representation of an RSA key which can be used to sign and verify SSH2 -data. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - msg, - data) -
-Create a new instance of this public key type.
 __hash__(self) -
str -__str__(self) -
-Return a string of an SSH Message made up of the public part(s) of -this key.
bool -can_sign(self) -
-Return True if this key has the private part necessary -for signing data.
RSAKey -generate(bits, - progress_func) -
-Generate a new private RSA key. (Static method) -
int -get_bits(self) -
-Return the number of significant bits in this key.
str -get_name(self) -
-Return the name of this private key implementation.
 sign_ssh_data(self, - rpool, - data) -
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.
 write_private_key_file(self, - filename, - password) -
-Write private key contents into a file.
 _from_private_key_file(self, - filename, - password) -
 _pkcs1imify(self, - data) -
-turn a 20-byte SHA1 hash into a blob of data as large as the key's N, -using PKCS1's "emsa-pkcs1-v1_5" encoding.
    Inherited from PKey
int -__cmp__(self, - other) -
-Compare this key to another.
str -_read_private_key_file(self, - tag, - filename, - password) -
-Read an SSH2-format private key file, looking for a string of the type -"BEGIN xxx PRIVATE KEY" for some xxx, -base64-decode the text we find, and return it as a string.
 _write_private_key_file(self, - tag, - filename, - data, - password) -
-Write an SSH2-format private key file in a form that can be read by -paramiko or openssh.
PKey -from_private_key_file(cl, - filename, - password) -
-Create a key object by reading a private key file. (Class method) -
str -get_base64(self) -
-Return a base64 string containing the public part of this key.
str -get_fingerprint(self) -
-Return an MD5 fingerprint of the public part of this key.
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value

- - - - - - - - - - -
Class Variable Summary
    Inherited from PKey
dict_CIPHER_TABLE = {'DES-EDE3-CBC': {'blocksize': 8, 'ciphe... -

- - - - - - -
Instance Method Details
- - -
-

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

- 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. -
           - (type=Message) -
data - - an optional string containing a public key of this type -
           - (type=str) -
-
-
Raises:
-
SSHException - - if a key cannot be created from the data or - msg given, or no key was passed in. -
-
Overrides:
-
paramiko.PKey.__init__ (inherited documentation) -
-
-
-
- - -
-

__str__(self) -
(Informal representation operator) -

- 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:
-
- string representation of an SSH key message. -
           - (type=str) -
-
-
Overrides:
-
paramiko.PKey.__str__ (inherited documentation) -
-
-
-
- - -
-

can_sign(self) -

- Return True if this key has the private part necessary - for signing data. -
-
Returns:
-
- True if this is a private key. -
           - (type=bool) -
-
-
Overrides:
-
paramiko.PKey.can_sign (inherited documentation) -
-
-
-
- - -
-

get_bits(self) -

- Return the number of significant bits in this key. This is useful - for judging the relative security of a key. -
-
Returns:
-
- bits in the key. -
           - (type=int) -
-
-
Overrides:
-
paramiko.PKey.get_bits (inherited documentation) -
-
-
-
- - -
-

get_name(self) -

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

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. -
-
Parameters:
-
data - - the data that was signed. -
           - (type=str) -
msg - - an SSH signature message -
           - (type=Message) -
-
-
Returns:
-
- True if the signature verifies correctly; - False otherwise. -
           - (type=boolean) -
-
-
Overrides:
-
paramiko.PKey.verify_ssh_sig (inherited documentation) -
-
-
-
- - -
-

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

- 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. -
           - (type=str) -
password - - an optional password to use to encrypt the key file. -
           - (type=str) -
-
-
Raises:
-
IOError - - if there was an error writing the file. -
SSHException - - if the key is invalid. -
-
Overrides:
-
paramiko.PKey.write_private_key_file (inherited documentation) -
-
-

Since: fearow -

- -
-
- - -
-

_pkcs1imify(self, - data) -

- turn a 20-byte SHA1 hash into a blob of data as large as the key's - N, using PKCS1's "emsa-pkcs1-v1_5" encoding. totally - bizarre. -
-
-
-
- - - - - - -
Static Method Details
- - -
-

generate(bits, - progress_func=None) -

- Generate a new private RSA key. This factory function can be used to - generate a new host key or authentication key. -
-
Parameters:
-
bits - - number of bits the generated key should be. -
           - (type=int) -
progress_func - - an optional function to call at key points in key generation - (used by pyCrypto.PublicKey). -
           - (type=function) -
-
-
Returns:
-
- new private key -
           - (type=RSAKey) -
-
-

Since: fearow -

- -
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.SFTP-class.html b/docs/private/paramiko.SFTP-class.html deleted file mode 100644 index 7ba1c7f..0000000 --- a/docs/private/paramiko.SFTP-class.html +++ /dev/null @@ -1,347 +0,0 @@ - - - - - paramiko.SFTP - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SFTP -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type SFTP

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

- -
- -an alias for SFTPClient for backwards compatability -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
    Inherited from SFTPClient
 __init__(self, - sock) -
-Create an SFTP client from an existing Channel.
 __del__(self) -
 chdir(self, - path) -
-Change the "current directory" of this SFTP session.
 chmod(self, - path, - mode) -
-Change the mode (permissions) of a file.
 chown(self, - path, - uid, - gid) -
-Change the owner (uid) and group (gid) of a -file.
 close(self) -
-Close the SFTP session and its underlying channel.
SFTPFile -file(self, - filename, - mode, - bufsize) -
-Open a file on the remote server.
SFTPClient -from_transport(selfclass, - t) -
-Create an SFTP client channel from an open Transport. (Class method) -
 get(self, - remotepath, - localpath) -
-Copy a remote file (remotepath) from the SFTP server to -the local host as localpath.
str -getcwd(self) -
-Return the "current working directory" for this SFTP -session, as emulated by paramiko.
list of str -listdir(self, - path) -
-Return a list containing the names of the entries in the given -path.
list of SFTPAttributes -listdir_attr(self, - path) -
-Return a list containing SFTPAttributes objects corresponding to -files in the given path.
SFTPAttributes -lstat(self, - path) -
-Retrieve information about a file on the remote system, without -following symbolic links (shortcuts).
 mkdir(self, - path, - mode) -
-Create a folder (directory) named path with numeric mode -mode.
str -normalize(self, - path) -
-Return the normalized path (on the server) of a given path.
SFTPFile -open(self, - filename, - mode, - bufsize) -
-Open a file on the remote server.
 put(self, - localpath, - remotepath) -
-Copy a local file (localpath) to the SFTP server as -remotepath.
str -readlink(self, - path) -
-Return the target of a symbolic link (shortcut).
 remove(self, - path) -
-Remove the file at the given path.
 rename(self, - oldpath, - newpath) -
-Rename a file or folder from oldpath to -newpath.
 rmdir(self, - path) -
-Remove the folder named path.
SFTPAttributes -stat(self, - path) -
-Retrieve information about a file on the remote system.
 symlink(self, - source, - dest) -
-Create a symbolic link (shortcut) of the source path at -destination.
 unlink(self, - path) -
-Remove the file at the given path.
 utime(self, - path, - times) -
-Set the access and modified times of the file specified by -path.
 _adjust_cwd(self, - path) -
-Return an adjusted path if we're emulating a "current working -directory" for the server.
 _async_request(self, - fileobj, - t, - *arg) -
 _convert_status(self, - msg) -
-Raises EOFError or IOError on error status; otherwise does -nothing.
 _finish_responses(self, - fileobj) -
 _read_response(self, - waitfor) -
 _request(self, - t, - *arg) -
    Inherited from BaseSFTP
 _log(self, - level, - msg) -
 _read_all(self, - n) -
 _read_packet(self) -
 _send_packet(self, - t, - packet) -
 _send_server_version(self) -
 _send_version(self) -
 _write_all(self, - out) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.SFTPAttributes-class.html b/docs/private/paramiko.SFTPAttributes-class.html deleted file mode 100644 index a98d008..0000000 --- a/docs/private/paramiko.SFTPAttributes-class.html +++ /dev/null @@ -1,385 +0,0 @@ - - - - - paramiko.SFTPAttributes - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SFTPAttributes -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type SFTPAttributes

- -
-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. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self) -
-Create a new (empty) SFTPAttributes object.
 __repr__(self) -
 __str__(self) -
-create a unix-style long description of the file (like ls -l)
SFTPAttributes -from_stat(cls, - obj, - filename) -
-Create an SFTPAttributes object from an existing stat -object (an object returned by os.stat). (Class method) -
 _debug_str(self) -
 _from_msg(cls, - msg, - filename) -
- (Class method) -
 _pack(self, - msg) -
 _rwx(n, - suid, - sticky) -
- (Static method) -
 _unpack(self, - msg) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value

- - - - - - - - - - - - - - - - -
Class Variable Summary
intFLAG_AMTIME = 8                                                                     
longFLAG_EXTENDED = 2147483648L -
intFLAG_PERMISSIONS = 4                                                                     
intFLAG_SIZE = 1                                                                     
intFLAG_UIDGID = 2                                                                     

- - - - - - -
Instance Method Details
- - -
-

__init__(self) -
(Constructor) -

- Create a new (empty) SFTPAttributes object. All fields will be - empty. -
-
Overrides:
-
__builtin__.object.__init__
-
-
-
- - -
-

__str__(self) -
(Informal representation operator) -

- create a unix-style long description of the file (like ls -l) -
-
Overrides:
-
__builtin__.object.__str__
-
-
-
-
- - - - - - -
Class Method Details
- - -
-

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

- Create an SFTPAttributes object from an existing stat - object (an object returned by os.stat). -
-
Parameters:
-
obj - - an object returned by os.stat (or - equivalent). -
           - (type=object) -
filename - - the filename associated with this file. -
           - (type=str) -
-
-
Returns:
-
- new SFTPAttributes object with the same - attribute fields. -
           - (type=SFTPAttributes) -
-
-
-
-
- - - - - - -
Class Variable Details
-
- -

FLAG_AMTIME

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-8                                                                     
-
-
-
-
-
- -

FLAG_EXTENDED

-
-
-
-
-
Type:
-
- long - -
-
Value:
-
-
-2147483648L                                                            
-
-
-
-
-
- -

FLAG_PERMISSIONS

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-4                                                                     
-
-
-
-
-
- -

FLAG_SIZE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-1                                                                     
-
-
-
-
-
- -

FLAG_UIDGID

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-2                                                                     
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.SFTPClient-class.html b/docs/private/paramiko.SFTPClient-class.html deleted file mode 100644 index a6ed5c0..0000000 --- a/docs/private/paramiko.SFTPClient-class.html +++ /dev/null @@ -1,1091 +0,0 @@ - - - - - paramiko.SFTPClient - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SFTPClient -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type SFTPClient

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

- -
Known Subclasses:
-
- SFTP
- -
- -SFTP client object. SFTPClient is used to open an sftp -session across an open ssh Transport and do remote file -operations. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - sock) -
-Create an SFTP client from an existing Channel.
 __del__(self) -
 chdir(self, - path) -
-Change the "current directory" of this SFTP session.
 chmod(self, - path, - mode) -
-Change the mode (permissions) of a file.
 chown(self, - path, - uid, - gid) -
-Change the owner (uid) and group (gid) of a -file.
 close(self) -
-Close the SFTP session and its underlying channel.
SFTPFile -file(self, - filename, - mode, - bufsize) -
-Open a file on the remote server.
SFTPClient -from_transport(selfclass, - t) -
-Create an SFTP client channel from an open Transport. (Class method) -
 get(self, - remotepath, - localpath) -
-Copy a remote file (remotepath) from the SFTP server to -the local host as localpath.
str -getcwd(self) -
-Return the "current working directory" for this SFTP -session, as emulated by paramiko.
list of str -listdir(self, - path) -
-Return a list containing the names of the entries in the given -path.
list of SFTPAttributes -listdir_attr(self, - path) -
-Return a list containing SFTPAttributes objects corresponding to -files in the given path.
SFTPAttributes -lstat(self, - path) -
-Retrieve information about a file on the remote system, without -following symbolic links (shortcuts).
 mkdir(self, - path, - mode) -
-Create a folder (directory) named path with numeric mode -mode.
str -normalize(self, - path) -
-Return the normalized path (on the server) of a given path.
SFTPFile -open(self, - filename, - mode, - bufsize) -
-Open a file on the remote server.
 put(self, - localpath, - remotepath) -
-Copy a local file (localpath) to the SFTP server as -remotepath.
str -readlink(self, - path) -
-Return the target of a symbolic link (shortcut).
 remove(self, - path) -
-Remove the file at the given path.
 rename(self, - oldpath, - newpath) -
-Rename a file or folder from oldpath to -newpath.
 rmdir(self, - path) -
-Remove the folder named path.
SFTPAttributes -stat(self, - path) -
-Retrieve information about a file on the remote system.
 symlink(self, - source, - dest) -
-Create a symbolic link (shortcut) of the source path at -destination.
 unlink(self, - path) -
-Remove the file at the given path.
 utime(self, - path, - times) -
-Set the access and modified times of the file specified by -path.
 _adjust_cwd(self, - path) -
-Return an adjusted path if we're emulating a "current working -directory" for the server.
 _async_request(self, - fileobj, - t, - *arg) -
 _convert_status(self, - msg) -
-Raises EOFError or IOError on error status; otherwise does -nothing.
 _finish_responses(self, - fileobj) -
 _read_response(self, - waitfor) -
 _request(self, - t, - *arg) -
    Inherited from BaseSFTP
 _log(self, - level, - msg) -
 _read_all(self, - n) -
 _read_packet(self) -
 _send_packet(self, - t, - packet) -
 _send_server_version(self) -
 _send_version(self) -
 _write_all(self, - out) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - -
Instance Method Details
- - -
-

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

-

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:
-
sock - - an open Channel using the - "sftp" subsystem. -
           - (type=Channel) -
-
-
Overrides:
-
paramiko.BaseSFTP.__init__
-
-
-
- - -
-

chdir(self, - path) -

- 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. -
-
Parameters:
-
path - - new current working directory -
           - (type=str) -
-
-
Raises:
-
IOError - - if the requested path doesn't exist on the server -
-

Since: 1.4 -

- -
-
- - -
-

chmod(self, - path, - mode) -

- 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 - - path of the file to change the permissions of. -
           - (type=string) -
mode - - new permissions. -
           - (type=int) -
-
-
-
- - -
-

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

- 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 - - path of the file to change the owner and group of. -
           - (type=string) -
uid - - new owner's uid -
           - (type=int) -
gid - - new group id -
           - (type=int) -
-
-
-
- - -
-

close(self) -

- Close the SFTP session and its underlying channel. -
-

Since: 1.4 -

- -
-
- - -
-

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

-

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 - - name of the file to open. -
           - (type=string) -
mode - - mode (python-style) to open in. -
           - (type=string) -
bufsize - - desired buffering (-1 = default buffer size) -
           - (type=int) -
-
-
Returns:
-
- a file object representing the open file. -
           - (type=SFTPFile) -
-
-
Raises:
-
IOError - - if the file could not be opened. -
-
-
- - -
-

get(self, - remotepath, - localpath) -

- 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 - - the remote file to copy -
           - (type=str) -
localpath - - the destination path on the local host -
           - (type=str) -
-
-

Since: 1.4 -

- -
-
- - -
-

getcwd(self) -

- 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:
-
- the current working directory on the server, or - None -
           - (type=str) -
-
-

Since: 1.4 -

- -
-
- - -
-

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

- 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 - - path to list (defaults to '.') -
           - (type=str) -
-
-
Returns:
-
- list of filenames -
           - (type=list of str) -
-
-
-
- - -
-

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

- 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. -
-
Parameters:
-
path - - path to list (defaults to '.') -
           - (type=str) -
-
-
Returns:
-
- list of attributes -
           - (type=list of SFTPAttributes) -
-
-

Since: 1.2 -

- -
-
- - -
-

lstat(self, - path) -

- Retrieve information about a file on the remote system, without - following symbolic links (shortcuts). This otherwise behaves exactly - the same as stat. -
-
Parameters:
-
path - - the filename to stat. -
           - (type=string) -
-
-
Returns:
-
- an object containing attributes about the given file. -
           - (type=SFTPAttributes) -
-
-
-
- - -
-

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

- 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 - - name of the folder to create. -
           - (type=string) -
mode - - permissions (posix-style) for the newly-created folder. -
           - (type=int) -
-
-
-
- - -
-

normalize(self, - path) -

- 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 - - path to be normalized. -
           - (type=str) -
-
-
Returns:
-
- normalized form of the given path. -
           - (type=str) -
-
-
Raises:
-
IOError - - if the path can't be resolved on the server -
-
-
- - -
-

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

-

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 - - name of the file to open. -
           - (type=string) -
mode - - mode (python-style) to open in. -
           - (type=string) -
bufsize - - desired buffering (-1 = default buffer size) -
           - (type=int) -
-
-
Returns:
-
- a file object representing the open file. -
           - (type=SFTPFile) -
-
-
Raises:
-
IOError - - if the file could not be opened. -
-
-
- - -
-

put(self, - localpath, - remotepath) -

-

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 - - the local file to copy -
           - (type=str) -
remotepath - - the destination path on the SFTP server -
           - (type=str) -
-
-

Since: 1.4 -

- -
-
- - -
-

readlink(self, - path) -

- 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 - - path of the symbolic link file. -
           - (type=str) -
-
-
Returns:
-
- target path. -
           - (type=str) -
-
-
-
- - -
-

remove(self, - path) -

- Remove the file at the given path. -
-
Parameters:
-
path - - path (absolute or relative) of the file to remove. -
           - (type=string) -
-
-
Raises:
-
IOError - - if the path refers to a folder (directory). Use rmdir to remove a folder. -
-
-
- - -
-

rename(self, - oldpath, - newpath) -

- Rename a file or folder from oldpath to - newpath. -
-
Parameters:
-
oldpath - - existing name of the file or folder. -
           - (type=string) -
newpath - - new name for the file or folder. -
           - (type=string) -
-
-
Raises:
-
IOError - - if newpath is a folder, or something else goes - wrong. -
-
-
- - -
-

rmdir(self, - path) -

- Remove the folder named path. -
-
Parameters:
-
path - - name of the folder to remove. -
           - (type=string) -
-
-
-
- - -
-

stat(self, - path) -

-

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 - - the filename to stat. -
           - (type=string) -
-
-
Returns:
-
- an object containing attributes about the given file. -
           - (type=SFTPAttributes) -
-
-
-
- - -
-

symlink(self, - source, - dest) -

- Create a symbolic link (shortcut) of the source path at - destination. -
-
Parameters:
-
source - - path of the original file. -
           - (type=string) -
dest - - path of the newly created symlink. -
           - (type=string) -
-
-
-
- - -
-

unlink(self, - path) -

- Remove the file at the given path. -
-
Parameters:
-
path - - path (absolute or relative) of the file to remove. -
           - (type=string) -
-
-
Raises:
-
IOError - - if the path refers to a folder (directory). Use rmdir to remove a folder. -
-
-
- - -
-

utime(self, - path, - times) -

- 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 - - path of the file to modify. -
           - (type=string) -
times - - None or a tuple of (access time, modified time) - in standard internet epoch time (seconds since 01 January 1970 - GMT). -
           - (type=tuple of int) -
-
-
-
- - -
-

_adjust_cwd(self, - path) -

- Return an adjusted path if we're emulating a "current working - directory" for the server. -
-
-
- - -
-

_convert_status(self, - msg) -

- Raises EOFError or IOError on error status; otherwise does - nothing. -
-
-
-
- - - - - - -
Class Method Details
- - -
-

from_transport(selfclass, - t) -

- Create an SFTP client channel from an open Transport. -
-
Parameters:
-
t - - an open Transport which is already - authenticated. -
           - (type=Transport) -
-
-
Returns:
-
- a new SFTPClient object, referring to an - sftp session (channel) across the transport. -
           - (type=SFTPClient) -
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.SFTPError-class.html b/docs/private/paramiko.SFTPError-class.html deleted file mode 100644 index 2b7aa97..0000000 --- a/docs/private/paramiko.SFTPError-class.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - paramiko.SFTPError - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SFTPError -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Class SFTPError

- -
-Exception --+
-            |
-           SFTPError
-

- -
- - - - - - - - - - - - - - -
Method Summary
    Inherited from Exception
 __init__(...) -
 __getitem__(...) -
 __str__(...) -

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.SFTPFile-class.html b/docs/private/paramiko.SFTPFile-class.html deleted file mode 100644 index 0c59d5f..0000000 --- a/docs/private/paramiko.SFTPFile-class.html +++ /dev/null @@ -1,667 +0,0 @@ - - - - - paramiko.SFTPFile - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SFTPFile -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type SFTPFile

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

- -
- -Proxy object for a file on the remote server, in client mode SFTP. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - sftp, - handle, - mode, - bufsize) -
 __del__(self) -
str -check(self, - hash_algorithm, - offset, - length, - block_size) -
-Ask the server for a hash of a section of this file.
 close(self) -
-Close the file.
float -gettimeout(self) -
-Returns the timeout in seconds (as a float) associated with the socket -or ssh Channel used for this file.
 prefetch(self) -
-Pre-fetch the remaining contents of this file in anticipation of -future read calls.
 seek(self, - offset, - whence) -
-Set the file's current position, like stdio's fseek.
 set_pipelined(self, - pipelined) -
-Turn on/off the pipelining of write operations to this file.
 setblocking(self, - blocking) -
-Set blocking or non-blocking mode on the underiying socket or ssh Channel.
 settimeout(self, - timeout) -
-Set a timeout on read/write operations on the underlying socket or ssh -Channel.
SFTPAttributes -stat(self) -
-Retrieve information about this file from the remote system.
 _async_response(self, - t, - msg) -
 _check_exception(self) -
-if there's a saved exception, raise & clear it
 _get_size(self) -
-(subclass override) Return the size of the file.
 _prefetch(self) -
 _read(self, - size) -
-(subclass override) Read data from the stream.
 _read_prefetch(self, - size) -
 _write(self, - data) -
-(subclass override) Write data into the stream.
    Inherited from BufferedFile
iterator -__iter__(self) -
-Returns an iterator that can be used to iterate over the lines in this -file.
 flush(self) -
-Write out any data in the write buffer.
str -next(self) -
-Returns the next line from the input, or raises -StopIteration when EOF is hit.
str -read(self, - size) -
-Read at most size bytes from the file (less if we hit the -end of the file first).
str -readline(self, - size) -
-Read one entire line from the file.
list -readlines(self, - sizehint) -
-Read all remaining lines using readline and return them as a list.
int -tell(self) -
-Return the file's current position.
 write(self, - data) -
-Write data to the file.
 writelines(self, - sequence) -
-Write a sequence of strings to the file.
iterator -xreadlines(self) -
-Identical to iter(f).
 _record_newline(self, - newline) -
 _set_mode(self, - mode, - bufsize) -
-Subclasses call this method to initialize the BufferedFile.
 _write_all(self, - data) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - - - - - - - -
Class Variable Summary
intMAX_REQUEST_SIZE = 32768                                                                 
    Inherited from BufferedFile
intSEEK_CUR = 1                                                                     
intSEEK_END = 2                                                                     
intSEEK_SET = 0                                                                     
int_DEFAULT_BUFSIZE = 8192                                                                  

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

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

-

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 - - the name of the hash algorithm to use (normally - "sha1" or - "md5") -
           - (type=str) -
offset - - offset into the file to begin hashing (0 means to start from - the beginning) -
           - (type=int or long) -
length - - number of bytes to hash (0 means continue to the end of the - file) -
           - (type=int or long) -
block_size - - number of bytes to hash per result (must not be less than 256; - 0 means to compute only one hash of the entire segment) -
           - (type=int) -
-
-
Returns:
-
- string of bytes representing the hash of each block, - concatenated together -
           - (type=str) -
-
-
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 -

- -
-
- - -
-

close(self, - _async=False) -

- Close the file. Future read and write operations will fail. -
-
Overrides:
-
paramiko.BufferedFile.close (inherited documentation) -
-
-
-
- - -
-

gettimeout(self) -

- 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) -

- 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. -
-

Since: 1.5.1 -

- -
-
- - -
-

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

- 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. -
           - (type=int) -
whence - - type of movement: 0 = absolute; 1 = relative to the current - position; 2 = relative to the end of the file. -
           - (type=int) -
-
-
Raises:
-
IOError - - if the file doesn't support random access. -
-
Overrides:
-
paramiko.BufferedFile.seek (inherited documentation) -
-
-

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). -

- -
-
- - -
-

set_pipelined(self, - pipelined=True) -

-

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 - - True if pipelining should be turned on for this - file; False otherwise -
           - (type=bool) -
-
-

Since: 1.5 -

- -
-
- - -
-

setblocking(self, - blocking) -

- Set blocking or non-blocking mode on the underiying socket or ssh Channel. -
-
Parameters:
-
blocking - - 0 to set non-blocking mode; non-0 to set blocking mode. -
           - (type=int) -
-
-

See Also: Channel.setblocking -

- -
-
- - -
-

settimeout(self, - timeout) -

- Set a timeout on read/write operations on the underlying socket or - ssh Channel. -
-
Parameters:
-
timeout - - seconds to wait for a pending read/write operation before - raising socket.timeout, or None for no - timeout -
           - (type=float) -
-
-

See Also: Channel.settimeout -

- -
-
- - -
-

stat(self) -

- 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:
-
- an object containing attributes about this file. -
           - (type=SFTPAttributes) -
-
-
-
- - -
-

_check_exception(self) -

- if there's a saved exception, raise & clear it -
-
-
- - -
-

_get_size(self) -

- (subclass override) Return the size of the file. This is - called from within _set_mode if the file is opened in append - mode, so the file position can be tracked and seek and tell will work correctly. If the file is - a stream that can't be randomly accessed, you don't need to override - this method, -
-
Overrides:
-
paramiko.BufferedFile._get_size (inherited documentation) -
-
-
-
- - -
-

_read(self, - size) -

- (subclass override) Read data from the stream. Return - None or raise EOFError to indicate EOF. -
-
Overrides:
-
paramiko.BufferedFile._read (inherited documentation) -
-
-
-
- - -
-

_write(self, - data) -

- (subclass override) Write data into the stream. -
-
Overrides:
-
paramiko.BufferedFile._write (inherited documentation) -
-
-
-
-
- - - - - - -
Class Variable Details
-
- -

MAX_REQUEST_SIZE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-32768                                                                 
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.SFTPHandle-class.html b/docs/private/paramiko.SFTPHandle-class.html deleted file mode 100644 index 958dbba..0000000 --- a/docs/private/paramiko.SFTPHandle-class.html +++ /dev/null @@ -1,364 +0,0 @@ - - - - - paramiko.SFTPHandle - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SFTPHandle -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type SFTPHandle

- -
-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. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self) -
int -chattr(self, - attr) -
-Change the attributes of this file.
 close(self) -
-When a client closes a file, this method is called on the handle.
str -read(self, - offset, - length) -
-Read up to length bytes from this file, starting at -position offset.
SFTPAttributes or error - code -stat(self) -
-Return an SFTPAttributes object referring to this -open file, or an error code.
 write(self, - offset, - data) -
-Write data into this file at position -offset.
 _get_name(self) -
 _get_next_files(self) -
-Used by the SFTP server code to retreive a cached directory -listing.
 _set_files(self, - files) -
-Used by the SFTP server code to cache a directory listing.
 _set_name(self, - name) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

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

chattr(self, - attr) -

- 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:
-
attr - - the attributes to change on this file. -
           - (type=SFTPAttributes) -
-
-
Returns:
-
- an error code like SFTP_OK. -
           - (type=int) -
-
-
-
- - -
-

close(self) -

-

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) -

-

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 - - position in the file to start reading from. -
           - (type=int or long) -
length - - number of bytes to attempt to read. -
           - (type=int) -
-
-
Returns:
-
- data read from the file, or an SFTP error code. -
           - (type=str) -
-
-
-
- - -
-

stat(self) -

- 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:
-
- an attributes object for the given file, or an SFTP error code - (like SFTP_PERMISSION_DENIED). -
           - (type=SFTPAttributes or error - code) -
-
-
-
- - -
-

write(self, - offset, - data) -

-

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 - - position in the file to start reading from. -
           - (type=int or long) -
data - - data to write into the file. -
           - (type=str) -
-
-
Returns:
-
- an SFTP error code like SFTP_OK. -
-
-
-
- - -
-

_get_next_files(self) -

- Used by the SFTP server code to retreive a cached directory - listing. -
-
-
- - -
-

_set_files(self, - files) -

- Used by the SFTP server code to cache a directory listing. (In the - SFTP protocol, listing a directory is a multi-stage process requiring a - temporary handle.) -
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.SFTPServer-class.html b/docs/private/paramiko.SFTPServer-class.html deleted file mode 100644 index 07a16b0..0000000 --- a/docs/private/paramiko.SFTPServer-class.html +++ /dev/null @@ -1,511 +0,0 @@ - - - - - paramiko.SFTPServer - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SFTPServer -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type SFTPServer

- -
-object --+            
-         |            
-  _Verbose --+        
-             |        
-        Thread --+    
-                 |    
-  SubsystemHandler --+
-                     |
-        object --+   |
-                 |   |
-          BaseSFTP --+
-                     |
-                    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. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - channel, - name, - server, - sftp_si, - *largs, - **kwargs) -
-The constructor for SFTPServer is meant to be called from within the -Transport as a subsystem handler.
int -convert_errno(e) -
-Convert an errno value (as from an OSError or -IOError) into a standard SFTP result code. (Static method) -
 finish_subsystem(self) -
-Perform any cleanup at the end of a subsystem.
 set_file_attr(filename, - attr) -
-Change a file's attributes on the local filesystem. (Static method) -
 start_subsystem(self, - name, - transport, - channel) -
-Process an ssh subsystem in server mode.
 _check_file(self, - request_number, - msg) -
 _convert_pflags(self, - pflags) -
-convert SFTP-style open() flags to python's os.open() flags
 _open_folder(self, - request_number, - path) -
 _process(self, - t, - request_number, - msg) -
 _read_folder(self, - request_number, - folder) -
 _response(self, - request_number, - t, - *arg) -
 _send_handle_response(self, - request_number, - handle, - folder) -
 _send_status(self, - request_number, - code, - desc) -
    Inherited from BaseSFTP
 _log(self, - level, - msg) -
 _read_all(self, - n) -
 _read_packet(self) -
 _send_packet(self, - t, - packet) -
 _send_server_version(self) -
 _send_version(self) -
 _write_all(self, - out) -
    Inherited from SubsystemHandler
ServerInterface -get_server(self) -
-Return the ServerInterface object associated with this -channel and subsystem.
 _run(self) -
    Inherited from Thread
 __repr__(self) -
 getName(self) -
 isAlive(self) -
 isDaemon(self) -
 join(self, - timeout) -
 run(self) -
 setDaemon(self, - daemonic) -
 setName(self, - name) -
 start(self) -
 _set_daemon(self) -
    Inherited from _Verbose
 _note(self, - format, - *args) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - -
Class Variable Summary
    Inherited from Thread
bool_Thread__initialized = False -

- - - - - - -
Instance Method Details
- - -
-

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

- 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 passed from the Transport. -
           - (type=Channel) -
name - - name of the requested subsystem. -
           - (type=str) -
server - - the server object associated with this channel and - subsystem -
           - (type=ServerInterface) -
sftp_si - - a subclass of SFTPServerInterface to use for - handling individual requests. -
           - (type=class) -
-
-
Overrides:
-
paramiko.BaseSFTP.__init__
-
-
-
- - -
-

finish_subsystem(self) -

- Perform any cleanup at the end of a subsystem. The default - implementation just closes the channel. -
-
Overrides:
-
paramiko.SubsystemHandler.finish_subsystem (inherited documentation) -
-
-

Since: 1.1 -

- -
-
- - -
-

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

-

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. -
           - (type=str) -
transport - - the server-mode Transport. -
           - (type=Transport) -
channel - - the channel associated with this subsystem request. -
           - (type=Channel) -
-
-
Overrides:
-
paramiko.SubsystemHandler.start_subsystem (inherited documentation) -
-
-

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. -

- -
-
- - -
-

_convert_pflags(self, - pflags) -

- convert SFTP-style open() flags to python's os.open() flags -
-
-
-
- - - - - - -
Static Method Details
- - -
-

convert_errno(e) -

- 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 - - an errno code, as from OSError.errno. -
           - (type=int) -
-
-
Returns:
-
- an SFTP error code like SFTP_NO_SUCH_FILE. -
           - (type=int) -
-
-
-
- - -
-

set_file_attr(filename, - attr) -

-

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 - - name of the file to alter (should usually be an absolute - path). -
           - (type=str) -
attr - - attributes to change. -
           - (type=SFTPAttributes) -
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.SFTPServerInterface-class.html b/docs/private/paramiko.SFTPServerInterface-class.html deleted file mode 100644 index a0bd429..0000000 --- a/docs/private/paramiko.SFTPServerInterface-class.html +++ /dev/null @@ -1,744 +0,0 @@ - - - - - paramiko.SFTPServerInterface - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SFTPServerInterface -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type SFTPServerInterface

- -
-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. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - server, - *largs, - **kwargs) -
-Create a new SFTPServerInterface object.
 canonicalize(self, - path) -
-Return the canonical form of a path on the server.
int -chattr(self, - path, - attr) -
-Change the attributes of a file.
list of SFTPAttributes or error - code -list_folder(self, - path) -
-Return a list of files within a given folder.
SFTPAttributes or error - code -lstat(self, - path) -
-Return an SFTPAttributes object for a path on the -server, or an error code.
int -mkdir(self, - path, - attr) -
-Create a new directory with the given attributes.
 open(self, - path, - flags, - attr) -
-Open a file on the server and create a handle for future operations on -that file.
str or error code -readlink(self, - path) -
-Return the target of a symbolic link (or shortcut) on the server.
int -remove(self, - path) -
-Delete a file, if possible.
int -rename(self, - oldpath, - newpath) -
-Rename (or move) a file.
int -rmdir(self, - path) -
-Remove a directory if it exists.
 session_ended(self) -
-The SFTP server session has just ended, either cleanly or via an -exception.
 session_started(self) -
-The SFTP server session has just started.
SFTPAttributes or error - code -stat(self, - path) -
-Return an SFTPAttributes object for a path on the -server, or an error 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.
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

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

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

- Create a new SFTPServerInterface object. This method does nothing by - default and is meant to be overridden by subclasses. -
-
Parameters:
-
server - - the server object associated with this channel and SFTP - subsystem -
           - (type=ServerInterface) -
-
-
Overrides:
-
__builtin__.object.__init__
-
-
-
- - -
-

canonicalize(self, - path) -

-

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) -

- 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 - - requested path (relative or absolute) of the file to - change. -
           - (type=str) -
attr - - requested attributes to change on the file. -
           - (type=SFTPAttributes) -
-
-
Returns:
-
- an error code like SFTP_OK. -
           - (type=int) -
-
-
-
- - -
-

list_folder(self, - path) -

-

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 - - the requested path (relative or absolute) to be listed. -
           - (type=str) -
-
-
Returns:
-
- a list of the files in the given folder, using SFTPAttributes objects. -
           - (type=list of SFTPAttributes or error - code) -
-
-

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) -

- 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 - - the requested path (relative or absolute) to fetch file - statistics for. -
           - (type=str) -
-
-
Returns:
-
- an attributes object for the given file, or an SFTP error code - (like SFTP_PERMISSION_DENIED). -
           - (type=SFTPAttributes or error - code) -
-
-
-
- - -
-

mkdir(self, - path, - attr) -

-

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 - - requested path (relative or absolute) of the new folder. -
           - (type=str) -
attr - - requested attributes of the new folder. -
           - (type=SFTPAttributes) -
-
-
Returns:
-
- an SFTP error code like SFTP_OK. -
           - (type=int) -
-
-
-
- - -
-

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

-

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 - - the requested path (relative or absolute) of the file to be - opened. -
           - (type=str) -
flags - - flags or'd together from the os module indicating - the requested mode for opening the file. -
           - (type=int) -
attr - - requested attributes of the file if it is newly created. -
           - (type=SFTPAttributes) -
-
-
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) -

- 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 - - path (relative or absolute) of the symbolic link. -
           - (type=str) -
-
-
Returns:
-
- the target path of the symbolic link, or an error code like SFTP_NO_SUCH_FILE. -
           - (type=str or error code) -
-
-
-
- - -
-

remove(self, - path) -

- Delete a file, if possible. -
-
Parameters:
-
path - - the requested path (relative or absolute) of the file to - delete. -
           - (type=str) -
-
-
Returns:
-
- an SFTP error code like SFTP_OK. -
           - (type=int) -
-
-
-
- - -
-

rename(self, - oldpath, - newpath) -

- 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 - - the requested path (relative or absolute) of the existing - file. -
           - (type=str) -
newpath - - the requested new path of the file. -
           - (type=str) -
-
-
Returns:
-
- an SFTP error code like SFTP_OK. -
           - (type=int) -
-
-

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) -

- Remove a directory if it exists. The path should refer - to an existing, empty folder -- otherwise this method should return an - error. -
-
Parameters:
-
path - - requested path (relative or absolute) of the folder to - remove. -
           - (type=str) -
-
-
Returns:
-
- an SFTP error code like SFTP_OK. -
           - (type=int) -
-
-
-
- - -
-

session_ended(self) -

- 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) -

- 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) -

- 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 - - the requested path (relative or absolute) to fetch file - statistics for. -
           - (type=str) -
-
-
Returns:
-
- an attributes object for the given file, or an SFTP error code - (like SFTP_PERMISSION_DENIED). -
           - (type=SFTPAttributes or error - code) -
-
-
-
- - -
-

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. -
-
Parameters:
-
target_path - - path (relative or absolute) of the target for this new - symbolic link. -
           - (type=str) -
path - - path (relative or absolute) of the symbolic link to - create. -
           - (type=str) -
-
-
Returns:
-
- an error code like SFTP_OK. -
           - (type=int) -
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.SSHException-class.html b/docs/private/paramiko.SSHException-class.html deleted file mode 100644 index 74d34e6..0000000 --- a/docs/private/paramiko.SSHException-class.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - paramiko.SSHException - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SSHException -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Class SSHException

- -
-Exception --+
-            |
-           SSHException
-

- -
Known Subclasses:
-
- BadAuthenticationType, - PasswordRequiredException, - PartialAuthentication
- -
- -Exception raised by failures in SSH2 protocol negotiation or logic -errors. -
- - - - - - - - - - - - - - -
Method Summary
    Inherited from Exception
 __init__(...) -
 __getitem__(...) -
 __str__(...) -

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.SecurityOptions-class.html b/docs/private/paramiko.SecurityOptions-class.html deleted file mode 100644 index 1763962..0000000 --- a/docs/private/paramiko.SecurityOptions-class.html +++ /dev/null @@ -1,373 +0,0 @@ - - - - - paramiko.SecurityOptions - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SecurityOptions -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type SecurityOptions

- -
-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. -
- -

Since: ivysaur -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - transport) -
str -__repr__(self) -
-Returns a string representation of this object, for debugging.
 _get_ciphers(self) -
 _get_compression(self) -
 _get_digests(self) -
 _get_kex(self) -
 _get_key_types(self) -
 _set(self, - name, - orig, - x) -
 _set_ciphers(self, - x) -
 _set_compression(self, - x) -
 _set_digests(self, - x) -
 _set_kex(self, - x) -
 _set_key_types(self, - x) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

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

- - - - - - - - - - -
Class Variable Summary
list__slots__ = ['ciphers', 'digests', 'key_types', 'kex', '... -
member_descriptor_transport = <member '_transport' of 'SecurityOptions' o... -

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

__repr__(self) -
(Representation operator) -

- Returns a string representation of this object, for debugging. -
-
Returns:
-
- str -
-
-
Overrides:
-
__builtin__.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) -
-
-
-

- - - - - - -
Class Variable Details
-
- -

__slots__

-
-
-
-
-
Type:
-
- list - -
-
Value:
-
-
-['ciphers', 'digests', 'key_types', 'kex', 'compression', '_transport'\
-]                                                                      
-
-
-
-
-
- -

_transport

-
-
-
-
-
Type:
-
- member_descriptor - -
-
Value:
-
-
-<member '_transport' of 'SecurityOptions' objects>                     
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.ServerInterface-class.html b/docs/private/paramiko.ServerInterface-class.html deleted file mode 100644 index 5cf358f..0000000 --- a/docs/private/paramiko.ServerInterface-class.html +++ /dev/null @@ -1,894 +0,0 @@ - - - - - paramiko.ServerInterface - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class ServerInterface -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type ServerInterface

- -
-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.) -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
int or InteractiveQuery -check_auth_interactive(self, - username, - submethods) -
-Begin an interactive authentication challenge, if supported.
int or InteractiveQuery -check_auth_interactive_response(self, - responses) -
-Continue or finish an interactive authentication challenge, if -supported.
int -check_auth_none(self, - username) -
-Determine if a client may open channels with no (further) -authentication.
int -check_auth_password(self, - username, - password) -
-Determine if a given username and password supplied by the client is -acceptable for use in authentication.
int -check_auth_publickey(self, - username, - key) -
-Determine if a given key supplied by the client is acceptable for use -in authentication.
bool -check_channel_exec_request(self, - channel, - command) -
-Determine if a shell command will be executed for the client.
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.
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.
bool -check_channel_shell_request(self, - channel) -
-Determine if a shell will be provided to the client on the given -channel.
bool -check_channel_subsystem_request(self, - channel, - name) -
-Determine if a requested subsystem will be provided to the client on -the given channel.
bool -check_channel_window_change_request(self, - channel, - width, - height, - pixelwidth, - pixelheight) -
-Determine if the pseudo-terminal on the given channel can be -resized.
bool -check_global_request(self, - kind, - msg) -
-Handle a global request of the given kind.
str -get_allowed_auths(self, - username) -
-Return a list of authentication methods supported by the server.
    Inherited from object
 __init__(...) -
-x.__init__(...) initializes x; see x.__class__.__doc__ for -signature
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

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

check_auth_interactive(self, - username, - submethods) -

-

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 - - the username of the authenticating client -
           - (type=str) -
submethods - - a comma-separated list of methods preferred by the client - (usually empty) -
           - (type=str) -
-
-
Returns:
-
- AUTH_FAILED if this auth method - isn't supported; otherwise an object containing queries for the - user -
           - (type=int or InteractiveQuery) -
-
-
-
- - -
-

check_auth_interactive_response(self, - responses) -

-

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 of responses from the client -
           - (type=list(str)) -
-
-
Returns:
-
- 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 -
           - (type=int or InteractiveQuery) -
-
-
-
- - -
-

check_auth_none(self, - username) -

-

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 - - the username of the client. -
           - (type=str) -
-
-
Returns:
-
- AUTH_FAILED if the authentication - fails; AUTH_SUCCESSFUL if it succeeds. -
           - (type=int) -
-
-
-
- - -
-

check_auth_password(self, - username, - password) -

-

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 - - the username of the authenticating client. -
           - (type=str) -
password - - the password given by the client. -
           - (type=str) -
-
-
Returns:
-
- AUTH_FAILED if the authentication - fails; AUTH_SUCCESSFUL if it succeeds; AUTH_PARTIALLY_SUCCESSFUL if the - password auth is successful, but authentication must - continue. -
           - (type=int) -
-
-
-
- - -
-

check_auth_publickey(self, - username, - key) -

-

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 - - the username of the authenticating client -
           - (type=str) -
key - - the key object provided by the client -
           - (type=PKey) -
-
-
Returns:
-
- 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 -
           - (type=int) -
-
-
-
- - -
-

check_channel_exec_request(self, - channel, - command) -

-

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 - - the Channel the request arrived on. -
           - (type=Channel) -
command - - the command to execute. -
           - (type=str) -
-
-
Returns:
-
- 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. -
           - (type=bool) -
-
-

Since: 1.1 -

- -
-
- - -
-

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.

- The default implementation always returns False. -
-
Parameters:
-
channel - - the Channel the pty request arrived - on. -
           - (type=Channel) -
term - - type of terminal requested (for example, - "vt100"). -
           - (type=str) -
width - - width of screen in characters. -
           - (type=int) -
height - - height of screen in characters. -
           - (type=int) -
pixelwidth - - width of screen in pixels, if known (may be 0 if - unknown). -
           - (type=int) -
pixelheight - - height of screen in pixels, if known (may be 0 if - unknown). -
           - (type=int) -
-
-
Returns:
-
- True if the psuedo-terminal has been allocated; - False otherwise. -
           - (type=bool) -
-
-
-
- - -
-

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. 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 - - the kind of channel the client would like to open (usually - "session"). -
           - (type=str) -
chanid - - ID of the channel -
           - (type=int) -
-
-
Returns:
-
- a success or failure code (listed above) -
           - (type=int) -
-
-
-
- - -
-

check_channel_shell_request(self, - channel) -

-

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:
-
channel - - the Channel the request arrived on. -
           - (type=Channel) -
-
-
Returns:
-
- True if this channel is now hooked up to a shell; - False if a shell can't or won't be provided. -
           - (type=bool) -
-
-
-
- - -
-

check_channel_subsystem_request(self, - channel, - name) -

-

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 - - the Channel the pty request arrived - on. -
           - (type=Channel) -
name - - name of the requested subsystem. -
           - (type=str) -
-
-
Returns:
-
- True if this channel is now hooked up to the - requested subsystem; False if that subsystem can't - or won't be provided. -
           - (type=bool) -
-
-

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) -

-

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 - - the Channel the pty request arrived - on. -
           - (type=Channel) -
width - - width of screen in characters. -
           - (type=int) -
height - - height of screen in characters. -
           - (type=int) -
pixelwidth - - width of screen in pixels, if known (may be 0 if - unknown). -
           - (type=int) -
pixelheight - - height of screen in pixels, if known (may be 0 if - unknown). -
           - (type=int) -
-
-
Returns:
-
- True if the terminal was resized; - False if not. -
           - (type=bool) -
-
-
-
- - -
-

check_global_request(self, - kind, - msg) -

-

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 - - the kind of global request being made. -
           - (type=str) -
msg - - any extra arguments to the request. -
           - (type=Message) -
-
-
Returns:
-
- True or a tuple of data if the request was - granted; False otherwise. -
           - (type=bool) -
-
-
-
- - -
-

get_allowed_auths(self, - username) -

-

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 - - the username requesting authentication. -
           - (type=str) -
-
-
Returns:
-
- a comma-separated list of authentication types -
           - (type=str) -
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.SubsystemHandler-class.html b/docs/private/paramiko.SubsystemHandler-class.html deleted file mode 100644 index 1d8116a..0000000 --- a/docs/private/paramiko.SubsystemHandler-class.html +++ /dev/null @@ -1,352 +0,0 @@ - - - - - paramiko.SubsystemHandler - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SubsystemHandler -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type SubsystemHandler

- -
-object --+        
-         |        
-  _Verbose --+    
-             |    
-        Thread --+
-                 |
-                SubsystemHandler
-

- -
Known Subclasses:
-
- SFTPServer
- -
- -

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. -
- -

Since: ivysaur -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - channel, - name, - server) -
-Create a new handler for a channel.
 finish_subsystem(self) -
-Perform any cleanup at the end of a subsystem.
ServerInterface -get_server(self) -
-Return the ServerInterface object associated with this -channel and subsystem.
 start_subsystem(self, - name, - transport, - channel) -
-Process an ssh subsystem in server mode.
 _run(self) -
    Inherited from Thread
 __repr__(self) -
 getName(self) -
 isAlive(self) -
 isDaemon(self) -
 join(self, - timeout) -
 run(self) -
 setDaemon(self, - daemonic) -
 setName(self, - name) -
 start(self) -
 _set_daemon(self) -
    Inherited from _Verbose
 _note(self, - format, - *args) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - -
Class Variable Summary
    Inherited from Thread
bool_Thread__initialized = False -

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

__init__(self, - channel, - name, - server) -
(Constructor) -

- 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 - - the channel associated with this subsystem request. -
           - (type=Channel) -
name - - name of the requested subsystem. -
           - (type=str) -
server - - the server object for the session that started this - subsystem -
           - (type=ServerInterface) -
-
-
Overrides:
-
threading.Thread.__init__
-
-
-
- - -
-

finish_subsystem(self) -

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

Since: 1.1 -

- -
-
- - -
-

get_server(self) -

- Return the ServerInterface object associated with - this channel and subsystem. -
-
Returns:
-
- ServerInterface -
-
-
-
- - -
-

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

-

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. -
           - (type=str) -
transport - - the server-mode Transport. -
           - (type=Transport) -
channel - - the channel associated with this subsystem request. -
           - (type=Channel) -
-
-

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. -

- -
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.Transport-class.html b/docs/private/paramiko.Transport-class.html deleted file mode 100644 index 5b96b90..0000000 --- a/docs/private/paramiko.Transport-class.html +++ /dev/null @@ -1,2151 +0,0 @@ - - - - - paramiko.Transport - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class Transport -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type Transport

- -
-object --+        
-         |        
-  _Verbose --+    
-             |    
-        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). -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - sock) -
-Create a new SSH session over an existing socket, or socket-like -object.
 __del__(self) -
str -__repr__(self) -
-Returns a string representation of this object, for debugging.
Channel -accept(self, - timeout) -
-Return the next channel opened by the client over this transport, in -server mode.
 add_server_key(self, - key) -
-Add a host key to the list of keys used for server mode.
list -auth_interactive(self, - username, - handler, - submethods) -
-Authenticate to the server interactively.
list -auth_none(self, - username) -
-Try to authenticate to the server using no authentication at all.
list -auth_password(self, - username, - password, - event, - fallback) -
-Authenticate to the server using a password.
list -auth_publickey(self, - username, - key, - event) -
-Authenticate to the server using a private key.
 close(self) -
-Close this session, and any open channels that are tied to it.
 connect(self, - hostkey, - username, - password, - pkey) -
-Negotiate an SSH2 session, and optionally verify the server's host key -and authenticate using a password or private key.
Exception -get_exception(self) -
-Return any exception that happened during the last server request.
bool -get_hexdump(self) -
-Return True if the transport is currently logging hex -dumps of protocol traffic.
str -get_log_channel(self) -
-Return the channel name used for this transport's logging.
PKey -get_remote_server_key(self) -
-Return the host key of the server (in client mode).
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.
PKey -get_server_key(self) -
-Return the active host key, in server mode.
string -get_username(self) -
-Return the username this connection is authenticated for.
Message -global_request(self, - kind, - data, - wait) -
-Make a global request to the remote host.
bool -is_active(self) -
-Return true if this session is active (open).
bool -is_authenticated(self) -
-Return true if this session is active and authenticated.
bool -load_server_moduli(filename) -
-(optional) Load a file of prime moduli for use in doing -group-exchange key negotiation in server mode. (Static method) -
Channel -open_channel(self, - kind, - dest_addr, - src_addr) -
-Request a new channel to the server.
Channel -open_session(self) -
-Request a new channel to the server, of type -"session".
SFTPClient -open_sftp_client(self) -
-Create an SFTP client channel from an open transport.
bool -renegotiate_keys(self) -
-Force this session to switch to new keys.
 run(self) -
 send_ignore(self, - bytes) -
-Send a junk packet across the encrypted link.
 set_hexdump(self, - hexdump) -
-Turn on/off logging a hex dump of protocol traffic at DEBUG level in -the logs.
 set_keepalive(self, - interval) -
-Turn on/off keepalive packets (default is off).
 set_log_channel(self, - name) -
-Set the channel for this transport's logging.
 set_subsystem_handler(self, - name, - handler, - *larg, - **kwarg) -
-Set the handler class for a subsystem in server mode.
 start_client(self, - event) -
-Negotiate a new SSH2 session as a client.
 start_server(self, - event, - server) -
-Negotiate a new SSH2 session as a server.
 stop_thread(self) -
 use_compression(self, - compress) -
-Turn on/off compression.
 _activate_inbound(self) -
-switch on newly negotiated encryption parameters for inbound -traffic
 _activate_outbound(self) -
-switch on newly negotiated encryption parameters for outbound -traffic
 _auth_trigger(self) -
 _check_banner(self) -
 _compute_key(self, - id, - nbytes) -
-id is 'A' - 'F' for the various keys used by ssh
 _expect_packet(self, - type) -
-used by a kex object to register the next packet type it expects to -see
 _get_cipher(self, - name, - key, - iv) -
 _get_modulus_pack(self) -
-used by KexGex to find primes for group exchange
 _get_subsystem_handler(self, - name) -
 _log(self, - level, - msg) -
 _negotiate_keys(self, - m) -
 _parse_channel_open(self, - m) -
 _parse_channel_open_failure(self, - m) -
 _parse_channel_open_success(self, - m) -
 _parse_debug(self, - m) -
 _parse_disconnect(self, - m) -
 _parse_global_request(self, - m) -
 _parse_kex_init(self, - m) -
 _parse_newkeys(self, - m) -
 _parse_request_failure(self, - m) -
 _parse_request_success(self, - m) -
 _send_kex_init(self) -
-announce to the other side that we'd like to negotiate keys, and what -kind of key negotiation we support.
 _send_message(self, - data) -
 _send_user_message(self, - data) -
-send a message, but block if we're in key negotiation.
 _set_K_H(self, - k, - h) -
-used by a kex object to set the K (root key) and H (exchange hash)
 _unlink_channel(self, - chanid) -
-used by a Channel to remove itself from the active channel list
 _verify_key(self, - host_key, - sig) -
    Inherited from Thread
 getName(self) -
 isAlive(self) -
 isDaemon(self) -
 join(self, - timeout) -
 setDaemon(self, - daemonic) -
 setName(self, - name) -
 start(self) -
 _set_daemon(self) -
    Inherited from _Verbose
 _note(self, - format, - *args) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Class Variable Summary
dict_channel_handler_table = {96: <unbound method Channel._h... -
dict_cipher_info = {'blowfish-cbc': {'block-size': 8, 'key-s... -
str_CLIENT_ID = 'paramiko_1.5.2' -
dict_compression_info = {'none': (None, None), 'zlib': (<cla... -
dict_handler_table = {80: <function _parse_global_request at... -
dict_kex_info = {'diffie-hellman-group1-sha1': <class 'param... -
dict_key_info = {'ssh-dss': <class 'paramiko.DSSKey'>, 'ssh-... -
dict_mac_info = {'hmac-sha1': {'class': <module 'Crypto.Hash... -
NoneType_modulus_pack = None                                                                  
tuple_preferred_ciphers = ('aes128-cbc', 'blowfish-cbc', 'aes... -
tuple_preferred_compression = ('none',) -
tuple_preferred_kex = ('diffie-hellman-group1-sha1', 'diffie-... -
tuple_preferred_keys = ('ssh-rsa', 'ssh-dss') -
tuple_preferred_macs = ('hmac-sha1', 'hmac-md5', 'hmac-sha1-9... -
str_PROTO_ID = '2.0' -
    Inherited from Thread
bool_Thread__initialized = False -

- - - - - - -
Instance Method Details
- - -
-

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

-

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 - - a socket or socket-like object to create the session over. -
           - (type=socket) -
-
-
Overrides:
-
threading.Thread.__init__
-
-
-
- - -
-

__repr__(self) -
(Representation operator) -

- Returns a string representation of this object, for debugging. -
-
Returns:
-
- str -
-
-
Overrides:
-
threading.Thread.__repr__
-
-
-
- - -
-

accept(self, - timeout=None) -

- 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 - - seconds to wait for a channel, or None to wait - forever -
           - (type=int) -
-
-
Returns:
-
- a new Channel opened by the client -
           - (type=Channel) -
-
-
-
- - -
-

add_server_key(self, - key) -

- Add a host key to the list of keys used for server mode. When - behaving as a server, the host key is used to sign certain packets - during the SSH2 negotiation, so that the client can trust that we are - who we say we are. Because this is used for signing, the key must - contain private key info, not just the public half. Only one key of - each type (RSA or DSS) is kept. -
-
Parameters:
-
key - - the host key to add, usually an RSAKey or DSSKey. -
           - (type=PKey) -
-
-
-
- - -
-

auth_interactive(self, - username, - handler, - submethods='') -

-

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 - - the username to authenticate as -
           - (type=string) -
handler - - a handler for responding to server questions -
           - (type=callable) -
submethods - - a string list of desired submethods (optional) -
           - (type=str) -
-
-
Returns:
-
- list of auth types permissible for the next stage of - authentication (normally empty). -
           - (type=list) -
-
-
Raises:
-
BadAuthenticationType - - if public-key authentication isn't allowed by the server for - this user -
SSHException - - if the authentication failed -
-

Since: 1.5 -

- -
-
- - -
-

auth_none(self, - username) -

- 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 - - the username to authenticate as -
           - (type=string) -
-
-
Returns:
-
- list of auth types permissible for the next stage of - authentication (normally empty) -
           - (type=list) -
-
-
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) -

-

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 - - the username to authenticate as -
           - (type=string) -
password - - the password to authenticate with -
           - (type=string) -
event - - an event to trigger when the authentication attempt is - complete (whether it was successful or not) -
           - (type=threading.Event) -
fallback - - True if an attempt at an automated - "interactive" password auth should be made if the - server doesn't support normal password auth -
           - (type=bool) -
-
-
Returns:
-
- list of auth types permissible for the next stage of - authentication (normally empty) -
           - (type=list) -
-
-
Raises:
-
BadAuthenticationType - - if password authentication isn't allowed by the server for - this user (and no event was passed in) -
SSHException - - if the authentication failed (and no event was passed in) -
-
-
- - -
-

auth_publickey(self, - username, - key, - event=None) -

-

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 - - the username to authenticate as -
           - (type=string) -
key - - the private key to authenticate with -
           - (type=PKey) -
event - - an event to trigger when the authentication attempt is - complete (whether it was successful or not) -
           - (type=threading.Event) -
-
-
Returns:
-
- list of auth types permissible for the next stage of - authentication (normally empty). -
           - (type=list) -
-
-
Raises:
-
BadAuthenticationType - - if public-key authentication isn't allowed by the server for - this user (and no event was passed in). -
SSHException - - if the authentication failed (and no event was passed in). -
-
-
- - -
-

close(self) -

- Close this session, and any open channels that are tied to it. -
-
-
- - -
-

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. 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 - - the host key expected from the server, or None if - you don't want to do host key verification. -
           - (type=PKey) -
username - - the username to authenticate as. -
           - (type=str) -
password - - a password to use for authentication, if you want to use - password authentication; otherwise None. -
           - (type=str) -
pkey - - a private key to use for authentication, if you want to use - private key authentication; otherwise None. -
           - (type=PKey) -
-
-
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. -

- -

Since: doduo -

- -
-
- - -
-

get_exception(self) -

- 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:
-
- an exception, or None if there is no stored - exception. -
           - (type=Exception) -
-
-

Since: 1.1 -

- -
-
- - -
-

get_hexdump(self) -

- Return True if the transport is currently logging hex - dumps of protocol traffic. -
-
Returns:
-
- True if hex dumps are being logged -
           - (type=bool) -
-
-

Since: 1.4 -

- -
-
- - -
-

get_log_channel(self) -

- Return the channel name used for this transport's logging. -
-
Returns:
-
- channel name. -
           - (type=str) -
-
-

Since: 1.2 -

- -
-
- - -
-

get_remote_server_key(self) -

- Return the host key of the server (in client mode). -
-
Returns:
-
- public key of the remote server. -
           - (type=PKey) -
-
-
Raises:
-
SSHException - - if no session is currently active. -
-

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) -

- 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:
-
- an object that can be used to change the preferred algorithms - for encryption, digest (hash), public key, and key exchange. -
           - (type=SecurityOptions) -
-
-

Since: ivysaur -

- -
-
- - -
-

get_server_key(self) -

- Return the active host key, in server mode. After negotiating with - the client, this method will return the negotiated host key. If only - one type of host key was set 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:
-
- host key of the type negotiated by the client, or - None. -
           - (type=PKey) -
-
-
-
- - -
-

get_username(self) -

- Return the username this connection is authenticated for. If the - session is not authenticated (or authentication failed), this method - returns None. -
-
Returns:
-
- username that was authenticated, or None. -
           - (type=string) -
-
-

Since: fearow -

- -
-
- - -
-

global_request(self, - kind, - data=None, - wait=True) -

- Make a global request to the remote host. These are normally - extensions to the SSH2 protocol. -
-
Parameters:
-
kind - - name of the request. -
           - (type=str) -
data - - an optional tuple containing additional data to attach to the - request. -
           - (type=tuple) -
wait - - True if this method should not return until a - response is received; False otherwise. -
           - (type=bool) -
-
-
Returns:
-
- 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. -
           - (type=Message) -
-
-

Since: fearow -

- -
-
- - -
-

is_active(self) -

- Return true if this session is active (open). -
-
Returns:
-
- True if the session is still active (open); False if the - session is closed. -
           - (type=bool) -
-
-
-
- - -
-

is_authenticated(self) -

- Return true if this session is active and authenticated. -
-
Returns:
-
- True if the session is still open and has been authenticated - successfully; False if authentication failed and/or the session - is closed. -
           - (type=bool) -
-
-
-
- - -
-

open_channel(self, - kind, - dest_addr=None, - src_addr=None) -

- 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 - - the kind of channel requested (usually - "session", - "forwarded-tcpip" or - "direct-tcpip"). -
           - (type=str) -
dest_addr - - the destination address of this port forwarding, if - kind is "forwarded-tcpip" or - "direct-tcpip" (ignored for other channel - types). -
           - (type=(str, int)) -
src_addr - - the source address of this port forwarding, if - kind is "forwarded-tcpip" or - "direct-tcpip". -
           - (type=(str, int)) -
-
-
Returns:
-
- a new Channel on success, or - None if the request is rejected or the session ends - prematurely. -
           - (type=Channel) -
-
-
-
- - -
-

open_session(self) -

- Request a new channel to the server, of type - "session". This is just an alias for - open_channel('session'). -
-
Returns:
-
- a new Channel on success, or - None if the request is rejected or the session ends - prematurely. -
           - (type=Channel) -
-
-
-
- - -
-

open_sftp_client(self) -

- 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:
-
- a new SFTPClient object, referring to an - sftp session (channel) across this transport -
           - (type=SFTPClient) -
-
-
-
- - -
-

renegotiate_keys(self) -

- Force this session to switch to new keys. Normally this is done - automatically after the session hits a certain number of packets or - bytes sent or received, but this method gives you the option of forcing - new keys whenever you want. Negotiating new keys causes a pause in - traffic both ways as the two sides swap keys and do computations. This - method returns when the session has switched to new keys, or the - session has died mid-negotiation. -
-
Returns:
-
- True if the renegotiation was successful, and the link is - using new keys; False if the session dropped during - renegotiation. -
           - (type=bool) -
-
-
-
- - -
-

send_ignore(self, - bytes=None) -

- Send a junk packet across the encrypted link. This is sometimes used - to add "noise" to a connection to confuse would-be attackers. - It can also be used as a keep-alive for long lived connections - traversing firewalls. -
-
Parameters:
-
bytes - - the number of random bytes to send in the payload of the - ignored packet -- defaults to a random number from 10 to 41. -
           - (type=int) -
-
-

Since: fearow -

- -
-
- - -
-

set_hexdump(self, - hexdump) -

- 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 - - True to log protocol traffix (in hex) to the log; - False otherwise. -
           - (type=bool) -
-
-
-
- - -
-

set_keepalive(self, - interval) -

- 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 - - seconds to wait before sending a keepalive packet (or 0 to - disable keepalives). -
           - (type=int) -
-
-

Since: fearow -

- -
-
- - -
-

set_log_channel(self, - name) -

- 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 - - new channel name for logging. -
           - (type=str) -
-
-

Since: 1.1 -

- -
-
- - -
-

set_subsystem_handler(self, - name, - handler, - *larg, - **kwarg) -

-

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 - - name of the subsystem. -
           - (type=str) -
handler - - subclass of SubsystemHandler that handles this - subsystem. -
           - (type=class) -
-
-
-
- - -
-

start_client(self, - event=None) -

-

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 - - an event to trigger when negotiation is complete - (optional) -
           - (type=threading.Event) -
-
-
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) -

-

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 - - an event to trigger when negotiation is complete. -
           - (type=threading.Event) -
server - - an object used to perform authentication and create Channels. -
           - (type=server.ServerInterface) -
-
-
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) -

- 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 and is not fully - tested. -
-
Parameters:
-
compress - - True to ask the remote client/server to compress - traffic; False to refuse compression -
           - (type=bool) -
-
-

Since: 1.5.2 -

- -
-
- - -
-

_activate_inbound(self) -

- switch on newly negotiated encryption parameters for inbound - traffic -
-
-
- - -
-

_activate_outbound(self) -

- switch on newly negotiated encryption parameters for outbound - traffic -
-
-
- - -
-

_compute_key(self, - id, - nbytes) -

- id is 'A' - 'F' for the various keys used by ssh -
-
-
- - -
-

_expect_packet(self, - type) -

- used by a kex object to register the next packet type it expects to - see -
-
-
- - -
-

_get_modulus_pack(self) -

- used by KexGex to find primes for group exchange -
-
-
- - -
-

_send_kex_init(self) -

- announce to the other side that we'd like to negotiate keys, and - what kind of key negotiation we support. -
-
-
- - -
-

_send_user_message(self, - data) -

- send a message, but block if we're in key negotiation. this is used - for user-initiated requests. -
-
-
- - -
-

_set_K_H(self, - k, - h) -

- used by a kex object to set the K (root key) and H (exchange - hash) -
-
-
- - -
-

_unlink_channel(self, - chanid) -

- used by a Channel to remove itself from the active channel list -
-
-
-
- - - - - - -
Static Method Details
- - -
-

load_server_moduli(filename=None) -

-

(optional) Load a file of prime moduli for use in doing - group-exchange key negotiation in server mode. It's a rather obscure - option and can be safely ignored.

- In server mode, the remote client may request - "group-exchange" key negotiation, which asks the server to - send a random prime number that fits certain criteria. These primes are - pretty difficult to compute, so they can't be generated on demand. But - many systems contain a file of suitable primes (usually named something - like /etc/ssh/moduli). If you call - load_server_moduli and it returns True, then - this file of primes has been loaded and we will support - "group-exchange" in server mode. Otherwise server mode will - just claim that it doesn't support that method of key negotiation. -
-
Parameters:
-
filename - - optional path to the moduli file, if you happen to know that - it's not in a standard location. -
           - (type=str) -
-
-
Returns:
-
- True if a moduli file was successfully loaded; False - otherwise. -
           - (type=bool) -
-
-

Note: This has no effect when used in client mode. -

- -

Since: doduo -

- -
-
-
- - - - - - -
Class Variable Details
-
- -

_channel_handler_table

-
-
-
-
-
Type:
-
- dict - -
-
Value:
-
-
-{93: <unbound method Channel._window_adjust>,
- 94: <unbound method Channel._feed>,
- 95: <unbound method Channel._feed_extended>,
- 96: <unbound method Channel._handle_eof>,
- 97: <unbound method Channel._handle_close>,
- 98: <unbound method Channel._handle_request>,
- 99: <unbound method Channel._request_success>,
- 100: <unbound method Channel._request_failed>}                        
-
-
-
-
-
- -

_cipher_info

-
-
-
-
-
Type:
-
- dict - -
-
Value:
-
-
-{'3des-cbc': {'block-size': 8,
-              'class': <module 'Crypto.Cipher.DES3' from '/usr/lib/pyt\
-hon2.4/site-packages/Crypto/Cipher/DES3.so'>,
-              'key-size': 24,
-              'mode': 2},
- 'aes128-cbc': {'block-size': 16,
-                'class': <module 'Crypto.Cipher.AES' from '/usr/lib/py\
-thon2.4/site-packages/Crypto/Cipher/AES.so'>,
-...                                                                    
-
-
-
-
-
- -

_CLIENT_ID

-
-
-
-
-
Type:
-
- str - -
-
Value:
-
-
-'paramiko_1.5.2'                                                       
-
-
-
-
-
- -

_compression_info

-
-
-
-
-
Type:
-
- dict - -
-
Value:
-
-
-{'none': (None, None),
- 'zlib': (<class 'paramiko.compress.ZlibCompressor'>,
-          <class 'paramiko.compress.ZlibDecompressor'>),
- 'zlib@openssh.com': (<class 'paramiko.compress.ZlibCompressor'>,
-                      <class 'paramiko.compress.ZlibDecompressor'>)}   
-
-
-
-
-
- -

_handler_table

-
-
-
-
-
Type:
-
- dict - -
-
Value:
-
-
-{20: <function _negotiate_keys at 0xb7b13dbc>,
- 21: <function _parse_newkeys at 0xb7b13f44>,
- 80: <function _parse_global_request at 0xb7b13fb4>,
- 81: <function _parse_request_success at 0xb7b1e02c>,
- 82: <function _parse_request_failure at 0xb7b1e064>,
- 90: <function _parse_channel_open at 0xb7b1e10c>,
- 91: <function _parse_channel_open_success at 0xb7b1e09c>,
- 92: <function _parse_channel_open_failure at 0xb7b1e0d4>}             
-
-
-
-
-
- -

_kex_info

-
-
-
-
-
Type:
-
- dict - -
-
Value:
-
-
-{'diffie-hellman-group-exchange-sha1': <class 'paramiko.kex_gex.KexGex\
-'>,
- 'diffie-hellman-group1-sha1': <class 'paramiko.kex_group1.KexGroup1'>\
-}                                                                      
-
-
-
-
-
- -

_key_info

-
-
-
-
-
Type:
-
- dict - -
-
Value:
-
-
-{'ssh-dss': <class 'paramiko.DSSKey'>, 'ssh-rsa': <class 'paramiko.RSA\
-Key'>}                                                                 
-
-
-
-
-
- -

_mac_info

-
-
-
-
-
Type:
-
- dict - -
-
Value:
-
-
-{'hmac-md5': {'class': <module 'Crypto.Hash.MD5' from '/usr/lib/python\
-2.4/site-packages/Crypto/Hash/MD5.pyc'>,
-              'size': 16},
- 'hmac-md5-96': {'class': <module 'Crypto.Hash.MD5' from '/usr/lib/pyt\
-hon2.4/site-packages/Crypto/Hash/MD5.pyc'>,
-                 'size': 12},
- 'hmac-sha1': {'class': <module 'Crypto.Hash.SHA' from '/usr/lib/pytho\
-n2.4/site-packages/Crypto/Hash/SHA.pyc'>,
-...                                                                    
-
-
-
-
-
- -

_modulus_pack

-
-
-
-
-
Type:
-
- NoneType - -
-
Value:
-
-
-None                                                                  
-
-
-
-
-
- -

_preferred_ciphers

-
-
-
-
-
Type:
-
- tuple - -
-
Value:
-
-
-('aes128-cbc', 'blowfish-cbc', 'aes256-cbc', '3des-cbc')               
-
-
-
-
-
- -

_preferred_compression

-
-
-
-
-
Type:
-
- tuple - -
-
Value:
-
-
-('none',)                                                              
-
-
-
-
-
- -

_preferred_kex

-
-
-
-
-
Type:
-
- tuple - -
-
Value:
-
-
-('diffie-hellman-group1-sha1', 'diffie-hellman-group-exchange-sha1')   
-
-
-
-
-
- -

_preferred_keys

-
-
-
-
-
Type:
-
- tuple - -
-
Value:
-
-
-('ssh-rsa', 'ssh-dss')                                                 
-
-
-
-
-
- -

_preferred_macs

-
-
-
-
-
Type:
-
- tuple - -
-
Value:
-
-
-('hmac-sha1', 'hmac-md5', 'hmac-sha1-96', 'hmac-md5-96')               
-
-
-
-
-
- -

_PROTO_ID

-
-
-
-
-
Type:
-
- str - -
-
Value:
-
-
-'2.0'                                                                  
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.agent-module.html b/docs/private/paramiko.agent-module.html deleted file mode 100644 index 889d9ea..0000000 --- a/docs/private/paramiko.agent-module.html +++ /dev/null @@ -1,164 +0,0 @@ - - - - - paramiko.agent - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module agent -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.agent

- -SSH Agent interface for Unix clients. -
- - - - - - - - - - - - - -
Variable Summary
intSSH2_AGENT_IDENTITIES_ANSWER = 12                                                                    
intSSH2_AGENT_SIGN_RESPONSE = 14                                                                    
intSSH2_AGENTC_REQUEST_IDENTITIES = 11                                                                    
intSSH2_AGENTC_SIGN_REQUEST = 13                                                                    

- - - - - - -
Variable Details
-
- -

SSH2_AGENT_IDENTITIES_ANSWER

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-12                                                                    
-
-
-
-
-
- -

SSH2_AGENT_SIGN_RESPONSE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-14                                                                    
-
-
-
-
-
- -

SSH2_AGENTC_REQUEST_IDENTITIES

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-11                                                                    
-
-
-
-
-
- -

SSH2_AGENTC_SIGN_REQUEST

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-13                                                                    
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.auth_handler-module.html b/docs/private/paramiko.auth_handler-module.html deleted file mode 100644 index 464b764..0000000 --- a/docs/private/paramiko.auth_handler-module.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - paramiko.auth_handler - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module auth_handler -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.auth_handler

- -AuthHandler -
- - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.ber-module.html b/docs/private/paramiko.ber-module.html deleted file mode 100644 index 03d907b..0000000 --- a/docs/private/paramiko.ber-module.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - paramiko.ber - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module ber -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.ber

- - - - - - - - -
Classes
- BERRobey's tiny little attempt at a BER decoder.

- - - - - - - - -
Exceptions
- BERException 

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.ber.BER-class.html b/docs/private/paramiko.ber.BER-class.html deleted file mode 100644 index 79b10ba..0000000 --- a/docs/private/paramiko.ber.BER-class.html +++ /dev/null @@ -1,145 +0,0 @@ - - - - - paramiko.ber.BER - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module ber :: - Class BER -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type BER

- -
-object --+
-         |
-        BER
-

- -
- -Robey's tiny little attempt at a BER decoder. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - content) -
 __repr__(self) -
 __str__(self) -
 decode(self) -
 decode_next(self) -
 decode_sequence(data) -
- (Static method) -
 encode(self, - x) -
 encode_sequence(data) -
- (Static method) -
 encode_tlv(self, - ident, - val) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.ber.BERException-class.html b/docs/private/paramiko.ber.BERException-class.html deleted file mode 100644 index 9ae6fff..0000000 --- a/docs/private/paramiko.ber.BERException-class.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - - paramiko.ber.BERException - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module ber :: - Class BERException -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Class BERException

- -
-Exception --+
-            |
-           BERException
-

- -
- - - - - - - - - - - - - - -
Method Summary
    Inherited from Exception
 __init__(...) -
 __getitem__(...) -
 __str__(...) -

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.channel-module.html b/docs/private/paramiko.channel-module.html deleted file mode 100644 index bf3adc0..0000000 --- a/docs/private/paramiko.channel-module.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - - paramiko.channel - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module channel -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.channel

- -Abstraction for an SSH2 channel. -
- - - - - - - -
Classes
- ChannelStderrFile 

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.channel.ChannelStderrFile-class.html b/docs/private/paramiko.channel.ChannelStderrFile-class.html deleted file mode 100644 index 646d24a..0000000 --- a/docs/private/paramiko.channel.ChannelStderrFile-class.html +++ /dev/null @@ -1,282 +0,0 @@ - - - - - paramiko.channel.ChannelStderrFile - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module channel :: - Class ChannelStderrFile -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type ChannelStderrFile

- -
-  object --+        
-           |        
-BufferedFile --+    
-               |    
-     ChannelFile --+
-                   |
-                  ChannelStderrFile
-

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - channel, - mode, - bufsize) -
 _read(self, - size) -
-(subclass override) Read data from the stream.
 _write(self, - data) -
-(subclass override) Write data into the stream.
    Inherited from ChannelFile
str -__repr__(self) -
-Returns a string representation of this object, for debugging.
 seek(self, - offset, - whence) -
-Set the file's current position, like stdio's fseek.
    Inherited from BufferedFile
 __del__(self) -
iterator -__iter__(self) -
-Returns an iterator that can be used to iterate over the lines in this -file.
 close(self) -
-Close the file.
 flush(self) -
-Write out any data in the write buffer.
str -next(self) -
-Returns the next line from the input, or raises -StopIteration when EOF is hit.
str -read(self, - size) -
-Read at most size bytes from the file (less if we hit the -end of the file first).
str -readline(self, - size) -
-Read one entire line from the file.
list -readlines(self, - sizehint) -
-Read all remaining lines using readline and return them as a list.
int -tell(self) -
-Return the file's current position.
 write(self, - data) -
-Write data to the file.
 writelines(self, - sequence) -
-Write a sequence of strings to the file.
iterator -xreadlines(self) -
-Identical to iter(f).
 _get_size(self) -
-(subclass override) Return the size of the file.
 _record_newline(self, - newline) -
 _set_mode(self, - mode, - bufsize) -
-Subclasses call this method to initialize the BufferedFile.
 _write_all(self, - data) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - - - - - -
Class Variable Summary
    Inherited from BufferedFile
intSEEK_CUR = 1                                                                     
intSEEK_END = 2                                                                     
intSEEK_SET = 0                                                                     
int_DEFAULT_BUFSIZE = 8192                                                                  

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

_read(self, - size) -

- (subclass override) Read data from the stream. Return - None or raise EOFError to indicate EOF. -
-
Overrides:
-
paramiko.ChannelFile._read (inherited documentation) -
-
-
-
- - -
-

_write(self, - data) -

- (subclass override) Write data into the stream. -
-
Overrides:
-
paramiko.ChannelFile._write (inherited documentation) -
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:46 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.common-module.html b/docs/private/paramiko.common-module.html deleted file mode 100644 index 5422192..0000000 --- a/docs/private/paramiko.common-module.html +++ /dev/null @@ -1,1013 +0,0 @@ - - - - - paramiko.common - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module common -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.common

- -Common constants and global variables. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Variable Summary
intAUTH_FAILED = 2                                                                     
intAUTH_PARTIALLY_SUCCESSFUL = 1                                                                     
intAUTH_SUCCESSFUL = 0                                                                     
dictCONNECTION_FAILED_CODE = {1: 'Administratively prohibite... -
intCRITICAL = 50                                                                    
intDEBUG = 10                                                                    
intDISCONNECT_AUTH_CANCELLED_BY_USER = 13                                                                    
intDISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14                                                                    
intDISCONNECT_SERVICE_NOT_AVAILABLE = 7                                                                     
intERROR = 40                                                                    
intINFO = 20                                                                    
intMSG_CHANNEL_CLOSE = 97                                                                    
intMSG_CHANNEL_DATA = 94                                                                    
intMSG_CHANNEL_EOF = 96                                                                    
intMSG_CHANNEL_EXTENDED_DATA = 95                                                                    
intMSG_CHANNEL_FAILURE = 100                                                                   
intMSG_CHANNEL_OPEN = 90                                                                    
intMSG_CHANNEL_OPEN_FAILURE = 92                                                                    
intMSG_CHANNEL_OPEN_SUCCESS = 91                                                                    
intMSG_CHANNEL_REQUEST = 98                                                                    
intMSG_CHANNEL_SUCCESS = 99                                                                    
intMSG_CHANNEL_WINDOW_ADJUST = 93                                                                    
intMSG_DEBUG = 4                                                                     
intMSG_DISCONNECT = 1                                                                     
intMSG_GLOBAL_REQUEST = 80                                                                    
intMSG_IGNORE = 2                                                                     
intMSG_KEXINIT = 20                                                                    
dictMSG_NAMES = {1: 'disconnect', 2: 'ignore', 3: 'unimpleme... -
intMSG_NEWKEYS = 21                                                                    
intMSG_REQUEST_FAILURE = 82                                                                    
intMSG_REQUEST_SUCCESS = 81                                                                    
intMSG_SERVICE_ACCEPT = 6                                                                     
intMSG_SERVICE_REQUEST = 5                                                                     
intMSG_UNIMPLEMENTED = 3                                                                     
intMSG_USERAUTH_BANNER = 53                                                                    
intMSG_USERAUTH_FAILURE = 51                                                                    
intMSG_USERAUTH_INFO_REQUEST = 60                                                                    
intMSG_USERAUTH_INFO_RESPONSE = 61                                                                    
intMSG_USERAUTH_PK_OK = 60                                                                    
intMSG_USERAUTH_REQUEST = 50                                                                    
intMSG_USERAUTH_SUCCESS = 52                                                                    
intWARNING = 30                                                                    

- - - - - - -
Variable Details
-
- -

AUTH_FAILED

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-2                                                                     
-
-
-
-
-
- -

AUTH_PARTIALLY_SUCCESSFUL

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-1                                                                     
-
-
-
-
-
- -

AUTH_SUCCESSFUL

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-0                                                                     
-
-
-
-
-
- -

CONNECTION_FAILED_CODE

-
-
-
-
-
Type:
-
- dict - -
-
Value:
-
-
-{1: 'Administratively prohibited',
- 2: 'Connect failed',
- 3: 'Unknown channel type',
- 4: 'Resource shortage'}                                               
-
-
-
-
-
- -

CRITICAL

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-50                                                                    
-
-
-
-
-
- -

DEBUG

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-10                                                                    
-
-
-
-
-
- -

DISCONNECT_AUTH_CANCELLED_BY_USER

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-13                                                                    
-
-
-
-
-
- -

DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-14                                                                    
-
-
-
-
-
- -

DISCONNECT_SERVICE_NOT_AVAILABLE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-7                                                                     
-
-
-
-
-
- -

ERROR

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-40                                                                    
-
-
-
-
-
- -

INFO

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-20                                                                    
-
-
-
-
-
- -

MSG_CHANNEL_CLOSE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-97                                                                    
-
-
-
-
-
- -

MSG_CHANNEL_DATA

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-94                                                                    
-
-
-
-
-
- -

MSG_CHANNEL_EOF

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-96                                                                    
-
-
-
-
-
- -

MSG_CHANNEL_EXTENDED_DATA

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-95                                                                    
-
-
-
-
-
- -

MSG_CHANNEL_FAILURE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-100                                                                   
-
-
-
-
-
- -

MSG_CHANNEL_OPEN

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-90                                                                    
-
-
-
-
-
- -

MSG_CHANNEL_OPEN_FAILURE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-92                                                                    
-
-
-
-
-
- -

MSG_CHANNEL_OPEN_SUCCESS

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-91                                                                    
-
-
-
-
-
- -

MSG_CHANNEL_REQUEST

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-98                                                                    
-
-
-
-
-
- -

MSG_CHANNEL_SUCCESS

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-99                                                                    
-
-
-
-
-
- -

MSG_CHANNEL_WINDOW_ADJUST

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-93                                                                    
-
-
-
-
-
- -

MSG_DEBUG

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-4                                                                     
-
-
-
-
-
- -

MSG_DISCONNECT

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-1                                                                     
-
-
-
-
-
- -

MSG_GLOBAL_REQUEST

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-80                                                                    
-
-
-
-
-
- -

MSG_IGNORE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-2                                                                     
-
-
-
-
-
- -

MSG_KEXINIT

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-20                                                                    
-
-
-
-
-
- -

MSG_NAMES

-
-
-
-
-
Type:
-
- dict - -
-
Value:
-
-
-{1: 'disconnect',
- 2: 'ignore',
- 3: 'unimplemented',
- 4: 'debug',
- 5: 'service-request',
- 6: 'service-accept',
- 20: 'kexinit',
- 21: 'newkeys',
-...                                                                    
-
-
-
-
-
- -

MSG_NEWKEYS

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-21                                                                    
-
-
-
-
-
- -

MSG_REQUEST_FAILURE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-82                                                                    
-
-
-
-
-
- -

MSG_REQUEST_SUCCESS

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-81                                                                    
-
-
-
-
-
- -

MSG_SERVICE_ACCEPT

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-6                                                                     
-
-
-
-
-
- -

MSG_SERVICE_REQUEST

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-5                                                                     
-
-
-
-
-
- -

MSG_UNIMPLEMENTED

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-3                                                                     
-
-
-
-
-
- -

MSG_USERAUTH_BANNER

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-53                                                                    
-
-
-
-
-
- -

MSG_USERAUTH_FAILURE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-51                                                                    
-
-
-
-
-
- -

MSG_USERAUTH_INFO_REQUEST

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-60                                                                    
-
-
-
-
-
- -

MSG_USERAUTH_INFO_RESPONSE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-61                                                                    
-
-
-
-
-
- -

MSG_USERAUTH_PK_OK

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-60                                                                    
-
-
-
-
-
- -

MSG_USERAUTH_REQUEST

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-50                                                                    
-
-
-
-
-
- -

MSG_USERAUTH_SUCCESS

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-52                                                                    
-
-
-
-
-
- -

WARNING

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-30                                                                    
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.compress-module.html b/docs/private/paramiko.compress-module.html deleted file mode 100644 index aa60bc4..0000000 --- a/docs/private/paramiko.compress-module.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - - paramiko.compress - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module compress -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.compress

- -Compression implementations for a Transport. -
- - - - - - - - - -
Classes
- ZlibCompressor 
- ZlibDecompressor 

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:46 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.compress.ZlibCompressor-class.html b/docs/private/paramiko.compress.ZlibCompressor-class.html deleted file mode 100644 index ac848f4..0000000 --- a/docs/private/paramiko.compress.ZlibCompressor-class.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - paramiko.compress.ZlibCompressor - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module compress :: - Class ZlibCompressor -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type ZlibCompressor

- -
-object --+
-         |
-        ZlibCompressor
-

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self) -
 __call__(self, - data) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.compress.ZlibDecompressor-class.html b/docs/private/paramiko.compress.ZlibDecompressor-class.html deleted file mode 100644 index 63e0b1f..0000000 --- a/docs/private/paramiko.compress.ZlibDecompressor-class.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - paramiko.compress.ZlibDecompressor - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module compress :: - Class ZlibDecompressor -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type ZlibDecompressor

- -
-object --+
-         |
-        ZlibDecompressor
-

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self) -
 __call__(self, - data) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.dsskey-module.html b/docs/private/paramiko.dsskey-module.html deleted file mode 100644 index 370a1c8..0000000 --- a/docs/private/paramiko.dsskey-module.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - paramiko.dsskey - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module dsskey -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.dsskey

- -DSSKey -
- - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.file-module.html b/docs/private/paramiko.file-module.html deleted file mode 100644 index 676e3ce..0000000 --- a/docs/private/paramiko.file-module.html +++ /dev/null @@ -1,230 +0,0 @@ - - - - - paramiko.file - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module file -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.file

- -BufferedFile. -
- - - - - - - - - - - - - - - - - - - -
Variable Summary
int_FLAG_APPEND = 4                                                                     
int_FLAG_BINARY = 16                                                                    
int_FLAG_BUFFERED = 32                                                                    
int_FLAG_LINE_BUFFERED = 64                                                                    
int_FLAG_READ = 1                                                                     
int_FLAG_UNIVERSAL_NEWLINE = 128                                                                   
int_FLAG_WRITE = 2                                                                     

- - - - - - -
Variable Details
-
- -

_FLAG_APPEND

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-4                                                                     
-
-
-
-
-
- -

_FLAG_BINARY

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-16                                                                    
-
-
-
-
-
- -

_FLAG_BUFFERED

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-32                                                                    
-
-
-
-
-
- -

_FLAG_LINE_BUFFERED

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-64                                                                    
-
-
-
-
-
- -

_FLAG_READ

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-1                                                                     
-
-
-
-
-
- -

_FLAG_UNIVERSAL_NEWLINE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-128                                                                   
-
-
-
-
-
- -

_FLAG_WRITE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-2                                                                     
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.kex_gex-module.html b/docs/private/paramiko.kex_gex-module.html deleted file mode 100644 index 8fad377..0000000 --- a/docs/private/paramiko.kex_gex-module.html +++ /dev/null @@ -1,179 +0,0 @@ - - - - - paramiko.kex_gex - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module kex_gex -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.kex_gex

- -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 

- - - - - - - - - - - - - - -
Variable Summary
int_MSG_KEXDH_GEX_GROUP = 31                                                                    
int_MSG_KEXDH_GEX_INIT = 32                                                                    
int_MSG_KEXDH_GEX_REPLY = 33                                                                    
int_MSG_KEXDH_GEX_REQUEST = 34                                                                    

- - - - - - -
Variable Details
-
- -

_MSG_KEXDH_GEX_GROUP

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-31                                                                    
-
-
-
-
-
- -

_MSG_KEXDH_GEX_INIT

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-32                                                                    
-
-
-
-
-
- -

_MSG_KEXDH_GEX_REPLY

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-33                                                                    
-
-
-
-
-
- -

_MSG_KEXDH_GEX_REQUEST

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-34                                                                    
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.kex_gex.KexGex-class.html b/docs/private/paramiko.kex_gex.KexGex-class.html deleted file mode 100644 index 2eec555..0000000 --- a/docs/private/paramiko.kex_gex.KexGex-class.html +++ /dev/null @@ -1,250 +0,0 @@ - - - - - paramiko.kex_gex.KexGex - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module kex_gex :: - Class KexGex -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type KexGex

- -
-object --+
-         |
-        KexGex
-

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - transport) -
 _generate_x(self) -
 _parse_kexdh_gex_group(self, - m) -
 _parse_kexdh_gex_init(self, - m) -
 _parse_kexdh_gex_reply(self, - m) -
 _parse_kexdh_gex_request(self, - m) -
 parse_next(self, - ptype, - m) -
 start_kex(self) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - - - -
Class Variable Summary
intmax_bits = 8192                                                                  
intmin_bits = 1024                                                                  
strname = 'diffie-hellman-group-exchange-sha1' -
intpreferred_bits = 2048                                                                  

- - - - - - -
Class Variable Details
-
- -

max_bits

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-8192                                                                  
-
-
-
-
-
- -

min_bits

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-1024                                                                  
-
-
-
-
-
- -

name

-
-
-
-
-
Type:
-
- str - -
-
Value:
-
-
-'diffie-hellman-group-exchange-sha1'                                   
-
-
-
-
-
- -

preferred_bits

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-2048                                                                  
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.kex_group1-module.html b/docs/private/paramiko.kex_group1-module.html deleted file mode 100644 index 84a44f2..0000000 --- a/docs/private/paramiko.kex_group1-module.html +++ /dev/null @@ -1,181 +0,0 @@ - - - - - paramiko.kex_group1 - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module kex_group1 -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.kex_group1

- -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 

- - - - - - - - - - - - - - -
Variable Summary
int_MSG_KEXDH_INIT = 30                                                                    
int_MSG_KEXDH_REPLY = 31                                                                    
intG = 2                                                                     
longP = 1797693134862315907708391567937874531978602960487560... -

- - - - - - -
Variable Details
-
- -

_MSG_KEXDH_INIT

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-30                                                                    
-
-
-
-
-
- -

_MSG_KEXDH_REPLY

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-31                                                                    
-
-
-
-
-
- -

G

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-2                                                                     
-
-
-
-
-
- -

P

-
-
-
-
-
Type:
-
- long - -
-
Value:
-
-
-1797693134862315907708391567937874531978602960487560117064444236841971\
-8021615851936894783379586492554150218056548598050364644054819923910005\
-0792877003355816639229553136239076508735759914822574862575007425302077\
-4477125895509579377784244424266173347276292993876687092056060502708108\
-42907692932019128194467627007L                                         
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.kex_group1.KexGroup1-class.html b/docs/private/paramiko.kex_group1.KexGroup1-class.html deleted file mode 100644 index 7287b9d..0000000 --- a/docs/private/paramiko.kex_group1.KexGroup1-class.html +++ /dev/null @@ -1,176 +0,0 @@ - - - - - paramiko.kex_group1.KexGroup1 - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module kex_group1 :: - Class KexGroup1 -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type KexGroup1

- -
-object --+
-         |
-        KexGroup1
-

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - transport) -
 _generate_x(self) -
 _parse_kexdh_init(self, - m) -
 _parse_kexdh_reply(self, - m) -
 parse_next(self, - ptype, - m) -
 start_kex(self) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - -
Class Variable Summary
strname = 'diffie-hellman-group1-sha1' -

- - - - - - -
Class Variable Details
-
- -

name

-
-
-
-
-
Type:
-
- str - -
-
Value:
-
-
-'diffie-hellman-group1-sha1'                                           
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.logging22-module.html b/docs/private/paramiko.logging22-module.html deleted file mode 100644 index daa72e6..0000000 --- a/docs/private/paramiko.logging22-module.html +++ /dev/null @@ -1,235 +0,0 @@ - - - - - paramiko.logging22 - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module logging22 -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.logging22

- -Stub out logging on python < 2.3. -
- - - - - - - - - - - -
Classes
- Formatter 
- logger 
- StreamHandler 

- - - - - - - - -
Function Summary
 getLogger(name) -

- - - - - - - - - - - - - - - - - - -
Variable Summary
logger_logger = <paramiko.logging22.logger object at 0xb7b2254... -
intCRITICAL = 50                                                                    
intDEBUG = 10                                                                    
intERROR = 40                                                                    
intINFO = 20                                                                    
intWARNING = 30                                                                    

- - - - - - -
Variable Details
-
- -

_logger

-
-
-
-
-
Type:
-
- logger - -
-
Value:
-
-
-<paramiko.logging22.logger object at 0xb7b2254c>                       
-
-
-
-
-
- -

CRITICAL

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-50                                                                    
-
-
-
-
-
- -

DEBUG

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-10                                                                    
-
-
-
-
-
- -

ERROR

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-40                                                                    
-
-
-
-
-
- -

INFO

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-20                                                                    
-
-
-
-
-
- -

WARNING

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-30                                                                    
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.logging22.Formatter-class.html b/docs/private/paramiko.logging22.Formatter-class.html deleted file mode 100644 index 78fa916..0000000 --- a/docs/private/paramiko.logging22.Formatter-class.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - paramiko.logging22.Formatter - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module logging22 :: - Class Formatter -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type Formatter

- -
-object --+
-         |
-        Formatter
-

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - x, - y) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.logging22.StreamHandler-class.html b/docs/private/paramiko.logging22.StreamHandler-class.html deleted file mode 100644 index dc3e953..0000000 --- a/docs/private/paramiko.logging22.StreamHandler-class.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - paramiko.logging22.StreamHandler - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module logging22 :: - Class StreamHandler -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type StreamHandler

- -
-object --+
-         |
-        StreamHandler
-

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - f) -
 setFormatter(self, - f) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.logging22.logger-class.html b/docs/private/paramiko.logging22.logger-class.html deleted file mode 100644 index 75bd6da..0000000 --- a/docs/private/paramiko.logging22.logger-class.html +++ /dev/null @@ -1,135 +0,0 @@ - - - - - paramiko.logging22.logger - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module logging22 :: - Class logger -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type logger

- -
-object --+
-         |
-        logger
-

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self) -
 addFilter(self, - filter) -
 addHandler(self, - h) -
 log(self, - level, - text) -
 setLevel(self, - level) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.message-module.html b/docs/private/paramiko.message-module.html deleted file mode 100644 index 3a82218..0000000 --- a/docs/private/paramiko.message-module.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - paramiko.message - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module message -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.message

- -Implementation of an SSH2 "message". -
- - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:46 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.packet-module.html b/docs/private/paramiko.packet-module.html deleted file mode 100644 index a14ccd8..0000000 --- a/docs/private/paramiko.packet-module.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - - paramiko.packet - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module packet -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.packet

- -Packetizer. -
- - - - - - - -
Exceptions
- NeedRekeyException 

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.packet.NeedRekeyException-class.html b/docs/private/paramiko.packet.NeedRekeyException-class.html deleted file mode 100644 index 850f706..0000000 --- a/docs/private/paramiko.packet.NeedRekeyException-class.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - - paramiko.packet.NeedRekeyException - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module packet :: - Class NeedRekeyException -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Class NeedRekeyException

- -
-Exception --+
-            |
-           NeedRekeyException
-

- -
- - - - - - - - - - - - - - -
Method Summary
    Inherited from Exception
 __init__(...) -
 __getitem__(...) -
 __str__(...) -

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.pipe-module.html b/docs/private/paramiko.pipe-module.html deleted file mode 100644 index 34edd01..0000000 --- a/docs/private/paramiko.pipe-module.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - paramiko.pipe - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module pipe -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.pipe

- -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. -
- - - - - - - - - -
Classes
- PosixPipe 
- WindowsPipeOn Windows, only an OS-level "WinSock" may be used in -select(), but reads and writes must be to the actual socket object.

- - - - - - - - -
Function Summary
 make_pipe() -

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.pipe.PosixPipe-class.html b/docs/private/paramiko.pipe.PosixPipe-class.html deleted file mode 100644 index b8a01b1..0000000 --- a/docs/private/paramiko.pipe.PosixPipe-class.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - - paramiko.pipe.PosixPipe - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module pipe :: - Class PosixPipe -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type PosixPipe

- -
-object --+
-         |
-        PosixPipe
-

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self) -
 clear(self) -
 close(self) -
 fileno(self) -
 set(self) -
 set_forever(self) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:46 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.pipe.WindowsPipe-class.html b/docs/private/paramiko.pipe.WindowsPipe-class.html deleted file mode 100644 index 56bd3f4..0000000 --- a/docs/private/paramiko.pipe.WindowsPipe-class.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - paramiko.pipe.WindowsPipe - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module pipe :: - Class WindowsPipe -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type WindowsPipe

- -
-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. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self) -
 clear(self) -
 close(self) -
 fileno(self) -
 set(self) -
 set_forever(self) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:46 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.pkey-module.html b/docs/private/paramiko.pkey-module.html deleted file mode 100644 index 3b6a4a1..0000000 --- a/docs/private/paramiko.pkey-module.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - paramiko.pkey - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module pkey -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.pkey

- -Common API for all public keys. -
- - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.primes-module.html b/docs/private/paramiko.primes-module.html deleted file mode 100644 index 3f2df29..0000000 --- a/docs/private/paramiko.primes-module.html +++ /dev/null @@ -1,117 +0,0 @@ - - - - - paramiko.primes - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module primes -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.primes

- -Utility functions for dealing with primes. -
- - - - - - - -
Classes
- ModulusPackconvenience object for holding the contents of the /etc/ssh/moduli -file, on systems that have such a file.

- - - - - - - - - - -
Function Summary
 _generate_prime(bits, - randpool) -
-primtive attempt at prime generation
 _roll_random(rpool, - n) -
-returns a random # from 0 to N-1

- - - - - - -
Function Details
- - -
-

_generate_prime(bits, - randpool) -

- primtive attempt at prime generation -
-
-
- - -
-

_roll_random(rpool, - n) -

- returns a random # from 0 to N-1 -
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.primes.ModulusPack-class.html b/docs/private/paramiko.primes.ModulusPack-class.html deleted file mode 100644 index 438893b..0000000 --- a/docs/private/paramiko.primes.ModulusPack-class.html +++ /dev/null @@ -1,158 +0,0 @@ - - - - - paramiko.primes.ModulusPack - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module primes :: - Class ModulusPack -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type ModulusPack

- -
-object --+
-         |
-        ModulusPack
-

- -
- -convenience object for holding the contents of the /etc/ssh/moduli -file, on systems that have such a file. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - rpool) -
 _parse_modulus(self, - line) -
 get_modulus(self, - min, - prefer, - max) -
 read_file(self, - filename) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

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

read_file(self, - filename) -

-
-
Raises:
-
IOError - - passed from any file operations that fail. -
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.rsakey-module.html b/docs/private/paramiko.rsakey-module.html deleted file mode 100644 index 29f2397..0000000 --- a/docs/private/paramiko.rsakey-module.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - paramiko.rsakey - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module rsakey -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.rsakey

- -RSAKey -
- - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.server-module.html b/docs/private/paramiko.server-module.html deleted file mode 100644 index 95d6786..0000000 --- a/docs/private/paramiko.server-module.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - - paramiko.server - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module server -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.server

- -ServerInterface is an interface to override -for server support. -
- - - - - - - -
Classes
- InteractiveQueryA query (set of prompts) for a user during interactive -authentication.

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.server.InteractiveQuery-class.html b/docs/private/paramiko.server.InteractiveQuery-class.html deleted file mode 100644 index adc7ea2..0000000 --- a/docs/private/paramiko.server.InteractiveQuery-class.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - paramiko.server.InteractiveQuery - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module server :: - Class InteractiveQuery -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type InteractiveQuery

- -
-object --+
-         |
-        InteractiveQuery
-

- -
- -A query (set of prompts) for a user during interactive -authentication. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - name, - instructions, - *prompts) -
-Create a new interactive query to send to the client.
 add_prompt(self, - prompt, - echo) -
-Add a prompt to this query.
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

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

__init__(self, - name='', - instructions='', - *prompts) -
(Constructor) -

- Create a new interactive query to send to the client. The name and - instructions are optional, but are generally displayed to the end user. - A list of prompts may be included, or they may be added via the add_prompt method. -
-
Parameters:
-
name - - name of this query -
           - (type=str) -
instructions - - user instructions (usually short) about this query -
           - (type=str) -
-
-
Overrides:
-
__builtin__.object.__init__
-
-
-
- - -
-

add_prompt(self, - prompt, - echo=True) -

- Add a prompt to this query. The prompt should be a (reasonably - short) string. Multiple prompts can be added to the same query. -
-
Parameters:
-
prompt - - the user prompt -
           - (type=str) -
echo - - True (default) if the user's response should be - echoed; False if not (for a password or similar) -
           - (type=bool) -
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.sftp-module.html b/docs/private/paramiko.sftp-module.html deleted file mode 100644 index 2d280dd..0000000 --- a/docs/private/paramiko.sftp-module.html +++ /dev/null @@ -1,1082 +0,0 @@ - - - - - paramiko.sftp - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.sftp

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Variable Summary
intCMD_ATTRS = 105                                                                   
intCMD_CLOSE = 4                                                                     
intCMD_DATA = 103                                                                   
intCMD_EXTENDED = 200                                                                   
intCMD_EXTENDED_REPLY = 201                                                                   
intCMD_FSETSTAT = 10                                                                    
intCMD_FSTAT = 8                                                                     
intCMD_HANDLE = 102                                                                   
intCMD_INIT = 1                                                                     
intCMD_LSTAT = 7                                                                     
intCMD_MKDIR = 14                                                                    
intCMD_NAME = 104                                                                   
dictCMD_NAMES = {1: 'init', 2: 'version', 3: 'open', 4: 'clo... -
intCMD_OPEN = 3                                                                     
intCMD_OPENDIR = 11                                                                    
intCMD_READ = 5                                                                     
intCMD_READDIR = 12                                                                    
intCMD_READLINK = 19                                                                    
intCMD_REALPATH = 16                                                                    
intCMD_REMOVE = 13                                                                    
intCMD_RENAME = 18                                                                    
intCMD_RMDIR = 15                                                                    
intCMD_SETSTAT = 9                                                                     
intCMD_STAT = 17                                                                    
intCMD_STATUS = 101                                                                   
intCMD_SYMLINK = 20                                                                    
intCMD_VERSION = 2                                                                     
intCMD_WRITE = 6                                                                     
intSFTP_BAD_MESSAGE = 5                                                                     
intSFTP_CONNECTION_LOST = 7                                                                     
listSFTP_DESC = ['Success', 'End of file', 'No such file', '... -
intSFTP_EOF = 1                                                                     
intSFTP_FAILURE = 4                                                                     
intSFTP_FLAG_APPEND = 4                                                                     
intSFTP_FLAG_CREATE = 8                                                                     
intSFTP_FLAG_EXCL = 32                                                                    
intSFTP_FLAG_READ = 1                                                                     
intSFTP_FLAG_TRUNC = 16                                                                    
intSFTP_FLAG_WRITE = 2                                                                     
intSFTP_NO_CONNECTION = 6                                                                     
intSFTP_NO_SUCH_FILE = 2                                                                     
intSFTP_OK = 0                                                                     
intSFTP_OP_UNSUPPORTED = 8                                                                     
intSFTP_PERMISSION_DENIED = 3                                                                     
int_VERSION = 3                                                                     

- - - - - - -
Variable Details
-
- -

CMD_ATTRS

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-105                                                                   
-
-
-
-
-
- -

CMD_CLOSE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-4                                                                     
-
-
-
-
-
- -

CMD_DATA

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-103                                                                   
-
-
-
-
-
- -

CMD_EXTENDED

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-200                                                                   
-
-
-
-
-
- -

CMD_EXTENDED_REPLY

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-201                                                                   
-
-
-
-
-
- -

CMD_FSETSTAT

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-10                                                                    
-
-
-
-
-
- -

CMD_FSTAT

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-8                                                                     
-
-
-
-
-
- -

CMD_HANDLE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-102                                                                   
-
-
-
-
-
- -

CMD_INIT

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-1                                                                     
-
-
-
-
-
- -

CMD_LSTAT

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-7                                                                     
-
-
-
-
-
- -

CMD_MKDIR

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-14                                                                    
-
-
-
-
-
- -

CMD_NAME

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-104                                                                   
-
-
-
-
-
- -

CMD_NAMES

-
-
-
-
-
Type:
-
- dict - -
-
Value:
-
-
-{1: 'init',
- 2: 'version',
- 3: 'open',
- 4: 'close',
- 5: 'read',
- 6: 'write',
- 7: 'lstat',
- 8: 'fstat',
-...                                                                    
-
-
-
-
-
- -

CMD_OPEN

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-3                                                                     
-
-
-
-
-
- -

CMD_OPENDIR

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-11                                                                    
-
-
-
-
-
- -

CMD_READ

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-5                                                                     
-
-
-
-
-
- -

CMD_READDIR

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-12                                                                    
-
-
-
-
-
- -

CMD_READLINK

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-19                                                                    
-
-
-
-
-
- -

CMD_REALPATH

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-16                                                                    
-
-
-
-
-
- -

CMD_REMOVE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-13                                                                    
-
-
-
-
-
- -

CMD_RENAME

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-18                                                                    
-
-
-
-
-
- -

CMD_RMDIR

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-15                                                                    
-
-
-
-
-
- -

CMD_SETSTAT

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-9                                                                     
-
-
-
-
-
- -

CMD_STAT

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-17                                                                    
-
-
-
-
-
- -

CMD_STATUS

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-101                                                                   
-
-
-
-
-
- -

CMD_SYMLINK

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-20                                                                    
-
-
-
-
-
- -

CMD_VERSION

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-2                                                                     
-
-
-
-
-
- -

CMD_WRITE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-6                                                                     
-
-
-
-
-
- -

SFTP_BAD_MESSAGE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-5                                                                     
-
-
-
-
-
- -

SFTP_CONNECTION_LOST

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-7                                                                     
-
-
-
-
-
- -

SFTP_DESC

-
-
-
-
-
Type:
-
- list - -
-
Value:
-
-
-['Success',
- 'End of file',
- 'No such file',
- 'Permission denied',
- 'Failure',
- 'Bad message',
- 'No connection',
- 'Connection lost',
-...                                                                    
-
-
-
-
-
- -

SFTP_EOF

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-1                                                                     
-
-
-
-
-
- -

SFTP_FAILURE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-4                                                                     
-
-
-
-
-
- -

SFTP_FLAG_APPEND

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-4                                                                     
-
-
-
-
-
- -

SFTP_FLAG_CREATE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-8                                                                     
-
-
-
-
-
- -

SFTP_FLAG_EXCL

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-32                                                                    
-
-
-
-
-
- -

SFTP_FLAG_READ

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-1                                                                     
-
-
-
-
-
- -

SFTP_FLAG_TRUNC

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-16                                                                    
-
-
-
-
-
- -

SFTP_FLAG_WRITE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-2                                                                     
-
-
-
-
-
- -

SFTP_NO_CONNECTION

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-6                                                                     
-
-
-
-
-
- -

SFTP_NO_SUCH_FILE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-2                                                                     
-
-
-
-
-
- -

SFTP_OK

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-0                                                                     
-
-
-
-
-
- -

SFTP_OP_UNSUPPORTED

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-8                                                                     
-
-
-
-
-
- -

SFTP_PERMISSION_DENIED

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-3                                                                     
-
-
-
-
-
- -

_VERSION

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-3                                                                     
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.sftp_attr-module.html b/docs/private/paramiko.sftp_attr-module.html deleted file mode 100644 index f5e9f9c..0000000 --- a/docs/private/paramiko.sftp_attr-module.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - paramiko.sftp_attr - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_attr -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.sftp_attr

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.sftp_client-module.html b/docs/private/paramiko.sftp_client-module.html deleted file mode 100644 index 9eff026..0000000 --- a/docs/private/paramiko.sftp_client-module.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - paramiko.sftp_client - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_client -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.sftp_client

- -Client-mode SFTP support. -
- - - - - - - -
Function Summary
 _to_unicode(s) -
-if a str is not ascii, decode its utf8 into unicode

- - - - - - -
Function Details
- - -
-

_to_unicode(s) -

- if a str is not ascii, decode its utf8 into unicode -
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.sftp_file-module.html b/docs/private/paramiko.sftp_file-module.html deleted file mode 100644 index f954ea3..0000000 --- a/docs/private/paramiko.sftp_file-module.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - paramiko.sftp_file - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_file -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.sftp_file

- -SFTPFile -
- - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.sftp_handle-module.html b/docs/private/paramiko.sftp_handle-module.html deleted file mode 100644 index aba785c..0000000 --- a/docs/private/paramiko.sftp_handle-module.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - paramiko.sftp_handle - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_handle -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.sftp_handle

- -Abstraction of an SFTP file handle (for server mode). -
- - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.sftp_server-module.html b/docs/private/paramiko.sftp_server-module.html deleted file mode 100644 index a4c43f5..0000000 --- a/docs/private/paramiko.sftp_server-module.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - - paramiko.sftp_server - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_server -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.sftp_server

- -Server-mode SFTP support. -
- - - - - - - -
Variable Summary
dict_hash_class = {'sha1': <module 'Crypto.Hash.SHA' from '/... -

- - - - - - -
Variable Details
-
- -

_hash_class

-
-
-
-
-
Type:
-
- dict - -
-
Value:
-
-
-{'md5': <module 'Crypto.Hash.MD5' from '/usr/lib/python2.4/site-packag\
-es/Crypto/Hash/MD5.pyc'>,
- 'sha1': <module 'Crypto.Hash.SHA' from '/usr/lib/python2.4/site-packa\
-ges/Crypto/Hash/SHA.pyc'>}                                             
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.sftp_si-module.html b/docs/private/paramiko.sftp_si-module.html deleted file mode 100644 index c4e623f..0000000 --- a/docs/private/paramiko.sftp_si-module.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - paramiko.sftp_si - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_si -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.sftp_si

- -SFTPServerInterface is an interface to -override for SFTP server support. -
- - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.ssh_exception-module.html b/docs/private/paramiko.ssh_exception-module.html deleted file mode 100644 index dd9908c..0000000 --- a/docs/private/paramiko.ssh_exception-module.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - paramiko.ssh_exception - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module ssh_exception -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.ssh_exception

- -Exceptions defined by paramiko. -
- - - - - - - -
Exceptions
- PartialAuthenticationAn internal exception thrown in the case of partial -authentication.

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:46 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.ssh_exception.PartialAuthentication-class.html b/docs/private/paramiko.ssh_exception.PartialAuthentication-class.html deleted file mode 100644 index 0aa4a93..0000000 --- a/docs/private/paramiko.ssh_exception.PartialAuthentication-class.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - paramiko.ssh_exception.PartialAuthentication - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module ssh_exception :: - Class PartialAuthentication -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Class PartialAuthentication

- -
-Exception --+    
-            |    
- SSHException --+
-                |
-               PartialAuthentication
-

- -
- -An internal exception thrown in the case of partial -authentication. -
- - - - - - - - - - - - - - -
Method Summary
 __init__(self, - types) -
    Inherited from Exception
 __getitem__(...) -
 __str__(...) -

- - - - - - - - -
Class Variable Summary
listallowed_types = [] -

- - - - - - -
Class Variable Details
-
- -

allowed_types

-
-
-
-
-
Type:
-
- list - -
-
Value:
-
-
-[]                                                                     
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.transport-module.html b/docs/private/paramiko.transport-module.html deleted file mode 100644 index 1d52647..0000000 --- a/docs/private/paramiko.transport-module.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - paramiko.transport - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module transport -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.transport

- -Transport handles the core SSH2 -protocol. -
- - - - - - - -
Function Summary
 _join_lingering_threads() -

- - - - - - - - -
Variable Summary
list_active_threads = [] -

- - - - - - -
Variable Details
-
- -

_active_threads

-
-
-
-
-
Type:
-
- list - -
-
Value:
-
-
-[]                                                                     
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.util-module.html b/docs/private/paramiko.util-module.html deleted file mode 100644 index 660bdf3..0000000 --- a/docs/private/paramiko.util-module.html +++ /dev/null @@ -1,475 +0,0 @@ - - - - - paramiko.util - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module util -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.util

- -Useful functions used by the rest of paramiko. -
- - - - - - - -
Classes
- PFilter 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Function Summary
 bit_length(n) -
 deflate_long(n, - add_sign_padding) -
-turns a long-int into a normalized byte string (adapted from -Crypto.Util.number)
 format_binary(data, - prefix) -
 format_binary_line(data) -
 format_binary_weird(data) -
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.
 get_logger(name) -
 get_thread_id() -
 hexify(s) -
-turn a string into a hex sequence
 inflate_long(s, - always_positive) -
-turns a normalized byte string into a long-int (adapted from -Crypto.Util.number)
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.
 log_to_file(filename, - level) -
-send paramiko logs to a logfile, if they're not already going -somewhere
 lookup_ssh_host_config(hostname, - config) -
-Return a dict of config options for a given hostname.
 mod_inverse(x, - m) -
object -parse_ssh_config(file_obj) -
-Parse a config file of the format used by OpenSSH, and return an -object that can be used to make queries to lookup_ssh_host_config.
 safe_string(s) -
 tb_strings() -
 unhexify(s) -
-turn a hex sequence back into a string

- - - - - - - - - - - - - - -
Variable Summary
int_g_thread_counter = 0                                                                     
dict_g_thread_ids = {} -
lock_g_thread_lock = <thread.lock object at 0xb7df2180> -
PFilter_pfilter = <paramiko.util.PFilter object at 0xb7b39dac> -

- - - - - - -
Function Details
- - -
-

deflate_long(n, - add_sign_padding=True) -

- turns a long-int into a normalized byte string (adapted from - Crypto.Util.number) -
-
-
- - -
-

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. This specific - algorithm is used for encrypting/decrypting private key files. -
-
Parameters:
-
hashclass - - class from Crypto.Hash that can be used as a - secure hashing function (like MD5 or - SHA). -
           - (type=Crypto.Hash) -
salt - - data to salt the hash with. -
           - (type=string) -
key - - human-entered password or passphrase. -
           - (type=string) -
nbytes - - number of bytes to generate. -
           - (type=int) -
-
-
Returns:
-
- key data -
           - (type=string) -
-
-
-
- - -
-

hexify(s) -

- turn a string into a hex sequence -
-
-
- - -
-

inflate_long(s, - always_positive=False) -

- turns a normalized byte string into a long-int (adapted from - Crypto.Util.number) -
-
-
- - -
-

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. 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"). -
-
Parameters:
-
filename - - name of the file to read host keys from -
           - (type=str) -
-
-
Returns:
-
- dict of host keys, indexed by hostname and then keytype -
           - (type=dict(hostname, dict(keytype, PKey))) -
-
-
-
- - -
-

log_to_file(filename, - level=10) -

- send paramiko logs to a logfile, if they're not already going - somewhere -
-
-
- - -
-

lookup_ssh_host_config(hostname, - config) -

-

Return a dict of config options for a given hostname. The - config object must come from parse_ssh_config.

-

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 - - the hostname to lookup -
           - (type=str) -
config - - the config object to search -
           - (type=object) -
-
-
-
- - -
-

parse_ssh_config(file_obj) -

-

Parse a config file of the format used by OpenSSH, and return an - object that can be used to make queries to lookup_ssh_host_config. The format is - described in OpenSSH's ssh_config man page. This method is - provided primarily as a convenience to posix users (since the OpenSSH - format is a de-facto standard on posix) but should work fine on Windows - too.

- The return value is currently a list of dictionaries, each - containing host-specific configuration, but this is considered an - implementation detail and may be subject to change in later - versions. -
-
Parameters:
-
file_obj - - a file-like object to read the config file from -
           - (type=file) -
-
-
Returns:
-
- opaque configuration object -
           - (type=object) -
-
-
-
- - -
-

unhexify(s) -

- turn a hex sequence back into a string -
-
-
-
- - - - - - -
Variable Details
-
- -

_g_thread_counter

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-0                                                                     
-
-
-
-
-
- -

_g_thread_ids

-
-
-
-
-
Type:
-
- dict - -
-
Value:
-
-
-{}                                                                     
-
-
-
-
-
- -

_g_thread_lock

-
-
-
-
-
Type:
-
- lock - -
-
Value:
-
-
-<thread.lock object at 0xb7df2180>                                     
-
-
-
-
-
- -

_pfilter

-
-
-
-
-
Type:
-
- PFilter - -
-
Value:
-
-
-<paramiko.util.PFilter object at 0xb7b39dac>                           
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/private/paramiko.util.PFilter-class.html b/docs/private/paramiko.util.PFilter-class.html deleted file mode 100644 index dee3883..0000000 --- a/docs/private/paramiko.util.PFilter-class.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - paramiko.util.PFilter - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module util :: - Class PFilter -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type PFilter

- -
-object --+
-         |
-        PFilter
-

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 filter(self, - record) -
    Inherited from object
 __init__(...) -
-x.__init__(...) initializes x; see x.__class__.__doc__ for -signature
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/private/threading.Thread-class.html b/docs/private/threading.Thread-class.html deleted file mode 100644 index 292b074..0000000 --- a/docs/private/threading.Thread-class.html +++ /dev/null @@ -1,237 +0,0 @@ - - - - - threading.Thread - - - - - - - - - - - - - - - - - - -
- - Module threading :: - Class Thread -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type Thread

- -
-object --+    
-         |    
-  _Verbose --+
-             |
-            Thread
-

- -
Known Subclasses:
-
- SubsystemHandler, - Transport
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - group, - target, - name, - args, - kwargs, - verbose) -
(type, value, traceback)__exc_info() -
-Return information about the most recent exception caught by an except -clause in the current stack frame or in an older stack frame.
 __repr__(self) -
 getName(self) -
 isAlive(self) -
 isDaemon(self) -
 join(self, - timeout) -
 run(self) -
 setDaemon(self, - daemonic) -
 setName(self, - name) -
 start(self) -
 __bootstrap(self) -
 __delete(self) -
-Remove current thread from the dict of currently running threads.
 __stop(self) -
 _set_daemon(self) -
    Inherited from _Verbose
 _note(self, - format, - *args) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - -
Class Variable Summary
bool_Thread__initialized = False -

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

__delete(self) -

- Remove current thread from the dict of currently running - threads. -
-
-
-
- - - - - - -
Class Variable Details
-
- -

_Thread__initialized

-
-
-
-
-
Type:
-
- bool - -
-
Value:
-
-
-False                                                                  
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/private/threading._Verbose-class.html b/docs/private/threading._Verbose-class.html deleted file mode 100644 index dec73e3..0000000 --- a/docs/private/threading._Verbose-class.html +++ /dev/null @@ -1,127 +0,0 @@ - - - - - threading._Verbose - - - - - - - - - - - - - - - - - - -
- - Module threading :: - Class _Verbose -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type _Verbose

- -
-object --+
-         |
-        _Verbose
-

- -
Known Subclasses:
-
- Thread
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - verbose) -
 _note(self, - format, - *args) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/private/toc-everything.html b/docs/private/toc-everything.html deleted file mode 100644 index a232317..0000000 --- a/docs/private/toc-everything.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - - Everything - - - -
Everything
-
- - -All Classes
-paramiko.Agent
-paramiko.AgentKey
-paramiko.AuthHandler
-paramiko.BaseSFTP
-paramiko.ber.BER
-paramiko.BufferedFile
-paramiko.Channel
-paramiko.channel.ChannelStderrFile
-paramiko.ChannelFile
-paramiko.compress.ZlibCompressor
-paramiko.compress.ZlibDecompressor
-paramiko.DSSKey
-paramiko.kex_gex.KexGex
-paramiko.kex_group1.KexGroup1
-paramiko.logging22.Formatter
-paramiko.logging22.logger
-paramiko.logging22.StreamHandler
-paramiko.Message
-paramiko.Packetizer
-paramiko.pipe.PosixPipe
-paramiko.pipe.WindowsPipe
-paramiko.PKey
-paramiko.primes.ModulusPack
-paramiko.RSAKey
-paramiko.SecurityOptions
-paramiko.server.InteractiveQuery
-paramiko.ServerInterface
-paramiko.SFTP
-paramiko.SFTPAttributes
-paramiko.SFTPClient
-paramiko.SFTPFile
-paramiko.SFTPHandle
-paramiko.SFTPServer
-paramiko.SFTPServerInterface
-paramiko.SubsystemHandler
-paramiko.Transport
-paramiko.util.PFilter
-
- - -All Exceptions
-paramiko.BadAuthenticationType
-paramiko.ber.BERException
-paramiko.packet.NeedRekeyException
-paramiko.PasswordRequiredException
-paramiko.SFTPError
-paramiko.ssh_exception.PartialAuthentication
-paramiko.SSHException
-
- - -All Functions
-_generate_prime
-_join_lingering_threads
-_roll_random
-_to_unicode
-bit_length
-deflate_long
-format_binary
-format_binary_line
-format_binary_weird
-generate_key_bytes
-get_logger
-get_thread_id
-getLogger
-hexify
-inflate_long
-load_host_keys
-log_to_file
-lookup_ssh_host_config
-make_pipe
-mod_inverse
-parse_ssh_config
-safe_string
-tb_strings
-unhexify
-
- - -All Variables
-__author__
-__date__
-__license__
-__version__
-__version_info__
-_active_threads
-_FLAG_APPEND
-_FLAG_BINARY
-_FLAG_BUFFERED
-_FLAG_LINE_BUFFERED
-_FLAG_READ
-_FLAG_UNIVERSAL_NEWLINE
-_FLAG_WRITE
-_g_thread_counter
-_g_thread_ids
-_g_thread_lock
-_hash_class
-_logger
-_MSG_KEXDH_GEX_GROUP
-_MSG_KEXDH_GEX_INIT
-_MSG_KEXDH_GEX_REPLY
-_MSG_KEXDH_GEX_REQUEST
-_MSG_KEXDH_INIT
-_MSG_KEXDH_REPLY
-_pfilter
-_VERSION
-AUTH_FAILED
-AUTH_PARTIALLY_SUCCESSFUL
-AUTH_SUCCESSFUL
-CMD_ATTRS
-CMD_CLOSE
-CMD_DATA
-CMD_EXTENDED
-CMD_EXTENDED_REPLY
-CMD_FSETSTAT
-CMD_FSTAT
-CMD_HANDLE
-CMD_INIT
-CMD_LSTAT
-CMD_MKDIR
-CMD_NAME
-CMD_NAMES
-CMD_OPEN
-CMD_OPENDIR
-CMD_READ
-CMD_READDIR
-CMD_READLINK
-CMD_REALPATH
-CMD_REMOVE
-CMD_RENAME
-CMD_RMDIR
-CMD_SETSTAT
-CMD_STAT
-CMD_STATUS
-CMD_SYMLINK
-CMD_VERSION
-CMD_WRITE
-CONNECTION_FAILED_CODE
-CRITICAL
-CRITICAL
-DEBUG
-DEBUG
-DISCONNECT_AUTH_CANCELLED_BY_USER
-DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE
-DISCONNECT_SERVICE_NOT_AVAILABLE
-ERROR
-ERROR
-G
-INFO
-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
-P
-SFTP_BAD_MESSAGE
-SFTP_CONNECTION_LOST
-SFTP_DESC
-SFTP_EOF
-SFTP_FAILURE
-SFTP_FLAG_APPEND
-SFTP_FLAG_CREATE
-SFTP_FLAG_EXCL
-SFTP_FLAG_READ
-SFTP_FLAG_TRUNC
-SFTP_FLAG_WRITE
-SFTP_NO_CONNECTION
-SFTP_NO_SUCH_FILE
-SFTP_OK
-SFTP_OP_UNSUPPORTED
-SFTP_PERMISSION_DENIED
-SSH2_AGENT_IDENTITIES_ANSWER
-SSH2_AGENT_SIGN_RESPONSE
-SSH2_AGENTC_REQUEST_IDENTITIES
-SSH2_AGENTC_SIGN_REQUEST
-WARNING
-WARNING
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko-module.html b/docs/private/toc-paramiko-module.html deleted file mode 100644 index e6f4d8b..0000000 --- a/docs/private/toc-paramiko-module.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - paramiko - - - -
paramiko
-
- - -Modules
-agent
-auth_handler
-ber
-channel
-common
-compress
-dsskey
-file
-kex_gex
-kex_group1
-logging22
-message
-packet
-pipe
-pkey
-primes
-rsakey
-server
-sftp
-sftp_attr
-sftp_client
-sftp_file
-sftp_handle
-sftp_server
-sftp_si
-ssh_exception
-transport
-util
-
- - -Classes
-Agent
-AgentKey
-AuthHandler
-BaseSFTP
-BufferedFile
-Channel
-ChannelFile
-DSSKey
-Message
-Packetizer
-PKey
-RSAKey
-SecurityOptions
-ServerInterface
-SFTP
-SFTPAttributes
-SFTPClient
-SFTPFile
-SFTPHandle
-SFTPServer
-SFTPServerInterface
-SubsystemHandler
-Transport
-x
-
- - -Exceptions
-BadAuthenticationType
-PasswordRequiredException
-SFTPError
-SSHException
-
- - -Variables
-__author__
-__date__
-__license__
-__version__
-__version_info__
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.agent-module.html b/docs/private/toc-paramiko.agent-module.html deleted file mode 100644 index 67aa397..0000000 --- a/docs/private/toc-paramiko.agent-module.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - paramiko.agent - - - -
agent
-
- - -Variables
-SSH2_AGENT_IDENTITIES_ANSWER
-SSH2_AGENT_SIGN_RESPONSE
-SSH2_AGENTC_REQUEST_IDENTITIES
-SSH2_AGENTC_SIGN_REQUEST
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.auth_handler-module.html b/docs/private/toc-paramiko.auth_handler-module.html deleted file mode 100644 index a82871d..0000000 --- a/docs/private/toc-paramiko.auth_handler-module.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - paramiko.auth_handler - - - -
auth_handler
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.ber-module.html b/docs/private/toc-paramiko.ber-module.html deleted file mode 100644 index 2dd81d0..0000000 --- a/docs/private/toc-paramiko.ber-module.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - paramiko.ber - - - -
ber
-
- - -Classes
-BER
-
- - -Exceptions
-BERException
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.channel-module.html b/docs/private/toc-paramiko.channel-module.html deleted file mode 100644 index d0eb4d9..0000000 --- a/docs/private/toc-paramiko.channel-module.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - paramiko.channel - - - -
channel
-
- - -Classes
-ChannelStderrFile
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.common-module.html b/docs/private/toc-paramiko.common-module.html deleted file mode 100644 index 3fe063c..0000000 --- a/docs/private/toc-paramiko.common-module.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - paramiko.common - - - -
common
-
- - -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
-WARNING
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.compress-module.html b/docs/private/toc-paramiko.compress-module.html deleted file mode 100644 index df10cb8..0000000 --- a/docs/private/toc-paramiko.compress-module.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - paramiko.compress - - - -
compress
-
- - -Classes
-ZlibCompressor
-ZlibDecompressor
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.dsskey-module.html b/docs/private/toc-paramiko.dsskey-module.html deleted file mode 100644 index dbdf69c..0000000 --- a/docs/private/toc-paramiko.dsskey-module.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - paramiko.dsskey - - - -
dsskey
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.file-module.html b/docs/private/toc-paramiko.file-module.html deleted file mode 100644 index 9cda933..0000000 --- a/docs/private/toc-paramiko.file-module.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - paramiko.file - - - -
file
-
- - -Variables
-_FLAG_APPEND
-_FLAG_BINARY
-_FLAG_BUFFERED
-_FLAG_LINE_BUFFERED
-_FLAG_READ
-_FLAG_UNIVERSAL_NEWLINE
-_FLAG_WRITE
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.kex_gex-module.html b/docs/private/toc-paramiko.kex_gex-module.html deleted file mode 100644 index fd9acc8..0000000 --- a/docs/private/toc-paramiko.kex_gex-module.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - paramiko.kex_gex - - - -
kex_gex
-
- - -Classes
-KexGex
-
- - -Variables
-_MSG_KEXDH_GEX_GROUP
-_MSG_KEXDH_GEX_INIT
-_MSG_KEXDH_GEX_REPLY
-_MSG_KEXDH_GEX_REQUEST
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.kex_group1-module.html b/docs/private/toc-paramiko.kex_group1-module.html deleted file mode 100644 index ca51eb0..0000000 --- a/docs/private/toc-paramiko.kex_group1-module.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - paramiko.kex_group1 - - - -
kex_group1
-
- - -Classes
-KexGroup1
-
- - -Variables
-_MSG_KEXDH_INIT
-_MSG_KEXDH_REPLY
-G
-P
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.logging22-module.html b/docs/private/toc-paramiko.logging22-module.html deleted file mode 100644 index 6b96de4..0000000 --- a/docs/private/toc-paramiko.logging22-module.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - paramiko.logging22 - - - -
logging22
-
- - -Classes
-Formatter
-logger
-StreamHandler
-
- - -Functions
-getLogger
-
- - -Variables
-_logger
-CRITICAL
-DEBUG
-ERROR
-INFO
-WARNING
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.message-module.html b/docs/private/toc-paramiko.message-module.html deleted file mode 100644 index 13e6444..0000000 --- a/docs/private/toc-paramiko.message-module.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - paramiko.message - - - -
message
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.packet-module.html b/docs/private/toc-paramiko.packet-module.html deleted file mode 100644 index 670fb37..0000000 --- a/docs/private/toc-paramiko.packet-module.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - paramiko.packet - - - -
packet
-
- - -Exceptions
-NeedRekeyException
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.pipe-module.html b/docs/private/toc-paramiko.pipe-module.html deleted file mode 100644 index 4a6b775..0000000 --- a/docs/private/toc-paramiko.pipe-module.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - paramiko.pipe - - - -
pipe
-
- - -Classes
-PosixPipe
-WindowsPipe
-
- - -Functions
-make_pipe
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.pkey-module.html b/docs/private/toc-paramiko.pkey-module.html deleted file mode 100644 index 56fa96f..0000000 --- a/docs/private/toc-paramiko.pkey-module.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - paramiko.pkey - - - -
pkey
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.primes-module.html b/docs/private/toc-paramiko.primes-module.html deleted file mode 100644 index 356d9bd..0000000 --- a/docs/private/toc-paramiko.primes-module.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - paramiko.primes - - - -
primes
-
- - -Classes
-ModulusPack
-
- - -Functions
-_generate_prime
-_roll_random
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.rsakey-module.html b/docs/private/toc-paramiko.rsakey-module.html deleted file mode 100644 index 117cc82..0000000 --- a/docs/private/toc-paramiko.rsakey-module.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - paramiko.rsakey - - - -
rsakey
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.server-module.html b/docs/private/toc-paramiko.server-module.html deleted file mode 100644 index 58cf1e4..0000000 --- a/docs/private/toc-paramiko.server-module.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - paramiko.server - - - -
server
-
- - -Classes
-InteractiveQuery
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.sftp-module.html b/docs/private/toc-paramiko.sftp-module.html deleted file mode 100644 index a2d59c4..0000000 --- a/docs/private/toc-paramiko.sftp-module.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - paramiko.sftp - - - -
sftp
-
- - -Variables
-_VERSION
-CMD_ATTRS
-CMD_CLOSE
-CMD_DATA
-CMD_EXTENDED
-CMD_EXTENDED_REPLY
-CMD_FSETSTAT
-CMD_FSTAT
-CMD_HANDLE
-CMD_INIT
-CMD_LSTAT
-CMD_MKDIR
-CMD_NAME
-CMD_NAMES
-CMD_OPEN
-CMD_OPENDIR
-CMD_READ
-CMD_READDIR
-CMD_READLINK
-CMD_REALPATH
-CMD_REMOVE
-CMD_RENAME
-CMD_RMDIR
-CMD_SETSTAT
-CMD_STAT
-CMD_STATUS
-CMD_SYMLINK
-CMD_VERSION
-CMD_WRITE
-SFTP_BAD_MESSAGE
-SFTP_CONNECTION_LOST
-SFTP_DESC
-SFTP_EOF
-SFTP_FAILURE
-SFTP_FLAG_APPEND
-SFTP_FLAG_CREATE
-SFTP_FLAG_EXCL
-SFTP_FLAG_READ
-SFTP_FLAG_TRUNC
-SFTP_FLAG_WRITE
-SFTP_NO_CONNECTION
-SFTP_NO_SUCH_FILE
-SFTP_OK
-SFTP_OP_UNSUPPORTED
-SFTP_PERMISSION_DENIED
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.sftp_attr-module.html b/docs/private/toc-paramiko.sftp_attr-module.html deleted file mode 100644 index e1180e3..0000000 --- a/docs/private/toc-paramiko.sftp_attr-module.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - paramiko.sftp_attr - - - -
sftp_attr
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.sftp_client-module.html b/docs/private/toc-paramiko.sftp_client-module.html deleted file mode 100644 index e2f94fd..0000000 --- a/docs/private/toc-paramiko.sftp_client-module.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - paramiko.sftp_client - - - -
sftp_client
-
- - -Functions
-_to_unicode
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.sftp_file-module.html b/docs/private/toc-paramiko.sftp_file-module.html deleted file mode 100644 index f270b0f..0000000 --- a/docs/private/toc-paramiko.sftp_file-module.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - paramiko.sftp_file - - - -
sftp_file
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.sftp_handle-module.html b/docs/private/toc-paramiko.sftp_handle-module.html deleted file mode 100644 index 1df5358..0000000 --- a/docs/private/toc-paramiko.sftp_handle-module.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - paramiko.sftp_handle - - - -
sftp_handle
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.sftp_server-module.html b/docs/private/toc-paramiko.sftp_server-module.html deleted file mode 100644 index 3c12fcc..0000000 --- a/docs/private/toc-paramiko.sftp_server-module.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - paramiko.sftp_server - - - -
sftp_server
-
- - -Variables
-_hash_class
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.sftp_si-module.html b/docs/private/toc-paramiko.sftp_si-module.html deleted file mode 100644 index 75605b8..0000000 --- a/docs/private/toc-paramiko.sftp_si-module.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - paramiko.sftp_si - - - -
sftp_si
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.ssh_exception-module.html b/docs/private/toc-paramiko.ssh_exception-module.html deleted file mode 100644 index 1567097..0000000 --- a/docs/private/toc-paramiko.ssh_exception-module.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - paramiko.ssh_exception - - - -
ssh_exception
-
- - -Exceptions
-PartialAuthentication
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.transport-module.html b/docs/private/toc-paramiko.transport-module.html deleted file mode 100644 index d5d5651..0000000 --- a/docs/private/toc-paramiko.transport-module.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - paramiko.transport - - - -
transport
-
- - -Functions
-_join_lingering_threads
-
- - -Variables
-_active_threads
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc-paramiko.util-module.html b/docs/private/toc-paramiko.util-module.html deleted file mode 100644 index a290c16..0000000 --- a/docs/private/toc-paramiko.util-module.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - paramiko.util - - - -
util
-
- - -Classes
-PFilter
-
- - -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
-_g_thread_counter
-_g_thread_ids
-_g_thread_lock
-_pfilter
-
- -
-[show private | hide private] - - diff --git a/docs/private/toc.html b/docs/private/toc.html deleted file mode 100644 index fd91230..0000000 --- a/docs/private/toc.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - Table of Contents - - - -
Table of Contents
-
-Everything
- - -
Packages
-paramiko
- - -
Modules
-paramiko.agent
-paramiko.auth_handler
-paramiko.ber
-paramiko.channel
-paramiko.common
-paramiko.compress
-paramiko.dsskey
-paramiko.file
-paramiko.kex_gex
-paramiko.kex_group1
-paramiko.logging22
-paramiko.message
-paramiko.packet
-paramiko.pipe
-paramiko.pkey
-paramiko.primes
-paramiko.rsakey
-paramiko.server
-paramiko.sftp
-paramiko.sftp_attr
-paramiko.sftp_client
-paramiko.sftp_file
-paramiko.sftp_handle
-paramiko.sftp_server
-paramiko.sftp_si
-paramiko.ssh_exception
-paramiko.transport
-paramiko.util
- -

-[show private | hide private] - - diff --git a/docs/private/trees.html b/docs/private/trees.html deleted file mode 100644 index d762eb6..0000000 --- a/docs/private/trees.html +++ /dev/null @@ -1,243 +0,0 @@ - - - - - Module and Class Hierarchies - - - - - - - - - - - - - - - - - - -
- - - -
[show private | hide private]
[frames | no frames]
- - -

Module Hierarchy

-
    -
  • paramiko: 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. - -
- - -

Class Hierarchy

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/public/__builtin__.object-class.html b/docs/public/__builtin__.object-class.html deleted file mode 100644 index f9ab2d2..0000000 --- a/docs/public/__builtin__.object-class.html +++ /dev/null @@ -1,268 +0,0 @@ - - - - - __builtin__.object - - - - - - - - - - - - - - - - - - -
- - Module __builtin__ :: - Class object -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type object

- -
Known Subclasses:
-
- BufferedFile, - Channel, - InteractiveQuery, - Message, - PFilter, - SecurityOptions, - SFTPAttributes, - SFTPHandle, - type
- -
- -The most base type -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(...) -
-x.__init__(...) initializes x; see x.__class__.__doc__ for -signature
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - -
Class Variable Summary
type__class__ = __builtin__.type

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

__init__(...) -
(Constructor) -

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

__delattr__(...) -

- x.__delattr__('name') <==> del x.name -
-
-
- - -
-

__getattribute__(...) -

- x.__getattribute__('name') <==> x.name -
-
-
- - -
-

__hash__(x) -
(Hashing function) -

- x.__hash__() <==> hash(x) -
-
Returns:
-
-
-hash(x)
-
-
-
-
-
- - -
-

__new__(T, - S, - ...) -

- T.__new__(S, ...) -> a new object with type S, a subtype of T -
-
Returns:
-
-
-a new object with type S, a subtype of T
-
-
-
-
-
- - -
-

__reduce__(...) -

- helper for pickle -
-
-
- - -
-

__reduce_ex__(...) -

- helper for pickle -
-
-
- - -
-

__repr__(x) -
(Representation operator) -

- x.__repr__() <==> repr(x) -
-
Returns:
-
-
-repr(x)
-
-
-
-
-
- - -
-

__setattr__(...) -

- x.__setattr__('name', value) <==> x.name = value -
-
-
- - -
-

__str__(x) -
(Informal representation operator) -

- x.__str__() <==> str(x) -
-
Returns:
-
-
-str(x)
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:46 2005http://epydoc.sf.net
- - diff --git a/docs/public/__builtin__.type-class.html b/docs/public/__builtin__.type-class.html deleted file mode 100644 index 21075f7..0000000 --- a/docs/public/__builtin__.type-class.html +++ /dev/null @@ -1,504 +0,0 @@ - - - - - __builtin__.type - - - - - - - - - - - - - - - - - - -
- - Module __builtin__ :: - Class type -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type type

- -
-object --+
-         |
-        type
-

- -
- -type(object) -> the object's type type(name, bases, dict) -> a -new type -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __call__(x, - ...) -
-x.__call__(...) <==> x(...)
 __cmp__(x, - y) -
-x.__cmp__(y) <==> cmp(x,y)
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
list of immediate subclasses__subclasses__() -
-__subclasses__() -> list of immediate subclasses
listmro() -
-return a type's method resolution order
    Inherited from object
 __init__(...) -
-x.__init__(...) initializes x; see x.__class__.__doc__ for -signature
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - - - - - - - - - - - - - -
Class Variable Summary
type__base__ = __builtin__.object
tuple__bases__ = (<type 'object'>,) -
int__basicsize__ = 420                                                                   
int__dictoffset__ = 132                                                                   
int__flags__ = 21995                                                                 
int__itemsize__ = 20                                                                    
tuple__mro__ = (<type 'type'>, <type 'object'>) -
str__name__ = 'type' -
int__weakrefoffset__ = 184                                                                   

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

__call__(x, - ...) -
(Call operator) -

- x.__call__(...) <==> x(...) -
-
Returns:
-
-
-x(...)
-
-
-
-
-
- - -
-

__cmp__(x, - y) -
(Comparison operator) -

- x.__cmp__(y) <==> cmp(x,y) -
-
Returns:
-
-
-cmp(x,y)
-
-
-
-
-
- - -
-

__delattr__(...) -

- x.__delattr__('name') <==> del x.name -
-
Overrides:
-
__builtin__.object.__delattr__
-
-
-
- - -
-

__getattribute__(...) -

- x.__getattribute__('name') <==> x.name -
-
Overrides:
-
__builtin__.object.__getattribute__
-
-
-
- - -
-

__hash__(x) -
(Hashing function) -

- x.__hash__() <==> hash(x) -
-
Returns:
-
-
-hash(x)
-
-
-
-
Overrides:
-
__builtin__.object.__hash__
-
-
-
- - -
-

__new__(T, - S, - ...) -

- T.__new__(S, ...) -> a new object with type S, a subtype of T -
-
Returns:
-
-
-a new object with type S, a subtype of T
-
-
-
-
Overrides:
-
__builtin__.object.__new__
-
-
-
- - -
-

__repr__(x) -
(Representation operator) -

- x.__repr__() <==> repr(x) -
-
Returns:
-
-
-repr(x)
-
-
-
-
Overrides:
-
__builtin__.object.__repr__
-
-
-
- - -
-

__setattr__(...) -

- x.__setattr__('name', value) <==> x.name = value -
-
Overrides:
-
__builtin__.object.__setattr__
-
-
-
- - -
-

__subclasses__() -

- __subclasses__() -> list of immediate subclasses -
-
Returns:
-
-list of immediate subclasses
-
-
-
- - -
-

mro() -

- return a type's method resolution order -
-
Returns:
-
-list
-
-
-
-
- - - - - - -
Class Variable Details
-
- -

__bases__

-
-
-
-
-
Type:
-
- tuple - -
-
Value:
-
-
-(<type 'object'>,)                                                     
-
-
-
-
-
- -

__basicsize__

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-420                                                                   
-
-
-
-
-
- -

__dictoffset__

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-132                                                                   
-
-
-
-
-
- -

__flags__

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-21995                                                                 
-
-
-
-
-
- -

__itemsize__

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-20                                                                    
-
-
-
-
-
- -

__mro__

-
-
-
-
-
Type:
-
- tuple - -
-
Value:
-
-
-(<type 'type'>, <type 'object'>)                                       
-
-
-
-
-
- -

__name__

-
-
-
-
-
Type:
-
- str - -
-
Value:
-
-
-'type'                                                                 
-
-
-
-
-
- -

__weakrefoffset__

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-184                                                                   
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/epydoc.css b/docs/public/epydoc.css deleted file mode 100644 index 46080bd..0000000 --- a/docs/public/epydoc.css +++ /dev/null @@ -1,100 +0,0 @@ - -/* Body color */ -body { background: #ffffff; color: #000000; } - -/* Tables */ -table.summary, table.details, table.index - { background: #e8f0f8; color: #000000; } -tr.summary, tr.details, tr.index - { background: #70b0f0; color: #000000; - text-align: left; font-size: 120%; } -tr.group { background: #c0e0f8; color: #000000; - text-align: left; font-size: 120%; - font-style: italic; } - -/* Documentation page titles */ -h2.module { margin-top: 0.2em; } -h2.class { margin-top: 0.2em; } - -/* Headings */ -h1.heading { font-size: +140%; font-style: italic; - font-weight: bold; } -h2.heading { font-size: +125%; font-style: italic; - font-weight: bold; } -h3.heading { font-size: +110%; font-style: italic; - font-weight: normal; } - -/* Base tree */ -pre.base-tree { font-size: 80%; margin: 0; } - -/* Details Sections */ -table.func-details { background: #e8f0f8; color: #000000; - border: 2px groove #c0d0d0; - padding: 0 1em 0 1em; margin: 0.4em 0 0 0; } -h3.func-detail { background: transparent; color: #000000; - margin: 0 0 1em 0; } - -table.var-details { background: #e8f0f8; color: #000000; - border: 2px groove #c0d0d0; - padding: 0 1em 0 1em; margin: 0.4em 0 0 0; } -h3.var-details { background: transparent; color: #000000; - margin: 0 0 1em 0; } - -/* Function signatures */ -.sig { background: transparent; color: #000000; - font-weight: bold; } -.sig-name { background: transparent; color: #006080; } -.sig-arg, .sig-kwarg, .sig-vararg - { background: transparent; color: #008060; } -.sig-default { background: transparent; color: #602000; } -.summary-sig { background: transparent; color: #000000; } -.summary-sig-name { background: transparent; color: #204080; } -.summary-sig-arg, .summary-sig-kwarg, .summary-sig-vararg - { background: transparent; color: #008060; } - -/* Doctest blocks */ -.py-src { background: transparent; color: #000000; } -.py-prompt { background: transparent; color: #005050; - font-weight: bold;} -.py-string { background: transparent; color: #006030; } -.py-comment { background: transparent; color: #003060; } -.py-keyword { background: transparent; color: #600000; } -.py-output { background: transparent; color: #404040; } -pre.doctestblock { background: #f4faff; color: #000000; - padding: .5em; margin: 1em; - border: 1px solid #708890; } -table pre.doctestblock - { background: #dce4ec; color: #000000; - padding: .5em; margin: 1em; - border: 1px solid #708890; } - -/* Variable values */ -pre.variable { background: #dce4ec; color: #000000; - padding: .5em; margin: 0; - border: 1px solid #708890; } -.variable-linewrap { background: transparent; color: #604000; } -.variable-ellipsis { background: transparent; color: #604000; } -.variable-quote { background: transparent; color: #604000; } -.re { background: transparent; color: #000000; } -.re-char { background: transparent; color: #006030; } -.re-op { background: transparent; color: #600000; } -.re-group { background: transparent; color: #003060; } -.re-ref { background: transparent; color: #404040; } - -/* Navigation bar */ -table.navbar { background: #a0c0ff; color: #0000ff; - border: 2px groove #c0d0d0; } -th.navbar { background: #a0c0ff; color: #0000ff; } -th.navselect { background: #70b0ff; color: #000000; } -.nomargin { margin: 0; } - -/* Links */ -a:link { background: transparent; color: #0000ff; } -a:visited { background: transparent; color: #204080; } -a.navbar:link { background: transparent; color: #0000ff; - text-decoration: none; } -a.navbar:visited { background: transparent; color: #204080; - text-decoration: none; } - -/* Lists */ -ul { margin-top: 0; } diff --git a/docs/public/exceptions.Exception-class.html b/docs/public/exceptions.Exception-class.html deleted file mode 100644 index 8e04fe7..0000000 --- a/docs/public/exceptions.Exception-class.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - exceptions.Exception - - - - - - - - - - - - - - - - - - -
- - Module exceptions :: - Class Exception -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Class Exception

- -
Known Subclasses:
-
- SFTPError, - SSHException
- -
- -Common base class for all exceptions. -
- - - - - - - - - - - - -
Method Summary
 __init__(...) -
 __getitem__(...) -
 __str__(...) -

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/frames.html b/docs/public/frames.html deleted file mode 100644 index 77678a0..0000000 --- a/docs/public/frames.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - API Documentation - - - - - - - - - diff --git a/docs/public/help.html b/docs/public/help.html deleted file mode 100644 index 99e33a2..0000000 --- a/docs/public/help.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - - Help - - - - - - - - - - - - - - - - - - -
- - - -
[show private | hide private]
[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.

- - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/public/index.html b/docs/public/index.html deleted file mode 100644 index 77678a0..0000000 --- a/docs/public/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - API Documentation - - - - - - - - - diff --git a/docs/public/indices.html b/docs/public/indices.html deleted file mode 100644 index ce1f266..0000000 --- a/docs/public/indices.html +++ /dev/null @@ -1,803 +0,0 @@ - - - - - Index - - - - - - - - - - - - - - - - - - -
- - - -
[show private | hide private]
[frames | no frames]
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Identifier Index
objectClass in module __builtin__
__bases__Variable in class __builtin__.type
__basicsize__Variable in class __builtin__.type
__call__Method in class __builtin__.type
typeClass in module __builtin__
__cmp__Method in class __builtin__.type
__del__Method in class paramiko.BufferedFile
__del__Method in class paramiko.Channel
__del__Method in class paramiko.SFTPClient
__del__Method in class paramiko.SFTPFile
__del__Method in class paramiko.Transport
__delattr__Method in class __builtin__.object
__delattr__Method in class __builtin__.type
__dictoffset__Variable in class __builtin__.type
__flags__Variable in class __builtin__.type
__getattribute__Method in class __builtin__.object
__getattribute__Method in class __builtin__.type
__getitem__Method in class exceptions.Exception
__hash__Method in class __builtin__.object
__hash__Method in class __builtin__.type
__hash__Method in class paramiko.DSSKey
__hash__Method in class paramiko.RSAKey
__init__Method in class __builtin__.object
__init__Method in class exceptions.Exception
__init__Method in class paramiko.Agent
__init__Method in class paramiko.AgentKey
__init__Method in class paramiko.BadAuthenticationType
__init__Method in class paramiko.BufferedFile
__init__Method in class paramiko.Channel
__init__Method in class paramiko.DSSKey
__init__Method in class paramiko.Message
__init__Method in class paramiko.RSAKey
__init__Method in class paramiko.SFTPAttributes
__init__Method in class paramiko.SFTPClient
__init__Method in class paramiko.SFTPFile
__init__Method in class paramiko.SFTPHandle
__init__Method in class paramiko.SFTPServer
__init__Method in class paramiko.SecurityOptions
__init__Method in class paramiko.SubsystemHandler
__init__Method in class paramiko.Transport
__init__Method in class paramiko.server.InteractiveQuery
__init__Method in class threading.Thread
__itemsize__Variable in class __builtin__.type
__iter__Method in class paramiko.BufferedFile
__mro__Variable in class __builtin__.type
__name__Variable in class __builtin__.type
__new__Method in class __builtin__.object
__new__Method in class __builtin__.type
__reduce__Method in class __builtin__.object
__reduce_ex__Method in class __builtin__.object
__repr__Method in class __builtin__.object
__repr__Method in class __builtin__.type
__repr__Method in class paramiko.Channel
__repr__Method in class paramiko.Message
__repr__Method in class paramiko.SFTPAttributes
__repr__Method in class paramiko.SecurityOptions
__repr__Method in class paramiko.Transport
__repr__Method in class threading.Thread
__setattr__Method in class __builtin__.object
__setattr__Method in class __builtin__.type
__slots__Variable in class paramiko.SecurityOptions
__str__Method in class __builtin__.object
__str__Method in class exceptions.Exception
__str__Method in class paramiko.AgentKey
__str__Method in class paramiko.BadAuthenticationType
__str__Method in class paramiko.DSSKey
__str__Method in class paramiko.Message
__str__Method in class paramiko.RSAKey
__str__Method in class paramiko.SFTPAttributes
__subclasses__Method in class __builtin__.type
__weakrefoffset__Variable in class __builtin__.type
acceptMethod in class paramiko.Transport
addMethod in class paramiko.Message
add_booleanMethod in class paramiko.Message
add_byteMethod in class paramiko.Message
add_bytesMethod in class paramiko.Message
add_intMethod in class paramiko.Message
add_int64Method in class paramiko.Message
add_listMethod in class paramiko.Message
add_mpintMethod in class paramiko.Message
add_promptMethod in class paramiko.server.InteractiveQuery
add_server_keyMethod in class paramiko.Transport
add_stringMethod in class paramiko.Message
AgentClass in package paramiko
agentModule in package paramiko
AgentKeyClass in package paramiko
allowed_typesVariable in class paramiko.BadAuthenticationType
auth_interactiveMethod in class paramiko.Transport
auth_noneMethod in class paramiko.Transport
auth_passwordMethod in class paramiko.Transport
auth_publickeyMethod in class paramiko.Transport
BadAuthenticationTypeClass in package paramiko
bit_lengthFunction in module paramiko.util
BufferedFileClass in package paramiko
can_signMethod in class paramiko.DSSKey
can_signMethod in class paramiko.RSAKey
ChannelClass in package paramiko
chattrMethod in class paramiko.SFTPHandle
chdirMethod in class paramiko.SFTPClient
checkMethod in class paramiko.SFTPFile
chmodMethod in class paramiko.SFTPClient
chownMethod in class paramiko.SFTPClient
ciphersMethod in class paramiko.SFTPClient in class paramiko.SecurityOptions
closeMethod in class paramiko.Agent
closeMethod in class paramiko.BufferedFile
closeMethod in class paramiko.Channel
closeMethod in class paramiko.SFTPClient
closeMethod in class paramiko.SFTPFile
closeMethod in class paramiko.SFTPHandle
closeMethod in class paramiko.Transport
CMD_ATTRSVariable in module paramiko.sftp
CMD_CLOSEVariable in module paramiko.sftp
CMD_DATAVariable in module paramiko.sftp
CMD_EXTENDEDVariable in module paramiko.sftp
CMD_EXTENDED_REPLYVariable in module paramiko.sftp
CMD_FSETSTATVariable in module paramiko.sftp
CMD_FSTATVariable in module paramiko.sftp
CMD_HANDLEVariable in module paramiko.sftp
CMD_INITVariable in module paramiko.sftp
CMD_LSTATVariable in module paramiko.sftp
CMD_MKDIRVariable in module paramiko.sftp
CMD_NAMEVariable in module paramiko.sftp
CMD_NAMESVariable in module paramiko.sftp
CMD_OPENVariable in module paramiko.sftp
CMD_OPENDIRVariable in module paramiko.sftp
CMD_READVariable in module paramiko.sftp
CMD_READDIRVariable in module paramiko.sftp
CMD_READLINKVariable in module paramiko.sftp
CMD_REALPATHVariable in module paramiko.sftp
CMD_REMOVEVariable in module paramiko.sftp
CMD_RENAMEVariable in module paramiko.sftp
CMD_RMDIRVariable in module paramiko.sftp
CMD_SETSTATVariable in module paramiko.sftp
CMD_STATVariable in module paramiko.sftp
CMD_STATUSVariable in module paramiko.sftp
CMD_SYMLINKVariable in module paramiko.sftp
CMD_VERSIONVariable in module paramiko.sftp
CMD_WRITEVariable in module paramiko.sftp
compressionModule in package paramiko in class paramiko.SecurityOptions
connectMethod in class paramiko.Transport
convert_errnoMethod in class paramiko.SFTPServer
deflate_longFunction in module paramiko.util
digestsFunction in module paramiko.util in class paramiko.SecurityOptions
DSSKeyClass in package paramiko
dsskeyModule in package paramiko
exc_infoFunction in module sys
ExceptionClass in module exceptions
exec_commandMethod in class paramiko.Channel
fileMethod in class paramiko.SFTPClient
fileModule in package paramiko
filenoMethod in class paramiko.Channel
filterMethod in class paramiko.util.PFilter
finish_subsystemMethod in class paramiko.SFTPServer
finish_subsystemMethod in class paramiko.SubsystemHandler
FLAG_AMTIMEVariable in class paramiko.SFTPAttributes
FLAG_EXTENDEDVariable in class paramiko.SFTPAttributes
FLAG_PERMISSIONSVariable in class paramiko.SFTPAttributes
FLAG_SIZEVariable in class paramiko.SFTPAttributes
FLAG_UIDGIDVariable in class paramiko.SFTPAttributes
flushMethod in class paramiko.BufferedFile
format_binaryFunction in module paramiko.util
format_binary_lineFunction in module paramiko.util
format_binary_weirdFunction in module paramiko.util
from_statMethod in class paramiko.SFTPAttributes
from_transportMethod in class paramiko.SFTPClient
generateMethod in class paramiko.DSSKey
generateMethod in class paramiko.RSAKey
generate_key_bytesFunction in module paramiko.util
getMethod in class paramiko.SFTPClient
get_bitsMethod in class paramiko.DSSKey
get_bitsMethod in class paramiko.RSAKey
get_booleanMethod in class paramiko.Message
get_byteMethod in class paramiko.Message
get_bytesMethod in class paramiko.Message
get_exceptionMethod in class paramiko.Transport
get_hexdumpMethod in class paramiko.Transport
get_idMethod in class paramiko.Channel
get_intMethod in class paramiko.Message
get_int64Method in class paramiko.Message
get_keysMethod in class paramiko.Agent
get_listMethod in class paramiko.Message
get_log_channelMethod in class paramiko.Transport
get_loggerFunction in module paramiko.util
get_mpintMethod in class paramiko.Message
get_nameMethod in class paramiko.AgentKey
get_nameMethod in class paramiko.Channel
get_nameMethod in class paramiko.DSSKey
get_nameMethod in class paramiko.RSAKey
get_ptyMethod in class paramiko.Channel
get_remainderMethod in class paramiko.Message
get_remote_server_keyMethod in class paramiko.Transport
get_security_optionsMethod in class paramiko.Transport
get_serverMethod in class paramiko.SubsystemHandler
get_server_keyMethod in class paramiko.Transport
get_so_farMethod in class paramiko.Message
get_stringMethod in class paramiko.Message
get_thread_idFunction in module paramiko.util
get_transportMethod in class paramiko.Channel
get_usernameMethod in class paramiko.Transport
getcwdMethod in class paramiko.SFTPClient
getNameMethod in class threading.Thread
gettimeoutMethod in class paramiko.Channel
gettimeoutMethod in class paramiko.SFTPFile
global_requestMethod in class paramiko.Transport
hexifyFunction in module paramiko.util
inflate_longFunction in module paramiko.util
InteractiveQueryClass in module paramiko.server
invoke_shellMethod in class paramiko.Channel
invoke_subsystemMethod in class paramiko.Channel
is_activeMethod in class paramiko.Transport
is_authenticatedMethod in class paramiko.Transport
isAliveMethod in class threading.Thread
isDaemonMethod in class threading.Thread
joinMethod in class threading.Thread
kexMethod in class threading.Thread in class paramiko.SecurityOptions
key_typesClass in module paramiko.kex_group1 in class paramiko.SecurityOptions
listdirMethod in class paramiko.SFTPClient
listdir_attrMethod in class paramiko.SFTPClient
load_host_keysFunction in module paramiko.util
load_server_moduliMethod in class paramiko.Transport
log_to_fileFunction in module paramiko.util
lookup_ssh_host_configFunction in module paramiko.util
lstatMethod in class paramiko.SFTPClient
makefileMethod in class paramiko.Channel
makefile_stderrMethod in class paramiko.Channel
MAX_REQUEST_SIZEVariable in class paramiko.SFTPFile
MessageClass in package paramiko
messageModule in package paramiko
MIN_PACKET_SIZEVariable in class paramiko.Channel
mkdirMethod in class paramiko.SFTPClient
mod_inverseFunction in module paramiko.util
mroMethod in class __builtin__.type
nextMethod in class paramiko.BufferedFile
normalizeMethod in class paramiko.SFTPClient
objectClass in module __builtin__
open_channelMethod in class paramiko.Transport
open_sessionMethod in class paramiko.Transport
open_sftp_clientMethod in class paramiko.Transport
paramikoPackage
parse_ssh_configFunction in module paramiko.util
PasswordRequiredExceptionClass in package paramiko
PFilterClass in module paramiko.util
pkeyModule in package paramiko
prefetchMethod in class paramiko.SFTPFile
putMethod in class paramiko.SFTPClient
readMethod in class paramiko.BufferedFile
readMethod in class paramiko.SFTPHandle
readlineMethod in class paramiko.BufferedFile
readlinesMethod in class paramiko.BufferedFile
readlinkMethod in class paramiko.SFTPClient
recvMethod in class paramiko.Channel
recv_exit_statusMethod in class paramiko.Channel
recv_readyMethod in class paramiko.Channel
recv_stderrMethod in class paramiko.Channel
recv_stderr_readyMethod in class paramiko.Channel
removeMethod in class paramiko.SFTPClient
renameMethod in class paramiko.SFTPClient
renegotiate_keysMethod in class paramiko.Transport
resize_ptyMethod in class paramiko.Channel
rewindMethod in class paramiko.Message
rmdirMethod in class paramiko.SFTPClient
RSAKeyClass in package paramiko
rsakeyModule in package paramiko
runMethod in class paramiko.Transport
runMethod in class threading.Thread
safe_stringFunction in module paramiko.util
SecurityOptionsClass in package paramiko
seekMethod in class paramiko.BufferedFile
seekMethod in class paramiko.SFTPFile
SEEK_CURVariable in class paramiko.BufferedFile
SEEK_CURVariable in class paramiko.BufferedFile
SEEK_CURVariable in class paramiko.BufferedFile
SEEK_CURVariable in class paramiko.BufferedFile
SEEK_ENDVariable in class paramiko.BufferedFile
SEEK_ENDVariable in class paramiko.BufferedFile
SEEK_ENDVariable in class paramiko.BufferedFile
SEEK_ENDVariable in class paramiko.BufferedFile
SEEK_SETVariable in class paramiko.BufferedFile
SEEK_SETVariable in class paramiko.BufferedFile
SEEK_SETVariable in class paramiko.BufferedFile
SEEK_SETVariable in class paramiko.BufferedFile
sendMethod in class paramiko.Channel
send_exit_statusMethod in class paramiko.Channel
send_ignoreMethod in class paramiko.Transport
send_stderrMethod in class paramiko.Channel
sendallMethod in class paramiko.Channel
sendall_stderrMethod in class paramiko.Channel
serverModule in package paramiko
set_combine_stderrMethod in class paramiko.Channel
set_file_attrMethod in class paramiko.SFTPServer
set_hexdumpMethod in class paramiko.Transport
set_keepaliveMethod in class paramiko.Transport
set_log_channelMethod in class paramiko.Transport
set_nameMethod in class paramiko.Channel
set_pipelinedMethod in class paramiko.SFTPFile
set_subsystem_handlerMethod in class paramiko.Transport
setblockingMethod in class paramiko.Channel
setblockingMethod in class paramiko.SFTPFile
setDaemonMethod in class threading.Thread
setNameMethod in class threading.Thread
settimeoutMethod in class paramiko.Channel
settimeoutMethod in class paramiko.SFTPFile
SFTPClass in package paramiko
sftpModule in package paramiko
sftp_attrModule in package paramiko
SFTP_BAD_MESSAGEVariable in module paramiko.sftp
sftp_clientModule in package paramiko
SFTP_CONNECTION_LOSTVariable in module paramiko.sftp
SFTP_DESCVariable in module paramiko.sftp
SFTP_EOFVariable in module paramiko.sftp
SFTP_FAILUREVariable in module paramiko.sftp
sftp_fileModule in package paramiko
SFTP_FLAG_APPENDVariable in module paramiko.sftp
SFTP_FLAG_CREATEVariable in module paramiko.sftp
SFTP_FLAG_EXCLVariable in module paramiko.sftp
SFTP_FLAG_READVariable in module paramiko.sftp
SFTP_FLAG_TRUNCVariable in module paramiko.sftp
SFTP_FLAG_WRITEVariable in module paramiko.sftp
sftp_handleModule in package paramiko
SFTP_NO_CONNECTIONVariable in module paramiko.sftp
SFTP_NO_SUCH_FILEVariable in module paramiko.sftp
SFTP_OKVariable in module paramiko.sftp
SFTP_OP_UNSUPPORTEDVariable in module paramiko.sftp
SFTP_PERMISSION_DENIEDVariable in module paramiko.sftp
sftp_serverModule in package paramiko
sftp_siModule in package paramiko
SFTPAttributesClass in package paramiko
SFTPClientClass in package paramiko
SFTPErrorClass in package paramiko
SFTPFileClass in package paramiko
SFTPHandleClass in package paramiko
SFTPServerClass in package paramiko
shutdownMethod in class paramiko.Channel
shutdown_readMethod in class paramiko.Channel
shutdown_writeMethod in class paramiko.Channel
sign_ssh_dataMethod in class paramiko.AgentKey
sign_ssh_dataMethod in class paramiko.DSSKey
sign_ssh_dataMethod in class paramiko.RSAKey
SSH2_AGENT_IDENTITIES_ANSWERVariable in module paramiko.agent
SSH2_AGENT_SIGN_RESPONSEVariable in module paramiko.agent
SSH2_AGENTC_REQUEST_IDENTITIESVariable in module paramiko.agent
SSH2_AGENTC_SIGN_REQUESTVariable in module paramiko.agent
SSHExceptionClass in package paramiko
startMethod in class threading.Thread
start_clientMethod in class paramiko.Transport
start_serverMethod in class paramiko.Transport
start_subsystemMethod in class paramiko.SFTPServer
start_subsystemMethod in class paramiko.SubsystemHandler
statMethod in class paramiko.SFTPClient
statMethod in class paramiko.SFTPFile
statMethod in class paramiko.SFTPHandle
stop_threadMethod in class paramiko.Transport
SubsystemHandlerClass in package paramiko
symlinkMethod in class paramiko.SFTPClient
tb_stringsFunction in module paramiko.util
tellMethod in class paramiko.BufferedFile
ThreadClass in module threading
TransportClass in package paramiko
transportModule in package paramiko
typeClass in module __builtin__
unhexifyFunction in module paramiko.util
use_compressionMethod in class paramiko.Transport
utilModule in package paramiko
utimeMethod in class paramiko.SFTPClient
verify_ssh_sigMethod in class paramiko.DSSKey
verify_ssh_sigMethod in class paramiko.RSAKey
writeMethod in class paramiko.BufferedFile
writeMethod in class paramiko.SFTPHandle
write_private_key_fileMethod in class paramiko.DSSKey
write_private_key_fileMethod in class paramiko.RSAKey
writelinesMethod in class paramiko.BufferedFile
xreadlinesMethod in class paramiko.BufferedFile
-
- - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko-module.html b/docs/public/paramiko-module.html deleted file mode 100644 index 15da9ab..0000000 --- a/docs/public/paramiko-module.html +++ /dev/null @@ -1,229 +0,0 @@ - - - - - paramiko - - - - - - - - - - - - - - - - - - -
- - Package paramiko -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Package paramiko

- -

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 heirarchical 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.)

-

To use this package, 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.5.2 (rhydon) -

- -

Author: Robey Pointer -

- -

Contact: robey@lag.net -

- -

License: GNU Lesser General Public License (LGPL) -

- - - - - - - -
Submodules

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Classes
- AgentClient interface for using private keys from an SSH agent running on -the local machine.
- AgentKeyPrivate key held in a local SSH agent.
- BufferedFileReusable base class to implement python-style file buffering around a -simpler stream.
- ChannelA secure tunnel across an SSH Transport.
- DSSKeyRepresentation of a DSS key which can be used to sign an verify SSH2 -data.
- MessageAn SSH2 Message is a stream of bytes that encodes some -combination of strings, integers, bools, and infinite-precision integers -(known in python as longs).
- RSAKeyRepresentation of an RSA key which can be used to sign and verify SSH2 -data.
- SecurityOptionsSimple object containing the security preferences of an ssh -transport.
- SFTPan alias for SFTPClient for backwards compatability
- SFTPAttributesRepresentation of the attributes of a file (or proxied file) for SFTP -in client or server mode.
- SFTPClientSFTP client object.
- SFTPFileProxy object for a file on the remote server, in client mode SFTP.
- SFTPHandleAbstract object representing a handle to an open file (or folder) in -an SFTP server implementation.
- SFTPServerServer-side SFTP subsystem support.
- SubsystemHandlerHandler for a subsytem in server mode.
- TransportAn SSH Transport attaches to a stream (usually a socket), negotiates -an encrypted session, authenticates, and then creates stream tunnels, -called Channels, across the session.

- - - - - - - - - - - - - - -
Exceptions
- BadAuthenticationTypeException raised when an authentication type (like password) is used, -but the server isn't allowing that type.
- PasswordRequiredExceptionException raised when a password is needed to unlock a private key -file.
- SFTPError 
- SSHExceptionException raised by failures in SSH2 protocol negotiation or logic -errors.

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.Agent-class.html b/docs/public/paramiko.Agent-class.html deleted file mode 100644 index 144efdf..0000000 --- a/docs/public/paramiko.Agent-class.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - paramiko.Agent - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class Agent -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Class Agent

- -
- -

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). -
- - - - - - - - - - - - -
Method Summary
 __init__(self) -
-Open a session with the local machine's SSH agent, if one is -running.
 close(self) -
-Close the SSH agent connection.
tuple of AgentKey -get_keys(self) -
-Return the list of keys available through the SSH agent, if any.

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

__init__(self) -
(Constructor) -

- 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 -
-
-
- - -
-

close(self) -

- Close the SSH agent connection. -
-
-
- - -
-

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. -
-
Returns:
-
- a list of keys available on the SSH agent -
           - (type=tuple of AgentKey) -
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.AgentKey-class.html b/docs/public/paramiko.AgentKey-class.html deleted file mode 100644 index 203e0f4..0000000 --- a/docs/public/paramiko.AgentKey-class.html +++ /dev/null @@ -1,236 +0,0 @@ - - - - - paramiko.AgentKey - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class AgentKey -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type AgentKey

- -
-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. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - agent, - blob) -
str -__str__(self) -
-Return a string of an SSH Message made up of the public part(s) of -this key.
str -get_name(self) -
-Return the name of this private key implementation.
Message -sign_ssh_data(self, - randpool, - data) -
-Sign a blob of data with this private key, and return a Message -representing an SSH signature message.
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value

- - - - - - -
Instance Method Details
- - -
-

__str__(self) -
(Informal representation operator) -

- 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:
-
- string representation of an SSH key message. -
           - (type=str) -
-
-
Overrides:
-
paramiko.PKey.__str__ (inherited documentation) -
-
-
-
- - -
-

get_name(self) -

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

sign_ssh_data(self, - randpool, - data) -

- Sign a blob of data with this private key, and return a Message representing an SSH signature - message. -
-
Parameters:
-
randpool - - a secure random number generator. -
           - (type=Crypto.Util.randpool.RandomPool) -
data - - the data to sign. -
           - (type=str) -
-
-
Returns:
-
- an SSH signature message. -
           - (type=Message) -
-
-
Overrides:
-
paramiko.PKey.sign_ssh_data (inherited documentation) -
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.BadAuthenticationType-class.html b/docs/public/paramiko.BadAuthenticationType-class.html deleted file mode 100644 index 27659ed..0000000 --- a/docs/public/paramiko.BadAuthenticationType-class.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - paramiko.BadAuthenticationType - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class BadAuthenticationType -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Class BadAuthenticationType

- -
-Exception --+    
-            |    
- SSHException --+
-                |
-               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 -

- - - - - - - - - - - - - - -
Method Summary
 __init__(self, - explanation, - types) -
 __str__(self) -
    Inherited from Exception
 __getitem__(...) -

- - - - - - - - -
Instance Variable Summary
listallowed_types: list of allowed authentication types provided by the server (possible -values are: "none", -"password", and -"publickey").

- - - - - - -
Instance Variable Details
-
- -

allowed_types

-list of allowed authentication types provided by the server (possible -values are: "none", -"password", and -"publickey"). -
-
-
-
-
Type:
-
- list - -
-
Value:
-
-
-[]                                                                     
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.BufferedFile-class.html b/docs/public/paramiko.BufferedFile-class.html deleted file mode 100644 index 535c74f..0000000 --- a/docs/public/paramiko.BufferedFile-class.html +++ /dev/null @@ -1,554 +0,0 @@ - - - - - paramiko.BufferedFile - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class BufferedFile -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type BufferedFile

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

- -
Known Subclasses:
-
- SFTPFile
- -
- -Reusable base class to implement python-style file buffering around a -simpler stream. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self) -
 __del__(self) -
iterator -__iter__(self) -
-Returns an iterator that can be used to iterate over the lines in this -file.
 close(self) -
-Close the file.
 flush(self) -
-Write out any data in the write buffer.
str -next(self) -
-Returns the next line from the input, or raises -StopIteration when EOF is hit.
str -read(self, - size) -
-Read at most size bytes from the file (less if we hit the -end of the file first).
str -readline(self, - size) -
-Read one entire line from the file.
list -readlines(self, - sizehint) -
-Read all remaining lines using readline and return them as a list.
 seek(self, - offset, - whence) -
-Set the file's current position, like stdio's fseek.
int -tell(self) -
-Return the file's current position.
 write(self, - data) -
-Write data to the file.
 writelines(self, - sequence) -
-Write a sequence of strings to the file.
iterator -xreadlines(self) -
-Identical to iter(f).
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - -
Class Variable Summary
intSEEK_CUR = 1                                                                     
intSEEK_END = 2                                                                     
intSEEK_SET = 0                                                                     

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

__iter__(self) -

- 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:
-
- an interator. -
           - (type=iterator) -
-
-
Raises:
-
ValueError - - if the file is closed. -
-
-
- - -
-

close(self) -

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

flush(self) -

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

next(self) -

- 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:
-
- a line read from the file. -
           - (type=str) -
-
-
Raises:
-
StopIteration - - when the end of the file is reached. -
-
-
- - -
-

read(self, - size=None) -

- 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 - - maximum number of bytes to read. -
           - (type=int) -
-
-
Returns:
-
- data read from the file, or an empty string if EOF was - encountered immediately. -
           - (type=str) -
-
-
-
- - -
-

readline(self, - size=None) -

- 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 - - maximum length of returned string. -
           - (type=int) -
-
-
Returns:
-
- next line of the file, or an empty string if the end of the - file has been reached. -
           - (type=str) -
-
-

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

- -
-
- - -
-

readlines(self, - sizehint=None) -

- 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 - - desired maximum number of bytes to read. -
           - (type=int) -
-
-
Returns:
-
- list of lines read from the file. -
           - (type=list) -
-
-
-
- - -
-

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

- 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. -
           - (type=int) -
whence - - type of movement: 0 = absolute; 1 = relative to the current - position; 2 = relative to the end of the file. -
           - (type=int) -
-
-
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) -

- 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:
-
- file position (in bytes). -
           - (type=int) -
-
-
-
- - -
-

write(self, - data) -

- 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 - - data to write. -
           - (type=str) -
-
-
-
- - -
-

writelines(self, - sequence) -

- 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 - - an iterable sequence of strings. -
           - (type=sequence) -
-
-
-
- - -
-

xreadlines(self) -

- Identical to iter(f). This is a deprecated file - interface that predates python iterator support. -
-
Returns:
-
- an iterator. -
           - (type=iterator) -
-
-
-
-
- - - - - - -
Class Variable Details
-
- -

SEEK_CUR

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-1                                                                     
-
-
-
-
-
- -

SEEK_END

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-2                                                                     
-
-
-
-
-
- -

SEEK_SET

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-0                                                                     
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.Channel-class.html b/docs/public/paramiko.Channel-class.html deleted file mode 100644 index 89bff06..0000000 --- a/docs/public/paramiko.Channel-class.html +++ /dev/null @@ -1,1241 +0,0 @@ - - - - - paramiko.Channel - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class Channel -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type Channel

- -
-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. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - chanid) -
-Create a new channel.
 __del__(self) -
str -__repr__(self) -
-Return a string representation of this object, for debugging.
 close(self) -
-Close the channel.
bool -exec_command(self, - command) -
-Execute a command on the server.
int -fileno(self) -
-Returns an OS-level file descriptor which can be used for polling, but -but not for reading or writing).
int -get_id(self) -
-Return the ID # for this channel.
str -get_name(self) -
-Get the name of this channel that was previously set by set_name.
bool -get_pty(self, - term, - width, - height) -
-Request a pseudo-terminal from the server.
Transport -get_transport(self) -
-Return the Transport associated with this channel.
float -gettimeout(self) -
-Returns the timeout in seconds (as a float) associated with socket -operations, or None if no timeout is set.
bool -invoke_shell(self) -
-Request an interactive shell session on this channel.
bool -invoke_subsystem(self, - subsystem) -
-Request a subsystem on the server (for example, -sftp).
ChannelFile -makefile(self, - *params) -
-Return a file-like object associated with this channel.
ChannelFile -makefile_stderr(self, - *params) -
-Return a file-like object associated with this channel's stderr -stream.
str -recv(self, - nbytes) -
-Receive data from the channel.
int -recv_exit_status(self) -
-Return the exit status from the process on the server.
boolean -recv_ready(self) -
-Returns true if data is buffered and ready to be read from this -channel.
str -recv_stderr(self, - nbytes) -
-Receive data from the channel's stderr stream.
boolean -recv_stderr_ready(self) -
-Returns true if data is buffered and ready to be read from this -channel's stderr stream.
bool -resize_pty(self, - width, - height) -
-Resize the pseudo-terminal.
int -send(self, - s) -
-Send data to the channel.
 send_exit_status(self, - status) -
-Send the exit status of an executed command to the client.
int -send_stderr(self, - s) -
-Send data to the channel on the "stderr" stream.
 sendall(self, - s) -
-Send data to the channel, without allowing partial results.
 sendall_stderr(self, - s) -
-Send data to the channel's "stderr" stream, without allowing -partial results.
bool -set_combine_stderr(self, - combine) -
-Set whether stderr should be combined into stdout on this channel.
 set_name(self, - name) -
-Set a name for this channel.
 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.
 settimeout(self, - timeout) -
-Set a timeout on blocking read/write operations.
 shutdown(self, - how) -
-Shut down one or both halves of the connection.
 shutdown_read(self) -
-Shutdown the receiving side of this socket, closing the stream in the -incoming direction.
 shutdown_write(self) -
-Shutdown the sending side of this socket, closing the stream in the -outgoing direction.
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - -
Class Variable Summary
intMIN_PACKET_SIZE = 1024                                                                  

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

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

- 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 - - the ID of this channel, as passed by an existing Transport. -
           - (type=int) -
-
-
Overrides:
-
__builtin__.object.__init__
-
-
-
- - -
-

__repr__(self) -
(Representation operator) -

- Return a string representation of this object, for debugging. -
-
Returns:
-
- str -
-
-
Overrides:
-
__builtin__.object.__repr__
-
-
-
- - -
-

close(self) -

- 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) -

-

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 - - a shell command to execute. -
           - (type=str) -
-
-
Returns:
-
- True if the operation succeeded; - False if not. -
           - (type=bool) -
-
-
-
- - -
-

fileno(self) -

-

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 open - hundreds or thousands of channels simultaneously, but it's still - notable. -
-
Returns:
-
- an OS-level file descriptor -
           - (type=int) -
-
-

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

- -
-
- - -
-

get_id(self) -

- 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:
-
- the ID of this channel. -
           - (type=int) -
-
-

Since: ivysaur -

- -
-
- - -
-

get_name(self) -

- Get the name of this channel that was previously set by set_name. -
-
Returns:
-
- the name of this channel. -
           - (type=str) -
-
-
-
- - -
-

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

- 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 - - the terminal type to emulate (for example, - 'vt100'). -
           - (type=str) -
width - - width (in characters) of the terminal screen -
           - (type=int) -
height - - height (in characters) of the terminal screen -
           - (type=int) -
-
-
Returns:
-
- True if the operation succeeded; - False if not. -
           - (type=bool) -
-
-
-
- - -
-

get_transport(self) -

- Return the Transport associated with this - channel. -
-
Returns:
-
- the Transport that was used to create - this channel. -
           - (type=Transport) -
-
-
-
- - -
-

gettimeout(self) -

- 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:
-
- timeout in seconds, or None. -
           - (type=float) -
-
-
-
- - -
-

invoke_shell(self) -

-

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. -
-
Returns:
-
- True if the operation succeeded; - False if not. -
           - (type=bool) -
-
-
-
- - -
-

invoke_subsystem(self, - subsystem) -

-

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 - - name of the subsystem being requested. -
           - (type=str) -
-
-
Returns:
-
- True if the operation succeeded; - False if not. -
           - (type=bool) -
-
-
-
- - -
-

makefile(self, - *params) -

- 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:
-
- object which can be used for python file I/O. -
           - (type=ChannelFile) -
-
-
-
- - -
-

makefile_stderr(self, - *params) -

-

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:
-
- object which can be used for python file I/O. -
           - (type=ChannelFile) -
-
-

Since: 1.1 -

- -
-
- - -
-

recv(self, - nbytes) -

- 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 - - maximum number of bytes to read. -
           - (type=int) -
-
-
Returns:
-
- data. -
           - (type=str) -
-
-
Raises:
-
socket.timeout - - if no data is ready before the timeout set by settimeout. -
-
-
- - -
-

recv_exit_status(self) -

- 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:
-
- the exit code of the process on the server. -
           - (type=int) -
-
-

Since: 1.2 -

- -
-
- - -
-

recv_ready(self) -

- 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:
-
- True if a recv call on this channel would - immediately return at least one byte; False - otherwise. -
           - (type=boolean) -
-
-
-
- - -
-

recv_stderr(self, - nbytes) -

- 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 - - maximum number of bytes to read. -
           - (type=int) -
-
-
Returns:
-
- data. -
           - (type=str) -
-
-
Raises:
-
socket.timeout - - if no data is ready before the timeout set by settimeout. -
-

Since: 1.1 -

- -
-
- - -
-

recv_stderr_ready(self) -

- 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:
-
- True if a recv_stderr call on this channel - would immediately return at least one byte; False - otherwise. -
           - (type=boolean) -
-
-

Since: 1.1 -

- -
-
- - -
-

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

- 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 - - new width (in characters) of the terminal screen -
           - (type=int) -
height - - new height (in characters) of the terminal screen -
           - (type=int) -
-
-
Returns:
-
- True if the operation succeeded; - False if not. -
           - (type=bool) -
-
-
-
- - -
-

send(self, - s) -

- 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 - - data to send. -
           - (type=str) -
-
-
Returns:
-
- number of bytes actually sent. -
           - (type=int) -
-
-
Raises:
-
socket.timeout - - if no data could be sent before the timeout set by settimeout. -
-
-
- - -
-

send_exit_status(self, - status) -

- 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 - - the exit code of the process -
           - (type=int) -
-
-

Since: 1.2 -

- -
-
- - -
-

send_stderr(self, - s) -

- 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 - - data to send. -
           - (type=str) -
-
-
Returns:
-
- number of bytes actually sent. -
           - (type=int) -
-
-
Raises:
-
socket.timeout - - if no data could be sent before the timeout set by settimeout. -
-

Since: 1.1 -

- -
-
- - -
-

sendall(self, - s) -

- 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 - - data to send. -
           - (type=str) -
-
-
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) -

- 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 - - data to send to the client as "stderr" output. -
           - (type=str) -
-
-
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) -

-

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 - - True if stderr output should be combined into - stdout on this channel. -
           - (type=bool) -
-
-
Returns:
-
- previous setting. -
           - (type=bool) -
-
-

Since: 1.1 -

- -
-
- - -
-

set_name(self, - name) -

- Set a name for this channel. Currently it's only used to set the - name of the log level used for debugging. The name can be fetched with - the get_name method. -
-
Parameters:
-
name - - new channel name. -
           - (type=str) -
-
-
-
- - -
-

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. 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.

- chan.setblocking(0) is equivalent to - chan.settimeout(0); chan.setblocking(1) is - equivalent to chan.settimeout(None). -
-
Parameters:
-
blocking - - 0 to set non-blocking mode; non-0 to set blocking mode. -
           - (type=int) -
-
-
-
- - -
-

settimeout(self, - timeout) -

-

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 - - seconds to wait for a pending read/write operation before - raising socket.timeout, or None for no - timeout. -
           - (type=float) -
-
-
-
- - -
-

shutdown(self, - how) -

- 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 - - 0 (stop receiving), 1 (stop sending), or 2 (stop receiving and - sending). -
           - (type=int) -
-
-
-
- - -
-

shutdown_read(self) -

- 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) -

- 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 -

- -
-
-
- - - - - - -
Class Variable Details
-
- -

MIN_PACKET_SIZE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-1024                                                                  
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.DSSKey-class.html b/docs/public/paramiko.DSSKey-class.html deleted file mode 100644 index f36e784..0000000 --- a/docs/public/paramiko.DSSKey-class.html +++ /dev/null @@ -1,423 +0,0 @@ - - - - - paramiko.DSSKey - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class DSSKey -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type DSSKey

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

- -
- -Representation of a DSS key which can be used to sign an verify SSH2 -data. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - msg, - data) -
-Create a new instance of this public key type.
 __hash__(self) -
str -__str__(self) -
-Return a string of an SSH Message made up of the public part(s) of -this key.
bool -can_sign(self) -
-Return True if this key has the private part necessary -for signing data.
DSSKey -generate(bits, - progress_func) -
-Generate a new private DSS key. (Static method) -
int -get_bits(self) -
-Return the number of significant bits in this key.
str -get_name(self) -
-Return the name of this private key implementation.
 sign_ssh_data(self, - rpool, - data) -
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.
 write_private_key_file(self, - filename, - password) -
-Write private key contents into a file.
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value

- - - - - - -
Instance Method Details
- - -
-

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

- 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. -
           - (type=Message) -
data - - an optional string containing a public key of this type -
           - (type=str) -
-
-
Raises:
-
SSHException - - if a key cannot be created from the data or - msg given, or no key was passed in. -
-
Overrides:
-
paramiko.PKey.__init__ (inherited documentation) -
-
-
-
- - -
-

__str__(self) -
(Informal representation operator) -

- 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:
-
- string representation of an SSH key message. -
           - (type=str) -
-
-
Overrides:
-
paramiko.PKey.__str__ (inherited documentation) -
-
-
-
- - -
-

can_sign(self) -

- Return True if this key has the private part necessary - for signing data. -
-
Returns:
-
- True if this is a private key. -
           - (type=bool) -
-
-
Overrides:
-
paramiko.PKey.can_sign (inherited documentation) -
-
-
-
- - -
-

get_bits(self) -

- Return the number of significant bits in this key. This is useful - for judging the relative security of a key. -
-
Returns:
-
- bits in the key. -
           - (type=int) -
-
-
Overrides:
-
paramiko.PKey.get_bits (inherited documentation) -
-
-
-
- - -
-

get_name(self) -

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

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. -
-
Parameters:
-
data - - the data that was signed. -
           - (type=str) -
msg - - an SSH signature message -
           - (type=Message) -
-
-
Returns:
-
- True if the signature verifies correctly; - False otherwise. -
           - (type=boolean) -
-
-
Overrides:
-
paramiko.PKey.verify_ssh_sig (inherited documentation) -
-
-
-
- - -
-

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

- 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. -
           - (type=str) -
password - - an optional password to use to encrypt the key file. -
           - (type=str) -
-
-
Raises:
-
IOError - - if there was an error writing the file. -
SSHException - - if the key is invalid. -
-
Overrides:
-
paramiko.PKey.write_private_key_file (inherited documentation) -
-
-

Since: fearow -

- -
-
-
- - - - - - -
Static Method Details
- - -
-

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

- Generate a new private DSS key. This factory function can be used to - generate a new host key or authentication key. -
-
Parameters:
-
bits - - number of bits the generated key should be. -
           - (type=int) -
progress_func - - an optional function to call at key points in key generation - (used by pyCrypto.PublicKey). -
           - (type=function) -
-
-
Returns:
-
- new private key -
           - (type=DSSKey) -
-
-

Since: fearow -

- -
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.Message-class.html b/docs/public/paramiko.Message-class.html deleted file mode 100644 index 7f097f8..0000000 --- a/docs/public/paramiko.Message-class.html +++ /dev/null @@ -1,650 +0,0 @@ - - - - - paramiko.Message - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class Message -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type Message

- -
-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. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - content) -
-Create a new SSH2 Message.
string -__repr__(self) -
-Returns a string representation of this object, for debugging.
string -__str__(self) -
-Return the byte stream content of this Message, as a string.
 add(self, - *seq) -
-Add a sequence of items to the stream.
 add_boolean(self, - b) -
-Add a boolean value to the stream.
 add_byte(self, - b) -
-Write a single byte to the stream, without any formatting.
 add_bytes(self, - b) -
-Write bytes to the stream, without any formatting.
 add_int(self, - n) -
-Add an integer to the stream.
 add_int64(self, - n) -
-Add a 64-bit int to the stream.
 add_list(self, - l) -
-Add a list of strings to the stream.
 add_mpint(self, - z) -
-Add a long int to the stream, encoded as an infinite-precision -integer.
 add_string(self, - s) -
-Add a string to the stream.
bool -get_boolean(self) -
-Fetch a boolean from the stream.
string -get_byte(self) -
-Return the next byte of the Message, without decomposing it.
string -get_bytes(self, - n) -
-Return the next n bytes of the Message, without -decomposing into an int, string, etc.
int -get_int(self) -
-Fetch an int from the stream.
long -get_int64(self) -
-Fetch a 64-bit int from the stream.
list of strings -get_list(self) -
-Fetch a list of strings from the stream.
long -get_mpint(self) -
-Fetch a long int (mpint) from the stream.
string -get_remainder(self) -
-Return the bytes of this Message that haven't already been parsed and -returned.
string -get_so_far(self) -
-Returns the bytes of this Message that have been parsed and -returned.
string -get_string(self) -
-Fetch a string from the stream.
 rewind(self) -
-Rewind the message to the beginning as if no items had been parsed out -of it yet.
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value

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

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

- Create a new SSH2 Message. -
-
Parameters:
-
content - - the byte stream to use as the Message content (passed in only - when decomposing a Message). -
           - (type=string) -
-
-
Overrides:
-
__builtin__.object.__init__
-
-
-
- - -
-

__repr__(self) -
(Representation operator) -

- Returns a string representation of this object, for debugging. -
-
Returns:
-
- string -
-
-
Overrides:
-
__builtin__.object.__repr__
-
-
-
- - -
-

__str__(self) -
(Informal representation operator) -

- Return the byte stream content of this Message, as a string. -
-
Returns:
-
- the contents of this Message. -
           - (type=string) -
-
-
Overrides:
-
__builtin__.object.__str__
-
-
-
- - -
-

add(self, - *seq) -

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

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

- -
-
- - -
-

add_boolean(self, - b) -

- Add a boolean value to the stream. -
-
Parameters:
-
b - - boolean value to add -
           - (type=bool) -
-
-
-
- - -
-

add_byte(self, - b) -

- Write a single byte to the stream, without any formatting. -
-
Parameters:
-
b - - byte to add -
           - (type=str) -
-
-
-
- - -
-

add_bytes(self, - b) -

- Write bytes to the stream, without any formatting. -
-
Parameters:
-
b - - bytes to add -
           - (type=str) -
-
-
-
- - -
-

add_int(self, - n) -

- Add an integer to the stream. -
-
Parameters:
-
n - - integer to add -
           - (type=int) -
-
-
-
- - -
-

add_int64(self, - n) -

- Add a 64-bit int to the stream. -
-
Parameters:
-
n - - long int to add -
           - (type=long) -
-
-
-
- - -
-

add_list(self, - l) -

- 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 of strings to add -
           - (type=list(str)) -
-
-
-
- - -
-

add_mpint(self, - z) -

- Add a long int to the stream, encoded as an infinite-precision - integer. This method only works on positive numbers. -
-
Parameters:
-
z - - long int to add -
           - (type=long) -
-
-
-
- - -
-

add_string(self, - s) -

- Add a string to the stream. -
-
Parameters:
-
s - - string to add -
           - (type=str) -
-
-
-
- - -
-

get_boolean(self) -

- Fetch a boolean from the stream. -
-
Returns:
-
- True or False (from the - Message). -
           - (type=bool) -
-
-
-
- - -
-

get_byte(self) -

- Return the next byte of the Message, without decomposing it. This is - equivalent to get_bytes(1). -
-
Returns:
-
- the next byte of the Message, or '' if there - aren't any bytes remaining. -
           - (type=string) -
-
-
-
- - -
-

get_bytes(self, - n) -

- Return the next n bytes of the Message, without - decomposing into an int, string, etc. Just the raw bytes are - returned. -
-
Returns:
-
- a string of the next n bytes of the Message, or a - string of n zero bytes, if there aren't - n bytes remaining. -
           - (type=string) -
-
-
-
- - -
-

get_int(self) -

- Fetch an int from the stream. -
-
Returns:
-
- a 32-bit unsigned integer. -
           - (type=int) -
-
-
-
- - -
-

get_int64(self) -

- Fetch a 64-bit int from the stream. -
-
Returns:
-
- a 64-bit unsigned integer. -
           - (type=long) -
-
-
-
- - -
-

get_list(self) -

- Fetch a list of strings from the stream. These are trivially encoded - as comma-separated values in a string. -
-
Returns:
-
- a list of strings. -
           - (type=list of strings) -
-
-
-
- - -
-

get_mpint(self) -

- Fetch a long int (mpint) from the stream. -
-
Returns:
-
- an arbitrary-length integer. -
           - (type=long) -
-
-
-
- - -
-

get_remainder(self) -

- Return the bytes of this Message that haven't already been parsed - and returned. -
-
Returns:
-
- a string of the bytes not parsed yet. -
           - (type=string) -
-
-
-
- - -
-

get_so_far(self) -

- 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:
-
- a string of the bytes parsed so far. -
           - (type=string) -
-
-
-
- - -
-

get_string(self) -

- 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:
-
- a string. -
           - (type=string) -
-
-
-
- - -
-

rewind(self) -

- Rewind the message to the beginning as if no items had been parsed - out of it yet. -
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:46 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.PasswordRequiredException-class.html b/docs/public/paramiko.PasswordRequiredException-class.html deleted file mode 100644 index 3d05e9c..0000000 --- a/docs/public/paramiko.PasswordRequiredException-class.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - paramiko.PasswordRequiredException - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class PasswordRequiredException -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Class PasswordRequiredException

- -
-Exception --+    
-            |    
- SSHException --+
-                |
-               PasswordRequiredException
-

- -
- -Exception raised when a password is needed to unlock a private key -file. -
- - - - - - - - - - - - - - -
Method Summary
    Inherited from Exception
 __init__(...) -
 __getitem__(...) -
 __str__(...) -

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.RSAKey-class.html b/docs/public/paramiko.RSAKey-class.html deleted file mode 100644 index 168a684..0000000 --- a/docs/public/paramiko.RSAKey-class.html +++ /dev/null @@ -1,423 +0,0 @@ - - - - - paramiko.RSAKey - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class RSAKey -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type RSAKey

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

- -
- -Representation of an RSA key which can be used to sign and verify SSH2 -data. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - msg, - data) -
-Create a new instance of this public key type.
 __hash__(self) -
str -__str__(self) -
-Return a string of an SSH Message made up of the public part(s) of -this key.
bool -can_sign(self) -
-Return True if this key has the private part necessary -for signing data.
RSAKey -generate(bits, - progress_func) -
-Generate a new private RSA key. (Static method) -
int -get_bits(self) -
-Return the number of significant bits in this key.
str -get_name(self) -
-Return the name of this private key implementation.
 sign_ssh_data(self, - rpool, - data) -
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.
 write_private_key_file(self, - filename, - password) -
-Write private key contents into a file.
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value

- - - - - - -
Instance Method Details
- - -
-

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

- 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. -
           - (type=Message) -
data - - an optional string containing a public key of this type -
           - (type=str) -
-
-
Raises:
-
SSHException - - if a key cannot be created from the data or - msg given, or no key was passed in. -
-
Overrides:
-
paramiko.PKey.__init__ (inherited documentation) -
-
-
-
- - -
-

__str__(self) -
(Informal representation operator) -

- 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:
-
- string representation of an SSH key message. -
           - (type=str) -
-
-
Overrides:
-
paramiko.PKey.__str__ (inherited documentation) -
-
-
-
- - -
-

can_sign(self) -

- Return True if this key has the private part necessary - for signing data. -
-
Returns:
-
- True if this is a private key. -
           - (type=bool) -
-
-
Overrides:
-
paramiko.PKey.can_sign (inherited documentation) -
-
-
-
- - -
-

get_bits(self) -

- Return the number of significant bits in this key. This is useful - for judging the relative security of a key. -
-
Returns:
-
- bits in the key. -
           - (type=int) -
-
-
Overrides:
-
paramiko.PKey.get_bits (inherited documentation) -
-
-
-
- - -
-

get_name(self) -

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

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. -
-
Parameters:
-
data - - the data that was signed. -
           - (type=str) -
msg - - an SSH signature message -
           - (type=Message) -
-
-
Returns:
-
- True if the signature verifies correctly; - False otherwise. -
           - (type=boolean) -
-
-
Overrides:
-
paramiko.PKey.verify_ssh_sig (inherited documentation) -
-
-
-
- - -
-

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

- 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. -
           - (type=str) -
password - - an optional password to use to encrypt the key file. -
           - (type=str) -
-
-
Raises:
-
IOError - - if there was an error writing the file. -
SSHException - - if the key is invalid. -
-
Overrides:
-
paramiko.PKey.write_private_key_file (inherited documentation) -
-
-

Since: fearow -

- -
-
-
- - - - - - -
Static Method Details
- - -
-

generate(bits, - progress_func=None) -

- Generate a new private RSA key. This factory function can be used to - generate a new host key or authentication key. -
-
Parameters:
-
bits - - number of bits the generated key should be. -
           - (type=int) -
progress_func - - an optional function to call at key points in key generation - (used by pyCrypto.PublicKey). -
           - (type=function) -
-
-
Returns:
-
- new private key -
           - (type=RSAKey) -
-
-

Since: fearow -

- -
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.SFTP-class.html b/docs/public/paramiko.SFTP-class.html deleted file mode 100644 index 72ebc70..0000000 --- a/docs/public/paramiko.SFTP-class.html +++ /dev/null @@ -1,287 +0,0 @@ - - - - - paramiko.SFTP - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SFTP -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type SFTP

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

- -
- -an alias for SFTPClient for backwards compatability -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
    Inherited from SFTPClient
 __init__(self, - sock) -
-Create an SFTP client from an existing Channel.
 __del__(self) -
 chdir(self, - path) -
-Change the "current directory" of this SFTP session.
 chmod(self, - path, - mode) -
-Change the mode (permissions) of a file.
 chown(self, - path, - uid, - gid) -
-Change the owner (uid) and group (gid) of a -file.
 close(self) -
-Close the SFTP session and its underlying channel.
SFTPFile -file(self, - filename, - mode, - bufsize) -
-Open a file on the remote server.
SFTPClient -from_transport(selfclass, - t) -
-Create an SFTP client channel from an open Transport. (Class method) -
 get(self, - remotepath, - localpath) -
-Copy a remote file (remotepath) from the SFTP server to -the local host as localpath.
str -getcwd(self) -
-Return the "current working directory" for this SFTP -session, as emulated by paramiko.
list of str -listdir(self, - path) -
-Return a list containing the names of the entries in the given -path.
list of SFTPAttributes -listdir_attr(self, - path) -
-Return a list containing SFTPAttributes objects corresponding to -files in the given path.
SFTPAttributes -lstat(self, - path) -
-Retrieve information about a file on the remote system, without -following symbolic links (shortcuts).
 mkdir(self, - path, - mode) -
-Create a folder (directory) named path with numeric mode -mode.
str -normalize(self, - path) -
-Return the normalized path (on the server) of a given path.
SFTPFile -open(self, - filename, - mode, - bufsize) -
-Open a file on the remote server.
 put(self, - localpath, - remotepath) -
-Copy a local file (localpath) to the SFTP server as -remotepath.
str -readlink(self, - path) -
-Return the target of a symbolic link (shortcut).
 remove(self, - path) -
-Remove the file at the given path.
 rename(self, - oldpath, - newpath) -
-Rename a file or folder from oldpath to -newpath.
 rmdir(self, - path) -
-Remove the folder named path.
SFTPAttributes -stat(self, - path) -
-Retrieve information about a file on the remote system.
 symlink(self, - source, - dest) -
-Create a symbolic link (shortcut) of the source path at -destination.
 unlink(self, - path) -
-Remove the file at the given path.
 utime(self, - path, - times) -
-Set the access and modified times of the file specified by -path.
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.SFTPAttributes-class.html b/docs/public/paramiko.SFTPAttributes-class.html deleted file mode 100644 index c3cc57c..0000000 --- a/docs/public/paramiko.SFTPAttributes-class.html +++ /dev/null @@ -1,360 +0,0 @@ - - - - - paramiko.SFTPAttributes - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SFTPAttributes -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type SFTPAttributes

- -
-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. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self) -
-Create a new (empty) SFTPAttributes object.
 __repr__(self) -
 __str__(self) -
-create a unix-style long description of the file (like ls -l)
SFTPAttributes -from_stat(cls, - obj, - filename) -
-Create an SFTPAttributes object from an existing stat -object (an object returned by os.stat). (Class method) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value

- - - - - - - - - - - - - - - - -
Class Variable Summary
intFLAG_AMTIME = 8                                                                     
longFLAG_EXTENDED = 2147483648L -
intFLAG_PERMISSIONS = 4                                                                     
intFLAG_SIZE = 1                                                                     
intFLAG_UIDGID = 2                                                                     

- - - - - - -
Instance Method Details
- - -
-

__init__(self) -
(Constructor) -

- Create a new (empty) SFTPAttributes object. All fields will be - empty. -
-
Overrides:
-
__builtin__.object.__init__
-
-
-
- - -
-

__str__(self) -
(Informal representation operator) -

- create a unix-style long description of the file (like ls -l) -
-
Overrides:
-
__builtin__.object.__str__
-
-
-
-
- - - - - - -
Class Method Details
- - -
-

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

- Create an SFTPAttributes object from an existing stat - object (an object returned by os.stat). -
-
Parameters:
-
obj - - an object returned by os.stat (or - equivalent). -
           - (type=object) -
filename - - the filename associated with this file. -
           - (type=str) -
-
-
Returns:
-
- new SFTPAttributes object with the same - attribute fields. -
           - (type=SFTPAttributes) -
-
-
-
-
- - - - - - -
Class Variable Details
-
- -

FLAG_AMTIME

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-8                                                                     
-
-
-
-
-
- -

FLAG_EXTENDED

-
-
-
-
-
Type:
-
- long - -
-
Value:
-
-
-2147483648L                                                            
-
-
-
-
-
- -

FLAG_PERMISSIONS

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-4                                                                     
-
-
-
-
-
- -

FLAG_SIZE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-1                                                                     
-
-
-
-
-
- -

FLAG_UIDGID

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-2                                                                     
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.SFTPClient-class.html b/docs/public/paramiko.SFTPClient-class.html deleted file mode 100644 index d691c5e..0000000 --- a/docs/public/paramiko.SFTPClient-class.html +++ /dev/null @@ -1,1009 +0,0 @@ - - - - - paramiko.SFTPClient - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SFTPClient -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type SFTPClient

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

- -
Known Subclasses:
-
- SFTP
- -
- -SFTP client object. SFTPClient is used to open an sftp -session across an open ssh Transport and do remote file -operations. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - sock) -
-Create an SFTP client from an existing Channel.
 __del__(self) -
 chdir(self, - path) -
-Change the "current directory" of this SFTP session.
 chmod(self, - path, - mode) -
-Change the mode (permissions) of a file.
 chown(self, - path, - uid, - gid) -
-Change the owner (uid) and group (gid) of a -file.
 close(self) -
-Close the SFTP session and its underlying channel.
SFTPFile -file(self, - filename, - mode, - bufsize) -
-Open a file on the remote server.
SFTPClient -from_transport(selfclass, - t) -
-Create an SFTP client channel from an open Transport. (Class method) -
 get(self, - remotepath, - localpath) -
-Copy a remote file (remotepath) from the SFTP server to -the local host as localpath.
str -getcwd(self) -
-Return the "current working directory" for this SFTP -session, as emulated by paramiko.
list of str -listdir(self, - path) -
-Return a list containing the names of the entries in the given -path.
list of SFTPAttributes -listdir_attr(self, - path) -
-Return a list containing SFTPAttributes objects corresponding to -files in the given path.
SFTPAttributes -lstat(self, - path) -
-Retrieve information about a file on the remote system, without -following symbolic links (shortcuts).
 mkdir(self, - path, - mode) -
-Create a folder (directory) named path with numeric mode -mode.
str -normalize(self, - path) -
-Return the normalized path (on the server) of a given path.
SFTPFile -open(self, - filename, - mode, - bufsize) -
-Open a file on the remote server.
 put(self, - localpath, - remotepath) -
-Copy a local file (localpath) to the SFTP server as -remotepath.
str -readlink(self, - path) -
-Return the target of a symbolic link (shortcut).
 remove(self, - path) -
-Remove the file at the given path.
 rename(self, - oldpath, - newpath) -
-Rename a file or folder from oldpath to -newpath.
 rmdir(self, - path) -
-Remove the folder named path.
SFTPAttributes -stat(self, - path) -
-Retrieve information about a file on the remote system.
 symlink(self, - source, - dest) -
-Create a symbolic link (shortcut) of the source path at -destination.
 unlink(self, - path) -
-Remove the file at the given path.
 utime(self, - path, - times) -
-Set the access and modified times of the file specified by -path.
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - -
Instance Method Details
- - -
-

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

-

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:
-
sock - - an open Channel using the - "sftp" subsystem. -
           - (type=Channel) -
-
-
Overrides:
-
paramiko.BaseSFTP.__init__
-
-
-
- - -
-

chdir(self, - path) -

- 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. -
-
Parameters:
-
path - - new current working directory -
           - (type=str) -
-
-
Raises:
-
IOError - - if the requested path doesn't exist on the server -
-

Since: 1.4 -

- -
-
- - -
-

chmod(self, - path, - mode) -

- 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 - - path of the file to change the permissions of. -
           - (type=string) -
mode - - new permissions. -
           - (type=int) -
-
-
-
- - -
-

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

- 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 - - path of the file to change the owner and group of. -
           - (type=string) -
uid - - new owner's uid -
           - (type=int) -
gid - - new group id -
           - (type=int) -
-
-
-
- - -
-

close(self) -

- Close the SFTP session and its underlying channel. -
-

Since: 1.4 -

- -
-
- - -
-

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

-

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 - - name of the file to open. -
           - (type=string) -
mode - - mode (python-style) to open in. -
           - (type=string) -
bufsize - - desired buffering (-1 = default buffer size) -
           - (type=int) -
-
-
Returns:
-
- a file object representing the open file. -
           - (type=SFTPFile) -
-
-
Raises:
-
IOError - - if the file could not be opened. -
-
-
- - -
-

get(self, - remotepath, - localpath) -

- 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 - - the remote file to copy -
           - (type=str) -
localpath - - the destination path on the local host -
           - (type=str) -
-
-

Since: 1.4 -

- -
-
- - -
-

getcwd(self) -

- 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:
-
- the current working directory on the server, or - None -
           - (type=str) -
-
-

Since: 1.4 -

- -
-
- - -
-

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

- 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 - - path to list (defaults to '.') -
           - (type=str) -
-
-
Returns:
-
- list of filenames -
           - (type=list of str) -
-
-
-
- - -
-

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

- 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. -
-
Parameters:
-
path - - path to list (defaults to '.') -
           - (type=str) -
-
-
Returns:
-
- list of attributes -
           - (type=list of SFTPAttributes) -
-
-

Since: 1.2 -

- -
-
- - -
-

lstat(self, - path) -

- Retrieve information about a file on the remote system, without - following symbolic links (shortcuts). This otherwise behaves exactly - the same as stat. -
-
Parameters:
-
path - - the filename to stat. -
           - (type=string) -
-
-
Returns:
-
- an object containing attributes about the given file. -
           - (type=SFTPAttributes) -
-
-
-
- - -
-

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

- 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 - - name of the folder to create. -
           - (type=string) -
mode - - permissions (posix-style) for the newly-created folder. -
           - (type=int) -
-
-
-
- - -
-

normalize(self, - path) -

- 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 - - path to be normalized. -
           - (type=str) -
-
-
Returns:
-
- normalized form of the given path. -
           - (type=str) -
-
-
Raises:
-
IOError - - if the path can't be resolved on the server -
-
-
- - -
-

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

-

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 - - name of the file to open. -
           - (type=string) -
mode - - mode (python-style) to open in. -
           - (type=string) -
bufsize - - desired buffering (-1 = default buffer size) -
           - (type=int) -
-
-
Returns:
-
- a file object representing the open file. -
           - (type=SFTPFile) -
-
-
Raises:
-
IOError - - if the file could not be opened. -
-
-
- - -
-

put(self, - localpath, - remotepath) -

-

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 - - the local file to copy -
           - (type=str) -
remotepath - - the destination path on the SFTP server -
           - (type=str) -
-
-

Since: 1.4 -

- -
-
- - -
-

readlink(self, - path) -

- 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 - - path of the symbolic link file. -
           - (type=str) -
-
-
Returns:
-
- target path. -
           - (type=str) -
-
-
-
- - -
-

remove(self, - path) -

- Remove the file at the given path. -
-
Parameters:
-
path - - path (absolute or relative) of the file to remove. -
           - (type=string) -
-
-
Raises:
-
IOError - - if the path refers to a folder (directory). Use rmdir to remove a folder. -
-
-
- - -
-

rename(self, - oldpath, - newpath) -

- Rename a file or folder from oldpath to - newpath. -
-
Parameters:
-
oldpath - - existing name of the file or folder. -
           - (type=string) -
newpath - - new name for the file or folder. -
           - (type=string) -
-
-
Raises:
-
IOError - - if newpath is a folder, or something else goes - wrong. -
-
-
- - -
-

rmdir(self, - path) -

- Remove the folder named path. -
-
Parameters:
-
path - - name of the folder to remove. -
           - (type=string) -
-
-
-
- - -
-

stat(self, - path) -

-

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 - - the filename to stat. -
           - (type=string) -
-
-
Returns:
-
- an object containing attributes about the given file. -
           - (type=SFTPAttributes) -
-
-
-
- - -
-

symlink(self, - source, - dest) -

- Create a symbolic link (shortcut) of the source path at - destination. -
-
Parameters:
-
source - - path of the original file. -
           - (type=string) -
dest - - path of the newly created symlink. -
           - (type=string) -
-
-
-
- - -
-

unlink(self, - path) -

- Remove the file at the given path. -
-
Parameters:
-
path - - path (absolute or relative) of the file to remove. -
           - (type=string) -
-
-
Raises:
-
IOError - - if the path refers to a folder (directory). Use rmdir to remove a folder. -
-
-
- - -
-

utime(self, - path, - times) -

- 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 - - path of the file to modify. -
           - (type=string) -
times - - None or a tuple of (access time, modified time) - in standard internet epoch time (seconds since 01 January 1970 - GMT). -
           - (type=tuple of int) -
-
-
-
-
- - - - - - -
Class Method Details
- - -
-

from_transport(selfclass, - t) -

- Create an SFTP client channel from an open Transport. -
-
Parameters:
-
t - - an open Transport which is already - authenticated. -
           - (type=Transport) -
-
-
Returns:
-
- a new SFTPClient object, referring to an - sftp session (channel) across the transport. -
           - (type=SFTPClient) -
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.SFTPError-class.html b/docs/public/paramiko.SFTPError-class.html deleted file mode 100644 index ed3a76d..0000000 --- a/docs/public/paramiko.SFTPError-class.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - paramiko.SFTPError - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SFTPError -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Class SFTPError

- -
-Exception --+
-            |
-           SFTPError
-

- -
- - - - - - - - - - - - - - -
Method Summary
    Inherited from Exception
 __init__(...) -
 __getitem__(...) -
 __str__(...) -

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.SFTPFile-class.html b/docs/public/paramiko.SFTPFile-class.html deleted file mode 100644 index 6425f07..0000000 --- a/docs/public/paramiko.SFTPFile-class.html +++ /dev/null @@ -1,560 +0,0 @@ - - - - - paramiko.SFTPFile - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SFTPFile -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type SFTPFile

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

- -
- -Proxy object for a file on the remote server, in client mode SFTP. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - sftp, - handle, - mode, - bufsize) -
 __del__(self) -
str -check(self, - hash_algorithm, - offset, - length, - block_size) -
-Ask the server for a hash of a section of this file.
 close(self) -
-Close the file.
float -gettimeout(self) -
-Returns the timeout in seconds (as a float) associated with the socket -or ssh Channel used for this file.
 prefetch(self) -
-Pre-fetch the remaining contents of this file in anticipation of -future read calls.
 seek(self, - offset, - whence) -
-Set the file's current position, like stdio's fseek.
 set_pipelined(self, - pipelined) -
-Turn on/off the pipelining of write operations to this file.
 setblocking(self, - blocking) -
-Set blocking or non-blocking mode on the underiying socket or ssh Channel.
 settimeout(self, - timeout) -
-Set a timeout on read/write operations on the underlying socket or ssh -Channel.
SFTPAttributes -stat(self) -
-Retrieve information about this file from the remote system.
    Inherited from BufferedFile
iterator -__iter__(self) -
-Returns an iterator that can be used to iterate over the lines in this -file.
 flush(self) -
-Write out any data in the write buffer.
str -next(self) -
-Returns the next line from the input, or raises -StopIteration when EOF is hit.
str -read(self, - size) -
-Read at most size bytes from the file (less if we hit the -end of the file first).
str -readline(self, - size) -
-Read one entire line from the file.
list -readlines(self, - sizehint) -
-Read all remaining lines using readline and return them as a list.
int -tell(self) -
-Return the file's current position.
 write(self, - data) -
-Write data to the file.
 writelines(self, - sequence) -
-Write a sequence of strings to the file.
iterator -xreadlines(self) -
-Identical to iter(f).
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - - - - - -
Class Variable Summary
intMAX_REQUEST_SIZE = 32768                                                                 
    Inherited from BufferedFile
intSEEK_CUR = 1                                                                     
intSEEK_END = 2                                                                     
intSEEK_SET = 0                                                                     

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

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

-

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 - - the name of the hash algorithm to use (normally - "sha1" or - "md5") -
           - (type=str) -
offset - - offset into the file to begin hashing (0 means to start from - the beginning) -
           - (type=int or long) -
length - - number of bytes to hash (0 means continue to the end of the - file) -
           - (type=int or long) -
block_size - - number of bytes to hash per result (must not be less than 256; - 0 means to compute only one hash of the entire segment) -
           - (type=int) -
-
-
Returns:
-
- string of bytes representing the hash of each block, - concatenated together -
           - (type=str) -
-
-
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 -

- -
-
- - -
-

close(self, - _async=False) -

- Close the file. Future read and write operations will fail. -
-
Overrides:
-
paramiko.BufferedFile.close (inherited documentation) -
-
-
-
- - -
-

gettimeout(self) -

- 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) -

- 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. -
-

Since: 1.5.1 -

- -
-
- - -
-

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

- 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. -
           - (type=int) -
whence - - type of movement: 0 = absolute; 1 = relative to the current - position; 2 = relative to the end of the file. -
           - (type=int) -
-
-
Raises:
-
IOError - - if the file doesn't support random access. -
-
Overrides:
-
paramiko.BufferedFile.seek (inherited documentation) -
-
-

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). -

- -
-
- - -
-

set_pipelined(self, - pipelined=True) -

-

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 - - True if pipelining should be turned on for this - file; False otherwise -
           - (type=bool) -
-
-

Since: 1.5 -

- -
-
- - -
-

setblocking(self, - blocking) -

- Set blocking or non-blocking mode on the underiying socket or ssh Channel. -
-
Parameters:
-
blocking - - 0 to set non-blocking mode; non-0 to set blocking mode. -
           - (type=int) -
-
-

See Also: Channel.setblocking -

- -
-
- - -
-

settimeout(self, - timeout) -

- Set a timeout on read/write operations on the underlying socket or - ssh Channel. -
-
Parameters:
-
timeout - - seconds to wait for a pending read/write operation before - raising socket.timeout, or None for no - timeout -
           - (type=float) -
-
-

See Also: Channel.settimeout -

- -
-
- - -
-

stat(self) -

- 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:
-
- an object containing attributes about this file. -
           - (type=SFTPAttributes) -
-
-
-
-
- - - - - - -
Class Variable Details
-
- -

MAX_REQUEST_SIZE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-32768                                                                 
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.SFTPHandle-class.html b/docs/public/paramiko.SFTPHandle-class.html deleted file mode 100644 index 662ee6a..0000000 --- a/docs/public/paramiko.SFTPHandle-class.html +++ /dev/null @@ -1,325 +0,0 @@ - - - - - paramiko.SFTPHandle - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SFTPHandle -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type SFTPHandle

- -
-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. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self) -
int -chattr(self, - attr) -
-Change the attributes of this file.
 close(self) -
-When a client closes a file, this method is called on the handle.
str -read(self, - offset, - length) -
-Read up to length bytes from this file, starting at -position offset.
SFTPAttributes or error - code -stat(self) -
-Return an SFTPAttributes object referring to this -open file, or an error code.
 write(self, - offset, - data) -
-Write data into this file at position -offset.
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

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

chattr(self, - attr) -

- 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:
-
attr - - the attributes to change on this file. -
           - (type=SFTPAttributes) -
-
-
Returns:
-
- an error code like SFTP_OK. -
           - (type=int) -
-
-
-
- - -
-

close(self) -

-

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) -

-

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 - - position in the file to start reading from. -
           - (type=int or long) -
length - - number of bytes to attempt to read. -
           - (type=int) -
-
-
Returns:
-
- data read from the file, or an SFTP error code. -
           - (type=str) -
-
-
-
- - -
-

stat(self) -

- 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:
-
- an attributes object for the given file, or an SFTP error code - (like SFTP_PERMISSION_DENIED). -
           - (type=SFTPAttributes or error - code) -
-
-
-
- - -
-

write(self, - offset, - data) -

-

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 - - position in the file to start reading from. -
           - (type=int or long) -
data - - data to write into the file. -
           - (type=str) -
-
-
Returns:
-
- an SFTP error code like SFTP_OK. -
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.SFTPServer-class.html b/docs/public/paramiko.SFTPServer-class.html deleted file mode 100644 index 4d4e827..0000000 --- a/docs/public/paramiko.SFTPServer-class.html +++ /dev/null @@ -1,403 +0,0 @@ - - - - - paramiko.SFTPServer - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SFTPServer -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type SFTPServer

- -
-object --+            
-         |            
-  _Verbose --+        
-             |        
-        Thread --+    
-                 |    
-  SubsystemHandler --+
-                     |
-        object --+   |
-                 |   |
-          BaseSFTP --+
-                     |
-                    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. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - channel, - name, - server, - sftp_si, - *largs, - **kwargs) -
-The constructor for SFTPServer is meant to be called from within the -Transport as a subsystem handler.
int -convert_errno(e) -
-Convert an errno value (as from an OSError or -IOError) into a standard SFTP result code. (Static method) -
 finish_subsystem(self) -
-Perform any cleanup at the end of a subsystem.
 set_file_attr(filename, - attr) -
-Change a file's attributes on the local filesystem. (Static method) -
 start_subsystem(self, - name, - transport, - channel) -
-Process an ssh subsystem in server mode.
    Inherited from SubsystemHandler
ServerInterface -get_server(self) -
-Return the ServerInterface object associated with this -channel and subsystem.
    Inherited from Thread
 __repr__(self) -
 getName(self) -
 isAlive(self) -
 isDaemon(self) -
 join(self, - timeout) -
 run(self) -
 setDaemon(self, - daemonic) -
 setName(self, - name) -
 start(self) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - -
Instance Method Details
- - -
-

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

- 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 passed from the Transport. -
           - (type=Channel) -
name - - name of the requested subsystem. -
           - (type=str) -
server - - the server object associated with this channel and - subsystem -
           - (type=ServerInterface) -
sftp_si - - a subclass of SFTPServerInterface to use for - handling individual requests. -
           - (type=class) -
-
-
Overrides:
-
paramiko.BaseSFTP.__init__
-
-
-
- - -
-

finish_subsystem(self) -

- Perform any cleanup at the end of a subsystem. The default - implementation just closes the channel. -
-
Overrides:
-
paramiko.SubsystemHandler.finish_subsystem (inherited documentation) -
-
-

Since: 1.1 -

- -
-
- - -
-

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

-

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. -
           - (type=str) -
transport - - the server-mode Transport. -
           - (type=Transport) -
channel - - the channel associated with this subsystem request. -
           - (type=Channel) -
-
-
Overrides:
-
paramiko.SubsystemHandler.start_subsystem (inherited documentation) -
-
-

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. -

- -
-
-
- - - - - - -
Static Method Details
- - -
-

convert_errno(e) -

- 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 - - an errno code, as from OSError.errno. -
           - (type=int) -
-
-
Returns:
-
- an SFTP error code like SFTP_NO_SUCH_FILE. -
           - (type=int) -
-
-
-
- - -
-

set_file_attr(filename, - attr) -

-

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 - - name of the file to alter (should usually be an absolute - path). -
           - (type=str) -
attr - - attributes to change. -
           - (type=SFTPAttributes) -
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.SSHException-class.html b/docs/public/paramiko.SSHException-class.html deleted file mode 100644 index a628f2f..0000000 --- a/docs/public/paramiko.SSHException-class.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - paramiko.SSHException - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SSHException -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Class SSHException

- -
-Exception --+
-            |
-           SSHException
-

- -
Known Subclasses:
-
- BadAuthenticationType, - PasswordRequiredException
- -
- -Exception raised by failures in SSH2 protocol negotiation or logic -errors. -
- - - - - - - - - - - - - - -
Method Summary
    Inherited from Exception
 __init__(...) -
 __getitem__(...) -
 __str__(...) -

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.SecurityOptions-class.html b/docs/public/paramiko.SecurityOptions-class.html deleted file mode 100644 index a9ca4be..0000000 --- a/docs/public/paramiko.SecurityOptions-class.html +++ /dev/null @@ -1,274 +0,0 @@ - - - - - paramiko.SecurityOptions - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SecurityOptions -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type SecurityOptions

- -
-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. -
- -

Since: ivysaur -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - transport) -
str -__repr__(self) -
-Returns a string representation of this object, for debugging.
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

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

- - - - - - - - -
Class Variable Summary
list__slots__ = ['ciphers', 'digests', 'key_types', 'kex', '... -

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

__repr__(self) -
(Representation operator) -

- Returns a string representation of this object, for debugging. -
-
Returns:
-
- str -
-
-
Overrides:
-
__builtin__.object.__repr__
-
-
-
-
- - - - - - -
Property Details
-
- - -

ciphers

-Symmetric encryption ciphers -
-
-
-
-
-
-
- - -

compression

-Compression algorithms -
-
-
-
-
-
-
- - -

digests

-Digest (one-way hash) algorithms -
-
-
-
-
-
-
- - -

kex

-Key exchange algorithms -
-
-
-
-
-
-
- - -

key_types

-Public-key algorithms -
-
-
-
-
-
-

- - - - - - -
Class Variable Details
-
- -

__slots__

-
-
-
-
-
Type:
-
- list - -
-
Value:
-
-
-['ciphers', 'digests', 'key_types', 'kex', 'compression', '_transport'\
-]                                                                      
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.SubsystemHandler-class.html b/docs/public/paramiko.SubsystemHandler-class.html deleted file mode 100644 index 05c7bdb..0000000 --- a/docs/public/paramiko.SubsystemHandler-class.html +++ /dev/null @@ -1,327 +0,0 @@ - - - - - paramiko.SubsystemHandler - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class SubsystemHandler -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type SubsystemHandler

- -
-object --+        
-         |        
-  _Verbose --+    
-             |    
-        Thread --+
-                 |
-                SubsystemHandler
-

- -
Known Subclasses:
-
- SFTPServer
- -
- -

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. -
- -

Since: ivysaur -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - channel, - name, - server) -
-Create a new handler for a channel.
 finish_subsystem(self) -
-Perform any cleanup at the end of a subsystem.
ServerInterface -get_server(self) -
-Return the ServerInterface object associated with this -channel and subsystem.
 start_subsystem(self, - name, - transport, - channel) -
-Process an ssh subsystem in server mode.
    Inherited from Thread
 __repr__(self) -
 getName(self) -
 isAlive(self) -
 isDaemon(self) -
 join(self, - timeout) -
 run(self) -
 setDaemon(self, - daemonic) -
 setName(self, - name) -
 start(self) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

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

__init__(self, - channel, - name, - server) -
(Constructor) -

- 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 - - the channel associated with this subsystem request. -
           - (type=Channel) -
name - - name of the requested subsystem. -
           - (type=str) -
server - - the server object for the session that started this - subsystem -
           - (type=ServerInterface) -
-
-
Overrides:
-
threading.Thread.__init__
-
-
-
- - -
-

finish_subsystem(self) -

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

Since: 1.1 -

- -
-
- - -
-

get_server(self) -

- Return the ServerInterface object associated with - this channel and subsystem. -
-
Returns:
-
- ServerInterface -
-
-
-
- - -
-

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

-

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. -
           - (type=str) -
transport - - the server-mode Transport. -
           - (type=Transport) -
channel - - the channel associated with this subsystem request. -
           - (type=Channel) -
-
-

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. -

- -
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.Transport-class.html b/docs/public/paramiko.Transport-class.html deleted file mode 100644 index 562982b..0000000 --- a/docs/public/paramiko.Transport-class.html +++ /dev/null @@ -1,1524 +0,0 @@ - - - - - paramiko.Transport - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Class Transport -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type Transport

- -
-object --+        
-         |        
-  _Verbose --+    
-             |    
-        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). -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - sock) -
-Create a new SSH session over an existing socket, or socket-like -object.
 __del__(self) -
str -__repr__(self) -
-Returns a string representation of this object, for debugging.
Channel -accept(self, - timeout) -
-Return the next channel opened by the client over this transport, in -server mode.
 add_server_key(self, - key) -
-Add a host key to the list of keys used for server mode.
list -auth_interactive(self, - username, - handler, - submethods) -
-Authenticate to the server interactively.
list -auth_none(self, - username) -
-Try to authenticate to the server using no authentication at all.
list -auth_password(self, - username, - password, - event, - fallback) -
-Authenticate to the server using a password.
list -auth_publickey(self, - username, - key, - event) -
-Authenticate to the server using a private key.
 close(self) -
-Close this session, and any open channels that are tied to it.
 connect(self, - hostkey, - username, - password, - pkey) -
-Negotiate an SSH2 session, and optionally verify the server's host key -and authenticate using a password or private key.
Exception -get_exception(self) -
-Return any exception that happened during the last server request.
bool -get_hexdump(self) -
-Return True if the transport is currently logging hex -dumps of protocol traffic.
str -get_log_channel(self) -
-Return the channel name used for this transport's logging.
PKey -get_remote_server_key(self) -
-Return the host key of the server (in client mode).
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.
PKey -get_server_key(self) -
-Return the active host key, in server mode.
string -get_username(self) -
-Return the username this connection is authenticated for.
Message -global_request(self, - kind, - data, - wait) -
-Make a global request to the remote host.
bool -is_active(self) -
-Return true if this session is active (open).
bool -is_authenticated(self) -
-Return true if this session is active and authenticated.
bool -load_server_moduli(filename) -
-(optional) Load a file of prime moduli for use in doing -group-exchange key negotiation in server mode. (Static method) -
Channel -open_channel(self, - kind, - dest_addr, - src_addr) -
-Request a new channel to the server.
Channel -open_session(self) -
-Request a new channel to the server, of type -"session".
SFTPClient -open_sftp_client(self) -
-Create an SFTP client channel from an open transport.
bool -renegotiate_keys(self) -
-Force this session to switch to new keys.
 run(self) -
 send_ignore(self, - bytes) -
-Send a junk packet across the encrypted link.
 set_hexdump(self, - hexdump) -
-Turn on/off logging a hex dump of protocol traffic at DEBUG level in -the logs.
 set_keepalive(self, - interval) -
-Turn on/off keepalive packets (default is off).
 set_log_channel(self, - name) -
-Set the channel for this transport's logging.
 set_subsystem_handler(self, - name, - handler, - *larg, - **kwarg) -
-Set the handler class for a subsystem in server mode.
 start_client(self, - event) -
-Negotiate a new SSH2 session as a client.
 start_server(self, - event, - server) -
-Negotiate a new SSH2 session as a server.
 stop_thread(self) -
 use_compression(self, - compress) -
-Turn on/off compression.
    Inherited from Thread
 getName(self) -
 isAlive(self) -
 isDaemon(self) -
 join(self, - timeout) -
 setDaemon(self, - daemonic) -
 setName(self, - name) -
 start(self) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - -
Instance Method Details
- - -
-

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

-

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 - - a socket or socket-like object to create the session over. -
           - (type=socket) -
-
-
Overrides:
-
threading.Thread.__init__
-
-
-
- - -
-

__repr__(self) -
(Representation operator) -

- Returns a string representation of this object, for debugging. -
-
Returns:
-
- str -
-
-
Overrides:
-
threading.Thread.__repr__
-
-
-
- - -
-

accept(self, - timeout=None) -

- 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 - - seconds to wait for a channel, or None to wait - forever -
           - (type=int) -
-
-
Returns:
-
- a new Channel opened by the client -
           - (type=Channel) -
-
-
-
- - -
-

add_server_key(self, - key) -

- Add a host key to the list of keys used for server mode. When - behaving as a server, the host key is used to sign certain packets - during the SSH2 negotiation, so that the client can trust that we are - who we say we are. Because this is used for signing, the key must - contain private key info, not just the public half. Only one key of - each type (RSA or DSS) is kept. -
-
Parameters:
-
key - - the host key to add, usually an RSAKey or DSSKey. -
           - (type=PKey) -
-
-
-
- - -
-

auth_interactive(self, - username, - handler, - submethods='') -

-

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 - - the username to authenticate as -
           - (type=string) -
handler - - a handler for responding to server questions -
           - (type=callable) -
submethods - - a string list of desired submethods (optional) -
           - (type=str) -
-
-
Returns:
-
- list of auth types permissible for the next stage of - authentication (normally empty). -
           - (type=list) -
-
-
Raises:
-
BadAuthenticationType - - if public-key authentication isn't allowed by the server for - this user -
SSHException - - if the authentication failed -
-

Since: 1.5 -

- -
-
- - -
-

auth_none(self, - username) -

- 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 - - the username to authenticate as -
           - (type=string) -
-
-
Returns:
-
- list of auth types permissible for the next stage of - authentication (normally empty) -
           - (type=list) -
-
-
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) -

-

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 - - the username to authenticate as -
           - (type=string) -
password - - the password to authenticate with -
           - (type=string) -
event - - an event to trigger when the authentication attempt is - complete (whether it was successful or not) -
           - (type=threading.Event) -
fallback - - True if an attempt at an automated - "interactive" password auth should be made if the - server doesn't support normal password auth -
           - (type=bool) -
-
-
Returns:
-
- list of auth types permissible for the next stage of - authentication (normally empty) -
           - (type=list) -
-
-
Raises:
-
BadAuthenticationType - - if password authentication isn't allowed by the server for - this user (and no event was passed in) -
SSHException - - if the authentication failed (and no event was passed in) -
-
-
- - -
-

auth_publickey(self, - username, - key, - event=None) -

-

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 - - the username to authenticate as -
           - (type=string) -
key - - the private key to authenticate with -
           - (type=PKey) -
event - - an event to trigger when the authentication attempt is - complete (whether it was successful or not) -
           - (type=threading.Event) -
-
-
Returns:
-
- list of auth types permissible for the next stage of - authentication (normally empty). -
           - (type=list) -
-
-
Raises:
-
BadAuthenticationType - - if public-key authentication isn't allowed by the server for - this user (and no event was passed in). -
SSHException - - if the authentication failed (and no event was passed in). -
-
-
- - -
-

close(self) -

- Close this session, and any open channels that are tied to it. -
-
-
- - -
-

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. 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 - - the host key expected from the server, or None if - you don't want to do host key verification. -
           - (type=PKey) -
username - - the username to authenticate as. -
           - (type=str) -
password - - a password to use for authentication, if you want to use - password authentication; otherwise None. -
           - (type=str) -
pkey - - a private key to use for authentication, if you want to use - private key authentication; otherwise None. -
           - (type=PKey) -
-
-
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. -

- -

Since: doduo -

- -
-
- - -
-

get_exception(self) -

- 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:
-
- an exception, or None if there is no stored - exception. -
           - (type=Exception) -
-
-

Since: 1.1 -

- -
-
- - -
-

get_hexdump(self) -

- Return True if the transport is currently logging hex - dumps of protocol traffic. -
-
Returns:
-
- True if hex dumps are being logged -
           - (type=bool) -
-
-

Since: 1.4 -

- -
-
- - -
-

get_log_channel(self) -

- Return the channel name used for this transport's logging. -
-
Returns:
-
- channel name. -
           - (type=str) -
-
-

Since: 1.2 -

- -
-
- - -
-

get_remote_server_key(self) -

- Return the host key of the server (in client mode). -
-
Returns:
-
- public key of the remote server. -
           - (type=PKey) -
-
-
Raises:
-
SSHException - - if no session is currently active. -
-

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) -

- 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:
-
- an object that can be used to change the preferred algorithms - for encryption, digest (hash), public key, and key exchange. -
           - (type=SecurityOptions) -
-
-

Since: ivysaur -

- -
-
- - -
-

get_server_key(self) -

- Return the active host key, in server mode. After negotiating with - the client, this method will return the negotiated host key. If only - one type of host key was set 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:
-
- host key of the type negotiated by the client, or - None. -
           - (type=PKey) -
-
-
-
- - -
-

get_username(self) -

- Return the username this connection is authenticated for. If the - session is not authenticated (or authentication failed), this method - returns None. -
-
Returns:
-
- username that was authenticated, or None. -
           - (type=string) -
-
-

Since: fearow -

- -
-
- - -
-

global_request(self, - kind, - data=None, - wait=True) -

- Make a global request to the remote host. These are normally - extensions to the SSH2 protocol. -
-
Parameters:
-
kind - - name of the request. -
           - (type=str) -
data - - an optional tuple containing additional data to attach to the - request. -
           - (type=tuple) -
wait - - True if this method should not return until a - response is received; False otherwise. -
           - (type=bool) -
-
-
Returns:
-
- 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. -
           - (type=Message) -
-
-

Since: fearow -

- -
-
- - -
-

is_active(self) -

- Return true if this session is active (open). -
-
Returns:
-
- True if the session is still active (open); False if the - session is closed. -
           - (type=bool) -
-
-
-
- - -
-

is_authenticated(self) -

- Return true if this session is active and authenticated. -
-
Returns:
-
- True if the session is still open and has been authenticated - successfully; False if authentication failed and/or the session - is closed. -
           - (type=bool) -
-
-
-
- - -
-

open_channel(self, - kind, - dest_addr=None, - src_addr=None) -

- 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 - - the kind of channel requested (usually - "session", - "forwarded-tcpip" or - "direct-tcpip"). -
           - (type=str) -
dest_addr - - the destination address of this port forwarding, if - kind is "forwarded-tcpip" or - "direct-tcpip" (ignored for other channel - types). -
           - (type=(str, int)) -
src_addr - - the source address of this port forwarding, if - kind is "forwarded-tcpip" or - "direct-tcpip". -
           - (type=(str, int)) -
-
-
Returns:
-
- a new Channel on success, or - None if the request is rejected or the session ends - prematurely. -
           - (type=Channel) -
-
-
-
- - -
-

open_session(self) -

- Request a new channel to the server, of type - "session". This is just an alias for - open_channel('session'). -
-
Returns:
-
- a new Channel on success, or - None if the request is rejected or the session ends - prematurely. -
           - (type=Channel) -
-
-
-
- - -
-

open_sftp_client(self) -

- 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:
-
- a new SFTPClient object, referring to an - sftp session (channel) across this transport -
           - (type=SFTPClient) -
-
-
-
- - -
-

renegotiate_keys(self) -

- Force this session to switch to new keys. Normally this is done - automatically after the session hits a certain number of packets or - bytes sent or received, but this method gives you the option of forcing - new keys whenever you want. Negotiating new keys causes a pause in - traffic both ways as the two sides swap keys and do computations. This - method returns when the session has switched to new keys, or the - session has died mid-negotiation. -
-
Returns:
-
- True if the renegotiation was successful, and the link is - using new keys; False if the session dropped during - renegotiation. -
           - (type=bool) -
-
-
-
- - -
-

send_ignore(self, - bytes=None) -

- Send a junk packet across the encrypted link. This is sometimes used - to add "noise" to a connection to confuse would-be attackers. - It can also be used as a keep-alive for long lived connections - traversing firewalls. -
-
Parameters:
-
bytes - - the number of random bytes to send in the payload of the - ignored packet -- defaults to a random number from 10 to 41. -
           - (type=int) -
-
-

Since: fearow -

- -
-
- - -
-

set_hexdump(self, - hexdump) -

- 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 - - True to log protocol traffix (in hex) to the log; - False otherwise. -
           - (type=bool) -
-
-
-
- - -
-

set_keepalive(self, - interval) -

- 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 - - seconds to wait before sending a keepalive packet (or 0 to - disable keepalives). -
           - (type=int) -
-
-

Since: fearow -

- -
-
- - -
-

set_log_channel(self, - name) -

- 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 - - new channel name for logging. -
           - (type=str) -
-
-

Since: 1.1 -

- -
-
- - -
-

set_subsystem_handler(self, - name, - handler, - *larg, - **kwarg) -

-

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 - - name of the subsystem. -
           - (type=str) -
handler - - subclass of SubsystemHandler that handles this - subsystem. -
           - (type=class) -
-
-
-
- - -
-

start_client(self, - event=None) -

-

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 - - an event to trigger when negotiation is complete - (optional) -
           - (type=threading.Event) -
-
-
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) -

-

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 - - an event to trigger when negotiation is complete. -
           - (type=threading.Event) -
server - - an object used to perform authentication and create Channels. -
           - (type=server.ServerInterface) -
-
-
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) -

- 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 and is not fully - tested. -
-
Parameters:
-
compress - - True to ask the remote client/server to compress - traffic; False to refuse compression -
           - (type=bool) -
-
-

Since: 1.5.2 -

- -
-
-
- - - - - - -
Static Method Details
- - -
-

load_server_moduli(filename=None) -

-

(optional) Load a file of prime moduli for use in doing - group-exchange key negotiation in server mode. It's a rather obscure - option and can be safely ignored.

- In server mode, the remote client may request - "group-exchange" key negotiation, which asks the server to - send a random prime number that fits certain criteria. These primes are - pretty difficult to compute, so they can't be generated on demand. But - many systems contain a file of suitable primes (usually named something - like /etc/ssh/moduli). If you call - load_server_moduli and it returns True, then - this file of primes has been loaded and we will support - "group-exchange" in server mode. Otherwise server mode will - just claim that it doesn't support that method of key negotiation. -
-
Parameters:
-
filename - - optional path to the moduli file, if you happen to know that - it's not in a standard location. -
           - (type=str) -
-
-
Returns:
-
- True if a moduli file was successfully loaded; False - otherwise. -
           - (type=bool) -
-
-

Note: This has no effect when used in client mode. -

- -

Since: doduo -

- -
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.agent-module.html b/docs/public/paramiko.agent-module.html deleted file mode 100644 index 560432a..0000000 --- a/docs/public/paramiko.agent-module.html +++ /dev/null @@ -1,164 +0,0 @@ - - - - - paramiko.agent - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module agent -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.agent

- -SSH Agent interface for Unix clients. -
- - - - - - - - - - - - - -
Variable Summary
intSSH2_AGENT_IDENTITIES_ANSWER = 12                                                                    
intSSH2_AGENT_SIGN_RESPONSE = 14                                                                    
intSSH2_AGENTC_REQUEST_IDENTITIES = 11                                                                    
intSSH2_AGENTC_SIGN_REQUEST = 13                                                                    

- - - - - - -
Variable Details
-
- -

SSH2_AGENT_IDENTITIES_ANSWER

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-12                                                                    
-
-
-
-
-
- -

SSH2_AGENT_SIGN_RESPONSE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-14                                                                    
-
-
-
-
-
- -

SSH2_AGENTC_REQUEST_IDENTITIES

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-11                                                                    
-
-
-
-
-
- -

SSH2_AGENTC_SIGN_REQUEST

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-13                                                                    
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.dsskey-module.html b/docs/public/paramiko.dsskey-module.html deleted file mode 100644 index f600c89..0000000 --- a/docs/public/paramiko.dsskey-module.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - paramiko.dsskey - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module dsskey -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.dsskey

- -DSSKey -
- - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.file-module.html b/docs/public/paramiko.file-module.html deleted file mode 100644 index 4cb6c90..0000000 --- a/docs/public/paramiko.file-module.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - paramiko.file - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module file -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.file

- -BufferedFile. -
- - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.message-module.html b/docs/public/paramiko.message-module.html deleted file mode 100644 index 2ccf4d9..0000000 --- a/docs/public/paramiko.message-module.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - paramiko.message - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module message -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.message

- -Implementation of an SSH2 "message". -
- - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:46 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.pkey-module.html b/docs/public/paramiko.pkey-module.html deleted file mode 100644 index e7aac95..0000000 --- a/docs/public/paramiko.pkey-module.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - paramiko.pkey - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module pkey -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.pkey

- -Common API for all public keys. -
- - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.rsakey-module.html b/docs/public/paramiko.rsakey-module.html deleted file mode 100644 index b287187..0000000 --- a/docs/public/paramiko.rsakey-module.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - paramiko.rsakey - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module rsakey -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.rsakey

- -RSAKey -
- - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.server-module.html b/docs/public/paramiko.server-module.html deleted file mode 100644 index b283866..0000000 --- a/docs/public/paramiko.server-module.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - - paramiko.server - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module server -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.server

- -ServerInterface is an interface to override -for server support. -
- - - - - - - -
Classes
- InteractiveQueryA query (set of prompts) for a user during interactive -authentication.

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.server.InteractiveQuery-class.html b/docs/public/paramiko.server.InteractiveQuery-class.html deleted file mode 100644 index 6a96be3..0000000 --- a/docs/public/paramiko.server.InteractiveQuery-class.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - paramiko.server.InteractiveQuery - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module server :: - Class InteractiveQuery -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type InteractiveQuery

- -
-object --+
-         |
-        InteractiveQuery
-

- -
- -A query (set of prompts) for a user during interactive -authentication. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - name, - instructions, - *prompts) -
-Create a new interactive query to send to the client.
 add_prompt(self, - prompt, - echo) -
-Add a prompt to this query.
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

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

__init__(self, - name='', - instructions='', - *prompts) -
(Constructor) -

- Create a new interactive query to send to the client. The name and - instructions are optional, but are generally displayed to the end user. - A list of prompts may be included, or they may be added via the add_prompt method. -
-
Parameters:
-
name - - name of this query -
           - (type=str) -
instructions - - user instructions (usually short) about this query -
           - (type=str) -
-
-
Overrides:
-
__builtin__.object.__init__
-
-
-
- - -
-

add_prompt(self, - prompt, - echo=True) -

- Add a prompt to this query. The prompt should be a (reasonably - short) string. Multiple prompts can be added to the same query. -
-
Parameters:
-
prompt - - the user prompt -
           - (type=str) -
echo - - True (default) if the user's response should be - echoed; False if not (for a password or similar) -
           - (type=bool) -
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.sftp-module.html b/docs/public/paramiko.sftp-module.html deleted file mode 100644 index 66fb99e..0000000 --- a/docs/public/paramiko.sftp-module.html +++ /dev/null @@ -1,1060 +0,0 @@ - - - - - paramiko.sftp - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.sftp

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Variable Summary
intCMD_ATTRS = 105                                                                   
intCMD_CLOSE = 4                                                                     
intCMD_DATA = 103                                                                   
intCMD_EXTENDED = 200                                                                   
intCMD_EXTENDED_REPLY = 201                                                                   
intCMD_FSETSTAT = 10                                                                    
intCMD_FSTAT = 8                                                                     
intCMD_HANDLE = 102                                                                   
intCMD_INIT = 1                                                                     
intCMD_LSTAT = 7                                                                     
intCMD_MKDIR = 14                                                                    
intCMD_NAME = 104                                                                   
dictCMD_NAMES = {1: 'init', 2: 'version', 3: 'open', 4: 'clo... -
intCMD_OPEN = 3                                                                     
intCMD_OPENDIR = 11                                                                    
intCMD_READ = 5                                                                     
intCMD_READDIR = 12                                                                    
intCMD_READLINK = 19                                                                    
intCMD_REALPATH = 16                                                                    
intCMD_REMOVE = 13                                                                    
intCMD_RENAME = 18                                                                    
intCMD_RMDIR = 15                                                                    
intCMD_SETSTAT = 9                                                                     
intCMD_STAT = 17                                                                    
intCMD_STATUS = 101                                                                   
intCMD_SYMLINK = 20                                                                    
intCMD_VERSION = 2                                                                     
intCMD_WRITE = 6                                                                     
intSFTP_BAD_MESSAGE = 5                                                                     
intSFTP_CONNECTION_LOST = 7                                                                     
listSFTP_DESC = ['Success', 'End of file', 'No such file', '... -
intSFTP_EOF = 1                                                                     
intSFTP_FAILURE = 4                                                                     
intSFTP_FLAG_APPEND = 4                                                                     
intSFTP_FLAG_CREATE = 8                                                                     
intSFTP_FLAG_EXCL = 32                                                                    
intSFTP_FLAG_READ = 1                                                                     
intSFTP_FLAG_TRUNC = 16                                                                    
intSFTP_FLAG_WRITE = 2                                                                     
intSFTP_NO_CONNECTION = 6                                                                     
intSFTP_NO_SUCH_FILE = 2                                                                     
intSFTP_OK = 0                                                                     
intSFTP_OP_UNSUPPORTED = 8                                                                     
intSFTP_PERMISSION_DENIED = 3                                                                     

- - - - - - -
Variable Details
-
- -

CMD_ATTRS

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-105                                                                   
-
-
-
-
-
- -

CMD_CLOSE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-4                                                                     
-
-
-
-
-
- -

CMD_DATA

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-103                                                                   
-
-
-
-
-
- -

CMD_EXTENDED

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-200                                                                   
-
-
-
-
-
- -

CMD_EXTENDED_REPLY

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-201                                                                   
-
-
-
-
-
- -

CMD_FSETSTAT

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-10                                                                    
-
-
-
-
-
- -

CMD_FSTAT

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-8                                                                     
-
-
-
-
-
- -

CMD_HANDLE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-102                                                                   
-
-
-
-
-
- -

CMD_INIT

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-1                                                                     
-
-
-
-
-
- -

CMD_LSTAT

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-7                                                                     
-
-
-
-
-
- -

CMD_MKDIR

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-14                                                                    
-
-
-
-
-
- -

CMD_NAME

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-104                                                                   
-
-
-
-
-
- -

CMD_NAMES

-
-
-
-
-
Type:
-
- dict - -
-
Value:
-
-
-{1: 'init',
- 2: 'version',
- 3: 'open',
- 4: 'close',
- 5: 'read',
- 6: 'write',
- 7: 'lstat',
- 8: 'fstat',
-...                                                                    
-
-
-
-
-
- -

CMD_OPEN

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-3                                                                     
-
-
-
-
-
- -

CMD_OPENDIR

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-11                                                                    
-
-
-
-
-
- -

CMD_READ

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-5                                                                     
-
-
-
-
-
- -

CMD_READDIR

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-12                                                                    
-
-
-
-
-
- -

CMD_READLINK

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-19                                                                    
-
-
-
-
-
- -

CMD_REALPATH

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-16                                                                    
-
-
-
-
-
- -

CMD_REMOVE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-13                                                                    
-
-
-
-
-
- -

CMD_RENAME

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-18                                                                    
-
-
-
-
-
- -

CMD_RMDIR

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-15                                                                    
-
-
-
-
-
- -

CMD_SETSTAT

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-9                                                                     
-
-
-
-
-
- -

CMD_STAT

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-17                                                                    
-
-
-
-
-
- -

CMD_STATUS

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-101                                                                   
-
-
-
-
-
- -

CMD_SYMLINK

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-20                                                                    
-
-
-
-
-
- -

CMD_VERSION

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-2                                                                     
-
-
-
-
-
- -

CMD_WRITE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-6                                                                     
-
-
-
-
-
- -

SFTP_BAD_MESSAGE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-5                                                                     
-
-
-
-
-
- -

SFTP_CONNECTION_LOST

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-7                                                                     
-
-
-
-
-
- -

SFTP_DESC

-
-
-
-
-
Type:
-
- list - -
-
Value:
-
-
-['Success',
- 'End of file',
- 'No such file',
- 'Permission denied',
- 'Failure',
- 'Bad message',
- 'No connection',
- 'Connection lost',
-...                                                                    
-
-
-
-
-
- -

SFTP_EOF

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-1                                                                     
-
-
-
-
-
- -

SFTP_FAILURE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-4                                                                     
-
-
-
-
-
- -

SFTP_FLAG_APPEND

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-4                                                                     
-
-
-
-
-
- -

SFTP_FLAG_CREATE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-8                                                                     
-
-
-
-
-
- -

SFTP_FLAG_EXCL

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-32                                                                    
-
-
-
-
-
- -

SFTP_FLAG_READ

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-1                                                                     
-
-
-
-
-
- -

SFTP_FLAG_TRUNC

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-16                                                                    
-
-
-
-
-
- -

SFTP_FLAG_WRITE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-2                                                                     
-
-
-
-
-
- -

SFTP_NO_CONNECTION

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-6                                                                     
-
-
-
-
-
- -

SFTP_NO_SUCH_FILE

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-2                                                                     
-
-
-
-
-
- -

SFTP_OK

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-0                                                                     
-
-
-
-
-
- -

SFTP_OP_UNSUPPORTED

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-8                                                                     
-
-
-
-
-
- -

SFTP_PERMISSION_DENIED

-
-
-
-
-
Type:
-
- int - -
-
Value:
-
-
-3                                                                     
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.sftp_attr-module.html b/docs/public/paramiko.sftp_attr-module.html deleted file mode 100644 index 7ff2add..0000000 --- a/docs/public/paramiko.sftp_attr-module.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - paramiko.sftp_attr - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_attr -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.sftp_attr

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.sftp_client-module.html b/docs/public/paramiko.sftp_client-module.html deleted file mode 100644 index a82e15f..0000000 --- a/docs/public/paramiko.sftp_client-module.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - paramiko.sftp_client - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_client -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.sftp_client

- -Client-mode SFTP support. -
- - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.sftp_file-module.html b/docs/public/paramiko.sftp_file-module.html deleted file mode 100644 index 3d2f402..0000000 --- a/docs/public/paramiko.sftp_file-module.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - paramiko.sftp_file - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_file -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.sftp_file

- -SFTPFile -
- - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.sftp_handle-module.html b/docs/public/paramiko.sftp_handle-module.html deleted file mode 100644 index 2a75e59..0000000 --- a/docs/public/paramiko.sftp_handle-module.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - paramiko.sftp_handle - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_handle -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.sftp_handle

- -Abstraction of an SFTP file handle (for server mode). -
- - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.sftp_server-module.html b/docs/public/paramiko.sftp_server-module.html deleted file mode 100644 index 06183af..0000000 --- a/docs/public/paramiko.sftp_server-module.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - paramiko.sftp_server - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_server -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.sftp_server

- -Server-mode SFTP support. -
- - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.sftp_si-module.html b/docs/public/paramiko.sftp_si-module.html deleted file mode 100644 index 121d97e..0000000 --- a/docs/public/paramiko.sftp_si-module.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - paramiko.sftp_si - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module sftp_si -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.sftp_si

- -SFTPServerInterface is an interface to -override for SFTP server support. -
- - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.transport-module.html b/docs/public/paramiko.transport-module.html deleted file mode 100644 index 42d378f..0000000 --- a/docs/public/paramiko.transport-module.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - paramiko.transport - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module transport -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.transport

- -Transport handles the core SSH2 -protocol. -
- - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.util-module.html b/docs/public/paramiko.util-module.html deleted file mode 100644 index a7ad4cd..0000000 --- a/docs/public/paramiko.util-module.html +++ /dev/null @@ -1,369 +0,0 @@ - - - - - paramiko.util - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module util -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Module paramiko.util

- -Useful functions used by the rest of paramiko. -
- - - - - - - -
Classes
- PFilter 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Function Summary
 bit_length(n) -
 deflate_long(n, - add_sign_padding) -
-turns a long-int into a normalized byte string (adapted from -Crypto.Util.number)
 format_binary(data, - prefix) -
 format_binary_line(data) -
 format_binary_weird(data) -
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.
 get_logger(name) -
 get_thread_id() -
 hexify(s) -
-turn a string into a hex sequence
 inflate_long(s, - always_positive) -
-turns a normalized byte string into a long-int (adapted from -Crypto.Util.number)
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.
 log_to_file(filename, - level) -
-send paramiko logs to a logfile, if they're not already going -somewhere
 lookup_ssh_host_config(hostname, - config) -
-Return a dict of config options for a given hostname.
 mod_inverse(x, - m) -
object -parse_ssh_config(file_obj) -
-Parse a config file of the format used by OpenSSH, and return an -object that can be used to make queries to lookup_ssh_host_config.
 safe_string(s) -
 tb_strings() -
 unhexify(s) -
-turn a hex sequence back into a string

- - - - - - -
Function Details
- - -
-

deflate_long(n, - add_sign_padding=True) -

- turns a long-int into a normalized byte string (adapted from - Crypto.Util.number) -
-
-
- - -
-

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. This specific - algorithm is used for encrypting/decrypting private key files. -
-
Parameters:
-
hashclass - - class from Crypto.Hash that can be used as a - secure hashing function (like MD5 or - SHA). -
           - (type=Crypto.Hash) -
salt - - data to salt the hash with. -
           - (type=string) -
key - - human-entered password or passphrase. -
           - (type=string) -
nbytes - - number of bytes to generate. -
           - (type=int) -
-
-
Returns:
-
- key data -
           - (type=string) -
-
-
-
- - -
-

hexify(s) -

- turn a string into a hex sequence -
-
-
- - -
-

inflate_long(s, - always_positive=False) -

- turns a normalized byte string into a long-int (adapted from - Crypto.Util.number) -
-
-
- - -
-

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. 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"). -
-
Parameters:
-
filename - - name of the file to read host keys from -
           - (type=str) -
-
-
Returns:
-
- dict of host keys, indexed by hostname and then keytype -
           - (type=dict(hostname, dict(keytype, PKey))) -
-
-
-
- - -
-

log_to_file(filename, - level=10) -

- send paramiko logs to a logfile, if they're not already going - somewhere -
-
-
- - -
-

lookup_ssh_host_config(hostname, - config) -

-

Return a dict of config options for a given hostname. The - config object must come from parse_ssh_config.

-

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 - - the hostname to lookup -
           - (type=str) -
config - - the config object to search -
           - (type=object) -
-
-
-
- - -
-

parse_ssh_config(file_obj) -

-

Parse a config file of the format used by OpenSSH, and return an - object that can be used to make queries to lookup_ssh_host_config. The format is - described in OpenSSH's ssh_config man page. This method is - provided primarily as a convenience to posix users (since the OpenSSH - format is a de-facto standard on posix) but should work fine on Windows - too.

- The return value is currently a list of dictionaries, each - containing host-specific configuration, but this is considered an - implementation detail and may be subject to change in later - versions. -
-
Parameters:
-
file_obj - - a file-like object to read the config file from -
           - (type=file) -
-
-
Returns:
-
- opaque configuration object -
           - (type=object) -
-
-
-
- - -
-

unhexify(s) -

- turn a hex sequence back into a string -
-
-
-
- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/public/paramiko.util.PFilter-class.html b/docs/public/paramiko.util.PFilter-class.html deleted file mode 100644 index f1e8059..0000000 --- a/docs/public/paramiko.util.PFilter-class.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - paramiko.util.PFilter - - - - - - - - - - - - - - - - - - -
- - Package paramiko :: - Module util :: - Class PFilter -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type PFilter

- -
-object --+
-         |
-        PFilter
-

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 filter(self, - record) -
    Inherited from object
 __init__(...) -
-x.__init__(...) initializes x; see x.__class__.__doc__ for -signature
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __repr__(x) -
-x.__repr__() <==> repr(x)
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/public/threading.Thread-class.html b/docs/public/threading.Thread-class.html deleted file mode 100644 index 951099e..0000000 --- a/docs/public/threading.Thread-class.html +++ /dev/null @@ -1,161 +0,0 @@ - - - - - threading.Thread - - - - - - - - - - - - - - - - - - -
- - Module threading :: - Class Thread -
-
- - -
[show private | hide private]
[frames | no frames]
- - -

Type Thread

- -
-object --+    
-         |    
-  _Verbose --+
-             |
-            Thread
-

- -
Known Subclasses:
-
- SubsystemHandler, - Transport
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
 __init__(self, - group, - target, - name, - args, - kwargs, - verbose) -
(type, value, traceback)__exc_info() -
-Return information about the most recent exception caught by an except -clause in the current stack frame or in an older stack frame.
 __repr__(self) -
 getName(self) -
 isAlive(self) -
 isDaemon(self) -
 join(self, - timeout) -
 run(self) -
 setDaemon(self, - daemonic) -
 setName(self, - name) -
 start(self) -
    Inherited from object
 __delattr__(...) -
-x.__delattr__('name') <==> del x.name
 __getattribute__(...) -
-x.__getattribute__('name') <==> x.name
 __hash__(x) -
-x.__hash__() <==> hash(x)
 __new__(T, - S, - ...) -
-T.__new__(S, ...) -> a new object with type S, a subtype of T
 __reduce__(...) -
-helper for pickle
 __reduce_ex__(...) -
-helper for pickle
 __setattr__(...) -
-x.__setattr__('name', value) <==> x.name = value
 __str__(x) -
-x.__str__() <==> str(x)

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005http://epydoc.sf.net
- - diff --git a/docs/public/toc-everything.html b/docs/public/toc-everything.html deleted file mode 100644 index e699f06..0000000 --- a/docs/public/toc-everything.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - Everything - - - -
Everything
-
- - -All Classes
-paramiko.Agent
-paramiko.AgentKey
-paramiko.BufferedFile
-paramiko.Channel
-paramiko.DSSKey
-paramiko.Message
-paramiko.RSAKey
-paramiko.SecurityOptions
-paramiko.server.InteractiveQuery
-paramiko.SFTP
-paramiko.SFTPAttributes
-paramiko.SFTPClient
-paramiko.SFTPFile
-paramiko.SFTPHandle
-paramiko.SFTPServer
-paramiko.SubsystemHandler
-paramiko.Transport
-paramiko.util.PFilter
-
- - -All Exceptions
-paramiko.BadAuthenticationType
-paramiko.PasswordRequiredException
-paramiko.SFTPError
-paramiko.SSHException
-
- - -All 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
-
- - -All Variables
-CMD_ATTRS
-CMD_CLOSE
-CMD_DATA
-CMD_EXTENDED
-CMD_EXTENDED_REPLY
-CMD_FSETSTAT
-CMD_FSTAT
-CMD_HANDLE
-CMD_INIT
-CMD_LSTAT
-CMD_MKDIR
-CMD_NAME
-CMD_NAMES
-CMD_OPEN
-CMD_OPENDIR
-CMD_READ
-CMD_READDIR
-CMD_READLINK
-CMD_REALPATH
-CMD_REMOVE
-CMD_RENAME
-CMD_RMDIR
-CMD_SETSTAT
-CMD_STAT
-CMD_STATUS
-CMD_SYMLINK
-CMD_VERSION
-CMD_WRITE
-SFTP_BAD_MESSAGE
-SFTP_CONNECTION_LOST
-SFTP_DESC
-SFTP_EOF
-SFTP_FAILURE
-SFTP_FLAG_APPEND
-SFTP_FLAG_CREATE
-SFTP_FLAG_EXCL
-SFTP_FLAG_READ
-SFTP_FLAG_TRUNC
-SFTP_FLAG_WRITE
-SFTP_NO_CONNECTION
-SFTP_NO_SUCH_FILE
-SFTP_OK
-SFTP_OP_UNSUPPORTED
-SFTP_PERMISSION_DENIED
-SSH2_AGENT_IDENTITIES_ANSWER
-SSH2_AGENT_SIGN_RESPONSE
-SSH2_AGENTC_REQUEST_IDENTITIES
-SSH2_AGENTC_SIGN_REQUEST
-
- -
-[show private | hide private] - - diff --git a/docs/public/toc-paramiko-module.html b/docs/public/toc-paramiko-module.html deleted file mode 100644 index 7353601..0000000 --- a/docs/public/toc-paramiko-module.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - - paramiko - - - -
paramiko
-
- - -Modules
-agent
-dsskey
-file
-message
-pkey
-rsakey
-server
-sftp
-sftp_attr
-sftp_client
-sftp_file
-sftp_handle
-sftp_server
-sftp_si
-transport
-util
-
- - -Classes
-Agent
-AgentKey
-BufferedFile
-Channel
-DSSKey
-Message
-RSAKey
-SecurityOptions
-SFTP
-SFTPAttributes
-SFTPClient
-SFTPFile
-SFTPHandle
-SFTPServer
-SubsystemHandler
-Transport
-
- - -Exceptions
-BadAuthenticationType
-PasswordRequiredException
-SFTPError
-SSHException
-
- - -Variables
-
- -
-[show private | hide private] - - diff --git a/docs/public/toc-paramiko.agent-module.html b/docs/public/toc-paramiko.agent-module.html deleted file mode 100644 index 543e5af..0000000 --- a/docs/public/toc-paramiko.agent-module.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - paramiko.agent - - - -
agent
-
- - -Variables
-SSH2_AGENT_IDENTITIES_ANSWER
-SSH2_AGENT_SIGN_RESPONSE
-SSH2_AGENTC_REQUEST_IDENTITIES
-SSH2_AGENTC_SIGN_REQUEST
-
- -
-[show private | hide private] - - diff --git a/docs/public/toc-paramiko.dsskey-module.html b/docs/public/toc-paramiko.dsskey-module.html deleted file mode 100644 index 7f5fddb..0000000 --- a/docs/public/toc-paramiko.dsskey-module.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - paramiko.dsskey - - - -
dsskey
-
- -
-[show private | hide private] - - diff --git a/docs/public/toc-paramiko.file-module.html b/docs/public/toc-paramiko.file-module.html deleted file mode 100644 index 9c02537..0000000 --- a/docs/public/toc-paramiko.file-module.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - paramiko.file - - - -
file
-
- - -Variables
-
- -
-[show private | hide private] - - diff --git a/docs/public/toc-paramiko.message-module.html b/docs/public/toc-paramiko.message-module.html deleted file mode 100644 index 14ecd78..0000000 --- a/docs/public/toc-paramiko.message-module.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - paramiko.message - - - -
message
-
- -
-[show private | hide private] - - diff --git a/docs/public/toc-paramiko.pkey-module.html b/docs/public/toc-paramiko.pkey-module.html deleted file mode 100644 index a2c0c5b..0000000 --- a/docs/public/toc-paramiko.pkey-module.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - paramiko.pkey - - - -
pkey
-
- -
-[show private | hide private] - - diff --git a/docs/public/toc-paramiko.rsakey-module.html b/docs/public/toc-paramiko.rsakey-module.html deleted file mode 100644 index ceceb19..0000000 --- a/docs/public/toc-paramiko.rsakey-module.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - paramiko.rsakey - - - -
rsakey
-
- -
-[show private | hide private] - - diff --git a/docs/public/toc-paramiko.server-module.html b/docs/public/toc-paramiko.server-module.html deleted file mode 100644 index c01d6d6..0000000 --- a/docs/public/toc-paramiko.server-module.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - paramiko.server - - - -
server
-
- - -Classes
-InteractiveQuery
-
- -
-[show private | hide private] - - diff --git a/docs/public/toc-paramiko.sftp-module.html b/docs/public/toc-paramiko.sftp-module.html deleted file mode 100644 index 52f03a3..0000000 --- a/docs/public/toc-paramiko.sftp-module.html +++ /dev/null @@ -1,65 +0,0 @@ - - - - - paramiko.sftp - - - -
sftp
-
- - -Variables
-CMD_ATTRS
-CMD_CLOSE
-CMD_DATA
-CMD_EXTENDED
-CMD_EXTENDED_REPLY
-CMD_FSETSTAT
-CMD_FSTAT
-CMD_HANDLE
-CMD_INIT
-CMD_LSTAT
-CMD_MKDIR
-CMD_NAME
-CMD_NAMES
-CMD_OPEN
-CMD_OPENDIR
-CMD_READ
-CMD_READDIR
-CMD_READLINK
-CMD_REALPATH
-CMD_REMOVE
-CMD_RENAME
-CMD_RMDIR
-CMD_SETSTAT
-CMD_STAT
-CMD_STATUS
-CMD_SYMLINK
-CMD_VERSION
-CMD_WRITE
-SFTP_BAD_MESSAGE
-SFTP_CONNECTION_LOST
-SFTP_DESC
-SFTP_EOF
-SFTP_FAILURE
-SFTP_FLAG_APPEND
-SFTP_FLAG_CREATE
-SFTP_FLAG_EXCL
-SFTP_FLAG_READ
-SFTP_FLAG_TRUNC
-SFTP_FLAG_WRITE
-SFTP_NO_CONNECTION
-SFTP_NO_SUCH_FILE
-SFTP_OK
-SFTP_OP_UNSUPPORTED
-SFTP_PERMISSION_DENIED
-
- -
-[show private | hide private] - - diff --git a/docs/public/toc-paramiko.sftp_attr-module.html b/docs/public/toc-paramiko.sftp_attr-module.html deleted file mode 100644 index 080044e..0000000 --- a/docs/public/toc-paramiko.sftp_attr-module.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - paramiko.sftp_attr - - - -
sftp_attr
-
- -
-[show private | hide private] - - diff --git a/docs/public/toc-paramiko.sftp_client-module.html b/docs/public/toc-paramiko.sftp_client-module.html deleted file mode 100644 index 7bf1ad8..0000000 --- a/docs/public/toc-paramiko.sftp_client-module.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - paramiko.sftp_client - - - -
sftp_client
-
- - -Functions
-
- -
-[show private | hide private] - - diff --git a/docs/public/toc-paramiko.sftp_file-module.html b/docs/public/toc-paramiko.sftp_file-module.html deleted file mode 100644 index aee1350..0000000 --- a/docs/public/toc-paramiko.sftp_file-module.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - paramiko.sftp_file - - - -
sftp_file
-
- -
-[show private | hide private] - - diff --git a/docs/public/toc-paramiko.sftp_handle-module.html b/docs/public/toc-paramiko.sftp_handle-module.html deleted file mode 100644 index fc8b60a..0000000 --- a/docs/public/toc-paramiko.sftp_handle-module.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - paramiko.sftp_handle - - - -
sftp_handle
-
- -
-[show private | hide private] - - diff --git a/docs/public/toc-paramiko.sftp_server-module.html b/docs/public/toc-paramiko.sftp_server-module.html deleted file mode 100644 index 93677ba..0000000 --- a/docs/public/toc-paramiko.sftp_server-module.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - paramiko.sftp_server - - - -
sftp_server
-
- - -Variables
-
- -
-[show private | hide private] - - diff --git a/docs/public/toc-paramiko.sftp_si-module.html b/docs/public/toc-paramiko.sftp_si-module.html deleted file mode 100644 index 58a1d30..0000000 --- a/docs/public/toc-paramiko.sftp_si-module.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - paramiko.sftp_si - - - -
sftp_si
-
- -
-[show private | hide private] - - diff --git a/docs/public/toc-paramiko.transport-module.html b/docs/public/toc-paramiko.transport-module.html deleted file mode 100644 index 14e73b4..0000000 --- a/docs/public/toc-paramiko.transport-module.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - paramiko.transport - - - -
transport
-
- - -Functions
-
- - -Variables
-
- -
-[show private | hide private] - - diff --git a/docs/public/toc-paramiko.util-module.html b/docs/public/toc-paramiko.util-module.html deleted file mode 100644 index 1224321..0000000 --- a/docs/public/toc-paramiko.util-module.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - paramiko.util - - - -
util
-
- - -Classes
-PFilter
-
- - -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
-
- -
-[show private | hide private] - - diff --git a/docs/public/toc.html b/docs/public/toc.html deleted file mode 100644 index a99a3d0..0000000 --- a/docs/public/toc.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - Table of Contents - - - -
Table of Contents
-
-Everything
- - -
Packages
-paramiko
- - -
Modules
-paramiko.agent
-paramiko.dsskey
-paramiko.file
-paramiko.message
-paramiko.pkey
-paramiko.rsakey
-paramiko.server
-paramiko.sftp
-paramiko.sftp_attr
-paramiko.sftp_client
-paramiko.sftp_file
-paramiko.sftp_handle
-paramiko.sftp_server
-paramiko.sftp_si
-paramiko.transport
-paramiko.util
- -

-[show private | hide private] - - diff --git a/docs/public/trees.html b/docs/public/trees.html deleted file mode 100644 index 6c85192..0000000 --- a/docs/public/trees.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - Module and Class Hierarchies - - - - - - - - - - - - - - - - - - -
- - - -
[show private | hide private]
[frames | no frames]
- - -

Module Hierarchy

- - - -

Class Hierarchy

- - - - - - - - - - - - - - - - - - -
Generated by Epydoc 2.1 on Sun Dec 4 11:16:48 2005http://epydoc.sf.net
- - diff --git a/docs/redirect.html b/docs/redirect.html new file mode 100644 index 0000000..33190ec --- /dev/null +++ b/docs/redirect.html @@ -0,0 +1,38 @@ +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 new file mode 100644 index 0000000..078046b --- /dev/null +++ b/docs/since-index.html @@ -0,0 +1,302 @@ + + + + + Introductions List + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + +
[frames] | no frames]
+
+
[ + Identifiers +| Bugs +| Introductions +]

+

Introductions List

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/docs/toc-everything.html b/docs/toc-everything.html new file mode 100644 index 0000000..53f4262 --- /dev/null +++ b/docs/toc-everything.html @@ -0,0 +1,146 @@ + + + + + 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.rng_win32.error
paramiko.util.PFilter
paramiko.util.enumerate
paramiko.win_pageant.PageantConnection

All Functions

+ paramiko.logging22.getLogger
paramiko.rng_win32.open_rng_device
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.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.randpool
paramiko.win_pageant.win32con_WM_COPYDATA

+ + + + diff --git a/docs/toc-paramiko-module.html b/docs/toc-paramiko-module.html new file mode 100644 index 0000000..f6b2876 --- /dev/null +++ b/docs/toc-paramiko-module.html @@ -0,0 +1,61 @@ + + + + + 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 new file mode 100644 index 0000000..5de5e79 --- /dev/null +++ b/docs/toc-paramiko.agent-module.html @@ -0,0 +1,28 @@ + + + + + agent + + + + + +

Module agent

+
+

Variables

+
+ + + + diff --git a/docs/toc-paramiko.auth_handler-module.html b/docs/toc-paramiko.auth_handler-module.html new file mode 100644 index 0000000..7fa221d --- /dev/null +++ b/docs/toc-paramiko.auth_handler-module.html @@ -0,0 +1,28 @@ + + + + + auth_handler + + + + + +

Module auth_handler

+
+

Variables

+
+ + + + diff --git a/docs/toc-paramiko.ber-module.html b/docs/toc-paramiko.ber-module.html new file mode 100644 index 0000000..b5c19e1 --- /dev/null +++ b/docs/toc-paramiko.ber-module.html @@ -0,0 +1,28 @@ + + + + + ber + + + + + +

Module ber

+
+

Classes

+
+ + + + diff --git a/docs/toc-paramiko.buffered_pipe-module.html b/docs/toc-paramiko.buffered_pipe-module.html new file mode 100644 index 0000000..699ad46 --- /dev/null +++ b/docs/toc-paramiko.buffered_pipe-module.html @@ -0,0 +1,28 @@ + + + + + buffered_pipe + + + + + +

Module buffered_pipe

+
+

Classes

+
+ + + + diff --git a/docs/toc-paramiko.channel-module.html b/docs/toc-paramiko.channel-module.html new file mode 100644 index 0000000..7eaaa97 --- /dev/null +++ b/docs/toc-paramiko.channel-module.html @@ -0,0 +1,29 @@ + + + + + channel + + + + + +

Module channel

+
+

Classes

+

Variables

+
+ + + + diff --git a/docs/toc-paramiko.client-module.html b/docs/toc-paramiko.client-module.html new file mode 100644 index 0000000..577541e --- /dev/null +++ b/docs/toc-paramiko.client-module.html @@ -0,0 +1,28 @@ + + + + + client + + + + + +

Module client

+
+

Variables

+
+ + + + diff --git a/docs/toc-paramiko.common-module.html b/docs/toc-paramiko.common-module.html new file mode 100644 index 0000000..0d0a848 --- /dev/null +++ b/docs/toc-paramiko.common-module.html @@ -0,0 +1,28 @@ + + + + + common + + + + + +

Module common

+
+

Variables

+
+ + + + diff --git a/docs/toc-paramiko.compress-module.html b/docs/toc-paramiko.compress-module.html new file mode 100644 index 0000000..ac5a589 --- /dev/null +++ b/docs/toc-paramiko.compress-module.html @@ -0,0 +1,28 @@ + + + + + compress + + + + + +

Module compress

+
+

Classes

+
+ + + + diff --git a/docs/toc-paramiko.config-module.html b/docs/toc-paramiko.config-module.html new file mode 100644 index 0000000..4552d73 --- /dev/null +++ b/docs/toc-paramiko.config-module.html @@ -0,0 +1,27 @@ + + + + + config + + + + + +

Module config

+
+
+ + + + diff --git a/docs/toc-paramiko.dsskey-module.html b/docs/toc-paramiko.dsskey-module.html new file mode 100644 index 0000000..6e0de13 --- /dev/null +++ b/docs/toc-paramiko.dsskey-module.html @@ -0,0 +1,28 @@ + + + + + dsskey + + + + + +

Module dsskey

+
+

Variables

+
+ + + + diff --git a/docs/toc-paramiko.file-module.html b/docs/toc-paramiko.file-module.html new file mode 100644 index 0000000..3fefa62 --- /dev/null +++ b/docs/toc-paramiko.file-module.html @@ -0,0 +1,27 @@ + + + + + file + + + + + +

Module file

+
+
+ + + + diff --git a/docs/toc-paramiko.hostkeys-module.html b/docs/toc-paramiko.hostkeys-module.html new file mode 100644 index 0000000..d7b93dd --- /dev/null +++ b/docs/toc-paramiko.hostkeys-module.html @@ -0,0 +1,29 @@ + + + + + hostkeys + + + + + +

Module hostkeys

+
+

Classes

+

Variables

+
+ + + + diff --git a/docs/toc-paramiko.kex_gex-module.html b/docs/toc-paramiko.kex_gex-module.html new file mode 100644 index 0000000..6f341ae --- /dev/null +++ b/docs/toc-paramiko.kex_gex-module.html @@ -0,0 +1,29 @@ + + + + + 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 new file mode 100644 index 0000000..75e12ba --- /dev/null +++ b/docs/toc-paramiko.kex_group1-module.html @@ -0,0 +1,29 @@ + + + + + kex_group1 + + + + + +

Module kex_group1

+
+

Classes

+

Variables

+
+ + + + diff --git a/docs/toc-paramiko.logging22-module.html b/docs/toc-paramiko.logging22-module.html new file mode 100644 index 0000000..23b4050 --- /dev/null +++ b/docs/toc-paramiko.logging22-module.html @@ -0,0 +1,39 @@ + + + + + logging22 + + + + + +

Module logging22

+
+

Classes

+ Formatter
StreamHandler
logger

Functions

+ getLogger

Variables

+ CRITICAL
DEBUG
ERROR
INFO
WARNING

+ + + + diff --git a/docs/toc-paramiko.message-module.html b/docs/toc-paramiko.message-module.html new file mode 100644 index 0000000..0ef8b8b --- /dev/null +++ b/docs/toc-paramiko.message-module.html @@ -0,0 +1,27 @@ + + + + + message + + + + + +

Module message

+
+
+ + + + diff --git a/docs/toc-paramiko.packet-module.html b/docs/toc-paramiko.packet-module.html new file mode 100644 index 0000000..d269a9a --- /dev/null +++ b/docs/toc-paramiko.packet-module.html @@ -0,0 +1,30 @@ + + + + + packet + + + + + +

Module packet

+
+

Classes

+

Functions

+

Variables

+
+ + + + diff --git a/docs/toc-paramiko.pipe-module.html b/docs/toc-paramiko.pipe-module.html new file mode 100644 index 0000000..328fcb9 --- /dev/null +++ b/docs/toc-paramiko.pipe-module.html @@ -0,0 +1,29 @@ + + + + + pipe + + + + + +

Module pipe

+
+

Classes

+

Functions

+
+ + + + diff --git a/docs/toc-paramiko.pkey-module.html b/docs/toc-paramiko.pkey-module.html new file mode 100644 index 0000000..af555cb --- /dev/null +++ b/docs/toc-paramiko.pkey-module.html @@ -0,0 +1,28 @@ + + + + + pkey + + + + + +

Module pkey

+
+

Variables

+
+ + + + diff --git a/docs/toc-paramiko.primes-module.html b/docs/toc-paramiko.primes-module.html new file mode 100644 index 0000000..ddf708a --- /dev/null +++ b/docs/toc-paramiko.primes-module.html @@ -0,0 +1,28 @@ + + + + + primes + + + + + +

Module primes

+
+

Classes

+
+ + + + diff --git a/docs/toc-paramiko.resource-module.html b/docs/toc-paramiko.resource-module.html new file mode 100644 index 0000000..7e44df7 --- /dev/null +++ b/docs/toc-paramiko.resource-module.html @@ -0,0 +1,28 @@ + + + + + resource + + + + + +

Module resource

+
+

Variables

+
+ + + + diff --git a/docs/toc-paramiko.rng-module.html b/docs/toc-paramiko.rng-module.html new file mode 100644 index 0000000..65755b5 --- /dev/null +++ b/docs/toc-paramiko.rng-module.html @@ -0,0 +1,29 @@ + + + + + rng + + + + + +

Module rng

+
+

Classes

+

Variables

+
+ + + + diff --git a/docs/toc-paramiko.rng_posix-module.html b/docs/toc-paramiko.rng_posix-module.html new file mode 100644 index 0000000..308d2e4 --- /dev/null +++ b/docs/toc-paramiko.rng_posix-module.html @@ -0,0 +1,29 @@ + + + + + rng_posix + + + + + +

Module rng_posix

+
+

Classes

+

Functions

+
+ + + + diff --git a/docs/toc-paramiko.rng_win32-module.html b/docs/toc-paramiko.rng_win32-module.html new file mode 100644 index 0000000..71da0c5 --- /dev/null +++ b/docs/toc-paramiko.rng_win32-module.html @@ -0,0 +1,31 @@ + + + + + rng_win32 + + + + + +

Module rng_win32

+
+

Classes

+ error

Functions

+ open_rng_device

+ + + + diff --git a/docs/toc-paramiko.rsakey-module.html b/docs/toc-paramiko.rsakey-module.html new file mode 100644 index 0000000..6f90edc --- /dev/null +++ b/docs/toc-paramiko.rsakey-module.html @@ -0,0 +1,28 @@ + + + + + rsakey + + + + + +

Module rsakey

+
+

Variables

+
+ + + + diff --git a/docs/toc-paramiko.server-module.html b/docs/toc-paramiko.server-module.html new file mode 100644 index 0000000..3fa9fa0 --- /dev/null +++ b/docs/toc-paramiko.server-module.html @@ -0,0 +1,28 @@ + + + + + server + + + + + +

Module server

+
+

Variables

+
+ + + + diff --git a/docs/toc-paramiko.sftp-module.html b/docs/toc-paramiko.sftp-module.html new file mode 100644 index 0000000..a6f8f10 --- /dev/null +++ b/docs/toc-paramiko.sftp-module.html @@ -0,0 +1,28 @@ + + + + + sftp + + + + + +

Module sftp

+
+

Variables

+
+ + + + diff --git a/docs/toc-paramiko.sftp_attr-module.html b/docs/toc-paramiko.sftp_attr-module.html new file mode 100644 index 0000000..ea808a9 --- /dev/null +++ b/docs/toc-paramiko.sftp_attr-module.html @@ -0,0 +1,28 @@ + + + + + sftp_attr + + + + + +

Module sftp_attr

+
+

Variables

+
+ + + + diff --git a/docs/toc-paramiko.sftp_client-module.html b/docs/toc-paramiko.sftp_client-module.html new file mode 100644 index 0000000..5bf3a67 --- /dev/null +++ b/docs/toc-paramiko.sftp_client-module.html @@ -0,0 +1,28 @@ + + + + + sftp_client + + + + + +

Module sftp_client

+
+

Variables

+
+ + + + diff --git a/docs/toc-paramiko.sftp_file-module.html b/docs/toc-paramiko.sftp_file-module.html new file mode 100644 index 0000000..c2e2578 --- /dev/null +++ b/docs/toc-paramiko.sftp_file-module.html @@ -0,0 +1,28 @@ + + + + + sftp_file + + + + + +

Module sftp_file

+
+

Variables

+
+ + + + diff --git a/docs/toc-paramiko.sftp_handle-module.html b/docs/toc-paramiko.sftp_handle-module.html new file mode 100644 index 0000000..2b658fe --- /dev/null +++ b/docs/toc-paramiko.sftp_handle-module.html @@ -0,0 +1,28 @@ + + + + + sftp_handle + + + + + +

Module sftp_handle

+
+

Variables

+
+ + + + diff --git a/docs/toc-paramiko.sftp_server-module.html b/docs/toc-paramiko.sftp_server-module.html new file mode 100644 index 0000000..f4020a8 --- /dev/null +++ b/docs/toc-paramiko.sftp_server-module.html @@ -0,0 +1,28 @@ + + + + + sftp_server + + + + + +

Module sftp_server

+
+

Variables

+
+ + + + diff --git a/docs/toc-paramiko.sftp_si-module.html b/docs/toc-paramiko.sftp_si-module.html new file mode 100644 index 0000000..ef768fe --- /dev/null +++ b/docs/toc-paramiko.sftp_si-module.html @@ -0,0 +1,28 @@ + + + + + sftp_si + + + + + +

Module sftp_si

+
+

Variables

+
+ + + + diff --git a/docs/toc-paramiko.ssh_exception-module.html b/docs/toc-paramiko.ssh_exception-module.html new file mode 100644 index 0000000..eb2abfe --- /dev/null +++ b/docs/toc-paramiko.ssh_exception-module.html @@ -0,0 +1,28 @@ + + + + + ssh_exception + + + + + +

Module ssh_exception

+
+

Classes

+
+ + + + diff --git a/docs/toc-paramiko.transport-module.html b/docs/toc-paramiko.transport-module.html new file mode 100644 index 0000000..f22c4ce --- /dev/null +++ b/docs/toc-paramiko.transport-module.html @@ -0,0 +1,29 @@ + + + + + transport + + + + + +

Module transport

+
+

Classes

+

Variables

+
+ + + + diff --git a/docs/toc-paramiko.util-module.html b/docs/toc-paramiko.util-module.html new file mode 100644 index 0000000..569b46c --- /dev/null +++ b/docs/toc-paramiko.util-module.html @@ -0,0 +1,99 @@ + + + + + util + + + + + +

Module util

+
+

Classes

+ 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
randpool

+ + + + diff --git a/docs/toc-paramiko.win_pageant-module.html b/docs/toc-paramiko.win_pageant-module.html new file mode 100644 index 0000000..988262c --- /dev/null +++ b/docs/toc-paramiko.win_pageant-module.html @@ -0,0 +1,33 @@ + + + + + win_pageant + + + + + +

Module win_pageant

+
+

Classes

+ PageantConnection

Functions

+ can_talk_to_agent

Variables

+ win32con_WM_COPYDATA

+ + + + diff --git a/docs/toc.html b/docs/toc.html new file mode 100644 index 0000000..f4183e8 --- /dev/null +++ b/docs/toc.html @@ -0,0 +1,35 @@ + + + + + Table of Contents + + + + + +

Table of Contents

+
+ Everything +
+

Modules

+ paramiko
paramiko.logging22
paramiko.rng_win32
paramiko.util
paramiko.win_pageant

+ + + + diff --git a/forward.py b/forward.py deleted file mode 100644 index f91e969..0000000 --- a/forward.py +++ /dev/null @@ -1,219 +0,0 @@ -#!/usr/bin/python - -# Copyright (C) 2003-2005 Robey Pointer -# -# 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. - -""" -Sample script showing how to do local port forwarding over paramiko. - -This script connects to the requested SSH server and sets up local port -forwarding (the openssh -L option) from a local port through a tunneled -connection to a destination reachable from the SSH server machine. -""" - -import sys -import os -import socket -import select -import SocketServer -import getpass -import base64 -from optparse import OptionParser - -import paramiko - -DEFAULT_PORT = 4000 -SSH_PORT = 22 -VERBOSE = True -READPASS = False - - -class ForwardServer (SocketServer.ThreadingTCPServer): - daemon_threads = True - allow_reuse_address = True - - -class Handler (SocketServer.BaseRequestHandler): - - def handle(self): - try: - chan = self.ssh_transport.open_channel('direct-tcpip', - (self.chain_host, self.chain_port), - self.request.getpeername()) - except Exception, e: - verbose('Incoming request to %s:%d failed: %s' % (self.chain_host, - self.chain_port, - repr(e))) - return - - verbose('Connected! Tunnel open.') - while True: - r, w, x = select.select([self.request, chan], [], []) - if self.request in r: - data = self.request.recv(1024) - if len(data) == 0: - break - chan.send(data) - if chan in r: - data = chan.recv(1024) - if len(data) == 0: - break - self.request.send(data) - chan.close() - self.request.close() - verbose('Tunnel closed.') - - -def forward_tunnel(local_port, remote_host, remote_port, transport): - # this is a little convoluted, but lets me configure things for the Handler - # object. (SocketServer doesn't give Handlers any way to access the outer - # server normally.) - class SubHander (Handler): - chain_host = remote_host - chain_port = remote_port - ssh_transport = transport - ForwardServer(('', local_port), SubHander).serve_forever() - -def find_default_key_file(): - filename = os.path.expanduser('~/.ssh/id_rsa') - if os.access(filename, os.R_OK): - return filename - filename = os.path.expanduser('~/ssh/id_rsa') - if os.access(filename, os.R_OK): - return filename - filename = os.path.expanduser('~/.ssh/id_dsa') - if os.access(filename, os.R_OK): - return filename - filename = os.path.expanduser('~/ssh/id_dsa') - if os.access(filename, os.R_OK): - return filename - return '' - -def verbose(s): - if VERBOSE: - print s - - -##### - - -parser = OptionParser(usage='usage: %prog [options] :', - version='%prog 1.0') -parser.add_option('-q', '--quiet', action='store_false', dest='verbose', default=VERBOSE, - help='squelch all informational output') -parser.add_option('-l', '--local-port', action='store', type='int', dest='port', - default=DEFAULT_PORT, - help='local port to forward (default: %d)' % DEFAULT_PORT) -parser.add_option('-r', '--host', action='store', type='string', dest='ssh_host', - help='SSH host to tunnel through (required)') -parser.add_option('-p', '--port', action='store', type='int', dest='ssh_port', default=SSH_PORT, - help='SSH port to tunnel through (default: %d)' % SSH_PORT) -parser.add_option('-u', '--user', action='store', type='string', dest='user', - default=getpass.getuser(), - help='username for SSH authentication (default: %s)' % getpass.getuser()) -parser.add_option('-K', '--key', action='store', type='string', dest='keyfile', - default=find_default_key_file(), - help='private key file to use for SSH authentication') -parser.add_option('', '--no-key', action='store_false', dest='use_key', default=True, - help='don\'t look for or use a private key file') -parser.add_option('-P', '--password', action='store_true', dest='readpass', default=READPASS, - help='read password (for key or password auth) from stdin') -options, args = parser.parse_args() - -VERBOSE = options.verbose -READPASS = options.readpass - - -if len(args) != 1: - parser.error('Incorrect number of arguments.') -remote_host = args[0] -if ':' not in remote_host: - parser.error('Remote port missing.') -remote_host, remote_port = remote_host.split(':', 1) -try: - remote_port = int(remote_port) -except: - parser.error('Remote port must be a number.') - -if not options.ssh_host: - parser.error('SSH host is required.') -if ':' in options.ssh_host: - options.ssh_host, options.ssh_port = options.ssh_host.split(':', 1) - try: - options.ssh_port = int(options.ssh_port) - except: - parser.error('SSH port must be a number.') - -try: - host_keys = paramiko.util.load_host_keys(os.path.expanduser('~/.ssh/known_hosts')) -except IOError: - try: - host_keys = paramiko.util.load_host_keys(os.path.expanduser('~/ssh/known_hosts')) - except IOError: - print '*** Unable to open host keys file' - host_keys = {} - -if not host_keys.has_key(options.ssh_host): - print '*** Warning: no host key for %s' % options.ssh_host - expected_host_key_type = None - expected_host_key = None -else: - expected_host_key_type = host_keys[options.ssh_host].keys()[0] - expected_host_key = host_keys[options.ssh_host][expected_host_key_type] - -key = None -password = None -if options.use_key: - try: - key = paramiko.RSAKey.from_private_key_file(options.keyfile) - except paramiko.PasswordRequiredException: - if not READPASS: - print '*** Password needed for keyfile (use -P): %s' % options.keyfile - sys.exit(1) - key_password = getpass.getpass('Enter password for key: ') - try: - key = paramiko.RSAKey.from_private_key_file(options.keyfile, key_password) - except: - print '*** Unable to read keyfile: %s' % options.keyfile - sys.exit(1) - except: - pass - -if key is None: - # try reading a password then - if not READPASS: - print '*** Either a valid private key or password is required (use -K or -P).' - sys.exit(1) - password = getpass.getpass('Enter password: ') - -verbose('Connecting to ssh host %s:%d ...' % (options.ssh_host, options.ssh_port)) - -transport = paramiko.Transport((options.ssh_host, options.ssh_port)) -transport.connect(hostkeytype=expected_host_key_type, - hostkey=expected_host_key, - username=options.user, - password=password, - pkey=key) - -verbose('Now forwarding port %d to %s:%d ...' % (options.port, remote_host, remote_port)) - -try: - forward_tunnel(options.port, remote_host, remote_port, transport) -except KeyboardInterrupt: - print 'Port forwarding stopped.' - sys.exit(0) diff --git a/paramiko.egg-info/PKG-INFO b/paramiko.egg-info/PKG-INFO new file mode 100644 index 0000000..f40d53f --- /dev/null +++ b/paramiko.egg-info/PKG-INFO @@ -0,0 +1,25 @@ +Metadata-Version: 1.0 +Name: paramiko +Version: 1.7.4 +Summary: SSH2 protocol library +Home-page: http://www.lag.net/paramiko/ +Author: Robey Pointer +Author-email: robey@lag.net +License: LGPL +Download-URL: http://www.lag.net/paramiko/download/paramiko-1.7.4.zip +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 new file mode 100644 index 0000000..40a1c7d --- /dev/null +++ b/paramiko.egg-info/SOURCES.txt @@ -0,0 +1,266 @@ +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.rng-module.html +docs/paramiko.rng-pysrc.html +docs/paramiko.rng.StrongLockingRandomPool-class.html +docs/paramiko.rng_posix-module.html +docs/paramiko.rng_posix-pysrc.html +docs/paramiko.rng_posix.error-class.html +docs/paramiko.rng_win32-module.html +docs/paramiko.rng_win32-pysrc.html +docs/paramiko.rng_win32.error-class.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.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.rng-module.html +docs/toc-paramiko.rng_posix-module.html +docs/toc-paramiko.rng_win32-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/rng.py +paramiko/rng_posix.py +paramiko/rng_win32.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 diff --git a/paramiko.egg-info/dependency_links.txt b/paramiko.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/paramiko.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/paramiko.egg-info/requires.txt b/paramiko.egg-info/requires.txt new file mode 100644 index 0000000..ac63416 --- /dev/null +++ b/paramiko.egg-info/requires.txt @@ -0,0 +1 @@ +pycrypto >= 1.9 \ No newline at end of file diff --git a/paramiko.egg-info/top_level.txt b/paramiko.egg-info/top_level.txt new file mode 100644 index 0000000..8608c1b --- /dev/null +++ b/paramiko.egg-info/top_level.txt @@ -0,0 +1 @@ +paramiko diff --git a/paramiko/__init__.py b/paramiko/__init__.py index 0a312cb..9a8caec 100644 --- a/paramiko/__init__.py +++ b/paramiko/__init__.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2008 Robey Pointer # # This file is part of paramiko. # @@ -26,8 +26,9 @@ replaced C{telnet} and C{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 C{sftp} works, for example.) -To use this package, pass a socket (or socket-like object) to a L{Transport}, -and use L{start_server } or +The high-level client API starts with creation of an L{SSHClient} object. +For more direct control, pass a socket (or socket-like object) to a +L{Transport}, and use L{start_server } or L{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 @@ -46,7 +47,7 @@ released under the GNU Lesser General Public License (LGPL). Website: U{http://www.lag.net/paramiko/} -@version: 1.5.2 (rhydon) +@version: 1.7.4 (Desmond) @author: Robey Pointer @contact: robey@lag.net @license: GNU Lesser General Public License (LGPL) @@ -59,20 +60,19 @@ if sys.version_info < (2, 2): __author__ = "Robey Pointer " -__date__ = "04 Dec 2005" -__version__ = "1.5.2 (rhydon)" -__version_info__ = (1, 5, 2) +__date__ = "06 Jul 2008" +__version__ = "1.7.4 (Desmond)" +__version_info__ = (1, 7, 4) __license__ = "GNU Lesser General Public License (LGPL)" -import transport, auth_handler, channel, rsakey, dsskey, message -import ssh_exception, file, packet, agent, server, util -import sftp_client, sftp_attr, sftp_handle, sftp_server, sftp_si - from transport import randpool, SecurityOptions, Transport +from client import SSHClient, MissingHostKeyPolicy, AutoAddPolicy, RejectPolicy, WarningPolicy from auth_handler import AuthHandler from channel import Channel, ChannelFile -from ssh_exception import SSHException, PasswordRequiredException, BadAuthenticationType +from ssh_exception import SSHException, PasswordRequiredException, \ + BadAuthenticationType, ChannelException, BadHostKeyException, \ + AuthenticationException from server import ServerInterface, SubsystemHandler, InteractiveQuery from rsakey import RSAKey from dsskey import DSSKey @@ -88,15 +88,15 @@ from packet import Packetizer from file import BufferedFile from agent import Agent, AgentKey from pkey import PKey +from hostkeys import HostKeys +from config import SSHConfig # fix module names for epydoc -for x in [Transport, SecurityOptions, Channel, SFTPServer, SSHException, \ - PasswordRequiredException, BadAuthenticationType, ChannelFile, \ - SubsystemHandler, AuthHandler, RSAKey, DSSKey, SFTPError, \ - SFTP, SFTPClient, SFTPServer, Message, Packetizer, SFTPAttributes, \ - SFTPHandle, SFTPServerInterface, BufferedFile, Agent, AgentKey, \ - PKey, BaseSFTP, SFTPFile, ServerInterface]: - x.__module__ = 'paramiko' +for c in locals().values(): + if issubclass(type(c), type) or type(c).__name__ == 'classobj': + # classobj for exceptions :/ + c.__module__ = __name__ +del c from common import AUTH_SUCCESSFUL, AUTH_PARTIALLY_SUCCESSFUL, AUTH_FAILED, \ OPEN_SUCCEEDED, OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED, OPEN_FAILED_CONNECT_FAILED, \ @@ -106,16 +106,24 @@ from sftp import SFTP_OK, SFTP_EOF, SFTP_NO_SUCH_FILE, SFTP_PERMISSION_DENIED, S SFTP_BAD_MESSAGE, SFTP_NO_CONNECTION, SFTP_CONNECTION_LOST, SFTP_OP_UNSUPPORTED __all__ = [ 'Transport', + 'SSHClient', + 'MissingHostKeyPolicy', + 'AutoAddPolicy', + 'RejectPolicy', + 'WarningPolicy', 'SecurityOptions', 'SubsystemHandler', 'Channel', + 'PKey', 'RSAKey', 'DSSKey', - 'Agent', 'Message', 'SSHException', + 'AuthenticationException', 'PasswordRequiredException', 'BadAuthenticationType', + 'ChannelException', + 'BadHostKeyException', 'SFTP', 'SFTPFile', 'SFTPHandle', @@ -123,24 +131,11 @@ __all__ = [ 'Transport', 'SFTPServer', 'SFTPError', 'SFTPAttributes', - 'SFTPServerInterface' + 'SFTPServerInterface', 'ServerInterface', 'BufferedFile', 'Agent', 'AgentKey', - 'rsakey', - 'dsskey', - 'pkey', - 'message', - 'transport', - 'sftp', - 'sftp_client', - 'sftp_server', - 'sftp_attr', - 'sftp_file', - 'sftp_si', - 'sftp_handle', - 'server', - 'file', - 'agent', + 'HostKeys', + 'SSHConfig', 'util' ] diff --git a/paramiko/agent.py b/paramiko/agent.py index 3555512..71de8b8 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 John Rochester +# Copyright (C) 2003-2007 John Rochester # # This file is part of paramiko. # @@ -55,20 +55,33 @@ class Agent: @raise SSHException: if an SSH agent is found, but speaks an incompatible protocol """ + self.keys = () if ('SSH_AUTH_SOCK' in os.environ) and (sys.platform != 'win32'): conn = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) - conn.connect(os.environ['SSH_AUTH_SOCK']) + try: + conn.connect(os.environ['SSH_AUTH_SOCK']) + except: + # probably a dangling env var: the ssh agent is gone + return self.conn = conn - type, result = self._send_message(chr(SSH2_AGENTC_REQUEST_IDENTITIES)) - if type != 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) + elif sys.platform == 'win32': + import win_pageant + if win_pageant.can_talk_to_agent(): + self.conn = win_pageant.PageantConnection() + else: + return else: - self.keys = () + # 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) def close(self): """ @@ -132,7 +145,7 @@ class AgentKey(PKey): msg.add_string(self.blob) msg.add_string(data) msg.add_int(0) - type, result = self.agent._send_message(msg) - if type != SSH2_AGENT_SIGN_RESPONSE: + ptype, result = self.agent._send_message(msg) + if ptype != SSH2_AGENT_SIGN_RESPONSE: raise SSHException('key cannot be used for signing') return result.get_string() diff --git a/paramiko/auth_handler.py b/paramiko/auth_handler.py index 59aa376..39a0194 100644 --- a/paramiko/auth_handler.py +++ b/paramiko/auth_handler.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -21,6 +21,7 @@ L{AuthHandler} """ import threading +import weakref # this helps freezing utils import encodings.utf_8 @@ -28,7 +29,8 @@ import encodings.utf_8 from paramiko.common import * from paramiko import util from paramiko.message import Message -from paramiko.ssh_exception import SSHException, BadAuthenticationType, PartialAuthentication +from paramiko.ssh_exception import SSHException, AuthenticationException, \ + BadAuthenticationType, PartialAuthentication from paramiko.server import InteractiveQuery @@ -38,13 +40,15 @@ class AuthHandler (object): """ def __init__(self, transport): - self.transport = transport + self.transport = weakref.proxy(transport) self.username = None self.authenticated = False self.auth_event = None self.auth_method = '' self.password = None self.private_key = None + self.interactive_handler = None + self.submethods = None # for server mode: self.auth_username = None self.auth_fail_count = 0 @@ -154,15 +158,15 @@ class AuthHandler (object): event.wait(0.1) if not self.transport.is_active(): e = self.transport.get_exception() - if e is None: - e = SSHException('Authentication failed.') + if (e is None) or issubclass(e.__class__, EOFError): + e = AuthenticationException('Authentication failed.') raise e if event.isSet(): break if not self.is_authenticated(): e = self.transport.get_exception() if e is None: - e = SSHException('Authentication failed.') + e = AuthenticationException('Authentication failed.') # this is horrible. python Exception isn't yet descended from # object, so type(e) won't work. :( if issubclass(e.__class__, PartialAuthentication): @@ -193,7 +197,10 @@ class AuthHandler (object): m.add_string(self.auth_method) if self.auth_method == 'password': m.add_boolean(False) - m.add_string(self.password.encode('UTF-8')) + password = self.password + if isinstance(password, unicode): + password = password.encode('UTF-8') + m.add_string(password) elif self.auth_method == 'publickey': m.add_boolean(True) m.add_string(self.private_key.get_name()) @@ -276,12 +283,22 @@ class AuthHandler (object): result = self.transport.server_object.check_auth_none(username) elif method == 'password': changereq = m.get_boolean() - password = m.get_string().decode('UTF-8', 'replace') + password = m.get_string() + try: + password = password.decode('UTF-8') + except UnicodeError: + # some clients/servers expect non-utf-8 passwords! + # in this case, just return the raw byte string. + pass if changereq: # always treated as failure, since we don't support changing passwords, but collect # the list of valid auth types from the callback anyway self.transport._log(DEBUG, 'Auth request to change passwords (rejected)') - newpassword = m.get_string().decode('UTF-8', 'replace') + newpassword = m.get_string() + try: + newpassword = newpassword.decode('UTF-8', 'replace') + except UnicodeError: + pass result = AUTH_FAILED else: result = self.transport.server_object.check_auth_password(username, password) @@ -332,7 +349,7 @@ class AuthHandler (object): self._send_auth_result(username, method, result) def _parse_userauth_success(self, m): - self.transport._log(INFO, 'Authentication successful!') + self.transport._log(INFO, 'Authentication (%s) successful!' % self.auth_method) self.authenticated = True self.transport._auth_trigger() if self.auth_event != None: @@ -346,11 +363,11 @@ class AuthHandler (object): self.transport._log(DEBUG, 'Methods: ' + str(authlist)) self.transport.saved_exception = PartialAuthentication(authlist) elif self.auth_method not in authlist: - self.transport._log(INFO, 'Authentication type not permitted.') + self.transport._log(INFO, 'Authentication type (%s) not permitted.' % self.auth_method) self.transport._log(DEBUG, 'Allowed methods: ' + str(authlist)) self.transport.saved_exception = BadAuthenticationType('Bad authentication type', authlist) else: - self.transport._log(INFO, 'Authentication failed.') + self.transport._log(INFO, 'Authentication (%s) failed.' % self.auth_method) self.authenticated = False self.username = None if self.auth_event != None: @@ -407,4 +424,3 @@ class AuthHandler (object): MSG_USERAUTH_INFO_RESPONSE: _parse_userauth_info_response, } - diff --git a/paramiko/ber.py b/paramiko/ber.py index 6a7823d..9d8ddfa 100644 --- a/paramiko/ber.py +++ b/paramiko/ber.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -16,7 +16,7 @@ # along with Paramiko; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -import struct + import util @@ -91,8 +91,9 @@ class BER(object): while True: x = b.decode_next() if x is None: - return out + break out.append(x) + return out decode_sequence = staticmethod(decode_sequence) def encode_tlv(self, ident, val): diff --git a/paramiko/buffered_pipe.py b/paramiko/buffered_pipe.py new file mode 100644 index 0000000..ae3d9d6 --- /dev/null +++ b/paramiko/buffered_pipe.py @@ -0,0 +1,200 @@ +# Copyright (C) 2006-2007 Robey Pointer +# +# 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. + +""" +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. +""" + +import array +import threading +import time + + +class PipeTimeout (IOError): + """ + Indicates that a timeout was reached on a read from a L{BufferedPipe}. + """ + pass + + +class BufferedPipe (object): + """ + 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 + L{Channel}. + """ + + def __init__(self): + self._lock = threading.Lock() + self._cv = threading.Condition(self._lock) + self._event = None + self._buffer = array.array('B') + self._closed = False + + def set_event(self, event): + """ + 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. + + @param event: the event to set/clear + @type event: Event + """ + self._event = event + if len(self._buffer) > 0: + event.set() + else: + event.clear() + + def feed(self, data): + """ + Feed new data into this pipe. This method is assumed to be called + from a separate thread, so synchronization is done. + + @param data: the data to add + @type data: str + """ + self._lock.acquire() + try: + if self._event is not None: + self._event.set() + self._buffer.fromstring(data) + self._cv.notifyAll() + finally: + self._lock.release() + + def read_ready(self): + """ + Returns true if data is buffered and ready to be read from this + feeder. A C{False} result does not mean that the feeder has closed; + it means you may need to wait before more data arrives. + + @return: C{True} if a L{read} call would immediately return at least + one byte; C{False} otherwise. + @rtype: bool + """ + self._lock.acquire() + try: + if len(self._buffer) == 0: + return False + return True + finally: + self._lock.release() + + def read(self, nbytes, timeout=None): + """ + 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 C{nbytes}. If a string of length zero is returned, + the pipe has been closed. + + The optional C{timeout} argument can be a nonnegative float expressing + seconds, or C{None} for no timeout. If a float is given, a + C{PipeTimeout} will be raised if the timeout period value has + elapsed before any data arrives. + + @param nbytes: maximum number of bytes to read + @type nbytes: int + @param timeout: maximum seconds to wait (or C{None}, the default, to + wait forever) + @type timeout: float + @return: data + @rtype: str + + @raise PipeTimeout: if a timeout was specified and no data was ready + before that timeout + """ + out = '' + self._lock.acquire() + try: + if len(self._buffer) == 0: + if self._closed: + return out + # should we block? + if timeout == 0.0: + raise PipeTimeout() + # loop here in case we get woken up but a different thread has + # grabbed everything in the buffer. + while (len(self._buffer) == 0) and not self._closed: + then = time.time() + self._cv.wait(timeout) + if timeout is not None: + timeout -= time.time() - then + if timeout <= 0.0: + raise PipeTimeout() + + # something's in the buffer and we have the lock! + if len(self._buffer) <= nbytes: + out = self._buffer.tostring() + del self._buffer[:] + if (self._event is not None) and not self._closed: + self._event.clear() + else: + out = self._buffer[:nbytes].tostring() + del self._buffer[:nbytes] + finally: + self._lock.release() + + return out + + def empty(self): + """ + Clear out the buffer and return all data that was in it. + + @return: any data that was in the buffer prior to clearing it out + @rtype: str + """ + self._lock.acquire() + try: + out = self._buffer.tostring() + del self._buffer[:] + if (self._event is not None) and not self._closed: + self._event.clear() + return out + finally: + self._lock.release() + + def close(self): + """ + Close this pipe object. Future calls to L{read} after the buffer + has been emptied will return immediately with an empty string. + """ + self._lock.acquire() + try: + self._closed = True + self._cv.notifyAll() + if self._event is not None: + self._event.set() + finally: + self._lock.release() + + def __len__(self): + """ + Return the number of bytes buffered. + + @return: number of bytes bufferes + @rtype: int + """ + self._lock.acquire() + try: + return len(self._buffer) + finally: + self._lock.release() + diff --git a/paramiko/channel.py b/paramiko/channel.py index 8a00233..910a03c 100644 --- a/paramiko/channel.py +++ b/paramiko/channel.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -20,6 +20,7 @@ Abstraction for an SSH2 channel. """ +import binascii import sys import time import threading @@ -31,9 +32,14 @@ from paramiko import util from paramiko.message import Message from paramiko.ssh_exception import SSHException from paramiko.file import BufferedFile +from paramiko.buffered_pipe import BufferedPipe, PipeTimeout from paramiko import pipe +# lower bound on the max packet size we'll accept from the remote host +MIN_PACKET_SIZE = 1024 + + class Channel (object): """ A secure tunnel across an SSH L{Transport}. A Channel is meant to behave @@ -49,9 +55,6 @@ class Channel (object): is exactly like a normal network socket, so it shouldn't be too surprising. """ - # lower bound on the max packet size we'll accept from the remote host - MIN_PACKET_SIZE = 1024 - def __init__(self, chanid): """ Create a new channel. The channel is not associated with any @@ -69,14 +72,12 @@ class Channel (object): self.active = False self.eof_received = 0 self.eof_sent = 0 - self.in_buffer = '' - self.in_stderr_buffer = '' + self.in_buffer = BufferedPipe() + self.in_stderr_buffer = BufferedPipe() self.timeout = None self.closed = False self.ultra_debug = False self.lock = threading.Lock() - self.in_buffer_cv = threading.Condition(self.lock) - self.in_stderr_buffer_cv = threading.Condition(self.lock) self.out_buffer_cv = threading.Condition(self.lock) self.in_window_size = 0 self.out_window_size = 0 @@ -85,15 +86,19 @@ class Channel (object): self.in_window_threshold = 0 self.in_window_sofar = 0 self.status_event = threading.Event() - self.name = str(chanid) - self.logger = util.get_logger('paramiko.chan.' + str(chanid)) - self.pipe = None + self._name = str(chanid) + self.logger = util.get_logger('paramiko.transport') + self._pipe = None self.event = threading.Event() self.combine_stderr = False self.exit_status = -1 + self.origin_addr = None def __del__(self): - self.close() + try: + self.close() + except: + pass def __repr__(self): """ @@ -124,14 +129,15 @@ class Channel (object): It isn't necessary (or desirable) to call this method if you're going to exectue a single command with L{exec_command}. - @param term: the terminal type to emulate (for example, C{'vt100'}). + @param term: the terminal type to emulate (for example, C{'vt100'}) @type term: str @param width: width (in characters) of the terminal screen @type width: int @param height: height (in characters) of the terminal screen @type height: int - @return: C{True} if the operation succeeded; C{False} if not. - @rtype: bool + + @raise SSHException: if the request was rejected or the channel was + closed """ if self.closed or self.eof_received or self.eof_sent or not self.active: raise SSHException('Channel is not open') @@ -148,12 +154,7 @@ class Channel (object): m.add_string('') self.event.clear() self.transport._send_user_message(m) - while True: - self.event.wait(0.1) - if self.closed: - return False - if self.event.isSet(): - return True + self._wait_for_event() def invoke_shell(self): """ @@ -168,8 +169,8 @@ class Channel (object): 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. - @return: C{True} if the operation succeeded; C{False} if not. - @rtype: bool + @raise SSHException: if the request was rejected or the channel was + closed """ if self.closed or self.eof_received or self.eof_sent or not self.active: raise SSHException('Channel is not open') @@ -180,12 +181,7 @@ class Channel (object): m.add_boolean(1) self.event.clear() self.transport._send_user_message(m) - while True: - self.event.wait(0.1) - if self.closed: - return False - if self.event.isSet(): - return True + self._wait_for_event() def exec_command(self, command): """ @@ -199,8 +195,9 @@ class Channel (object): @param command: a shell command to execute. @type command: str - @return: C{True} if the operation succeeded; C{False} if not. - @rtype: bool + + @raise SSHException: if the request was rejected or the channel was + closed """ if self.closed or self.eof_received or self.eof_sent or not self.active: raise SSHException('Channel is not open') @@ -208,16 +205,11 @@ class Channel (object): m.add_byte(chr(MSG_CHANNEL_REQUEST)) m.add_int(self.remote_chanid) m.add_string('exec') - m.add_boolean(1) + m.add_boolean(True) m.add_string(command) self.event.clear() self.transport._send_user_message(m) - while True: - self.event.wait(0.1) - if self.closed: - return False - if self.event.isSet(): - return True + self._wait_for_event() def invoke_subsystem(self, subsystem): """ @@ -230,8 +222,9 @@ class Channel (object): @param subsystem: name of the subsystem being requested. @type subsystem: str - @return: C{True} if the operation succeeded; C{False} if not. - @rtype: bool + + @raise SSHException: if the request was rejected or the channel was + closed """ if self.closed or self.eof_received or self.eof_sent or not self.active: raise SSHException('Channel is not open') @@ -239,16 +232,11 @@ class Channel (object): m.add_byte(chr(MSG_CHANNEL_REQUEST)) m.add_int(self.remote_chanid) m.add_string('subsystem') - m.add_boolean(1) + m.add_boolean(True) m.add_string(subsystem) self.event.clear() self.transport._send_user_message(m) - while True: - self.event.wait(0.1) - if self.closed: - return False - if self.event.isSet(): - return True + self._wait_for_event() def resize_pty(self, width=80, height=24): """ @@ -259,8 +247,9 @@ class Channel (object): @type width: int @param height: new height (in characters) of the terminal screen @type height: int - @return: C{True} if the operation succeeded; C{False} if not. - @rtype: bool + + @raise SSHException: if the request was rejected or the channel was + closed """ if self.closed or self.eof_received or self.eof_sent or not self.active: raise SSHException('Channel is not open') @@ -268,19 +257,27 @@ class Channel (object): m.add_byte(chr(MSG_CHANNEL_REQUEST)) m.add_int(self.remote_chanid) m.add_string('window-change') - m.add_boolean(1) + m.add_boolean(True) m.add_int(width) m.add_int(height) m.add_int(0).add_int(0) self.event.clear() self.transport._send_user_message(m) - while True: - self.event.wait(0.1) - if self.closed: - return False - if self.event.isSet(): - return True + self._wait_for_event() + def exit_status_ready(self): + """ + 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 L{recv_exit_status}. Note that the server may not + return an exit status in some cases (like bad servers). + + @return: True if L{recv_exit_status} will return immediately + @rtype: bool + @since: 1.7.3 + """ + return self.closed or self.status_event.isSet() + def recv_exit_status(self): """ Return the exit status from the process on the server. This is @@ -296,8 +293,9 @@ class Channel (object): """ while True: if self.closed or self.status_event.isSet(): - return self.exit_status + break self.status_event.wait(0.1) + return self.exit_status def send_exit_status(self, status): """ @@ -317,10 +315,73 @@ class Channel (object): m.add_byte(chr(MSG_CHANNEL_REQUEST)) m.add_int(self.remote_chanid) m.add_string('exit-status') - m.add_boolean(0) + m.add_boolean(False) m.add_int(status) self.transport._send_user_message(m) + + def request_x11(self, screen_number=0, auth_protocol=None, auth_cookie=None, + single_connection=False, handler=None): + """ + 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 + L{Transport.accept}. The handler's calling signature is:: + + handler(channel: Channel, (address: str, port: int)) + + @param screen_number: the x11 screen number (0, 10, etc) + @type screen_number: int + @param auth_protocol: the name of the X11 authentication method used; + if none is given, C{"MIT-MAGIC-COOKIE-1"} is used + @type auth_protocol: str + @param auth_cookie: hexadecimal string containing the x11 auth cookie; + if none is given, a secure random 128-bit value is generated + @type auth_cookie: str + @param single_connection: if True, only a single x11 connection will be + forwarded (by default, any number of x11 connections can arrive + over this session) + @type single_connection: bool + @param handler: an optional handler to use for incoming X11 connections + @type handler: function + @return: the auth_cookie used + """ + if self.closed or self.eof_received or self.eof_sent or not self.active: + raise SSHException('Channel is not open') + if auth_protocol is None: + auth_protocol = 'MIT-MAGIC-COOKIE-1' + if auth_cookie is None: + auth_cookie = binascii.hexlify(self.transport.randpool.get_bytes(16)) + + m = Message() + m.add_byte(chr(MSG_CHANNEL_REQUEST)) + m.add_int(self.remote_chanid) + m.add_string('x11-req') + m.add_boolean(True) + m.add_boolean(single_connection) + m.add_string(auth_protocol) + m.add_string(auth_cookie) + m.add_int(screen_number) + self.event.clear() + self.transport._send_user_message(m) + self._wait_for_event() + self.transport._set_x11_handler(handler) + return auth_cookie + def get_transport(self): """ Return the L{Transport} associated with this channel. @@ -333,14 +394,13 @@ class Channel (object): def set_name(self, name): """ Set a name for this channel. Currently it's only used to set the name - of the log level used for debugging. The name can be fetched with the + of the channel in logfile entries. The name can be fetched with the L{get_name} method. - @param name: new channel name. + @param name: new channel name @type name: str """ - self.name = name - self.logger = util.get_logger(self.transport.get_log_channel() + '.' + self.name) + self._name = name def get_name(self): """ @@ -349,7 +409,7 @@ class Channel (object): @return: the name of this channel. @rtype: str """ - return self.name + return self._name def get_id(self): """ @@ -360,8 +420,6 @@ class Channel (object): @return: the ID of this channel. @rtype: int - - @since: ivysaur """ return self.chanid @@ -394,8 +452,7 @@ class Channel (object): self.combine_stderr = combine if combine and not old: # copy old stderr buffer into primary buffer - data = self.in_stderr_buffer - self.in_stderr_buffer = '' + data = self.in_stderr_buffer.empty() finally: self.lock.release() if len(data) > 0: @@ -419,7 +476,7 @@ class Channel (object): C{chan.settimeout(None)} is equivalent to C{chan.setblocking(1)}. @param timeout: seconds to wait for a pending read/write operation - before raising C{socket.timeout}, or C{None} for no timeout. + before raising C{socket.timeout}, or C{None} for no timeout. @type timeout: float """ self.timeout = timeout @@ -439,17 +496,19 @@ class Channel (object): """ Set blocking or non-blocking mode of the channel: if C{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. + mode. Initially all channels are in blocking mode. In non-blocking mode, if a L{recv} call doesn't find any data, or if a L{send} call can't immediately dispose of the data, an error exception - is raised. In blocking mode, the calls block until they can proceed. + is raised. In blocking mode, the calls block until they can proceed. An + EOF condition is considered "immediate data" for L{recv}, so if the + channel is closed in the read direction, it will never block. C{chan.setblocking(0)} is equivalent to C{chan.settimeout(0)}; C{chan.setblocking(1)} is equivalent to C{chan.settimeout(None)}. @param blocking: 0 to set non-blocking mode; non-0 to set blocking - mode. + mode. @type blocking: int """ if blocking: @@ -457,6 +516,18 @@ class Channel (object): else: self.settimeout(0.0) + def getpeername(self): + """ + Return the address of the remote side of this Channel, if possible. + This is just a wrapper around C{'getpeername'} on the Transport, used + to provide enough of a socket-like interface to allow asyncore to work. + (asyncore likes to call C{'getpeername'}.) + + @return: the address if the remote host, if known + @rtype: tuple(str, int) + """ + return self.transport.getpeername() + def close(self): """ Close the channel. All future read/write operations on the channel @@ -466,15 +537,17 @@ class Channel (object): """ self.lock.acquire() try: + # only close the pipe when the user explicitly closes the channel. + # otherwise they will get unpleasant surprises. (and do it before + # checking self.closed, since the remote host may have already + # closed the connection.) + if self._pipe is not None: + self._pipe.close() + self._pipe = None + if not self.active or self.closed: return msgs = self._close_internal() - - # only close the pipe when the user explicitly closes the channel. - # otherwise they will get unpleasant surprises. - if self.pipe is not None: - self.pipe.close() - self.pipe = None finally: self.lock.release() for m in msgs: @@ -491,13 +564,7 @@ class Channel (object): return at least one byte; C{False} otherwise. @rtype: boolean """ - self.lock.acquire() - try: - if len(self.in_buffer) == 0: - return False - return True - finally: - self.lock.release() + return self.in_buffer.read_ready() def recv(self, nbytes): """ @@ -514,38 +581,12 @@ class Channel (object): @raise socket.timeout: if no data is ready before the timeout set by L{settimeout}. """ - out = '' - self.lock.acquire() try: - if len(self.in_buffer) == 0: - if self.closed or self.eof_received: - return out - # should we block? - if self.timeout == 0.0: - raise socket.timeout() - # loop here in case we get woken up but a different thread has grabbed everything in the buffer - timeout = self.timeout - while (len(self.in_buffer) == 0) and not self.closed and not self.eof_received: - then = time.time() - self.in_buffer_cv.wait(timeout) - if timeout != None: - timeout -= time.time() - then - if timeout <= 0.0: - raise socket.timeout() - # something in the buffer and we have the lock - if len(self.in_buffer) <= nbytes: - out = self.in_buffer - self.in_buffer = '' - if self.pipe is not None: - # clear the pipe, since no more data is buffered - self.pipe.clear() - else: - out = self.in_buffer[:nbytes] - self.in_buffer = self.in_buffer[nbytes:] - ack = self._check_add_window(len(out)) - finally: - self.lock.release() + out = self.in_buffer.read(nbytes, self.timeout) + except PipeTimeout, e: + raise socket.timeout() + ack = self._check_add_window(len(out)) # no need to hold the channel lock when sending this if ack > 0: m = Message() @@ -569,13 +610,7 @@ class Channel (object): @since: 1.1 """ - self.lock.acquire() - try: - if len(self.in_stderr_buffer) == 0: - return False - return True - finally: - self.lock.release() + return self.in_stderr_buffer.read_ready() def recv_stderr(self, nbytes): """ @@ -596,36 +631,43 @@ class Channel (object): @since: 1.1 """ - out = '' + try: + out = self.in_stderr_buffer.read(nbytes, self.timeout) + except PipeTimeout, e: + raise socket.timeout() + + ack = self._check_add_window(len(out)) + # no need to hold the channel lock when sending this + if ack > 0: + m = Message() + m.add_byte(chr(MSG_CHANNEL_WINDOW_ADJUST)) + m.add_int(self.remote_chanid) + m.add_int(ack) + self.transport._send_user_message(m) + + return out + + def send_ready(self): + """ + 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 L{send} call will succeed immediately and return + the number of bytes actually written. + + @return: C{True} if a L{send} call on this channel would immediately + succeed or fail + @rtype: boolean + """ self.lock.acquire() try: - if len(self.in_stderr_buffer) == 0: - if self.closed or self.eof_received: - return out - # should we block? - if self.timeout == 0.0: - raise socket.timeout() - # loop here in case we get woken up but a different thread has grabbed everything in the buffer - timeout = self.timeout - while (len(self.in_stderr_buffer) == 0) and not self.closed and not self.eof_received: - then = time.time() - self.in_stderr_buffer_cv.wait(timeout) - if timeout != None: - timeout -= time.time() - then - if timeout <= 0.0: - raise socket.timeout() - # something in the buffer and we have the lock - if len(self.in_stderr_buffer) <= nbytes: - out = self.in_stderr_buffer - self.in_stderr_buffer = '' - else: - out = self.in_stderr_buffer[:nbytes] - self.in_stderr_buffer = self.in_stderr_buffer[nbytes:] - self._check_add_window(len(out)) + if self.closed or self.eof_sent: + return True + return self.out_window_size > 0 finally: self.lock.release() - return out - + def send(self, s): """ Send data to the channel. Returns the number of bytes sent, or 0 if @@ -634,9 +676,9 @@ class Channel (object): transmitted, the application needs to attempt delivery of the remaining data. - @param s: data to send. + @param s: data to send @type s: str - @return: number of bytes actually sent. + @return: number of bytes actually sent @rtype: int @raise socket.timeout: if no data could be sent before the timeout set @@ -653,9 +695,11 @@ class Channel (object): m.add_byte(chr(MSG_CHANNEL_DATA)) m.add_int(self.remote_chanid) m.add_string(s[:size]) - self.transport._send_user_message(m) finally: self.lock.release() + # Note: We release self.lock before calling _send_user_message. + # Otherwise, we can deadlock during re-keying. + self.transport._send_user_message(m) return size def send_stderr(self, s): @@ -689,9 +733,11 @@ class Channel (object): m.add_int(self.remote_chanid) m.add_int(1) m.add_string(s[:size]) - self.transport._send_user_message(m) finally: self.lock.release() + # Note: We release self.lock before calling _send_user_message. + # Otherwise, we can deadlock during re-keying. + self.transport._send_user_message(m) return size def sendall(self, s): @@ -776,14 +822,14 @@ class Channel (object): def fileno(self): """ Returns an OS-level file descriptor which can be used for polling, but - but I{not} for reading or writing). This is primaily to allow python's + but I{not} for reading or writing. This is primaily to allow python's C{select} module to work. The first time C{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 open hundreds or thousands of - channels simultaneously, but it's still notable. + (You won't notice this effect unless you have hundreds of channels + open at the same time.) @return: an OS-level file descriptor @rtype: int @@ -793,13 +839,14 @@ class Channel (object): """ self.lock.acquire() try: - if self.pipe is not None: - return self.pipe.fileno() + if self._pipe is not None: + return self._pipe.fileno() # create the pipe and feed in any existing data - self.pipe = pipe.make_pipe() - if len(self.in_buffer) > 0: - self.pipe.set() - return self.pipe.fileno() + self._pipe = pipe.make_pipe() + p1, p2 = pipe.make_or_pipe(self._pipe) + self.in_buffer.set_event(p1) + self.in_stderr_buffer.set_event(p2) + return self._pipe.fileno() finally: self.lock.release() @@ -856,7 +903,7 @@ class Channel (object): def _set_transport(self, transport): self.transport = transport - self.logger = util.get_logger(self.transport.get_log_channel() + '.' + self.name) + self.logger = util.get_logger(self.transport.get_log_channel()) def _set_window(self, window_size, max_packet_size): self.in_window_size = window_size @@ -869,7 +916,7 @@ class Channel (object): def _set_remote_channel(self, chanid, window_size, max_packet_size): self.remote_chanid = chanid self.out_window_size = window_size - self.out_max_packet_size = max(max_packet_size, self.MIN_PACKET_SIZE) + self.out_max_packet_size = max(max_packet_size, MIN_PACKET_SIZE) self.active = 1 self._log(DEBUG, 'Max packet out: %d bytes' % max_packet_size) @@ -894,16 +941,7 @@ class Channel (object): s = m else: s = m.get_string() - self.lock.acquire() - try: - if self.ultra_debug: - self._log(DEBUG, 'fed %d bytes' % len(s)) - if self.pipe is not None: - self.pipe.set() - self.in_buffer += s - self.in_buffer_cv.notifyAll() - finally: - self.lock.release() + self.in_buffer.feed(s) def _feed_extended(self, m): code = m.get_int() @@ -912,15 +950,9 @@ class Channel (object): self._log(ERROR, 'unknown extended_data type %d; discarding' % code) return if self.combine_stderr: - return self._feed(s) - self.lock.acquire() - try: - if self.ultra_debug: - self._log(DEBUG, 'fed %d stderr bytes' % len(s)) - self.in_stderr_buffer += s - self.in_stderr_buffer_cv.notifyAll() - finally: - self.lock.release() + self._feed(s) + else: + self.in_stderr_buffer.feed(s) def _window_adjust(self, m): nbytes = m.get_int() @@ -984,6 +1016,16 @@ class Channel (object): else: ok = server.check_channel_window_change_request(self, width, height, pixelwidth, pixelheight) + elif key == 'x11-req': + single_connection = m.get_boolean() + auth_proto = m.get_string() + auth_cookie = m.get_string() + screen_number = m.get_int() + if server is None: + ok = False + else: + ok = server.check_channel_x11_request(self, single_connection, + auth_proto, auth_cookie, screen_number) else: self._log(DEBUG, 'Unhandled channel request "%s"' % key) ok = False @@ -1001,13 +1043,13 @@ class Channel (object): try: if not self.eof_received: self.eof_received = True - self.in_buffer_cv.notifyAll() - self.in_stderr_buffer_cv.notifyAll() - if self.pipe is not None: - self.pipe.set_forever() + self.in_buffer.close() + self.in_stderr_buffer.close() + if self._pipe is not None: + self._pipe.set_forever() finally: self.lock.release() - self._log(DEBUG, 'EOF received') + self._log(DEBUG, 'EOF received (%s)', self._name) def _handle_close(self, m): self.lock.acquire() @@ -1024,17 +1066,29 @@ class Channel (object): ### internals... - def _log(self, level, msg): - self.logger.log(level, msg) + def _log(self, level, msg, *args): + self.logger.log(level, "[chan " + self._name + "] " + msg, *args) + + def _wait_for_event(self): + while True: + self.event.wait(0.1) + if self.event.isSet(): + return + if self.closed: + e = self.transport.get_exception() + if e is None: + e = SSHException('Channel closed.') + raise e + return def _set_closed(self): # you are holding the lock. self.closed = True - self.in_buffer_cv.notifyAll() - self.in_stderr_buffer_cv.notifyAll() + self.in_buffer.close() + self.in_stderr_buffer.close() self.out_buffer_cv.notifyAll() - if self.pipe is not None: - self.pipe.set_forever() + if self._pipe is not None: + self._pipe.set_forever() def _send_eof(self): # you are holding the lock. @@ -1044,7 +1098,7 @@ class Channel (object): m.add_byte(chr(MSG_CHANNEL_EOF)) m.add_int(self.remote_chanid) self.eof_sent = True - self._log(DEBUG, 'EOF sent') + self._log(DEBUG, 'EOF sent (%s)', self._name) return m def _close_internal(self): @@ -1072,19 +1126,22 @@ class Channel (object): self.lock.release() def _check_add_window(self, n): - # already holding the lock! - if self.closed or self.eof_received or not self.active: - return 0 - if self.ultra_debug: - self._log(DEBUG, 'addwindow %d' % n) - self.in_window_sofar += n - if self.in_window_sofar <= self.in_window_threshold: - return 0 - if self.ultra_debug: - self._log(DEBUG, 'addwindow send %d' % self.in_window_sofar) - out = self.in_window_sofar - self.in_window_sofar = 0 - return out + self.lock.acquire() + try: + if self.closed or self.eof_received or not self.active: + return 0 + if self.ultra_debug: + self._log(DEBUG, 'addwindow %d' % n) + self.in_window_sofar += n + if self.in_window_sofar <= self.in_window_threshold: + return 0 + if self.ultra_debug: + self._log(DEBUG, 'addwindow send %d' % self.in_window_sofar) + out = self.in_window_sofar + self.in_window_sofar = 0 + return out + finally: + self.lock.release() def _wait_for_send_window(self, size): """ @@ -1155,8 +1212,6 @@ class ChannelFile (BufferedFile): def _write(self, data): self.channel.sendall(data) return len(data) - - seek = BufferedFile.seek class ChannelStderrFile (ChannelFile): diff --git a/paramiko/client.py b/paramiko/client.py new file mode 100644 index 0000000..7870ea9 --- /dev/null +++ b/paramiko/client.py @@ -0,0 +1,474 @@ +# Copyright (C) 2006-2007 Robey Pointer +# +# 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{SSHClient}. +""" + +from binascii import hexlify +import getpass +import os +import socket +import warnings + +from paramiko.agent import Agent +from paramiko.common import * +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 + + +class MissingHostKeyPolicy (object): + """ + Interface for defining the policy that L{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 L{HostKeys} object (L{AutoAddPolicy}), + and for automatically rejecting the key (L{RejectPolicy}). + + This function may be used to ask the user to verify the key, for example. + """ + + def missing_host_key(self, client, hostname, key): + """ + Called when an L{SSHClient} receives a server key for a server that + isn't in either the system or local L{HostKeys} object. To accept + the key, simply return. To reject, raised an exception (which will + be passed to the calling application). + """ + pass + + +class AutoAddPolicy (MissingHostKeyPolicy): + """ + Policy for automatically adding the hostname and new host key to the + local L{HostKeys} object, and saving it. This is used by L{SSHClient}. + """ + + def missing_host_key(self, client, hostname, key): + client._host_keys.add(hostname, key.get_name(), key) + if client._host_keys_filename is not None: + client.save_host_keys(client._host_keys_filename) + client._log(DEBUG, 'Adding %s host key for %s: %s' % + (key.get_name(), hostname, hexlify(key.get_fingerprint()))) + + +class RejectPolicy (MissingHostKeyPolicy): + """ + Policy for automatically rejecting the unknown hostname & key. This is + used by L{SSHClient}. + """ + + 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) + + +class WarningPolicy (MissingHostKeyPolicy): + """ + Policy for logging a python-style warning for an unknown host key, but + accepting it. This is used by L{SSHClient}. + """ + def missing_host_key(self, client, hostname, key): + warnings.warn('Unknown %s host key for %s: %s' % + (key.get_name(), hostname, hexlify(key.get_fingerprint()))) + + +class SSHClient (object): + """ + A high-level representation of a session with an SSH server. This class + wraps L{Transport}, L{Channel}, and L{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 + """ + + def __init__(self): + """ + Create a new SSHClient. + """ + self._system_host_keys = HostKeys() + self._host_keys = HostKeys() + self._host_keys_filename = None + self._log_channel = None + self._policy = RejectPolicy() + self._transport = None + + def load_system_host_keys(self, filename=None): + """ + Load host keys from a system (read-only) file. Host keys read with + this method will not be saved back by L{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 C{filename} is left as C{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. + + @param filename: the filename to read, or C{None} + @type filename: str + + @raise IOError: if a filename was provided and the file could not be + read + """ + if filename is None: + # try the user's .ssh key file, and mask exceptions + filename = os.path.expanduser('~/.ssh/known_hosts') + try: + self._system_host_keys.load(filename) + except IOError: + pass + return + self._system_host_keys.load(filename) + + def load_host_keys(self, filename): + """ + Load host keys from a local host-key file. Host keys read with this + method will be checked I{after} keys loaded via L{load_system_host_keys}, + but will be saved back by L{save_host_keys} (so they can be modified). + The missing host key policy L{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. + + @param filename: the filename to read + @type filename: str + + @raise IOError: if the filename could not be read + """ + self._host_keys_filename = filename + self._host_keys.load(filename) + + def save_host_keys(self, filename): + """ + Save the host keys back to a file. Only the host keys loaded with + L{load_host_keys} (plus any added directly) will be saved -- not any + host keys loaded with L{load_system_host_keys}. + + @param filename: the filename to save to + @type filename: str + + @raise IOError: if the file could not be written + """ + f = open(filename, 'w') + f.write('# SSH host keys collected by paramiko\n') + for hostname, keys in self._host_keys.iteritems(): + for keytype, key in keys.iteritems(): + f.write('%s %s %s\n' % (hostname, keytype, key.get_base64())) + f.close() + + def get_host_keys(self): + """ + Get the local L{HostKeys} object. This can be used to examine the + local host keys or change them. + + @return: the local host keys + @rtype: L{HostKeys} + """ + return self._host_keys + + def set_log_channel(self, name): + """ + Set the channel for logging. The default is C{"paramiko.transport"} + but it can be set to anything you want. + + @param name: new channel name for logging + @type name: str + """ + self._log_channel = name + + def 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 L{HostKeys} objects. The + default policy is to reject all unknown servers (using L{RejectPolicy}). + You may substitute L{AutoAddPolicy} or write your own policy class. + + @param policy: the policy to use when receiving a host key from a + previously-unknown server + @type policy: L{MissingHostKeyPolicy} + """ + self._policy = policy + + def connect(self, hostname, port=22, username=None, password=None, pkey=None, + key_filename=None, timeout=None, allow_agent=True, look_for_keys=True): + """ + 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}) + and any local host keys (L{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 L{set_missing_host_key_policy}). The default policy is + to reject the key and raise an L{SSHException}. + + Authentication is attempted in the following order of priority: + + - The C{pkey} or C{key_filename} passed in (if any) + - Any key we can find through an SSH agent + - Any "id_rsa" or "id_dsa" key discoverable in C{~/.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. + + @param hostname: the server to connect to + @type hostname: str + @param port: the server port to connect to + @type port: int + @param username: the username to authenticate as (defaults to the + current local username) + @type username: str + @param password: a password to use for authentication or for unlocking + a private key + @type password: str + @param pkey: an optional private key to use for authentication + @type pkey: L{PKey} + @param key_filename: the filename, or list of filenames, of optional + private key(s) to try for authentication + @type key_filename: str or list(str) + @param timeout: an optional timeout (in seconds) for the TCP connect + @type timeout: float + @param allow_agent: set to False to disable connecting to the SSH agent + @type allow_agent: bool + @param look_for_keys: set to False to disable searching for discoverable + private key files in C{~/.ssh/} + @type look_for_keys: bool + + @raise BadHostKeyException: if the server's host key could not be + verified + @raise AuthenticationException: if authentication failed + @raise SSHException: if there was any other error connecting or + establishing an SSH session + @raise socket.error: if a socket error occurred while connecting + """ + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + if timeout is not None: + try: + sock.settimeout(timeout) + except: + pass + + sock.connect((hostname, port)) + t = self._transport = Transport(sock) + + if self._log_channel is not None: + t.set_log_channel(self._log_channel) + t.start_client() + ResourceManager.register(self, t) + + server_key = t.get_remote_server_key() + keytype = server_key.get_name() + + our_server_key = self._system_host_keys.get(hostname, {}).get(keytype, None) + if our_server_key is None: + our_server_key = self._host_keys.get(hostname, {}).get(keytype, None) + if our_server_key is None: + # will raise exception if the key is rejected; let that fall out + self._policy.missing_host_key(self, hostname, server_key) + # if the callback returns, assume the key is ok + our_server_key = server_key + + if server_key != our_server_key: + raise BadHostKeyException(hostname, server_key, our_server_key) + + if username is None: + username = getpass.getuser() + + if key_filename is None: + key_filenames = [] + elif isinstance(key_filename, (str, unicode)): + key_filenames = [ key_filename ] + else: + key_filenames = key_filename + self._auth(username, password, pkey, key_filenames, allow_agent, look_for_keys) + + def close(self): + """ + Close this SSHClient and its underlying L{Transport}. + """ + if self._transport is None: + return + self._transport.close() + self._transport = None + + def exec_command(self, command, bufsize=-1): + """ + 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 + streams are returned as python C{file}-like objects representing + stdin, stdout, and stderr. + + @param command: the command to execute + @type command: str + @param bufsize: interpreted the same way as by the built-in C{file()} function in python + @type bufsize: 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() + 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): + """ + Start an interactive shell session on the SSH server. A new L{Channel} + is opened and connected to a pseudo-terminal using the requested + terminal type and size. + + @param term: the terminal type to emulate (for example, C{"vt100"}) + @type term: str + @param width: the width (in characters) of the terminal window + @type width: int + @param height: the height (in characters) of the terminal window + @type height: 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.invoke_shell() + return chan + + def open_sftp(self): + """ + Open an SFTP session on the SSH server. + + @return: a new SFTP session object + @rtype: L{SFTPClient} + """ + return self._transport.open_sftp_client() + + def get_transport(self): + """ + Return the underlying L{Transport} object for this SSH connection. + This can be used to perform lower-level tasks, like opening specific + kinds of channels. + + @return: the Transport for this connection + @rtype: L{Transport} + """ + return self._transport + + def _auth(self, username, password, pkey, key_filenames, allow_agent, look_for_keys): + """ + Try, in order: + + - The key passed in, if one was passed in. + - Any key we can find through an SSH agent (if allowed). + - 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.) + """ + saved_exception = None + + if pkey is not None: + try: + self._log(DEBUG, 'Trying SSH key %s' % hexlify(pkey.get_fingerprint())) + self._transport.auth_publickey(username, pkey) + 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: + for key in Agent().get_keys(): + try: + self._log(DEBUG, 'Trying SSH agent key %s' % hexlify(key.get_fingerprint())) + self._transport.auth_publickey(username, key) + return + 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: + 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 + + if password is not None: + try: + self._transport.auth_password(username, password) + return + except SSHException, e: + saved_exception = e + + # if we got an auth-failed exception earlier, re-raise it + if saved_exception is not None: + raise saved_exception + raise SSHException('No authentication methods available') + + def _log(self, level, msg): + self._transport._log(level, msg) + diff --git a/paramiko/common.py b/paramiko/common.py index c5999e6..f4a4d81 100644 --- a/paramiko/common.py +++ b/paramiko/common.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -21,7 +21,7 @@ Common constants and global variables. """ MSG_DISCONNECT, MSG_IGNORE, MSG_UNIMPLEMENTED, MSG_DEBUG, MSG_SERVICE_REQUEST, \ - MSG_SERVICE_ACCEPT = range(1, 7) + MSG_SERVICE_ACCEPT = range(1, 7) MSG_KEXINIT, MSG_NEWKEYS = range(20, 22) MSG_USERAUTH_REQUEST, MSG_USERAUTH_FAILURE, MSG_USERAUTH_SUCCESS, \ MSG_USERAUTH_BANNER = range(50, 54) @@ -29,9 +29,9 @@ MSG_USERAUTH_PK_OK = 60 MSG_USERAUTH_INFO_REQUEST, MSG_USERAUTH_INFO_RESPONSE = range(60, 62) MSG_GLOBAL_REQUEST, MSG_REQUEST_SUCCESS, MSG_REQUEST_FAILURE = range(80, 83) MSG_CHANNEL_OPEN, MSG_CHANNEL_OPEN_SUCCESS, MSG_CHANNEL_OPEN_FAILURE, \ - MSG_CHANNEL_WINDOW_ADJUST, MSG_CHANNEL_DATA, MSG_CHANNEL_EXTENDED_DATA, \ - MSG_CHANNEL_EOF, MSG_CHANNEL_CLOSE, MSG_CHANNEL_REQUEST, \ - MSG_CHANNEL_SUCCESS, MSG_CHANNEL_FAILURE = range(90, 101) + MSG_CHANNEL_WINDOW_ADJUST, MSG_CHANNEL_DATA, MSG_CHANNEL_EXTENDED_DATA, \ + MSG_CHANNEL_EOF, MSG_CHANNEL_CLOSE, MSG_CHANNEL_REQUEST, \ + MSG_CHANNEL_SUCCESS, MSG_CHANNEL_FAILURE = range(90, 101) # for debugging: @@ -95,21 +95,10 @@ CONNECTION_FAILED_CODE = { DISCONNECT_SERVICE_NOT_AVAILABLE, DISCONNECT_AUTH_CANCELLED_BY_USER, \ DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 7, 13, 14 - -from Crypto.Util.randpool import PersistentRandomPool, RandomPool +from rng import StrongLockingRandomPool # keep a crypto-strong PRNG nearby -try: - randpool = PersistentRandomPool(os.path.join(os.path.expanduser('~'), '/.randpool')) -except: - # the above will likely fail on Windows - fall back to non-persistent random pool - randpool = RandomPool() - -try: - randpool.randomize() -except: - # earlier versions of pyCrypto (pre-2.0) don't have randomize() - pass +randpool = StrongLockingRandomPool() import sys if sys.version_info < (2, 3): @@ -129,6 +118,7 @@ else: import logging PY22 = False + DEBUG = logging.DEBUG INFO = logging.INFO WARNING = logging.WARNING diff --git a/paramiko/compress.py b/paramiko/compress.py index bdf4b42..08fffb1 100644 --- a/paramiko/compress.py +++ b/paramiko/compress.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # diff --git a/paramiko/config.py b/paramiko/config.py new file mode 100644 index 0000000..1e3d680 --- /dev/null +++ b/paramiko/config.py @@ -0,0 +1,105 @@ +# Copyright (C) 2006-2007 Robey Pointer +# +# 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{SSHConfig}. +""" + +import fnmatch + + +class SSHConfig (object): + """ + Representation of config information as stored in the format used by + OpenSSH. Queries can be made via L{lookup}. The format is described in + OpenSSH's C{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 + """ + + def __init__(self): + """ + Create a new OpenSSH config object. + """ + self._config = [ { 'host': '*' } ] + + def parse(self, file_obj): + """ + Read an OpenSSH config from the given file object. + + @param file_obj: a file-like object to read the config file from + @type file_obj: file + """ + config = self._config[0] + 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() + else: + # find first whitespace, and split there + i = 0 + while (i < len(line)) and not line[i].isspace(): + i += 1 + if i == len(line): + raise Exception('Unparsable line: %r' % line) + key = line[:i].lower() + value = line[i:].lstrip() + + if key == 'host': + # do we have a pre-existing host config to append to? + matches = [c for c in self._config if c['host'] == value] + if len(matches) > 0: + config = matches[0] + else: + config = { 'host': value } + self._config.append(config) + else: + config[key] = value + + def lookup(self, hostname): + """ + Return a dict of config options for a given hostname. + + The host-matching rules of OpenSSH's C{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 C{"Port"} is set under C{"Host *"} + and also C{"Host *.example.com"}, and the lookup is for + C{"ssh.example.com"}, then the port entry for C{"Host *.example.com"} + 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. + + @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']))) + ret = {} + for m in matches: + ret.update(m) + del ret['host'] + return ret diff --git a/paramiko/dsskey.py b/paramiko/dsskey.py index 2b31372..9f381d2 100644 --- a/paramiko/dsskey.py +++ b/paramiko/dsskey.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -37,7 +37,15 @@ class DSSKey (PKey): data. """ - def __init__(self, msg=None, data=None, filename=None, password=None, vals=None): + def __init__(self, msg=None, data=None, filename=None, password=None, vals=None, file_obj=None): + self.p = None + self.q = None + self.g = None + self.y = None + self.x = None + if file_obj is not None: + self._from_private_key(file_obj, password) + return if filename is not None: self._from_private_key_file(filename, password) return @@ -81,7 +89,7 @@ class DSSKey (PKey): return self.size def can_sign(self): - return hasattr(self, 'x') + return self.x is not None def sign_ssh_data(self, rpool, data): digest = SHA.new(data).digest() @@ -123,14 +131,22 @@ class DSSKey (PKey): dss = DSA.construct((long(self.y), long(self.g), long(self.p), long(self.q))) return dss.verify(sigM, (sigR, sigS)) - def write_private_key_file(self, filename, password=None): + def _encode_key(self): + if self.x is None: + raise SSHException('Not enough key information') keylist = [ 0, self.p, self.q, self.g, self.y, self.x ] try: b = BER() b.encode(keylist) except BERException: raise SSHException('Unable to create ber encoding of key') - self._write_private_key_file('DSA', filename, str(b), password) + return str(b) + + def write_private_key_file(self, filename, password=None): + self._write_private_key_file('DSA', filename, self._encode_key(), password) + + def write_private_key(self, file_obj, password=None): + self._write_private_key('DSA', file_obj, self._encode_key(), password) def generate(bits=1024, progress_func=None): """ @@ -144,8 +160,6 @@ class DSSKey (PKey): @type progress_func: function @return: new private key @rtype: L{DSSKey} - - @since: fearow """ randpool.stir() dsa = DSA.generate(bits, randpool.get_bytes, progress_func) @@ -159,9 +173,16 @@ class DSSKey (PKey): def _from_private_key_file(self, filename, password): + data = self._read_private_key_file('DSA', filename, password) + self._decode_key(data) + + def _from_private_key(self, file_obj, password): + data = self._read_private_key('DSA', file_obj, password) + self._decode_key(data) + + def _decode_key(self, data): # private key file contains: # DSAPrivateKey = { version = 0, p, q, g, y, x } - data = self._read_private_key_file('DSA', filename, password) try: keylist = BER(data).decode() except BERException, x: diff --git a/paramiko/file.py b/paramiko/file.py index c29e7c4..7db4401 100644 --- a/paramiko/file.py +++ b/paramiko/file.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -23,15 +23,6 @@ BufferedFile. from cStringIO import StringIO -_FLAG_READ = 0x1 -_FLAG_WRITE = 0x2 -_FLAG_APPEND = 0x4 -_FLAG_BINARY = 0x10 -_FLAG_BUFFERED = 0x20 -_FLAG_LINE_BUFFERED = 0x40 -_FLAG_UNIVERSAL_NEWLINE = 0x80 - - class BufferedFile (object): """ Reusable base class to implement python-style file buffering around a @@ -44,7 +35,16 @@ class BufferedFile (object): SEEK_CUR = 1 SEEK_END = 2 + FLAG_READ = 0x1 + FLAG_WRITE = 0x2 + FLAG_APPEND = 0x4 + FLAG_BINARY = 0x10 + FLAG_BUFFERED = 0x20 + FLAG_LINE_BUFFERED = 0x40 + FLAG_UNIVERSAL_NEWLINE = 0x80 + def __init__(self): + self.newlines = None self._flags = 0 self._bufsize = self._DEFAULT_BUFSIZE self._wbuffer = StringIO() @@ -55,6 +55,8 @@ class BufferedFile (object): # realpos - position according the OS # (these may be different because we buffer for line reading) self._pos = self._realpos = 0 + # size only matters for seekable files + self._size = 0 def __del__(self): self.close() @@ -112,16 +114,16 @@ class BufferedFile (object): file first). If the C{size} argument is negative or omitted, read all the remaining data in the file. - @param size: maximum number of bytes to read. + @param size: maximum number of bytes to read @type size: int @return: data read from the file, or an empty string if EOF was - encountered immediately. + encountered immediately @rtype: str """ if self._closed: raise IOError('File is closed') - if not (self._flags & _FLAG_READ): - raise IOError('File not open for reading') + if not (self._flags & self.FLAG_READ): + raise IOError('File is not open for reading') if (size is None) or (size < 0): # go for broke result = self._rbuffer @@ -144,8 +146,11 @@ class BufferedFile (object): self._pos += len(result) return result while len(self._rbuffer) < size: + read_size = size - len(self._rbuffer) + if self._flags & self.FLAG_BUFFERED: + read_size = max(self._bufsize, read_size) try: - new_data = self._read(max(self._bufsize, size - len(self._rbuffer))) + new_data = self._read(read_size) except EOFError: new_data = None if (new_data is None) or (len(new_data) == 0): @@ -178,11 +183,11 @@ class BufferedFile (object): # it's almost silly how complex this function is. if self._closed: raise IOError('File is closed') - if not (self._flags & _FLAG_READ): + if not (self._flags & self.FLAG_READ): raise IOError('File not open for reading') line = self._rbuffer while True: - if self._at_trailing_cr and (self._flags & _FLAG_UNIVERSAL_NEWLINE) and (len(line) > 0): + if self._at_trailing_cr and (self._flags & self.FLAG_UNIVERSAL_NEWLINE) and (len(line) > 0): # edge case: the newline may be '\r\n' and we may have read # only the first '\r' last time. if line[0] == '\n': @@ -202,8 +207,8 @@ class BufferedFile (object): return line n = size - len(line) else: - n = self._DEFAULT_BUFSIZE - if ('\n' in line) or ((self._flags & _FLAG_UNIVERSAL_NEWLINE) and ('\r' in line)): + n = self._bufsize + if ('\n' in line) or ((self._flags & self.FLAG_UNIVERSAL_NEWLINE) and ('\r' in line)): break try: new_data = self._read(n) @@ -217,7 +222,7 @@ class BufferedFile (object): self._realpos += len(new_data) # find the newline pos = line.find('\n') - if self._flags & _FLAG_UNIVERSAL_NEWLINE: + if self._flags & self.FLAG_UNIVERSAL_NEWLINE: rpos = line.find('\r') if (rpos >= 0) and ((rpos < pos) or (pos < 0)): pos = rpos @@ -250,7 +255,7 @@ class BufferedFile (object): """ lines = [] bytes = 0 - while 1: + while True: line = self.readline() if len(line) == 0: break @@ -303,13 +308,13 @@ class BufferedFile (object): """ if self._closed: raise IOError('File is closed') - if not (self._flags & _FLAG_WRITE): + if not (self._flags & self.FLAG_WRITE): raise IOError('File not open for writing') - if not (self._flags & _FLAG_BUFFERED): + if not (self._flags & self.FLAG_BUFFERED): self._write_all(data) return self._wbuffer.write(data) - if self._flags & _FLAG_LINE_BUFFERED: + if self._flags & self.FLAG_LINE_BUFFERED: # only scan the new data for linefeed, to avoid wasting time. last_newline_pos = data.rfind('\n') if last_newline_pos >= 0: @@ -387,26 +392,37 @@ class BufferedFile (object): """ Subclasses call this method to initialize the BufferedFile. """ + # set bufsize in any event, because it's used for readline(). + self._bufsize = self._DEFAULT_BUFSIZE + if bufsize < 0: + # do no buffering by default, because otherwise writes will get + # buffered in a way that will probably confuse people. + bufsize = 0 if bufsize == 1: # apparently, line buffering only affects writes. reads are only # buffered if you call readline (directly or indirectly: iterating # over a file will indirectly call readline). - self._flags |= _FLAG_BUFFERED | _FLAG_LINE_BUFFERED + self._flags |= self.FLAG_BUFFERED | self.FLAG_LINE_BUFFERED elif bufsize > 1: self._bufsize = bufsize - self._flags |= _FLAG_BUFFERED + self._flags |= self.FLAG_BUFFERED + self._flags &= ~self.FLAG_LINE_BUFFERED + elif bufsize == 0: + # unbuffered + self._flags &= ~(self.FLAG_BUFFERED | self.FLAG_LINE_BUFFERED) + if ('r' in mode) or ('+' in mode): - self._flags |= _FLAG_READ + self._flags |= self.FLAG_READ if ('w' in mode) or ('+' in mode): - self._flags |= _FLAG_WRITE + self._flags |= self.FLAG_WRITE if ('a' in mode): - self._flags |= _FLAG_WRITE | _FLAG_APPEND + self._flags |= self.FLAG_WRITE | self.FLAG_APPEND self._size = self._get_size() self._pos = self._realpos = self._size if ('b' in mode): - self._flags |= _FLAG_BINARY + self._flags |= self.FLAG_BINARY if ('U' in mode): - self._flags |= _FLAG_UNIVERSAL_NEWLINE + self._flags |= self.FLAG_UNIVERSAL_NEWLINE # built-in file objects have this attribute to store which kinds of # line terminations they've seen: # @@ -418,7 +434,7 @@ class BufferedFile (object): while len(data) > 0: count = self._write(data) data = data[count:] - if self._flags & _FLAG_APPEND: + if self._flags & self.FLAG_APPEND: self._size += count self._pos = self._realpos = self._size else: @@ -430,7 +446,7 @@ class BufferedFile (object): # silliness about tracking what kinds of newlines we've seen. # i don't understand why it can be None, a string, or a tuple, instead # of just always being a tuple, but we'll emulate that behavior anyway. - if not (self._flags & _FLAG_UNIVERSAL_NEWLINE): + if not (self._flags & self.FLAG_UNIVERSAL_NEWLINE): return if self.newlines is None: self.newlines = newline diff --git a/paramiko/hostkeys.py b/paramiko/hostkeys.py new file mode 100644 index 0000000..0c0ac8c --- /dev/null +++ b/paramiko/hostkeys.py @@ -0,0 +1,315 @@ +# Copyright (C) 2006-2007 Robey Pointer +# +# 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{HostKeys} +""" + +import base64 +from Crypto.Hash import SHA, HMAC +import UserDict + +from paramiko.common import * +from paramiko.dsskey import DSSKey +from paramiko.rsakey import RSAKey + + +class HostKeyEntry: + """ + Representation of a line in an OpenSSH-style "known hosts" file. + """ + + def __init__(self, hostnames=None, key=None): + self.valid = (hostnames is not None) and (key is not None) + self.hostnames = hostnames + self.key = key + + def 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. 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. + + @param line: a line from an OpenSSH known_hosts file + @type line: str + """ + fields = line.split(' ') + if len(fields) != 3: + # Bad number of fields + return None + + names, keytype, key = fields + names = names.split(',') + + # 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 + + return cls(names, key) + from_line = classmethod(from_line) + + def to_line(self): + """ + 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. + """ + if self.valid: + return '%s %s %s\n' % (','.join(self.hostnames), self.key.get_name(), + self.key.get_base64()) + return None + + def __repr__(self): + return '' % (self.hostnames, self.key) + + +class HostKeys (UserDict.DictMixin): + """ + 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 L{lookup}. + + @since: 1.5.3 + """ + + def __init__(self, filename=None): + """ + Create a new HostKeys object, optionally loading keys from an openssh + style host-key file. + + @param filename: filename to load host keys from, or C{None} + @type filename: str + """ + # emulate a dict of { hostname: { keytype: PKey } } + self._entries = [] + if filename is not None: + self.load(filename) + + def add(self, hostname, keytype, key): + """ + Add a host key entry to the table. Any existing entry for a + C{(hostname, keytype)} pair will be replaced. + + @param hostname: the hostname (or IP) to add + @type hostname: str + @param keytype: key type (C{"ssh-rsa"} or C{"ssh-dss"}) + @type keytype: str + @param key: the key to add + @type key: L{PKey} + """ + for e in self._entries: + if (hostname in e.hostnames) and (e.key.get_name() == keytype): + e.key = key + return + self._entries.append(HostKeyEntry([hostname], key)) + + def load(self, filename): + """ + 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 + C{os.path.expanduser("~/.ssh/known_hosts")}. + + If this method is called multiple times, the host keys are merged, + not cleared. So multiple calls to C{load} will just call L{add}, + replacing any existing entries and adding new ones. + + @param filename: name of the file to read host keys from + @type filename: str + + @raise IOError: if there was an error reading the file + """ + f = open(filename, 'r') + for line in f: + line = line.strip() + if (len(line) == 0) or (line[0] == '#'): + continue + e = HostKeyEntry.from_line(line) + if e is not None: + self._entries.append(e) + f.close() + + def save(self, filename): + """ + 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. + + @param filename: name of the file to write + @type filename: str + + @raise IOError: if there was an error writing the file + + @since: 1.6.1 + """ + f = open(filename, 'w') + for e in self._entries: + line = e.to_line() + if line: + f.write(line) + f.close() + + def lookup(self, hostname): + """ + Find a hostkey entry for a given hostname or IP. If no entry is found, + C{None} is returned. Otherwise a dictionary of keytype to key is + returned. The keytype will be either C{"ssh-rsa"} or C{"ssh-dss"}. + + @param hostname: the hostname (or IP) to lookup + @type hostname: str + @return: keys associated with this host (or C{None}) + @rtype: dict(str, L{PKey}) + """ + class SubDict (UserDict.DictMixin): + def __init__(self, hostname, entries, hostkeys): + self._hostname = hostname + self._entries = entries + self._hostkeys = hostkeys + + def __getitem__(self, key): + for e in self._entries: + if e.key.get_name() == key: + return e.key + raise KeyError(key) + + def __setitem__(self, key, val): + for e in self._entries: + if e.key is None: + continue + if e.key.get_name() == key: + # replace + e.key = val + break + else: + # add a new one + e = HostKeyEntry([hostname], val) + self._entries.append(e) + self._hostkeys._entries.append(e) + + def keys(self): + return [e.key.get_name() for e in self._entries if e.key is not None] + + entries = [] + for e in self._entries: + for h in e.hostnames: + if (h.startswith('|1|') and (self.hash_host(hostname, h) == h)) or (h == hostname): + entries.append(e) + if len(entries) == 0: + return None + return SubDict(hostname, entries, self) + + def check(self, hostname, key): + """ + Return True if the given key is associated with the given hostname + in this dictionary. + + @param hostname: hostname (or IP) of the SSH server + @type hostname: str + @param key: the key to check + @type key: L{PKey} + @return: C{True} if the key is associated with the hostname; C{False} + if not + @rtype: bool + """ + k = self.lookup(hostname) + if k is None: + return False + host_key = k.get(key.get_name(), None) + if host_key is None: + return False + return str(host_key) == str(key) + + def clear(self): + """ + Remove all host keys from the dictionary. + """ + self._entries = [] + + def __getitem__(self, key): + ret = self.lookup(key) + if ret is None: + raise KeyError(key) + return ret + + def __setitem__(self, hostname, entry): + # don't use this please. + if len(entry) == 0: + self._entries.append(HostKeyEntry([hostname], None)) + return + for key_type in entry.keys(): + found = False + for e in self._entries: + if (hostname in e.hostnames) and (e.key.get_name() == key_type): + # replace + e.key = entry[key_type] + found = True + if not found: + self._entries.append(HostKeyEntry([hostname], entry[key_type])) + + def keys(self): + # python 2.4 sets would be nice here. + ret = [] + for e in self._entries: + for h in e.hostnames: + if h not in ret: + ret.append(h) + return ret + + def values(self): + ret = [] + for k in self.keys(): + ret.append(self.lookup(k)) + return ret + + def 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. + + @param hostname: the hostname to hash + @type hostname: str + @param salt: optional salt to use when hashing (must be 20 bytes long) + @type salt: str + @return: the hashed hostname + @rtype: str + """ + if salt is None: + salt = randpool.get_bytes(SHA.digest_size) + else: + if salt.startswith('|1|'): + salt = salt.split('|')[2] + salt = base64.decodestring(salt) + assert len(salt) == SHA.digest_size + hmac = HMAC.HMAC(salt, hostname, SHA).digest() + hostkey = '|1|%s|%s' % (base64.encodestring(salt), base64.encodestring(hmac)) + return hostkey.replace('\n', '') + hash_host = staticmethod(hash_host) + diff --git a/paramiko/kex_gex.py b/paramiko/kex_gex.py index 994d76c..63a0c99 100644 --- a/paramiko/kex_gex.py +++ b/paramiko/kex_gex.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -31,7 +31,8 @@ from paramiko.message import Message from paramiko.ssh_exception import SSHException -_MSG_KEXDH_GEX_GROUP, _MSG_KEXDH_GEX_INIT, _MSG_KEXDH_GEX_REPLY, _MSG_KEXDH_GEX_REQUEST = range(31, 35) +_MSG_KEXDH_GEX_REQUEST_OLD, _MSG_KEXDH_GEX_GROUP, _MSG_KEXDH_GEX_INIT, \ + _MSG_KEXDH_GEX_REPLY, _MSG_KEXDH_GEX_REQUEST = range(30, 35) class KexGex (object): @@ -43,19 +44,32 @@ class KexGex (object): def __init__(self, transport): self.transport = transport - - def start_kex(self): + self.p = None + self.q = None + self.g = None + self.x = None + self.e = None + self.f = None + self.old_style = False + + def start_kex(self, _test_old_style=False): if self.transport.server_mode: - self.transport._expect_packet(_MSG_KEXDH_GEX_REQUEST) + self.transport._expect_packet(_MSG_KEXDH_GEX_REQUEST, _MSG_KEXDH_GEX_REQUEST_OLD) return # request a bit range: we accept (min_bits) to (max_bits), but prefer # (preferred_bits). according to the spec, we shouldn't pull the # minimum up above 1024. m = Message() - m.add_byte(chr(_MSG_KEXDH_GEX_REQUEST)) - m.add_int(self.min_bits) - m.add_int(self.preferred_bits) - m.add_int(self.max_bits) + if _test_old_style: + # only used for unit tests: we shouldn't ever send this + m.add_byte(chr(_MSG_KEXDH_GEX_REQUEST_OLD)) + m.add_int(self.preferred_bits) + self.old_style = True + else: + m.add_byte(chr(_MSG_KEXDH_GEX_REQUEST)) + m.add_int(self.min_bits) + m.add_int(self.preferred_bits) + m.add_int(self.max_bits) self.transport._send_message(m) self.transport._expect_packet(_MSG_KEXDH_GEX_GROUP) @@ -68,6 +82,8 @@ class KexGex (object): return self._parse_kexdh_gex_init(m) elif ptype == _MSG_KEXDH_GEX_REPLY: return self._parse_kexdh_gex_reply(m) + elif ptype == _MSG_KEXDH_GEX_REQUEST_OLD: + return self._parse_kexdh_gex_request_old(m) raise SSHException('KexGex asked to handle packet type %d' % ptype) @@ -126,6 +142,28 @@ class KexGex (object): self.transport._send_message(m) self.transport._expect_packet(_MSG_KEXDH_GEX_INIT) + def _parse_kexdh_gex_request_old(self, m): + # same as above, but without min_bits or max_bits (used by older clients like putty) + self.preferred_bits = m.get_int() + # smoosh the user's preferred size into our own limits + if self.preferred_bits > self.max_bits: + self.preferred_bits = self.max_bits + if self.preferred_bits < self.min_bits: + self.preferred_bits = self.min_bits + # generate prime + pack = self.transport._get_modulus_pack() + if pack is None: + raise SSHException('Can\'t do server-side gex with no modulus pack') + self.transport._log(DEBUG, 'Picking p (~ %d bits)' % (self.preferred_bits,)) + self.g, self.p = pack.get_modulus(self.min_bits, self.preferred_bits, self.max_bits) + m = Message() + m.add_byte(chr(_MSG_KEXDH_GEX_GROUP)) + m.add_mpint(self.p) + m.add_mpint(self.g) + self.transport._send_message(m) + self.transport._expect_packet(_MSG_KEXDH_GEX_INIT) + self.old_style = True + def _parse_kexdh_gex_group(self, m): self.p = m.get_mpint() self.g = m.get_mpint() @@ -156,9 +194,11 @@ class KexGex (object): hm.add(self.transport.remote_version, self.transport.local_version, self.transport.remote_kex_init, self.transport.local_kex_init, key) - hm.add_int(self.min_bits) + if not self.old_style: + hm.add_int(self.min_bits) hm.add_int(self.preferred_bits) - hm.add_int(self.max_bits) + if not self.old_style: + hm.add_int(self.max_bits) hm.add_mpint(self.p) hm.add_mpint(self.g) hm.add_mpint(self.e) @@ -189,9 +229,11 @@ class KexGex (object): hm.add(self.transport.local_version, self.transport.remote_version, self.transport.local_kex_init, self.transport.remote_kex_init, host_key) - hm.add_int(self.min_bits) + if not self.old_style: + hm.add_int(self.min_bits) hm.add_int(self.preferred_bits) - hm.add_int(self.max_bits) + if not self.old_style: + hm.add_int(self.max_bits) hm.add_mpint(self.p) hm.add_mpint(self.g) hm.add_mpint(self.e) diff --git a/paramiko/kex_group1.py b/paramiko/kex_group1.py index a13cf3a..843a6d8 100644 --- a/paramiko/kex_group1.py +++ b/paramiko/kex_group1.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # diff --git a/paramiko/logging22.py b/paramiko/logging22.py index ac11a73..9bf7656 100644 --- a/paramiko/logging22.py +++ b/paramiko/logging22.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # diff --git a/paramiko/message.py b/paramiko/message.py index 1d75a01..1a5151c 100644 --- a/paramiko/message.py +++ b/paramiko/message.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -285,7 +285,7 @@ class Message (object): elif type(i) is list: return self.add_list(i) else: - raise exception('Unknown type') + raise Exception('Unknown type') def add(self, *seq): """ diff --git a/paramiko/packet.py b/paramiko/packet.py index 277d68e..4bde2f7 100644 --- a/paramiko/packet.py +++ b/paramiko/packet.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -20,12 +20,12 @@ Packetizer. """ +import errno import select import socket import struct import threading import time -from Crypto.Hash import HMAC from paramiko.common import * from paramiko import util @@ -33,6 +33,19 @@ from paramiko.ssh_exception import SSHException from paramiko.message import Message +got_r_hmac = False +try: + import r_hmac + got_r_hmac = True +except ImportError: + pass +def compute_hmac(key, message, digest_class): + if got_r_hmac: + return r_hmac.HMAC(key, message, digest_class).digest() + from Crypto.Hash import HMAC + return HMAC.HMAC(key, message, digest_class).digest() + + class NeedRekeyException (Exception): pass @@ -54,6 +67,7 @@ class Packetizer (object): self.__dump_packets = False self.__need_rekey = False self.__init_count = 0 + self.__remainder = '' # used for noticing when to re-key: self.__sent_bytes = 0 @@ -86,13 +100,6 @@ class Packetizer (object): self.__keepalive_last = time.time() self.__keepalive_callback = None - def __del__(self): - # this is not guaranteed to be called, but we should try. - try: - self.__socket.close() - except: - pass - def set_log(self, log): """ Set the python log object to use for logging. @@ -142,6 +149,7 @@ class Packetizer (object): def close(self): self.__closed = True + self.__socket.close() def set_hexdump(self, hexdump): self.__dump_packets = hexdump @@ -186,10 +194,16 @@ class Packetizer (object): @raise EOFError: if the socket was closed before all the bytes could be read """ - if PY22: - return self._py22_read_all(n) out = '' + # handle over-reading from reading the banner line + if len(self.__remainder) > 0: + out = self.__remainder[:n] + self.__remainder = self.__remainder[n:] + n -= len(out) + if PY22: + return self._py22_read_all(n, out) while n > 0: + got_timeout = False try: x = self.__socket.recv(n) if len(x) == 0: @@ -197,6 +211,21 @@ class Packetizer (object): out += x n -= len(x) except socket.timeout: + got_timeout = True + except socket.error, e: + # on Linux, sometimes instead of socket.timeout, we get + # EAGAIN. this is a bug in recent (> 2.6.9) kernels but + # we need to work around it. + if (type(e.args) is tuple) and (len(e.args) > 0) and (e.args[0] == errno.EAGAIN): + got_timeout = True + elif (type(e.args) is tuple) and (len(e.args) > 0) and (e.args[0] == errno.EINTR): + # syscall interrupted; try again + pass + elif self.__closed: + raise EOFError() + else: + raise + if got_timeout: if self.__closed: raise EOFError() if check_rekey and (len(out) == 0) and self.__need_rekey: @@ -207,32 +236,44 @@ class Packetizer (object): def write_all(self, out): self.__keepalive_last = time.time() while len(out) > 0: + got_timeout = False try: n = self.__socket.send(out) except socket.timeout: - n = 0 - if self.__closed: + got_timeout = 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 + elif (type(e.args) is tuple) and (len(e.args) > 0) and (e.args[0] == errno.EINTR): + # syscall interrupted; try again + pass + else: n = -1 except Exception: # could be: (32, 'Broken pipe') n = -1 + if got_timeout: + n = 0 + if self.__closed: + n = -1 if n < 0: raise EOFError() if n == len(out): - return + break out = out[n:] return def readline(self, timeout): """ - Read a line from the socket. This is done in a fairly inefficient - way, but is only used for initial banner negotiation so it's not worth - optimising. + Read a line from the socket. We assume no data is pending after the + line, so it's okay to attempt large reads. """ buf = '' while not '\n' in buf: buf += self._read_timeout(timeout) - buf = buf[:-1] + n = buf.index('\n') + self.__remainder += buf[n+1:] + buf = buf[:n] if (len(buf) > 0) and (buf[-1] == '\r'): buf = buf[:-1] return buf @@ -242,21 +283,21 @@ class Packetizer (object): Write a block of data using the current cipher, as an SSH block. """ # encrypt this sucka - randpool.stir() data = str(data) cmd = ord(data[0]) if cmd in MSG_NAMES: cmd_name = MSG_NAMES[cmd] else: cmd_name = '$%x' % cmd - self._log(DEBUG, 'Write packet <%s>, length %d' % (cmd_name, len(data))) - if self.__compress_engine_out is not None: - data = self.__compress_engine_out(data) - packet = self._build_packet(data) - if self.__dump_packets: - self._log(DEBUG, util.format_binary(packet, 'OUT: ')) + orig_len = len(data) self.__write_lock.acquire() try: + if self.__compress_engine_out is not None: + data = self.__compress_engine_out(data) + packet = self._build_packet(data) + if self.__dump_packets: + self._log(DEBUG, 'Write packet <%s>, length %d' % (cmd_name, orig_len)) + self._log(DEBUG, util.format_binary(packet, 'OUT: ')) if self.__block_engine_out != None: out = self.__block_engine_out.encrypt(packet) else: @@ -264,12 +305,15 @@ class Packetizer (object): # + mac if self.__block_engine_out != None: payload = struct.pack('>I', self.__sequence_number_out) + packet - out += HMAC.HMAC(self.__mac_key_out, payload, self.__mac_engine_out).digest()[:self.__mac_size_out] + out += compute_hmac(self.__mac_key_out, payload, self.__mac_engine_out)[:self.__mac_size_out] self.__sequence_number_out = (self.__sequence_number_out + 1) & 0xffffffffL self.write_all(out) self.__sent_bytes += len(out) self.__sent_packets += 1 + if (self.__sent_packets % 100) == 0: + # stirring the randpool takes 30ms on my ibook!! + randpool.stir() if ((self.__sent_packets >= self.REKEY_PACKETS) or (self.__sent_bytes >= self.REKEY_BYTES)) \ and not self.__need_rekey: # only ask once for rekeying @@ -310,12 +354,12 @@ class Packetizer (object): if self.__mac_size_in > 0: mac = post_packet[:self.__mac_size_in] mac_payload = struct.pack('>II', self.__sequence_number_in, packet_size) + packet - my_mac = HMAC.HMAC(self.__mac_key_in, mac_payload, self.__mac_engine_in).digest()[:self.__mac_size_in] + my_mac = compute_hmac(self.__mac_key_in, mac_payload, self.__mac_engine_in)[:self.__mac_size_in] if my_mac != mac: raise SSHException('Mismatched MAC') padding = ord(packet[0]) payload = packet[1:packet_size - padding] - randpool.add_event(packet[packet_size - padding]) + randpool.add_event() if self.__dump_packets: self._log(DEBUG, 'Got payload (%d bytes, %d padding)' % (packet_size, padding)) @@ -348,7 +392,8 @@ class Packetizer (object): cmd_name = MSG_NAMES[cmd] else: cmd_name = '$%x' % cmd - self._log(DEBUG, 'Read packet <%s>, length %d' % (cmd_name, len(payload))) + if self.__dump_packets: + self._log(DEBUG, 'Read packet <%s>, length %d' % (cmd_name, len(payload))) return cmd, msg @@ -374,8 +419,7 @@ class Packetizer (object): self.__keepalive_callback() self.__keepalive_last = now - def _py22_read_all(self, n): - out = '' + def _py22_read_all(self, n, out): while n > 0: r, w, e = select.select([self.__socket], [], [], 0.1) if self.__socket not in r: @@ -398,23 +442,24 @@ class Packetizer (object): x = self.__socket.recv(1) if len(x) == 0: raise EOFError() - return x + break if self.__closed: raise EOFError() now = time.time() if now - start >= timeout: raise socket.timeout() + return x def _read_timeout(self, timeout): if PY22: - return self._py22_read_timeout(n) + return self._py22_read_timeout(timeout) start = time.time() while True: try: - x = self.__socket.recv(1) + x = self.__socket.recv(128) if len(x) == 0: raise EOFError() - return x + break except socket.timeout: pass if self.__closed: @@ -422,6 +467,7 @@ class Packetizer (object): now = time.time() if now - start >= timeout: raise socket.timeout() + return x def _build_packet(self, payload): # pad up at least 4 bytes, to nearest block-size (usually 8) diff --git a/paramiko/pipe.py b/paramiko/pipe.py index cc28f43..1cfed2d 100644 --- a/paramiko/pipe.py +++ b/paramiko/pipe.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -19,6 +19,9 @@ """ 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(). """ import sys @@ -28,8 +31,10 @@ import socket def make_pipe (): if sys.platform[:3] != 'win': - return PosixPipe() - return WindowsPipe() + p = PosixPipe() + else: + p = WindowsPipe() + return p class PosixPipe (object): @@ -37,10 +42,13 @@ class PosixPipe (object): self._rfd, self._wfd = os.pipe() self._set = False self._forever = False + self._closed = False def close (self): os.close(self._rfd) os.close(self._wfd) + # used for unit tests: + self._closed = True def fileno (self): return self._rfd @@ -52,7 +60,7 @@ class PosixPipe (object): self._set = False def set (self): - if self._set: + if self._set or self._closed: return self._set = True os.write(self._wfd, '*') @@ -80,10 +88,13 @@ class WindowsPipe (object): serv.close() self._set = False self._forever = False + self._closed = False def close (self): self._rsock.close() self._wsock.close() + # used for unit tests: + self._closed = True def fileno (self): return self._rsock.fileno() @@ -95,7 +106,7 @@ class WindowsPipe (object): self._set = False def set (self): - if self._set: + if self._set or self._closed: return self._set = True self._wsock.send('*') @@ -103,3 +114,34 @@ class WindowsPipe (object): def set_forever (self): self._forever = True self.set() + + +class OrPipe (object): + def __init__(self, pipe): + self._set = False + self._partner = None + self._pipe = pipe + + def set(self): + self._set = True + if not self._partner._set: + self._pipe.set() + + def clear(self): + self._set = False + if not self._partner._set: + self._pipe.clear() + + +def make_or_pipe(pipe): + """ + 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. + """ + p1 = OrPipe(pipe) + p2 = OrPipe(pipe) + p1._partner = p2 + p2._partner = p1 + return p1, p2 + diff --git a/paramiko/pkey.py b/paramiko/pkey.py index 75db8e5..4e8b26b 100644 --- a/paramiko/pkey.py +++ b/paramiko/pkey.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -21,6 +21,7 @@ Common API for all public keys. """ import base64 +from binascii import hexlify, unhexlify import os from Crypto.Hash import MD5 @@ -139,8 +140,6 @@ class PKey (object): @return: a base64 string containing the public part of the key. @rtype: str - - @since: fearow """ return base64.encodestring(str(self)).replace('\n', '') @@ -173,7 +172,7 @@ class PKey (object): """ return False - def from_private_key_file(cl, filename, password=None): + def from_private_key_file(cls, filename, password=None): """ Create a key object by reading a private key file. If the private key is encrypted and C{password} is not C{None}, the given password @@ -182,41 +181,76 @@ class PKey (object): exist in all subclasses of PKey (such as L{RSAKey} or L{DSSKey}), but is useless on the abstract PKey class. - @param filename: name of the file to read. + @param filename: name of the file to read @type filename: str @param password: an optional password to use to decrypt the key file, if it's encrypted @type password: str - @return: a new key object based on the given private key. + @return: a new key object based on the given private key @rtype: L{PKey} - @raise IOError: if there was an error reading the file. + @raise IOError: if there was an error reading the file @raise PasswordRequiredException: if the private key file is - encrypted, and C{password} is C{None}. - @raise SSHException: if the key file is invalid. - - @since: fearow + encrypted, and C{password} is C{None} + @raise SSHException: if the key file is invalid """ - key = cl(filename=filename, password=password) + key = cls(filename=filename, password=password) return key from_private_key_file = classmethod(from_private_key_file) + def from_private_key(cls, file_obj, password=None): + """ + Create a key object by reading a private key from a file (or file-like) + object. If the private key is encrypted and C{password} is not C{None}, + the given password will be used to decrypt the key (otherwise + L{PasswordRequiredException} is thrown). + + @param file_obj: the file to read from + @type file_obj: file + @param password: an optional password to use to decrypt the key, if it's + encrypted + @type password: str + @return: a new key object based on the given private key + @rtype: L{PKey} + + @raise IOError: if there was an error reading the key + @raise PasswordRequiredException: if the private key file is encrypted, + and C{password} is C{None} + @raise SSHException: if the key file is invalid + """ + key = cls(file_obj=file_obj, password=password) + return key + from_private_key = classmethod(from_private_key) + def write_private_key_file(self, filename, password=None): """ Write private key contents into a file. If the password is not C{None}, the key is encrypted before writing. - @param filename: name of the file to write. + @param filename: name of the file to write @type filename: str - @param password: an optional password to use to encrypt the key file. + @param password: an optional password to use to encrypt the key file @type password: str - @raise IOError: if there was an error writing the file. - @raise SSHException: if the key is invalid. - - @since: fearow + @raise IOError: if there was an error writing the file + @raise SSHException: if the key is invalid + """ + raise Exception('Not implemented in PKey') + + def write_private_key(self, file_obj, password=None): """ - raise exception('Not implemented in PKey') + Write private key contents into a file (or file-like) object. If the + password is not C{None}, the key is encrypted before writing. + + @param file_obj: the file object to write into + @type file_obj: file + @param password: an optional password to use to encrypt the key + @type password: str + + @raise IOError: if there was an error writing to the file + @raise SSHException: if the key is invalid + """ + raise Exception('Not implemented in PKey') def _read_private_key_file(self, tag, filename, password=None): """ @@ -242,8 +276,12 @@ class PKey (object): @raise SSHException: if the key file is invalid. """ f = open(filename, 'r') - lines = f.readlines() + data = self._read_private_key(tag, f, password) f.close() + return data + + def _read_private_key(self, tag, f, password=None): + lines = f.readlines() start = 0 while (start < len(lines)) and (lines[start].strip() != '-----BEGIN ' + tag + ' PRIVATE KEY-----'): start += 1 @@ -265,9 +303,9 @@ class PKey (object): # if we trudged to the end of the file, just try to cope. try: data = base64.decodestring(''.join(lines[start:end])) - except binascii.Error, e: + except base64.binascii.Error, e: raise SSHException('base64 decoding error: ' + str(e)) - if not headers.has_key('proc-type'): + if 'proc-type' not in headers: # unencryped: done return data # encrypted keyfile: will need a password @@ -277,7 +315,7 @@ class PKey (object): encryption_type, saltstr = headers['dek-info'].split(',') except: raise SSHException('Can\'t parse DEK-info in private key file') - if not self._CIPHER_TABLE.has_key(encryption_type): + if encryption_type not in self._CIPHER_TABLE: raise SSHException('Unknown private key cipher "%s"' % encryption_type) # if no password was passed in, raise an exception pointing out that we need one if password is None: @@ -285,7 +323,7 @@ class PKey (object): cipher = self._CIPHER_TABLE[encryption_type]['cipher'] keysize = self._CIPHER_TABLE[encryption_type]['keysize'] mode = self._CIPHER_TABLE[encryption_type]['mode'] - salt = util.unhexify(saltstr) + salt = unhexlify(saltstr) key = util.generate_key_bytes(MD5, salt, password, keysize) return cipher.new(key, mode, salt).decrypt(data) @@ -310,6 +348,10 @@ class PKey (object): f = open(filename, 'w', 0600) # grrr... the mode doesn't always take hold os.chmod(filename, 0600) + self._write_private_key(tag, f, data, password) + f.close() + + def _write_private_key(self, tag, f, data, password=None): f.write('-----BEGIN %s PRIVATE KEY-----\n' % tag) if password is not None: # since we only support one cipher here, use it @@ -327,7 +369,7 @@ class PKey (object): data += '\0' * n data = cipher.new(key, mode, salt).encrypt(data) f.write('Proc-Type: 4,ENCRYPTED\n') - f.write('DEK-Info: %s,%s\n' % (cipher_name, util.hexify(salt))) + f.write('DEK-Info: %s,%s\n' % (cipher_name, hexlify(salt).upper())) f.write('\n') s = base64.encodestring(data) # re-wrap to 64-char lines @@ -336,4 +378,3 @@ class PKey (object): f.write(s) f.write('\n') f.write('-----END %s PRIVATE KEY-----\n' % tag) - f.close() diff --git a/paramiko/primes.py b/paramiko/primes.py index 3677394..7b35736 100644 --- a/paramiko/primes.py +++ b/paramiko/primes.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -23,6 +23,7 @@ Utility functions for dealing with primes. from Crypto.Util import number from paramiko import util +from paramiko.ssh_exception import SSHException def _generate_prime(bits, randpool): @@ -39,7 +40,8 @@ def _generate_prime(bits, randpool): while not number.isPrime(n): n += 2 if util.bit_length(n) == bits: - return n + break + return n def _roll_random(rpool, n): "returns a random # from 0 to N-1" @@ -59,7 +61,8 @@ def _roll_random(rpool, n): x = chr(ord(x[0]) & hbyte_mask) + x[1:] num = util.inflate_long(x, 1) if num < n: - return num + break + return num class ModulusPack (object): @@ -75,8 +78,8 @@ class ModulusPack (object): self.randpool = rpool def _parse_modulus(self, line): - timestamp, type, tests, tries, size, generator, modulus = line.split() - type = int(type) + timestamp, mod_type, tests, tries, size, generator, modulus = line.split() + mod_type = int(mod_type) tests = int(tests) tries = int(tries) size = int(size) @@ -87,7 +90,7 @@ class ModulusPack (object): # type 2 (meets basic structural requirements) # test 4 (more than just a small-prime sieve) # tries < 100 if test & 4 (at least 100 tries of miller-rabin) - if (type < 2) or (tests < 4) or ((tests & 4) and (tests < 8) and (tries < 100)): + if (mod_type < 2) or (tests < 4) or ((tests & 4) and (tests < 8) and (tries < 100)): self.discarded.append((modulus, 'does not meet basic requirements')) return if generator == 0: @@ -100,7 +103,7 @@ class ModulusPack (object): if (bl != size) and (bl != size + 1): self.discarded.append((modulus, 'incorrectly reported bit length %d' % size)) return - if not self.pack.has_key(bl): + if bl not in self.pack: self.pack[bl] = [] self.pack[bl].append((generator, modulus)) diff --git a/paramiko/resource.py b/paramiko/resource.py new file mode 100644 index 0000000..a089754 --- /dev/null +++ b/paramiko/resource.py @@ -0,0 +1,72 @@ +# Copyright (C) 2003-2007 Robey Pointer +# +# 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. + +""" +Resource manager. +""" + +import weakref + + +class ResourceManager (object): + """ + A registry of objects and resources that should be closed when those + objects are deleted. + + This is meant to be a safer alternative to python's C{__del__} method, + which can cause reference cycles to never be collected. Objects registered + with the ResourceManager can be collected but still free resources when + they die. + + Resources are registered using L{register}, and when an object is garbage + collected, each registered resource is closed by having its C{close()} + method called. Multiple resources may be registered per object, but a + resource will only be closed once, even if multiple objects register it. + (The last object to register it wins.) + """ + + def __init__(self): + self._table = {} + + def register(self, obj, resource): + """ + Register a resource to be closed with an object is collected. + + When the given C{obj} is garbage-collected by the python interpreter, + the C{resource} will be closed by having its C{close()} method called. + Any exceptions are ignored. + + @param obj: the object to track + @type obj: object + @param resource: the resource to close when the object is collected + @type resource: object + """ + def callback(ref): + try: + resource.close() + except: + pass + del self._table[id(resource)] + + # keep the weakref in a table so it sticks around long enough to get + # its callback called. :) + self._table[id(resource)] = weakref.ref(obj, callback) + + +# singleton +ResourceManager = ResourceManager() diff --git a/paramiko/rng.py b/paramiko/rng.py new file mode 100644 index 0000000..46329d1 --- /dev/null +++ b/paramiko/rng.py @@ -0,0 +1,112 @@ +#!/usr/bin/python +# -*- coding: ascii -*- +# Copyright (C) 2008 Dwayne C. Litzenberger +# +# 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., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import sys +import threading +from Crypto.Util.randpool import RandomPool as _RandomPool + +try: + import platform +except ImportError: + platform = None # Not available using Python 2.2 + +def _strxor(a, b): + assert len(a) == len(b) + return "".join(map(lambda x, y: chr(ord(x) ^ ord(y)), a, b)) + +## +## Find a strong random entropy source, depending on the detected platform. +## WARNING TO DEVELOPERS: This will fail on some systems, but do NOT use +## Crypto.Util.randpool.RandomPool as a fall-back. RandomPool will happily run +## with very little entropy, thus _silently_ defeating any security that +## Paramiko attempts to provide. (This is current as of PyCrypto 2.0.1). +## See http://www.lag.net/pipermail/paramiko/2008-January/000599.html +## and http://www.lag.net/pipermail/paramiko/2008-April/000678.html +## + +if ((platform is not None and platform.system().lower() == 'windows') or + sys.platform == 'win32'): + # MS Windows + from paramiko import rng_win32 + rng_device = rng_win32.open_rng_device() +else: + # Assume POSIX (any system where /dev/urandom exists) + from paramiko import rng_posix + rng_device = rng_posix.open_rng_device() + + +class StrongLockingRandomPool(object): + """Wrapper around RandomPool guaranteeing strong random numbers. + + Crypto.Util.randpool.RandomPool will silently operate even if it is seeded + with little or no entropy, and it provides no prediction resistance if its + state is ever compromised throughout its runtime. It is also not thread-safe. + + This wrapper augments RandomPool by XORing its output with random bits from + the operating system, and by controlling access to the underlying + RandomPool using an exclusive lock. + """ + + def __init__(self, instance=None): + if instance is None: + instance = _RandomPool() + self.randpool = instance + self.randpool_lock = threading.Lock() + self.entropy = rng_device + + # Stir 256 bits of entropy from the RNG device into the RandomPool. + self.randpool.stir(self.entropy.read(32)) + self.entropy.randomize() + + def stir(self, s=''): + self.randpool_lock.acquire() + try: + self.randpool.stir(s) + finally: + self.randpool_lock.release() + self.entropy.randomize() + + def randomize(self, N=0): + self.randpool_lock.acquire() + try: + self.randpool.randomize(N) + finally: + self.randpool_lock.release() + self.entropy.randomize() + + def add_event(self, s=''): + self.randpool_lock.acquire() + try: + self.randpool.add_event(s) + finally: + self.randpool_lock.release() + + def get_bytes(self, N): + self.randpool_lock.acquire() + try: + randpool_data = self.randpool.get_bytes(N) + finally: + self.randpool_lock.release() + entropy_data = self.entropy.read(N) + result = _strxor(randpool_data, entropy_data) + assert len(randpool_data) == N and len(entropy_data) == N and len(result) == N + return result + +# vim:set ts=4 sw=4 sts=4 expandtab: diff --git a/paramiko/rng_posix.py b/paramiko/rng_posix.py new file mode 100644 index 0000000..1e6d72c --- /dev/null +++ b/paramiko/rng_posix.py @@ -0,0 +1,97 @@ +#!/usr/bin/python +# -*- coding: ascii -*- +# Copyright (C) 2008 Dwayne C. Litzenberger +# Copyright (C) 2008 Open Systems Canada Limited +# +# 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., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import os +import stat + +class error(Exception): + pass + +class _RNG(object): + def __init__(self, file): + self.file = file + + def read(self, bytes): + return self.file.read(bytes) + + def close(self): + return self.file.close() + + def randomize(self): + return + +def open_rng_device(device_path=None): + """Open /dev/urandom and perform some sanity checks.""" + + f = None + g = None + + if device_path is None: + device_path = "/dev/urandom" + + try: + # Try to open /dev/urandom now so that paramiko will be able to access + # it even if os.chroot() is invoked later. + try: + f = open(device_path, "rb", 0) + except EnvironmentError: + raise error("Unable to open /dev/urandom") + + # Open a second file descriptor for sanity checking later. + try: + g = open(device_path, "rb", 0) + except EnvironmentError: + raise error("Unable to open /dev/urandom") + + # Check that /dev/urandom is a character special device, not a regular file. + st = os.fstat(f.fileno()) # f + if stat.S_ISREG(st.st_mode) or not stat.S_ISCHR(st.st_mode): + raise error("/dev/urandom is not a character special device") + + st = os.fstat(g.fileno()) # g + if stat.S_ISREG(st.st_mode) or not stat.S_ISCHR(st.st_mode): + raise error("/dev/urandom is not a character special device") + + # Check that /dev/urandom always returns the number of bytes requested + x = f.read(20) + y = g.read(20) + if len(x) != 20 or len(y) != 20: + raise error("Error reading from /dev/urandom: input truncated") + + # Check that different reads return different data + if x == y: + raise error("/dev/urandom is broken; returning identical data: %r == %r" % (x, y)) + + # Close the duplicate file object + g.close() + + # Return the first file object + return _RNG(f) + + except error: + if f is not None: + f.close() + if g is not None: + g.close() + raise + +# vim:set ts=4 sw=4 sts=4 expandtab: + diff --git a/paramiko/rng_win32.py b/paramiko/rng_win32.py new file mode 100644 index 0000000..3cb8b84 --- /dev/null +++ b/paramiko/rng_win32.py @@ -0,0 +1,121 @@ +#!/usr/bin/python +# -*- coding: ascii -*- +# Copyright (C) 2008 Dwayne C. Litzenberger +# Copyright (C) 2008 Open Systems Canada Limited +# +# 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., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +class error(Exception): + pass + +# Try to import the "winrandom" module +try: + from Crypto.Util import winrandom as _winrandom +except ImportError: + _winrandom = None + +# Try to import the "urandom" module +try: + from os import urandom as _urandom +except ImportError: + _urandom = None + + +class _RNG(object): + def __init__(self, readfunc): + self.read = readfunc + + def randomize(self): + # According to "Cryptanalysis of the Random Number Generator of the + # Windows Operating System", by Leo Dorrendorf and Zvi Gutterman + # and Benny Pinkas , + # CryptGenRandom only updates its internal state using kernel-provided + # random data every 128KiB of output. + self.read(128*1024) # discard 128 KiB of output + +def _open_winrandom(): + if _winrandom is None: + raise error("Crypto.Util.winrandom module not found") + + # Check that we can open the winrandom module + try: + r0 = _winrandom.new() + r1 = _winrandom.new() + except Exception, exc: + raise error("winrandom.new() failed: %s" % str(exc), exc) + + # Check that we can read from the winrandom module + try: + x = r0.get_bytes(20) + y = r1.get_bytes(20) + except Exception, exc: + raise error("winrandom get_bytes failed: %s" % str(exc), exc) + + # Check that the requested number of bytes are returned + if len(x) != 20 or len(y) != 20: + raise error("Error reading from winrandom: input truncated") + + # Check that different reads return different data + if x == y: + raise error("winrandom broken: returning identical data") + + return _RNG(r0.get_bytes) + +def _open_urandom(): + if _urandom is None: + raise error("os.urandom function not found") + + # Check that we can read from os.urandom() + try: + x = _urandom(20) + y = _urandom(20) + except Exception, exc: + raise error("os.urandom failed: %s" % str(exc), exc) + + # Check that the requested number of bytes are returned + if len(x) != 20 or len(y) != 20: + raise error("os.urandom failed: input truncated") + + # Check that different reads return different data + if x == y: + raise error("os.urandom failed: returning identical data") + + return _RNG(_urandom) + +def open_rng_device(): + # Try using the Crypto.Util.winrandom module + try: + return _open_winrandom() + except error: + pass + + # Several versions of PyCrypto do not contain the winrandom module, but + # Python >= 2.4 has os.urandom, so try to use that. + try: + return _open_urandom() + except error: + pass + + # SECURITY NOTE: DO NOT USE Crypto.Util.randpool.RandomPool HERE! + # If we got to this point, RandomPool will silently run with very little + # entropy. (This is current as of PyCrypto 2.0.1). + # See http://www.lag.net/pipermail/paramiko/2008-January/000599.html + # and http://www.lag.net/pipermail/paramiko/2008-April/000678.html + + raise error("Unable to find a strong random entropy source. You cannot run this software securely under the current configuration.") + +# vim:set ts=4 sw=4 sts=4 expandtab: diff --git a/paramiko/rsakey.py b/paramiko/rsakey.py index 780ea1b..d72d175 100644 --- a/paramiko/rsakey.py +++ b/paramiko/rsakey.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -38,7 +38,15 @@ class RSAKey (PKey): data. """ - def __init__(self, msg=None, data=None, filename=None, password=None, vals=None): + def __init__(self, msg=None, data=None, filename=None, password=None, vals=None, file_obj=None): + self.n = None + self.e = None + self.d = None + self.p = None + self.q = None + if file_obj is not None: + self._from_private_key(file_obj, password) + return if filename is not None: self._from_private_key_file(filename, password) return @@ -75,7 +83,7 @@ class RSAKey (PKey): return self.size def can_sign(self): - return hasattr(self, 'd') + return self.d is not None def sign_ssh_data(self, rpool, data): digest = SHA.new(data).digest() @@ -93,11 +101,13 @@ class RSAKey (PKey): # verify the signature by SHA'ing the data and encrypting it using the # public key. some wackiness ensues where we "pkcs1imify" the 20-byte # hash into a string as long as the RSA key. - hash = util.inflate_long(self._pkcs1imify(SHA.new(data).digest()), True) + hash_obj = util.inflate_long(self._pkcs1imify(SHA.new(data).digest()), True) rsa = RSA.construct((long(self.n), long(self.e))) - return rsa.verify(hash, (sig,)) + return rsa.verify(hash_obj, (sig,)) - def write_private_key_file(self, filename, password=None): + def _encode_key(self): + if (self.p is None) or (self.q is None): + raise SSHException('Not enough key info to write private key file') keylist = [ 0, self.n, self.e, self.d, self.p, self.q, self.d % (self.p - 1), self.d % (self.q - 1), util.mod_inverse(self.q, self.p) ] @@ -106,7 +116,13 @@ class RSAKey (PKey): b.encode(keylist) except BERException: raise SSHException('Unable to create ber encoding of key') - self._write_private_key_file('RSA', filename, str(b), password) + return str(b) + + def write_private_key_file(self, filename, password=None): + self._write_private_key_file('RSA', filename, self._encode_key(), password) + + def write_private_key(self, file_obj, password=None): + self._write_private_key('RSA', file_obj, self._encode_key(), password) def generate(bits, progress_func=None): """ @@ -120,8 +136,6 @@ class RSAKey (PKey): @type progress_func: function @return: new private key @rtype: L{RSAKey} - - @since: fearow """ randpool.stir() rsa = RSA.generate(bits, randpool.get_bytes, progress_func) @@ -147,9 +161,16 @@ class RSAKey (PKey): return '\x00\x01' + filler + '\x00' + SHA1_DIGESTINFO + data def _from_private_key_file(self, filename, password): + data = self._read_private_key_file('RSA', filename, password) + self._decode_key(data) + + def _from_private_key(self, file_obj, password): + data = self._read_private_key('RSA', file_obj, password) + self._decode_key(data) + + def _decode_key(self, data): # private key file contains: # RSAPrivateKey = { version = 0, n, e, d, p, q, d mod p-1, d mod q-1, q**-1 mod p } - data = self._read_private_key_file('RSA', filename, password) try: keylist = BER(data).decode() except BERException: diff --git a/paramiko/server.py b/paramiko/server.py index a0e3988..bcaa4be 100644 --- a/paramiko/server.py +++ b/paramiko/server.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -41,6 +41,8 @@ class InteractiveQuery (object): @type name: str @param instructions: user instructions (usually short) about this query @type instructions: str + @param prompts: one or more authentication prompts + @type prompts: str """ self.name = name self.instructions = instructions @@ -90,6 +92,7 @@ class ServerInterface (object): - L{check_channel_shell_request} - L{check_channel_subsystem_request} - L{check_channel_window_change_request} + - L{check_channel_x11_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 @@ -273,6 +276,42 @@ class ServerInterface (object): """ return AUTH_FAILED + def check_port_forward_request(self, address, port): + """ + 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 C{"0.0.0.0"} indicates a global + address (any address associated with this server) and a port of C{0} + indicates that no specific port is requested (usually the OS will pick + a port). + + The default implementation always returns C{False}, rejecting the + port forwarding request. If the request is accepted, you should return + the port opened for listening. + + @param address: the requested address + @type address: str + @param port: the requested port + @type port: int + @return: the port number that was opened for listening, or C{False} to + reject + @rtype: int + """ + return False + + def cancel_port_forward_request(self, address, port): + """ + 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. + + @param address: the forwarded address + @type address: str + @param port: the forwarded port + @type port: int + """ + pass + def check_global_request(self, kind, msg): """ Handle a global request of the given C{kind}. This method is called @@ -291,6 +330,9 @@ class ServerInterface (object): The default implementation always returns C{False}, indicating that it does not support any global requests. + + @note: Port forwarding requests are handled separately, in + L{check_port_forward_request}. @param kind: the kind of global request being made. @type kind: str @@ -426,6 +468,71 @@ class ServerInterface (object): @rtype: bool """ return False + + def 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. If this + method returns C{True}, X11 applications should be routed through new + SSH channels, using L{Transport.open_x11_channel}. + + The default implementation always returns C{False}. + + @param channel: the L{Channel} the X11 request arrived on + @type channel: L{Channel} + @param single_connection: C{True} if only a single X11 channel should + be opened + @type single_connection: bool + @param auth_protocol: the protocol used for X11 authentication + @type auth_protocol: str + @param auth_cookie: the cookie used to authenticate to X11 + @type auth_cookie: str + @param screen_number: the number of the X11 screen to connect to + @type screen_number: int + @return: C{True} if the X11 session was opened; 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 + return C{OPEN_SUCCEEDED} or an error code. This method is + called in server mode when the client requests a channel, after + authentication is complete. + + The C{chanid} parameter is a small number that uniquely identifies the + channel within a L{Transport}. A L{Channel} object is not created + unless this method returns C{OPEN_SUCCEEDED} -- once a + L{Channel} object is created, you can call L{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 C{OPEN_SUCCEEDED} (or + C{0}) to allow the channel request, or one of the following error + codes to reject it: + - C{OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED} + - C{OPEN_FAILED_CONNECT_FAILED} + - C{OPEN_FAILED_UNKNOWN_CHANNEL_TYPE} + - C{OPEN_FAILED_RESOURCE_SHORTAGE} + + The default implementation always returns + C{OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED}. + + @param chanid: ID of the channel + @type chanid: int + @param origin: 2-tuple containing the IP address and port of the + originator (client side) + @type origin: tuple + @param destination: 2-tuple containing the IP address and port of the + destination (server side) + @type destination: tuple + @return: a success or failure code (listed above) + @rtype: int + """ + return OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED class SubsystemHandler (threading.Thread): @@ -443,8 +550,6 @@ class SubsystemHandler (threading.Thread): authenticated and requests subsytem C{"mp3"}, an object of class C{MP3Handler} will be created, and L{start_subsystem} will be called on it from a new thread. - - @since: ivysaur """ def __init__(self, channel, name, server): """ diff --git a/paramiko/sftp.py b/paramiko/sftp.py index 58d7103..2296d85 100644 --- a/paramiko/sftp.py +++ b/paramiko/sftp.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -16,6 +16,7 @@ # along with Paramiko; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +import select import socket import struct @@ -113,24 +114,22 @@ class BaseSFTP (object): return version def _send_server_version(self): + # winscp will freak out if the server sends version info before the + # client finishes sending INIT. + t, data = self._read_packet() + if t != CMD_INIT: + raise SFTPError('Incompatible sftp protocol') + version = struct.unpack('>I', data[:4])[0] # advertise that we support "check-file" extension_pairs = [ 'check-file', 'md5,sha1' ] msg = Message() msg.add_int(_VERSION) msg.add(*extension_pairs) self._send_packet(CMD_VERSION, str(msg)) - t, data = self._read_packet() - if t != CMD_INIT: - raise SFTPError('Incompatible sftp protocol') - version = struct.unpack('>I', data[:4])[0] return version - def _log(self, level, msg): - if issubclass(type(msg), list): - for m in msg: - self.logger.log(level, m) - else: - self.logger.log(level, msg) + def _log(self, level, msg, *args): + self.logger.log(level, msg, *args) def _write_all(self, out): while len(out) > 0: @@ -145,7 +144,20 @@ class BaseSFTP (object): def _read_all(self, n): out = '' while n > 0: - x = self.sock.recv(n) + if isinstance(self.sock, socket.socket): + # sometimes sftp is used directly over a socket instead of + # through a paramiko channel. in this case, check periodically + # if the socket is closed. (for some reason, recv() won't ever + # return or raise an exception, but calling select on a closed + # socket will.) + while True: + read, write, err = select.select([ self.sock ], [], [], 0.1) + if len(read) > 0: + x = self.sock.recv(n) + break + else: + x = self.sock.recv(n) + if len(x) == 0: raise EOFError() out += x @@ -153,16 +165,24 @@ class BaseSFTP (object): return out def _send_packet(self, t, packet): + #self._log(DEBUG2, 'write: %s (len=%d)' % (CMD_NAMES.get(t, '0x%02x' % t), len(packet))) out = struct.pack('>I', len(packet) + 1) + chr(t) + packet if self.ultra_debug: self._log(DEBUG, util.format_binary(out, 'OUT: ')) self._write_all(out) def _read_packet(self): - size = struct.unpack('>I', self._read_all(4))[0] + x = self._read_all(4) + # most sftp servers won't accept packets larger than about 32k, so + # anything with the high byte set (> 16MB) is just garbage. + if x[0] != '\x00': + raise SFTPError('Garbage packet received') + size = struct.unpack('>I', x)[0] data = self._read_all(size) if self.ultra_debug: self._log(DEBUG, util.format_binary(data, 'IN: ')); if size > 0: - return ord(data[0]), data[1:] + t = ord(data[0]) + #self._log(DEBUG2, 'read: %s (len=%d)' % (CMD_NAMES.get(t), '0x%02x' % t, len(data)-1)) + return t, data[1:] return 0, '' diff --git a/paramiko/sftp_attr.py b/paramiko/sftp_attr.py index eae7c99..9c92862 100644 --- a/paramiko/sftp_attr.py +++ b/paramiko/sftp_attr.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2006 Robey Pointer # # This file is part of paramiko. # @@ -51,6 +51,12 @@ class SFTPAttributes (object): Create a new (empty) SFTPAttributes object. All fields will be empty. """ self._flags = 0 + self.st_size = None + self.st_uid = None + self.st_gid = None + self.st_mode = None + self.st_atime = None + self.st_mtime = None self.attr = {} def from_stat(cls, obj, filename=None): @@ -80,18 +86,17 @@ class SFTPAttributes (object): def __repr__(self): return '' % self._debug_str() - def __str__(self): - return self._debug_str() - ### internals... - def _from_msg(cls, msg, filename=None): + def _from_msg(cls, msg, filename=None, longname=None): attr = cls() attr._unpack(msg) if filename is not None: attr.filename = filename + if longname is not None: + attr.longname = longname return attr _from_msg = classmethod(_from_msg) @@ -114,13 +119,13 @@ class SFTPAttributes (object): def _pack(self, msg): self._flags = 0 - if hasattr(self, 'st_size'): + if self.st_size is not None: self._flags |= self.FLAG_SIZE - if hasattr(self, 'st_uid') or hasattr(self, 'st_gid'): + if (self.st_uid is not None) and (self.st_gid is not None): self._flags |= self.FLAG_UIDGID - if hasattr(self, 'st_mode'): + if self.st_mode is not None: self._flags |= self.FLAG_PERMISSIONS - if hasattr(self, 'st_atime') or hasattr(self, 'st_mtime'): + if (self.st_atime is not None) and (self.st_mtime is not None): self._flags |= self.FLAG_AMTIME if len(self.attr) > 0: self._flags |= self.FLAG_EXTENDED @@ -128,13 +133,14 @@ class SFTPAttributes (object): if self._flags & self.FLAG_SIZE: msg.add_int64(self.st_size) if self._flags & self.FLAG_UIDGID: - msg.add_int(getattr(self, 'st_uid', 0)) - msg.add_int(getattr(self, 'st_gid', 0)) + msg.add_int(self.st_uid) + msg.add_int(self.st_gid) if self._flags & self.FLAG_PERMISSIONS: msg.add_int(self.st_mode) if self._flags & self.FLAG_AMTIME: - msg.add_int(getattr(self, 'st_atime', 0)) - msg.add_int(getattr(self, 'st_mtime', 0)) + # throw away any fractional seconds + msg.add_int(long(self.st_atime)) + msg.add_int(long(self.st_mtime)) if self._flags & self.FLAG_EXTENDED: msg.add_int(len(self.attr)) for key, val in self.attr.iteritems(): @@ -144,15 +150,14 @@ class SFTPAttributes (object): def _debug_str(self): out = '[ ' - if hasattr(self, 'st_size'): + if self.st_size is not None: out += 'size=%d ' % self.st_size - if hasattr(self, 'st_uid') or hasattr(self, 'st_gid'): - out += 'uid=%d gid=%d ' % (getattr(self, 'st_uid', 0), getattr(self, 'st_gid', 0)) - if hasattr(self, 'st_mode'): + if (self.st_uid is not None) and (self.st_gid is not None): + out += 'uid=%d gid=%d ' % (self.st_uid, self.st_gid) + if self.st_mode is not None: out += 'mode=' + oct(self.st_mode) + ' ' - if hasattr(self, 'st_atime') or hasattr(self, 'st_mtime'): - out += 'atime=%d mtime=%d ' % (getattr(self, 'st_atime', 0), - getattr(self, 'st_mtime', 0)) + if (self.st_atime is not None) and (self.st_mtime is not None): + out += 'atime=%d mtime=%d ' % (self.st_atime, self.st_mtime) for k, v in self.attr.iteritems(): out += '"%s"=%r ' % (str(k), v) out += ']' @@ -171,7 +176,7 @@ class SFTPAttributes (object): def __str__(self): "create a unix-style long description of the file (like ls -l)" - if hasattr(self, 'st_mode'): + if self.st_mode is not None: kind = stat.S_IFMT(self.st_mode) if kind == stat.S_IFIFO: ks = 'p' @@ -194,15 +199,25 @@ class SFTPAttributes (object): ks += self._rwx(self.st_mode & 7, self.st_mode & stat.S_ISVTX, True) else: ks = '?---------' - uid = getattr(self, 'st_uid', -1) - gid = getattr(self, 'st_gid', -1) - size = getattr(self, 'st_size', -1) - mtime = getattr(self, 'st_mtime', 0) # compute display date - if abs(time.time() - mtime) > 15552000: - # (15552000 = 6 months) - datestr = time.strftime('%d %b %Y', time.localtime(mtime)) + if (self.st_mtime is None) or (self.st_mtime == 0xffffffff): + # shouldn't really happen + datestr = '(unknown date)' else: - datestr = time.strftime('%d %b %H:%M', time.localtime(mtime)) + if abs(time.time() - self.st_mtime) > 15552000: + # (15552000 = 6 months) + datestr = time.strftime('%d %b %Y', time.localtime(self.st_mtime)) + else: + datestr = time.strftime('%d %b %H:%M', time.localtime(self.st_mtime)) filename = getattr(self, 'filename', '?') - return '%s 1 %-8d %-8d %8d %-12s %s' % (ks, uid, gid, size, datestr, filename) + + # not all servers support uid/gid + uid = self.st_uid + gid = self.st_gid + if uid is None: + uid = 0 + if gid is None: + gid = 0 + + return '%s 1 %-8d %-8d %8d %-12s %s' % (ks, uid, gid, self.st_size, datestr, filename) + diff --git a/paramiko/sftp_client.py b/paramiko/sftp_client.py index 2fe89e9..b3d2d56 100644 --- a/paramiko/sftp_client.py +++ b/paramiko/sftp_client.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -20,21 +20,32 @@ Client-mode SFTP support. """ +from binascii import hexlify import errno import os import threading +import time import weakref + from paramiko.sftp import * from paramiko.sftp_attr import SFTPAttributes +from paramiko.ssh_exception import SSHException from paramiko.sftp_file import SFTPFile def _to_unicode(s): - "if a str is not ascii, decode its utf8 into unicode" + """ + decode a string as ascii or utf8 if possible (as required by the sftp + protocol). if neither works, just return a byte string because the server + probably doesn't know the filename's encoding. + """ try: return s.encode('ascii') - except: - return s.decode('utf-8') + except UnicodeError: + try: + return s.decode('utf-8') + except UnicodeError: + return s class SFTPClient (BaseSFTP): @@ -51,8 +62,11 @@ class SFTPClient (BaseSFTP): An alternate way to create an SFTP client context is by using L{from_transport}. - @param sock: an open L{Channel} using the C{"sftp"} subsystem. + @param sock: an open L{Channel} using the C{"sftp"} subsystem @type sock: L{Channel} + + @raise SSHException: if there's an exception while negotiating + sftp """ BaseSFTP.__init__(self) self.sock = sock @@ -66,31 +80,33 @@ class SFTPClient (BaseSFTP): if type(sock) is Channel: # override default logger transport = self.sock.get_transport() - self.logger = util.get_logger(transport.get_log_channel() + '.' + - self.sock.get_name() + '.sftp') + self.logger = util.get_logger(transport.get_log_channel() + '.sftp') self.ultra_debug = transport.get_hexdump() - self._send_version() - - def __del__(self): - self.close() + try: + server_version = self._send_version() + except EOFError, x: + raise SSHException('EOF during negotiation') + self._log(INFO, 'Opened sftp connection (server version %d)' % server_version) - def from_transport(selfclass, t): + def from_transport(cls, t): """ Create an SFTP client channel from an open L{Transport}. - @param t: an open L{Transport} which is already authenticated. + @param t: an open L{Transport} which is already authenticated @type t: L{Transport} @return: a new L{SFTPClient} object, referring to an sftp session - (channel) across the transport. + (channel) across the transport @rtype: L{SFTPClient} """ chan = t.open_session() if chan is None: return None - if not chan.invoke_subsystem('sftp'): - raise SFTPError('Failed to invoke sftp subsystem') - return selfclass(chan) + chan.invoke_subsystem('sftp') + return cls(chan) from_transport = classmethod(from_transport) + + def _log(self, level, msg, *args): + super(SFTPClient, self)._log(level, "[chan %s] " + msg, *([ self.sock.get_name() ] + list(args))) def close(self): """ @@ -98,7 +114,20 @@ class SFTPClient (BaseSFTP): @since: 1.4 """ + self._log(INFO, 'sftp session closed.') self.sock.close() + + def get_channel(self): + """ + Return the underlying L{Channel} object for this SFTP session. This + might be useful for doing things like setting a timeout on the channel. + + @return: the SSH channel + @rtype: L{Channel} + + @since: 1.7.1 + """ + return self.sock def listdir(self, path='.'): """ @@ -121,6 +150,11 @@ class SFTPClient (BaseSFTP): files in the given C{path}. The list is in arbitrary order. It does not include the special entries C{'.'} and C{'..'} even if they are present in the folder. + + The returned L{SFTPAttributes} objects will each have an additional + field: C{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. @param path: path to list (defaults to C{'.'}) @type path: str @@ -130,6 +164,7 @@ class SFTPClient (BaseSFTP): @since: 1.2 """ path = self._adjust_cwd(path) + self._log(DEBUG, 'listdir(%r)' % path) t, msg = self._request(CMD_OPENDIR, path) if t != CMD_HANDLE: raise SFTPError('Expected handle') @@ -147,13 +182,13 @@ class SFTPClient (BaseSFTP): for i in range(count): filename = _to_unicode(msg.get_string()) longname = _to_unicode(msg.get_string()) - attr = SFTPAttributes._from_msg(msg, filename) + attr = SFTPAttributes._from_msg(msg, filename, longname) if (filename != '.') and (filename != '..'): filelist.append(attr) self._request(CMD_CLOSE, handle) return filelist - def file(self, filename, mode='r', bufsize=-1): + def open(self, filename, mode='r', bufsize=-1): """ 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 @@ -177,18 +212,19 @@ class SFTPClient (BaseSFTP): buffering, C{1} uses line buffering, and any number greater than 1 (C{>1}) uses that specific buffer size. - @param filename: name of the file to open. - @type filename: string - @param mode: mode (python-style) to open in. - @type mode: string + @param filename: name of the file to open + @type filename: str + @param mode: mode (python-style) to open in + @type mode: str @param bufsize: desired buffering (-1 = default buffer size) @type bufsize: int - @return: a file object representing the open file. + @return: a file object representing the open file @rtype: SFTPFile @raise IOError: if the file could not be opened. """ filename = self._adjust_cwd(filename) + self._log(DEBUG, 'open(%r, %r)' % (filename, mode)) imode = 0 if ('r' in mode) or ('+' in mode): imode |= SFTP_FLAG_READ @@ -205,23 +241,24 @@ class SFTPClient (BaseSFTP): if t != CMD_HANDLE: raise SFTPError('Expected handle') handle = msg.get_string() + self._log(DEBUG, 'open(%r, %r) -> %s' % (filename, mode, hexlify(handle))) return SFTPFile(self, handle, mode, bufsize) - # python has migrated toward file() instead of open(). - # and really, that's more easily identifiable. - open = file + # python continues to vacillate about "open" vs "file"... + file = open def remove(self, path): """ - Remove the file at the given path. + Remove the file at the given path. This only works on files; for + removing folders (directories), use L{rmdir}. - @param path: path (absolute or relative) of the file to remove. - @type path: string + @param path: path (absolute or relative) of the file to remove + @type path: str - @raise IOError: if the path refers to a folder (directory). Use - L{rmdir} to remove a folder. + @raise IOError: if the path refers to a folder (directory) """ path = self._adjust_cwd(path) + self._log(DEBUG, 'remove(%r)' % path) self._request(CMD_REMOVE, path) unlink = remove @@ -230,16 +267,17 @@ class SFTPClient (BaseSFTP): """ Rename a file or folder from C{oldpath} to C{newpath}. - @param oldpath: existing name of the file or folder. - @type oldpath: string - @param newpath: new name for the file or folder. - @type newpath: string + @param oldpath: existing name of the file or folder + @type oldpath: str + @param newpath: new name for the file or folder + @type newpath: str @raise IOError: if C{newpath} is a folder, or something else goes - wrong. + wrong """ oldpath = self._adjust_cwd(oldpath) newpath = self._adjust_cwd(newpath) + self._log(DEBUG, 'rename(%r, %r)' % (oldpath, newpath)) self._request(CMD_RENAME, oldpath, newpath) def mkdir(self, path, mode=0777): @@ -248,12 +286,13 @@ class SFTPClient (BaseSFTP): The default mode is 0777 (octal). On some systems, mode is ignored. Where it is used, the current umask value is first masked out. - @param path: name of the folder to create. - @type path: string - @param mode: permissions (posix-style) for the newly-created folder. + @param path: name of the folder to create + @type path: str + @param mode: permissions (posix-style) for the newly-created folder @type mode: int """ path = self._adjust_cwd(path) + self._log(DEBUG, 'mkdir(%r, %r)' % (path, mode)) attr = SFTPAttributes() attr.st_mode = mode self._request(CMD_MKDIR, path, attr) @@ -262,10 +301,11 @@ class SFTPClient (BaseSFTP): """ Remove the folder named C{path}. - @param path: name of the folder to remove. - @type path: string + @param path: name of the folder to remove + @type path: str """ path = self._adjust_cwd(path) + self._log(DEBUG, 'rmdir(%r)' % path) self._request(CMD_RMDIR, path) def stat(self, path): @@ -282,12 +322,13 @@ class SFTPClient (BaseSFTP): The fields supported are: C{st_mode}, C{st_size}, C{st_uid}, C{st_gid}, C{st_atime}, and C{st_mtime}. - @param path: the filename to stat. - @type path: string - @return: an object containing attributes about the given file. + @param path: the filename to stat + @type path: str + @return: an object containing attributes about the given file @rtype: SFTPAttributes """ path = self._adjust_cwd(path) + self._log(DEBUG, 'stat(%r)' % path) t, msg = self._request(CMD_STAT, path) if t != CMD_ATTRS: raise SFTPError('Expected attributes') @@ -299,12 +340,13 @@ class SFTPClient (BaseSFTP): following symbolic links (shortcuts). This otherwise behaves exactly the same as L{stat}. - @param path: the filename to stat. - @type path: string - @return: an object containing attributes about the given file. + @param path: the filename to stat + @type path: str + @return: an object containing attributes about the given file @rtype: SFTPAttributes """ path = self._adjust_cwd(path) + self._log(DEBUG, 'lstat(%r)' % path) t, msg = self._request(CMD_LSTAT, path) if t != CMD_ATTRS: raise SFTPError('Expected attributes') @@ -315,12 +357,13 @@ class SFTPClient (BaseSFTP): Create a symbolic link (shortcut) of the C{source} path at C{destination}. - @param source: path of the original file. - @type source: string - @param dest: path of the newly created symlink. - @type dest: string + @param source: path of the original file + @type source: str + @param dest: path of the newly created symlink + @type dest: str """ dest = self._adjust_cwd(dest) + self._log(DEBUG, 'symlink(%r, %r)' % (source, dest)) if type(source) is unicode: source = source.encode('utf-8') self._request(CMD_SYMLINK, source, dest) @@ -331,12 +374,13 @@ class SFTPClient (BaseSFTP): unix-style and identical to those used by python's C{os.chmod} function. - @param path: path of the file to change the permissions of. - @type path: string - @param mode: new permissions. + @param path: path of the file to change the permissions of + @type path: str + @param mode: new permissions @type mode: int """ path = self._adjust_cwd(path) + self._log(DEBUG, 'chmod(%r, %r)' % (path, mode)) attr = SFTPAttributes() attr.st_mode = mode self._request(CMD_SETSTAT, path, attr) @@ -348,14 +392,15 @@ class SFTPClient (BaseSFTP): only want to change one, use L{stat} first to retrieve the current owner and group. - @param path: path of the file to change the owner and group of. - @type path: string + @param path: path of the file to change the owner and group of + @type path: str @param uid: new owner's uid @type uid: int @param gid: new group id @type gid: int """ path = self._adjust_cwd(path) + self._log(DEBUG, 'chown(%r, %r, %r)' % (path, uid, gid)) attr = SFTPAttributes() attr.st_uid, attr.st_gid = uid, gid self._request(CMD_SETSTAT, path, attr) @@ -369,31 +414,50 @@ class SFTPClient (BaseSFTP): modified times, respectively. This bizarre API is mimicked from python for the sake of consistency -- I apologize. - @param path: path of the file to modify. - @type path: string + @param path: path of the file to modify + @type path: str @param times: C{None} or a tuple of (access time, modified time) in - standard internet epoch time (seconds since 01 January 1970 GMT). - @type times: tuple of int + standard internet epoch time (seconds since 01 January 1970 GMT) + @type times: tuple(int) """ path = self._adjust_cwd(path) if times is None: times = (time.time(), time.time()) + self._log(DEBUG, 'utime(%r, %r)' % (path, times)) attr = SFTPAttributes() attr.st_atime, attr.st_mtime = times self._request(CMD_SETSTAT, path, attr) + def truncate(self, path, size): + """ + Change the size of the file specified by C{path}. This usually extends + or shrinks the size of the file, just like the C{truncate()} method on + python file objects. + + @param path: path of the file to modify + @type path: str + @param size: the new size of the file + @type size: int or long + """ + path = self._adjust_cwd(path) + self._log(DEBUG, 'truncate(%r, %r)' % (path, size)) + attr = SFTPAttributes() + attr.st_size = size + self._request(CMD_SETSTAT, path, attr) + def readlink(self, path): """ Return the target of a symbolic link (shortcut). You can use L{symlink} to create these. The result may be either an absolute or relative pathname. - @param path: path of the symbolic link file. + @param path: path of the symbolic link file @type path: str - @return: target path. + @return: target path @rtype: str """ path = self._adjust_cwd(path) + self._log(DEBUG, 'readlink(%r)' % path) t, msg = self._request(CMD_READLINK, path) if t != CMD_NAME: raise SFTPError('Expected name response') @@ -411,14 +475,15 @@ class SFTPClient (BaseSFTP): server is considering to be the "current folder" (by passing C{'.'} as C{path}). - @param path: path to be normalized. + @param path: path to be normalized @type path: str - @return: normalized form of the given path. + @return: normalized form of the given path @rtype: str @raise IOError: if the path can't be resolved on the server """ path = self._adjust_cwd(path) + self._log(DEBUG, 'normalize(%r)' % path) t, msg = self._request(CMD_REALPATH, path) if t != CMD_NAME: raise SFTPError('Expected name response') @@ -457,7 +522,7 @@ class SFTPClient (BaseSFTP): """ return self._cwd - def put(self, localpath, remotepath): + def put(self, localpath, remotepath, callback=None): """ Copy a local file (C{localpath}) to the SFTP server as C{remotepath}. Any exception raised by operations will be passed through. This @@ -469,9 +534,17 @@ class SFTPClient (BaseSFTP): @type localpath: str @param remotepath: the destination path on the SFTP server @type remotepath: 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: an object containing attributes about the given file + (since 1.7.4) + @rtype: SFTPAttributes @since: 1.4 """ + file_size = os.stat(localpath).st_size fl = file(localpath, 'rb') fr = self.file(remotepath, 'wb') fr.set_pipelined(True) @@ -482,13 +555,16 @@ class SFTPClient (BaseSFTP): break fr.write(data) size += len(data) + if callback is not None: + callback(size, file_size) fl.close() fr.close() s = self.stat(remotepath) if s.st_size != size: raise IOError('size mismatch in put! %d != %d' % (s.st_size, size)) + return s - def get(self, remotepath, localpath): + def get(self, remotepath, localpath, callback=None): """ Copy a remote file (C{remotepath}) from the SFTP server to the local host as C{localpath}. Any exception raised by operations will be @@ -498,10 +574,15 @@ class SFTPClient (BaseSFTP): @type remotepath: str @param localpath: the destination path on the local host @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) @since: 1.4 """ fr = self.file(remotepath, 'rb') + file_size = self.stat(remotepath).st_size fr.prefetch() fl = file(localpath, 'wb') size = 0 @@ -511,6 +592,8 @@ class SFTPClient (BaseSFTP): break fl.write(data) size += len(data) + if callback is not None: + callback(size, file_size) fl.close() fr.close() s = os.stat(localpath) @@ -552,7 +635,10 @@ class SFTPClient (BaseSFTP): def _read_response(self, waitfor=None): while True: - t, data = self._read_packet() + try: + t, data = self._read_packet() + except EOFError, e: + raise SSHException('Server connection dropped: %s' % (str(e),)) msg = Message(data) num = msg.get_int() if num not in self._expecting: @@ -560,7 +646,7 @@ class SFTPClient (BaseSFTP): self._log(DEBUG, 'Unexpected response #%d' % (num,)) if waitfor is None: # just doing a single check - return + break continue fileobj = self._expecting[num] del self._expecting[num] @@ -573,7 +659,8 @@ class SFTPClient (BaseSFTP): fileobj._async_response(t, msg) if waitfor is None: # just doing a single check - return + break + return (None, None) def _finish_responses(self, fileobj): while fileobj in self._expecting.values(): @@ -610,6 +697,8 @@ class SFTPClient (BaseSFTP): if (len(path) > 0) and (path[0] == '/'): # absolute path return path + if self._cwd == '/': + return self._cwd + path return self._cwd + '/' + path diff --git a/paramiko/sftp_file.py b/paramiko/sftp_file.py index f224f02..cfa7db1 100644 --- a/paramiko/sftp_file.py +++ b/paramiko/sftp_file.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -20,7 +20,11 @@ L{SFTPFile} """ +from binascii import hexlify +import socket import threading +import time + from paramiko.common import * from paramiko.sftp import * from paramiko.file import BufferedFile @@ -43,12 +47,18 @@ class SFTPFile (BufferedFile): BufferedFile._set_mode(self, mode, bufsize) self.pipelined = False self._prefetching = False + self._prefetch_done = False + self._prefetch_data = {} + self._prefetch_reads = [] self._saved_exception = None def __del__(self): - self.close(_async=True) + self._close(async=True) + + def close(self): + self._close(async=False) - def close(self, _async=False): + def _close(self, async=False): # We allow double-close without signaling an error, because real # Python file objects do. However, we must protect against actually # sending multiple CMD_CLOSE packets, because after we close our @@ -58,11 +68,12 @@ class SFTPFile (BufferedFile): # __del__.) if self._closed: return + self.sftp._log(DEBUG, 'close(%s)' % hexlify(self.handle)) if self.pipelined: self.sftp._finish_responses(self) BufferedFile.close(self) try: - if _async: + if async: # GC'd file handle could be called from an arbitrary thread -- don't wait for a response self.sftp._async_request(type(None), CMD_CLOSE, self.handle) else: @@ -70,34 +81,77 @@ class SFTPFile (BufferedFile): except EOFError: # may have outlived the Transport connection pass - except IOError: + except (IOError, socket.error): # may have outlived the Transport connection pass + def _data_in_prefetch_requests(self, offset, size): + k = [i for i in self._prefetch_reads if i[0] <= offset] + if len(k) == 0: + return False + k.sort(lambda x, y: cmp(x[0], y[0])) + buf_offset, buf_size = k[-1] + if buf_offset + buf_size <= offset: + # prefetch request ends before this one begins + return False + if buf_offset + buf_size >= offset + size: + # inclusive + return True + # well, we have part of the request. see if another chunk has the rest. + return self._data_in_prefetch_requests(buf_offset + buf_size, offset + size - buf_offset - buf_size) + + def _data_in_prefetch_buffers(self, offset): + """ + if a block of data is present in the prefetch buffers, at the given + offset, return the offset of the relevant prefetch buffer. otherwise, + return None. this guarantees nothing about the number of bytes + collected in the prefetch buffer so far. + """ + k = [i for i in self._prefetch_data.keys() if i <= offset] + if len(k) == 0: + return None + index = max(k) + buf_offset = offset - index + if buf_offset >= len(self._prefetch_data[index]): + # it's not here + return None + return index + def _read_prefetch(self, size): + """ + read data out of the prefetch buffer, if possible. if the data isn't + in the buffer, return None. otherwise, behaves like a normal read. + """ # while not closed, and haven't fetched past the current position, and haven't reached EOF... - while (self._prefetch_so_far <= self._realpos) and \ - (self._prefetch_so_far < self._prefetch_size) and not self._closed: + while True: + offset = self._data_in_prefetch_buffers(self._realpos) + if offset is not None: + break + if self._prefetch_done or self._closed: + break self.sftp._read_response() - self._check_exception() - k = self._prefetch_data.keys() - k.sort() - while (len(k) > 0) and (k[0] + len(self._prefetch_data[k[0]]) <= self._realpos): - # done with that block - del self._prefetch_data[k[0]] - k.pop(0) - if len(k) == 0: + self._check_exception() + if offset is None: self._prefetching = False - return '' - assert k[0] <= self._realpos - buf_offset = self._realpos - k[0] - buf_length = len(self._prefetch_data[k[0]]) - buf_offset - return self._prefetch_data[k[0]][buf_offset : buf_offset + buf_length] + return None + prefetch = self._prefetch_data[offset] + del self._prefetch_data[offset] + + buf_offset = self._realpos - offset + if buf_offset > 0: + self._prefetch_data[offset] = prefetch[:buf_offset] + prefetch = prefetch[buf_offset:] + if size < len(prefetch): + self._prefetch_data[self._realpos + size] = prefetch[size:] + prefetch = prefetch[:size] + return prefetch def _read(self, size): size = min(size, self.MAX_REQUEST_SIZE) if self._prefetching: - return self._read_prefetch(size) + data = self._read_prefetch(size) + if data is not None: + return data t, msg = self.sftp._request(CMD_READ, self.handle, long(self._realpos), int(size)) if t != CMD_DATA: raise SFTPError('Expected data') @@ -106,8 +160,7 @@ 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])) + 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: @@ -173,6 +226,71 @@ class SFTPFile (BufferedFile): if t != CMD_ATTRS: raise SFTPError('Expected attributes') return SFTPAttributes._from_msg(msg) + + def chmod(self, mode): + """ + Change the mode (permissions) of this file. The permissions are + unix-style and identical to those used by python's C{os.chmod} + function. + + @param mode: new permissions + @type mode: int + """ + self.sftp._log(DEBUG, 'chmod(%s, %r)' % (hexlify(self.handle), mode)) + attr = SFTPAttributes() + attr.st_mode = mode + self.sftp._request(CMD_FSETSTAT, self.handle, attr) + + def chown(self, uid, gid): + """ + Change the owner (C{uid}) and group (C{gid}) of this file. As with + python's C{os.chown} function, you must pass both arguments, so if you + only want to change one, use L{stat} first to retrieve the current + owner and group. + + @param uid: new owner's uid + @type uid: int + @param gid: new group id + @type gid: int + """ + self.sftp._log(DEBUG, 'chown(%s, %r, %r)' % (hexlify(self.handle), uid, gid)) + attr = SFTPAttributes() + attr.st_uid, attr.st_gid = uid, gid + self.sftp._request(CMD_FSETSTAT, self.handle, attr) + + def utime(self, times): + """ + Set the access and modified times of this file. If + C{times} is C{None}, then the file's access and modified times are set + to the current time. Otherwise, C{times} must be a 2-tuple of numbers, + of the form C{(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. + + @param times: C{None} or a tuple of (access time, modified time) in + standard internet epoch time (seconds since 01 January 1970 GMT) + @type times: tuple(int) + """ + if times is None: + times = (time.time(), time.time()) + self.sftp._log(DEBUG, 'utime(%s, %r)' % (hexlify(self.handle), times)) + attr = SFTPAttributes() + attr.st_atime, attr.st_mtime = times + self.sftp._request(CMD_FSETSTAT, self.handle, attr) + + def truncate(self, size): + """ + Change the size of this file. This usually extends + or shrinks the size of the file, just like the C{truncate()} method on + python file objects. + + @param size: the new size of the file + @type size: int or long + """ + self.sftp._log(DEBUG, 'truncate(%s, %r)' % (hexlify(self.handle), size)) + attr = SFTPAttributes() + attr.st_size = size + self.sftp._request(CMD_FSETSTAT, self.handle, attr) def check(self, hash_algorithm, offset=0, length=0, block_size=0): """ @@ -255,26 +373,60 @@ class SFTPFile (BufferedFile): 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 L{read} + method. Once data has been read, it's removed from the buffer. The + data may be read in a random order (using L{seek}); chunks of the + buffer that haven't been read will continue to be buffered. + @since: 1.5.1 """ size = self.stat().st_size # queue up async reads for the rest of the file - self._prefetching = True - self._prefetch_so_far = self._realpos - self._prefetch_size = size - self._prefetch_data = {} - t = threading.Thread(target=self._prefetch) - t.setDaemon(True) - t.start() - - def _prefetch(self): + chunks = [] n = self._realpos - size = self._prefetch_size while n < size: chunk = min(self.MAX_REQUEST_SIZE, size - n) - self.sftp._async_request(self, CMD_READ, self.handle, long(n), int(chunk)) + chunks.append((n, chunk)) n += chunk + if len(chunks) > 0: + self._start_prefetch(chunks) + + def readv(self, chunks): + """ + Read a set of blocks from the file by (offset, length). This is more + efficient than doing a series of L{seek} and L{read} calls, since the + prefetch machinery is used to retrieve all the requested blocks at + once. + + @param chunks: a list of (offset, length) tuples indicating which + sections of the file to read + @type chunks: list(tuple(long, int)) + @return: a list of blocks read, in the same order as in C{chunks} + @rtype: list(str) + + @since: 1.5.4 + """ + self.sftp._log(DEBUG, 'readv(%s, %r)' % (hexlify(self.handle), chunks)) + read_chunks = [] + for offset, size in chunks: + # don't fetch data that's already in the prefetch buffer + if self._data_in_prefetch_buffers(offset) or self._data_in_prefetch_requests(offset, size): + continue + + # break up anything larger than the max read size + while size > 0: + chunk_size = min(size, self.MAX_REQUEST_SIZE) + read_chunks.append((offset, chunk_size)) + offset += chunk_size + size -= chunk_size + + self._start_prefetch(read_chunks) + # now we can just devolve to a bunch of read()s :) + for x in chunks: + self.seek(x[0]) + yield self.read(x[1]) + ### internals... @@ -285,6 +437,21 @@ class SFTPFile (BufferedFile): except: return 0 + def _start_prefetch(self, chunks): + self._prefetching = True + self._prefetch_done = False + self._prefetch_reads.extend(chunks) + + t = threading.Thread(target=self._prefetch_thread, args=(chunks,)) + t.setDaemon(True) + t.start() + + def _prefetch_thread(self, chunks): + # do these read requests in a temporary thread because there may be + # a lot of them, so it may block. + for offset, length in chunks: + self.sftp._async_request(self, CMD_READ, self.handle, long(offset), int(length)) + def _async_response(self, t, msg): if t == CMD_STATUS: # save exception and re-raise it on next file operation @@ -296,8 +463,10 @@ class SFTPFile (BufferedFile): if t != CMD_DATA: raise SFTPError('Expected data') data = msg.get_string() - self._prefetch_data[self._prefetch_so_far] = data - self._prefetch_so_far += len(data) + offset, length = self._prefetch_reads.pop(0) + self._prefetch_data[offset] = data + if len(self._prefetch_reads) == 0: + self._prefetch_done = True def _check_exception(self): "if there's a saved exception, raise & clear it" diff --git a/paramiko/sftp_handle.py b/paramiko/sftp_handle.py index e1d93e9..e976f43 100644 --- a/paramiko/sftp_handle.py +++ b/paramiko/sftp_handle.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -35,7 +35,16 @@ class SFTPHandle (object): Server implementations can (and should) subclass SFTPHandle to implement features of a file handle, like L{stat} or L{chattr}. """ - def __init__(self): + def __init__(self, flags=0): + """ + Create a new file handle representing a local file being served over + SFTP. If C{flags} is passed in, it's used to determine if the file + is open in append mode. + + @param flags: optional flags as passed to L{SFTPServerInterface.open} + @type flags: int + """ + self.__flags = flags self.__name = None # only for handles to folders: self.__files = { } @@ -81,15 +90,16 @@ class SFTPHandle (object): @return: data read from the file, or an SFTP error code. @rtype: str """ - if not hasattr(self, 'readfile') or (self.readfile is None): + readfile = getattr(self, 'readfile', None) + if readfile is None: return SFTP_OP_UNSUPPORTED try: if self.__tell is None: - self.__tell = self.readfile.tell() + self.__tell = readfile.tell() if offset != self.__tell: - self.readfile.seek(offset) + readfile.seek(offset) self.__tell = offset - data = self.readfile.read(length) + data = readfile.read(length) except IOError, e: self.__tell = None return SFTPServer.convert_errno(e.errno) @@ -116,20 +126,24 @@ class SFTPHandle (object): @type data: str @return: an SFTP error code like L{SFTP_OK}. """ - if not hasattr(self, 'writefile') or (self.writefile is None): + writefile = getattr(self, 'writefile', None) + if writefile is None: return SFTP_OP_UNSUPPORTED try: - if self.__tell is None: - self.__tell = self.writefile.tell() - if offset != self.__tell: - self.writefile.seek(offset) - self.__tell = offset - self.writefile.write(data) - self.writefile.flush() + # in append mode, don't care about seeking + if (self.__flags & os.O_APPEND) == 0: + if self.__tell is None: + self.__tell = writefile.tell() + if offset != self.__tell: + writefile.seek(offset) + self.__tell = offset + writefile.write(data) + writefile.flush() except IOError, e: self.__tell = None return SFTPServer.convert_errno(e.errno) - self.__tell += len(data) + if self.__tell is not None: + self.__tell += len(data) return SFTP_OK def stat(self): diff --git a/paramiko/sftp_server.py b/paramiko/sftp_server.py index 5905843..099ac12 100644 --- a/paramiko/sftp_server.py +++ b/paramiko/sftp_server.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -66,15 +66,21 @@ class SFTPServer (BaseSFTP, SubsystemHandler): BaseSFTP.__init__(self) SubsystemHandler.__init__(self, channel, name, server) transport = channel.get_transport() - self.logger = util.get_logger(transport.get_log_channel() + '.' + - channel.get_name() + '.sftp') + self.logger = util.get_logger(transport.get_log_channel() + '.sftp') self.ultra_debug = transport.get_hexdump() self.next_handle = 1 # map of handle-string to SFTPHandle for files & folders: self.file_table = { } self.folder_table = { } self.server = sftp_si(server, *largs, **kwargs) - + + def _log(self, level, msg): + if issubclass(type(msg), list): + for m in msg: + super(SFTPServer, self)._log(level, "[chan " + self.sock.get_name() + "] " + m) + else: + super(SFTPServer, self)._log(level, "[chan " + self.sock.get_name() + "] " + msg) + def start_subsystem(self, name, transport, channel): self.sock = channel self._log(DEBUG, 'Started sftp server on channel %s' % repr(channel)) @@ -92,10 +98,20 @@ class SFTPServer (BaseSFTP, SubsystemHandler): return msg = Message(data) request_number = msg.get_int() - self._process(t, request_number, msg) + try: + self._process(t, request_number, msg) + except Exception, e: + self._log(DEBUG, 'Exception in server processing: ' + str(e)) + self._log(DEBUG, util.tb_strings()) + # send some kind of failure message, at least + try: + self._send_status(request_number, SFTP_FAILURE) + except: + pass def finish_subsystem(self): self.server.session_ended() + super(SFTPServer, self).finish_subsystem() # close any file handles that were left open (so we can return them to the OS quickly) for f in self.file_table.itervalues(): f.close() @@ -118,7 +134,7 @@ class SFTPServer (BaseSFTP, SubsystemHandler): if e == errno.EACCES: # permission denied return SFTP_PERMISSION_DENIED - elif e == errno.ENOENT: + elif (e == errno.ENOENT) or (e == errno.ENOTDIR): # no such file return SFTP_NO_SUCH_FILE else: @@ -141,12 +157,16 @@ class SFTPServer (BaseSFTP, SubsystemHandler): @param attr: attributes to change. @type attr: L{SFTPAttributes} """ - if attr._flags & attr.FLAG_PERMISSIONS: - os.chmod(filename, attr.st_mode) - if attr._flags & attr.FLAG_UIDGID: - os.chown(filename, attr.st_uid, attr.st_gid) + if sys.platform != 'win32': + # mode operations are meaningless on win32 + if attr._flags & attr.FLAG_PERMISSIONS: + os.chmod(filename, attr.st_mode) + if attr._flags & attr.FLAG_UIDGID: + os.chown(filename, attr.st_uid, attr.st_gid) if attr._flags & attr.FLAG_AMTIME: os.utime(filename, (attr.st_atime, attr.st_mtime)) + if attr._flags & attr.FLAG_SIZE: + open(filename, 'w+').truncate(attr.st_size) set_file_attr = staticmethod(set_file_attr) @@ -184,8 +204,12 @@ class SFTPServer (BaseSFTP, SubsystemHandler): def _send_status(self, request_number, code, desc=None): if desc is None: - desc = SFTP_DESC[code] - self._response(request_number, CMD_STATUS, code, desc) + try: + desc = SFTP_DESC[code] + except IndexError: + desc = 'Unknown' + # some clients expect a "langauge" tag at the end (but don't mind it being blank) + self._response(request_number, CMD_STATUS, code, desc, '') def _open_folder(self, request_number, path): resp = self.server.list_folder(path) @@ -222,7 +246,7 @@ class SFTPServer (BaseSFTP, SubsystemHandler): start = msg.get_int64() length = msg.get_int64() block_size = msg.get_int() - if not self.file_table.has_key(handle): + if handle not in self.file_table: self._send_status(request_number, SFTP_BAD_MESSAGE, 'Invalid handle') return f = self.file_table[handle] @@ -246,29 +270,29 @@ class SFTPServer (BaseSFTP, SubsystemHandler): self._send_status(request_number, SFTP_FAILURE, 'Block size too small') return - sum = '' + sum_out = '' offset = start while offset < start + length: blocklen = min(block_size, start + length - offset) # don't try to read more than about 64KB at a time chunklen = min(blocklen, 65536) count = 0 - hash = alg.new() + hash_obj = alg.new() while count < blocklen: data = f.read(offset, chunklen) if not type(data) is str: self._send_status(request_number, data, 'Unable to hash file') return - hash.update(data) + hash_obj.update(data) count += len(data) offset += count - sum += hash.digest() + sum_out += hash_obj.digest() msg = Message() msg.add_int(request_number) msg.add_string('check-file') msg.add_string(algname) - msg.add_bytes(sum) + msg.add_bytes(sum_out) self._send_packet(CMD_EXTENDED_REPLY, str(msg)) def _convert_pflags(self, pflags): @@ -298,11 +322,11 @@ class SFTPServer (BaseSFTP, SubsystemHandler): self._send_handle_response(request_number, self.server.open(path, flags, attr)) elif t == CMD_CLOSE: handle = msg.get_string() - if self.folder_table.has_key(handle): + if handle in self.folder_table: del self.folder_table[handle] self._send_status(request_number, SFTP_OK) return - if self.file_table.has_key(handle): + if handle in self.file_table: self.file_table[handle].close() del self.file_table[handle] self._send_status(request_number, SFTP_OK) @@ -312,7 +336,7 @@ class SFTPServer (BaseSFTP, SubsystemHandler): handle = msg.get_string() offset = msg.get_int64() length = msg.get_int() - if not self.file_table.has_key(handle): + if handle not in self.file_table: self._send_status(request_number, SFTP_BAD_MESSAGE, 'Invalid handle') return data = self.file_table[handle].read(offset, length) @@ -327,7 +351,7 @@ class SFTPServer (BaseSFTP, SubsystemHandler): handle = msg.get_string() offset = msg.get_int64() data = msg.get_string() - if not self.file_table.has_key(handle): + if handle not in self.file_table: self._send_status(request_number, SFTP_BAD_MESSAGE, 'Invalid handle') return self._send_status(request_number, self.file_table[handle].write(offset, data)) @@ -351,7 +375,7 @@ class SFTPServer (BaseSFTP, SubsystemHandler): return elif t == CMD_READDIR: handle = msg.get_string() - if not self.folder_table.has_key(handle): + if handle not in self.folder_table: self._send_status(request_number, SFTP_BAD_MESSAGE, 'Invalid handle') return folder = self.folder_table[handle] @@ -372,7 +396,7 @@ class SFTPServer (BaseSFTP, SubsystemHandler): self._send_status(request_number, resp) elif t == CMD_FSTAT: handle = msg.get_string() - if not self.file_table.has_key(handle): + if handle not in self.file_table: self._send_status(request_number, SFTP_BAD_MESSAGE, 'Invalid handle') return resp = self.file_table[handle].stat() @@ -387,7 +411,7 @@ class SFTPServer (BaseSFTP, SubsystemHandler): elif t == CMD_FSETSTAT: handle = msg.get_string() attr = SFTPAttributes._from_msg(msg) - if not self.file_table.has_key(handle): + if handle not in self.file_table: self._response(request_number, SFTP_BAD_MESSAGE, 'Invalid handle') return self._send_status(request_number, self.file_table[handle].chattr(attr)) @@ -412,7 +436,7 @@ class SFTPServer (BaseSFTP, SubsystemHandler): if tag == 'check-file': self._check_file(request_number, msg) else: - send._send_status(request_number, SFTP_OP_UNSUPPORTED) + self._send_status(request_number, SFTP_OP_UNSUPPORTED) else: self._send_status(request_number, SFTP_OP_UNSUPPORTED) diff --git a/paramiko/sftp_si.py b/paramiko/sftp_si.py index 16005d4..47dd25d 100644 --- a/paramiko/sftp_si.py +++ b/paramiko/sftp_si.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -36,6 +36,9 @@ class SFTPServerInterface (object): 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. """ def __init__ (self, server, *largs, **kwargs): @@ -268,9 +271,13 @@ class SFTPServerInterface (object): The default implementation returns C{os.path.normpath('/' + path)}. """ if os.path.isabs(path): - return os.path.normpath(path) + out = os.path.normpath(path) else: - return os.path.normpath('/' + path) + out = os.path.normpath('/' + path) + if sys.platform == 'win32': + # on windows, normalize backslashes to sftp/posix format + out = out.replace('\\', '/') + return out def readlink(self, path): """ diff --git a/paramiko/ssh_exception.py b/paramiko/ssh_exception.py index 900d4a0..e3120bb 100644 --- a/paramiko/ssh_exception.py +++ b/paramiko/ssh_exception.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -28,14 +28,25 @@ class SSHException (Exception): pass -class PasswordRequiredException (SSHException): +class AuthenticationException (SSHException): + """ + 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 + """ + pass + + +class PasswordRequiredException (AuthenticationException): """ Exception raised when a password is needed to unlock a private key file. """ pass -class BadAuthenticationType (SSHException): +class BadAuthenticationType (AuthenticationException): """ 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 @@ -51,19 +62,54 @@ class BadAuthenticationType (SSHException): allowed_types = [] def __init__(self, explanation, types): - SSHException.__init__(self, explanation) + AuthenticationException.__init__(self, explanation) self.allowed_types = types def __str__(self): return SSHException.__str__(self) + ' (allowed_types=%r)' % self.allowed_types -class PartialAuthentication (SSHException): +class PartialAuthentication (AuthenticationException): """ An internal exception thrown in the case of partial authentication. """ allowed_types = [] def __init__(self, types): - SSHException.__init__(self, 'partial authentication') + AuthenticationException.__init__(self, 'partial authentication') self.allowed_types = types + + +class ChannelException (SSHException): + """ + Exception raised when an attempt to open a new L{Channel} fails. + + @ivar code: the error code returned by the server + @type code: int + + @since: 1.6 + """ + def __init__(self, code, text): + SSHException.__init__(self, text) + self.code = code + + +class BadHostKeyException (SSHException): + """ + The host key given by the SSH server did not match what we were expecting. + + @ivar hostname: the hostname of the SSH server + @type hostname: str + @ivar key: the host key presented by the server + @type key: L{PKey} + @ivar expected_key: the host key expected + @type expected_key: L{PKey} + + @since: 1.6 + """ + def __init__(self, hostname, got_key, expected_key): + SSHException.__init__(self, 'Host key for server %s does not match!' % hostname) + self.hostname = hostname + self.key = got_key + self.expected_key = expected_key + diff --git a/paramiko/transport.py b/paramiko/transport.py index 8714a96..a18e05b 100644 --- a/paramiko/transport.py +++ b/paramiko/transport.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -30,19 +30,20 @@ import time import weakref from paramiko import util +from paramiko.auth_handler import AuthHandler +from paramiko.channel import Channel from paramiko.common import * from paramiko.compress import ZlibCompressor, ZlibDecompressor -from paramiko.ssh_exception import SSHException, BadAuthenticationType -from paramiko.message import Message -from paramiko.channel import Channel -from paramiko.sftp_client import SFTPClient -from paramiko.packet import Packetizer, NeedRekeyException -from paramiko.rsakey import RSAKey from paramiko.dsskey import DSSKey -from paramiko.kex_group1 import KexGroup1 from paramiko.kex_gex import KexGex +from paramiko.kex_group1 import KexGroup1 +from paramiko.message import Message +from paramiko.packet import Packetizer, NeedRekeyException from paramiko.primes import ModulusPack -from paramiko.auth_handler import AuthHandler +from paramiko.rsakey import RSAKey +from paramiko.server import ServerInterface +from paramiko.sftp_client import SFTPClient +from paramiko.ssh_exception import SSHException, BadAuthenticationType, ChannelException # these come from PyCrypt # http://www.amk.ca/python/writing/pycrypt/ @@ -50,7 +51,7 @@ from paramiko.auth_handler import AuthHandler # PyCrypt compiled for Win32 can be downloaded from the HashTar homepage: # http://nitace.bsd.uchicago.edu:8080/hashtar from Crypto.Cipher import Blowfish, AES, DES3 -from Crypto.Hash import SHA, MD5, HMAC +from Crypto.Hash import SHA, MD5 # for thread cleanup @@ -73,8 +74,6 @@ class SecurityOptions (object): If you try to add an algorithm that paramiko doesn't recognize, C{ValueError} will be raised. If you try to assign something besides a tuple to one of the fields, C{TypeError} will be raised. - - @since: ivysaur """ __slots__ = [ 'ciphers', 'digests', 'key_types', 'kex', 'compression', '_transport' ] @@ -110,7 +109,8 @@ class SecurityOptions (object): if type(x) is not tuple: raise TypeError('expected tuple or list') possible = getattr(self._transport, orig).keys() - if len(filter(lambda n: n not in possible, x)) > 0: + forbidden = filter(lambda n: n not in possible, x) + if len(forbidden) > 0: raise ValueError('unknown cipher') setattr(self._transport, name, x) @@ -140,6 +140,51 @@ class SecurityOptions (object): "Compression algorithms") +class ChannelMap (object): + def __init__(self): + # (id -> Channel) + self._map = weakref.WeakValueDictionary() + self._lock = threading.Lock() + + def put(self, chanid, chan): + self._lock.acquire() + try: + self._map[chanid] = chan + finally: + self._lock.release() + + def get(self, chanid): + self._lock.acquire() + try: + return self._map.get(chanid, None) + finally: + self._lock.release() + + def delete(self, chanid): + self._lock.acquire() + try: + try: + del self._map[chanid] + except KeyError: + pass + finally: + self._lock.release() + + def values(self): + self._lock.acquire() + try: + return self._map.values() + finally: + self._lock.release() + + def __len__(self): + self._lock.acquire() + try: + return len(self._map) + finally: + self._lock.release() + + class Transport (threading.Thread): """ An SSH Transport attaches to a stream (usually a socket), negotiates an @@ -149,7 +194,7 @@ class Transport (threading.Thread): """ _PROTO_ID = '2.0' - _CLIENT_ID = 'paramiko_1.5.2' + _CLIENT_ID = 'paramiko_1.7.4' _preferred_ciphers = ( 'aes128-cbc', 'blowfish-cbc', 'aes256-cbc', '3des-cbc' ) _preferred_macs = ( 'hmac-sha1', 'hmac-md5', 'hmac-sha1-96', 'hmac-md5-96' ) @@ -245,25 +290,41 @@ class Transport (threading.Thread): self.sock.settimeout(0.1) except AttributeError: pass + # negotiated crypto parameters self.packetizer = Packetizer(sock) self.local_version = 'SSH-' + self._PROTO_ID + '-' + self._CLIENT_ID self.remote_version = '' self.local_cipher = self.remote_cipher = '' self.local_kex_init = self.remote_kex_init = None + self.local_mac = self.remote_mac = None + self.local_compression = self.remote_compression = None self.session_id = None - # /negotiated crypto parameters - self.expected_packet = 0 + self.host_key_type = None + self.host_key = None + + # state used during negotiation + self.kex_engine = None + self.H = None + self.K = None + self.active = False self.initial_kex_done = False self.in_kex = False + self.authenticated = False + self._expected_packet = tuple() self.lock = threading.Lock() # synchronization (always higher level than write_lock) - self.channels = weakref.WeakValueDictionary() # (id -> Channel) + + # tracking open channels + self._channels = ChannelMap() self.channel_events = { } # (id -> Event) self.channels_seen = { } # (id -> True) - self.channel_counter = 1 + self._channel_counter = 1 self.window_size = 65536 self.max_packet_size = 34816 + self._x11_handler = None + self._tcp_handler = None + self.saved_exception = None self.clear_to_send = threading.Event() self.clear_to_send_lock = threading.Lock() @@ -271,9 +332,10 @@ class Transport (threading.Thread): self.logger = util.get_logger(self.log_name) self.packetizer.set_log(self.logger) self.auth_handler = None - self.authenticated = False - # user-defined event callbacks: - self.completion_event = None + self.global_response = None # response Message from an arbitrary global request + self.completion_event = None # user-defined event callbacks + self.banner_timeout = 15 # how long (seconds) to wait for the SSH banner + # server mode: self.server_mode = False self.server_object = None @@ -282,9 +344,6 @@ class Transport (threading.Thread): self.server_accept_cv = threading.Condition(self.lock) self.subsystem_table = { } - def __del__(self): - self.close() - def __repr__(self): """ Returns a string representation of this object, for debugging. @@ -299,16 +358,26 @@ class Transport (threading.Thread): out += ' (cipher %s, %d bits)' % (self.local_cipher, self._cipher_info[self.local_cipher]['key-size'] * 8) if self.is_authenticated(): - if len(self.channels) == 1: - out += ' (active; 1 open channel)' - else: - out += ' (active; %d open channels)' % len(self.channels) + out += ' (active; %d open channel(s))' % len(self._channels) elif self.initial_kex_done: out += ' (connected; awaiting auth)' else: out += ' (connecting)' out += '>' return out + + def atfork(self): + """ + 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 + """ + self.sock.close() + self.close() def get_security_options(self): """ @@ -319,8 +388,6 @@ class Transport (threading.Thread): @return: an object that can be used to change the preferred algorithms for encryption, digest (hash), public key, and key exchange. @rtype: L{SecurityOptions} - - @since: ivysaur """ return SecurityOptions(self) @@ -471,7 +538,8 @@ class Transport (threading.Thread): try: return self.server_key_dict[self.host_key_type] except KeyError: - return None + pass + return None def load_server_moduli(filename=None): """ @@ -496,8 +564,6 @@ class Transport (threading.Thread): @return: True if a moduli file was successfully loaded; False otherwise. @rtype: bool - - @since: doduo @note: This has no effect when used in client mode. """ @@ -521,14 +587,13 @@ class Transport (threading.Thread): """ Close this session, and any open channels that are tied to it. """ + if not self.active: + return self.active = False - # since this may be called from __del__, can't assume any attributes exist - try: - self.packetizer.close() - for chan in self.channels.values(): - chan._unlink() - except AttributeError: - pass + self.packetizer.close() + self.join() + for chan in self._channels.values(): + chan._unlink() def get_remote_server_key(self): """ @@ -541,7 +606,7 @@ class Transport (threading.Thread): @raise SSHException: if no session is currently active. - @return: public key of the remote server. + @return: public key of the remote server @rtype: L{PKey } """ if (not self.active) or (not self.initial_kex_done): @@ -553,7 +618,7 @@ class Transport (threading.Thread): Return true if this session is active (open). @return: True if the session is still active (open); False if the - session is closed. + session is closed @rtype: bool """ return self.active @@ -563,12 +628,43 @@ class Transport (threading.Thread): Request a new channel to the server, of type C{"session"}. This is just an alias for C{open_channel('session')}. - @return: a new L{Channel} on success, or C{None} if the request is - rejected or the session ends prematurely. + @return: a new L{Channel} @rtype: L{Channel} + + @raise SSHException: if the request is rejected or the session ends + prematurely """ return self.open_channel('session') + def open_x11_channel(self, src_addr=None): + """ + Request a new channel to the client, of type C{"x11"}. This + is just an alias for C{open_channel('x11', src_addr=src_addr)}. + + @param src_addr: the source address of the x11 server (port is the + x11 port, ie. 6010) + @type src_addr: (str, int) + @return: a new L{Channel} + @rtype: L{Channel} + + @raise SSHException: if the request is rejected or the session ends + prematurely + """ + return self.open_channel('x11', src_addr=src_addr) + + 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"}. + This is used after a client has requested port forwarding, for sending + incoming connections back to the client. + + @param src_addr: originator's address + @param src_port: originator's port + @param dest_addr: local (server) connected address + @param dest_port: local (server) connected port + """ + return self.open_channel('forwarded-tcpip', (dest_addr, dest_port), (src_addr, src_port)) + def open_channel(self, kind, dest_addr=None, src_addr=None): """ Request a new channel to the server. L{Channel}s are socket-like @@ -577,18 +673,20 @@ class Transport (threading.Thread): L{connect} or L{start_client}) and authenticating. @param kind: the kind of channel requested (usually C{"session"}, - C{"forwarded-tcpip"} or C{"direct-tcpip"}). + C{"forwarded-tcpip"}, C{"direct-tcpip"}, or C{"x11"}) @type kind: str @param dest_addr: the destination address of this port forwarding, if C{kind} is C{"forwarded-tcpip"} or C{"direct-tcpip"} (ignored - for other channel types). + for other channel types) @type dest_addr: (str, int) @param src_addr: the source address of this port forwarding, if - C{kind} is C{"forwarded-tcpip"} or C{"direct-tcpip"}. + C{kind} is C{"forwarded-tcpip"}, C{"direct-tcpip"}, or C{"x11"} @type src_addr: (str, int) - @return: a new L{Channel} on success, or C{None} if the request is - rejected or the session ends prematurely. + @return: a new L{Channel} on success @rtype: L{Channel} + + @raise SSHException: if the request is rejected or the session ends + prematurely """ chan = None if not self.active: @@ -596,11 +694,7 @@ class Transport (threading.Thread): return None self.lock.acquire() try: - chanid = self.channel_counter - while self.channels.has_key(chanid): - self.channel_counter = (self.channel_counter + 1) & 0xffffff - chanid = self.channel_counter - self.channel_counter = (self.channel_counter + 1) & 0xffffff + chanid = self._next_channel() m = Message() m.add_byte(chr(MSG_CHANNEL_OPEN)) m.add_string(kind) @@ -612,7 +706,11 @@ class Transport (threading.Thread): m.add_int(dest_addr[1]) m.add_string(src_addr[0]) m.add_int(src_addr[1]) - self.channels[chanid] = chan = Channel(chanid) + elif kind == 'x11': + m.add_string(src_addr[0]) + m.add_int(src_addr[1]) + chan = Channel(chanid) + self._channels.put(chanid, chan) self.channel_events[chanid] = event = threading.Event() self.channels_seen[chanid] = True chan._set_transport(self) @@ -620,20 +718,84 @@ class Transport (threading.Thread): finally: self.lock.release() self._send_user_message(m) - while 1: + while True: event.wait(0.1); if not self.active: - return None + e = self.get_exception() + if e is None: + e = SSHException('Unable to open channel.') + raise e if event.isSet(): break - try: - self.lock.acquire() - if not self.channels.has_key(chanid): - chan = None - finally: - self.lock.release() - return chan - + chan = self._channels.get(chanid) + if chan is not None: + return chan + e = self.get_exception() + if e is None: + e = SSHException('Unable to open channel.') + raise e + + def 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. + + 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 C{server_addr} and C{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 + L{accept}. + + @param address: the address to bind when forwarding + @type address: str + @param port: the port to forward, or 0 to ask the server to allocate + any port + @type port: int + @param handler: optional handler for incoming forwarded connections + @type handler: function(Channel, (str, int), (str, int)) + @return: the port # allocated by the server + @rtype: int + + @raise SSHException: if the server refused the TCP forward request + """ + if not self.active: + raise SSHException('SSH session not active') + address = str(address) + port = int(port) + response = self.global_request('tcpip-forward', (address, port), wait=True) + if response is None: + raise SSHException('TCP forwarding request denied') + if port == 0: + port = response.get_int() + if handler is None: + def default_handler(channel, (src_addr, src_port), (dest_addr, dest_port)): + self._queue_incoming_channel(channel) + handler = default_handler + self._tcp_handler = handler + return port + + def cancel_port_forward(self, address, port): + """ + 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. + + @param address: the address to stop forwarding + @type address: str + @param port: the port to stop forwarding + @type port: int + """ + if not self.active: + return + self._tcp_handler = None + self.global_request('cancel-tcpip-forward', (address, port), wait=True) + def open_sftp_client(self): """ Create an SFTP client channel from an open transport. On success, @@ -656,8 +818,6 @@ class Transport (threading.Thread): @param bytes: the number of random bytes to send in the payload of the ignored packet -- defaults to a random number from 10 to 41. @type bytes: int - - @since: fearow """ m = Message() m.add_byte(chr(MSG_IGNORE)) @@ -674,22 +834,23 @@ class Transport (threading.Thread): bytes sent or received, but this method gives you the option of forcing new keys whenever you want. Negotiating new keys causes a pause in traffic both ways as the two sides swap keys and do computations. This - method returns when the session has switched to new keys, or the - session has died mid-negotiation. + method returns when the session has switched to new keys. - @return: True if the renegotiation was successful, and the link is - using new keys; False if the session dropped during renegotiation. - @rtype: bool + @raise SSHException: if the key renegotiation failed (which causes the + session to end) """ self.completion_event = threading.Event() self._send_kex_init() - while 1: - self.completion_event.wait(0.1); + while True: + self.completion_event.wait(0.1) if not self.active: - return False + e = self.get_exception() + if e is not None: + raise e + raise SSHException('Negotiation failed.') if self.completion_event.isSet(): break - return True + return def set_keepalive(self, interval): """ @@ -701,11 +862,9 @@ class Transport (threading.Thread): @param interval: seconds to wait before sending a keepalive packet (or 0 to disable keepalives). @type interval: int - - @since: fearow """ self.packetizer.set_keepalive(interval, - lambda x=self: x.global_request('keepalive@lag.net', wait=False)) + lambda x=weakref.proxy(self): x.global_request('keepalive@lag.net', wait=False)) def global_request(self, kind, data=None, wait=True): """ @@ -724,8 +883,6 @@ class Transport (threading.Thread): request was successful (or an empty L{Message} if C{wait} was C{False}); C{None} if the request was denied. @rtype: L{Message} - - @since: fearow """ if wait: self.completion_event = threading.Event() @@ -807,8 +964,6 @@ class Transport (threading.Thread): @raise SSHException: if the SSH2 negotiation fails, the host key supplied by the server is incorrect, or authentication fails. - - @since: doduo """ if hostkey is not None: self._preferred_keys = [ hostkey.get_name() ] @@ -896,8 +1051,6 @@ class Transport (threading.Thread): @return: username that was authenticated, or C{None}. @rtype: string - - @since: fearow """ if not self.active or (self.auth_handler is None): return None @@ -958,9 +1111,9 @@ class Transport (threading.Thread): step. Otherwise, in the normal case, an empty list is returned. @param username: the username to authenticate as - @type username: string + @type username: str @param password: the password to authenticate with - @type password: string + @type password: str or unicode @param event: an event to trigger when the authentication attempt is complete (whether it was successful or not) @type event: threading.Event @@ -974,8 +1127,9 @@ class Transport (threading.Thread): @raise BadAuthenticationType: if password authentication isn't allowed by the server for this user (and no event was passed in) - @raise SSHException: if the authentication failed (and no event was - passed in) + @raise AuthenticationException: if the authentication failed (and no + event was passed in) + @raise SSHException: if there was a network error """ if (not self.active) or (not self.initial_kex_done): # we should never try to send the password unless we're on a secure link @@ -993,7 +1147,7 @@ class Transport (threading.Thread): return self.auth_handler.wait_for_response(my_event) except BadAuthenticationType, x: # if password auth isn't allowed, but keyboard-interactive *is*, try to fudge it - if not fallback or not 'keyboard-interactive' in x.allowed_types: + if not fallback or ('keyboard-interactive' not in x.allowed_types): raise try: def handler(title, instructions, fields): @@ -1010,6 +1164,7 @@ class Transport (threading.Thread): except SSHException, ignored: # attempt failed; just raise the original exception raise x + return None def auth_publickey(self, username, key, event=None): """ @@ -1037,13 +1192,14 @@ class Transport (threading.Thread): complete (whether it was successful or not) @type event: threading.Event @return: list of auth types permissible for the next stage of - authentication (normally empty). + authentication (normally empty) @rtype: list @raise BadAuthenticationType: if public-key authentication isn't - allowed by the server for this user (and no event was passed in). - @raise SSHException: if the authentication failed (and no event was - passed in). + allowed by the server for this user (and no event was passed in) + @raise AuthenticationException: if the authentication failed (and no + event was passed in) + @raise SSHException: if there was a network error """ if (not self.active) or (not self.initial_kex_done): # we should never try to authenticate unless we're on a secure link @@ -1100,7 +1256,8 @@ class Transport (threading.Thread): @raise BadAuthenticationType: if public-key authentication isn't allowed by the server for this user - @raise SSHException: if the authentication failed + @raise AuthenticationException: if the authentication failed + @raise SSHException: if there was a network error @since: 1.5 """ @@ -1119,13 +1276,14 @@ class Transport (threading.Thread): (See the C{logging} module for more info.) SSH Channels will log to a sub-channel of the one specified. - @param name: new channel name for logging. + @param name: new channel name for logging @type name: str @since: 1.1 """ self.log_name = name self.logger = util.get_logger(name) + self.packetizer.set_log(self.logger) def get_log_channel(self): """ @@ -1166,8 +1324,7 @@ class Transport (threading.Thread): """ Turn on/off compression. This will only have an affect before starting the transport (ie before calling L{connect}, etc). By default, - compression is off since it negatively affects interactive sessions - and is not fully tested. + compression is off since it negatively affects interactive sessions. @param compress: C{True} to ask the remote client/server to compress traffic; C{False} to refuse compression @@ -1179,6 +1336,21 @@ class Transport (threading.Thread): self._preferred_compression = ( 'zlib@openssh.com', 'zlib', 'none' ) else: self._preferred_compression = ( 'none', ) + + def getpeername(self): + """ + Return the address of the remote side of this Transport, if possible. + This is effectively a wrapper around C{'getpeername'} on the underlying + socket. If the socket-like object has no C{'getpeername'} method, + then C{("unknown", 0)} is returned. + + @return: the address if the remote host, if known + @rtype: tuple(str, int) + """ + gp = getattr(self.sock, 'getpeername', None) + if gp is None: + return ('unknown', 0) + return gp() def stop_thread(self): self.active = False @@ -1188,25 +1360,29 @@ class Transport (threading.Thread): ### internals... - def _log(self, level, msg): + def _log(self, level, msg, *args): if issubclass(type(msg), list): for m in msg: self.logger.log(level, m) else: - self.logger.log(level, msg) + self.logger.log(level, msg, *args) def _get_modulus_pack(self): "used by KexGex to find primes for group exchange" return self._modulus_pack + def _next_channel(self): + "you are holding the lock" + chanid = self._channel_counter + while self._channels.get(chanid) is not None: + self._channel_counter = (self._channel_counter + 1) & 0xffffff + chanid = self._channel_counter + self._channel_counter = (self._channel_counter + 1) & 0xffffff + return chanid + def _unlink_channel(self, chanid): "used by a Channel to remove itself from the active channel list" - try: - self.lock.acquire() - if self.channels.has_key(chanid): - del self.channels[chanid] - finally: - self.lock.release() + self._channels.delete(chanid) def _send_message(self, data): self.packetizer.send_message(data) @@ -1237,9 +1413,9 @@ class Transport (threading.Thread): if self.session_id == None: self.session_id = h - def _expect_packet(self, type): + def _expect_packet(self, *ptypes): "used by a kex object to register the next packet type it expects to see" - self.expected_packet = type + self._expected_packet = tuple(ptypes) def _verify_key(self, host_key, sig): key = self._key_info[self.host_key_type](Message(host_key)) @@ -1262,16 +1438,34 @@ class Transport (threading.Thread): m.add_mpint(self.K) m.add_bytes(self.H) m.add_bytes(sofar) - hash = SHA.new(str(m)).digest() - out += hash - sofar += hash + digest = SHA.new(str(m)).digest() + out += digest + sofar += digest return out[:nbytes] def _get_cipher(self, name, key, iv): - if not self._cipher_info.has_key(name): + if name not in self._cipher_info: raise SSHException('Unknown client cipher ' + name) return self._cipher_info[name]['class'].new(key, self._cipher_info[name]['mode'], iv) + def _set_x11_handler(self, handler): + # only called if a channel has turned on x11 forwarding + if handler is None: + # by default, use the same mechanism as accept() + def default_handler(channel, (src_addr, src_port)): + self._queue_incoming_channel(channel) + self._x11_handler = default_handler + else: + self._x11_handler = handler + + def _queue_incoming_channel(self, channel): + self.lock.acquire() + try: + self.server_accepts.append(channel) + self.server_accept_cv.notify() + finally: + self.lock.release() + def run(self): # (use the exposed "run" method, because if we specify a thread target # of a private method, threading.Thread will keep a reference to it @@ -1288,7 +1482,7 @@ class Transport (threading.Thread): self.packetizer.write_all(self.local_version + '\r\n') self._check_banner() self._send_kex_init() - self.expected_packet = MSG_KEXINIT + self._expect_packet(MSG_KEXINIT) while self.active: if self.packetizer.need_rekey() and not self.in_kex: @@ -1307,27 +1501,28 @@ class Transport (threading.Thread): elif ptype == MSG_DEBUG: self._parse_debug(m) continue - if self.expected_packet != 0: - if ptype != self.expected_packet: - raise SSHException('Expecting packet %d, got %d' % (self.expected_packet, ptype)) - self.expected_packet = 0 + 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 self._handler_table.has_key(ptype): + if ptype in self._handler_table: self._handler_table[ptype](self, m) - elif self._channel_handler_table.has_key(ptype): + elif ptype in self._channel_handler_table: chanid = m.get_int() - if self.channels.has_key(chanid): - self._channel_handler_table[ptype](self.channels[chanid], m) - elif self.channels_seen.has_key(chanid): + 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 self.auth_handler._handler_table.has_key(ptype): + 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) @@ -1355,7 +1550,7 @@ class Transport (threading.Thread): self._log(ERROR, util.tb_strings()) self.saved_exception = e _active_threads.remove(self) - for chan in self.channels.values(): + for chan in self._channels.values(): chan._unlink() if self.active: self.active = False @@ -1366,6 +1561,11 @@ class Transport (threading.Thread): 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() @@ -1388,30 +1588,31 @@ class Transport (threading.Thread): def _check_banner(self): # this is slow, but we only have to do it once for i in range(5): - # give them 5 seconds for the first line, then just 2 seconds each additional line + # give them 15 seconds for the first line, then just 2 seconds + # each additional line. (some sites have very high latency.) if i == 0: - timeout = 5 + timeout = self.banner_timeout else: timeout = 2 try: - buffer = self.packetizer.readline(timeout) + buf = self.packetizer.readline(timeout) except Exception, x: raise SSHException('Error reading SSH protocol banner' + str(x)) - if buffer[:4] == 'SSH-': + if buf[:4] == 'SSH-': break - self._log(DEBUG, 'Banner: ' + buffer) - if buffer[:4] != 'SSH-': - raise SSHException('Indecipherable protocol version "' + buffer + '"') + self._log(DEBUG, 'Banner: ' + buf) + if buf[:4] != 'SSH-': + raise SSHException('Indecipherable protocol version "' + buf + '"') # save this server version string for later - self.remote_version = buffer + self.remote_version = buf # pull off any attached comment comment = '' - i = string.find(buffer, ' ') + i = string.find(buf, ' ') if i >= 0: - comment = buffer[i+1:] - buffer = buffer[:i] + comment = buf[i+1:] + buf = buf[:i] # parse out version string and make sure it matches - segs = buffer.split('-', 2) + segs = buf.split('-', 2) if len(segs) < 3: raise SSHException('Invalid SSH banner') version = segs[1] @@ -1612,7 +1813,7 @@ class Transport (threading.Thread): if not self.packetizer.need_rekey(): self.in_kex = False # we always expect to receive NEWKEYS now - self.expected_packet = MSG_NEWKEYS + self._expect_packet(MSG_NEWKEYS) def _auth_trigger(self): self.authenticated = True @@ -1661,7 +1862,22 @@ class Transport (threading.Thread): kind = m.get_string() self._log(DEBUG, 'Received global request "%s"' % kind) want_reply = m.get_boolean() - ok = self.server_object.check_global_request(kind, m) + if not self.server_mode: + self._log(DEBUG, 'Rejecting "%s" global request from server.' % kind) + ok = False + elif kind == 'tcpip-forward': + address = m.get_string() + port = m.get_int() + ok = self.server_object.check_port_forward_request(address, port) + if ok != False: + ok = (ok,) + elif kind == 'cancel-tcpip-forward': + address = m.get_string() + port = m.get_int() + self.server_object.cancel_port_forward_request(address, port) + ok = True + else: + ok = self.server_object.check_global_request(kind, m) extra = () if type(ok) is tuple: extra = ok @@ -1692,15 +1908,15 @@ class Transport (threading.Thread): server_chanid = m.get_int() server_window_size = m.get_int() server_max_packet_size = m.get_int() - if not self.channels.has_key(chanid): + chan = self._channels.get(chanid) + if chan is None: self._log(WARNING, 'Success for unrequested channel! [??]') return self.lock.acquire() try: - chan = self.channels[chanid] chan._set_remote_channel(server_chanid, server_window_size, server_max_packet_size) self._log(INFO, 'Secsh channel %d opened.' % chanid) - if self.channel_events.has_key(chanid): + if chanid in self.channel_events: self.channel_events[chanid].set() del self.channel_events[chanid] finally: @@ -1712,16 +1928,14 @@ class Transport (threading.Thread): reason = m.get_int() reason_str = m.get_string() lang = m.get_string() - if CONNECTION_FAILED_CODE.has_key(reason): - reason_text = CONNECTION_FAILED_CODE[reason] - else: - reason_text = '(unknown code)' + reason_text = CONNECTION_FAILED_CODE.get(reason, '(unknown code)') self._log(INFO, 'Secsh channel %d open FAILED: %s: %s' % (chanid, reason_str, reason_text)) + self.lock.acquire() try: - self.lock.aquire() - if self.channels.has_key(chanid): - del self.channels[chanid] - if self.channel_events.has_key(chanid): + self.saved_exception = ChannelException(reason, reason_text) + if chanid in self.channel_events: + self._channels.delete(chanid) + if chanid in self.channel_events: self.channel_events[chanid].set() del self.channel_events[chanid] finally: @@ -1734,21 +1948,47 @@ class Transport (threading.Thread): initial_window_size = m.get_int() max_packet_size = m.get_int() reject = False - if not self.server_mode: + if (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)) + self.lock.acquire() + try: + my_chanid = self._next_channel() + finally: + self.lock.release() + elif (kind == 'forwarded-tcpip') and (self._tcp_handler is not None): + server_addr = m.get_string() + server_port = m.get_int() + origin_addr = m.get_string() + origin_port = m.get_int() + self._log(DEBUG, 'Incoming tcp forwarded connection from %s:%d' % (origin_addr, origin_port)) + self.lock.acquire() + try: + my_chanid = self._next_channel() + finally: + self.lock.release() + elif not self.server_mode: self._log(DEBUG, 'Rejecting "%s" channel request from server.' % kind) reject = True reason = OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED else: self.lock.acquire() try: - my_chanid = self.channel_counter - while self.channels.has_key(my_chanid): - self.channel_counter = (self.channel_counter + 1) & 0xffffff - my_chanid = self.channel_counter - self.channel_counter = (self.channel_counter + 1) & 0xffffff + my_chanid = self._next_channel() finally: self.lock.release() - reason = self.server_object.check_channel_request(kind, my_chanid) + if kind == 'direct-tcpip': + # handle direct-tcpip requests comming from the client + dest_addr = m.get_string() + dest_port = m.get_int() + origin_addr = m.get_string() + origin_port = m.get_int() + reason = self.server_object.check_channel_direct_tcpip_request( + my_chanid, (origin_addr, origin_port), + (dest_addr, dest_port)) + else: + reason = self.server_object.check_channel_request(kind, my_chanid) if reason != OPEN_SUCCEEDED: self._log(DEBUG, 'Rejecting "%s" channel request from client.' % kind) reject = True @@ -1761,10 +2001,11 @@ class Transport (threading.Thread): msg.add_string('en') self._send_message(msg) return + chan = Channel(my_chanid) + self.lock.acquire() try: - self.lock.acquire() - self.channels[my_chanid] = chan + self._channels.put(my_chanid, chan) self.channels_seen[my_chanid] = True chan._set_transport(self) chan._set_window(self.window_size, self.max_packet_size) @@ -1778,13 +2019,14 @@ class Transport (threading.Thread): m.add_int(self.window_size) m.add_int(self.max_packet_size) self._send_message(m) - self._log(INFO, 'Secsh channel %d opened.' % my_chanid) - try: - self.lock.acquire() - self.server_accepts.append(chan) - self.server_accept_cv.notify() - finally: - self.lock.release() + self._log(INFO, 'Secsh channel %d (%s) opened.', my_chanid, kind) + if kind == 'x11': + self._x11_handler(chan, (origin_addr, origin_port)) + elif kind == 'forwarded-tcpip': + chan.origin_addr = (origin_addr, origin_port) + self._tcp_handler(chan, (origin_addr, origin_port), (server_addr, server_port)) + else: + self._queue_incoming_channel(chan) def _parse_debug(self, m): always_display = m.get_boolean() @@ -1795,7 +2037,7 @@ class Transport (threading.Thread): def _get_subsystem_handler(self, name): try: self.lock.acquire() - if not self.subsystem_table.has_key(name): + if name not in self.subsystem_table: return (None, [], {}) return self.subsystem_table[name] finally: diff --git a/paramiko/util.py b/paramiko/util.py index abab825..8abdc0c 100644 --- a/paramiko/util.py +++ b/paramiko/util.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -22,13 +22,14 @@ Useful functions used by the rest of paramiko. from __future__ import generators -import fnmatch +from binascii import hexlify, unhexlify import sys import struct import traceback import threading from paramiko.common import * +from paramiko.config import SSHConfig # Change by RogerB - python < 2.3 doesn't have enumerate so we implement it @@ -115,12 +116,10 @@ def format_binary_line(data): return '%-50s %s' % (left, right) def hexify(s): - "turn a string into a hex sequence" - return ''.join(['%02X' % ord(c) for c in s]) + return hexlify(s).upper() def unhexify(s): - "turn a hex sequence back into a string" - return ''.join([chr(int(s[i:i+2], 16)) for i in range(0, len(s), 2)]) + return unhexlify(s) def safe_string(s): out = '' @@ -168,12 +167,12 @@ def generate_key_bytes(hashclass, salt, key, nbytes): if len(salt) > 8: salt = salt[:8] while nbytes > 0: - hash = hashclass.new() + hash_obj = hashclass.new() if len(digest) > 0: - hash.update(digest) - hash.update(key) - hash.update(salt) - digest = hash.digest() + hash_obj.update(digest) + hash_obj.update(key) + hash_obj.update(salt) + digest = hash_obj.digest() size = min(nbytes, len(digest)) keydata += digest[:size] nbytes -= size @@ -189,117 +188,29 @@ def load_host_keys(filename): This type of file unfortunately doesn't exist on Windows, but on posix, it will usually be stored in C{os.path.expanduser("~/.ssh/known_hosts")}. + Since 1.5.3, this is just a wrapper around L{HostKeys}. + @param filename: name of the file to read host keys from @type filename: str @return: dict of host keys, indexed by hostname and then keytype @rtype: dict(hostname, dict(keytype, L{PKey })) """ - import base64 - from rsakey import RSAKey - from dsskey import DSSKey - - keys = {} - f = file(filename, 'r') - for line in f: - line = line.strip() - if (len(line) == 0) or (line[0] == '#'): - continue - keylist = line.split(' ') - if len(keylist) != 3: - continue - hostlist, keytype, key = keylist - hosts = hostlist.split(',') - for host in hosts: - if not keys.has_key(host): - keys[host] = {} - if keytype == 'ssh-rsa': - keys[host][keytype] = RSAKey(data=base64.decodestring(key)) - elif keytype == 'ssh-dss': - keys[host][keytype] = DSSKey(data=base64.decodestring(key)) - f.close() - return keys + from paramiko.hostkeys import HostKeys + return HostKeys(filename) def parse_ssh_config(file_obj): """ - Parse a config file of the format used by OpenSSH, and return an object - that can be used to make queries to L{lookup_ssh_host_config}. The - format is described in OpenSSH's C{ssh_config} man page. This method is - provided primarily as a convenience to posix users (since the OpenSSH - format is a de-facto standard on posix) but should work fine on Windows - too. - - The return value is currently a list of dictionaries, each containing - host-specific configuration, but this is considered an implementation - detail and may be subject to change in later versions. - - @param file_obj: a file-like object to read the config file from - @type file_obj: file - @return: opaque configuration object - @rtype: object + Provided only as a backward-compatible wrapper around L{SSHConfig}. """ - ret = [] - config = { 'host': '*' } - ret.append(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() - else: - # find first whitespace, and split there - i = 0 - while (i < len(line)) and not line[i].isspace(): - i += 1 - if i == len(line): - raise Exception('Unparsable line: %r' % line) - key = line[:i].lower() - value = line[i:].lstrip() - - if key == 'host': - # do we have a pre-existing host config to append to? - matches = [c for c in ret if c['host'] == value] - if len(matches) > 0: - config = matches[0] - else: - config = { 'host': value } - ret.append(config) - else: - config[key] = value - - return ret + config = SSHConfig() + config.parse(file_obj) + return config def lookup_ssh_host_config(hostname, config): """ - Return a dict of config options for a given hostname. The C{config} object - must come from L{parse_ssh_config}. - - The host-matching rules of OpenSSH's C{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 - C{"Port"} is set under C{"Host *"} and also C{"Host *.example.com"}, and - the lookup is for C{"ssh.example.com"}, then the port entry for - C{"Host *.example.com"} 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. - - @param hostname: the hostname to lookup - @type hostname: str - @param config: the config object to search - @type config: object + Provided only as a backward-compatible wrapper around L{SSHConfig}. """ - matches = [x for x in config if fnmatch.fnmatch(hostname, x['host'])] - # sort in order of shortest match (usually '*') to longest - matches.sort(key=lambda x: len(x['host'])) - ret = {} - for m in matches: - ret.update(m) - del ret['host'] - return ret + return config.lookup(hostname) def mod_inverse(x, m): # it's crazy how small python can make this function. @@ -355,3 +266,5 @@ def get_logger(name): l = logging.getLogger(name) l.addFilter(_pfilter) return l + + diff --git a/paramiko/win_pageant.py b/paramiko/win_pageant.py new file mode 100644 index 0000000..787032b --- /dev/null +++ b/paramiko/win_pageant.py @@ -0,0 +1,148 @@ +# Copyright (C) 2005 John Arbash-Meinel +# Modified up by: Todd Whiteman +# +# 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. + +""" +Functions for communicating with Pageant, the basic windows ssh agent program. +""" + +import os +import struct +import tempfile +import mmap +import array + +# if you're on windows, you should have one of these, i guess? +# ctypes is part of standard library since Python 2.5 +_has_win32all = False +_has_ctypes = False +try: + # win32gui is preferred over win32ui to avoid MFC dependencies + import win32gui + _has_win32all = True +except ImportError: + try: + import ctypes + _has_ctypes = True + except ImportError: + pass + + +_AGENT_COPYDATA_ID = 0x804e50ba +_AGENT_MAX_MSGLEN = 8192 +# Note: The WM_COPYDATA value is pulled from win32con, as a workaround +# so we do not have to import this huge library just for this one variable. +win32con_WM_COPYDATA = 74 + + +def _get_pageant_window_object(): + if _has_win32all: + try: + hwnd = win32gui.FindWindow('Pageant', 'Pageant') + return hwnd + except win32gui.error: + pass + elif _has_ctypes: + # Return 0 if there is no Pageant window. + return ctypes.windll.user32.FindWindowA('Pageant', 'Pageant') + return None + + +def can_talk_to_agent(): + """ + 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. + """ + if (_has_win32all or _has_ctypes) and _get_pageant_window_object(): + return True + return False + + +def _query_pageant(msg): + hwnd = _get_pageant_window_object() + if not hwnd: + # Raise a failure to connect exception, pageant isn't running anymore! + return None + + # Write our pageant request string into the file (pageant will read this to determine what to do) + filename = tempfile.mktemp('.pag') + map_filename = os.path.basename(filename) + + f = open(filename, 'w+b') + f.write(msg ) + # Ensure the rest of the file is empty, otherwise pageant will read this + f.write('\0' * (_AGENT_MAX_MSGLEN - len(msg))) + # Create the shared file map that pageant will use to read from + pymap = mmap.mmap(f.fileno(), _AGENT_MAX_MSGLEN, tagname=map_filename, access=mmap.ACCESS_WRITE) + try: + # Create an array buffer containing the mapped filename + 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) + + 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) + elif _has_ctypes: + _buf = array.array('B', cds) + _addr, _size = _buf.buffer_info() + response = ctypes.windll.user32.SendMessageA(hwnd, win32con_WM_COPYDATA, _size, _addr) + else: + response = 0 + + if response > 0: + datalen = pymap.read(4) + retlen = struct.unpack('>I', datalen)[0] + return datalen + pymap.read(retlen) + return None + finally: + pymap.close() + f.close() + # Remove the file, it was temporary only + os.unlink(filename) + + +class PageantConnection (object): + """ + 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. + """ + + 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 '' + ret = self._response[:n] + self._response = self._response[n:] + if self._response == '': + self._response = None + return ret + + def close(self): + pass diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..861a9f5 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,5 @@ +[egg_info] +tag_build = +tag_date = 0 +tag_svn_revision = 0 + diff --git a/setup.py b/setup.py index ce7d047..2041fea 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,4 @@ -from distutils.core import setup - -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2008 Robey Pointer # # This file is part of paramiko. # @@ -26,17 +24,37 @@ connections between python scripts. All major ciphers and hash methods are supported. SFTP client and server mode are both supported too. Required packages: - pyCrypt + pyCrypto ''' +# if someday we want to *require* setuptools, uncomment this: +# (it will cause setuptools to be automatically downloaded) +#import ez_setup +#ez_setup.use_setuptools() + +import sys +try: + from setuptools import setup + kw = { + 'install_requires': 'pycrypto >= 1.9', + } +except ImportError: + from distutils.core import setup + kw = {} + +if sys.platform == 'darwin': + import setup_helper + setup_helper.install_custom_make_tarball() + + setup(name = "paramiko", - version = "1.5.2", + version = "1.7.4", description = "SSH2 protocol library", author = "Robey Pointer", author_email = "robey@lag.net", url = "http://www.lag.net/paramiko/", packages = [ 'paramiko' ], - download_url = 'http://www.lag.net/paramiko/download/paramiko-1.5.2.zip', + download_url = 'http://www.lag.net/paramiko/download/paramiko-1.7.4.zip', license = 'LGPL', platforms = 'Posix; MacOS X; Windows', classifiers = [ 'Development Status :: 5 - Production/Stable', @@ -46,4 +64,5 @@ setup(name = "paramiko", 'Topic :: Internet', 'Topic :: Security :: Cryptography' ], long_description = longdesc, + **kw ) diff --git a/setup_helper.py b/setup_helper.py new file mode 100644 index 0000000..778d90a --- /dev/null +++ b/setup_helper.py @@ -0,0 +1,102 @@ +# Copyright (C) 2003-2007 Robey Pointer +# +# 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. + +# Note: Despite the copyright notice, this was submitted by John +# Arbash Meinel. Thanks John! + + +"""A small set of helper functions for dealing with setup issues""" + +import os +import tarfile + +from distutils import log +import distutils.archive_util +from distutils.dir_util import mkpath +from distutils.spawn import spawn + + +def make_tarball(base_name, base_dir, compress='gzip', + verbose=False, dry_run=False): + """Create a tar file from all the files under 'base_dir'. + This file may be compressed. + + :param compress: Compression algorithms. Supported algorithms are: + 'gzip': (the default) + 'compress' + 'bzip2' + None + For 'gzip' and 'bzip2' the internal tarfile module will be used. + For 'compress' the .tar will be created using tarfile, and then + we will spawn 'compress' afterwards. + The output tar file will be named 'base_name' + ".tar", + possibly plus the appropriate compression extension (".gz", + ".bz2" or ".Z"). Return the output filename. + """ + # XXX GNU tar 1.13 has a nifty option to add a prefix directory. + # It's pretty new, though, so we certainly can't require it -- + # but it would be nice to take advantage of it to skip the + # "create a tree of hardlinks" step! (Would also be nice to + # detect GNU tar to use its 'z' option and save a step.) + + compress_ext = { 'gzip': ".gz", + 'bzip2': '.bz2', + 'compress': ".Z" } + + # flags for compression program, each element of list will be an argument + tarfile_compress_flag = {'gzip':'gz', 'bzip2':'bz2'} + compress_flags = {'compress': ["-f"]} + + if compress is not None and compress not in compress_ext.keys(): + raise ValueError("bad value for 'compress': must be None, 'gzip'," + "'bzip2' or 'compress'") + + archive_name = base_name + ".tar" + if compress and compress in tarfile_compress_flag: + archive_name += compress_ext[compress] + + mode = 'w:' + tarfile_compress_flag.get(compress, '') + + mkpath(os.path.dirname(archive_name), dry_run=dry_run) + log.info('Creating tar file %s with mode %s' % (archive_name, mode)) + + if not dry_run: + tar = tarfile.open(archive_name, mode=mode) + # This recursively adds everything underneath base_dir + tar.add(base_dir) + tar.close() + + if compress and compress not in tarfile_compress_flag: + spawn([compress] + compress_flags[compress] + [archive_name], + dry_run=dry_run) + return archive_name + compress_ext[compress] + else: + return archive_name + + +_custom_formats = { + 'gztar': (make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"), + 'bztar': (make_tarball, [('compress', 'bzip2')], "bzip2'ed tar-file"), + 'ztar': (make_tarball, [('compress', 'compress')], "compressed tar file"), + 'tar': (make_tarball, [('compress', None)], "uncompressed tar file"), +} + +# Hack in and insert ourselves into the distutils code base +def install_custom_make_tarball(): + distutils.archive_util.ARCHIVE_FORMATS.update(_custom_formats) + diff --git a/test.py b/test.py old mode 100644 new mode 100755 index 17b6294..b7f6c8a --- a/test.py +++ b/test.py @@ -1,6 +1,6 @@ -#!/usr/bin/python +#!/usr/bin/env python -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -22,82 +22,127 @@ do the unit tests! """ -import sys, os, unittest +import os +import re +import sys +import unittest from optparse import OptionParser import paramiko -sys.path.append('tests/') +sys.path.append('tests') from test_message import MessageTest from test_file import BufferedFileTest +from test_buffered_pipe import BufferedPipeTest from test_util import UtilTest +from test_hostkeys import HostKeysTest from test_pkey import KeyTest from test_kex import KexTest from test_packetizer import PacketizerTest +from test_auth import AuthTest from test_transport import TransportTest from test_sftp import SFTPTest +from test_sftp_big import BigSFTPTest +from test_client import SSHClientTest default_host = 'localhost' default_user = os.environ.get('USER', 'nobody') default_keyfile = os.path.join(os.environ.get('HOME', '/'), '.ssh/id_rsa') default_passwd = None -parser = OptionParser('usage: %prog [options]') -parser.add_option('--verbose', action='store_true', dest='verbose', default=False, - help='verbose display (one line per test)') -parser.add_option('--no-pkey', action='store_false', dest='use_pkey', default=True, - help='skip RSA/DSS private key tests (which can take a while)') -parser.add_option('--no-transport', action='store_false', dest='use_transport', default=True, - help='skip transport tests (which can take a while)') -parser.add_option('--no-sftp', action='store_false', dest='use_sftp', default=True, - help='skip SFTP client/server tests, which can be slow') -parser.add_option('--no-big-file', action='store_false', dest='use_big_file', default=True, - help='skip big file SFTP tests, which are slow as molasses') -parser.add_option('-R', action='store_false', dest='use_loopback_sftp', default=True, - help='perform SFTP tests against a remote server (by default, SFTP tests ' + - 'are done through a loopback socket)') -parser.add_option('-H', '--sftp-host', dest='hostname', type='string', default=default_host, - metavar='', - help='[with -R] host for remote sftp tests (default: %s)' % default_host) -parser.add_option('-U', '--sftp-user', dest='username', type='string', default=default_user, - metavar='', - help='[with -R] username for remote sftp tests (default: %s)' % default_user) -parser.add_option('-K', '--sftp-key', dest='keyfile', type='string', default=default_keyfile, - metavar='', - help='[with -R] location of private key for remote sftp tests (default: %s)' % - default_keyfile) -parser.add_option('-P', '--sftp-passwd', dest='password', type='string', default=default_passwd, - metavar='', - help='[with -R] (optional) password to unlock the private key for remote sftp tests') -options, args = parser.parse_args() -if len(args) > 0: - parser.error('unknown argument(s)') +def iter_suite_tests(suite): + """Return all tests in a suite, recursing through nested suites""" + for item in suite._tests: + if isinstance(item, unittest.TestCase): + yield item + elif isinstance(item, unittest.TestSuite): + for r in iter_suite_tests(item): + yield r + else: + raise Exception('unknown object %r inside test suite %r' + % (item, suite)) -# setup logging -paramiko.util.log_to_file('test.log') -if options.use_sftp: - if options.use_loopback_sftp: - SFTPTest.init_loopback() - else: - SFTPTest.init(options.hostname, options.username, options.keyfile, options.password) - if not options.use_big_file: - SFTPTest.set_big_file_test(False) +def filter_suite_by_re(suite, pattern): + result = unittest.TestSuite() + filter_re = re.compile(pattern) + for test in iter_suite_tests(suite): + if filter_re.search(test.id()): + result.addTest(test) + return result -suite = unittest.TestSuite() -suite.addTest(unittest.makeSuite(MessageTest)) -suite.addTest(unittest.makeSuite(BufferedFileTest)) -suite.addTest(unittest.makeSuite(UtilTest)) -if options.use_pkey: - suite.addTest(unittest.makeSuite(KeyTest)) -suite.addTest(unittest.makeSuite(KexTest)) -suite.addTest(unittest.makeSuite(PacketizerTest)) -if options.use_transport: - suite.addTest(unittest.makeSuite(TransportTest)) -if options.use_sftp: - suite.addTest(unittest.makeSuite(SFTPTest)) -verbosity = 1 -if options.verbose: - verbosity = 2 -unittest.TextTestRunner(verbosity=verbosity).run(suite) + +def main(): + parser = OptionParser('usage: %prog [options]') + parser.add_option('--verbose', action='store_true', dest='verbose', default=False, + help='verbose display (one line per test)') + parser.add_option('--no-pkey', action='store_false', dest='use_pkey', default=True, + help='skip RSA/DSS private key tests (which can take a while)') + parser.add_option('--no-transport', action='store_false', dest='use_transport', default=True, + help='skip transport tests (which can take a while)') + parser.add_option('--no-sftp', action='store_false', dest='use_sftp', default=True, + help='skip SFTP client/server tests, which can be slow') + parser.add_option('--no-big-file', action='store_false', dest='use_big_file', default=True, + help='skip big file SFTP tests, which are slow as molasses') + parser.add_option('-R', action='store_false', dest='use_loopback_sftp', default=True, + help='perform SFTP tests against a remote server (by default, SFTP tests ' + + 'are done through a loopback socket)') + parser.add_option('-H', '--sftp-host', dest='hostname', type='string', default=default_host, + metavar='', + help='[with -R] host for remote sftp tests (default: %s)' % default_host) + parser.add_option('-U', '--sftp-user', dest='username', type='string', default=default_user, + metavar='', + help='[with -R] username for remote sftp tests (default: %s)' % default_user) + parser.add_option('-K', '--sftp-key', dest='keyfile', type='string', default=default_keyfile, + metavar='', + help='[with -R] location of private key for remote sftp tests (default: %s)' % + default_keyfile) + parser.add_option('-P', '--sftp-passwd', dest='password', type='string', default=default_passwd, + metavar='', + help='[with -R] (optional) password to unlock the private key for remote sftp tests') + + options, args = parser.parse_args() + + # setup logging + paramiko.util.log_to_file('test.log') + + if options.use_sftp: + if options.use_loopback_sftp: + SFTPTest.init_loopback() + else: + SFTPTest.init(options.hostname, options.username, options.keyfile, options.password) + if not options.use_big_file: + SFTPTest.set_big_file_test(False) + + suite = unittest.TestSuite() + suite.addTest(unittest.makeSuite(MessageTest)) + suite.addTest(unittest.makeSuite(BufferedFileTest)) + suite.addTest(unittest.makeSuite(BufferedPipeTest)) + suite.addTest(unittest.makeSuite(UtilTest)) + suite.addTest(unittest.makeSuite(HostKeysTest)) + if options.use_pkey: + suite.addTest(unittest.makeSuite(KeyTest)) + suite.addTest(unittest.makeSuite(KexTest)) + suite.addTest(unittest.makeSuite(PacketizerTest)) + if options.use_transport: + suite.addTest(unittest.makeSuite(AuthTest)) + suite.addTest(unittest.makeSuite(TransportTest)) + suite.addTest(unittest.makeSuite(SSHClientTest)) + if options.use_sftp: + suite.addTest(unittest.makeSuite(SFTPTest)) + if options.use_big_file: + suite.addTest(unittest.makeSuite(BigSFTPTest)) + verbosity = 1 + if options.verbose: + verbosity = 2 + + runner = unittest.TextTestRunner(verbosity=verbosity) + if len(args) > 0: + filter = '|'.join(args) + suite = filter_suite_by_re(suite, filter) + runner.run(suite) + + +if __name__ == '__main__': + main() diff --git a/tests/loop.py b/tests/loop.py index ad5f7ca..fb6ffae 100644 --- a/tests/loop.py +++ b/tests/loop.py @@ -1,6 +1,4 @@ -#!/usr/bin/python - -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # diff --git a/tests/stub_sftp.py b/tests/stub_sftp.py index 4b8b9c3..ac292ff 100644 --- a/tests/stub_sftp.py +++ b/tests/stub_sftp.py @@ -1,6 +1,4 @@ -#!/usr/bin/python - -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -48,6 +46,7 @@ class StubSFTPHandle (SFTPHandle): # use the stored filename try: SFTPServer.set_file_attr(self.filename, attr) + return SFTP_OK except OSError, e: return SFTPServer.convert_errno(e.errno) @@ -90,23 +89,38 @@ class StubSFTPServer (SFTPServerInterface): def open(self, path, flags, attr): path = self._realpath(path) try: - fd = os.open(path, flags) + binary_flag = getattr(os, 'O_BINARY', 0) + flags |= binary_flag + mode = getattr(attr, 'st_mode', None) + if mode is not None: + fd = os.open(path, flags, mode) + else: + # os.open() defaults to 0777 which is + # an odd default mode for files + fd = os.open(path, flags, 0666) except OSError, e: return SFTPServer.convert_errno(e.errno) if (flags & os.O_CREAT) and (attr is not None): + attr._flags &= ~attr.FLAG_PERMISSIONS SFTPServer.set_file_attr(path, attr) if flags & os.O_WRONLY: - fstr = 'w' + if flags & os.O_APPEND: + fstr = 'ab' + else: + fstr = 'wb' elif flags & os.O_RDWR: - fstr = 'r+' + if flags & os.O_APPEND: + fstr = 'a+b' + else: + fstr = 'r+b' else: # O_RDONLY (== 0) - fstr = 'r' + fstr = 'rb' try: f = os.fdopen(fd, fstr) except OSError, e: return SFTPServer.convert_errno(e.errno) - fobj = StubSFTPHandle() + fobj = StubSFTPHandle(flags) fobj.filename = path fobj.readfile = f fobj.writefile = f @@ -171,7 +185,7 @@ class StubSFTPServer (SFTPServerInterface): target_path = '' try: os.symlink(target_path, path) - except: + except OSError, e: return SFTPServer.convert_errno(e.errno) return SFTP_OK diff --git a/tests/test_auth.py b/tests/test_auth.py new file mode 100644 index 0000000..fadd8ca --- /dev/null +++ b/tests/test_auth.py @@ -0,0 +1,231 @@ +# Copyright (C) 2008 Robey Pointer +# +# 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. + +""" +Some unit tests for authenticating over a Transport. +""" + +import sys +import threading +import unittest + +from paramiko import Transport, ServerInterface, RSAKey, DSSKey, \ + SSHException, BadAuthenticationType, InteractiveQuery, ChannelException, \ + AuthenticationException +from paramiko import AUTH_FAILED, AUTH_PARTIALLY_SUCCESSFUL, AUTH_SUCCESSFUL +from paramiko import OPEN_SUCCEEDED, OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED +from loop import LoopSocket + + +class NullServer (ServerInterface): + paranoid_did_password = False + paranoid_did_public_key = False + paranoid_key = DSSKey.from_private_key_file('tests/test_dss.key') + + def get_allowed_auths(self, username): + if username == 'slowdive': + return 'publickey,password' + if username == 'paranoid': + if not self.paranoid_did_password and not self.paranoid_did_public_key: + return 'publickey,password' + elif self.paranoid_did_password: + return 'publickey' + else: + return 'password' + if username == 'commie': + return 'keyboard-interactive' + if username == 'utf8': + return 'password' + if username == 'non-utf8': + return 'password' + return 'publickey' + + def check_auth_password(self, username, password): + if (username == 'slowdive') and (password == 'pygmalion'): + return AUTH_SUCCESSFUL + if (username == 'paranoid') and (password == 'paranoid'): + # 2-part auth (even openssh doesn't support this) + self.paranoid_did_password = True + if self.paranoid_did_public_key: + return AUTH_SUCCESSFUL + return AUTH_PARTIALLY_SUCCESSFUL + if (username == 'utf8') and (password == u'\u2022'): + return AUTH_SUCCESSFUL + if (username == 'non-utf8') and (password == '\xff'): + return AUTH_SUCCESSFUL + if username == 'bad-server': + raise Exception("Ack!") + return AUTH_FAILED + + def check_auth_publickey(self, username, key): + if (username == 'paranoid') and (key == self.paranoid_key): + # 2-part auth + self.paranoid_did_public_key = True + if self.paranoid_did_password: + return AUTH_SUCCESSFUL + return AUTH_PARTIALLY_SUCCESSFUL + return AUTH_FAILED + + def check_auth_interactive(self, username, submethods): + if username == 'commie': + self.username = username + return InteractiveQuery('password', 'Please enter a password.', ('Password', False)) + return AUTH_FAILED + + def check_auth_interactive_response(self, responses): + if self.username == 'commie': + if (len(responses) == 1) and (responses[0] == 'cat'): + return AUTH_SUCCESSFUL + return AUTH_FAILED + + +class AuthTest (unittest.TestCase): + + def setUp(self): + self.socks = LoopSocket() + self.sockc = LoopSocket() + self.sockc.link(self.socks) + self.tc = Transport(self.sockc) + self.ts = Transport(self.socks) + + def tearDown(self): + self.tc.close() + self.ts.close() + self.socks.close() + self.sockc.close() + + def start_server(self): + host_key = RSAKey.from_private_key_file('tests/test_rsa.key') + self.public_host_key = RSAKey(data=str(host_key)) + self.ts.add_server_key(host_key) + self.event = threading.Event() + self.server = NullServer() + self.assert_(not self.event.isSet()) + self.ts.start_server(self.event, self.server) + + def verify_finished(self): + self.event.wait(1.0) + self.assert_(self.event.isSet()) + self.assert_(self.ts.is_active()) + + def test_1_bad_auth_type(self): + """ + verify that we get the right exception when an unsupported auth + type is requested. + """ + self.start_server() + try: + self.tc.connect(hostkey=self.public_host_key, + username='unknown', password='error') + self.assert_(False) + except: + etype, evalue, etb = sys.exc_info() + self.assertEquals(BadAuthenticationType, etype) + self.assertEquals(['publickey'], evalue.allowed_types) + + def test_2_bad_password(self): + """ + verify that a bad password gets the right exception, and that a retry + with the right password works. + """ + self.start_server() + self.tc.connect(hostkey=self.public_host_key) + try: + self.tc.auth_password(username='slowdive', password='error') + self.assert_(False) + except: + etype, evalue, etb = sys.exc_info() + self.assert_(issubclass(etype, AuthenticationException)) + self.tc.auth_password(username='slowdive', password='pygmalion') + self.verify_finished() + + def test_3_multipart_auth(self): + """ + verify that multipart auth works. + """ + self.start_server() + self.tc.connect(hostkey=self.public_host_key) + remain = self.tc.auth_password(username='paranoid', password='paranoid') + self.assertEquals(['publickey'], remain) + key = DSSKey.from_private_key_file('tests/test_dss.key') + remain = self.tc.auth_publickey(username='paranoid', key=key) + self.assertEquals([], remain) + self.verify_finished() + + def test_4_interactive_auth(self): + """ + verify keyboard-interactive auth works. + """ + self.start_server() + self.tc.connect(hostkey=self.public_host_key) + + def handler(title, instructions, prompts): + self.got_title = title + self.got_instructions = instructions + self.got_prompts = prompts + return ['cat'] + remain = self.tc.auth_interactive('commie', handler) + self.assertEquals(self.got_title, 'password') + self.assertEquals(self.got_prompts, [('Password', False)]) + self.assertEquals([], remain) + self.verify_finished() + + def test_5_interactive_auth_fallback(self): + """ + verify that a password auth attempt will fallback to "interactive" + if password auth isn't supported but interactive is. + """ + self.start_server() + self.tc.connect(hostkey=self.public_host_key) + remain = self.tc.auth_password('commie', 'cat') + self.assertEquals([], remain) + self.verify_finished() + + def test_6_auth_utf8(self): + """ + verify that utf-8 encoding happens in authentication. + """ + self.start_server() + self.tc.connect(hostkey=self.public_host_key) + remain = self.tc.auth_password('utf8', u'\u2022') + self.assertEquals([], remain) + self.verify_finished() + + def test_7_auth_non_utf8(self): + """ + verify that non-utf-8 encoded passwords can be used for broken + servers. + """ + self.start_server() + self.tc.connect(hostkey=self.public_host_key) + remain = self.tc.auth_password('non-utf8', '\xff') + self.assertEquals([], remain) + self.verify_finished() + + def test_8_auth_gets_disconnected(self): + """ + verify that we catch a server disconnecting during auth, and report + it as an auth failure. + """ + self.start_server() + self.tc.connect(hostkey=self.public_host_key) + try: + remain = self.tc.auth_password('bad-server', 'hello') + except: + etype, evalue, etb = sys.exc_info() + self.assert_(issubclass(etype, AuthenticationException)) diff --git a/tests/test_buffered_pipe.py b/tests/test_buffered_pipe.py new file mode 100644 index 0000000..f96edb8 --- /dev/null +++ b/tests/test_buffered_pipe.py @@ -0,0 +1,95 @@ +# Copyright (C) 2006-2007 Robey Pointer +# +# 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. + +""" +Some unit tests for BufferedPipe. +""" + +import threading +import time +import unittest +from paramiko.buffered_pipe import BufferedPipe, PipeTimeout +from paramiko import pipe + + +def delay_thread(pipe): + pipe.feed('a') + time.sleep(0.5) + pipe.feed('b') + pipe.close() + + +def close_thread(pipe): + time.sleep(0.2) + 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 + + def test_1_buffered_pipe(self): + p = BufferedPipe() + self.assert_(not p.read_ready()) + p.feed('hello.') + self.assert_(p.read_ready()) + data = p.read(6) + self.assertEquals('hello.', data) + + p.feed('plus/minus') + self.assertEquals('plu', p.read(3)) + self.assertEquals('s/m', p.read(3)) + self.assertEquals('inus', p.read(4)) + + p.close() + self.assert_(not p.read_ready()) + self.assertEquals('', p.read(1)) + + def test_2_delay(self): + p = BufferedPipe() + self.assert_(not p.read_ready()) + threading.Thread(target=delay_thread, args=(p,)).start() + self.assertEquals('a', p.read(1, 0.1)) + try: + p.read(1, 0.1) + self.assert_(False) + except PipeTimeout: + pass + self.assertEquals('b', p.read(1, 1.0)) + self.assertEquals('', p.read(1)) + + def test_3_close_while_reading(self): + p = BufferedPipe() + threading.Thread(target=close_thread, args=(p,)).start() + data = p.read(1, 1.0) + self.assertEquals('', data) + + def test_4_or_pipe(self): + p = pipe.make_pipe() + p1, p2 = pipe.make_or_pipe(p) + self.assertFalse(p._set) + p1.set() + self.assertTrue(p._set) + p2.set() + self.assertTrue(p._set) + p1.clear() + self.assertTrue(p._set) + p2.clear() + self.assertFalse(p._set) + diff --git a/tests/test_client.py b/tests/test_client.py new file mode 100644 index 0000000..59cd67c --- /dev/null +++ b/tests/test_client.py @@ -0,0 +1,214 @@ +# Copyright (C) 2003-2007 Robey Pointer +# +# 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. + +""" +Some unit tests for SSHClient. +""" + +import socket +import threading +import time +import unittest +import weakref +from binascii import hexlify + +import paramiko + + +class NullServer (paramiko.ServerInterface): + + def get_allowed_auths(self, username): + if username == 'slowdive': + return 'publickey,password' + return 'publickey' + + def check_auth_password(self, username, password): + if (username == 'slowdive') and (password == 'pygmalion'): + return paramiko.AUTH_SUCCESSFUL + return paramiko.AUTH_FAILED + + def check_auth_publickey(self, username, key): + if (key.get_name() == 'ssh-dss') and (hexlify(key.get_fingerprint()) == '4478f0b9a23cc5182009ff755bc1d26c'): + return paramiko.AUTH_SUCCESSFUL + return paramiko.AUTH_FAILED + + def check_channel_request(self, kind, chanid): + return paramiko.OPEN_SUCCEEDED + + def check_channel_exec_request(self, channel, command): + if command != 'yes': + return False + return True + + +class SSHClientTest (unittest.TestCase): + + def setUp(self): + self.sockl = socket.socket() + self.sockl.bind(('localhost', 0)) + self.sockl.listen(1) + self.addr, self.port = self.sockl.getsockname() + self.event = threading.Event() + thread = threading.Thread(target=self._run) + thread.start() + + def tearDown(self): + if hasattr(self, 'tc'): + self.tc.close() + self.ts.close() + self.socks.close() + self.sockl.close() + + def _run(self): + self.socks, addr = self.sockl.accept() + self.ts = paramiko.Transport(self.socks) + host_key = paramiko.RSAKey.from_private_key_file('tests/test_rsa.key') + self.ts.add_server_key(host_key) + server = NullServer() + self.ts.start_server(self.event, server) + + + def test_1_client(self): + """ + verify that the SSHClient stuff works too. + """ + host_key = paramiko.RSAKey.from_private_key_file('tests/test_rsa.key') + public_host_key = paramiko.RSAKey(data=str(host_key)) + + self.tc = paramiko.SSHClient() + self.tc.get_host_keys().add(self.addr, 'ssh-rsa', public_host_key) + self.tc.connect(self.addr, self.port, username='slowdive', password='pygmalion') + + self.event.wait(1.0) + self.assert_(self.event.isSet()) + self.assert_(self.ts.is_active()) + self.assertEquals('slowdive', self.ts.get_username()) + self.assertEquals(True, self.ts.is_authenticated()) + + stdin, stdout, stderr = self.tc.exec_command('yes') + schan = self.ts.accept(1.0) + + schan.send('Hello there.\n') + schan.send_stderr('This is on stderr.\n') + schan.close() + + self.assertEquals('Hello there.\n', stdout.readline()) + self.assertEquals('', stdout.readline()) + self.assertEquals('This is on stderr.\n', stderr.readline()) + self.assertEquals('', stderr.readline()) + + stdin.close() + stdout.close() + stderr.close() + + def test_2_client_dsa(self): + """ + verify that SSHClient works with a DSA key. + """ + host_key = paramiko.RSAKey.from_private_key_file('tests/test_rsa.key') + public_host_key = paramiko.RSAKey(data=str(host_key)) + + self.tc = paramiko.SSHClient() + self.tc.get_host_keys().add(self.addr, 'ssh-rsa', public_host_key) + self.tc.connect(self.addr, self.port, username='slowdive', key_filename='tests/test_dss.key') + + self.event.wait(1.0) + self.assert_(self.event.isSet()) + self.assert_(self.ts.is_active()) + self.assertEquals('slowdive', self.ts.get_username()) + self.assertEquals(True, self.ts.is_authenticated()) + + stdin, stdout, stderr = self.tc.exec_command('yes') + schan = self.ts.accept(1.0) + + schan.send('Hello there.\n') + schan.send_stderr('This is on stderr.\n') + schan.close() + + self.assertEquals('Hello there.\n', stdout.readline()) + self.assertEquals('', stdout.readline()) + self.assertEquals('This is on stderr.\n', stderr.readline()) + self.assertEquals('', stderr.readline()) + + stdin.close() + stdout.close() + stderr.close() + + def test_3_multiple_key_files(self): + """ + verify that SSHClient accepts and tries multiple key files. + """ + host_key = paramiko.RSAKey.from_private_key_file('tests/test_rsa.key') + public_host_key = paramiko.RSAKey(data=str(host_key)) + + self.tc = paramiko.SSHClient() + self.tc.get_host_keys().add(self.addr, 'ssh-rsa', public_host_key) + self.tc.connect(self.addr, self.port, username='slowdive', key_filename=[ 'tests/test_rsa.key', 'tests/test_dss.key' ]) + + self.event.wait(1.0) + self.assert_(self.event.isSet()) + self.assert_(self.ts.is_active()) + self.assertEquals('slowdive', self.ts.get_username()) + self.assertEquals(True, self.ts.is_authenticated()) + + def test_4_auto_add_policy(self): + """ + verify that SSHClient's AutoAddPolicy works. + """ + host_key = paramiko.RSAKey.from_private_key_file('tests/test_rsa.key') + public_host_key = paramiko.RSAKey(data=str(host_key)) + + self.tc = paramiko.SSHClient() + self.tc.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + self.assertEquals(0, len(self.tc.get_host_keys())) + self.tc.connect(self.addr, self.port, username='slowdive', password='pygmalion') + + self.event.wait(1.0) + self.assert_(self.event.isSet()) + self.assert_(self.ts.is_active()) + self.assertEquals('slowdive', self.ts.get_username()) + self.assertEquals(True, self.ts.is_authenticated()) + self.assertEquals(1, len(self.tc.get_host_keys())) + self.assertEquals(public_host_key, self.tc.get_host_keys()[self.addr]['ssh-rsa']) + + def test_5_cleanup(self): + """ + verify that when an SSHClient is collected, its transport (and the + transport's packetizer) is closed. + """ + host_key = paramiko.RSAKey.from_private_key_file('tests/test_rsa.key') + public_host_key = paramiko.RSAKey(data=str(host_key)) + + self.tc = paramiko.SSHClient() + self.tc.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + self.assertEquals(0, len(self.tc.get_host_keys())) + self.tc.connect(self.addr, self.port, username='slowdive', password='pygmalion') + + self.event.wait(1.0) + self.assert_(self.event.isSet()) + self.assert_(self.ts.is_active()) + + p = weakref.ref(self.tc._transport.packetizer) + self.assert_(p() is not None) + del self.tc + # hrm, sometimes p isn't cleared right away. why is that? + st = time.time() + while (time.time() - st < 5.0) and (p() is not None): + time.sleep(0.1) + self.assert_(p() is None) + diff --git a/tests/test_file.py b/tests/test_file.py old mode 100644 new mode 100755 index 250821c..d66babf --- a/tests/test_file.py +++ b/tests/test_file.py @@ -1,6 +1,4 @@ -#!/usr/bin/python - -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # diff --git a/tests/test_hostkeys.py b/tests/test_hostkeys.py new file mode 100644 index 0000000..28521ba --- /dev/null +++ b/tests/test_hostkeys.py @@ -0,0 +1,117 @@ +# Copyright (C) 2006-2007 Robey Pointer +# +# 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. + +""" +Some unit tests for HostKeys. +""" + +import base64 +from binascii import hexlify +import os +import unittest +import paramiko + + +test_hosts_file = """\ +secure.example.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA1PD6U2/TVxET6lkpKhOk5r\ +9q/kAYG6sP9f5zuUYP8i7FOFp/6ncCEbbtg/lB+A3iidyxoSWl+9jtoyyDOOVX4UIDV9G11Ml8om3\ +D+jrpI9cycZHqilK0HmxDeCuxbwyMuaCygU9gS2qoRvNLWZk70OpIKSSpBo0Wl3/XUmz9uhc= +happy.example.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA8bP1ZA7DCZDB9J0s50l31M\ +BGQ3GQ/Fc7SX6gkpXkwcZryoi4kNFhHu5LvHcZPdxXV1D+uTMfGS1eyd2Yz/DoNWXNAl8TI0cAsW\ +5ymME3bQ4J/k1IKxCtz/bAlAqFgKoc+EolMziDYqWIATtW0rYTJvzGAzTmMj80/QpsFH+Pc2M= +""" + +keyblob = """\ +AAAAB3NzaC1yc2EAAAABIwAAAIEA8bP1ZA7DCZDB9J0s50l31MBGQ3GQ/Fc7SX6gkpXkwcZryoi4k\ +NFhHu5LvHcZPdxXV1D+uTMfGS1eyd2Yz/DoNWXNAl8TI0cAsW5ymME3bQ4J/k1IKxCtz/bAlAqFgK\ +oc+EolMziDYqWIATtW0rYTJvzGAzTmMj80/QpsFH+Pc2M=""" + +keyblob_dss = """\ +AAAAB3NzaC1kc3MAAACBAOeBpgNnfRzr/twmAQRu2XwWAp3CFtrVnug6s6fgwj/oLjYbVtjAy6pl/\ +h0EKCWx2rf1IetyNsTxWrniA9I6HeDj65X1FyDkg6g8tvCnaNB8Xp/UUhuzHuGsMIipRxBxw9LF60\ +8EqZcj1E3ytktoW5B5OcjrkEoz3xG7C+rpIjYvAAAAFQDwz4UnmsGiSNu5iqjn3uTzwUpshwAAAIE\ +AkxfFeY8P2wZpDjX0MimZl5wkoFQDL25cPzGBuB4OnB8NoUk/yjAHIIpEShw8V+LzouMK5CTJQo5+\ +Ngw3qIch/WgRmMHy4kBq1SsXMjQCte1So6HBMvBPIW5SiMTmjCfZZiw4AYHK+B/JaOwaG9yRg2Ejg\ +4Ok10+XFDxlqZo8Y+wAAACARmR7CCPjodxASvRbIyzaVpZoJ/Z6x7dAumV+ysrV1BVYd0lYukmnjO\ +1kKBWApqpH1ve9XDQYN8zgxM4b16L21kpoWQnZtXrY3GZ4/it9kUgyB7+NwacIBlXa8cMDL7Q/69o\ +0d54U0X/NeX5QxuYR6OMJlrkQB7oiW/P/1mwjQgE=""" + + +class HostKeysTest (unittest.TestCase): + + def setUp(self): + f = open('hostfile.temp', 'w') + f.write(test_hosts_file) + f.close() + + def tearDown(self): + os.unlink('hostfile.temp') + + def test_1_load(self): + hostdict = paramiko.HostKeys('hostfile.temp') + self.assertEquals(2, len(hostdict)) + self.assertEquals(1, len(hostdict.values()[0])) + self.assertEquals(1, len(hostdict.values()[1])) + fp = hexlify(hostdict['secure.example.com']['ssh-rsa'].get_fingerprint()).upper() + self.assertEquals('E6684DB30E109B67B70FF1DC5C7F1363', fp) + + def test_2_add(self): + hostdict = paramiko.HostKeys('hostfile.temp') + hh = '|1|BMsIC6cUIP2zBuXR3t2LRcJYjzM=|hpkJMysjTk/+zzUUzxQEa2ieq6c=' + key = paramiko.RSAKey(data=base64.decodestring(keyblob)) + hostdict.add(hh, 'ssh-rsa', key) + self.assertEquals(3, len(hostdict)) + x = hostdict['foo.example.com'] + fp = hexlify(x['ssh-rsa'].get_fingerprint()).upper() + self.assertEquals('7EC91BB336CB6D810B124B1353C32396', fp) + self.assert_(hostdict.check('foo.example.com', key)) + + def test_3_dict(self): + hostdict = paramiko.HostKeys('hostfile.temp') + self.assert_('secure.example.com' in hostdict) + self.assert_('not.example.com' not in hostdict) + self.assert_(hostdict.has_key('secure.example.com')) + self.assert_(not hostdict.has_key('not.example.com')) + x = hostdict.get('secure.example.com', None) + self.assert_(x is not None) + fp = hexlify(x['ssh-rsa'].get_fingerprint()).upper() + self.assertEquals('E6684DB30E109B67B70FF1DC5C7F1363', fp) + i = 0 + for key in hostdict: + i += 1 + self.assertEquals(2, i) + + def test_4_dict_set(self): + hostdict = paramiko.HostKeys('hostfile.temp') + key = paramiko.RSAKey(data=base64.decodestring(keyblob)) + key_dss = paramiko.DSSKey(data=base64.decodestring(keyblob_dss)) + hostdict['secure.example.com'] = { + 'ssh-rsa': key, + 'ssh-dss': key_dss + } + hostdict['fake.example.com'] = {} + hostdict['fake.example.com']['ssh-rsa'] = key + + self.assertEquals(3, len(hostdict)) + self.assertEquals(2, len(hostdict.values()[0])) + self.assertEquals(1, len(hostdict.values()[1])) + self.assertEquals(1, len(hostdict.values()[2])) + fp = hexlify(hostdict['secure.example.com']['ssh-rsa'].get_fingerprint()).upper() + self.assertEquals('7EC91BB336CB6D810B124B1353C32396', fp) + fp = hexlify(hostdict['secure.example.com']['ssh-dss'].get_fingerprint()).upper() + self.assertEquals('4478F0B9A23CC5182009FF755BC1D26C', fp) diff --git a/tests/test_kex.py b/tests/test_kex.py index 2680853..f304275 100644 --- a/tests/test_kex.py +++ b/tests/test_kex.py @@ -1,6 +1,4 @@ -#!/usr/bin/python - -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -22,6 +20,7 @@ Some unit tests for the key exchange protocols. """ +from binascii import hexlify import unittest import paramiko.util from paramiko.kex_group1 import KexGroup1 @@ -35,18 +34,21 @@ class FakeRandpool (object): def get_bytes(self, n): return chr(0xcc) * n + class FakeKey (object): def __str__(self): return 'fake-key' def sign_ssh_data(self, randpool, H): return 'fake-sig' + class FakeModulusPack (object): P = 0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFFL G = 2 def get_modulus(self, min, ask, max): return self.G, self.P + class FakeTransport (object): randpool = FakeRandpool() local_version = 'SSH-2.0-paramiko_1.0' @@ -56,7 +58,7 @@ class FakeTransport (object): def _send_message(self, m): self._message = m - def _expect_packet(self, t): + def _expect_packet(self, *t): self._expect = t def _set_K_H(self, K, H): self._K = K @@ -89,8 +91,8 @@ class KexTest (unittest.TestCase): kex = KexGroup1(transport) kex.start_kex() x = '1E000000807E2DDB1743F3487D6545F04F1C8476092FB912B013626AB5BCEB764257D88BBA64243B9F348DF7B41B8C814A995E00299913503456983FFB9178D3CD79EB6D55522418A8ABF65375872E55938AB99A84A0B5FC8A1ECC66A7C3766E7E0F80B7CE2C9225FC2DD683F4764244B72963BBB383F529DCF0C5D17740B8A2ADBE9208D4' - self.assertEquals(x, paramiko.util.hexify(str(transport._message))) - self.assertEquals(paramiko.kex_group1._MSG_KEXDH_REPLY, transport._expect) + self.assertEquals(x, hexlify(str(transport._message)).upper()) + self.assertEquals((paramiko.kex_group1._MSG_KEXDH_REPLY,), transport._expect) # fake "reply" msg = Message() @@ -101,7 +103,7 @@ class KexTest (unittest.TestCase): kex.parse_next(paramiko.kex_group1._MSG_KEXDH_REPLY, msg) H = '03079780F3D3AD0B3C6DB30C8D21685F367A86D2' self.assertEquals(self.K, transport._K) - self.assertEquals(H, paramiko.util.hexify(transport._H)) + self.assertEquals(H, hexlify(transport._H).upper()) self.assertEquals(('fake-host-key', 'fake-sig'), transport._verify) self.assert_(transport._activated) @@ -110,7 +112,7 @@ class KexTest (unittest.TestCase): transport.server_mode = True kex = KexGroup1(transport) kex.start_kex() - self.assertEquals(paramiko.kex_group1._MSG_KEXDH_INIT, transport._expect) + self.assertEquals((paramiko.kex_group1._MSG_KEXDH_INIT,), transport._expect) msg = Message() msg.add_mpint(69) @@ -119,8 +121,8 @@ class KexTest (unittest.TestCase): H = 'B16BF34DD10945EDE84E9C1EF24A14BFDC843389' x = '1F0000000866616B652D6B6579000000807E2DDB1743F3487D6545F04F1C8476092FB912B013626AB5BCEB764257D88BBA64243B9F348DF7B41B8C814A995E00299913503456983FFB9178D3CD79EB6D55522418A8ABF65375872E55938AB99A84A0B5FC8A1ECC66A7C3766E7E0F80B7CE2C9225FC2DD683F4764244B72963BBB383F529DCF0C5D17740B8A2ADBE9208D40000000866616B652D736967' self.assertEquals(self.K, transport._K) - self.assertEquals(H, paramiko.util.hexify(transport._H)) - self.assertEquals(x, paramiko.util.hexify(str(transport._message))) + self.assertEquals(H, hexlify(transport._H).upper()) + self.assertEquals(x, hexlify(str(transport._message)).upper()) self.assert_(transport._activated) def test_3_gex_client(self): @@ -129,8 +131,8 @@ class KexTest (unittest.TestCase): kex = KexGex(transport) kex.start_kex() x = '22000004000000080000002000' - self.assertEquals(x, paramiko.util.hexify(str(transport._message))) - self.assertEquals(paramiko.kex_gex._MSG_KEXDH_GEX_GROUP, transport._expect) + self.assertEquals(x, hexlify(str(transport._message)).upper()) + self.assertEquals((paramiko.kex_gex._MSG_KEXDH_GEX_GROUP,), transport._expect) msg = Message() msg.add_mpint(FakeModulusPack.P) @@ -138,8 +140,8 @@ class KexTest (unittest.TestCase): msg.rewind() kex.parse_next(paramiko.kex_gex._MSG_KEXDH_GEX_GROUP, msg) x = '20000000807E2DDB1743F3487D6545F04F1C8476092FB912B013626AB5BCEB764257D88BBA64243B9F348DF7B41B8C814A995E00299913503456983FFB9178D3CD79EB6D55522418A8ABF65375872E55938AB99A84A0B5FC8A1ECC66A7C3766E7E0F80B7CE2C9225FC2DD683F4764244B72963BBB383F529DCF0C5D17740B8A2ADBE9208D4' - self.assertEquals(x, paramiko.util.hexify(str(transport._message))) - self.assertEquals(paramiko.kex_gex._MSG_KEXDH_GEX_REPLY, transport._expect) + self.assertEquals(x, hexlify(str(transport._message)).upper()) + self.assertEquals((paramiko.kex_gex._MSG_KEXDH_GEX_REPLY,), transport._expect) msg = Message() msg.add_string('fake-host-key') @@ -149,16 +151,46 @@ class KexTest (unittest.TestCase): kex.parse_next(paramiko.kex_gex._MSG_KEXDH_GEX_REPLY, msg) H = 'A265563F2FA87F1A89BF007EE90D58BE2E4A4BD0' self.assertEquals(self.K, transport._K) - self.assertEquals(H, paramiko.util.hexify(transport._H)) + self.assertEquals(H, hexlify(transport._H).upper()) self.assertEquals(('fake-host-key', 'fake-sig'), transport._verify) self.assert_(transport._activated) - def test_4_gex_server(self): + def test_4_gex_old_client(self): + transport = FakeTransport() + transport.server_mode = False + kex = KexGex(transport) + kex.start_kex(_test_old_style=True) + x = '1E00000800' + self.assertEquals(x, hexlify(str(transport._message)).upper()) + self.assertEquals((paramiko.kex_gex._MSG_KEXDH_GEX_GROUP,), transport._expect) + + msg = Message() + msg.add_mpint(FakeModulusPack.P) + msg.add_mpint(FakeModulusPack.G) + msg.rewind() + kex.parse_next(paramiko.kex_gex._MSG_KEXDH_GEX_GROUP, msg) + x = '20000000807E2DDB1743F3487D6545F04F1C8476092FB912B013626AB5BCEB764257D88BBA64243B9F348DF7B41B8C814A995E00299913503456983FFB9178D3CD79EB6D55522418A8ABF65375872E55938AB99A84A0B5FC8A1ECC66A7C3766E7E0F80B7CE2C9225FC2DD683F4764244B72963BBB383F529DCF0C5D17740B8A2ADBE9208D4' + self.assertEquals(x, hexlify(str(transport._message)).upper()) + self.assertEquals((paramiko.kex_gex._MSG_KEXDH_GEX_REPLY,), transport._expect) + + msg = Message() + msg.add_string('fake-host-key') + msg.add_mpint(69) + msg.add_string('fake-sig') + msg.rewind() + kex.parse_next(paramiko.kex_gex._MSG_KEXDH_GEX_REPLY, msg) + H = '807F87B269EF7AC5EC7E75676808776A27D5864C' + self.assertEquals(self.K, transport._K) + self.assertEquals(H, hexlify(transport._H).upper()) + self.assertEquals(('fake-host-key', 'fake-sig'), transport._verify) + self.assert_(transport._activated) + + def test_5_gex_server(self): transport = FakeTransport() transport.server_mode = True kex = KexGex(transport) kex.start_kex() - self.assertEquals(paramiko.kex_gex._MSG_KEXDH_GEX_REQUEST, transport._expect) + self.assertEquals((paramiko.kex_gex._MSG_KEXDH_GEX_REQUEST, paramiko.kex_gex._MSG_KEXDH_GEX_REQUEST_OLD), transport._expect) msg = Message() msg.add_int(1024) @@ -167,8 +199,8 @@ class KexTest (unittest.TestCase): msg.rewind() kex.parse_next(paramiko.kex_gex._MSG_KEXDH_GEX_REQUEST, msg) x = '1F0000008100FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF0000000102' - self.assertEquals(x, paramiko.util.hexify(str(transport._message))) - self.assertEquals(paramiko.kex_gex._MSG_KEXDH_GEX_INIT, transport._expect) + self.assertEquals(x, hexlify(str(transport._message)).upper()) + self.assertEquals((paramiko.kex_gex._MSG_KEXDH_GEX_INIT,), transport._expect) msg = Message() msg.add_mpint(12345) @@ -178,6 +210,33 @@ class KexTest (unittest.TestCase): H = 'CE754197C21BF3452863B4F44D0B3951F12516EF' x = '210000000866616B652D6B6579000000807E2DDB1743F3487D6545F04F1C8476092FB912B013626AB5BCEB764257D88BBA64243B9F348DF7B41B8C814A995E00299913503456983FFB9178D3CD79EB6D55522418A8ABF65375872E55938AB99A84A0B5FC8A1ECC66A7C3766E7E0F80B7CE2C9225FC2DD683F4764244B72963BBB383F529DCF0C5D17740B8A2ADBE9208D40000000866616B652D736967' self.assertEquals(K, transport._K) - self.assertEquals(H, paramiko.util.hexify(transport._H)) - self.assertEquals(x, paramiko.util.hexify(str(transport._message))) + self.assertEquals(H, hexlify(transport._H).upper()) + self.assertEquals(x, hexlify(str(transport._message)).upper()) + self.assert_(transport._activated) + + def test_6_gex_server_with_old_client(self): + transport = FakeTransport() + transport.server_mode = True + kex = KexGex(transport) + kex.start_kex() + self.assertEquals((paramiko.kex_gex._MSG_KEXDH_GEX_REQUEST, paramiko.kex_gex._MSG_KEXDH_GEX_REQUEST_OLD), transport._expect) + + msg = Message() + msg.add_int(2048) + msg.rewind() + kex.parse_next(paramiko.kex_gex._MSG_KEXDH_GEX_REQUEST_OLD, msg) + x = '1F0000008100FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF0000000102' + self.assertEquals(x, hexlify(str(transport._message)).upper()) + self.assertEquals((paramiko.kex_gex._MSG_KEXDH_GEX_INIT,), transport._expect) + + msg = Message() + msg.add_mpint(12345) + msg.rewind() + kex.parse_next(paramiko.kex_gex._MSG_KEXDH_GEX_INIT, msg) + K = 67592995013596137876033460028393339951879041140378510871612128162185209509220726296697886624612526735888348020498716482757677848959420073720160491114319163078862905400020959196386947926388406687288901564192071077389283980347784184487280885335302632305026248574716290537036069329724382811853044654824945750581L + H = 'B41A06B2E59043CEFC1AE16EC31F1E2D12EC455B' + x = '210000000866616B652D6B6579000000807E2DDB1743F3487D6545F04F1C8476092FB912B013626AB5BCEB764257D88BBA64243B9F348DF7B41B8C814A995E00299913503456983FFB9178D3CD79EB6D55522418A8ABF65375872E55938AB99A84A0B5FC8A1ECC66A7C3766E7E0F80B7CE2C9225FC2DD683F4764244B72963BBB383F529DCF0C5D17740B8A2ADBE9208D40000000866616B652D736967' + self.assertEquals(K, transport._K) + self.assertEquals(H, hexlify(transport._H).upper()) + self.assertEquals(x, hexlify(str(transport._message)).upper()) self.assert_(transport._activated) diff --git a/tests/test_message.py b/tests/test_message.py index 441e3ce..e930f71 100644 --- a/tests/test_message.py +++ b/tests/test_message.py @@ -1,6 +1,4 @@ -#!/usr/bin/python - -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # diff --git a/tests/test_packetizer.py b/tests/test_packetizer.py index 8c992bd..cb6248f 100644 --- a/tests/test_packetizer.py +++ b/tests/test_packetizer.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # diff --git a/tests/test_pkey.py b/tests/test_pkey.py index e56edb1..e591ab1 100644 --- a/tests/test_pkey.py +++ b/tests/test_pkey.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -20,6 +20,8 @@ Some unit tests for public/private key objects. """ +from binascii import hexlify, unhexlify +import StringIO import unittest from paramiko import RSAKey, DSSKey, Message, util, randpool @@ -30,6 +32,39 @@ FINGER_RSA = '1024 60:73:38:44:cb:51:86:65:7f:de:da:a2:2b:5a:57:d5' FINGER_DSS = '1024 44:78:f0:b9:a2:3c:c5:18:20:09:ff:75:5b:c1:d2:6c' SIGNED_RSA = '20:d7:8a:31:21:cb:f7:92:12:f2:a4:89:37:f5:78:af:e6:16:b6:25:b9:97:3d:a2:cd:5f:ca:20:21:73:4c:ad:34:73:8f:20:77:28:e2:94:15:08:d8:91:40:7a:85:83:bf:18:37:95:dc:54:1a:9b:88:29:6c:73:ca:38:b4:04:f1:56:b9:f2:42:9d:52:1b:29:29:b4:4f:fd:c9:2d:af:47:d2:40:76:30:f3:63:45:0c:d9:1d:43:86:0f:1c:70:e2:93:12:34:f3:ac:c5:0a:2f:14:50:66:59:f1:88:ee:c1:4a:e9:d1:9c:4e:46:f0:0e:47:6f:38:74:f1:44:a8' +RSA_PRIVATE_OUT = """\ +-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKCAIEA049W6geFpmsljTwfvI1UmKWWJPNFI74+vNKTk4dmzkQY2yAM +s6FhlvhlI8ysU4oj71ZsRYMecHbBbxdN79+JRFVYTKaLqjwGENeTd+yv4q+V2PvZ +v3fLnzApI3l7EJCqhWwJUHJ1jAkZzqDx0tyOL4uoZpww3nmE0kb3y21tH4cCASMC +ggCAEiI6plhqipt4P05L3PYr0pHZq2VPEbE4k9eI/gRKo/c1VJxY3DJnc1cenKsk +trQRtW3OxCEufqsX5PNec6VyKkW+Ox6beJjMKm4KF8ZDpKi9Nw6MdX3P6Gele9D9 ++ieyhVFljrnAqcXsgChTBOYlL2imqCs3qRGAJ3cMBIAx3VsCQQD3pIFVYW398kE0 +n0e1icEpkbDRV4c5iZVhu8xKy2yyfy6f6lClSb2+Ub9uns7F3+b5v0pYSHbE9+/r +OpRq83AfAkEA2rMZlr8SnMXgnyka2LuggA9QgMYy18hyao1dUxySubNDa9N+q2QR +mwDisTUgRFHKIlDHoQmzPbXAmYZX1YlDmQJBAPCRLS5epV0XOAc7pL762OaNhzHC +veAfQKgVhKBt105PqaKpGyQ5AXcNlWQlPeTK4GBTbMrKDPna6RBkyrEJvV8CQBK+ +5O+p+kfztCrmRCE0p1tvBuZ3Y3GU1ptrM+KNa6mEZN1bRV8l1Z+SXJLYqv6Kquz/ +nBUeFq2Em3rfoSDugiMCQDyG3cxD5dKX3IgkhLyBWls/FLDk4x/DQ+NUTu0F1Cu6 +JJye+5ARLkL0EweMXf0tmIYfWItDLsWB0fKg/56h0js= +-----END RSA PRIVATE KEY----- +""" + +DSS_PRIVATE_OUT = """\ +-----BEGIN DSA PRIVATE KEY----- +MIIBvgIBAAKCAIEA54GmA2d9HOv+3CYBBG7ZfBYCncIW2tWe6Dqzp+DCP+guNhtW +2MDLqmX+HQQoJbHat/Uh63I2xPFaueID0jod4OPrlfUXIOSDqDy28Kdo0Hxen9RS +G7Me4awwiKlHEHHD0sXrTwSplyPUTfK2S2hbkHk5yOuQSjPfEbsL6ukiNi8CFQDw +z4UnmsGiSNu5iqjn3uTzwUpshwKCAIEAkxfFeY8P2wZpDjX0MimZl5wkoFQDL25c +PzGBuB4OnB8NoUk/yjAHIIpEShw8V+LzouMK5CTJQo5+Ngw3qIch/WgRmMHy4kBq +1SsXMjQCte1So6HBMvBPIW5SiMTmjCfZZiw4AYHK+B/JaOwaG9yRg2Ejg4Ok10+X +FDxlqZo8Y+wCggCARmR7CCPjodxASvRbIyzaVpZoJ/Z6x7dAumV+ysrV1BVYd0lY +ukmnjO1kKBWApqpH1ve9XDQYN8zgxM4b16L21kpoWQnZtXrY3GZ4/it9kUgyB7+N +wacIBlXa8cMDL7Q/69o0d54U0X/NeX5QxuYR6OMJlrkQB7oiW/P/1mwjQgECFGI9 +QPSch9pT9XHqn+1rZ4bK+QGA +-----END DSA PRIVATE KEY----- +""" + class KeyTest (unittest.TestCase): @@ -42,23 +77,30 @@ class KeyTest (unittest.TestCase): def test_1_generate_key_bytes(self): from Crypto.Hash import MD5 key = util.generate_key_bytes(MD5, '\x01\x02\x03\x04', 'happy birthday', 30) - exp = util.unhexify('61E1F272F4C1C4561586BD322498C0E924672780F47BB37DDA7D54019E64') + exp = unhexlify('61E1F272F4C1C4561586BD322498C0E924672780F47BB37DDA7D54019E64') self.assertEquals(exp, key) def test_2_load_rsa(self): key = RSAKey.from_private_key_file('tests/test_rsa.key') self.assertEquals('ssh-rsa', key.get_name()) exp_rsa = FINGER_RSA.split()[1].replace(':', '') - my_rsa = util.hexify(key.get_fingerprint()).lower() + my_rsa = hexlify(key.get_fingerprint()) self.assertEquals(exp_rsa, my_rsa) self.assertEquals(PUB_RSA.split()[1], key.get_base64()) self.assertEquals(1024, key.get_bits()) + s = StringIO.StringIO() + key.write_private_key(s) + self.assertEquals(RSA_PRIVATE_OUT, s.getvalue()) + s.seek(0) + key2 = RSAKey.from_private_key(s) + self.assertEquals(key, key2) + def test_3_load_rsa_password(self): key = RSAKey.from_private_key_file('tests/test_rsa_password.key', 'television') self.assertEquals('ssh-rsa', key.get_name()) exp_rsa = FINGER_RSA.split()[1].replace(':', '') - my_rsa = util.hexify(key.get_fingerprint()).lower() + my_rsa = hexlify(key.get_fingerprint()) self.assertEquals(exp_rsa, my_rsa) self.assertEquals(PUB_RSA.split()[1], key.get_base64()) self.assertEquals(1024, key.get_bits()) @@ -67,16 +109,23 @@ class KeyTest (unittest.TestCase): key = DSSKey.from_private_key_file('tests/test_dss.key') self.assertEquals('ssh-dss', key.get_name()) exp_dss = FINGER_DSS.split()[1].replace(':', '') - my_dss = util.hexify(key.get_fingerprint()).lower() + my_dss = hexlify(key.get_fingerprint()) self.assertEquals(exp_dss, my_dss) self.assertEquals(PUB_DSS.split()[1], key.get_base64()) self.assertEquals(1024, key.get_bits()) + s = StringIO.StringIO() + key.write_private_key(s) + self.assertEquals(DSS_PRIVATE_OUT, s.getvalue()) + s.seek(0) + key2 = DSSKey.from_private_key(s) + self.assertEquals(key, key2) + def test_5_load_dss_password(self): key = DSSKey.from_private_key_file('tests/test_dss_password.key', 'television') self.assertEquals('ssh-dss', key.get_name()) exp_dss = FINGER_DSS.split()[1].replace(':', '') - my_dss = util.hexify(key.get_fingerprint()).lower() + my_dss = hexlify(key.get_fingerprint()) self.assertEquals(exp_dss, my_dss) self.assertEquals(PUB_DSS.split()[1], key.get_base64()) self.assertEquals(1024, key.get_bits()) diff --git a/tests/test_sftp.py b/tests/test_sftp.py old mode 100644 new mode 100755 index 993899a..edc0599 --- a/tests/test_sftp.py +++ b/tests/test_sftp.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -23,9 +23,11 @@ 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 binascii import hexlify import logging import os import random +import struct import sys import threading import time @@ -69,6 +71,11 @@ tc = None g_big_file_test = True +def get_sftp(): + global sftp + return sftp + + class SFTPTest (unittest.TestCase): def init(hostname, username, keyfile, passwd): @@ -273,28 +280,85 @@ class SFTPTest (unittest.TestCase): def test_8_setstat(self): """ - verify that the setstat functions (chown, chmod, utime) work. + verify that the setstat functions (chown, chmod, utime, truncate) work. """ f = sftp.open(FOLDER + '/special', 'w') try: + f.write('x' * 1024) f.close() stat = sftp.stat(FOLDER + '/special') sftp.chmod(FOLDER + '/special', (stat.st_mode & ~0777) | 0600) - self.assertEqual(sftp.stat(FOLDER + '/special').st_mode & 0777, 0600) + stat = sftp.stat(FOLDER + '/special') + expected_mode = 0600 + if sys.platform == 'win32': + # chmod not really functional on windows + expected_mode = 0666 + if sys.platform == 'cygwin': + # even worse. + expected_mode = 0644 + self.assertEqual(stat.st_mode & 0777, expected_mode) + self.assertEqual(stat.st_size, 1024) mtime = stat.st_mtime - 3600 atime = stat.st_atime - 1800 sftp.utime(FOLDER + '/special', (atime, mtime)) - nstat = sftp.stat(FOLDER + '/special') - self.assertEqual(nstat.st_mtime, mtime) - self.assertEqual(nstat.st_atime, atime) + stat = sftp.stat(FOLDER + '/special') + self.assertEqual(stat.st_mtime, mtime) + if sys.platform not in ('win32', 'cygwin'): + self.assertEqual(stat.st_atime, atime) # can't really test chown, since we'd have to know a valid uid. + + sftp.truncate(FOLDER + '/special', 512) + stat = sftp.stat(FOLDER + '/special') + self.assertEqual(stat.st_size, 512) finally: sftp.remove(FOLDER + '/special') - def test_9_readline_seek(self): + def test_9_fsetstat(self): + """ + verify that the fsetstat functions (chown, chmod, utime, truncate) + work on open files. + """ + f = sftp.open(FOLDER + '/special', 'w') + try: + f.write('x' * 1024) + f.close() + + f = sftp.open(FOLDER + '/special', 'r+') + stat = f.stat() + f.chmod((stat.st_mode & ~0777) | 0600) + stat = f.stat() + + expected_mode = 0600 + if sys.platform == 'win32': + # chmod not really functional on windows + expected_mode = 0666 + if sys.platform == 'cygwin': + # even worse. + expected_mode = 0644 + self.assertEqual(stat.st_mode & 0777, expected_mode) + self.assertEqual(stat.st_size, 1024) + + mtime = stat.st_mtime - 3600 + atime = stat.st_atime - 1800 + f.utime((atime, mtime)) + stat = f.stat() + self.assertEqual(stat.st_mtime, mtime) + if sys.platform not in ('win32', 'cygwin'): + self.assertEqual(stat.st_atime, atime) + + # can't really test chown, since we'd have to know a valid uid. + + f.truncate(512) + stat = f.stat() + self.assertEqual(stat.st_size, 512) + f.close() + finally: + sftp.remove(FOLDER + '/special') + + def test_A_readline_seek(self): """ create a text file and write a bunch of text into it. then count the lines in the file, and seek around to retreive particular lines. this should @@ -324,7 +388,7 @@ class SFTPTest (unittest.TestCase): finally: sftp.remove(FOLDER + '/duck.txt') - def test_A_write_seek(self): + def test_B_write_seek(self): """ create a text file, seek back and change part of it, and verify that the changes worked. @@ -344,10 +408,14 @@ class SFTPTest (unittest.TestCase): finally: sftp.remove(FOLDER + '/testing.txt') - def test_B_symlink(self): + def test_C_symlink(self): """ create a symlink and then check that lstat doesn't follow it. """ + if not hasattr(os, "symlink"): + # skip symlink tests on windows + return + f = sftp.open(FOLDER + '/original.txt', 'w') try: f.write('original\n') @@ -387,7 +455,7 @@ class SFTPTest (unittest.TestCase): except: pass - def test_C_flush_seek(self): + def test_D_flush_seek(self): """ verify that buffered writes are automatically flushed on seek. """ @@ -409,183 +477,7 @@ class SFTPTest (unittest.TestCase): except: pass - def test_D_lots_of_files(self): - """ - create a bunch of files over the same session. - """ - global g_big_file_test - if not g_big_file_test: - return - numfiles = 100 - try: - for i in range(numfiles): - f = sftp.open('%s/file%d.txt' % (FOLDER, i), 'w', 1) - f.write('this is file #%d.\n' % i) - f.close() - sftp.chmod('%s/file%d.txt' % (FOLDER, i), 0660) - - # now make sure every file is there, by creating a list of filenmes - # and reading them in random order. - numlist = range(numfiles) - while len(numlist) > 0: - r = numlist[random.randint(0, len(numlist) - 1)] - f = sftp.open('%s/file%d.txt' % (FOLDER, r)) - self.assertEqual(f.readline(), 'this is file #%d.\n' % r) - f.close() - numlist.remove(r) - finally: - for i in range(numfiles): - try: - sftp.remove('%s/file%d.txt' % (FOLDER, i)) - except: - pass - - def test_E_big_file(self): - """ - write a 1MB file with no buffering. - """ - global g_big_file_test - if not g_big_file_test: - return - kblob = (1024 * 'x') - start = time.time() - try: - f = sftp.open('%s/hongry.txt' % FOLDER, 'w') - for n in range(1024): - f.write(kblob) - if n % 128 == 0: - sys.stderr.write('.') - f.close() - sys.stderr.write(' ') - - self.assertEqual(sftp.stat('%s/hongry.txt' % FOLDER).st_size, 1024 * 1024) - end = time.time() - sys.stderr.write('%ds ' % round(end - start)) - - start = time.time() - f = sftp.open('%s/hongry.txt' % FOLDER, 'r') - for n in range(1024): - data = f.read(1024) - self.assertEqual(data, kblob) - f.close() - - end = time.time() - sys.stderr.write('%ds ' % round(end - start)) - finally: - sftp.remove('%s/hongry.txt' % FOLDER) - - def test_F_big_file_pipelined(self): - """ - write a 1MB file, with no linefeeds, using pipelining. - """ - global g_big_file_test - if not g_big_file_test: - return - kblob = (1024 * 'x') - start = time.time() - try: - f = sftp.open('%s/hongry.txt' % FOLDER, 'w') - f.set_pipelined(True) - for n in range(1024): - f.write(kblob) - if n % 128 == 0: - sys.stderr.write('.') - f.close() - sys.stderr.write(' ') - - self.assertEqual(sftp.stat('%s/hongry.txt' % FOLDER).st_size, 1024 * 1024) - end = time.time() - sys.stderr.write('%ds ' % round(end - start)) - - start = time.time() - f = sftp.open('%s/hongry.txt' % FOLDER, 'r') - f.prefetch() - for n in range(1024): - data = f.read(1024) - self.assertEqual(data, kblob) - f.close() - - end = time.time() - sys.stderr.write('%ds ' % round(end - start)) - finally: - sftp.remove('%s/hongry.txt' % FOLDER) - - def test_G_lots_of_prefetching(self): - """ - prefetch a 1MB file a bunch of times, discarding the file object - without using it, to verify that paramiko doesn't get confused. - """ - global g_big_file_test - if not g_big_file_test: - return - kblob = (1024 * 'x') - try: - f = sftp.open('%s/hongry.txt' % FOLDER, 'w') - f.set_pipelined(True) - for n in range(1024): - f.write(kblob) - if n % 128 == 0: - sys.stderr.write('.') - f.close() - sys.stderr.write(' ') - - self.assertEqual(sftp.stat('%s/hongry.txt' % FOLDER).st_size, 1024 * 1024) - - for i in range(10): - f = sftp.open('%s/hongry.txt' % FOLDER, 'r') - f.prefetch() - f = sftp.open('%s/hongry.txt' % FOLDER, 'r') - f.prefetch() - for n in range(1024): - data = f.read(1024) - self.assertEqual(data, kblob) - if n % 128 == 0: - sys.stderr.write('.') - f.close() - sys.stderr.write(' ') - finally: - sftp.remove('%s/hongry.txt' % FOLDER) - - def test_H_big_file_big_buffer(self): - """ - write a 1MB file, with no linefeeds, and a big buffer. - """ - global g_big_file_test - if not g_big_file_test: - return - mblob = (1024 * 1024 * 'x') - try: - f = sftp.open('%s/hongry.txt' % FOLDER, 'w', 128 * 1024) - f.write(mblob) - f.close() - - self.assertEqual(sftp.stat('%s/hongry.txt' % FOLDER).st_size, 1024 * 1024) - finally: - sftp.remove('%s/hongry.txt' % FOLDER) - - def test_I_big_file_renegotiate(self): - """ - write a 1MB file, forcing key renegotiation in the middle. - """ - global g_big_file_test - if not g_big_file_test: - return - t = sftp.sock.get_transport() - t.packetizer.REKEY_BYTES = 512 * 1024 - k32blob = (32 * 1024 * 'x') - try: - f = sftp.open('%s/hongry.txt' % FOLDER, 'w', 128 * 1024) - for i in xrange(32): - f.write(k32blob) - f.close() - - self.assertEqual(sftp.stat('%s/hongry.txt' % FOLDER).st_size, 1024 * 1024) - self.assertNotEquals(t.H, t.session_id) - finally: - sftp.remove('%s/hongry.txt' % FOLDER) - t.packetizer.REKEY_BYTES = pow(2, 30) - - def test_J_realpath(self): + def test_E_realpath(self): """ test that realpath is returning something non-empty and not an error. @@ -596,7 +488,7 @@ class SFTPTest (unittest.TestCase): self.assert_(len(f) > 0) self.assertEquals(os.path.join(pwd, FOLDER), f) - def test_K_mkdir(self): + def test_F_mkdir(self): """ verify that mkdir/rmdir work. """ @@ -619,7 +511,7 @@ class SFTPTest (unittest.TestCase): except IOError: pass - def test_L_chdir(self): + def test_G_chdir(self): """ verify that chdir/getcwd work. """ @@ -656,7 +548,7 @@ class SFTPTest (unittest.TestCase): except: pass - def test_M_get_put(self): + def test_H_get_put(self): """ verify that get/put work. """ @@ -665,27 +557,33 @@ class SFTPTest (unittest.TestCase): localname = os.tempnam() text = 'All I wanted was a plastic bunny rabbit.\n' - f = open(localname, 'w') + f = open(localname, 'wb') f.write(text) f.close() - sftp.put(localname, FOLDER + '/bunny.txt') + saved_progress = [] + def progress_callback(x, y): + saved_progress.append((x, y)) + sftp.put(localname, FOLDER + '/bunny.txt', progress_callback) f = sftp.open(FOLDER + '/bunny.txt', 'r') self.assertEquals(text, f.read(128)) f.close() + self.assertEquals((41, 41), saved_progress[-1]) os.unlink(localname) localname = os.tempnam() - sftp.get(FOLDER + '/bunny.txt', localname) + saved_progress = [] + sftp.get(FOLDER + '/bunny.txt', localname, progress_callback) - f = open(localname, 'r') + f = open(localname, 'rb') self.assertEquals(text, f.read(128)) f.close() + self.assertEquals((41, 41), saved_progress[-1]) os.unlink(localname) sftp.unlink(FOLDER + '/bunny.txt') - def test_N_check(self): + def test_I_check(self): """ verify that file.check() works against our own server. (it's an sftp extension that we support, and may be the only ones who @@ -698,16 +596,17 @@ class SFTPTest (unittest.TestCase): try: f = sftp.open(FOLDER + '/kitty.txt', 'r') sum = f.check('sha1') - self.assertEquals('91059CFC6615941378D413CB5ADAF4C5EB293402', paramiko.util.hexify(sum)) + self.assertEquals('91059CFC6615941378D413CB5ADAF4C5EB293402', hexlify(sum).upper()) sum = f.check('md5', 0, 512) - self.assertEquals('93DE4788FCA28D471516963A1FE3856A', paramiko.util.hexify(sum)) + self.assertEquals('93DE4788FCA28D471516963A1FE3856A', hexlify(sum).upper()) sum = f.check('md5', 0, 0, 510) self.assertEquals('EB3B45B8CD55A0707D99B177544A319F373183D241432BB2157AB9E46358C4AC90370B5CADE5D90336FC1716F90B36D6', - paramiko.util.hexify(sum)) + hexlify(sum).upper()) + f.close() finally: sftp.unlink(FOLDER + '/kitty.txt') - def test_O_x_flag(self): + def test_J_x_flag(self): """ verify that the 'x' flag works when opening a file. """ @@ -723,7 +622,7 @@ class SFTPTest (unittest.TestCase): finally: sftp.unlink(FOLDER + '/unusual.txt') - def test_P_utf8(self): + def test_K_utf8(self): """ verify that unicode strings are encoded into utf8 correctly. """ @@ -738,3 +637,43 @@ class SFTPTest (unittest.TestCase): self.fail('exception ' + e) sftp.unlink(FOLDER + '/\xc3\xbcnic\xc3\xb8\x64\x65') + def test_L_bad_readv(self): + """ + verify that readv at the end of the file doesn't essplode. + """ + f = sftp.open(FOLDER + '/zero', 'w') + f.close() + try: + f = sftp.open(FOLDER + '/zero', 'r') + data = f.readv([(0, 12)]) + f.close() + + f = sftp.open(FOLDER + '/zero', 'r') + f.prefetch() + data = f.read(100) + f.close() + finally: + sftp.unlink(FOLDER + '/zero') + + def XXX_test_M_seek_append(self): + """ + verify that seek does't affect writes during append. + + does not work except through paramiko. :( openssh fails. + """ + f = sftp.open(FOLDER + '/append.txt', 'a') + try: + f.write('first line\nsecond line\n') + f.seek(11, f.SEEK_SET) + f.write('third line\n') + f.close() + + f = sftp.open(FOLDER + '/append.txt', 'r') + self.assertEqual(f.stat().st_size, 34) + self.assertEqual(f.readline(), 'first line\n') + self.assertEqual(f.readline(), 'second line\n') + self.assertEqual(f.readline(), 'third line\n') + f.close() + finally: + sftp.remove(FOLDER + '/append.txt') + diff --git a/tests/test_sftp_big.py b/tests/test_sftp_big.py new file mode 100644 index 0000000..c182762 --- /dev/null +++ b/tests/test_sftp_big.py @@ -0,0 +1,385 @@ +# Copyright (C) 2003-2007 Robey Pointer +# +# 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. + +""" +some unit tests to make sure sftp works well with large files. + +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). +""" + +import logging +import os +import random +import struct +import sys +import threading +import time +import unittest + +import paramiko +from stub_sftp import StubServer, StubSFTPServer +from loop import LoopSocket +from test_sftp import get_sftp + +FOLDER = os.environ.get('TEST_FOLDER', 'temp-testing000') + + +class BigSFTPTest (unittest.TestCase): + + def setUp(self): + global FOLDER + sftp = get_sftp() + for i in xrange(1000): + FOLDER = FOLDER[:-3] + '%03d' % i + try: + sftp.mkdir(FOLDER) + break + except (IOError, OSError): + pass + + def tearDown(self): + sftp = get_sftp() + sftp.rmdir(FOLDER) + + def test_1_lots_of_files(self): + """ + create a bunch of files over the same session. + """ + sftp = get_sftp() + numfiles = 100 + try: + for i in range(numfiles): + f = sftp.open('%s/file%d.txt' % (FOLDER, i), 'w', 1) + f.write('this is file #%d.\n' % i) + f.close() + sftp.chmod('%s/file%d.txt' % (FOLDER, i), 0660) + + # now make sure every file is there, by creating a list of filenmes + # and reading them in random order. + numlist = range(numfiles) + while len(numlist) > 0: + r = numlist[random.randint(0, len(numlist) - 1)] + f = sftp.open('%s/file%d.txt' % (FOLDER, r)) + self.assertEqual(f.readline(), 'this is file #%d.\n' % r) + f.close() + numlist.remove(r) + finally: + for i in range(numfiles): + try: + sftp.remove('%s/file%d.txt' % (FOLDER, i)) + except: + pass + + def test_2_big_file(self): + """ + write a 1MB file with no buffering. + """ + sftp = get_sftp() + kblob = (1024 * 'x') + start = time.time() + try: + f = sftp.open('%s/hongry.txt' % FOLDER, 'w') + for n in range(1024): + f.write(kblob) + if n % 128 == 0: + sys.stderr.write('.') + f.close() + sys.stderr.write(' ') + + self.assertEqual(sftp.stat('%s/hongry.txt' % FOLDER).st_size, 1024 * 1024) + end = time.time() + sys.stderr.write('%ds ' % round(end - start)) + + start = time.time() + f = sftp.open('%s/hongry.txt' % FOLDER, 'r') + for n in range(1024): + data = f.read(1024) + self.assertEqual(data, kblob) + f.close() + + end = time.time() + sys.stderr.write('%ds ' % round(end - start)) + finally: + sftp.remove('%s/hongry.txt' % FOLDER) + + def test_3_big_file_pipelined(self): + """ + write a 1MB file, with no linefeeds, using pipelining. + """ + sftp = get_sftp() + kblob = ''.join([struct.pack('>H', n) for n in xrange(512)]) + start = time.time() + try: + f = sftp.open('%s/hongry.txt' % FOLDER, 'w') + f.set_pipelined(True) + for n in range(1024): + f.write(kblob) + if n % 128 == 0: + sys.stderr.write('.') + f.close() + sys.stderr.write(' ') + + self.assertEqual(sftp.stat('%s/hongry.txt' % FOLDER).st_size, 1024 * 1024) + end = time.time() + sys.stderr.write('%ds ' % round(end - start)) + + start = time.time() + f = sftp.open('%s/hongry.txt' % FOLDER, 'r') + f.prefetch() + + # read on odd boundaries to make sure the bytes aren't getting scrambled + n = 0 + k2blob = kblob + kblob + chunk = 629 + size = 1024 * 1024 + while n < size: + if n + chunk > size: + chunk = size - n + data = f.read(chunk) + offset = n % 1024 + self.assertEqual(data, k2blob[offset:offset + chunk]) + n += chunk + f.close() + + end = time.time() + sys.stderr.write('%ds ' % round(end - start)) + finally: + sftp.remove('%s/hongry.txt' % FOLDER) + + def test_4_prefetch_seek(self): + sftp = get_sftp() + kblob = ''.join([struct.pack('>H', n) for n in xrange(512)]) + try: + f = sftp.open('%s/hongry.txt' % FOLDER, 'w') + f.set_pipelined(True) + for n in range(1024): + f.write(kblob) + if n % 128 == 0: + sys.stderr.write('.') + f.close() + sys.stderr.write(' ') + + self.assertEqual(sftp.stat('%s/hongry.txt' % FOLDER).st_size, 1024 * 1024) + + start = time.time() + k2blob = kblob + kblob + chunk = 793 + for i in xrange(10): + f = sftp.open('%s/hongry.txt' % FOLDER, 'r') + f.prefetch() + base_offset = (512 * 1024) + 17 * random.randint(1000, 2000) + offsets = [base_offset + j * chunk for j in xrange(100)] + # randomly seek around and read them out + for j in xrange(100): + offset = offsets[random.randint(0, len(offsets) - 1)] + offsets.remove(offset) + f.seek(offset) + data = f.read(chunk) + n_offset = offset % 1024 + self.assertEqual(data, k2blob[n_offset:n_offset + chunk]) + offset += chunk + f.close() + end = time.time() + sys.stderr.write('%ds ' % round(end - start)) + finally: + sftp.remove('%s/hongry.txt' % FOLDER) + + def test_5_readv_seek(self): + sftp = get_sftp() + kblob = ''.join([struct.pack('>H', n) for n in xrange(512)]) + try: + f = sftp.open('%s/hongry.txt' % FOLDER, 'w') + f.set_pipelined(True) + for n in range(1024): + f.write(kblob) + if n % 128 == 0: + sys.stderr.write('.') + f.close() + sys.stderr.write(' ') + + self.assertEqual(sftp.stat('%s/hongry.txt' % FOLDER).st_size, 1024 * 1024) + + start = time.time() + k2blob = kblob + kblob + chunk = 793 + for i in xrange(10): + f = sftp.open('%s/hongry.txt' % FOLDER, 'r') + base_offset = (512 * 1024) + 17 * random.randint(1000, 2000) + # make a bunch of offsets and put them in random order + offsets = [base_offset + j * chunk for j in xrange(100)] + readv_list = [] + for j in xrange(100): + o = offsets[random.randint(0, len(offsets) - 1)] + offsets.remove(o) + readv_list.append((o, chunk)) + ret = f.readv(readv_list) + for i in xrange(len(readv_list)): + offset = readv_list[i][0] + n_offset = offset % 1024 + self.assertEqual(ret.next(), k2blob[n_offset:n_offset + chunk]) + f.close() + end = time.time() + sys.stderr.write('%ds ' % round(end - start)) + finally: + sftp.remove('%s/hongry.txt' % FOLDER) + + def test_6_lots_of_prefetching(self): + """ + prefetch a 1MB file a bunch of times, discarding the file object + without using it, to verify that paramiko doesn't get confused. + """ + sftp = get_sftp() + kblob = (1024 * 'x') + try: + f = sftp.open('%s/hongry.txt' % FOLDER, 'w') + f.set_pipelined(True) + for n in range(1024): + f.write(kblob) + if n % 128 == 0: + sys.stderr.write('.') + f.close() + sys.stderr.write(' ') + + self.assertEqual(sftp.stat('%s/hongry.txt' % FOLDER).st_size, 1024 * 1024) + + for i in range(10): + f = sftp.open('%s/hongry.txt' % FOLDER, 'r') + f.prefetch() + f = sftp.open('%s/hongry.txt' % FOLDER, 'r') + f.prefetch() + for n in range(1024): + data = f.read(1024) + self.assertEqual(data, kblob) + if n % 128 == 0: + sys.stderr.write('.') + f.close() + sys.stderr.write(' ') + finally: + sftp.remove('%s/hongry.txt' % FOLDER) + + def test_7_prefetch_readv(self): + """ + verify that prefetch and readv don't conflict with each other. + """ + sftp = get_sftp() + kblob = ''.join([struct.pack('>H', n) for n in xrange(512)]) + try: + f = sftp.open('%s/hongry.txt' % FOLDER, 'w') + f.set_pipelined(True) + for n in range(1024): + f.write(kblob) + if n % 128 == 0: + sys.stderr.write('.') + f.close() + sys.stderr.write(' ') + + self.assertEqual(sftp.stat('%s/hongry.txt' % FOLDER).st_size, 1024 * 1024) + + f = sftp.open('%s/hongry.txt' % FOLDER, 'r') + f.prefetch() + data = f.read(1024) + self.assertEqual(data, kblob) + + chunk_size = 793 + base_offset = 512 * 1024 + k2blob = kblob + kblob + chunks = [(base_offset + (chunk_size * i), chunk_size) for i in range(20)] + for data in f.readv(chunks): + offset = base_offset % 1024 + self.assertEqual(chunk_size, len(data)) + self.assertEqual(k2blob[offset:offset + chunk_size], data) + base_offset += chunk_size + + f.close() + sys.stderr.write(' ') + finally: + sftp.remove('%s/hongry.txt' % FOLDER) + + def test_8_large_readv(self): + """ + verify that a very large readv is broken up correctly and still + returned as a single blob. + """ + sftp = get_sftp() + kblob = ''.join([struct.pack('>H', n) for n in xrange(512)]) + try: + f = sftp.open('%s/hongry.txt' % FOLDER, 'w') + f.set_pipelined(True) + for n in range(1024): + f.write(kblob) + if n % 128 == 0: + sys.stderr.write('.') + f.close() + sys.stderr.write(' ') + + self.assertEqual(sftp.stat('%s/hongry.txt' % FOLDER).st_size, 1024 * 1024) + + f = sftp.open('%s/hongry.txt' % FOLDER, 'r') + data = list(f.readv([(23 * 1024, 128 * 1024)])) + self.assertEqual(1, len(data)) + data = data[0] + self.assertEqual(128 * 1024, len(data)) + + f.close() + sys.stderr.write(' ') + finally: + sftp.remove('%s/hongry.txt' % FOLDER) + + def test_9_big_file_big_buffer(self): + """ + write a 1MB file, with no linefeeds, and a big buffer. + """ + sftp = get_sftp() + mblob = (1024 * 1024 * 'x') + try: + f = sftp.open('%s/hongry.txt' % FOLDER, 'w', 128 * 1024) + f.write(mblob) + f.close() + + self.assertEqual(sftp.stat('%s/hongry.txt' % FOLDER).st_size, 1024 * 1024) + finally: + sftp.remove('%s/hongry.txt' % FOLDER) + + def test_A_big_file_renegotiate(self): + """ + write a 1MB file, forcing key renegotiation in the middle. + """ + sftp = get_sftp() + t = sftp.sock.get_transport() + t.packetizer.REKEY_BYTES = 512 * 1024 + k32blob = (32 * 1024 * 'x') + try: + f = sftp.open('%s/hongry.txt' % FOLDER, 'w', 128 * 1024) + for i in xrange(32): + f.write(k32blob) + f.close() + + self.assertEqual(sftp.stat('%s/hongry.txt' % FOLDER).st_size, 1024 * 1024) + self.assertNotEquals(t.H, t.session_id) + + # try to read it too. + f = sftp.open('%s/hongry.txt' % FOLDER, 'r', 128 * 1024) + f.prefetch() + total = 0 + while total < 1024 * 1024: + total += len(f.read(32 * 1024)) + f.close() + finally: + sftp.remove('%s/hongry.txt' % FOLDER) + t.packetizer.REKEY_BYTES = pow(2, 30) diff --git a/tests/test_transport.py b/tests/test_transport.py index 5fcc786..4b52c4f 100644 --- a/tests/test_transport.py +++ b/tests/test_transport.py @@ -1,4 +1,4 @@ -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -20,12 +20,21 @@ Some unit tests for the ssh2 protocol in Transport. """ -import sys, time, threading, unittest +from binascii import hexlify, unhexlify import select +import socket +import sys +import time +import threading +import unittest +import random + from paramiko import Transport, SecurityOptions, ServerInterface, RSAKey, DSSKey, \ - SSHException, BadAuthenticationType, InteractiveQuery, util + SSHException, BadAuthenticationType, InteractiveQuery, ChannelException from paramiko import AUTH_FAILED, AUTH_PARTIALLY_SUCCESSFUL, AUTH_SUCCESSFUL -from paramiko import OPEN_SUCCEEDED +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 @@ -37,50 +46,16 @@ class NullServer (ServerInterface): def get_allowed_auths(self, username): if username == 'slowdive': return 'publickey,password' - if username == 'paranoid': - if not self.paranoid_did_password and not self.paranoid_did_public_key: - return 'publickey,password' - elif self.paranoid_did_password: - return 'publickey' - else: - return 'password' - if username == 'commie': - return 'keyboard-interactive' return 'publickey' def check_auth_password(self, username, password): if (username == 'slowdive') and (password == 'pygmalion'): return AUTH_SUCCESSFUL - if (username == 'paranoid') and (password == 'paranoid'): - # 2-part auth (even openssh doesn't support this) - self.paranoid_did_password = True - if self.paranoid_did_public_key: - return AUTH_SUCCESSFUL - return AUTH_PARTIALLY_SUCCESSFUL - return AUTH_FAILED - - def check_auth_publickey(self, username, key): - if (username == 'paranoid') and (key == self.paranoid_key): - # 2-part auth - self.paranoid_did_public_key = True - if self.paranoid_did_password: - return AUTH_SUCCESSFUL - return AUTH_PARTIALLY_SUCCESSFUL - return AUTH_FAILED - - def check_auth_interactive(self, username, submethods): - if username == 'commie': - self.username = username - return InteractiveQuery('password', 'Please enter a password.', ('Password', False)) - return AUTH_FAILED - - def check_auth_interactive_response(self, responses): - if self.username == 'commie': - if (len(responses) == 1) and (responses[0] == 'cat'): - return AUTH_SUCCESSFUL return AUTH_FAILED def check_channel_request(self, kind, chanid): + if kind == 'bogus': + return OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED return OPEN_SUCCEEDED def check_channel_exec_request(self, channel, command): @@ -94,10 +69,34 @@ class NullServer (ServerInterface): def check_global_request(self, kind, msg): self._global_request = kind return False + + def check_channel_x11_request(self, channel, single_connection, auth_protocol, auth_cookie, screen_number): + self._x11_single_connection = single_connection + self._x11_auth_protocol = auth_protocol + self._x11_auth_cookie = auth_cookie + self._x11_screen_number = screen_number + return True + + def check_port_forward_request(self, addr, port): + self._listen = socket.socket() + self._listen.bind(('127.0.0.1', 0)) + self._listen.listen(1) + return self._listen.getsockname()[1] + + def cancel_port_forward_request(self, addr, port): + self._listen.close() + self._listen = None + + def check_channel_direct_tcpip_request(self, chanid, origin, destination): + self._tcpip_dest = destination + 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 + def setUp(self): self.socks = LoopSocket() self.sockc = LoopSocket() @@ -111,6 +110,26 @@ class TransportTest (unittest.TestCase): self.socks.close() self.sockc.close() + def setup_test_server(self, client_options=None, server_options=None): + host_key = RSAKey.from_private_key_file('tests/test_rsa.key') + public_host_key = RSAKey(data=str(host_key)) + self.ts.add_server_key(host_key) + + if client_options is not None: + client_options(self.tc.get_security_options()) + if server_options is not None: + server_options(self.ts.get_security_options()) + + event = threading.Event() + self.server = NullServer() + self.assert_(not event.isSet()) + self.ts.start_server(event, self.server) + self.tc.connect(hostkey=public_host_key, + username='slowdive', password='pygmalion') + event.wait(1.0) + self.assert_(event.isSet()) + self.assert_(self.ts.is_active()) + def test_1_security_options(self): o = self.tc.get_security_options() self.assertEquals(type(o), SecurityOptions) @@ -130,11 +149,11 @@ class TransportTest (unittest.TestCase): def test_2_compute_key(self): self.tc.K = 123281095979686581523377256114209720774539068973101330872763622971399429481072519713536292772709507296759612401802191955568143056534122385270077606457721553469730659233569339356140085284052436697480759510519672848743794433460113118986816826624865291116513647975790797391795651716378444844877749505443714557929L - self.tc.H = util.unhexify('0C8307CDE6856FF30BA93684EB0F04C2520E9ED3') + self.tc.H = unhexlify('0C8307CDE6856FF30BA93684EB0F04C2520E9ED3') self.tc.session_id = self.tc.H key = self.tc._compute_key('C', 32) self.assertEquals('207E66594CA87C44ECCBA3B3CD39FDDB378E6FDB0F97C54B2AA0CFBF900CD995', - util.hexify(key)) + hexlify(key).upper()) def test_3_simple(self): """ @@ -168,193 +187,45 @@ class TransportTest (unittest.TestCase): verify that the client can demand odd handshake settings, and can renegotiate keys in mid-stream. """ - host_key = RSAKey.from_private_key_file('tests/test_rsa.key') - public_host_key = RSAKey(data=str(host_key)) - self.ts.add_server_key(host_key) - event = threading.Event() - server = NullServer() - self.assert_(not event.isSet()) - self.ts.start_server(event, server) - options = self.tc.get_security_options() - options.ciphers = ('aes256-cbc',) - options.digests = ('hmac-md5-96',) - self.tc.connect(hostkey=public_host_key, - username='slowdive', password='pygmalion') - event.wait(1.0) - self.assert_(event.isSet()) - self.assert_(self.ts.is_active()) + def force_algorithms(options): + options.ciphers = ('aes256-cbc',) + options.digests = ('hmac-md5-96',) + self.setup_test_server(client_options=force_algorithms) self.assertEquals('aes256-cbc', self.tc.local_cipher) self.assertEquals('aes256-cbc', self.tc.remote_cipher) self.assertEquals(12, self.tc.packetizer.get_mac_size_out()) self.assertEquals(12, self.tc.packetizer.get_mac_size_in()) self.tc.send_ignore(1024) - self.assert_(self.tc.renegotiate_keys()) + self.tc.renegotiate_keys() self.ts.send_ignore(1024) def test_5_keepalive(self): """ verify that the keepalive will be sent. """ - self.tc.set_hexdump(True) - - host_key = RSAKey.from_private_key_file('tests/test_rsa.key') - public_host_key = RSAKey(data=str(host_key)) - self.ts.add_server_key(host_key) - event = threading.Event() - server = NullServer() - self.assert_(not event.isSet()) - self.ts.start_server(event, server) - self.tc.connect(hostkey=public_host_key, - username='slowdive', password='pygmalion') - event.wait(1.0) - self.assert_(event.isSet()) - self.assert_(self.ts.is_active()) - - self.assertEquals(None, getattr(server, '_global_request', None)) + self.setup_test_server() + self.assertEquals(None, getattr(self.server, '_global_request', None)) self.tc.set_keepalive(1) time.sleep(2) - self.assertEquals('keepalive@lag.net', server._global_request) - - def test_6_bad_auth_type(self): - """ - verify that we get the right exception when an unsupported auth - type is requested. - """ - host_key = RSAKey.from_private_key_file('tests/test_rsa.key') - public_host_key = RSAKey(data=str(host_key)) - self.ts.add_server_key(host_key) - event = threading.Event() - server = NullServer() - self.assert_(not event.isSet()) - self.ts.start_server(event, server) - try: - self.tc.connect(hostkey=public_host_key, - username='unknown', password='error') - self.assert_(False) - except: - etype, evalue, etb = sys.exc_info() - self.assertEquals(BadAuthenticationType, etype) - self.assertEquals(['publickey'], evalue.allowed_types) - - def test_7_bad_password(self): - """ - verify that a bad password gets the right exception, and that a retry - with the right password works. - """ - host_key = RSAKey.from_private_key_file('tests/test_rsa.key') - public_host_key = RSAKey(data=str(host_key)) - self.ts.add_server_key(host_key) - event = threading.Event() - server = NullServer() - self.assert_(not event.isSet()) - self.ts.start_server(event, server) - self.tc.ultra_debug = True - self.tc.connect(hostkey=public_host_key) - try: - self.tc.auth_password(username='slowdive', password='error') - self.assert_(False) - except: - etype, evalue, etb = sys.exc_info() - self.assertEquals(SSHException, etype) - self.tc.auth_password(username='slowdive', password='pygmalion') - event.wait(1.0) - self.assert_(event.isSet()) - self.assert_(self.ts.is_active()) - - def test_8_multipart_auth(self): - """ - verify that multipart auth works. - """ - host_key = RSAKey.from_private_key_file('tests/test_rsa.key') - public_host_key = RSAKey(data=str(host_key)) - self.ts.add_server_key(host_key) - event = threading.Event() - server = NullServer() - self.assert_(not event.isSet()) - self.ts.start_server(event, server) - self.tc.ultra_debug = True - self.tc.connect(hostkey=public_host_key) - remain = self.tc.auth_password(username='paranoid', password='paranoid') - self.assertEquals(['publickey'], remain) - key = DSSKey.from_private_key_file('tests/test_dss.key') - remain = self.tc.auth_publickey(username='paranoid', key=key) - self.assertEquals([], remain) - event.wait(1.0) - self.assert_(event.isSet()) - self.assert_(self.ts.is_active()) - - def test_9_interactive_auth(self): - """ - verify keyboard-interactive auth works. - """ - host_key = RSAKey.from_private_key_file('tests/test_rsa.key') - public_host_key = RSAKey(data=str(host_key)) - self.ts.add_server_key(host_key) - event = threading.Event() - server = NullServer() - self.assert_(not event.isSet()) - self.ts.start_server(event, server) - self.tc.ultra_debug = True - self.tc.connect(hostkey=public_host_key) - - def handler(title, instructions, prompts): - self.got_title = title - self.got_instructions = instructions - self.got_prompts = prompts - return ['cat'] - remain = self.tc.auth_interactive('commie', handler) - self.assertEquals(self.got_title, 'password') - self.assertEquals(self.got_prompts, [('Password', False)]) - self.assertEquals([], remain) - event.wait(1.0) - self.assert_(event.isSet()) - self.assert_(self.ts.is_active()) + self.assertEquals('keepalive@lag.net', self.server._global_request) - def test_A_interactive_auth_fallback(self): - """ - verify that a password auth attempt will fallback to "interactive" - if password auth isn't supported but interactive is. - """ - host_key = RSAKey.from_private_key_file('tests/test_rsa.key') - public_host_key = RSAKey(data=str(host_key)) - self.ts.add_server_key(host_key) - event = threading.Event() - server = NullServer() - self.assert_(not event.isSet()) - self.ts.start_server(event, server) - self.tc.ultra_debug = True - self.tc.connect(hostkey=public_host_key) - remain = self.tc.auth_password('commie', 'cat') - self.assertEquals([], remain) - event.wait(1.0) - self.assert_(event.isSet()) - self.assert_(self.ts.is_active()) - - def test_B_exec_command(self): + def test_6_exec_command(self): """ verify that exec_command() does something reasonable. """ - host_key = RSAKey.from_private_key_file('tests/test_rsa.key') - public_host_key = RSAKey(data=str(host_key)) - self.ts.add_server_key(host_key) - event = threading.Event() - server = NullServer() - self.assert_(not event.isSet()) - self.ts.start_server(event, server) - self.tc.ultra_debug = True - self.tc.connect(hostkey=public_host_key) - self.tc.auth_password(username='slowdive', password='pygmalion') - event.wait(1.0) - self.assert_(event.isSet()) - self.assert_(self.ts.is_active()) + self.setup_test_server() chan = self.tc.open_session() schan = self.ts.accept(1.0) - self.assert_(not chan.exec_command('no')) + try: + chan.exec_command('no') + self.assert_(False) + except SSHException, x: + pass chan = self.tc.open_session() - self.assert_(chan.exec_command('yes')) + chan.exec_command('yes') schan = self.ts.accept(1.0) schan.send('Hello there.\n') schan.send_stderr('This is on stderr.\n') @@ -369,7 +240,7 @@ class TransportTest (unittest.TestCase): # now try it with combined stdout/stderr chan = self.tc.open_session() - self.assert_(chan.exec_command('yes')) + chan.exec_command('yes') schan = self.ts.accept(1.0) schan.send('Hello there.\n') schan.send_stderr('This is on stderr.\n') @@ -381,26 +252,13 @@ class TransportTest (unittest.TestCase): self.assertEquals('This is on stderr.\n', f.readline()) self.assertEquals('', f.readline()) - def test_C_invoke_shell(self): + def test_7_invoke_shell(self): """ verify that invoke_shell() does something reasonable. """ - host_key = RSAKey.from_private_key_file('tests/test_rsa.key') - public_host_key = RSAKey(data=str(host_key)) - self.ts.add_server_key(host_key) - event = threading.Event() - server = NullServer() - self.assert_(not event.isSet()) - self.ts.start_server(event, server) - self.tc.ultra_debug = True - self.tc.connect(hostkey=public_host_key) - self.tc.auth_password(username='slowdive', password='pygmalion') - event.wait(1.0) - self.assert_(event.isSet()) - self.assert_(self.ts.is_active()) - + self.setup_test_server() chan = self.tc.open_session() - self.assert_(chan.invoke_shell()) + chan.invoke_shell() schan = self.ts.accept(1.0) chan.send('communist j. cat\n') f = schan.makefile() @@ -408,28 +266,28 @@ class TransportTest (unittest.TestCase): chan.close() self.assertEquals('', f.readline()) - def test_D_exit_status(self): + def test_8_channel_exception(self): + """ + verify that ChannelException is thrown for a bad open-channel request. + """ + self.setup_test_server() + try: + chan = self.tc.open_channel('bogus') + self.fail('expected exception') + except ChannelException, x: + self.assert_(x.code == OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED) + + def test_9_exit_status(self): """ verify that get_exit_status() works. """ - host_key = RSAKey.from_private_key_file('tests/test_rsa.key') - public_host_key = RSAKey(data=str(host_key)) - self.ts.add_server_key(host_key) - event = threading.Event() - server = NullServer() - self.assert_(not event.isSet()) - self.ts.start_server(event, server) - self.tc.ultra_debug = True - self.tc.connect(hostkey=public_host_key) - self.tc.auth_password(username='slowdive', password='pygmalion') - event.wait(1.0) - self.assert_(event.isSet()) - self.assert_(self.ts.is_active()) + self.setup_test_server() chan = self.tc.open_session() schan = self.ts.accept(1.0) - self.assert_(chan.exec_command('yes')) + chan.exec_command('yes') schan.send('Hello there.\n') + self.assert_(not chan.exit_status_ready()) # trigger an EOF schan.shutdown_read() schan.shutdown_write() @@ -439,29 +297,22 @@ class TransportTest (unittest.TestCase): f = chan.makefile() self.assertEquals('Hello there.\n', f.readline()) self.assertEquals('', f.readline()) + count = 0 + while not chan.exit_status_ready(): + time.sleep(0.1) + count += 1 + if count > 50: + raise Exception("timeout") self.assertEquals(23, chan.recv_exit_status()) chan.close() - def test_E_select(self): + def test_A_select(self): """ verify that select() on a channel works. """ - host_key = RSAKey.from_private_key_file('tests/test_rsa.key') - public_host_key = RSAKey(data=str(host_key)) - self.ts.add_server_key(host_key) - event = threading.Event() - server = NullServer() - self.assert_(not event.isSet()) - self.ts.start_server(event, server) - self.tc.ultra_debug = True - self.tc.connect(hostkey=public_host_key) - self.tc.auth_password(username='slowdive', password='pygmalion') - event.wait(1.0) - self.assert_(event.isSet()) - self.assert_(self.ts.is_active()) - + self.setup_test_server() chan = self.tc.open_session() - self.assert_(chan.invoke_shell()) + chan.invoke_shell() schan = self.ts.accept(1.0) # nothing should be ready @@ -503,28 +354,21 @@ class TransportTest (unittest.TestCase): self.assertEquals([], e) self.assertEquals('', chan.recv(16)) + # make sure the pipe is still open for now... + p = chan._pipe + self.assertEquals(False, p._closed) chan.close() + # ...and now is closed. + self.assertEquals(True, p._closed) - def test_F_renegotiate(self): + def test_B_renegotiate(self): """ verify that a transport can correctly renegotiate mid-stream. """ - host_key = RSAKey.from_private_key_file('tests/test_rsa.key') - public_host_key = RSAKey(data=str(host_key)) - self.ts.add_server_key(host_key) - event = threading.Event() - server = NullServer() - self.ts.start_server(event, server) - self.tc.connect(hostkey=public_host_key, - username='slowdive', password='pygmalion') - event.wait(1.0) - self.assert_(event.isSet()) - self.assert_(self.ts.is_active()) - + self.setup_test_server() self.tc.packetizer.REKEY_BYTES = 16384 - chan = self.tc.open_session() - self.assert_(chan.exec_command('yes')) + chan.exec_command('yes') schan = self.ts.accept(1.0) self.assertEquals(self.tc.H, self.tc.session_id) @@ -541,26 +385,15 @@ class TransportTest (unittest.TestCase): schan.close() - def test_G_compression(self): + def test_C_compression(self): """ verify that zlib compression is basically working. """ - host_key = RSAKey.from_private_key_file('tests/test_rsa.key') - public_host_key = RSAKey(data=str(host_key)) - self.ts.add_server_key(host_key) - self.ts.get_security_options().compression = ('zlib',) - self.tc.get_security_options().compression = ('zlib',) - event = threading.Event() - server = NullServer() - self.ts.start_server(event, server) - self.tc.connect(hostkey=public_host_key, - username='slowdive', password='pygmalion') - event.wait(1.0) - self.assert_(event.isSet()) - self.assert_(self.ts.is_active()) - + def force_compression(o): + o.compression = ('zlib',) + self.setup_test_server(force_compression, force_compression) chan = self.tc.open_session() - self.assert_(chan.exec_command('yes')) + chan.exec_command('yes') schan = self.ts.accept(1.0) bytes = self.tc.packetizer._Packetizer__sent_bytes @@ -568,6 +401,326 @@ class TransportTest (unittest.TestCase): bytes2 = self.tc.packetizer._Packetizer__sent_bytes # tests show this is actually compressed to *52 bytes*! including packet overhead! nice!! :) self.assert_(bytes2 - bytes < 1024) + self.assertEquals(52, bytes2 - bytes) chan.close() schan.close() + + def test_D_x11(self): + """ + verify that an x11 port can be requested and opened. + """ + self.setup_test_server() + chan = self.tc.open_session() + chan.exec_command('yes') + schan = self.ts.accept(1.0) + + requested = [] + def handler(c, (addr, port)): + requested.append((addr, port)) + self.tc._queue_incoming_channel(c) + + self.assertEquals(None, getattr(self.server, '_x11_screen_number', None)) + cookie = chan.request_x11(0, single_connection=True, handler=handler) + self.assertEquals(0, self.server._x11_screen_number) + self.assertEquals('MIT-MAGIC-COOKIE-1', self.server._x11_auth_protocol) + self.assertEquals(cookie, self.server._x11_auth_cookie) + self.assertEquals(True, self.server._x11_single_connection) + + x11_server = self.ts.open_x11_channel(('localhost', 6093)) + x11_client = self.tc.accept() + self.assertEquals('localhost', requested[0][0]) + self.assertEquals(6093, requested[0][1]) + + x11_server.send('hello') + self.assertEquals('hello', x11_client.recv(5)) + + x11_server.close() + x11_client.close() + chan.close() + schan.close() + + def test_E_reverse_port_forwarding(self): + """ + verify that a client can ask the server to open a reverse port for + forwarding. + """ + self.setup_test_server() + chan = self.tc.open_session() + chan.exec_command('yes') + schan = self.ts.accept(1.0) + + requested = [] + def handler(c, (origin_addr, origin_port), (server_addr, server_port)): + requested.append((origin_addr, origin_port)) + requested.append((server_addr, server_port)) + self.tc._queue_incoming_channel(c) + + port = self.tc.request_port_forward('127.0.0.1', 0, handler) + self.assertEquals(port, self.server._listen.getsockname()[1]) + + cs = socket.socket() + cs.connect(('127.0.0.1', port)) + ss, _ = self.server._listen.accept() + sch = self.ts.open_forwarded_tcpip_channel(ss.getsockname(), ss.getpeername()) + cch = self.tc.accept() + + sch.send('hello') + self.assertEquals('hello', cch.recv(5)) + sch.close() + cch.close() + ss.close() + cs.close() + + # now cancel it. + self.tc.cancel_port_forward('127.0.0.1', port) + self.assertTrue(self.server._listen is None) + + def test_F_port_forwarding(self): + """ + verify that a client can forward new connections from a locally- + forwarded port. + """ + self.setup_test_server() + chan = self.tc.open_session() + chan.exec_command('yes') + schan = self.ts.accept(1.0) + + # open a port on the "server" that the client will ask to forward to. + greeting_server = socket.socket() + greeting_server.bind(('127.0.0.1', 0)) + greeting_server.listen(1) + greeting_port = greeting_server.getsockname()[1] + + cs = self.tc.open_channel('direct-tcpip', ('127.0.0.1', greeting_port), ('', 9000)) + sch = self.ts.accept(1.0) + cch = socket.socket() + cch.connect(self.server._tcpip_dest) + + ss, _ = greeting_server.accept() + ss.send('Hello!\n') + ss.close() + sch.send(cch.recv(8192)) + sch.close() + + self.assertEquals('Hello!\n', cs.recv(7)) + cs.close() + + def test_G_stderr_select(self): + """ + verify that select() on a channel works even if only stderr is + receiving data. + """ + self.setup_test_server() + chan = self.tc.open_session() + chan.invoke_shell() + schan = self.ts.accept(1.0) + + # nothing should be ready + r, w, e = select.select([chan], [], [], 0.1) + self.assertEquals([], r) + self.assertEquals([], w) + self.assertEquals([], e) + + schan.send_stderr('hello\n') + + # something should be ready now (give it 1 second to appear) + for i in range(10): + r, w, e = select.select([chan], [], [], 0.1) + if chan in r: + break + time.sleep(0.1) + self.assertEquals([chan], r) + self.assertEquals([], w) + self.assertEquals([], e) + + self.assertEquals('hello\n', chan.recv_stderr(6)) + + # and, should be dead again now + r, w, e = select.select([chan], [], [], 0.1) + self.assertEquals([], r) + self.assertEquals([], w) + self.assertEquals([], e) + + schan.close() + chan.close() + + def test_H_send_ready(self): + """ + verify that send_ready() indicates when a send would not block. + """ + self.setup_test_server() + chan = self.tc.open_session() + chan.invoke_shell() + schan = self.ts.accept(1.0) + + self.assertEquals(chan.send_ready(), True) + total = 0 + K = '*' * 1024 + while total < 1024 * 1024: + chan.send(K) + total += len(K) + if not chan.send_ready(): + break + self.assert_(total < 1024 * 1024) + + schan.close() + chan.close() + self.assertEquals(chan.send_ready(), True) + + def test_I_rekey_deadlock(self): + """ + Regression test for deadlock when in-transit messages are received after MSG_KEXINIT is sent + + Note: When this test fails, it may leak threads. + """ + + # Test for an obscure deadlocking bug that can occur if we receive + # certain messages while initiating a key exchange. + # + # The deadlock occurs as follows: + # + # In the main thread: + # 1. The user's program calls Channel.send(), which sends + # MSG_CHANNEL_DATA to the remote host. + # 2. Packetizer discovers that REKEY_BYTES has been exceeded, and + # sets the __need_rekey flag. + # + # In the Transport thread: + # 3. Packetizer notices that the __need_rekey flag is set, and raises + # NeedRekeyException. + # 4. In response to NeedRekeyException, the transport thread sends + # MSG_KEXINIT to the remote host. + # + # On the remote host (using any SSH implementation): + # 5. The MSG_CHANNEL_DATA is received, and MSG_CHANNEL_WINDOW_ADJUST is sent. + # 6. The MSG_KEXINIT is received, and a corresponding MSG_KEXINIT is sent. + # + # In the main thread: + # 7. The user's program calls Channel.send(). + # 8. Channel.send acquires Channel.lock, then calls Transport._send_user_message(). + # 9. Transport._send_user_message waits for Transport.clear_to_send + # to be set (i.e., it waits for re-keying to complete). + # Channel.lock is still held. + # + # In the Transport thread: + # 10. MSG_CHANNEL_WINDOW_ADJUST is received; Channel._window_adjust + # is called to handle it. + # 11. Channel._window_adjust tries to acquire Channel.lock, but it + # blocks because the lock is already held by the main thread. + # + # The result is that the Transport thread never processes the remote + # host's MSG_KEXINIT packet, because it becomes deadlocked while + # handling the preceding MSG_CHANNEL_WINDOW_ADJUST message. + + # We set up two separate threads for sending and receiving packets, + # while the main thread acts as a watchdog timer. If the timer + # expires, a deadlock is assumed. + + class SendThread(threading.Thread): + def __init__(self, chan, iterations, done_event): + threading.Thread.__init__(self, None, None, self.__class__.__name__) + self.setDaemon(True) + self.chan = chan + self.iterations = iterations + self.done_event = done_event + self.watchdog_event = threading.Event() + self.last = None + + def run(self): + try: + for i in xrange(1, 1+self.iterations): + if self.done_event.isSet(): + break + self.watchdog_event.set() + #print i, "SEND" + self.chan.send("x" * 2048) + finally: + self.done_event.set() + self.watchdog_event.set() + + class ReceiveThread(threading.Thread): + def __init__(self, chan, done_event): + threading.Thread.__init__(self, None, None, self.__class__.__name__) + self.setDaemon(True) + self.chan = chan + self.done_event = done_event + self.watchdog_event = threading.Event() + + def run(self): + try: + while not self.done_event.isSet(): + if self.chan.recv_ready(): + chan.recv(65536) + self.watchdog_event.set() + else: + if random.randint(0, 1): + time.sleep(random.randint(0, 500) / 1000.0) + finally: + self.done_event.set() + self.watchdog_event.set() + + self.setup_test_server() + self.ts.packetizer.REKEY_BYTES = 2048 + + chan = self.tc.open_session() + chan.exec_command('yes') + schan = self.ts.accept(1.0) + + # Monkey patch the client's Transport._handler_table so that the client + # sends MSG_CHANNEL_WINDOW_ADJUST whenever it receives an initial + # MSG_KEXINIT. This is used to simulate the effect of network latency + # on a real MSG_CHANNEL_WINDOW_ADJUST message. + self.tc._handler_table = self.tc._handler_table.copy() # copy per-class dictionary + _negotiate_keys = self.tc._handler_table[MSG_KEXINIT] + def _negotiate_keys_wrapper(self, m): + if self.local_kex_init is None: # Remote side sent KEXINIT + # Simulate in-transit MSG_CHANNEL_WINDOW_ADJUST by sending it + # before responding to the incoming MSG_KEXINIT. + m2 = Message() + m2.add_byte(chr(MSG_CHANNEL_WINDOW_ADJUST)) + m2.add_int(chan.remote_chanid) + m2.add_int(1) # bytes to add + self._send_message(m2) + return _negotiate_keys(self, m) + self.tc._handler_table[MSG_KEXINIT] = _negotiate_keys_wrapper + + # Parameters for the test + iterations = 500 # The deadlock does not happen every time, but it + # should after many iterations. + timeout = 5 + + # This event is set when the test is completed + done_event = threading.Event() + + # Start the sending thread + st = SendThread(schan, iterations, done_event) + st.start() + + # Start the receiving thread + rt = ReceiveThread(chan, done_event) + rt.start() + + # Act as a watchdog timer, checking + deadlocked = False + while not deadlocked and not done_event.isSet(): + for event in (st.watchdog_event, rt.watchdog_event): + event.wait(timeout) + if done_event.isSet(): + break + if not event.isSet(): + deadlocked = True + break + event.clear() + + # Tell the threads to stop (if they haven't already stopped). Note + # that if one or more threads are deadlocked, they might hang around + # forever (until the process exits). + done_event.set() + + # Assertion: We must not have detected a timeout. + self.assertFalse(deadlocked) + + # Close the channels + schan.close() + chan.close() diff --git a/tests/test_util.py b/tests/test_util.py index fa8c029..d385bab 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -1,6 +1,4 @@ -#!/usr/bin/python - -# Copyright (C) 2003-2005 Robey Pointer +# Copyright (C) 2003-2007 Robey Pointer # # This file is part of paramiko. # @@ -22,7 +20,9 @@ Some unit tests for utility functions. """ +from binascii import hexlify import cStringIO +import os import unittest from Crypto.Hash import SHA import paramiko.util @@ -43,27 +43,80 @@ Host spoo.example.com Crazy something else """ +test_hosts_file = """\ +secure.example.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA1PD6U2/TVxET6lkpKhOk5r\ +9q/kAYG6sP9f5zuUYP8i7FOFp/6ncCEbbtg/lB+A3iidyxoSWl+9jtoyyDOOVX4UIDV9G11Ml8om3\ +D+jrpI9cycZHqilK0HmxDeCuxbwyMuaCygU9gS2qoRvNLWZk70OpIKSSpBo0Wl3/XUmz9uhc= +happy.example.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA8bP1ZA7DCZDB9J0s50l31M\ +BGQ3GQ/Fc7SX6gkpXkwcZryoi4kNFhHu5LvHcZPdxXV1D+uTMfGS1eyd2Yz/DoNWXNAl8TI0cAsW\ +5ymME3bQ4J/k1IKxCtz/bAlAqFgKoc+EolMziDYqWIATtW0rYTJvzGAzTmMj80/QpsFH+Pc2M= +""" + + +# for test 1: +from paramiko import * + class UtilTest (unittest.TestCase): - K = 14730343317708716439807310032871972459448364195094179797249681733965528989482751523943515690110179031004049109375612685505881911274101441415545039654102474376472240501616988799699744135291070488314748284283496055223852115360852283821334858541043710301057312858051901453919067023103730011648890038847384890504L + 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 + + def test_1_import(self): + """ + verify that all the classes can be imported from paramiko. + """ + symbols = globals().keys() + self.assertTrue('Transport' in symbols) + self.assertTrue('SSHClient' in symbols) + self.assertTrue('MissingHostKeyPolicy' in symbols) + self.assertTrue('AutoAddPolicy' in symbols) + self.assertTrue('RejectPolicy' in symbols) + self.assertTrue('WarningPolicy' in symbols) + self.assertTrue('SecurityOptions' in symbols) + self.assertTrue('SubsystemHandler' in symbols) + self.assertTrue('Channel' in symbols) + self.assertTrue('RSAKey' in symbols) + self.assertTrue('DSSKey' in symbols) + self.assertTrue('Message' in symbols) + self.assertTrue('SSHException' in symbols) + self.assertTrue('AuthenticationException' in symbols) + self.assertTrue('PasswordRequiredException' in symbols) + self.assertTrue('BadAuthenticationType' in symbols) + self.assertTrue('ChannelException' in symbols) + self.assertTrue('SFTP' in symbols) + self.assertTrue('SFTPFile' in symbols) + self.assertTrue('SFTPHandle' in symbols) + self.assertTrue('SFTPClient' in symbols) + self.assertTrue('SFTPServer' in symbols) + self.assertTrue('SFTPError' in symbols) + self.assertTrue('SFTPAttributes' in symbols) + self.assertTrue('SFTPServerInterface' in symbols) + self.assertTrue('ServerInterface' in symbols) + self.assertTrue('BufferedFile' in symbols) + self.assertTrue('Agent' in symbols) + self.assertTrue('AgentKey' in symbols) + self.assertTrue('HostKeys' in symbols) + self.assertTrue('SSHConfig' in symbols) + self.assertTrue('util' in symbols) - def test_1_parse_config(self): + def test_2_parse_config(self): global test_config_file f = cStringIO.StringIO(test_config_file) config = paramiko.util.parse_ssh_config(f) - self.assertEquals(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'}]) + 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'}]) - def test_2_host_config(self): + def test_3_host_config(self): global test_config_file f = cStringIO.StringIO(test_config_file) config = paramiko.util.parse_ssh_config(f) @@ -74,7 +127,28 @@ class UtilTest (unittest.TestCase): 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'}) - def test_3_generate_key_bytes(self): + def test_4_generate_key_bytes(self): x = paramiko.util.generate_key_bytes(SHA, 'ABCDEFGH', 'This is my secret passphrase.', 64) hex = ''.join(['%02x' % ord(c) for c in x]) self.assertEquals(hex, '9110e2f6793b69363e58173e9436b13a5a4b339005741d5c680e505f57d871347b4239f14fb5c46e857d5e100424873ba849ac699cea98d729e57b3e84378e8b') + + def test_5_host_keys(self): + f = open('hostfile.temp', 'w') + f.write(test_hosts_file) + f.close() + try: + hostdict = paramiko.util.load_host_keys('hostfile.temp') + self.assertEquals(2, len(hostdict)) + self.assertEquals(1, len(hostdict.values()[0])) + self.assertEquals(1, len(hostdict.values()[1])) + fp = hexlify(hostdict['secure.example.com']['ssh-rsa'].get_fingerprint()).upper() + self.assertEquals('E6684DB30E109B67B70FF1DC5C7F1363', fp) + finally: + os.unlink('hostfile.temp') + + def test_6_random(self): + from paramiko.common import randpool + # just verify that we can pull out 32 bytes and not get an exception. + x = randpool.get_bytes(32) + self.assertEquals(len(x), 32) + -- cgit v1.2.3