Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var crypto = require('crypto');
var Socket = require('net').Socket;
var dnsLookup = require('dns').lookup;
var EventEmitter = require('events').EventEmitter;
var inherits = require('util').inherits;
var HASHES = crypto.getHashes();
var ssh2_streams = require('ssh2-streams');
var SSH2Stream = ssh2_streams.SSH2Stream;
var SFTPStream = ssh2_streams.SFTPStream;
var consts = ssh2_streams.constants;
var BUGS = consts.BUGS;
var ALGORITHMS = consts.ALGORITHMS;
var EDDSA_SUPPORTED = consts.EDDSA_SUPPORTED;
var parseKey = ssh2_streams.utils.parseKey;
var HTTPAgents = require('./http-agents');
var Channel = require('./Channel');
var agentQuery = require('./agent');
var SFTPWrapper = require('./SFTPWrapper');
var readUInt32BE = require('./buffer-helpers').readUInt32BE;
var MAX_CHANNEL = Math.pow(2, 32) - 1;
var RE_OPENSSH = /^OpenSSH_(?:(?![0-4])\d)|(?:\d{2,})/;
var DEBUG_NOOP = function(msg) {};
function Client() {
var inherits = require('util').inherits;
var DuplexStream = require('stream').Duplex;
var ReadableStream = require('stream').Readable;
var WritableStream = require('stream').Writable;
var STDERR = require('ssh2-streams').constants.CHANNEL_EXTENDED_DATATYPE.STDERR;
var PACKET_SIZE = 32 * 1024;
var MAX_WINDOW = 2 * 1024 * 1024;
var WINDOW_THRESHOLD = MAX_WINDOW / 2;
var CUSTOM_EVENTS = [
'CHANNEL_EOF',
'CHANNEL_CLOSE',
'CHANNEL_DATA',
'CHANNEL_EXTENDED_DATA',
'CHANNEL_WINDOW_ADJUST',
'CHANNEL_SUCCESS',
'CHANNEL_FAILURE',
'CHANNEL_REQUEST'
];
var CUSTOM_EVENTS_LEN = CUSTOM_EVENTS.length;
import FS from 'fs-plus';
import os from 'os';
import { File, CompositeDisposable, Emitter, watchPath } from 'atom';
import { $ } from 'atom-space-pen-views';
import Path from 'path';
import stripJsonComments from 'strip-json-comments';
import ignore from 'ignore';
import sshConfig from 'ssh-config';
import { multipleHostsEnabled, getObject, hasProject, logger, traverseTree, validateConfig, resolveHome, mkdirSyncRecursive } from './helpers';
import Directory from './directory';
import Progress from './progress';
import FTP from './connectors/ftp';
import SFTP from './connectors/sftp';
import PromptPassDialog from './dialogs/prompt-pass-dialog';
const SSH2_ALGORITHMS = require('ssh2-streams').constants.ALGORITHMS;
export default class Client {
constructor() {
this.subscriptions = new CompositeDisposable();
this.emitter = new Emitter();
const self = this;
self.info = null;
self.connector = null;
self.current = null;
self.queue = [];
self.configFileName = '.ftpconfig';
self.ignoreBaseName = '.ftpignore';
self.ignoreFilter = false;
self.watchers = [];
var net = require('net');
var EventEmitter = require('events').EventEmitter;
var listenerCount = EventEmitter.listenerCount;
var inherits = require('util').inherits;
var ssh2_streams = require('ssh2-streams');
var parseKey = ssh2_streams.utils.parseKey;
var SSH2Stream = ssh2_streams.SSH2Stream;
var SFTPStream = ssh2_streams.SFTPStream;
var consts = ssh2_streams.constants;
var DISCONNECT_REASON = consts.DISCONNECT_REASON;
var CHANNEL_OPEN_FAILURE = consts.CHANNEL_OPEN_FAILURE;
var ALGORITHMS = consts.ALGORITHMS;
var Channel = require('./Channel');
var KeepaliveManager = require('./keepalivemgr');
var writeUInt32BE = require('./buffer-helpers').writeUInt32BE;
var MAX_CHANNEL = Math.pow(2, 32) - 1;
var MAX_PENDING_AUTHS = 10;
var kaMgr;
function Server(cfg, listener) {
if (!(this instanceof Server))
return new Server(cfg, listener);