Net::SSH::Perl - remoteinteract.pl doesn?t work

G

Guest

There?s an examplescript on http://search.cpan.org/src/DROLSKY/Net-SSH-
Perl-1.25/eg/remoteinteract.pl

It?s not working with me although I have
The "passwd" command gets send and the output of the Command on the
remote Computer is recieved by the script (which I have proofed by
adding additional debug-commands).
Then the script hangs.
This must be at theses lines of code:

--- snip ---
if ($str eq "(current) UNIX password: ") {
my $packet = $ssh->packet_start(SSH_CMSG_STDIN_DATA);
$packet->put_str($old_password);
$packet->send;
--- snap ---

Has anyone run the "remoteinteract.pl" successfully ?
 
M

Martin Kissner

Finally I found the solution.
Thank you very much, A. Sinan Unur.
The excessive use of print statements (which you recommended) got me on the way.

instead of
use constant NEWPASS => 'newpass';
use constant OLDPASS => 'oldpass';
I had to do
use constant NEWPASS => "newpass\n";
use constant OLDPASS => "oldpass\n";
use constant PASS => 'oldpass';

I also found that
elsif ($str =~ /^New password:/) {
and
elsif ($str =~ /^Retype new password:/) {
matched only without the '^' althoug /^Old password:/ did match

Next step will be, to try remote interaction on my cisco router.
Thanks again for the help.
 
M

Martin Kissner

Joe Smith wrote :
Are you intending to re-invent the wheel, or will you be using
Net::Telnet::Cisco for that?

http://nettelnetcisco.sourceforge.net/

-Joe

My first intention is to learn and to practice.
Thanks for the hint to Net::Telnet::Cisco
I will try this as soon as i find the time to do.

I also want to try to find a solution with ssh for secure communication.
This might be a challenge, since my IOS doesn't support ssh v2.
As far as I understand this is a prerequisite for sending more than one
command in one session.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,781
Messages
2,569,615
Members
45,294
Latest member
LandonPigo

Latest Threads

Top