ssh-chat
ssh-chat copied to clipboard
Capture piped input as one-off messages
Presumably we have a bunch of bots that are piping commands, we'd like for them to render as a message then be politely disconnected. The trick is that their input doesn't have a trailing \r
so it doesn't currently render in ssh-chat.
Right now:
$ echo "hello" | ssh [email protected]
Shows up as:
* bot joined. (Connected: 11)
* bot left.
Ideally we want:
* bot joined. (Connected: 11)
bot: hello
* bot left.
The correct solution here would be to detect whether a tty was allocated for the session. If it was not, then special case it as a pipe where the input is a stand-alone message, followed by a disconnect.
Other cases we want to capture:
-
ssh -T chat.shazow.net
should capture input that should show up as a message (whereas right now it does not). -
ssh chat.shazow.net | head -n5
should this get disconnected?
Reasoning:
- Writing one-off bots is a little bit easier (don't have to append a labourous
\r
). - We might get to see fun output from bots who are trying to add ssh-chat to their botnet.
My program https://gist.github.com/Low-power/94d2b33fc3350ef5945489b63a74651f is now depending on this bug; so it is now a feature...
@Low-power Depending on it how?
Well it is a half kidding actually, but since multi line messages are allowed in SSHOUT, when those messages being forwarded to ssh-chat, \n
character will keeping unchanged; and the whole message will ending with a \r\n
.
If ssh-chat was changed to send message on ever \n
instead, such multi message will be sent at almost same time; which may hit the rate limitation of ssh-chat, causing message loss.