[Perl] Telnet


Telnet to DS211j

 

#!/usr/bin/perl

use Net::Telnet;
$telnet = new Net::Telnet ( Timeout=>10,
Errmode=>'die', Prompt =>'/\$|#|%|>/');
$telnet->open('192.168.0.104');
$telnet->login(‘user’,'pass') or die("Problem logging in: $!");
#print $telnet->cmd('/usr/bin/who')
print $telnet->cmd(String =>'/usr/bin/who', Prompt => '/\$|#|%|>/');
print $telnet->cmd(String =>'ps', Prompt => '/\$|#|%|>/');

Ref: Perl - Net::Telnet module

 

Ed32. Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com