Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Best Method to Execute a Telnet Session in a Perl Application?

by gridlock (Novice)
on Mar 26, 2004 at 17:02 UTC ( #340076=perlquestion: print w/replies, xml ) Need Help??
gridlock has asked for the wisdom of the Perl Monks concerning the following question:

Off late, I've had to write a lot of applications that require me to use Telnet sessions into different network elements, usually through different gateway access points. I've used the Net::Telnet module from CPAN which works really well for directly Telnetting into devices. However, there have been a lot of times where I've run into buffering issues especially when hopping through gateways which change terminal types. Unfortunately - I've found no dynamic way to change terminal types with them and stay in sync and have ended up having to write filters for any data retrieved back on more than one occassion....

From your expereinces, what other methods other than Net::Telnet are around to establish Telnet sessions from within a Perl application?

Suggestions are appreciated! Thanks in advance!

/Gridlock a.k.a. Debashis "Codito Ergo Sum"
  • Comment on Best Method to Execute a Telnet Session in a Perl Application?

Replies are listed 'Best First'.
Re: Best Method to Execute a Telnet Session in a Perl Application?
by flyingmoose (Priest) on Mar 26, 2004 at 17:21 UTC
    My apologies if you already know this (I'm saying this mostly for community benefit), but telnet is a horribly unsecure plaintext protocol. Everything you do (including sending passwords) is publically visible and interceptable. Not to dodge your question, but is it possible to use Net::SSH or Net::SSH::Perl against sshd instead? It is easier to use, much safer, and more spiffy.

    I understand there are embedded devices that only support telnet, but in general I would be extremely paranoid about firewall rules and limitating access to them in those cases. A few times the word 'telnet' is overhead within my organization, and I am usually yelling over the cube walls "NOOOOOOOOOOO!!!!!" within 3 seconds. It makes me very popular with the locals :)

      Is it possible to use? Absolutely - - - - I've actually never tried using either of these two modules - - - thanks for pointing them out!
      /Gridlock a.k.a. Debashis "Codito Ergo Sum"
Re: Best Method to Execute a Telnet Session in a Perl Application?
by TilRMan (Friar) on Mar 26, 2004 at 17:50 UTC

    You could try using the Expect module to drive a telnet executable. (I've never used them together.) Or you could see how far you can get with a plain IO::Socket::INET. (Guilty!)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://340076]
Approved by talexb
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2018-06-19 20:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (114 votes). Check out past polls.

    Notices?