General discussion
May 12, 2008 at 03:20 AM
mejaz

per script

by mejaz . Updated 18 years, 2 months ago

I have tried below scripts to get some users details from juniper (ERX)through my linux machine, but coudn’t succed, any ones help is here hightly appreciated

Thanks in advance

Ejaz

#! /usr/bin/perl
$pass=”xxxx”;
$enable=”xxxx”;
#$username=”[put a username here]”; # login name if needed
$infile=”routerlist”; # list of routers to read from
$host=”212.119.67.11″;
use Net::Telnet::Cisco;
open (LIST,”$infile”) or die “Couldn’t open file $infile”;
@list=;
foreach (@list) {
($host)=split(/\s+/,$_);
&TELNET;
}

sub TELNET {
$t = Net::Telnet::Cisco->new(
Timeout => 10,
Host => $host
);
$t->errmode(“return”);
print “Trying $host\n”;
#$t->login($username,$pass);
my @out=$t->password($pass);
my @out=$t->enable 5($enable);
print “downloading config…\n”;
my $out=$t->cmd(“show subscribers”);
print $out;
$t->close;
}

This discussion is locked

All Comments