Closed mohzulfikar closed 1 year ago
Since tty-share
provides shell access to the machine on which it runs, requesting user input is quite sensible. If it didn't require user interaction, it would be easy to abuse for malicious purposes.
I think it might make sense to have a flag like that, but have it default to the current behaviour. I could imagine that it would be useful to not require pressing Enter in certain cases. I may look into it at some point, but I have very little time now. Feel free to push a change with that, if you want , @mohzulfikar :)
it would be great to also be able to pass a command that is executed, for example setting up a Curses "service" that runs unattended, but available via tty-share.
If I get what you're saying, @artificiel , then you can already do that with the two flags: --command
and --args
. Check that out
yes these flags are great, but hitting Enter is still required, so not possible to spawn unattended.
to be clear: using something like screen -d -m /path/to/tty-share --command service.sh
not saying this is ideal, but does piping in echo " " | tty-share
work to simulate a newline?
ha! well the echo
idea was nice but does not work it say Input not a tty
(at least on linux 4.15.0 x86_64)
BUT noodling around the idea led me to tmux
which has a send-keys
command. so this works:
tmux new-session -d -s tshare tty-share_linux-386 -listen some.host.net:4444 --command /usr/bin/top && tmux send-keys -t tshare: "Enter"
if you want to actually re-attach to the tmux session (so answering the initial request of "not having to press enter") you can append && tmux attach -t tshare:
and keep on trucking with the process with the Enter
taken care of.
it's quite some funny stuff, thinking about it.
(note: perhaps it would be feasible with screen
too but tmux
proved more straightforward to harness)
ha! well the
echo
idea was nice but does not work it sayInput not a tty
(at least on linux 4.15.0 x86_64)
Tbh I'm not too surprised, as it was kind of a hack anyway. I think the request is valid in any case, wanting to launch non-interactively is a valid requirement sometimes (without needing hacky workarounds like weve described).
https://github.com/elisescu/tty-share/blob/e6bbaefd4708aff17c35aeba7f01c523935b91fb/main.go#L170
Here's the offending line, it could either be removed, or a new option --headless
could be given
@mohzulfikar , @strazto I've added a small change to add that. Have a look: https://github.com/elisescu/tty-share/releases/tag/v2.3.0
As always, any feedback is appreciated.
Closing this, as --headless
is an option with the new version
Maybe we can create an option so that we can run tty-share without pressing enter? @elisescu @matthewstrasiotto. thank you