Allow sending messages by directly providing them as a ssh commandline argument, by reading process.command

This commit is contained in:
ChaoticByte 2024-06-16 08:55:52 +02:00
parent 00b73bfa46
commit aca4f8c0be
No known key found for this signature in database

View file

@ -55,6 +55,12 @@ async def handle_connection(process: asyncssh.SSHServerProcess):
connected_msg = f"[connected] {username}\n"
stderr.write(connected_msg)
broadcast(connected_msg, True)
if process.command is not None:
line = process.command.strip("\r\n")
msg = f"{username}: {line}\n"
stdout.write(msg)
broadcast(msg)
else:
while True:
try:
async for line in process.stdin: