Use the Net::Telnet module

上一篇 / 下一篇  2008-11-12 14:12:03 / 个人分类:Perl

use warnings;
use Net::Telnet ();
my ($hostname, $username, $passwd);
$hostname = "192.168.120.48";
$username = "cnshroot";
$passwd = "shroot";
$telnet = new Net::Telnet (Timeout => 10,
                      Prompt => '/-bash-3\.00# $/');
$telnet->open($hostname);
$telnet->login($username, $passwd);
@lines = $telnet->cmd("who");
print @lines;
$telnet->close;
exit;

TAG: Perl Net::Telnet telnet

 

评分:0

我来说两句

日历

« 2024-05-15  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 48341
  • 日志数: 80
  • 建立时间: 2008-10-27
  • 更新时间: 2009-07-17

RSS订阅

Open Toolbar