下面我的代碼給出了參考淨::的Telnet EOF讀等待登錄提示:在test.pl線25
#!/usr/bin/perl
use strict;
use Net::Telnet::Cisco;
my ($host, $port, $user, $pass, $command);
##### get host info
print 'Enter host: ';
chop($host = <STDIN>);
##### get port info
print 'Enter port: ';
chop($port = <STDIN>);
##### get user info
print 'Enter user: ';
chop($user = <STDIN>);
##### get user info & hide input
print 'Enter password: ';
system 'stty -echo';
chop($pass = <STDIN>);
system 'stty echo';
print "\n";
my $tn = new Net::Telnet(Host =>$host, Port =>$port, Timeout => 20)
or die "connect failed: $!";
$tn->open ($host);
$tn->login('','[email protected]');
$tn->login('$user','$pass');
my @out1 = $tn->print("sh run");
print "@out1\n";
正嘗試通過終端服務器控制檯端口登錄並執行命令,但面對「EOF閱讀等待登錄提示:在test.pl第25行「錯誤。 任何幫助將不勝感激,謝謝。
我刪除1號線也是同樣的錯誤我面臨着同樣的錯誤,我刪除啓用密碼到ma切換,所以現在我可以直接登錄到特權模式的休耕模式SW-SANT-TEST1-T15# – user3740674
不確定你的意思,但你應該只使用'login()',如果設備要求輸入密碼。如果您沒有憑據直接登錄,則可以刪除這兩行。 – AKHolland
好吧我將刪除並嘗試 – user3740674