Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

ssh2

Package Overview
Dependencies
2
Maintainers
1
Versions
104
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.12 to 0.2.13

14

lib/Channel.js

@@ -247,3 +247,3 @@ var inherits = require('util').inherits,

if (had_err)
cb(new Error('Error: Unable to request a pseudo-terminal'));
cb(new Error('Unable to request a pseudo-terminal'));
else

@@ -275,3 +275,3 @@ cb();

if (had_err)
return cb(new Error('Error: Unable to open shell'));
return cb(new Error('Unable to open shell'));
self.subtype = 'shell';

@@ -311,3 +311,3 @@ self._stream = new ChannelStream(self);

if (had_err)
return cb(new Error('Error: Unable to exec'));
return cb(new Error('Unable to exec'));
self.subtype = 'exec';

@@ -412,3 +412,3 @@ self._stream = new ChannelStream(self);

if (had_err)
return cb(new Error('Error: Unable to start subsystem: ' + name));
return cb(new Error('Unable to start subsystem: ' + name));
self.subtype = 'subsystem';

@@ -636,7 +636,7 @@ self._stream = new ChannelStream(self);

if (extendedType === undefined)
throw new Error('Error: Invalid extended data type specified: '
throw new Error('Invalid extended data type specified: '
+ extended);
extended = extendedType;
} else if (extended && typeof extended !== 'number')
throw new Error('Error: Unexpected extended type: ' + extended);
throw new Error('Unexpected extended type: ' + extended);

@@ -653,3 +653,3 @@ if (this.outpaused) {

} else
throw new Error('Error: Unexpected data type: ' + typeof data);
throw new Error('Unexpected data type: ' + typeof data);
};

@@ -656,0 +656,0 @@

@@ -237,3 +237,3 @@ var i = 0, keys, len;

