simple-ssh
Advanced tools
Comparing version 0.8.2 to 0.8.3
@@ -13,2 +13,3 @@ 'use strict'; | ||
* @param {String} config.pass - Password | ||
* @param {String} [config.passphase=''] - Passphrase | ||
* @param {String} [config.baseDir=''] - Base directory to perform commands from | ||
@@ -27,2 +28,3 @@ * @param {String} [config.agent=''] - SSH Agent to connect with | ||
key: '', | ||
passphrase: '', | ||
baseDir: '', | ||
@@ -42,2 +44,3 @@ agent: '', | ||
this.key = config.key; | ||
this.passphrase = config.passphrase; | ||
this.baseDir = config.baseDir; | ||
@@ -88,3 +91,3 @@ this.agent = config.agent; | ||
stream.on('data', function(data, extended) { | ||
stream.on('data', function(data) { | ||
// This will allow us to send in the password if we're doing something like `sudo` | ||
@@ -198,9 +201,16 @@ buffer += (!passwordSent) ? data.toString() : ''; | ||
} else if (!self.pass && self.key) { | ||
self._c.connect({ | ||
host: self.host, | ||
port: self.port || 22, | ||
username: self.user, | ||
privateKey: self.key, | ||
readyTimeout: self.timeout | ||
}); | ||
try { | ||
self._c.connect({ | ||
host: self.host, | ||
port: self.port || 22, | ||
username: self.user, | ||
privateKey: self.key, | ||
passphrase: self.passphrase, | ||
readyTimeout: self.timeout | ||
}); | ||
} catch (err) { | ||
self._c.emit('error', new Error('Incorrect passphrase: ' + err.toString())); | ||
return this; | ||
} | ||
} else if (self.pass && self.key) { | ||
@@ -284,2 +294,2 @@ self._c.connect({ | ||
module.exports = SSH; | ||
module.exports = SSH; |
{ | ||
"name": "simple-ssh", | ||
"version": "0.8.2", | ||
"version": "0.8.3", | ||
"description": "A wrapper for ssh2 to make it easier to perform commands over SSH", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -77,9 +77,9 @@ # simple-ssh | ||
.exec('echo "Node.js"', { | ||
out: console.log | ||
out: console.log.bind(console) | ||
}) | ||
.exec('echo "is"', { | ||
out: console.log | ||
out: console.log.bind(console) | ||
}) | ||
.exec('echo "awesome!"', { | ||
out: console.log | ||
out: console.log.bind(console) | ||
}) | ||
@@ -110,3 +110,3 @@ .start(); | ||
pty: true, | ||
out: console.log | ||
out: console.log.bind(console) | ||
}).start(); | ||
@@ -173,2 +173,3 @@ ``` | ||
* **config.key** { _String_ }: SSH key | ||
* **config.passphrase** { _String_ }: Passphrase | ||
* **config.baseDir** { _String_ }: Base directory. If this is set, each command will be preceeded by `cd ${this.baseDir}` | ||
@@ -202,3 +203,3 @@ * **config.agent** { _String_ }: Connects with the given SSH agent. If this is set, no need to specify a private key or password. | ||
* **end**(): **Ends the SSH session** (this is automatically called at the end of a command queue). | ||
### Properties | ||
@@ -205,0 +206,0 @@ |
@@ -5,2 +5,3 @@ 'use strict'; | ||
expect = require('expect.js'), | ||
fs = require('fs'), | ||
@@ -11,2 +12,6 @@ config = require('../config/ssh.json'), | ||
describe('SSH', function() { | ||
if (config.key) { | ||
config.key = fs.readFileSync(config.key); | ||
} | ||
beforeEach(function() { | ||
@@ -253,2 +258,2 @@ ssh = new SSH(config); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27329
534
255
1