First message here, after spending some days reading other posts related. I have a comment... this page is huge! HUGE! congratulations!
I have bought a device which I want to control remotely. The only way to do this is establishing an SSH-2 connection as a client with the device (that has an SSH-2 server implemented on it). If I do this from Linux with the ssh command, a shell is displayed where I can type commands and read the answer. I would like to use Perl to automatize its control.
This device answers to the commands first with an acknowledgment: for example, an empty line and "ok,00" is the right one. After that, it adds in some cases an status message giving some information to control it. Sometimes these information messages are sent asynchronously (without sending any command), keeping the same format. Here is an example (in this case the first command is written by me and the second "empty command" is written automatically by the device to report the status).
$ control sleep ok,00 $ ok,00 SS,true
My problem is the following: when I use the corresponding package in Perl (I've tried with Net::SSH::Perl, Net::SSH2 and Net::OpenSSH) to establish the connection and send the commands, everything works fine except for one thing; the output retrieved (found either with the command output or with a handler) only contains the acknowledgment, ignoring the status message. It happens the same for the 3 packages mentioned.
After doing many tests, I think that maybe is a problem of the format in which this status message is sent. But it's really strange that it's perfectly shown when using a shell and it disappears when using any of the mentioned packages. Probably the SSH-clients used in these packages close the channel once the ACK is received.
Here I paste the log of a SSH2-client (putty) for a command, starting with the prompt ($) and ending with the answer and the status message:
Incoming packet type 94 / 0x5e (SSH2_MSG_CHANNEL_DATA) 00000000 00 00 01 00 00 00 00 02 24 20 ........$ Outgoing packet type 94 / 0x5e (SSH2_MSG_CHANNEL_DATA) 00000000 00 00 00 00 00 00 00 01 63 ........c Incoming packet type 94 / 0x5e (SSH2_MSG_CHANNEL_DATA) 00000000 00 00 01 00 00 00 00 01 63 ........c Outgoing packet type 94 / 0x5e (SSH2_MSG_CHANNEL_DATA) 00000000 00 00 00 00 00 00 00 01 6f ........o Incoming packet type 94 / 0x5e (SSH2_MSG_CHANNEL_DATA) 00000000 00 00 01 00 00 00 00 01 6f ........o . . . ------------------ (Here continues the command) ---------------------- ------------------ (until it finishes) ---------------------- . . . Outgoing packet type 94 / 0x5e (SSH2_MSG_CHANNEL_DATA) 00000000 00 00 00 00 00 00 00 01 0d ......... Incoming packet type 94 / 0x5e (SSH2_MSG_CHANNEL_DATA) 00000000 00 00 01 00 00 00 00 02 0d 0a .......... Incoming packet type 94 / 0x5e (SSH2_MSG_CHANNEL_DATA) 00000000 00 00 01 00 00 00 00 02 0d 0a .......... Incoming packet type 94 / 0x5e (SSH2_MSG_CHANNEL_DATA) 00000000 00 00 01 00 00 00 00 45 6f 6b 2c 30 30 0d 0a 43 .......Eok, +00..C 00000010 53 2c 31 31 2c 31 2c 44 69 61 6c 69 6e 67 2c 41 S,11,1,Dial +ing,A 00000020 75 64 69 6f 2c 4e 6f 72 6d 61 6c 2c 31 34 39 2e udio,Normal +,149.
If someone has managed to read this boring problem up to this point, I am already thankful! But any help would be a great one! How can I get the status message? Thanks in advance :)
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |