summaryrefslogtreecommitdiffhomepage
path: root/demos/demo_server.py
diff options
context:
space:
mode:
authormagmaus3 <magmaus3@disroot.org>2023-02-14 12:36:10 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2023-08-02 22:07:45 +0200
commit4753b3619dd0f08185c16e3d3d60b98afdbaa040 (patch)
tree62b2ad6b595977471f649671ae7c5bb66282088c /demos/demo_server.py
parentd5117fc7988e3ede445ca09d7ffc95d4263445c3 (diff)
Don't use functions from nonexistent py3compat module in demos.py3compat
commit 36bafee8af15d7743fd9f16b7a6b146b4e90de0e Author: magmaus3 <magmaus3@disroot.org> Date: Tue Feb 14 12:36:10 2023 +0100 Don't use functions from nonexistent py3compat module in demos.
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")