summaryrefslogtreecommitdiffhomepage
path: root/demos/demo_server.py
diff options
context:
space:
mode:
Diffstat (limited to 'demos/demo_server.py')
-rw-r--r--demos/demo_server.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/demos/demo_server.py b/demos/demo_server.py
index 6cb2dc51..7a175ac8 100644
--- a/demos/demo_server.py
+++ b/demos/demo_server.py
@@ -27,7 +27,6 @@ import threading
import traceback
import paramiko
-from paramiko.py3compat import b, u, decodebytes
# setup logging
@@ -36,7 +35,7 @@ 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: " + u(hexlify(host_key.get_fingerprint())))
+print("Read key: " + hexlify(host_key.get_fingerprint()).decode())
class Server(paramiko.ServerInterface):
@@ -48,7 +47,7 @@ class Server(paramiko.ServerInterface):
b"KDqIexkgHAfID/6mqvmnSJf0b5W8v5h2pI/stOSwTQ+pxVhwJ9ctYDhRSlF0iT"
b"UWT10hcuO4Ks8="
)
- good_pub_key = paramiko.RSAKey(data=decodebytes(data))
+ good_pub_key = paramiko.RSAKey(data=base64.decodebytes(data))
def __init__(self):
self.event = threading.Event()
@@ -64,7 +63,7 @@ class Server(paramiko.ServerInterface):
return paramiko.AUTH_FAILED
def check_auth_publickey(self, username, key):
- print("Auth attempt with key: " + u(hexlify(key.get_fingerprint())))
+ print("Auth attempt with key: " + hexlify(key.get_fingerprint()).decode())
if (username == "robey") and (key == self.good_pub_key):
return paramiko.AUTH_SUCCESSFUL
return paramiko.AUTH_FAILED
@@ -165,9 +164,7 @@ try:
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("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")