Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Correct way to use Net:SSH2 module

by runrig (Abbot)
on Mar 18, 2013 at 22:32 UTC ( #1024171=note: print w/ replies, xml ) Need Help??


in reply to Correct way to use Net:SSH2 module

When I had that issue, I wrote an wrapper for executing commands that always followed the command with echo'ing "COMMAND_IS_DONE" or somesuch. Then keep reading until you see your marker.

Update: wow...no "echo"?? It's often a shell builtin. My condolences. But I think you could satisfactorily uniquify a "COMMAND_IS_DONE" string by adding a pid or other random digits/characters...


Comment on Re: Correct way to use Net:SSH2 module
Re^2: Correct way to use Net:SSH2 module
by MikeKulls2 (Novice) on Mar 18, 2013 at 23:26 UTC
    That is what we are doing but it is something I want to eliminate as it has the obvious fault if the command returns COMMAND_IS_DONE for any reason. We are also connecting to a lot of routers that have their own command set which doesn't include echo.
Re^2: Correct way to use Net:SSH2 module
by MikeKulls2 (Novice) on Mar 19, 2013 at 01:04 UTC
    You need to remember that connecting to a shell is only one option with SSH and we might not even be connecting to linux/unix. We are dealing with big network boxes that implement their own environment that is not shell and absolutely zero shell commands works (even if these boxes do have shell it is likely a massive deal getting access to it). Sometimes the boxes talk XML. Other times we avoid shell and communicate directly with our own perl script on the remote server. This works really well because we can give a remote dept access to talk to our script only and we can really control what they can do then. It beats giving them shell access and hoping that we locked everything down correctly. Come to think of it I pretty much never connect to a shell, certainly I would exhaust every other option first. Using shell is generally going to result in code that breaks with different OSes. With regards the uniqueness I think you are correct, it would be possible to get something unique. However, again it is something I would use as a last resort as it is still a hole in the software that could possibly be a security risk.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (1)
As of 2014-11-26 04:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (162 votes), past polls