use hexlify instead of custom-made hexify in demos
This commit is contained in:
parent
157484f5eb
commit
7ac433a6ac
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
from binascii import hexlify
|
||||||
import getpass
|
import getpass
|
||||||
import os
|
import os
|
||||||
import select
|
import select
|
||||||
|
@ -45,7 +46,7 @@ def agent_auth(transport, username):
|
||||||
return
|
return
|
||||||
|
|
||||||
for key in agent_keys:
|
for key in agent_keys:
|
||||||
print 'Trying ssh-agent key %s' % paramiko.util.hexify(key.get_fingerprint()),
|
print 'Trying ssh-agent key %s' % hexlify(key.get_fingerprint()),
|
||||||
try:
|
try:
|
||||||
transport.auth_publickey(username, key)
|
transport.auth_publickey(username, key)
|
||||||
print '... success!'
|
print '... success!'
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
from binascii import hexlify
|
||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
import sys
|
import sys
|
||||||
|
@ -34,7 +35,7 @@ paramiko.util.log_to_file('demo_server.log')
|
||||||
host_key = paramiko.RSAKey(filename='test_rsa.key')
|
host_key = paramiko.RSAKey(filename='test_rsa.key')
|
||||||
#host_key = paramiko.DSSKey(filename='test_dss.key')
|
#host_key = paramiko.DSSKey(filename='test_dss.key')
|
||||||
|
|
||||||
print 'Read key: ' + paramiko.util.hexify(host_key.get_fingerprint())
|
print 'Read key: ' + hexlify(host_key.get_fingerprint())
|
||||||
|
|
||||||
|
|
||||||
class Server (paramiko.ServerInterface):
|
class Server (paramiko.ServerInterface):
|
||||||
|
@ -60,7 +61,7 @@ class Server (paramiko.ServerInterface):
|
||||||
return paramiko.AUTH_FAILED
|
return paramiko.AUTH_FAILED
|
||||||
|
|
||||||
def check_auth_publickey(self, username, key):
|
def check_auth_publickey(self, username, key):
|
||||||
print 'Auth attempt with key: ' + paramiko.util.hexify(key.get_fingerprint())
|
print 'Auth attempt with key: ' + hexlify(key.get_fingerprint())
|
||||||
if (username == 'robey') and (key == self.good_pub_key):
|
if (username == 'robey') and (key == self.good_pub_key):
|
||||||
return paramiko.AUTH_SUCCESSFUL
|
return paramiko.AUTH_SUCCESSFUL
|
||||||
return paramiko.AUTH_FAILED
|
return paramiko.AUTH_FAILED
|
||||||
|
|
Loading…
Reference in New Issue