ssh2shell 2.0.7 → 2.0.9

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/README.md CHANGED
@@ -1040,3 +1040,29 @@ this has some risks associated with it. I like to know what is in the script I a
1040
1040
  "rm myscript.sh"
1041
1041
  ],
1042
1042
  ```
1043
+
1044
+ from [issue #103](https://github.com/cmp-202/ssh2shell/issues/103)
1045
+ "I read the local script file & encoded into Base64 to avoid any special characters.
1046
+ Then with it I formed a command at the runtime to execute at the target:
1047
+
1048
+ `echo "<>" | base64 -d | bash`
1049
+
1050
+ and if you have command line inputs:
1051
+ `echo "<>" | base64 -d | bash -s`
1052
+
1053
+ This worked for me without physically copying the script on target as well as running into any special character issues with echo or printf statement.
1054
+ Hopefully it can help others who are looking to solve the same problem.
1055
+ "
1056
+
1057
+ from [issue #104](https://github.com/cmp-202/ssh2shell/issues/104)
1058
+ ```javascript
1059
+ host.commands: [ bash -s ${fs.readFileSync('./script1.sh', 'utf-8')}]
1060
+
1061
+ //remove the output of the command content from the script result
1062
+ host.onCommandComplete: function( command, response, sshObj) {
1063
+ if (command.indexOf("bash ") > -1){
1064
+ //end match would most likely fail if there was a problem
1065
+ sshObj.sessonText = response.replace(command.substring(0, 4)+"*"+command.substring(command.length - 2),'')
1066
+ }
1067
+ }
1068
+ ```
package/lib/ssh2shell.js CHANGED
@@ -979,7 +979,8 @@
979
979
  if (_this._hosts.length === 0) {
980
980
  if (typeof _this._callback === 'function') {
981
981
  _this._callback(_this._allSessions);
982
- return _this._removeListeners();
982
+ _this._removeListeners();
983
+ return _this._allSessions;
983
984
  }
984
985
  } else {
985
986
  return _this.emit("newPrimaryHost", _this._nextPrimaryHost(_this._connect));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ssh2shell",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
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",
@@ -607,6 +607,7 @@ class SSH2Shell extends Stream
607
607
  if typeof @_callback == 'function'
608
608
  @_callback @_allSessions
609
609
  @_removeListeners()
610
+ return @_allSessions
610
611
  else
611
612
  @.emit "newPrimaryHost", @_nextPrimaryHost(@_connect)
612
613