[perl]代码库
#-----------------------------
use Net::Telnet;
$t = Net::Telnet->new ( Timeout => 10,
Prompt => '/%/',
Host => $hostname );
$t->login ( $username, $password );
@files = $t->cmd ( "ls" );
$t->print ( "top" );
( undef, $process_string ) = $t->waitfor ( '/\d+ processes/' );
$t->close;
#-----------------------------
/[\$%#>] $/
#-----------------------------
$telnet = Net::Telnet->new ( Errmode => sub { main::log ( @_ ) }, ... );
#-----------------------------
$telnet->login ( $username, $password )
or die "Login failed: @{[ $telnet->errmsg() ]}\n";
#-----------------------------
$telnet->waitfor ( '/--more--/' )
#-----------------------------
$telnet->waitfor ( String => 'greasy smoke', Timeout => 30 )
#-----------------------------
by: 发表于:2017-09-15 16:56:14 顶(0) | 踩(0) 回复
??
回复评论