How to use python to implement a xshell (terminal) of your own, which can be run under Mac

because I can"t find a tool like xshell that I am satisfied with under Mac (can remember the password, send commands to multiple nodes at the same time, and save the connection list), I just want to write one myself and give me some inspiration?
mainly does not know how to draw the dark box, and how to display the results returned by the command into the dark box.

Apr.01,2021

Coincidentally, there was a similar requirement a few days ago, but instead of writing a terminal, I simply wrote down to get a command line to enter commands freely, and the commands entered are not isolated. The code is as follows for your reference. As for writing terminals, you may need to add a lot of things, which can not be easily done. It is suggested that secureCRT for mac I am using the representation

.
import paramiko
import time

ip = "10.211.55.6"
port = 22
username = "root"
password = "redhat"


def recv_str(client_channel, tag_str=None):
    result = client_channel.recv(65535).decode()
    while not result.endswith(tag_str):
        result = result + client_channel.recv(65535).decode()
    return result


client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(hostname=ip, port=port, username=username, password=password,
               timeout=60)
channel = client.invoke_shell()
channel.send("ping www.baidu.com\n")
time.sleep(2)
channel.send(chr(3))
res = recv_str(channel, "[root@centos-linux ~]-sharp ")
print(res)
client.close()
Menu