Hi,
So I am having a little bit of trouble with the expect module when
formatting the output. It is creating too many spaces and offsetting
the next printed/displayed line by 9 characters. I am not quite sure
why - or how to correct the problem.
this is happening on the local machine. I am using iTerm for Mac with
VT100 emulation configured. any clues on this?
Here is the script and the machine's perl -V:
Macintosh-3:~ noahgarrettwallach$ less login.pl
#!/sw/bin/perl
#
use Expect;
#
#--- ENSURE TO HAVE SUFFICIENT COMMAND LINE ARGUMENTS !
----------------------#
#
if ( $#ARGV != 2 ) {
printf("USAGE: $0 <host> <user> <pw>n");
exit(-1);
}
$host = shift;
$user = shift;
$pw = shift;
#
#--- CONFIGURATION
----------------------------------------------------------#
#
$cmd = "ssh -l $user $host";
$prompt = "[Pp]assword";
#
#--- START SSH LOGIN SEQUENCE !
----------------------------------------------#
#
$exp = new Expect();
$exp->raw_pty(1);
$exp->spawn($cmd);
#
#--- LOGIN AND INTERACT !
----------------------------------------------------#
#
$exp->expect(10000, [ $prompt => sub { $_[0]->send("$pwn"); } ]);
$exp->interact();
Macintosh-3:~ noahgarrettwallach$ /sw/bin/perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
Platform:
osname=darwin, osvers=8.10.1, archname=darwin-thread-multi-2level
uname='darwin macintosh-2.local 8.10.1 darwin kernel version
8.10.1: wed may 23 16:33:00 pdt 2007; root
nu-792.22.5~1release_i386
i386 i386 '
config_args='-des -Dcc=gcc -Dcpp=gcc -E -Dprefix=/sw
-Dccflags=-I/sw/include -Dldflags=-L/sw/lib -Dperladmin=none
-Uinstallusrbinperl -Dprivlib=/sw/lib/perl5-core/5.8.8
-Darchlib=/sw/lib/perl5-core/5.8.8/darwin-thread-multi-2level
-Dman3dir=/sw/lib/perl5-core/5.8.8/man/man3 -Dman3ext=3pm -Duseithreads
-Dinc_version_list=5.8.8/darwin-thread-multi-2level
5.8.6/darwin-thread-multi-2level 5.8.1 5.8.0 5.6.0
-Adefine:startperl=#!/sw/bin/perl5.8.8'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-I/sw/include -fno-common -DPERL_DARWIN
-no-cpp-precomp -fno-strict-aliasing -pipe -Wdeclaration-after-statement
-I/usr/local/include -I/opt/local/include',
optimize='-O3',
cppflags='-no-cpp-precomp -I/sw/include -fno-common -DPERL_DARWIN
-no-cpp-precomp -fno-strict-aliasing -pipe -Wdeclaration-