frechett@spot.Colorado.EDU (-=Runaway Daemon=-) (06/16/91)
I have been messing with chat2.pl and the little select routine that came with the last release. I have found that it is a simple matter to open a port on a machine and allow someone to telnet into that port and grab a pty on my machine with this setup. There are a couple problems though once this happens besides obvious security issues. The call chat'select() appears to use \n as the signal for pending data. Unfortunately this puts everything in line by line mode.. It is useable but painful. Consider using vi where it won't read your commands until you press return and besides that, it echos back everything you type as you type it, and then the remote end echos it back again as it receives it as it should normally.. messy. The way I have it set up select is trying to listen to the socket (NS) and the pty ($SH) and I would like to figure out a way to put it in character at a time mode... I can get perl to read one character at a time as it comes in but I can't seem to get select to do it.. Is there a way? The next problem is that I am trying to figure out how to make the chat routines aware of when $SH closes. If I have this set up on a port of the machine, I would like it to disconnect current connection and go back to listening for a new one if it sees the process running on the pty die. Right now, if I exit 'sh' for instance it will just keep listening for output from the socket but for some reason it also won't let the process hanging off the pty to die completely <defunct> processes and such.. until you do an explicit chat'close($SH); which is fine, except that I can't seem to figure out what denotes the end of the highest process. I can't use eof or it will close unpredictably somewhere else... like in a subshell of sh. Lastly, for now, I would like to use chat'open_proc("/bin/csh") but that doesn't work.. neither does tcsh.. .. Of course sh works and so does any other non-real-shell command like, telnet, rlogin etc.. Any way to change the default shell? Thanks for anything that anyone can offer. ian -=Runaway Daemon=- (UNIXOPS University of Colorado at Boulder)