in reply to Re: Expect.pm early termination?
in thread Expect.pm early termination?
I do not however believe there is an issue with it since it is so basic and have already troubleshot down to the Expect.pm module but if it helps you help me, there it is.#!/usr/bin/perl -w use strict; use Expect; my $username = "admin"; my $password = "password\n"; ##### flip this value to 0 to turn off stout and 1 to turn it on $Expect::Log_Stdout=1; # Lets see what expect is doing! $Expect::Exp_Internal = 1; #$Expect::Debug = 3; my $terminal = new Expect; $terminal->raw_pty(1); $terminal = Expect->spawn("ssh -l $username hostname"); $terminal->log_file("test_err.txt"); unless ($terminal->expect(30,"passphrase")) { die "Error 01::Never got password prompt, ".$terminal->exp_error(). +"\n"; } print "...recieved password prompt\n"; $terminal->send($password); unless ($terminal->expect(30, '/# ')) { die "Error 02::Never got first prompt, ".$terminal->exp_error()."\n +"; } $terminal->send("sys hard\n"); unless ($terminal->expect(30, '/# ')) { die "Error 03::Never got sec prompt, ".$terminal->exp_error()."\n"; } $terminal->send("exit\n"); $terminal->log_file(undef);
Yes the entire session always works via command line and tcl expect and python expect, so I would venture a guess that it is perl expect that has the issue. Yes I am talking to some shell type application, sorry if that was not clear in my original post. The remote server shell mimics that of a Cisco IOS type OS.
I have monitored the connection via ethereal but none of it really helps since ssh is an encrypted session I can not see what is being sent in the payload. Any other suggestions?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Expect.pm early termination?
by shmem (Chancellor) on Jul 25, 2006 at 16:26 UTC | |
by Elijah (Hermit) on Jul 25, 2006 at 17:24 UTC |