FW: NET::Telnet

2002-09-17 Thread Moulder, Glen


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



FW: NET::Telnet

2002-09-17 Thread Moulder, Glen


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