ssh2shell 1.9.6 → 1.9.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/ssh2shell.js CHANGED
@@ -583,7 +583,7 @@
583
583
  } else {
584
584
  this.hosts = [hosts];
585
585
  }
586
- this.ssh2Client = require('ssh2');
586
+ this.ssh2Client = require('ssh2').Client;
587
587
  this.on("newPrimmaryHost", this._nextPrimaryHost);
588
588
  this.on("data", (function(_this) {
589
589
  return function(data) {
@@ -927,34 +927,16 @@
927
927
  })(this));
928
928
  if (this.sshObj.server && this.sshObj.commands) {
929
929
  try {
930
- this.connection.connect({
931
- host: this.sshObj.server.host,
932
- port: this.sshObj.server.port,
933
- forceIPv4: this.sshObj.server.forceIPv4,
934
- forceIPv6: this.sshObj.server.forceIPv6,
935
- hostHash: this.sshObj.server.hashMethod,
936
- hostVerifier: this.sshObj.server.hostVerifier,
937
- username: this.sshObj.server.userName,
938
- password: this.sshObj.server.password,
939
- agent: this.sshObj.server.agent,
940
- agentForward: this.sshObj.server.agentForward,
941
- privateKey: this.sshObj.server.privateKey,
942
- passphrase: this.sshObj.server.passPhrase,
943
- localHostname: this.sshObj.server.localHostname,
944
- localUsername: this.sshObj.server.localUsername,
945
- localAddress: this.sshObj.server.localAddress,
946
- localPort: this.sshObj.server.localPort,
947
- authHandler: this.sshObj.server.authHandler,
948
- tryKeyboard: this.sshObj.server.tryKeyboard,
949
- keepaliveInterval: this.sshObj.server.keepaliveInterval,
950
- keepaliveCountMax: this.sshObj.server.keepaliveCountMax,
951
- readyTimeout: this.sshObj.server.readyTimeout,
952
- sock: this.sshObj.server.sock,
953
- strictVendor: this.sshObj.server.strictVendor,
954
- algorithms: this.sshObj.server.algorithms,
955
- compress: this.sshObj.server.compress,
956
- debug: this.sshObj.server.debug
957
- });
930
+ if (!this.sshObj.server.username) {
931
+ this.sshObj.server.username = this.sshObj.server.userName;
932
+ }
933
+ if (!this.sshObj.server.hostHash) {
934
+ this.sshObj.server.hostHash = this.sshObj.server.hashMethod;
935
+ }
936
+ if (!this.sshObj.server.passphrase) {
937
+ this.sshObj.server.passphrase = this.sshObj.server.passPhrase;
938
+ }
939
+ this.connection.connect(this.sshObj.server);
958
940
  } catch (error) {
959
941
  e = error;
960
942
  this.emit('error', e + " " + e.stack, "Connection.connect", true);
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "ssh2shell",
3
- "version": "1.9.6",
3
+ "version": "1.9.7",
4
4
  "author": "cmp-202",
5
5
  "description": "A wrapper class for ssh2 to run multiple sequential commands in an SSH shell session, handle command responses, and tunnel through to other hosts using nested host objects",
6
6
  "main": "./lib/ssh2shell.js",
7
7
  "engines": {
8
- "node": ">=4.5.0"
8
+ "node": ">=14.18.0"
9
9
  },
10
10
  "dependencies": {
11
11
  "ssh2": "^1.4.0"
12
12
  },
13
13
  "devDependencies": {
14
14
  "coffee-script": "^1.12.7",
15
- "dotenv": "^8.2.0"
15
+ "dotenv": "^8.6.0"
16
16
  },
17
17
  "scripts": {},
18
18
  "keywords": [
@@ -378,7 +378,7 @@ class SSH2Shell extends Stream
378
378
  @hosts = hosts
379
379
  else
380
380
  @hosts = [hosts]
381
- @ssh2Client = require('ssh2')
381
+ @ssh2Client = require('ssh2').Client
382
382
  @.on "newPrimmaryHost", @_nextPrimaryHost
383
383
  @.on "data", (data) =>
384
384
  #@.emit 'msg', "#{@sshObj.server.host}: data event: #{data}" if @sshObj.verbose
@@ -578,33 +578,10 @@ class SSH2Shell extends Stream
578
578
 
579
579
  if @sshObj.server and @sshObj.commands
580
580
  try
581
- @connection.connect
582
- host: @sshObj.server.host
583
- port: @sshObj.server.port
584
- forceIPv4: @sshObj.server.forceIPv4
585
- forceIPv6: @sshObj.server.forceIPv6
586
- hostHash: @sshObj.server.hashMethod
587
- hostVerifier: @sshObj.server.hostVerifier
588
- username: @sshObj.server.userName
589
- password: @sshObj.server.password
590
- agent: @sshObj.server.agent
591
- agentForward: @sshObj.server.agentForward
592
- privateKey: @sshObj.server.privateKey
593
- passphrase: @sshObj.server.passPhrase
594
- localHostname: @sshObj.server.localHostname
595
- localUsername: @sshObj.server.localUsername
596
- localAddress: @sshObj.server.localAddress
597
- localPort: @sshObj.server.localPort
598
- authHandler: @sshObj.server.authHandler
599
- tryKeyboard: @sshObj.server.tryKeyboard
600
- keepaliveInterval:@sshObj.server.keepaliveInterval
601
- keepaliveCountMax:@sshObj.server.keepaliveCountMax
602
- readyTimeout: @sshObj.server.readyTimeout
603
- sock: @sshObj.server.sock
604
- strictVendor: @sshObj.server.strictVendor
605
- algorithms: @sshObj.server.algorithms
606
- compress: @sshObj.server.compress
607
- debug: @sshObj.server.debug
581
+ @sshObj.server.username = @sshObj.server.userName unless @sshObj.server.username
582
+ @sshObj.server.hostHash = @sshObj.server.hashMethod unless @sshObj.server.hostHash
583
+ @sshObj.server.passphrase = @sshObj.server.passPhrase unless @sshObj.server.passphrase
584
+ @connection.connect @sshObj.server
608
585
  catch e
609
586
  @.emit 'error', "#{e} #{e.stack}", "Connection.connect", true
610
587
  else