ssh2shell 2.0.8 → 2.0.10
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 +26 -0
- package/lib/ssh2shell.js +1024 -1021
- package/package.json +2 -2
- package/src/ssh2shell.coffee +2 -1
- package/Lots of commands.log +0 -445
- package/first.log +0 -30
- package/second.log +0 -30
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
|
+
```
|