in reply to telnet wrapper

Using 'open' and ReadKey could solve your problem :-)

use Term::ReadKey qw(GetTerminalSize ReadMode); open(TEL, "| telnet $arg"); $username=<> print <TEL> $username; ReadMode 2; chomp($pass=<STDIN>); ReadMode 0; print <TEL> $pass;

cheers

perl -Te 'print map { chr((ord)-((10,20,2,7)[$i++])) } split //,"turo"'

Replies are listed 'Best First'.
Re^2: telnet wrapper
by gri6507 (Deacon) on Jan 23, 2006 at 13:58 UTC
    I thought of this approach already. Unfortunately, it requires the wrapper to be cognizant of telnet's output and expect "Password:". Only then can the wrapper safely apply ReadMode settings around the password request. However, since telnet is only opened for writing, the wrapper does not know what telnet outputs and the ReadMode trick can't work. The only way to make that work is if telnet is started with open3 and autoflush is turned on. Even then, I'm not sure if the login "Password:" request would get flushed because it does not contain a new line after it.

      Umm, it was only an idea, i think you have the reason ...

      A lot time ago, i've made a little script in 'Expect' a TCL extension, this expects for patterns or keyword of your program and feed that program with the data you want... maybe the Expect module for perl will help ...

      good luck

      perl -Te 'print map { chr((ord)-((10,20,2,7)[$i++])) } split //,"turo"'