Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Making a shell work like a Net::Telnet session

by belden (Friar)
on Feb 10, 2011 at 15:29 UTC ( [id://887474]=note: print w/replies, xml ) Need Help??


in reply to Making a shell work like a Net::Telnet session

I must be missing something here. It sounds like you used to have:
script-on-box --telnet--> hardware.
And now the hardware doesn't accept telnet connections, and you've got your script-on-box that doesn't know how to do ssh. So you want to do:
script-on-box --telnet--> another box --ssh--> hardware
Net::Telnet will allow you to connect to an ssh session, so you could just spawn an ssh connection to the piece of hardware, then attach that ssh connection to your Net::Telnet object. (Search for 'spawn' in the Net::Telnet perldoc for an example of this.) Your script would continue to behave as it has in the past, interacting with a Net::Telnet object that just happens to be speaking ssh.

But I assume you already know this, so what am I missing?

Replies are listed 'Best First'.
Re^2: Making a shell work like a Net::Telnet session
by salva (Canon) on Feb 10, 2011 at 16:00 UTC
    Have you actually tried the spawn sample on a Windows box? I am almost sure it will not work.

    IO::Pty does not compile there, you could just use IPC::Open2 but Net::Telnet uses select to poll the connection and on Windows select does not work with pipes.

    Later versions of perl have a socketpair emulation that uses TCP internally (it goes through localhost) but the last time I tried it with OpenSSH, it didn't like having its stdio attached to a TCP socket.

      Aha! Okay - I missed that this was on a Windows box. Thanks for the clarification.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://887474]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2024-04-18 10:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found