RE: Net::Telnet
John wrote: its does not work on these servers: Windows 2000 Pro, Windows XP pro, Windows 2000 server pro, Windows server 2003. Reason is, the new windows server uses ANSI codes and you CAN'T turn them off like on a UNIX box. These ANSI codes garble up the responses to Net::Telnet. I'd put it this way: The telnet server in these versions of Windows is broken. It doesn't follow the RFCs. To make telnet work, use an alternate telnet server, e.g. http://kpym.sourceforge.net/ -- Mark ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Net::Telnet
I have had no issues using Net::Telnet on XP Pro that are using the MS Windows telnet server. Stating that it does not work on Windows server/workstations is not entirely true. Try starting the MS Windows telnet server, and using it. - Aaron -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Thomas, Mark - BLS CTR Sent: Thursday, June 02, 2005 7:35 AM To: 'John Serink'; Rajesh Vattem; perl-win32-users@listserv.ActiveState.com Subject: RE: Net::Telnet John wrote: its does not work on these servers: Windows 2000 Pro, Windows XP pro, Windows 2000 server pro, Windows server 2003. Reason is, the new windows server uses ANSI codes and you CAN'T turn them off like on a UNIX box. These ANSI codes garble up the responses to Net::Telnet. I'd put it this way: The telnet server in these versions of Windows is broken. It doesn't follow the RFCs. To make telnet work, use an alternate telnet server, e.g. http://kpym.sourceforge.net/ -- Mark ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Net::Telnet
Correct. -Original Message- From: Thomas, Mark - BLS CTR [mailto:[EMAIL PROTECTED] Sent: Thursday, June 02, 2005 8:35 PM To: John Serink; Rajesh Vattem; perl-win32-users@listserv.ActiveState.com Subject: RE: Net::Telnet John wrote: its does not work on these servers: Windows 2000 Pro, Windows XP pro, Windows 2000 server pro, Windows server 2003. Reason is, the new windows server uses ANSI codes and you CAN'T turn them off like on a UNIX box. These ANSI codes garble up the responses to Net::Telnet. I'd put it this way: The telnet server in these versions of Windows is broken. It doesn't follow the RFCs. To make telnet work, use an alternate telnet server, e.g. http://kpym.sourceforge.net/ -- Mark ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Net::Telnet
I have heard the MS Telnet server was fixed on XP (and that would seem then on 2003) but have not tested it. I know Net::Telnet did NOT work on Win2K pro, I wasted about a week trying to get it to. Worked fine on NT 4.0 though. Cheers, John -Original Message- From: Aaron.Tesch [mailto:[EMAIL PROTECTED] Sent: Thursday, June 02, 2005 9:22 PM To: Thomas, Mark - BLS CTR; John Serink; Rajesh Vattem; perl-win32-users@listserv.ActiveState.com Subject: RE: Net::Telnet I have had no issues using Net::Telnet on XP Pro that are using the MS Windows telnet server. Stating that it does not work on Windows server/workstations is not entirely true. Try starting the MS Windows telnet server, and using it. - Aaron -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Thomas, Mark - BLS CTR Sent: Thursday, June 02, 2005 7:35 AM To: 'John Serink'; Rajesh Vattem; perl-win32-users@listserv.ActiveState.com Subject: RE: Net::Telnet John wrote: its does not work on these servers: Windows 2000 Pro, Windows XP pro, Windows 2000 server pro, Windows server 2003. Reason is, the new windows server uses ANSI codes and you CAN'T turn them off like on a UNIX box. These ANSI codes garble up the responses to Net::Telnet. I'd put it this way: The telnet server in these versions of Windows is broken. It doesn't follow the RFCs. To make telnet work, use an alternate telnet server, e.g. http://kpym.sourceforge.net/ -- Mark ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Net::Telnet
Hi, I am using this module (Net::Telnet) downloaded from CPAN, for a small interactive program in which I telnet to a particular host, login and give some commands (based on the options you get). I am not able to do this. I am able to login but whatever I do after that doesn't seem to happen. Can someone suggest what might be going wrong!!! After login, the control console shows --- Control Console --- 1- Device Manager 2- Network 3- System 4- Logout ESC- Main Menu, ENTER- Refresh, CTRL-L- Event Log Please let me know your inputs. Test.txt Thanks Regards, Rajesh. ** The information contained in this email and any attachments is likely to be confidential and legally privileged, and is for the intended recipient named above only. Any copying, dissemination, disclosure of or use of this email or its attachments unless authorised by us is prohibited, except that you may forward this email and/or attachments to a third party on a strict need to know basis. If you have received this email in error, please notify us immediately by replying to the email or by calling +91-80-22297030. Please then delete this email and any full or partial copies of it. You as the intended recipient must be aware and accept that emailis not a totally secure communications medium. Although we have taken all reasonable steps to make sure this email and any attachments are free from viruses, we do not (to the extent permitted by law) accept any liability whatsoever for any virus infection and/or compromise of security caused by this email and any attachment. No contract may be formed or documents served by you on or with us by this email or any attachments unless expressly agreed otherwise by us. Any views expressed in this email or attachments by an individual are not necessarily those of UbiNetics India (Private) Limited. ** print I am starting my script\n; use Net::Telnet; my $t = new Net::Telnet (Timeout = 10, Prompt = '/bash\$ $/'); my $username = apc; my $passwd = apc; $t-open(192.168.0.15); print I got connected\n; $t-waitfor('/User Name :.*$/'); $t-print($username\n); $t-waitfor('/Password :.*$/'); $t-print($passwd\n); print I have logged in\n; sleep(2); $t-print(1); print This is first step\n; sleep(2); $t-print(3); print This is second step\n; sleep(2); $t-print(1); print This is third step\n; sleep(2); $t-print(1); print This is fourth step\n; sleep(2); $t-print(3); print This is fifth step\n; sleep(2); $t-print(YES); print This is sixth step\n; sleep(2); $t-print(); print This is seventh step\n;___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Net::Telnet
Hi, I am using this module (Net::Telnet) downloaded from CPAN, for a small interactive program in which I telnet to a particular host, login and give some commands (based on the options you get). I am not able to do this. I am able to login but whatever I do after that doesn't seem to happen. Can someone suggest what might be going wrong!!! After login, the control console shows --- Control Console --- 1- Device Manager 2- Network 3- System 4- Logout ESC- Main Menu, ENTER- Refresh, CTRL-L- Event Log You have to reset the Prompt. It is expecting and waiting for a '/bash\$ $/' prompt. You may also change the Prompt under the cmd method, in case it changes throughout the session. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Net::Telnet
When Net::Telnet doesn't do what you expect, 99% of the time it's a prompt issue. Did you set the prompt? The default prompt works with the unix command line, but you'll have to set it to work with your application. I highly recommend using the debugging options; they can help you figure out problems like these. -- Mark Thomas Internet Systems Architect ___ BAE SYSTEMS Information Technology 2525 Network Place Herndon, VA 20171 USA -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rajesh Vattem Sent: Wednesday, June 01, 2005 9:37 AM To: perl-win32-users@listserv.ActiveState.com Subject: Net::Telnet Hi, I am using this module (Net::Telnet) downloaded from CPAN, for a small interactive program in which I telnet to a particular host, login and give some commands (based on the options you get). I am not able to do this. I am able to login but whatever I do after that doesn't seem to happen. Can someone suggest what might be going wrong!!! After login, the control console shows --- Control Console --- 1- Device Manager 2- Network 3- System 4- Logout ESC- Main Menu, ENTER- Refresh, CTRL-L- Event Log Please let me know your inputs. Test.txt Thanks Regards, Rajesh. ** The information contained in this email and any attachments is likely to be confidential and legally privileged, and is for the intended recipient named above only. Any copying, dissemination, disclosure of or use of this email or its attachments unless authorised by us is prohibited, except that you may forward this email and/or attachments to a third party on a strict need to know basis. If you have received this email in error, please notify us immediately by replying to the email or by calling +91-80-22297030. Please then delete this email and any full or partial copies of it. You as the intended recipient must be aware and accept that emailis not a totally secure communications medium. Although we have taken all reasonable steps to make sure this email and any attachments are free from viruses, we do not (to the extent permitted by law) accept any liability whatsoever for any virus infection and/or compromise of security caused by this email and any attachment. No contract may be formed or documents served by you on or with us by this email or any attachments unless expressly agreed otherwise by us. Any views expressed in this email or attachments by an individual are not necessarily those of UbiNetics India (Private) Limited. ** ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Using Net-telnet to connect via ssh
Hi Sir, thanks for your help and to all those who replied to my queries. I've already installed Net-SSH-Perl (W32Perl) via the soulcage site and now I'm using this to access our servers via a workstation. Again to All, your replies are highly appreciated. Regards. Rodel -Original Message- From: Sisyphus [mailto:[EMAIL PROTECTED] Sent: Friday, April 01, 2005 6:29 AM To: GT BAUTISTA, Rodel D.; perl-win32-users Subject: Re: Using Net-telnet to connect via ssh - Original Message - From: GT BAUTISTA, Rodel D. [EMAIL PROTECTED] To: perl-win32-users@listserv.ActiveState.com Sent: Thursday, March 31, 2005 5:05 PM Subject: Using Net-telnet to connect via ssh Hi to All, Is there a windows binary distribution of IO-Tty (or IO-Pty)? I can't install the one I downloaded from cpan. I'm having errors in the compiler 'cl' but it is already installed and PATH is properly defined. Below are the errors from the log during makefile.pl: compilerok.c c1 : warning C4349: /Gf is deprecated and will not be supported in future versions of Visual C++; remove /Gf or use /GF instead LINK : fatal error LNK1104: cannot open file 'MSVCRT.lib' Also, where can I download a copy of MSVCRt.lib. thanks and best regards. Rodel Bautista Afaik IO-Tty won't build on Win32 - but the errors you got are not what I expected. MSVCRT.lib should be in the 'lib' folder of your Visual Studio compiler. Did you run vcvars32.bat to set up the appropriate environment variables before you tried to build the module ? Cheers, Rob ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Using Net-telnet to connect via ssh
- Original Message - From: GT BAUTISTA, Rodel D. [EMAIL PROTECTED] To: perl-win32-users@listserv.ActiveState.com Sent: Thursday, March 31, 2005 5:05 PM Subject: Using Net-telnet to connect via ssh Hi to All, Is there a windows binary distribution of IO-Tty (or IO-Pty)? I can't install the one I downloaded from cpan. I'm having errors in the compiler 'cl' but it is already installed and PATH is properly defined. Below are the errors from the log during makefile.pl: compilerok.c c1 : warning C4349: /Gf is deprecated and will not be supported in future versions of Visual C++; remove /Gf or use /GF instead LINK : fatal error LNK1104: cannot open file 'MSVCRT.lib' Also, where can I download a copy of MSVCRt.lib. thanks and best regards. Rodel Bautista Afaik IO-Tty won't build on Win32 - but the errors you got are not what I expected. MSVCRT.lib should be in the 'lib' folder of your Visual Studio compiler. Did you run vcvars32.bat to set up the appropriate environment variables before you tried to build the module ? Cheers, Rob ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Using Net-telnet to connect via ssh
Title: Message Hi to All, Is there a windows binary distribution of IO-Tty (or IO-Pty)? I can't install the one I downloaded from cpan. I'm having errors in the compiler 'cl' but it is already installed and PATH is properly defined. Below are the errors from the log during makefile.pl: compilerok.cc1 : warning C4349: /Gf is deprecated and will not be supported in future versions of Visual C++; remove /Gf or use /GF insteadLINK : fatal error LNK1104: cannot open file 'MSVCRT.lib' Also, where can I download a copy of MSVCRt.lib. thanks and best regards. Rodel Bautista Globe Telecom ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Net::Telnet and Windows Telnet Server --- any alternatives?
Hi Folks, The Net::Telnet doc explains why the Windows Telnet Server will not work with that module (sends ANSI cursor positioning codes, etc. instead of simple ASCII) and mentions that alternative Telnet servers exist, but does not name them. Apparently, many of them do the same thing as the Windows Telnet server unless they allow you to disable 'console mode' according to the Net::Telnet doc. So far, all the Telnet servers I have tried exhibit the bad behavior and don't have a way to turn off 'console mode'. Does anyone know of a freeware/shareware/open source Telnet server that works with the Net::Telnet module? Thanks! Jim Guion Sr. Quality Assurance Engineer Bluesocket, Inc. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Net::Telnet and Windows Telnet Server --- any alternatives?
The Hummingbird telnet works like a normal terminal but is non free. For scripting a telnet session I would use Expect anyway. For a free telnet server that is terminal like I would(and do) use Cygwin. U can even use bash as the shell. -- REMEMBER THE WORLD TRADE CENTER ---= WTC 911 =-- ...ne cede males 0100 ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re:Re: net::telnet (and perl sockets) question
[EMAIL PROTECTED] wrote: And 2-nd question: how to start fixed program/without params/ on windows98 box from linux box (on a local network) ? You can 'use IO::Socket;' on the Windows box to set up a simple server, and 'use IO::Socket;' on the linux box to send the start message to the server on the Windows box. Cheers, Rob == I come to vb6 Winsock server from http://15seconds.com/files/010820.zip on Windows box which suits me well and SIMPLE perl client which I get by cut and paste method from perl docs: +++ use strict; use IO::Socket; use Tk; require Tk::LabFrame; my $so; my $port; my $top = new MainWindow; my $bar=$top-LabFrame(-label = 'buttons bar'); $bar-pack; my $exi=$bar-Button(-command=\exi,-text=Exit); $exi-pack(-side='left'); my $conne=$bar-Button(-command=\connect,-text=Connect); $conne-pack(-side='left'); my $clos=$bar-Button(-command=\clos,-text=Close); $clos-pack(-side='left'); my $send=$bar-Button(-command=\send,-text=Send); $send-pack(-side='left'); MainLoop; sub exi{ if (defined $so){ $so-shutdown(1); } $top-destroy; } sub connect { my ($remote,$port, $iaddr, $paddr, $proto, $line); $remote = 'localhost'; $port= 1007; # random port if ($port =~ /\D/) { $port = getservbyname($port, 'tcp') } die No port unless $port; $so=new IO::Socket::INET-new( PeerAddr=$remote, PeerPort=$port, Proto='tcp', Type=SOCK_STREAM, ) or die could not connect to $remote port $port; } sub clos{ if (defined $so){ # close $so; $so-shutdown(1); } } sub send { if (defined $so){ print $so ...; } } my last question is - it looks to me that to this client snippet there must be simple server snippet in perl I should rather use perl ! /I need to receive sms messages from handset mobile - these messages I need on my Linux box, but I have a program only in windows to read messages from mobile ,so that after chimes which signals arrival of message, operator on Linux box starts program on windows box which starts reading messages from mobile and send them back to Linux box/ Client snippet is fully functional,so I looking for fully functional server snippet in the style of client thank you in advance ! ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: net::telnet question
[EMAIL PROTECTED] wrote: And 2-nd question: how to start fixed program/without params/ on windows98 box from linux box (on a local network) ? You can 'use IO::Socket;' on the Windows box to set up a simple server, and 'use IO::Socket;' on the linux box to send the start message to the server on the Windows box. Cheers, Rob ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
IPC::Open2 Net::Telnet
I've been trying to write a script that controls an interactive command-line program. From the searching I've done, it looks like IPC::Open2/IPC::Open3 paired with Net::Telnet would be the easiest way to do this on Windows. The included script is my attempt, however I get the following error when I run the script: unexpected read error: Bad file descriptor at fcli.pl line 22 Any suggestions/comments appreciated. James 1 use strict; 2 use warnings; 3 4 use IPC::Open2; 5 use Net::Telnet; 6 $| = 1; 7 8 my ($readme, $writeme, $results, $pid); 9 eval { $pid = open2($readme, $writeme, 'flarecons', 'd', 'f', 'a'); }; 10 if ($@) { 11 if ($@ =~ /^open2:/i) { 12 die open2 failed: [EMAIL PROTECTED]; 13 } 14 die; 15 } 16 17 my $telnet = Net::Telnet-new(-fhopen = $readme, 18 -telnetmode = 0, 19 -cmd_remove_mode = 1, 20 -prompt = '/fcli $/'); 21 print $writeme l\n; 22 $results = $telnet-waitfor('/q\' to Quit\) $/'); 23 print $writeme \n; 24 $results .= $telnet-waitfor('/q\' to Quit\) $/'); 25 print $writeme q\n; 26 print $writeme \cC\n; 27 waitpid($pid, 0); 28 print $results\n; ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Net::Telnet::Cisco script not waiting for prompt
Hi Howard, I have some experience in writing scripts with this excellent module, some of which have been used on c2500 routers. Sometimes, I find that setting the terminal length to zero at the start of the script can help: @output=$RSession-cmd(String = 'term length 0', Timeout = '3'); (you need enable mode before sending this command) Experiment with this, but if all else fails, you could get in touch with the module author via his web forum: http://nettelnetcisco.sourceforge.net/ HTH, James. Bullock, Howard A. wrote: I am attempting to automate some router changes using Net::Telnet::Cisco and having problems. The router: IOS (tm) 2500 Software (C2500-J-L), Version 11.2(14) The cisco module methods seem to work well for login, enable, and cmd('show version'). I run into a problem when I issue cmd('wr'). The router returns the following text: Building configuration... [OK] As soon as the 'wr' command is sent the program continues to the end. I even attempt to perform a backup using TFTP after the 'wr' commad. This also seems to not wait for the prompt. My timeout for the commands is set to 40 seconds. I have used the debug dump.log and see what I think is very strange. The 'wr' command is executed, then the TFTP command is executed, then the response from the 'wr' is echoed. 0x0: 5e 5a 0d 0a 63 31 39 34 6e 23 0d 0a 63 31 39 34 ^Z..c194n#..c194 0x00010: 6e 23 n# 0x0: 77 72 0d 0a wr.. 0x0: 63 6f 70 79 20 72 75 6e 6e 69 6e 67 2d 63 6f 6e copy running-con 0x00010: 66 69 67 20 74 66 74 70 0d 0a 31 36 33 2e 32 34 fig tftp..163.24 0x00020: 31 2e 31 35 34 2e 31 38 36 0d 0a 63 31 39 34 6e 1.154.186..c194n 0x00030: 2d 63 6f 6e 66 67 0d 0a 0d 0a 0d 0a -confg.. 0x0: 77 72 0d 0a 42 75 69 6c 64 69 6e 67 20 63 6f 6e wr..Building con 0x00010: 66 69 67 75 72 61 74 69 6f 6e 2e 2e 2e 0d 0a 5b figuration.[ 0x00020: 4f 4b 5d 0d 0a 63 31 39 34 6e 23 63 6f 70 79 20 OK]..c194n#copy 0x00030: 72 75 6e 6e 69 6e 67 running I even scrapped the cmd method and implemented: $session-print('wr'); $session-waitfor('/\[OK\]/'); This also does not seem to way. Adding sleep 40; after the 'wr' command and another sleep 40; after the TFTP command got the program to work. This however is not solution. Any assistance would be greatly appreciated. Howard A. Bullock Global IT Infrastructure 717-810-3584 ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Net::Telnet and Term Type
Normally, that cmd would do the trick. Unfortunately, my script needs to connect to a login without shell access, so I cant set TERM that way on the remote (UNIX) box. The login is given a menu from the start, and it is from that menu that I call the program that wants to see vt100. The local side is a WinXP box. Setting TERM in the local XP-DOS environment did what I expected: nothing. Any other ideas? [So far, the only choice Im seeing is to work-around by inserting an extra hopconnecting to a UNIX shell login first, using that cmd(export TERM=vt100) there, and then re-connecting from that shell login to my destinationbut that is definitely not a preferred way to do this. It would be much better to go direct if there is a way.] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mingbo_Wan Try tm-cmd(export TERM=vt100) -- I need to set the Telnet terminal type option for a telnet connection using Net::Telnet. Does anyone know how to do that? My script is connecting to the system and processing most commands just fine. (So I know it is NOT related to my prompt setting.) The problem comes when I try to use a program on the server that is looking to see vt100 in the Term Type, and it seems to be seeing tvi925 instead. Ive tried looking through the docs and Telnet.pm, but Im not sure how to go about using TELOPT_TTYPE, or even if that is what I need to use.
RE: Help needed -- Net::telnet gives errors
Hi Ibrahim Thanks for ur help ! I am able to connect to the UNIX server using Prompt='/[\w]$-/' (the login being the user id with which the person has logged in eg. tom- ). But 1 more prob. i have an application in which this perl script is being called by an HTML form (the usual Login screen ) and the login pwd is passed to the perl script This is my code for the HTML form == html head titleLogin Screen/title /head body H1centerU User Log in Screen /U/H1/center brbrhr form name=usrlogin action=/cgi-bin/telp.pl method=GET center User id : nbspnbspnbsp input type=text name=fname br Password : input type=password name=fpwd brbr input type=reset Value=Reset nbspnbsp input type=submit Value=Submit hr / center /form /body /html And this is the Perl code use CGI; use CGI::Carp qw(fatalsToBrowser); use Net::Telnet(); print Content-type:text/html\n\n; read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(//,$buffer); print @pairs \n; $j=0; foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; #($dummy,$name)= split(/?/,$name); $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(C, hex($1))/eg; $FORM{$name} = $value; $info[$j]= $value; $j++; } $t = new Net::Telnet (Timeout = 10, Prompt ='/-/i',input_log='D:\server\logs\inputlog.txt'); $t-open(xxx..xxx.xxx) or die Server not found \n; $t-login($usr, $pwd); @lines = $t-cmd(ls -l); foreach $temp(@lines) { print a href = \cgi-bin/change_dir.pl\$temp/abr; } == The problem is that when i clik submit in the login screen, it dosent paas the usrname nad pswd to the perl prog. I dont understand why this is happening. Please help. Regards Ashish From: ibrahim [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: 'ashish srivastava' [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: RE: Help needed -- Net::telnet gives errors Date: Sat, 14 Jun 2003 06:18:40 +0300 I used to get this type of error if the server was off or has some other problem. However, the I got the following code from this board and it is working excellent over about 80-90 switches-servers except some switches where login code worked fine but the switch require pressing enter after login and this what I could not solve it until now (send enter key or any key to this type of switch after login). Please let me know if I can help. Thank you. use Net::Telnet; $telnet = new Net::Telnet (Timeout = 20, Prompt = '/[%#\]\/] *$/'); $out='C:\Result.txt'; open OUT, $out or die Cannot open $out for append :$!; $telnet-open('XX.XXX.XXX.XXX'); $telnet-login('user','user'); @lines= $telnet-cmd(ipmac); print OUT @lines,\n; for ($X=0; $X = $#lines; $X++) { @lines=$telnet-cmd( ); print OUT @lines,\n; } close OUT; $telnet-close; -Original Message- From: ashish srivastava [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 7:19 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Help needed -- Net::telnet gives errors http://www.herohonda.com/karizma _ Horror films in Bollywood. Are they worth it? http://server1.msn.co.in/features/horror/index.asp Get all the dope! ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Help needed -- Net::telnet gives errors
On Sat, 14 Jun 2003, ashish srivastava wrote: Hi Ibrahim Thanks for ur help ! I am able to connect to the UNIX server using Prompt='/[\w]$-/' (the login being the user id with which the person has logged in eg. tom- ). But 1 more prob. i have an application in which this perl script is being called by an HTML form (the usual Login screen ) and the login pwd is passed to the perl script This is my code for the HTML form == html head titleLogin Screen/title /head body H1centerU User Log in Screen /U/H1/center brbrhr form name=usrlogin action=/cgi-bin/telp.pl method=GET center User id : nbspnbspnbsp input type=text name=fname br Password : input type=password name=fpwd brbr input type=reset Value=Reset nbspnbsp input type=submit Value=Submit hr / center /form /body /html And this is the Perl code use CGI; use CGI::Carp qw(fatalsToBrowser); use Net::Telnet(); print Content-type:text/html\n\n; read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(//,$buffer); print @pairs \n; $j=0; foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; #($dummy,$name)= split(/?/,$name); $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(C, hex($1))/eg; $FORM{$name} = $value; $info[$j]= $value; $j++; } $t = new Net::Telnet (Timeout = 10, Prompt ='/-/i',input_log='D:\server\logs\inputlog.txt'); $t-open(xxx..xxx.xxx) or die Server not found \n; $t-login($usr, $pwd); @lines = $t-cmd(ls -l); foreach $temp(@lines) { print a href = \cgi-bin/change_dir.pl\$temp/abr; } == The problem is that when i clik submit in the login screen, it dosent paas the usrname nad pswd to the perl prog. I dont understand why this is happening. Please help. It's because you said the method was GET but you tried to retreive the value from the form as though the method was POST. When the method is GET the form values are passed via the $ENV{QUERY_STRING}. I strongly suggest that the GET method NOT be used when you are passing a password unless you only want to keep the password secret from those who don't know how to view/source on an HTML page. Also why are you hand-parsing the form input anyway when the CGI module has already done it for you? [EMAIL PROTECTED] Carl Jolley All opinions are my own and not necessarily those of my employer ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Help needed -- Net::telnet gives errors
I am also working on a project that requires passing a password via the web, and obviously did not want to do so URL encoded with GET. My suggestions: A. Use CGI.pm's param() method to get your form data. I second Carl's question as to why you would manually parse the form data when you can get all of the form data into a hash by simply doing use CGI; my $query = new CGI; my %formvalues = $query-Vars; B. The way I went about the password issue without using GET, or even a POST with hidden fields (better but still not ideal), is to use CGI::Session to generate a unique session ID once the username and password are authenticated. Now I use the session ID in hidden fields where I can, URL encoded using GET where I have to, but the username and password are not being passed around insecurely. The CGI::Session docs are pretty decent on the examples, so you shouldn't have much trouble with it. You can also use the generated session ID as a cookie and fake statefulness that way. Your solution may require more effort because you are using a telnet session and authenticating that way, where I'm just authenticating against either .htaccess files or MySQL columns, so you've got another link in the chain there. But then again telnet passes username/password in plain ascii, so we're back to the security issue on that end of it. Have you considered initiating an SSH session rather than a telnet session? Just a thought... Scot R. inSite -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Carl Jolley Sent: Saturday, June 14, 2003 7:29 PM To: ashish srivastava Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Help needed -- Net::telnet gives errors On Sat, 14 Jun 2003, ashish srivastava wrote: Hi Ibrahim Thanks for ur help ! I am able to connect to the UNIX server using Prompt='/[\w]$-/' (the login being the user id with which the person has logged in eg. tom- ). But 1 more prob. i have an application in which this perl script is being called by an HTML form (the usual Login screen ) and the login pwd is passed to the perl script This is my code for the HTML form == html head titleLogin Screen/title /head body H1centerU User Log in Screen /U/H1/center brbrhr form name=usrlogin action=/cgi-bin/telp.pl method=GET center User id : nbspnbspnbsp input type=text name=fname br Password : input type=password name=fpwd brbr input type=reset Value=Reset nbspnbsp input type=submit Value=Submit hr / center /form /body /html And this is the Perl code use CGI; use CGI::Carp qw(fatalsToBrowser); use Net::Telnet(); print Content-type:text/html\n\n; read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(//,$buffer); print @pairs \n; $j=0; foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; #($dummy,$name)= split(/?/,$name); $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(C, hex($1))/eg; $FORM{$name} = $value; $info[$j]= $value; $j++; } $t = new Net::Telnet (Timeout = 10, Prompt ='/-/i',input_log='D:\server\logs\inputlog.txt'); $t-open(xxx..xxx.xxx) or die Server not found \n; $t-login($usr, $pwd); @lines = $t-cmd(ls -l); foreach $temp(@lines) { print a href = \cgi-bin/change_dir.pl\$temp/abr; } == The problem is that when i clik submit in the login screen, it dosent paas the usrname nad pswd to the perl prog. I dont understand why this is happening. Please help. It's because you said the method was GET but you tried to retreive the value from the form as though the method was POST. When the method is GET the form values are passed via the $ENV{QUERY_STRING}. I strongly suggest that the GET method NOT be used when you are passing a password unless you only want to keep the password secret from those who don't know how to view/source on an HTML page. Also why are you hand-parsing the form input anyway when the CGI module has already done it for you? [EMAIL PROTECTED] Carl Jolley All opinions are my own and not necessarily those of my employer ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs BEGIN:VCARD VERSION:2.1 N:Robnett;Scot FN:Scot Robnett ORG:inSite Internet Solutions NOTE;ENCODING=QUOTED-PRINTABLE:Low cost web hosting, 50 MB disk space, easy and intuitive browser-based pag= e builder and control panel, 2000 product shopping cart, contact management,= site promotion, and free tech support:=0D=0A=0D=0A http://www.mawebcenters.= com
RE: Help needed -- Net::telnet gives errors
I used to get this type of error if the server was off or has some other problem. However, the I got the following code from this board and it is working excellent over about 80-90 switches-servers except some switches where login code worked fine but the switch require pressing enter after login and this what I could not solve it until now (send enter key or any key to this type of switch after login). Please let me know if I can help. Thank you. use Net::Telnet; $telnet = new Net::Telnet (Timeout = 20, Prompt = '/[%#\]\/] *$/'); $out='C:\Result.txt'; open OUT, $out or die Cannot open $out for append :$!; $telnet-open('XX.XXX.XXX.XXX'); $telnet-login('user','user'); @lines= $telnet-cmd(ipmac); print OUT @lines,\n; for ($X=0; $X = $#lines; $X++) { @lines=$telnet-cmd( ); print OUT @lines,\n; } close OUT; $telnet-close; -Original Message- From: ashish srivastava [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 7:19 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Help needed -- Net::telnet gives errors
Net::Telnet Script Issue
I was able to resolve my issues with Net::Telnet not working, thank you to everyone who replied to my post. Now I have something different. Below is a script that I wrote, it telnets to a Cisco router, goes into enable mode, and is supposed to print the output of a show ip route command. The issue is that the script times out at line 13, which is where it is supposed to send the command. I know that the telnet is connecting, and the script is authenticating, because if it wasn't it would time out way before line 13 (at least I hope that is correct). Can anyone tell me why it is timing out? I thought that maybe it was because there was no newline at the end of line 13, but supposedly when using cmd there is an automatic newline appended to the string. I would appreciate any help. use Net::Telnet(); $t = new Net::Telnet; $t-open(x.x.x.x); $t-waitfor('/Username:/'); $t-print(glupi); $t-waitfor('/Password:/'); $t-print(neteng1283); $t-waitfor('/br01-nyc1.ny/'); $t-print(enable); $t-waitfor('/Password:/'); $t-print(neteng1283); $t-waitfor('/br01-nyc1.ny#/'); @lines = $t-cmd(show ip route); print @lines; Guy H. Lupi ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Having problems with Net::Telnet
I should have included that in my original message, I copied this from a website: use Net::Telnet(); $telnet = new Net::Telnet (Timeout = 10, Errmode = 'die'); $telnet -open('198.207.193.112'); $telnet -waitfor('Password:') -Original Message- From: Scot Robnett [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2003 8:21 PM To: Lupi, Guy; [EMAIL PROTECTED] Subject: RE: Having problems with Net::Telnet Show us the code? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Lupi, Guy Sent: Monday, March 03, 2003 5:22 PM To: '[EMAIL PROTECTED]' Subject: Having problems with Net::Telnet Please excuse me if this is an extremely basic question, this is my first post and I am a beginner, but I can't seem to get Net::Telnet to work. I am getting the following error when I try to run a script using the Net::Telnet module. Can't locate object method new via package Net::Telnet (perhaps you forgot t o load Net::Telnet?) at telnet.txt line 2. I have looked on the net, and I found some advice, but nothing I do seems to work. I ran the libnet.cfg file, and ran ppm to install net-telnet, and telnet.pm is definitely in my Perl installation. I think my code is correct, I copied it exactly from a website and simply replaced their IP address with my own. I am running ActivePerl on a Windows XP workstation. I am a beginner, so be gentle :). Guy H. Lupi ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Having problems with Net::Telnet
I did that, here is the output that was returned. C:\Perlppm install Net::Telnet Searching for 'Net::Telnet' returned multiple results. Using 'search' instead... Searching in Active Repositories 1. Net-Telnet [3.03] Interact with TELNET port or other TCP ports 2. Net-Telnet-Cisco [1.10] automate Cisco management 3. Net-Telnet-Netscreen [1.01] interact with a Netscreen firewall C:\Perlppm install Net-Telnet Note: Package 'Net-Telnet' is already installed. Install 'Net-Telnet' version 3.03 in ActivePerl 5.8.0.804. Successfully installed Net-Telnet version 3.03 in ActivePerl 5.8.0.804. Then I tried to run my script and I got the same error message. -Original Message- From: Thomas_M [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 04, 2003 8:06 AM To: Lupi, Guy Cc: Perl-Win32-Users (Perl-Win32-Users) Subject: RE: Having problems with Net::Telnet Can't locate object method new via package Net::Telnet (perhaps you forgot t o load Net::Telnet?) at telnet.txt line 2. I'm not sure why nobody told you this yet, but this error means you need to install the Net::Telnet module. From a command prompt, type ppm install Net::Telnet. -- Mark Thomas[EMAIL PROTECTED] Internet Systems Architect User Technology Associates, Inc. $_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y; ;;print;; ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Another Net::Telnet question while we are on the subject!
Title: Another Net::Telnet question while we are on the subject! Hi all, I was just wondering about this: I use Net::Telnet to send a command that takes anywhere from 3 to 10 minutes to complete. Is there some way to create some activity indication while the command is out doing its thing? Maybe print dots, or print out what it's doing on the remote machine? would I need to multi-thread for this? Example+++ my $user = 'me'; my $pass = 'mepasswd'; my $dumplog = 'result.log'; $telnet = Net::Telnet-new($host) or die FAILED could not establish Telnet to $host; $telnet-errmode(die); $telnet-input_log($dumplog); $telnet-login($user,$pass) or die FAILED could not log into $host using $user and $pass; $telnet-cmd(String = SomeLengthyCmd, Timeout = 600); $telnet-close; # here we do something # with the $dumplog to see # if command did everything End Example--- Thanks, John D.
Re: Having problems with Net::Telnet
Lupi, Guy wrote: I did that, here is the output that was returned. C:\Perlppm install Net::Telnet [snip] Successfully installed Net-Telnet version 3.03 in ActivePerl 5.8.0.804. Then I tried to run my script and I got the same error message. [snip] FYI, I tried the snip on 98se, 5.6 build 633. All ok. I'd suspect either winXP (which is always causing odd problems) or 5.8 ASperl... though the module is 'pure perl' right? I don't see anything new for the 5.8 ppd. Good luck! -- mike higgins ^ ^ -|- (.)__ the world is a big box of paints. __ __ and others, the canvas we're dealt. | | - XTC _/ \_ ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Having problems with Net::Telnet
Title: RE: Having problems with Net::Telnet I'm using perl, v5.6.1 built for cygwin-multi under Windows2000 Pro SP2 and found the following if it helps at all. doesn't seem to bear on your original problem though! #just a thought but shouldn't this line: $telnet -waitfor('Password:') #instead read: $telnet -waitfor('/Password:/i'); I get the following error when it's not: bad match operator: opening delimiter missing: Password: at ./temp.pl line 27
RE: Having problems with Net::Telnet
Show us the code? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Lupi, Guy Sent: Monday, March 03, 2003 5:22 PM To: '[EMAIL PROTECTED]' Subject: Having problems with Net::Telnet Please excuse me if this is an extremely basic question, this is my first post and I am a beginner, but I can't seem to get Net::Telnet to work. I am getting the following error when I try to run a script using the Net::Telnet module. Can't locate object method new via package Net::Telnet (perhaps you forgot t o load Net::Telnet?) at telnet.txt line 2. I have looked on the net, and I found some advice, but nothing I do seems to work. I ran the libnet.cfg file, and ran ppm to install net-telnet, and telnet.pm is definitely in my Perl installation. I think my code is correct, I copied it exactly from a website and simply replaced their IP address with my own. I am running ActivePerl on a Windows XP workstation. I am a beginner, so be gentle :). Guy H. Lupi ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs BEGIN:VCARD VERSION:2.1 N:Robnett;Scot FN:Scot Robnett ORG:inSite Internet Solutions NOTE;ENCODING=QUOTED-PRINTABLE:Low cost web hosting, 50 MB disk space, easy and intuitive browser-based pag= e builder and control panel, 2000 product shopping cart, contact management,= site promotion, and free tech support:=0D=0A=0D=0A http://www.mawebcenters.= com/insite2000 TEL;WORK;VOICE:(815) 206-2907 TEL;CELL;VOICE:(815) 790-9687 ADR;WORK;ENCODING=QUOTED-PRINTABLE:;;Square West Center=0D=0A454 W. Jackson St.;Woodstock;IL;60098;United State= s of America LABEL;WORK;ENCODING=QUOTED-PRINTABLE:Square West Center=0D=0A454 W. Jackson St.=0D=0AWoodstock, IL 60098=0D=0AUni= ted States of America URL;HOME:http://www.insiteful.tv URL;WORK:http://www.insiteful.tv EMAIL;PREF;INTERNET:[EMAIL PROTECTED] EMAIL;INTERNET:[EMAIL PROTECTED] EMAIL;INTERNET:[EMAIL PROTECTED] REV:20030223T194915Z END:VCARD
Re: Having problems with Net::Telnet
Lupi, Guy wrote: Please excuse me if this is an extremely basic question, this is my first post and I am a beginner, but I can't seem to get Net::Telnet to work. I am getting the following error when I try to run a script using the Net::Telnet module. Can't locate object method new via package Net::Telnet (perhaps you forgot t o load Net::Telnet?) at telnet.txt line 2. [snip] Since I see the error occured at line 2, I think there are lines missing. First, 'use strict;' ... line 1 'use warnings;' ... line 2 There's definitely a problem. ;-) However, unless you *don't* have 'use Net::Telnet;' as line 1, you should post the code. -- mike higgins ^ ^ -|- (.)__ the world is a big box of paints. __ __ and others, the canvas we're dealt. | | - XTC _/ \_ ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Having problems with Net::Telnet
Did you install the module using PPM? What platform are you running it on? -Original Message- From: Lupi, Guy [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 04, 2003 7:22 AM To: '[EMAIL PROTECTED]' Subject: Having problems with Net::Telnet Please excuse me if this is an extremely basic question, this is my first post and I am a beginner, but I can't seem to get Net::Telnet to work. I am getting the following error when I try to run a script using the Net::Telnet module. Can't locate object method new via package Net::Telnet (perhaps you forgot t o load Net::Telnet?) at telnet.txt line 2. I have looked on the net, and I found some advice, but nothing I do seems to work. I ran the libnet.cfg file, and ran ppm to install net-telnet, and telnet.pm is definitely in my Perl installation. I think my code is correct, I copied it exactly from a website and simply replaced their IP address with my own. I am running ActivePerl on a Windows XP workstation. I am a beginner, so be gentle :). Guy H. Lupi ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Net::Telnet on Win2K
John, The problem is outlined in the Net:Telnet documentation. The loads of gibberish is ANSI terminal escape characters. I haven't worked with that exact telnet application, but some allow you to turn ANSI off and on http://search.cpan.org/author/JROGERS/Net-Telnet-3.03/lib/Net/Telnet.pm Connecting to a Remote MS-Windows Machine By default MS-Windows doesn't come with a TELNET server. However third party TELNET servers are available. Unfortunately many of these servers falsely claim to be a TELNET server. This is especially true of the so-called Microsoft Telnet Server that comes installed with some newer versions MS-Windows. When a TELNET server first accepts a connection, it must use the ASCII control characters carriage-return and line-feed to start a new line (see RFC854). A server like the Microsoft Telnet Server that doesn't do this, isn't a TELNET server. These servers send ANSI terminal escape sequences to position to a column on a subsequent line and to even position while writing characters that are adjacent to each other. Worse, when sending output these servers resend previously sent command output in a misguided attempt to display an entire terminal screen. Connecting Net::Telnet to one of these false TELNET servers makes your job of parsing command output very difficult. It's better to replace a false TELNET server with a real TELNET server. The better TELNET servers for MS-Windows allow you to avoid the ANSI escapes by turning off something some of them call console mode. Kevin _ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Net::Telnet on Win2K
--8-- When a TELNET server first accepts a connection, it must use the ASCII control characters carriage-return and line-feed to start a new line (see RFC854). A server like the Microsoft Telnet Server that doesn't do this, isn't a TELNET server. These servers send ANSI terminal escape sequences to position to a column on a subsequent line and to even position while writing characters that are adjacent to each other. Worse, when sending output these servers resend previously sent command output in a misguided attempt to display an entire terminal screen. Connecting Net::Telnet to one of these false TELNET servers makes your job of parsing command output very difficult. It's better to replace a false TELNET server with a real TELNET server. The better TELNET servers for MS-Windows allow you to avoid the ANSI escapes by turning off something some of them call console mode. --8-- Kevin Very informative, thanks. Do you know of any FREE real Telnet servers, that allow you to turn off console mode? Just in ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Net::Telnet on Win2K
Yah, yahread all that. Question is, how do you stop the Win2K telnet server from defaulting to an ANSI terminal? This is particularly worrisome as the option_send method has not yet been written for the Net::Telnet module so it is impossible to ask the Win2K server to change from inside the perl app. I have tired the following unsuccessfully: 1. Reordered the terminal parameters setting on the Win2K telnet server box in the c:\winnt\system32\termcap file (this was an attempted hack as I know nothing about termcap files), 2. Renamed the termcap file to that tlntsvr couldn't find it which causes tlntsvr to exit after login, 3. Used the /y switch in the console execution entry in the registry. At this stage of the game, I am going to give up since the option_send method is not up yet. Since my app simply requires me to identify whether a remote perl script executed successfully on the target Win2K machine, I can search through the gibberish with regex and check. Unfortunately, this does not solve the more general issue regarding the tlntsvr on a Win2K box. Mickeysoft has ZERO information on the termcap file anywhere on their website but it appears to follow the Unix syntax. They also have ZERO information on how to change the default terminal setting for the tlntsvr. Anyhow, That's it for me on this issue. Cheers and thanx to everybody for the help, jOhn -Original Message- From: Kevin Pendleton [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 28, 2002 12:56 PM To: John Serink; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: Net::Telnet on Win2K John, The problem is outlined in the Net:Telnet documentation. The loads of gibberish is ANSI terminal escape characters. I haven't worked with that exact telnet application, but some allow you to turn ANSI off and on http://search.cpan.org/author/JROGERS/Net-Telnet-3.03/lib/Net/ Telnet.pm Connecting to a Remote MS-Windows Machine By default MS-Windows doesn't come with a TELNET server. However third party TELNET servers are available. Unfortunately many of these servers falsely claim to be a TELNET server. This is especially true of the so-called Microsoft Telnet Server that comes installed with some newer versions MS-Windows. When a TELNET server first accepts a connection, it must use the ASCII control characters carriage-return and line-feed to start a new line (see RFC854). A server like the Microsoft Telnet Server that doesn't do this, isn't a TELNET server. These servers send ANSI terminal escape sequences to position to a column on a subsequent line and to even position while writing characters that are adjacent to each other. Worse, when sending output these servers resend previously sent command output in a misguided attempt to display an entire terminal screen. Connecting Net::Telnet to one of these false TELNET servers makes your job of parsing command output very difficult. It's better to replace a false TELNET server with a real TELNET server. The better TELNET servers for MS-Windows allow you to avoid the ANSI escapes by turning off something some of them call console mode. Kevin _ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: NET::Telnet
Jitranda, I gave up trying to figure out what to use as a prompt for Net::Telnet when connecting to Windows' telnet server. Maybe someone out there will enlighten us both. Tom Jitendra Soam [EMAIL PROTECTED]@listserv.ActiveState.com on 09/17/2002 10:38:52 AM Sent by:[EMAIL PROTECTED] To:[EMAIL PROTECTED] cc: Subject:RE: NET::Telnet Thanks. But the what should be used as prompt? -Original Message- From: Thomas R Wyant_III [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 7:01 PM To: [EMAIL PROTECTED] Subject: Re: NET::Telnet Jitendra Soam [EMAIL PROTECTED] wrote: Is it possible to use Net::Telnet module to telnet into Windows machine running Microsoft Telnet Service.. In theory, yes, _provided_ the Telnet service is set up to do username/password authentication. This is not the default. In practice, there appear to be significant problems figuring out what you should tell it the prompt string is, because Microsoft embeds all sorts of escape sequences in it. and start Any program like Notepad on target machine? In theory, yes. In practice, of course, Notepad displays on the target machine's desktop, which probably does you as the owner of the telnet link no good at all. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as E-Contract Intended, this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portuges Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as E-Contract Intended, this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portuges Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: NET::Telnet
The Prompt is a regular expression that matches the commandline prompt from the remote shell. That means you'll want to match the prompt for the user you are logging in as. If I log into one of my remote windows machines through a telnet server and I see I have a prompt like so, C:/ I'll need to match that within my code as prompt. If the prompt isn't matched in the time specified in Timeout then the script will either return false or die based on what Errmode is set to, return or die respectively. NET::Telnet Defaults: Timeout = 10 Host = localhost Errmode = die Prompt = /[\$%#]$/ # matches most unix shells. Port = 23 This is how you could establish a connection with a windows machine with NET::Telnet (Untested). use strict; my $TIMEOUT = 30; my $PROMPT = C:/; my $HOST = foobar.foo.com; my $USER = Bob; my $PASS = password; $telnet = Net::Telnet-new( Timeout = $TIMEOUT, Prompt = $PROMPT, Host= $HOST, Errmode = return); $telnet-login($USER, $PASS); # Test here for success if using return. my $msg = $telnet-errmsg(); if ($msg) { print $msg\n; $telnet-close; # do whatever you want here. } Hope this helps. Cheers, Carter. -Original Message- From: Jitendra Soam [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 7:39 AM To: [EMAIL PROTECTED] Subject: RE: NET::Telnet Thanks. But the what should be used as prompt? -Original Message- From: Thomas R Wyant_III [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 7:01 PM To: [EMAIL PROTECTED] Subject: Re: NET::Telnet Jitendra Soam [EMAIL PROTECTED] wrote: Is it possible to use Net::Telnet module to telnet into Windows machine running Microsoft Telnet Service.. In theory, yes, _provided_ the Telnet service is set up to do username/password authentication. This is not the default. In practice, there appear to be significant problems figuring out what you should tell it the prompt string is, because Microsoft embeds all sorts of escape sequences in it. and start Any program like Notepad on target machine? In theory, yes. In practice, of course, Notepad displays on the target machine's desktop, which probably does you as the owner of the telnet link no good at all. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as E-Contract Intended, this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portuges Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
FW: NET::Telnet
Carter, what you're saying may work on Unix systems, but after 2 weeks of hair-pulling last year, I gave up trying to use Net::Telnet on legacy Univac and Dec systems. The module just couldn't handle the odd terminal emulation escape sequences that were being fed to it (especially on the Univac) and I was unable to reliably establish and maintain terminal sessions on those machines. Finally had to brute force ftp files up to those boxes without being able to do the file existence/status checking planned for in my original design. Net::Telnet users beware. Glen -Original Message- From: Carter Thompson [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 1:22 PM To: Jitendra Soam; [EMAIL PROTECTED] Subject: RE: NET::Telnet The Prompt is a regular expression that matches the commandline prompt from the remote shell. That means you'll want to match the prompt for the user you are logging in as. If I log into one of my remote windows machines through a telnet server and I see I have a prompt like so, C:/ I'll need to match that within my code as prompt. If the prompt isn't matched in the time specified in Timeout then the script will either return false or die based on what Errmode is set to, return or die respectively. NET::Telnet Defaults: Timeout = 10 Host = localhost Errmode = die Prompt = /[\$%#]$/ # matches most unix shells. Port = 23 This is how you could establish a connection with a windows machine with NET::Telnet (Untested). use strict; my $TIMEOUT = 30; my $PROMPT = C:/; my $HOST = foobar.foo.com; my $USER = Bob; my $PASS = password; $telnet = Net::Telnet-new( Timeout = $TIMEOUT, Prompt = $PROMPT, Host= $HOST, Errmode = return); $telnet-login($USER, $PASS); # Test here for success if using return. my $msg = $telnet-errmsg(); if ($msg) { print $msg\n; $telnet-close; # do whatever you want here. } Hope this helps. Cheers, Carter. -Original Message- From: Jitendra Soam [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 7:39 AM To: [EMAIL PROTECTED] Subject: RE: NET::Telnet Thanks. But the what should be used as prompt? -Original Message- From: Thomas R Wyant_III [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 7:01 PM To: [EMAIL PROTECTED] Subject: Re: NET::Telnet Jitendra Soam [EMAIL PROTECTED] wrote: Is it possible to use Net::Telnet module to telnet into Windows machine running Microsoft Telnet Service.. In theory, yes, _provided_ the Telnet service is set up to do username/password authentication. This is not the default. In practice, there appear to be significant problems figuring out what you should tell it the prompt string is, because Microsoft embeds all sorts of escape sequences in it. and start Any program like Notepad on target machine? In theory, yes. In practice, of course, Notepad displays on the target machine's desktop, which probably does you as the owner of the telnet link no good at all. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as E-Contract Intended, this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portuges Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: NET::Telnet
Before anyone else mentions it - please add the use NET::Telnet in the example. I told you it was untested. ;-) Carter. -Original Message- From: Carter Thompson Sent: Tuesday, September 17, 2002 10:22 AM To: Jitendra Soam; [EMAIL PROTECTED] Subject: RE: NET::Telnet The Prompt is a regular expression that matches the commandline prompt from the remote shell. That means you'll want to match the prompt for the user you are logging in as. If I log into one of my remote windows machines through a telnet server and I see I have a prompt like so, C:/ I'll need to match that within my code as prompt. If the prompt isn't matched in the time specified in Timeout then the script will either return false or die based on what Errmode is set to, return or die respectively. NET::Telnet Defaults: Timeout = 10 Host = localhost Errmode = die Prompt = /[\$%#]$/ # matches most unix shells. Port = 23 This is how you could establish a connection with a windows machine with NET::Telnet (Untested). use strict; my $TIMEOUT = 30; my $PROMPT = C:/; my $HOST = foobar.foo.com; my $USER = Bob; my $PASS = password; $telnet = Net::Telnet-new( Timeout = $TIMEOUT, Prompt = $PROMPT, Host= $HOST, Errmode = return); $telnet-login($USER, $PASS); # Test here for success if using return. my $msg = $telnet-errmsg(); if ($msg) { print $msg\n; $telnet-close; # do whatever you want here. } Hope this helps. Cheers, Carter. -Original Message- From: Jitendra Soam [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 7:39 AM To: [EMAIL PROTECTED] Subject: RE: NET::Telnet Thanks. But the what should be used as prompt? -Original Message- From: Thomas R Wyant_III [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 7:01 PM To: [EMAIL PROTECTED] Subject: Re: NET::Telnet Jitendra Soam [EMAIL PROTECTED] wrote: Is it possible to use Net::Telnet module to telnet into Windows machine running Microsoft Telnet Service.. In theory, yes, _provided_ the Telnet service is set up to do username/password authentication. This is not the default. In practice, there appear to be significant problems figuring out what you should tell it the prompt string is, because Microsoft embeds all sorts of escape sequences in it. and start Any program like Notepad on target machine? In theory, yes. In practice, of course, Notepad displays on the target machine's desktop, which probably does you as the owner of the telnet link no good at all. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as E-Contract Intended, this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portuges Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: NET::Telnet
Greetings, I too had alot of trouble getting Net::Telnet to work properly, it seemed to continuously stop for no apparent reason, with very poor performance. As well as not being able to make it non-block on win32. I had to eventually write a direct TCP client to get a proper level of performance..etc.. Just my .02, -Lenny -Original Message- From: Moulder, Glen [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 1:42 PM To: perl-win32-users Subject: FW: NET::Telnet Carter, what you're saying may work on Unix systems, but after 2 weeks of hair-pulling last year, I gave up trying to use Net::Telnet on legacy Univac and Dec systems. The module just couldn't handle the odd terminal emulation escape sequences that were being fed to it (especially on the Univac) and I was unable to reliably establish and maintain terminal sessions on those machines. Finally had to brute force ftp files up to those boxes without being able to do the file existence/status checking planned for in my original design. Net::Telnet users beware. Glen -Original Message- From: Carter Thompson [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 1:22 PM To: Jitendra Soam; [EMAIL PROTECTED] Subject: RE: NET::Telnet The Prompt is a regular expression that matches the commandline prompt from the remote shell. That means you'll want to match the prompt for the user you are logging in as. If I log into one of my remote windows machines through a telnet server and I see I have a prompt like so, C:/ I'll need to match that within my code as prompt. If the prompt isn't matched in the time specified in Timeout then the script will either return false or die based on what Errmode is set to, return or die respectively. NET::Telnet Defaults: Timeout = 10 Host = localhost Errmode = die Prompt = /[\$%#]$/ # matches most unix shells. Port = 23 This is how you could establish a connection with a windows machine with NET::Telnet (Untested). use strict; my $TIMEOUT = 30; my $PROMPT = C:/; my $HOST = foobar.foo.com; my $USER = Bob; my $PASS = password; $telnet = Net::Telnet-new( Timeout = $TIMEOUT, Prompt = $PROMPT, Host= $HOST, Errmode = return); $telnet-login($USER, $PASS); # Test here for success if using return. my $msg = $telnet-errmsg(); if ($msg) { print $msg\n; $telnet-close; # do whatever you want here. } Hope this helps. Cheers, Carter. -Original Message- From: Jitendra Soam [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 7:39 AM To: [EMAIL PROTECTED] Subject: RE: NET::Telnet Thanks. But the what should be used as prompt? -Original Message- From: Thomas R Wyant_III [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 7:01 PM To: [EMAIL PROTECTED] Subject: Re: NET::Telnet Jitendra Soam [EMAIL PROTECTED] wrote: Is it possible to use Net::Telnet module to telnet into Windows machine running Microsoft Telnet Service.. In theory, yes, _provided_ the Telnet service is set up to do username/password authentication. This is not the default. In practice, there appear to be significant problems figuring out what you should tell it the prompt string is, because Microsoft embeds all sorts of escape sequences in it. and start Any program like Notepad on target machine? In theory, yes. In practice, of course, Notepad displays on the target machine's desktop, which probably does you as the owner of the telnet link no good at all. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as E-Contract Intended, this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portuges Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list
FW: NET::Telnet
Mark, you'd probably win that bet. I just searched back through my notes of the time (what did I do before I got my PDA?) and can't find any mention of having changed the term type. I remember sending a couple of SOSes to the list and don't recall that being in any of the suggested solutions or comments. I'm curious now though, and will keep your response in my suspense list for a rainy day. Would be nice to be able to query those legacy systems instead of having to log in to 'em manually. Glen -Original Message- From: Thomas_M [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 1:49 PM To: 'Moulder, Glen' Subject: RE: NET::Telnet I'll bet you didn't try setting the term type to 'TTY'. - Mark. -Original Message- From: Moulder, Glen [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 1:42 PM To: perl-win32-users Subject: FW: NET::Telnet Carter, what you're saying may work on Unix systems, but after 2 weeks of hair-pulling last year, I gave up trying to use Net::Telnet on legacy Univac and Dec systems. The module just couldn't handle the odd terminal emulation escape sequences that were being fed to it (especially on the Univac) and I was unable to reliably establish and maintain terminal sessions on those machines. Finally had to brute force ftp files up to those boxes without being able to do the file existence/status checking planned for in my original design. Net::Telnet users beware. Glen -Original Message- From: Carter Thompson [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 1:22 PM To: Jitendra Soam; [EMAIL PROTECTED] Subject: RE: NET::Telnet The Prompt is a regular expression that matches the commandline prompt from the remote shell. That means you'll want to match the prompt for the user you are logging in as. If I log into one of my remote windows machines through a telnet server and I see I have a prompt like so, C:/ I'll need to match that within my code as prompt. If the prompt isn't matched in the time specified in Timeout then the script will either return false or die based on what Errmode is set to, return or die respectively. NET::Telnet Defaults: Timeout = 10 Host = localhost Errmode = die Prompt = /[\$%#]$/ # matches most unix shells. Port = 23 This is how you could establish a connection with a windows machine with NET::Telnet (Untested). use strict; my $TIMEOUT = 30; my $PROMPT = C:/; my $HOST = foobar.foo.com; my $USER = Bob; my $PASS = password; $telnet = Net::Telnet-new( Timeout = $TIMEOUT, Prompt = $PROMPT, Host= $HOST, Errmode = return); $telnet-login($USER, $PASS); # Test here for success if using return. my $msg = $telnet-errmsg(); if ($msg) { print $msg\n; $telnet-close; # do whatever you want here. } Hope this helps. Cheers, Carter. -Original Message- From: Jitendra Soam [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 7:39 AM To: [EMAIL PROTECTED] Subject: RE: NET::Telnet Thanks. But the what should be used as prompt? -Original Message- From: Thomas R Wyant_III [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 7:01 PM To: [EMAIL PROTECTED] Subject: Re: NET::Telnet Jitendra Soam [EMAIL PROTECTED] wrote: Is it possible to use Net::Telnet module to telnet into Windows machine running Microsoft Telnet Service.. In theory, yes, _provided_ the Telnet service is set up to do username/password authentication. This is not the default. In practice, there appear to be significant problems figuring out what you should tell it the prompt string is, because Microsoft embeds all sorts of escape sequences in it. and start Any program like Notepad on target machine? In theory, yes. In practice, of course, Notepad displays on the target machine's desktop, which probably does you as the owner of the telnet link no good at all. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as E-Contract Intended, this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties
RE: NET::Telnet
First, if you are telnetting from a non Windoze PC, you must turn off NTLM authentication on the host. This works on an NT box: use Net::Telnet; use strict; use warnings; my $telnet = new Net::Telnet ( Timeout=10, Errmode='die'); my @jim=; my $frank=; $telnet-open('192.168.174.108'); $telnet-waitfor('/Username: $/i'); $telnet-print('Administrator'); $telnet-waitfor('/Password: $/i'); $telnet-print('12345'); $telnet-waitfor('/\$/i'); $telnet-print('show users'); @jim=$telnet-waitfor('/\$/'); Its similar for W2K except that Username is login. -Original Message- From: Thomas R Wyant_III [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 18, 2002 12:20 AM To: [EMAIL PROTECTED] Subject: RE: NET::Telnet Jitranda, I gave up trying to figure out what to use as a prompt for Net::Telnet when connecting to Windows' telnet server. Maybe someone out there will enlighten us both. Tom Jitendra Soam [EMAIL PROTECTED]@listserv.ActiveState.com on 09/17/2002 10:38:52 AM Sent by:[EMAIL PROTECTED] To:[EMAIL PROTECTED] cc: Subject:RE: NET::Telnet Thanks. But the what should be used as prompt? -Original Message- From: Thomas R Wyant_III [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 7:01 PM To: [EMAIL PROTECTED] Subject: Re: NET::Telnet Jitendra Soam [EMAIL PROTECTED] wrote: Is it possible to use Net::Telnet module to telnet into Windows machine running Microsoft Telnet Service.. In theory, yes, _provided_ the Telnet service is set up to do username/password authentication. This is not the default. In practice, there appear to be significant problems figuring out what you should tell it the prompt string is, because Microsoft embeds all sorts of escape sequences in it. and start Any program like Notepad on target machine? In theory, yes. In practice, of course, Notepad displays on the target machine's desktop, which probably does you as the owner of the telnet link no good at all. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as E-Contract Intended, this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portuges Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as E-Contract Intended, this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portuges Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Net::Telnet and wxPerl
Hey everyone, I have a wxPerl app that is using Net::Telnet to connect to a UNIX host to run a script. As you can see from the example, the script is exectuted, and then I want to watch the output log get updated, but I want to pipe that into a Text area on the wxPerl app. I can't seem to figure out how to do it, and the code below times out, even though the script on the UNIX side is running. Any ideas? -Erich- === # Go to the script directory my $status = $obj-cmd(String = cd $script_dir, Timeout = 10); # Launch the backup script $status = $obj-cmd(String = $script -tape$length -$backup_type, Timeout =20); $status = $obj-cmd(String = cd $data_dir); # Capture the output of the tail command my @results = $obj-cmd(String = tail -f $log); # I want this this text area to contain the value of @results as the script runs, not when the script finishes. $this-{NOTEBOOK}-{TAPEPANEL}-{TEXT}-SetValue(@results); ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Printing to browser while waiting for Net Telnet to releasecontr ol
Hi I have a Perl script that runs as CGI and uses Net::Telnet to connect to a UNIX machine and execute a set of tasks. The system works except that the user has to wait for the some time for the browser to show up something (it waits till the control is returned from the Telnet process) . Part of the code is as below. Is there a better of way doing this so that user is not kept in suspense for the duration of the processing? Thanks Sundar # Code use strict; use Net::Telnet; use CGI; use CGI::Carp qw(fatalsToBrowser); my $query = new CGI; print $query-header; print $query-start_html(Clean Up Servers.); my $ServerOS = $query-param(OSType); my $ServerName = $query-param(ServerName); my $Username = ; my $Password = x; fCleanUpOldInstances($ServerName , $Username,$Password); print $query-end_html; sub fCleanUpOldInstances { my ($Host,$User,$Password) = @_ ; my $SiebProcFlag = 0; my $GtwyProcFlag = 0; my $SourceCmd = source \/export\/home\/siebel\/siebsrvr\/siebenv.csh; my $GtwySourceCmd = source \/export\/home\/siebel\/gtwysrvr\/siebenv.csh; # Create a new object my $telnet = new Net::Telnet ( timeout=240,Errmode='die',Prompt='/[\$%#] $/'); # Open connections and log in $telnet-open($Host); #debug print done\n; $telnet-login($User, $Password); # Check if the Siebel processes are running my @lines = $telnet-cmd(ps -ef | grep sieb); print The outpuit of ps -ef | grep sieb is @lines\nbr; foreach (@lines) { if (m/siebsvc -s siebsrvr/i) { print Siebel Process - $_br\n ; $SiebProcFlag = 1; } if (m/siebsvc -s gtwyns/i) { print bGateway Process - $_br\n ; $GtwyProcFlag = 1; } } # Delete directories $telnet-cmd(unalias rm); foreach(@DirToDelete) { DeleteDir($_,$telnet); } @lines = $telnet-cmd(ps -ef | grep sieb); print b@lines\n/bbr; $telnet-close($Host); } ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Help with Net::Telnet
On Mon, 17 Jun 2002, Erich C. Beyrent wrote: Hi everyone, I need some assistance with a Net::Telnet project. I am trying to telnet from my Win2k box to a Solaris 2.8 host to run an application. I can telnet as root into the Solaris box via the command console, but when I try to do it through my Perl code, I get an invalid username or password (I have not included the password in the below code...). I can telnet as another user, but I need to be root to run this application. Besides not using Strict and running with the -w flag, can anyone see anything obvious with the below code? Thanks in advance for your help! Some systems are set up to not allow login to root. If you've tried with another userID and it works, my WAG would be that the remote system you are logging into does not permit root log-ins. Have you tried logging in to a non-root account and then doing a su command to become root? Another, certainly less desirable solution, is to modify the settings on the remote system to allow root log-in. However I doubt that disallowing root log-ins to the remote system is something that was not intended. [EMAIL PROTECTED] Carl Jolley All opinions are my own and not necessarily those of my employer ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Help with Net::Telnet
Hi everyone, I need some assistance with a Net::Telnet project. I am trying to telnet from my Win2k box to a Solaris 2.8 host to run an application. I can telnet as root into the Solaris box via the command console, but when I try to do it through my Perl code, I get an invalid username or password (I have not included the password in the below code...). I can telnet as another user, but I need to be root to run this application. Besides not using Strict and running with the -w flag, can anyone see anything obvious with the below code? Thanks in advance for your help! Erich C. BeyrentCKP Newspaper Systems, Inc. === #!/usr/bin/perl use Net::Telnet; $obj = new Net::Telnet (Input_log = "input.log", Output_log = "output.log", Dump_log ="dmp.log", Timeout = 10, Prompt = "/\#/" ); $obj-open("192.168.100.78"); $obj-login(Name='root', Password=$password );$ok = $obj-cmd(String = "pwd", Timeout = 10); exit;
RE: pattern match timeout error using Net::Telnet
You don't need to waitfor() the prompt. Just use cmd() and Net::Telnet will automatically stop reading at the prompt. The prompt will not be included in the return value of cmd(). This, of course, assumes you've specified the prompt correctly. If this is your problem, you can use the nice debugging features to help you track this down. -- Mark Thomas [EMAIL PROTECTED] for($r=-1;$r!=38;$c++){print\n, x(38-$r+++($c=0))if($c$r);print~$r$c? `: #;} -Original Message- From: Allegakoen, Justin Devanandan [mailto:[EMAIL PROTECTED]] Sent: Friday, April 12, 2002 6:06 AM To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED] Subject: pattern match timeout error using Net::Telnet Hello all, I'm using the Net::Telnet module on a SunOS based system to run a program that resides on a Windoze 2k server. By use of the log, I have determined that connection, and login are fine. But I keep getting a pattern match timed-out error. According to the Help, it relates this to matching the prompt and it states: If the pattern chosen doesn't match what's sent, then it's likely those commands will timeout. On a manual telnet session the command prompt is:- C:\ In my program I set my prompt as :- $obj-prompt('/C\:\\\$/'); I follow that by :- $obj-waitfor('/C\:\\\$/'); And there's where it times out. Funnily enough if I remove the anchoring $ in the search pattern the rest of the program will work, and the log will even have the return of the command executed, but output from the command won't go into the array I put it in (I get a 0 element array instead). Obviously $obj-prompt needs a search pattern that works for the rest of the program to. Question is what is the search pattern I need? Oh, and using quot in Net::FTP doesnt work either. Just in ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Help for Net::Telnet
The solution is right in the docs... look up max_buffer_length(). That will solve your problem. /Chad -Original Message-From: Bryan Bateman [mailto:[EMAIL PROTECTED]]Sent: Thursday, November 29, 2001 1:19 PMTo: Bryan Bateman; [EMAIL PROTECTED]Subject: Re: Help for Net::Telnet I will post here then. @lines = $t-cmd("cat /usr/unifi/log/pipe_log/*"); This statement creates a buffer overrun when cat'ed files are over 1 meg in size. Any ideas??? - Original Message - From: Bryan Bateman To: [EMAIL PROTECTED] Sent: Thursday, November 29, 2001 11:46 AM Subject: Help for Net::Telnet Having some problems specific to Net::Telnet. Anyone know of a listserv that is appropriate for help???
RE: Help for Net::Telnet
Put it right after you open the telnet object... /Chad -Original Message-From: Bryan Bateman [mailto:[EMAIL PROTECTED]]Sent: Thursday, November 29, 2001 1:40 PMTo: Chad TowerCc: [EMAIL PROTECTED]Subject: Re: Help for Net::Telnet When and where do I apply it in the code??? No code example. - Original Message - From: Chad Tower To: 'Bryan Bateman' Cc: '[EMAIL PROTECTED]' Sent: Thursday, November 29, 2001 1:22 PM Subject: RE: Help for Net::Telnet The solution is right in the docs... look up max_buffer_length(). That will solve your problem. /Chad -Original Message-From: Bryan Bateman [mailto:[EMAIL PROTECTED]]Sent: Thursday, November 29, 2001 1:19 PMTo: Bryan Bateman; [EMAIL PROTECTED]Subject: Re: Help for Net::Telnet I will post here then. @lines = $t-cmd("cat /usr/unifi/log/pipe_log/*"); This statement creates a buffer overrun when cat'ed files are over 1 meg in size. Any ideas??? - Original Message - From: Bryan Bateman To: [EMAIL PROTECTED] Sent: Thursday, November 29, 2001 11:46 AM Subject: Help for Net::Telnet Having some problems specific to Net::Telnet. Anyone know of a listserv that is appropriate for help???
Re: Help for Net::Telnet
Still getting buffer overflow. What is this newbie doing wrong?? my $len = 3001000; . . . . $t = new Net::Telnet (Timeout = 200, Prompt = '/root\@hsvaps1/');$len = $t-max_buffer_length;$t-open("hsvaps1");$t-login($username, $passwd);# roll copy of log file on mail server if (-e "$log"){rename $log, $logBackup;} # Get Pipe Logs from Phone Server #@lines = $t-cmd("cat /usr/unifi/log/pipe_log/*");@lines = $t-cmd("cat /usr/unifi/oldlogs/log.0/pipe_log/*"); open(LOGS, "$log");print LOGS "@lines";close(LOGS); . . . . . . . - Original Message - From: Chad Tower To: 'Bryan Bateman' Cc: [EMAIL PROTECTED] Sent: Thursday, November 29, 2001 1:40 PM Subject: RE: Help for Net::Telnet Put it right after you open the telnet object... /Chad -Original Message-From: Bryan Bateman [mailto:[EMAIL PROTECTED]]Sent: Thursday, November 29, 2001 1:40 PMTo: Chad TowerCc: [EMAIL PROTECTED]Subject: Re: Help for Net::Telnet When and where do I apply it in the code??? No code example. - Original Message - From: Chad Tower To: 'Bryan Bateman' Cc: '[EMAIL PROTECTED]' Sent: Thursday, November 29, 2001 1:22 PM Subject: RE: Help for Net::Telnet The solution is right in the docs... look up max_buffer_length(). That will solve your problem. /Chad -Original Message-From: Bryan Bateman [mailto:[EMAIL PROTECTED]]Sent: Thursday, November 29, 2001 1:19 PMTo: Bryan Bateman; [EMAIL PROTECTED]Subject: Re: Help for Net::Telnet I will post here then. @lines = $t-cmd("cat /usr/unifi/log/pipe_log/*"); This statement creates a buffer overrun when cat'ed files are over 1 meg in size. Any ideas??? - Original Message - From: Bryan Bateman To: [EMAIL PROTECTED] Sent: Thursday, November 29, 2001 11:46 AM Subject: Help for Net::Telnet Having some problems specific to Net::Telnet. Anyone know of a listserv that is appropriate for help???
RE: Help for Net::Telnet
You can't just call the sub.. you have to give it a value or you haven't changed anything. Did you read the explanation in the docset? Try this line instead: $temp = $t-max_buffer_length(4194304); #$temp is a throwaway local var for storing the results of this operation. /Chad -Original Message-From: Bryan Bateman [mailto:[EMAIL PROTECTED]]Sent: Thursday, November 29, 2001 2:56 PMTo: Chad TowerCc: [EMAIL PROTECTED]Subject: Re: Help for Net::Telnet Still getting buffer overflow. What is this newbie doing wrong?? my $len = 3001000; . . . . $t = new Net::Telnet (Timeout = 200, Prompt = '/root\@hsvaps1/');$len = $t-max_buffer_length;$t-open("hsvaps1");$t-login($username, $passwd);# roll copy of log file on mail server if (-e "$log"){rename $log, $logBackup;} # Get Pipe Logs from Phone Server #@lines = $t-cmd("cat /usr/unifi/log/pipe_log/*");@lines = $t-cmd("cat /usr/unifi/oldlogs/log.0/pipe_log/*"); open(LOGS, "$log");print LOGS "@lines";close(LOGS); . . . . . . . - Original Message - From: Chad Tower To: 'Bryan Bateman' Cc: [EMAIL PROTECTED] Sent: Thursday, November 29, 2001 1:40 PM Subject: RE: Help for Net::Telnet Put it right after you open the telnet object... /Chad -Original Message-From: Bryan Bateman [mailto:[EMAIL PROTECTED]]Sent: Thursday, November 29, 2001 1:40 PMTo: Chad TowerCc: [EMAIL PROTECTED]Subject: Re: Help for Net::Telnet When and where do I apply it in the code??? No code example. - Original Message - From: Chad Tower To: 'Bryan Bateman' Cc: '[EMAIL PROTECTED]' Sent: Thursday, November 29, 2001 1:22 PM Subject: RE: Help for Net::Telnet The solution is right in the docs... look up max_buffer_length(). That will solve your problem. /Chad -Original Message-From: Bryan Bateman [mailto:[EMAIL PROTECTED]]Sent: Thursday, November 29, 2001 1:19 PMTo: Bryan Bateman; [EMAIL PROTECTED]Subject: Re: Help for Net::Telnet I will post here then. @lines = $t-cmd("cat /usr/unifi/log/pipe_log/*"); This statement creates a buffer overrun when cat'ed files are over 1 meg in size. Any ideas??? - Original Message - From: Bryan Bateman To: [EMAIL PROTECTED] Sent: Thursday, November 29, 2001 11:46 AM Subject: Help for Net::Telnet Having some problems specific to Net::Telnet. Anyone know of a listserv that is appropriate for help???
RE: Help for Net::Telnet
:: Still getting buffer overflow. What is this newbie doing wrong?? 1) Your emails come with a dirt-brown color, instead of plain text. There are quite a few otherwise very generous and helpful people on this list who just plain refuse to answer letters that come with HTML formatting. For better or worse, that's how it is. 2) You use WAY too many question marks. The Recommended Sentence Allowance is one. 3) I've never used Net::Telnet before, but I can make some guesses from all this conversation you've been having... You assign a great big value to $len, then you turn around and do this: $len = $t-max_buffer_length; When you do that, you're trying to assign a new value to $len. You need to do it the other way around, assigning a new value to the max buffer length. I can only assume such a thing is possible, and that that's what others were suggesting all along. I have no idea of the proper syntax, but it's probably something like: $t-max_buffer_length = $len; Though -max_buffer_length may be a method, rather than an object in which case you'd use it like calling a function: $t-max_buffer_length(send_stuff_in_here); You'd have to read the docs to see what the proper usage is, I can only tell from here that what you were doing isn't right. - Aaron -- Aaron Brown - [EMAIL PROTECTED] Middleware Programmer University of Kansas 785-864-0423 http://www.ku.edu/~aaronb/ ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: Help with executing a command on remote machine using Net::Telnet
As specified in the Net::Telnet docs, your prompt should be a match string. Try something like:- prompt ='/c:.*?/' #untested on a full session but does not throw an error when called as below Andy - Original Message - From: Satish Vadlamani [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, July 01, 2001 4:52 AM Subject: Help with executing a command on remote machine using Net::Telnet Hi: I am having trouble sending a command to the remote machine (both machines win2000). I don't want any interaction. I just want to send a command to be executed on the remote machine. I am getting the following error: bad match operator: opening delimiter missing: c:.*\\ at C:\MATRIX~1\DF\controls\scripts\RUN_PR~3.PL line 17 Here is the relevant part of my program. Thanks a lot if you can be of help. use Cwd; use File::Basename; use Env; use Cwd; use File::Copy ; use File::Path ; use strict; use Data::Dumper; use Time::Local; use Win32; use Date::Calc; use Net::Telnet; $\ = \n; my $t; $t = Net::Telnet-new (Timeout = 10, Host = 'MatrixDev', Prompt = 'c:.*\\\' ); my $user_name = administrator; my $password = ; $t-login($user_name,$password); #my $change_dir = $t-cmd(cd c:/MatrixDev/DF/controls/scripts); #my $result = $-cmd(run_prod_secondary_aa.pl); _ Get your FREE download of MSN Explorer at http://explorer.msn.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: Help with executing a command on remote machine using Net::Telnet
Hi Andy: I am not able to run the program. Actually, in order to eliminate variables, the host I am telnetting to is the local machine. The program is running but no results. I included the relevant part of the program here. Thanks in advance. Satish use Cwd; use File::Basename; use Env; use Cwd; use File::Copy ; use File::Path ; use strict; use Data::Dumper; use Time::Local; use Win32; use Date::Calc; use Net::Telnet; $\ = \n; my $t; #$t = Net::Telnet-new (Timeout = 10,Host = 'MatrixProd',Prompt = '/c:.*/i'); $t = Net::Telnet-new (Timeout = 10,Prompt = '/c:.*?/i'); $t-open(MatrixProd); my $user_name = administrator; my $password = ; $t-login($user_name,$password); my $fh = $t-input_log; $fh = $t-input_log($fh); my $change_dir = $t-cmd(cd c:\\MatrixProd\\DF\\controls\\scripts); $t-cmd(c:\\MatrixProd\\DF\\controls\\scripts\\run_primary_aa.pl); my $ok = $t-print(c:\\MatrixProd\\DF\\controls\\scripts\\run_primary_aa.pl); exit; From: Andy Jennings [EMAIL PROTECTED] Reply-To: Andy Jennings [EMAIL PROTECTED] To: Satish Vadlamani [EMAIL PROTECTED], Perl Win32 [EMAIL PROTECTED] Subject: Re: Help with executing a command on remote machine using Net::Telnet Date: Sun, 1 Jul 2001 04:54:52 -0500 As specified in the Net::Telnet docs, your prompt should be a match string. Try something like:- prompt ='/c:.*?/' #untested on a full session but does not throw an error when called as below Andy - Original Message - From: Satish Vadlamani [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, July 01, 2001 4:52 AM Subject: Help with executing a command on remote machine using Net::Telnet Hi: I am having trouble sending a command to the remote machine (both machines win2000). I don't want any interaction. I just want to send a command to be executed on the remote machine. I am getting the following error: bad match operator: opening delimiter missing: c:.*\\ at C:\MATRIX~1\DF\controls\scripts\RUN_PR~3.PL line 17 Here is the relevant part of my program. Thanks a lot if you can be of help. use Cwd; use File::Basename; use Env; use Cwd; use File::Copy ; use File::Path ; use strict; use Data::Dumper; use Time::Local; use Win32; use Date::Calc; use Net::Telnet; $\ = \n; my $t; $t = Net::Telnet-new (Timeout = 10, Host = 'MatrixDev', Prompt = 'c:.*\\\' ); my $user_name = administrator; my $password = ; $t-login($user_name,$password); #my $change_dir = $t-cmd(cd c:/MatrixDev/DF/controls/scripts); #my $result = $-cmd(run_prod_secondary_aa.pl); _ Get your FREE download of MSN Explorer at http://explorer.msn.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users _ Get your FREE download of MSN Explorer at http://explorer.msn.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: Help with executing a command on remote machine using Net::Telnet
A small correction- I am able to run it but not desired results. thanks. Satish From: Satish Vadlamani [EMAIL PROTECTED] To: [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: Help with executing a command on remote machine using Net::Telnet Date: Sun, 01 Jul 2001 14:35:28 Hi Andy: I am not able to run the program. Actually, in order to eliminate variables, the host I am telnetting to is the local machine. The program is running but no results. I included the relevant part of the program here. Thanks in advance. Satish use Cwd; use File::Basename; use Env; use Cwd; use File::Copy ; use File::Path ; use strict; use Data::Dumper; use Time::Local; use Win32; use Date::Calc; use Net::Telnet; $\ = \n; my $t; #$t = Net::Telnet-new (Timeout = 10,Host = 'MatrixProd',Prompt = '/c:.*/i'); $t = Net::Telnet-new (Timeout = 10,Prompt = '/c:.*?/i'); $t-open(MatrixProd); my $user_name = administrator; my $password = ; $t-login($user_name,$password); my $fh = $t-input_log; $fh = $t-input_log($fh); my $change_dir = $t-cmd(cd c:\\MatrixProd\\DF\\controls\\scripts); $t-cmd(c:\\MatrixProd\\DF\\controls\\scripts\\run_primary_aa.pl); my $ok = $t-print(c:\\MatrixProd\\DF\\controls\\scripts\\run_primary_aa.pl); exit; From: Andy Jennings [EMAIL PROTECTED] Reply-To: Andy Jennings [EMAIL PROTECTED] To: Satish Vadlamani [EMAIL PROTECTED], Perl Win32 [EMAIL PROTECTED] Subject: Re: Help with executing a command on remote machine using Net::Telnet Date: Sun, 1 Jul 2001 04:54:52 -0500 As specified in the Net::Telnet docs, your prompt should be a match string. Try something like:- prompt ='/c:.*?/' #untested on a full session but does not throw an error when called as below Andy - Original Message - From: Satish Vadlamani [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, July 01, 2001 4:52 AM Subject: Help with executing a command on remote machine using Net::Telnet Hi: I am having trouble sending a command to the remote machine (both machines win2000). I don't want any interaction. I just want to send a command to be executed on the remote machine. I am getting the following error: bad match operator: opening delimiter missing: c:.*\\ at C:\MATRIX~1\DF\controls\scripts\RUN_PR~3.PL line 17 Here is the relevant part of my program. Thanks a lot if you can be of help. use Cwd; use File::Basename; use Env; use Cwd; use File::Copy ; use File::Path ; use strict; use Data::Dumper; use Time::Local; use Win32; use Date::Calc; use Net::Telnet; $\ = \n; my $t; $t = Net::Telnet-new (Timeout = 10, Host = 'MatrixDev', Prompt = 'c:.*\\\' ); my $user_name = administrator; my $password = ; $t-login($user_name,$password); #my $change_dir = $t-cmd(cd c:/MatrixDev/DF/controls/scripts); #my $result = $-cmd(run_prod_secondary_aa.pl); _ Get your FREE download of MSN Explorer at http://explorer.msn.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users _ Get your FREE download of MSN Explorer at http://explorer.msn.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users _ Get your FREE download of MSN Explorer at http://explorer.msn.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Help with executing a command on remote machine using Net::Telnet
Hi: I am having trouble sending a command to the remote machine (both machines win2000). I don't want any interaction. I just want to send a command to be executed on the remote machine. I am getting the following error: bad match operator: opening delimiter missing: c:.*\\ at C:\MATRIX~1\DF\controls\scripts\RUN_PR~3.PL line 17 Here is the relevant part of my program. Thanks a lot if you can be of help. use Cwd; use File::Basename; use Env; use Cwd; use File::Copy ; use File::Path ; use strict; use Data::Dumper; use Time::Local; use Win32; use Date::Calc; use Net::Telnet; $\ = \n; my $t; $t = Net::Telnet-new (Timeout = 10, Host = 'MatrixDev', Prompt = 'c:.*\\\' ); my $user_name = administrator; my $password = ; $t-login($user_name,$password); #my $change_dir = $t-cmd(cd c:/MatrixDev/DF/controls/scripts); #my $result = $-cmd(run_prod_secondary_aa.pl); _ Get your FREE download of MSN Explorer at http://explorer.msn.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
net::telnet, fork, waitpid
No matter what I do, I cannot get the non blocking waitfor to not block. NT4p6 perl 5.6.0 bld 623. Does it work in NT. (Parent has a telnet session open and is monitoring the applictions communications with the telnet server. When the application is done, waitpid unblocks and net::telent's getline empties the buffer. If I can't get this to unblock, I wonder how big is the buffer? Will I loose anything?) Signed fork rookie. Signed net:: rookie. Thanks. use Net::Telnet (); use POSIX :sys_wait_h; # Here the call in the parent's sub monitor(). waitpid($pid, WNOHANG); #And fork is right out of the book. FORK: { if ($pid = fork) { sleep(2); $rtn = monitor($pid); } elsif(defined $pid) { system($program); $childProcessSystemReturn = $?; exit $childProcessSystemReturn; } elsif ($! == EAGAIN) { redo FORK; } else { # can't recover die Can't fork: $!\n; } } # end FORK: Get free email and a permanent address at http://www.netaddress.com/?N=1 ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
net::telnet
I've had success with the Net::Telnet module. But I can't get the SUcommand to work. It times out waiting for a password.Any ideas?Thanks!John---CODE#! perl remote loginuse Net::Telnet ();$telnet = new Net::Telnet (Timeout = 5);$telnet-open("192.134.1.23");$telnet-login($user, $pw);$telnet-cmd("su");#it never seems to get to this point$telnet-waitfor('/Password: /');$telnet-print("the password");
Re: net::telnet
I have no familiarity with the Net::Telnet module, but I believe the SU syntax is actually 'SU -' to open a shell that you can log into. TW On Wed, 11 Apr 2001, John Williams wrote: I've had success with the Net::Telnet module. But I can't get the SU command to work. It times out waiting for a password. Any ideas? Thanks! John ---CODE #! perl remote login use Net::Telnet (); $telnet = new Net::Telnet (Timeout = 5); $telnet-open("192.134.1.23"); $telnet-login($user, $pw); $telnet-cmd("su"); #it never seems to get to this point $telnet-waitfor('/Password: /'); $telnet-print("the password"); ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: net::telnet
$telnet-cmd("su"); su should require a password so normal users cannot arbitrarly becomeroot.
net::telnet
My mistake... the line $telnet-cmd("su");should have been$telnet-print("su"); when I changed it, the waitfor command waited for the "Password:" prompt. works fine now... I'm just kinda new to this and was following an example.. Thanks! John