Leser: 3
8 Einträge, 1 Seite |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#!/usr/bin/perl $inputlog = "/home/test/input.log"; # your input logfile $outputlog = "/home/test/output.log"; # your input logfile use Net::Telnet; $telnet=new Net::Telnet(Timeout=>5, Errmode=> 'Die', Port => 2004, Input_log => $inputlog, Output_log => $outputlog); $telnet->open('10.1.1.1'); $telnet->print("\n"); $telnet->print("en"); $telnet->print("terminal length 0"); @output=$telnet->cmd('sh run'); print ("Output is: @output \n");
1
2
3
4
5
6
7
8
root@itislanserver2:~# cat input.log
root@itislanserver2:~# cat output.log
en
terminal length 0
sh run
root@itislanserver2:~#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
my $sock = IO::Socket::INET->new(PeerAddr => $slav, PeerPort => $port, Proto => 'tcp'); $_=<$sock>; return if ($_ !~ /^010/); print $sock "user $user\r\n"; $_=<$sock>; return if ($_ !~ /^305/); print $sock "pass $pass\r\n"; $_=<$sock>; return if ($_ !~ /^301/); print $sock "commando beispiel\r\n"; $_=<$sock>; return if ($_ !~ /^121/);
1
2
3
4
5
6
7
Port: p5-Net-Telnet-Cisco-1.10
Path: /usr/ports/net-mgmt/p5-Telnet-Cisco
Info: Perl5 module to telnet to Cisco routers
Maint: lyngbol@wheel.dk
B-deps: p5-Net-Telnet-3.03 p5-Term-ReadKey-2.30 p5-Test-Harness-2.64 p5-Test-Simple-0.64 perl-5.8.8
R-deps: p5-Net-Telnet-3.03 p5-Term-ReadKey-2.30 p5-Test-Harness-2.64 p5-Test-Simple-0.64 perl-5.8.8
WWW: http://search.cpan.org/dist/Net-Telnet-Cisco/
8 Einträge, 1 Seite |