private Cipher _tCipher; //cipher for transmission // exec command for SCP //private bool _executingExecCmd = false; public SSH1Connection(SSHConnectionParameter param, AbstractGranadosSocket s, ISSHConnectionEventReceiver er, string serverversion, string clientversion) : base(param, s, er) { _cInfo = new SSH1ConnectionInfo(); _cInfo._serverVersionString = serverversion; _cInfo._clientVersionString = clientversion; _shellID = -1; _packetReceiver = new SynchronizedPacketReceiver(this); _packetBuilder = new SSH1PacketBuilder(_packetReceiver); }
private readonly object _transmitSync = new object(); // for keeping correct packet order internal SSH2Connection(SSHConnectionParameter param, AbstractGranadosSocket strm, ISSHConnectionEventReceiver r, string serverversion, string clientversion) : base(param, strm, r) { _cInfo = new SSH2ConnectionInfo(); _cInfo._serverVersionString = serverversion; _cInfo._clientVersionString = clientversion; _packetReceiver = new SynchronizedPacketReceiver(this); _packetBuilder = new SSH2PacketBuilder(_packetReceiver); }
protected bool _execCmdWaitFlag; // wait response flag for sending exec command to server protected SSHConnection(SSHConnectionParameter param, AbstractGranadosSocket strm, ISSHConnectionEventReceiver receiver) { _param = (SSHConnectionParameter)param.Clone(); _stream = strm; _eventReceiver = receiver; _channel_collection = new ChannelCollection(); _autoDisconnect = true; _execCmd = null; _execCmdWaitFlag = true; }
/** * writes to encrypted stream */ public void WriteTo(AbstractGranadosSocket output, Cipher cipher) { byte[] image = BuildImage(); //dumpBA(image); byte[] encrypted = new byte[image.Length - 4]; cipher.Encrypt(image, 4, image.Length - 4, encrypted, 0); //length field must not be encrypted Array.Copy(encrypted, 0, image, 4, encrypted.Length); output.Write(image, 0, image.Length); }
/** * writes to plain stream */ public void WriteTo(AbstractGranadosSocket output) { byte[] image = BuildImage(); output.Write(image, 0, image.Length); }
public VersionExchangeHandler(SSHConnectionParameter param, AbstractGranadosSocket socket) : base(socket) { _param = param; }
public SynchronizedDataHandler(AbstractGranadosSocket socket) { _socket = socket; _event = new ManualResetEvent(false); _results = new Queue(); }
internal DummySSHConnection(SSHConnectionParameter param, AbstractGranadosSocket strm, ISSHConnectionEventReceiver receiver) : base(param, strm, receiver) { }
private static SSHConnection ConnectMain(SSHConnectionParameter param, ISSHConnectionEventReceiver receiver, VersionExchangeHandler pnh, AbstractGranadosSocket s) { DataFragment data = pnh.WaitResponse(); string sv = pnh.ServerVersion; SSHConnection con = null; if (param.Protocol == SSHProtocol.SSH1) con = new SSH1Connection(param, s, receiver, sv, SSHUtil.ClientVersionString(param.Protocol)); else con = new SSH2Connection(param, s, receiver, sv, SSHUtil.ClientVersionString(param.Protocol)); con.TraceReceptionEvent("server version-string", sv.Trim()); pnh.Close(); s.SetHandler(con.PacketBuilder); con.SendMyVersion(param); if (con.Connect() != AuthenticationResult.Failure) { return con; } else { s.Close(); return null; } }