exports.SSH_TO_OPENSSL = {
// ciphers (only counter mode available is for AES and only in OpenSSL 1.0.1+)
// ciphers
'3des-cbc': 'des-ede3-cbc',

@@ -240,0 +240,0 @@ 'blowfish-cbc': 'bf-cbc',

@@ -125,3 +125,3 @@ // TODO: * Filter control codes from strings

// RFC says greeting SHOULD be utf8
greeting: this._greeting,//(this._greeting ? this._greeting.toString('utf8') : null),
greeting: this._greeting,
ident_raw: 'SSH-' + buffer,

@@ -145,3 +145,4 @@ versions: {

} else if (this._state === STATE_PACKETBEFORE) {
this.debug&&this.debug('DEBUG: Parser: STATE_PACKETBEFORE (expecting ' + this._decryptSize + ')');
this.debug&&this.debug('DEBUG: Parser: STATE_PACKETBEFORE (expecting '
+ this._decryptSize + ')');
// wait for the right number of bytes so we can determine the incoming

@@ -158,3 +159,5 @@ // packet length

var remainLen = this._pktLen + 4 - this._decryptSize;
this.debug&&this.debug('DEBUG: Parser: remainLen === ' + remainLen);
this.debug&&this.debug('DEBUG: Parser: pktLen:' + this._pktLen
+ ',padLen:' + this._padLen
+ ',remainLen:' + remainLen);
if (remainLen > 0) {

@@ -192,3 +195,3 @@ this._pktExtra = buffer.slice(5);

// wait for hmac hash
this.debug&&this.debug('DEBUG: Parser: hmacSize === ' + this._hmacSize);
this.debug&&this.debug('DEBUG: Parser: hmacSize:' + this._hmacSize);
this.expect(EXP_TYPE_BYTES, this._hmacSize, '_hmacBuf');

@@ -626,2 +629,3 @@ this._state = STATE_PACKETDATAVERIFY;

Parser.prototype.hmacVerify = function(hmac) {
this.debug&&this.debug('DEBUG: Parser: Verifying MAC');
var calcHmac = crypto.createHmac(SSH_TO_OPENSSL[this._hmac], this._hmacKey);

@@ -640,2 +644,3 @@

Parser.prototype.decrypt = function(data) {
this.debug&&this.debug('DEBUG: Parser: Decrypting');
return new Buffer(this._decrypt.update(data, 'binary', 'binary'), 'binary');

@@ -642,0 +647,0 @@ };

@@ -243,3 +243,3 @@ var EventEmitter = require('events').EventEmitter,

function fastXfer(src, dst, srcPath, dstPath, opts, cb) {
var concurrency = 25, chunkSize = 32768;
var concurrency = 25, chunkSize = 32768, step;

@@ -255,6 +255,8 @@ if (typeof opts === 'function')

chunkSize = opts.chunkSize;
if (typeof opts.step === 'function')
step = opts.step;
}
// internal state variables
var fsize, chunk, psrc = 0, pdst = 0, reads = 0, total = 0, srcfd, dstfd,
var fsize, chunk, psrc = 0, pdst = 0, reads = 0, total = 0, srcfd, dstfd, total_done = 0,
readbuf = new Buffer(chunkSize * concurrency);

@@ -270,14 +272,19 @@

};
if (srcfd)
++left;
if (dstfd)
++left;
if (srcfd)
src.close(srcfd, cbfinal);
if (dstfd)
dst.close(dstfd, cbfinal);
} else
cb(err);
if (srcfd) {
++left;
fs.close(srcfd, cbfinal);
}
if (dstfd) {
++left;
src.close(dstfd, cbfinal);
}
}
function onstep(chunk, total) {
total_done += chunk;
step && step(total_done, chunk, total);
}
src.stat(srcPath, function(err, attrs) {

@@ -302,2 +309,4 @@ if (err) return onerror(err);

onstep(nb, fsize);
if (--reads === 0) {

@@ -304,0 +313,0 @@ if (total === fsize) {

{ "name": "ssh2",
"version": "0.2.12",
"version": "0.2.13",
"author": "Brian White <mscdex@mscdex.net>",

@@ -4,0 +4,0 @@ "description": "An SSH2 client module written in pure JavaScript for node.js",

@@ -1,2 +0,1 @@

Description

@@ -146,4 +145,4 @@ ===========

// Content-Type: text/html; charset=UTF-8
//
//
//
//
// TCP :: EOF

@@ -326,3 +325,48 @@ // TCP :: CLOSED

* Invoke an arbitrary subsystem (netconf in this example):
```javascript
var Connection = require('ssh'),
xmlhello = '<?xml version="1.0" encoding="UTF-8"?>'+
'<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">'+
' <capabilities>'+
' <capability>urn:ietf:params:netconf:base:1.0</capability>'+
' </capabilities>'+
'</hello>]]>]]>';
var c = new Connection();
c.on('connect', function() {
console.log('Connection :: connect');
});
c.on('ready', function() {
console.log('Connection :: ready');
c.subsys('netconf', function(err, stream) {
stream.on('data', function(data, extended) {
console.log(data);
// would probably want to parse xml2js here
});
stream.write(xmlhello);
});
});
c.on('error', function(err) {
console.log('Connection :: error :: ' + err);
});
c.on('end', function() {
console.log('Connection :: end');
});
c.on('close', function(had_error) {
console.log('Connection :: close');
});
c.connect({
host: '1.2.3.4',
port: 22,
username: 'blargh',
password: 'honk'
});
```
API

@@ -362,3 +406,5 @@ ===

* **debug**(< _string_ >message) - If `debug` is set in the object passed to connect(), then this event will be emitted when the server sends debug messages. For OpenSSH, these usually are messages like "Pty allocation disabled.", "X11 forwarding disabled.", etc. when options are set for particular keys in `~/.ssh/authorized_keys`.
Connection methods

@@ -388,3 +434,3 @@ ------------------

* **passphrase** - < _string_ > - For an encrypted private key, this is the passphrase used to decrypt it. **Default:** (none)
* **publicKey** - < _mixed_ > - Optional Buffer or string that contains a public key for key-based user authentication (OpenSSH format). If `publicKey` is not set, it will be generated from the `privateKey`. **Default:** (none)

@@ -404,3 +450,3 @@

* **pty** - < _mixed_ > - Set to true to allocate a pseudo-tty with defaults, or an object containing specific pseudo-tty settings (see 'Pseudo-TTY settings').
* **pty** - < _mixed_ > - Set to true to allocate a pseudo-tty with defaults, or an object containing specific pseudo-tty settings (see 'Pseudo-TTY settings'). Setting up a pseudo-tty can be useful when working with remote processes that expect input from an actual terminal (e.g. sudo's password prompt).

@@ -429,2 +475,4 @@ `callback` has 2 parameters: < _Error_ >err, < _ChannelStream_ >stream.

* **subsys**(< _string_ >subsystem, < _function_ >callback) - _(void)_ - Invokes `subsystem` on the server. `callback` has 2 parameters: < _Error_ >err, < _ChannelStream_ >stream.
* **end**() - _(void)_ - Disconnects the socket.

@@ -472,2 +520,4 @@

* step - _function_(< _integer_ >total_transferred, < _integer_ >chunk, < _integer_ >total) - Called every time a part of a file was transferred
`callback` has 1 parameter: < _Error_ >err.

@@ -481,2 +531,4 @@

* step - _function_(< _integer_ >total_transferred, < _integer_ >chunk, < _integer_ >total) - Called every time a part of a file was transferred
`callback` has 1 parameter: < _Error_ >err.

@@ -483,0 +535,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc