Reputation: 83
I try to get the show log output, but it gives me partial output, expected output 65000 bytes. How do I fix this?
my $ua = LWP::UserAgent->new;
my $request = HTTP::Request->new('POST' => $url);
$request->content("command='term length 0, sh log'")
$request->protocol('HTTP/1.0');
my $respone = $ua->request($request);
warn Dumper($respone->content); #It only gives me the first page (I've included "term length 0" in my command).
Upvotes: -1
Views: 62
Reputation: 185620
This is the way to 'talk' to routers with Net::Telnet
:
#!/usr/bin/env perl -w
use strict;
use utf8;
use encoding qw[ utf8 ];
use Net::Telnet;
use Data::Dumper;
my $telnet = Net::Telnet->new(
Prompt => '/>/',
Errmode => sub { warn "telnet warn $@" if $@ },
Timeout => 20
);
$telnet->open( "172.17.20.1" );
$telnet->waitfor('/RETURN/');
$telnet->print("");
$telnet->waitfor('/Password:/');
$telnet->print('xxx');
$telnet->waitfor('/\>/');
$telnet->cmd('enable');
$telnet->waitfor('/Password:/');
$telnet->print('xxx');
$telnet->waitfor('/#/');
$telnet->cmd('term length 0, sh log');
Upvotes: 2