SSH login from nodejs/python

Dear Team,

Please help me in using API from node or python scripts. I’m using Win Beta 15.
First, I tried to use nodejs with SSH2 library. It works well with my other SSH servers, but when I use it for connection to ZRCSAPI I get error at command execution.
The second issue - after error ZAAPI.exe takes about 27% CPU for a while, and I can’t connect with Putty/other terminals.
Script example:
var Client = require(‘ssh2’).Client;

var conn = new Client();
conn.on('ready', function() {
  console.log('Client :: ready');
  conn.exec('zCommand Dial StartPmi Duration: 30', function(err, stream) {
    if (err){
      throw err;
    }
    stream.on('close', function(code, signal) {
      console.log('Stream :: close :: code: ' + code + ', signal: ' + signal);
      conn.end();
    }).on('data', function(data) {
      console.log('STDOUT: ' + data);
    }).stderr.on('data', function(data) {
      console.log('STDERR: ' + data);
    });
  });
}).connect({
  host: '127.0.0.1',
  port: 2244,
  username: 'zoom',
  password: 'P@ssword'
});

Error:

index.js:9
throw err;
^

Error: Unable to exec
at c:\tssh\node_modules\ssh2\lib\client.js:1387:19
at SSH2Stream. (c:\tssh\node_modules\ssh2\lib\Channel.js:206:24)
at emitNone (events.js:106:13)
at SSH2Stream.emit (events.js:208:7)
at parsePacket (c:\tssh\node_modules\ssh2-streams\lib\ssh.js:3360:10)
at SSH2Stream._transform (c:\tssh\node_modules\ssh2-streams\lib\ssh.js:694:13)
at SSH2Stream.Transform._read (_stream_transform.js:186:10)
at SSH2Stream._read (c:\tssh\node_modules\ssh2-streams\lib\ssh.js:252:15)
at SSH2Stream.Transform._write (_stream_transform.js:174:12)
at doWrite (_stream_writable.js:396:12)

What I should setup in headers/TTY params/etc to make it works?

In python with paramiko it raised with wait_for_event error.

Actually, I need a working example in Python or NodeJS how to login to ZRCSAPI, exec commands and receive replies/event info.
If anyone have an example, please share it here.

We have not tested a Node.js or Python connection; However, I recommend not using the exec command function; instead, it’s likely that you need to use the shell() function to send plain text, ending in a newline. the SSH API does not support the remote exec operation; only plain text.

-Scott

Thank you Scott,

shell() function works great!

Actually, it works only with \r newline endings, not \n:
stream.write('zCommand Dial StartPmi Duration: 30\r');

Yeah, after several hours testing, finally I get kinda stable working raw TCP to ZRCSAPI proxy in Python.

First, a ZoomRoom’s developer, instead of implementing built-in server with HTTP or JSON or something else API , reinventing the wheel and make stand-alone process ZAAPI.

Now I spent several hours reinventing the wheel again and made another stand-alone process TSSH, which converts raw TCP data from control system to SSH ZAAPI and back, because the other developer of control system was lazy and didnt want to include SSH to list of native communicative ways.

As a result, user will be unhappy of periodically restart the ZoomRoom PC with all that stand-alone wheels because of future unpredictable issues. I love it.