Help on Net::Telnet perl module

--0-778832742-1310129965=:21091
Content-Type: text/plain; charset=us-ascii

hi,

i am using Net::Telnet module to connect to remote hosts 
i able to to successfully connect to remote host and run the "ls" command 
but the issue is , the output of command is not getting printed to scalar variable 


use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10,
Prompt => '/bash\$ $/');
$t->open("abc");
$t->login($username, $passwd);
@lines = $t->cmd("ls");
print @lines;

please suggest.

regards,
irfan
--0-778832742-1310129965=:21091--
0
irfan_sayed2002
7/8/2011 12:59:25 PM
perl.beginners 29388 articles. 4 followers. Follow

2 Replies
492 Views

Similar Articles

[PageSpeed] 24

On 7/8/11 Fri  Jul 8, 2011  5:59 AM, "Irfan Sayed"
<irfan_sayed2002@yahoo.com> scribbled:

> hi,
> 
> i am using Net::Telnet module to connect to remote hosts
> i able to to successfully connect to remote host and run the "ls" command
> but the issue is , the output of command is not getting printed to scalar
> variable 
> 
> 
> use Net::Telnet ();
> $t = new Net::Telnet (Timeout => 10,
> Prompt => '/bash\$ $/');
> $t->open("abc");
> $t->login($username, $passwd);
> @lines = $t->cmd("ls");
> print @lines;

That looks like the sample code included with 'perldoc Net::Telnet'. That
presumes that you have assigned valid values to the $username and $passwd
variables. Have you?

You have no error checking in your code. Since you are apparently getting an
error, it is time to add some error checking. See 'perldoc Net::Telnet' for
how to do this. The documentation recommends the use of input_log() and
dump_log() to trace the data sent back and forth between your program and
the telnet server.

Unfortunately, I cannot find a telnet server to test your program. Most
telnet access has been replaced by ssh these days.


0
jimsgibson
7/8/2011 5:13:37 PM
--0-2113045390-1310151799=:31307
Content-Type: text/plain; charset=us-ascii

i have written my own code and i am printing dump_log and input_log as well
in the log , it says , everything is successful, i am getting the output of "ls" command as well.in the log


but on the console it is not printing the output 


plz suggest

regards
irfan



________________________________
From: Jim Gibson <jimsgibson@gmail.com>
To: Perl Beginners <beginners@perl.org>
Sent: Friday, July 8, 2011 10:47 PM
Subject: Re: Help on Net::Telnet perl module




 You chose to allow Jim Gibson (jimsgibson@gmail.com) even though this message failed authentication 
Click to disallow 
--0-2113045390-1310151799=:31307--
0
irfan_sayed2002
7/8/2011 7:03:19 PM
Reply:

Similar Artilces:

Help with Net::Telnet module
I am looking for some help debugging a problem with the Net::Telnet module written by Jay Rogers. Here's the subroutine I am having problems with: sub login { $errmode = 'return'; $hostaddress = 'xxx.xxx.xxx.xxx'; $prompt = '/Sheldon_NS16>/'; $username = 'xxxxxxxx'; $password = 'xxxxxxxx'; $obj = new Net::Telnet ( Host => $hostaddress, Errmode => $errmode, Prompt => $prompt, Timeout => 15, Port => 23 ); $obj->login($u...

Help :-) Beginner in ASP.NET ... Help in Datagrid
Hi , I'm a novice to the ASP.NET/ADO.Net field. I have a datagrid web control in which i show data that is read from a table(assume table has just one field called I_status ). Every row in the datagrid has a button control column called "Update" (created using <asp:ButtonControl ButtonType="PushButton" > ). My case is that upon clicking the Update button in any row, i need to set the column entry for I_Status field (for that particular row in which Update button was clicked) to value 0. I am writing the following code for the gridEvent Handler Sub grdSit...

Help with net::telnet
Hi, I am trying to get Perl telnet to work on our *nix boxes, and I am missing something. I'm sure it is obvious. If anyone can help. I would appreciate it. Listed below is the code I use and the login screen from one of our FreeBSD boxes (sparky). +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #!/usr/local/bin/perl -w use Net::Telnet (); $username = "sqa"; $passwd = "sqa"; $machine = "sparky"; print $t = new Net::Telnet (Timeout => 10, Prompt => '/$username\@$machine\#/'); print $t-...

Net-Telnet Module
Hello: I am in the process of setting up a Solaris 8 box that will monitor 4 different systems for my company. I want to make it idiot proof in that if it ever gets rebooted, I want it to automatically xterm back into the 4 boxes that it is monitoring. I have sucessfully created a script that will xterm into a different machine, but I do not know how to send commands to the xterm after it is opened so I can launch openview. Any Ideas? Brian ...

HELP!HELP!HELP!HELP!HELP!HELP!
I was using powerbuilder4.0 a month ago I decided that migrate it to PB7.0 When Im using 4.0, in datawindows I was using extra colums additional to stores procedure. I mean that for example; stored proc. returns 4 columns. I was using 2 extra columns to modify something from client. But I cant do the same thing in PB7.0. How can I do that??? please help. Gurcan yucel gyucel@infina.com.tr "I was using 2 extra columns to modify something from client." what does this mean that you added to the result set? If so then just goto the SQL and add a param. Then set the...

Help Help Help Help Help Help
------=_NextPart_000_0074_01C2960E.EBE13A30 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Can someone please help me. I have installed mysql on Unix Solaris and it works fine I have Perl installed previously which is working and with which i have installed other perlmodules before and are working fine. I have also installed DBI and it works fine with the Sybase drivers which i have installed. When i tried to install the Msql-Mysql-modules-1.2219 drivers i get the following error. # make /usr/local/bin/perl -Iblib/arch -Iblib/lib -I/...

Net::Telnet --help required
------=_Part_19101_13362803.1179309892857 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello, I am trying to telnet to all m/c for which i haven't set password(only root is a valid user) any body can telnet using root user But when i try to access through perl it <snip> use warnings; use Net::Telnet; my $t = new Net::Telnet (Timeout => 10,Prompt => '/bash\$ $/'); my @line; $t->open("host1"); $t->waitfor('/login:.*$/'); $t->print("root"); $...

Help Help Help Help
i need to create a crosstab report using Crystal reprot for VS 2003 i face aproblem when i need to order my Fileds by their names my data must be like this Basic Cola Housing Gross Deduction1 Deduction2 Deduction3 Net but when i run my report it give my a not sorted data acutally i have acode field which can i order field using it. but i don't knwo how to do thisSo..................? Select Report tab | |-->Select Record Sort expert Choost the fields you want to sort --Select the corresponding sort direction f...

Help required about NET::TELNET
------=_Part_24326_2033954.1133781558079 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Folks, I have installed the module NET::TELNET from CPAN and when i try to execute the below simple pgm, --------------------****************************----------------------- use Net::Telnet; $telnet =3D new Net::Telnet ( Timeout=3D>100,Errmode=3D>'die'); $telnet->open('202.177.129.37'); $telnet->waitfor('/login: $/i'); $telnet->print('root'); $telnet->waitfor(...

help help help help
Name: chef mario Email: chefusa_at_pacbell.net Product: Firefox Summary: help help help help Comments: Heard great reports about Firefox!!! Downloaded & installed Firefox !!!! Lost All my very very valuable BOOKMARKS!!! CAN ANYONE HELP!!!!! All bookmarks were in Internet Explorer Did bookmark transfer to Firefox. Seem the Fox eat all m,y bookmarks Need serious help anyone. chef mario Browser Details: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8) Gecko/20051025 Firefox/1.5 ...

Help Help Help DataWindow.NET 2.0
Hello, i am using datawindow.NET 2.0 evaluation version my application is working fine using Pbls as source for objects as soon as i change the Pbl to PBD the application gives the error object not found however help says that u can use PBDs kindly tell me that this error is due to evaluation version or there is something wrong i am very worried about this behaviour because i have to report to my project manager for this behaviour of datawindow.NET kindly reply thanks Haroon Yes PBDs will work with the evaluation version. Is this a web forms or Windows Form...

Beginner Help: ODBC/ASP.NET
I'm an absolute beginner, and I need a little help. System DSN name: sampledata (maps to sampledata.mdb in c:\data folder) (Has one table called test, with one column called myfield. I entered four sample rows, so myField contains 1, 2, 3, 4, that's it). I'm using ASP.NET Web Matrix editor. I have dotNET Framework 1.1 installed on my machine. I don't have any other tool. (there's actually a restriction I can't go into right now) I simply need to display the data from the table in the webpage in a table format, in the simplest way possible. Period. Ca...

A beginner in ASP.Net need help
Hi, I am new in ASP.Net. I now doing a sys using VB.Net n SQL Server 2000. I keep getting the same error for my login page, can somebody help me point out where is the problem? I really need help urgently.  Below are the error message I get: Server Error in '/e-library' Application.-------------------------------------------------------------------------------- Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriate...

HELP HELP HELP
i need help, i use an dbmaker 3.0 server and now i want to use an client to go on it but i dont have an client(i have dbmaker 3.6 but it don't work) who can help me with the dbmaker 3.0 client (tools,files,drivers) email me kelly.kloen@siteways.nl ...

help help help
i wanna know the list of compite time errors related to code correction/programming errors in powerbuilder.thanks lot cenk That's a pretty big request. You want a list of everything it is possible to do wrong in PowerBuilder? What you might want to do is search the solved cases infobase on the Sybase web site. On Tue, 15 Jun 1999 11:50:32 +0300, in powersoft.public.powerbuilder.general cenk KIZILDAG <cenk1536@yahoo.com> wrote: >i wanna know the list of compite time errors related to code >correction/programming errors in powerbuilder.thanks lot > >c...

Web resources about - Help on Net::Telnet perl module - perl.beginners

Resources last updated: 12/25/2015 6:41:16 PM