develooper Front page | perl.beginners | Postings from May 2007

Net::Telnet --help required

Thread Next
From:
a b
Date:
May 16, 2007 03:05
Subject:
Net::Telnet --help required
Message ID:
bf72ed650705160304m362f587l2e9e52837774f404@mail.gmail.com
Hello,
I am trying to telnet to all m/c for which i haven't set password(only root
is a valid user)
any body can telnet using root user
But when i try to access through perl it
<snip>
use warnings;
use Net::Telnet;

my $t = new Net::Telnet (Timeout => 10,Prompt => '/bash\$ $/');
my @line;
$t->open("host1");
$t->waitfor('/login:.*$/');
$t->print("root");
$forecast=$t->print("/usr/bin/ls");
print $forecast;


O/P : 1

OR

use warnings;
use Net::Ping;
use Net::Telnet;

my $t = new Net::Telnet (Timeout => 10,Prompt => '/bash\$ $/');
my @line;
$t->open("host1");
$t->login("root","");
$result=$t->cmd("/usr/bin/ls");
print $result;

O/P : timed-out waiting for password prompt at j.pl line 8


Please, help me to understand the solution of it.
I need this as urgent requirement for house-keeping activities

Thanks in adavance

_abhi

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About