Click here to get back home

Telnet from perl

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Telnet from perl siddhartha mulpuru 09-23-2004
Posted by siddhartha mulpuru on September 23, 2004, 2:12 pm
Please log in for more thread options
I use this NET::TELNET module to login into a telnet session.. THis is
the code

#!/usr/bin/perl
use CGI;

$frm = new CGI;

$unix_box = $frm->param('unix_box');

$username = $frm->param('username');

$password = $frm->param('password');

#$unix_box = "xxxx.xxx.xxx";

#$username = "xxxxxx";

#$password = "xxxxxxxx";

my $prmpt = '/[w().-]*[$#>:.]s?(?:(enable))?s*$/';
$telnet = new Net::Telnet ( Timeout=>20, Prompt => $prmpt,
"Dump_log" => "dump_log",
Errmode=>'die');
use Net::Telnet;
$telnet->open($unix_box);
$telnet->waitfor('/login:/i');
$telnet->print($username);
$telnet->waitfor('/Enter SecurID PASSCODE:/i');
$telnet->print($password);
$telnet->waitfor('/.+:/.+/.+>/i');
@lines= $telnet->cmd("who");
#print STDOUT @lines;

print "Content-type: text/htmlnn";

print "
@lines
";


$telnet->close;

When i run this script from the command line it works fine. But when i
run this as a post from a form with values for username,password and
unix box it does not work.

Please advise

Thanks
Sid


Similar ThreadsPosted
Net::Telnet not working with perl 5.8.5 November 15, 2005, 2:48 am
getting output of telnet from perl April 6, 2006, 6:03 am
problem in telnet using perl December 27, 2007, 11:22 pm
Using Net::Telnet to connect to Perl server January 22, 2005, 12:57 am
getting output of telnet from perl script April 10, 2006, 5:35 am
How do you telnet from 1 host to another using Telnet Module December 21, 2005, 4:15 pm
net::telnet to ms telnet server May 19, 2005, 12:28 am
Net::Telnet December 9, 2004, 11:33 pm
NET::Telnet February 15, 2006, 8:42 am
Net::telnet June 9, 2006, 1:42 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap