Click here to get back home

using Net::SSH::Perl with Expect

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
using Net::SSH::Perl with Expect dan byers 11-21-2005
Posted by dan byers on November 21, 2005, 3:41 pm
Please log in for more thread options



Hey everyone, got a code snippet here:

#!/usr/bin/perl

use strict;
use Expect;
use Net::SSH::Perl;

my $connection = new Net::SSH::Perl( "1.2.3.4",
{ protocol => "2,1",
use_pty => 1 } );

$connection->login("user", "pwd");

my $exp = Expect->exp_init($connection->sock);
#$exp->log_stdout(1);
$exp->log_file("./test");
#$exp->raw_pty(1);

$exp->expect(5, ">");
print "got our prompt....\n";

$exp->send("exit\n");
print "sending exit...\n";

$exp->soft_close();
print "done...\n";

I'm trying to get Expect to log all of the transactions with the ssh session
either to the file (as noted) or stdout (as commented). What it outputs
from any of the expect calls is seemingly encrypted.

Is there a way around this? I would prefer to use Expect for interacting
with SSH, and it will have to be Net::SSH::Perl as I want the ssh session to
be within the initial process.

thanks for any help/advice,
Dan





Similar ThreadsPosted
Perl Expect question November 8, 2004, 12:20 pm
DBI does not do what I expect... March 12, 2008, 4:18 am
Expect::Simple December 1, 2005, 4:19 pm
Expect::Simple December 2, 2005, 9:22 am
Expect: Getting PID at both ends of ssh January 22, 2007, 3:08 pm
Expect and xterm February 27, 2007, 11:12 pm
username passwd expect September 14, 2006, 12:36 am
Simple expect problem . March 21, 2007, 2:31 pm
Expect.pm module help - simple question... March 15, 2005, 12:27 pm
Problem with very simple Expect script April 24, 2005, 8:42 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap