summaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
authorJeremy T. Bouse <jbouse@debian.org>2009-11-27 16:25:55 -0500
committerJeremy T. Bouse <jbouse@debian.org>2009-11-27 16:25:55 -0500
commite299181a5dda25aed4879ebcbe1359604448b3ae (patch)
treef2d18804fcc3367ca9c5e977c1618679b5a5e363 /demos
parented280d5ac360e2af796e9bd973d7b4df89f0c449 (diff)
downloadpython-paramiko-e299181a5dda25aed4879ebcbe1359604448b3ae.tar
python-paramiko-e299181a5dda25aed4879ebcbe1359604448b3ae.tar.gz
Imported Upstream version 1.7.6upstream/1.7.6
Diffstat (limited to 'demos')
-rwxr-xr-xdemos/demo.py2
-rw-r--r--[-rwxr-xr-x]demos/demo_server.py2
-rwxr-xr-xdemos/demo_sftp.py2
-rwxr-xr-xdemos/demo_simple.py39
-rw-r--r--[-rwxr-xr-x]demos/forward.py2
-rw-r--r--demos/interactive.py2
-rwxr-xr-xdemos/rforward.py2
7 files changed, 17 insertions, 34 deletions
diff --git a/demos/demo.py b/demos/demo.py
index c8346ce..05524d3 100755
--- a/demos/demo.py
+++ b/demos/demo.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-# Copyright (C) 2003-2007 Robey Pointer <robey@lag.net>
+# Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
diff --git a/demos/demo_server.py b/demos/demo_server.py
index e7b0e61..4972928 100755..100644
--- a/demos/demo_server.py
+++ b/demos/demo_server.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-# Copyright (C) 2003-2007 Robey Pointer <robey@lag.net>
+# Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
diff --git a/demos/demo_sftp.py b/demos/demo_sftp.py
index a823fb3..992615f 100755
--- a/demos/demo_sftp.py
+++ b/demos/demo_sftp.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-# Copyright (C) 2003-2007 Robey Pointer <robey@lag.net>
+# Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
diff --git a/demos/demo_simple.py b/demos/demo_simple.py
index 5bcc214..231da8d 100755
--- a/demos/demo_simple.py
+++ b/demos/demo_simple.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-# Copyright (C) 2003-2007 Robey Pointer <robey@lag.net>
+# Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
@@ -59,43 +59,26 @@ if username == '':
password = getpass.getpass('Password for %s@%s: ' % (username, hostname))
-# get host key, if we know one
-hostkeytype = None
-hostkey = None
+# now, connect and use paramiko Client to negotiate SSH2 across the connection
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()
+ client = paramiko.SSHClient()
+ client.load_system_host_keys()
+ client.set_missing_host_key_policy(paramiko.WarningPolicy)
+ print '*** Connecting...'
+ client.connect(hostname, port, username, password)
+ chan = client.invoke_shell()
+ print repr(client.get_transport())
print '*** Here we go!'
print
interactive.interactive_shell(chan)
chan.close()
- t.close()
+ client.close()
except Exception, e:
print '*** Caught exception: %s: %s' % (e.__class__, e)
traceback.print_exc()
try:
- t.close()
+ client.close()
except:
pass
sys.exit(1)
diff --git a/demos/forward.py b/demos/forward.py
index 33c98ab..4e10785 100755..100644
--- a/demos/forward.py
+++ b/demos/forward.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-# Copyright (C) 2003-2007 Robey Pointer <robey@lag.net>
+# Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
diff --git a/demos/interactive.py b/demos/interactive.py
index b80e661..4cbc617 100644
--- a/demos/interactive.py
+++ b/demos/interactive.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007 Robey Pointer <robey@lag.net>
+# Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
diff --git a/demos/rforward.py b/demos/rforward.py
index 810fea6..ef4c532 100755
--- a/demos/rforward.py
+++ b/demos/rforward.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-# Copyright (C) 2008 Robey Pointer <robey@lag.net>
+# Copyright (C) 2008 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#