summaryrefslogtreecommitdiffhomepage
path: root/demo_simple.py
diff options
context:
space:
mode:
authorRobey Pointer <robey@lag.net>2004-10-18 04:54:27 +0000
committerRobey Pointer <robey@lag.net>2004-10-18 04:54:27 +0000
commit2939b6936b50d207048d9e245c202c6a7c705643 (patch)
treeda66e17bef235baef4a1b58f7963fdf721b737ba /demo_simple.py
parente1639180f99a381e879b29c2ca25cbe02fe09f02 (diff)
[project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-93]
switch Transport.connect() to using a Pkey object for the host key i suddenly realized that passing "hostkeytype" and "hostkey" as strings to Transport.connect() was pretty silly since i went to all the effort of making a class specifically for holding keys. so Transport.connect() now just takes host-key argument: "hostkey" as a PKey object. updated the demos to use PKey objects when reading the host key file, and to use the new "hostkey" argument.
Diffstat (limited to 'demo_simple.py')
-rwxr-xr-xdemo_simple.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/demo_simple.py b/demo_simple.py
index 0bc46bf3..d31b0630 100755
--- a/demo_simple.py
+++ b/demo_simple.py
@@ -23,7 +23,10 @@ def load_host_keys():
for host in hosts:
if not keys.has_key(host):
keys[host] = {}
- keys[host][keytype] = base64.decodestring(key)
+ if keytype == 'ssh-rsa':
+ keys[host][keytype] = paramiko.RSAKey(data=base64.decodestring(key))
+ elif keytype == 'ssh-dss':
+ keys[host][keytype] = paramiko.DSSKey(data=base64.decodestring(key))
f.close()
return keys
@@ -70,7 +73,7 @@ if hkeys.has_key(hostname):
# now, connect and use paramiko Transport to negotiate SSH2 across the connection
try:
t = paramiko.Transport((hostname, port))
- t.connect(username=username, password=password, hostkeytype=hostkeytype, hostkey=hostkey)
+ t.connect(username=username, password=password, hostkey=hostkey)
chan = t.open_session()
chan.get_pty()
chan.invoke_shell()