亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? connectionroot.cs

?? Granados是一個基于.NET的SSH客戶端庫。同時支持SSH1和SSH2。實現了AES, Blowfish, TripleDES, RSA, DSA等加密驗證算法。實現TCP協議連接。
?? CS
字號:
/* ---------------------------------------------------------------------------
 *
 * Copyright (c) Routrek Networks, Inc.    All Rights Reserved..
 * 
 * This file is a part of the Granados SSH Client Library that is subject to
 * the license included in the distributed package.
 * You may not use this file except in compliance with the license.
 * 
 * ---------------------------------------------------------------------------
 */

using System;
using System.Collections;
using System.IO;
using System.Net.Sockets;
using System.Text;
using Routrek.Crypto;
using Routrek.PKI;
using Routrek.SSHCV1;
using Routrek.SSHCV2;

namespace Routrek.SSHC
{
	public abstract class SSHConnection {

		internal AbstractSocket _stream;
		internal ISSHConnectionEventReceiver _eventReceiver;
		
		protected byte[] _sessionID;
		internal Cipher _tCipher; //transmission
		//internal Cipher _rCipher; //reception
		protected SSHConnectionParameter _param;

		protected object _tLockObject = new Object();

		protected bool _closed;

		protected bool _autoDisconnect;

		protected AuthenticationResult _authenticationResult;

		protected SSHConnection(SSHConnectionParameter param, ISSHConnectionEventReceiver receiver) {
			_param = (SSHConnectionParameter)param.Clone();
			_eventReceiver = receiver;
			_channel_entries = new ArrayList(16);
			_autoDisconnect = true;
		}

		public abstract SSHConnectionInfo ConnectionInfo { get; }
		
		/**
		* returns true if any data from server is available
		*/
		public bool Available {
			get {
				if(_closed)
					return false;
				else
					return _stream.DataAvailable;
			}
		}

		public SSHConnectionParameter Param {
			get {
				return _param;
			}
		}
		public AuthenticationResult AuthenticationResult {
			get {
				return _authenticationResult;
			}
		}

		internal abstract IByteArrayHandler PacketBuilder {
			get ;
		}

		public ISSHConnectionEventReceiver EventReceiver {
			get {
				return _eventReceiver;
			}
		}
		public bool IsClosed {
			get {
				return _closed;
			}
		}
		public bool AutoDisconnect {
			get {
				return _autoDisconnect;
			}
			set {
				_autoDisconnect = value;
			}
		}


		internal abstract AuthenticationResult Connect(AbstractSocket target);

		/**
		* terminates this connection
		*/
		public abstract void Disconnect(string msg);

		/**
		* opens a pseudo terminal
		*/
		public abstract SSHChannel OpenShell(ISSHChannelEventReceiver receiver);

		/**
		 * forwards the remote end to another host
		 */ 
		public abstract SSHChannel ForwardPort(ISSHChannelEventReceiver receiver, string remote_host, int remote_port, string originator_host, int originator_port);

		/**
		 * listens a connection on the remote end
		 */ 
		public abstract void ListenForwardedPort(string allowed_host, int bind_port);

		/**
		 * cancels binded port
		 */ 
		public abstract void CancelForwardedPort(string host, int port);

		/**
		* closes socket directly.
		*/
		public abstract void Close();

		
		public abstract void SendIgnorableData(string msg);


		/**
		 * opens another SSH connection via port-forwarded connection
		 */ 
		public SSHConnection OpenPortForwardedAnotherConnection(SSHConnectionParameter param, ISSHConnectionEventReceiver receiver, string host, int port) {
			ProtocolNegotiationHandler pnh = new ProtocolNegotiationHandler(param);
			ChannelSocket s = new ChannelSocket(pnh);

			SSHChannel ch = ForwardPort(s, host, port, "localhost", 0);
			s.SSHChennal = ch;
			return SSHConnection.Connect(param, receiver, pnh, s);
		}

		//channel id support
		protected class ChannelEntry {
			public int _localID;
			public ISSHChannelEventReceiver _receiver;
			public SSHChannel _channel;
		}

		protected ArrayList _channel_entries;
		protected int _channel_sequence;
		protected ChannelEntry FindChannelEntry(int id) {
			for(int i=0; i<_channel_entries.Count; i++) {
				ChannelEntry e = (ChannelEntry)_channel_entries[i];
				if(e._localID==id) return e;
			}
			return null;
		}
		protected ChannelEntry RegisterChannelEventReceiver(SSHChannel ch, ISSHChannelEventReceiver r) {
			lock(this) {
				ChannelEntry e = new ChannelEntry();
				e._channel = ch;
				e._receiver = r;
				e._localID = _channel_sequence++;

				for(int i=0; i<_channel_entries.Count; i++) {
					if(_channel_entries[i]==null) {
						_channel_entries[i] = e;
						return e;
					}
				}
				_channel_entries.Add(e);
				return e;
			}
		}
		internal void RegisterChannel(int local_id, SSHChannel ch) {
			FindChannelEntry(local_id)._channel = ch;
		}
		internal void UnregisterChannelEventReceiver(int id) {
			lock(this) {
				foreach(ChannelEntry e in _channel_entries) {
					if(e._localID==id) {
						_channel_entries.Remove(e);
						break;
					}
				}
				if(this.ChannelCount==0 && _autoDisconnect) Disconnect(""); //auto close
			}
		}
		public virtual int ChannelCount {
			get {
				int r = 0;
				for(int i=0; i<_channel_entries.Count; i++) {
					if(_channel_entries[i]!=null) r++;
				}
				return r;
			}
		}

		
		//establishes a SSH connection in subject to ConnectionParameter
		public static SSHConnection Connect(SSHConnectionParameter param, ISSHConnectionEventReceiver receiver, Socket underlying_socket) {
			if(param.UserName==null) throw new InvalidOperationException("UserName property is not set");
			if(param.Password==null) throw new InvalidOperationException("Password property is not set");

			ProtocolNegotiationHandler pnh = new ProtocolNegotiationHandler(param);
			PlainSocket s = new PlainSocket(underlying_socket, pnh);
			s.RepeatAsyncRead();
			return ConnectMain(param, receiver, pnh, s);
		}
		internal static SSHConnection Connect(SSHConnectionParameter param, ISSHConnectionEventReceiver receiver, ProtocolNegotiationHandler pnh, AbstractSocket s) {
			if(param.UserName==null) throw new InvalidOperationException("UserName property is not set");
			if(param.Password==null) throw new InvalidOperationException("Password property is not set");

			return ConnectMain(param, receiver, pnh, s);
		}
		private static SSHConnection ConnectMain(SSHConnectionParameter param, ISSHConnectionEventReceiver receiver, ProtocolNegotiationHandler pnh, AbstractSocket s) {
			pnh.Wait();

			if(pnh.State!=ReceiverState.Ready) throw new SSHException(pnh.ErrorMessage);

			string sv = pnh.ServerVersion;

			SSHConnection con = null;
			if(param.Protocol==SSHProtocol.SSH1)
				con = new SSH1Connection(param, receiver, sv, SSHUtil.ClientVersionString(param.Protocol));
			else
				con = new SSH2Connection(param, receiver, sv, SSHUtil.ClientVersionString(param.Protocol));

			s.SetHandler(con.PacketBuilder);
			SendMyVersion(s, param);

			if(con.Connect(s)!=AuthenticationResult.Failure)
				return con;
			else {
				s.Close();
				return null;
			}
		}

		private static void SendMyVersion(AbstractSocket stream, SSHConnectionParameter param) {
			string cv = SSHUtil.ClientVersionString(param.Protocol);
			if(param.Protocol==SSHProtocol.SSH1)
				cv += param.SSH1VersionEOL;
			else
				cv += "\r\n";
			byte[] data = Encoding.ASCII.GetBytes(cv);
			stream.Write(data, 0, data.Length);
		}
	}

	public enum ChannelType {
		Session,
		Shell,
		ForwardedLocalToRemote,
		ForwardedRemoteToLocal
	}

	public abstract class SSHChannel {
		protected ChannelType _type;
		protected int _localID;
		protected int _remoteID;
		protected SSHConnection _connection;

		protected SSHChannel(SSHConnection con, ChannelType type, int local_id) {
			con.RegisterChannel(local_id, this);
			_connection = con;
			_type = type;
			_localID = local_id;
		}

		public int LocalChannelID {
			get {
				return _localID;
			}
		}
		public int RemoteChannelID {
			get {
				return _remoteID;
			}
		}
		public SSHConnection Connection {
			get {
				return _connection;
			}
		}
		public ChannelType Type {
			get {
				return _type;
			}
		}

		/**
		 * resizes the size of terminal
		 */
		public abstract void ResizeTerminal(int width, int height, int pixel_width, int pixel_height);

		/**
		* transmits channel data 
		*/
		public abstract void Transmit(byte[] data);

		/**
		* transmits channel data 
		*/
		public abstract void Transmit(byte[] data, int offset, int length);

		/**
		 * sends EOF(SSH2 only)
		 */
		public abstract void SendEOF();

		/**
		 * closes this channel
		 */
		public abstract void Close();


	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩欧美一区中文| 亚洲一区二区欧美日韩| 亚洲视频在线一区| 美国毛片一区二区三区| 99久久婷婷国产综合精品电影| 欧美精品 国产精品| 亚洲丝袜制服诱惑| 国产一区二区毛片| 欧美精品日日鲁夜夜添| 亚洲老妇xxxxxx| 国产成人综合精品三级| 日韩一区二区三| 石原莉奈一区二区三区在线观看| 成人高清免费在线播放| 欧美精品一区二区三区蜜桃| 亚洲成人av一区二区| 欧美精品在线一区二区三区| 国产精品乱码一区二区三区软件 | 无码av免费一区二区三区试看 | 国产99久久久久久免费看农村| 欧美日韩精品系列| 亚洲免费在线播放| 91在线看国产| 最新国产精品久久精品| voyeur盗摄精品| 中文字幕一区二区不卡| 大陆成人av片| 国产精品无圣光一区二区| 国产成人一区在线| 久久久久久97三级| 国产高清在线精品| 日本一区二区免费在线观看视频 | 亚洲一区二区在线播放相泽| 色综合久久久久综合体桃花网| 中文字幕一区二区三区四区 | 免费成人av在线| 日韩三级在线观看| 九九精品视频在线看| 久久久久久一二三区| 国产精品99久久久久久久女警 | 久久久久久久精| 国产成人精品网址| 亚洲欧洲日韩一区二区三区| 91视频免费看| 亚洲制服丝袜一区| 欧美美女黄视频| 久久精品国产澳门| 国产午夜精品福利| 99免费精品在线观看| 亚洲激情图片qvod| 欧美丰满美乳xxx高潮www| 成人精品国产免费网站| 国产精品免费久久| 欧美亚洲国产一区二区三区va| 亚洲亚洲人成综合网络| 日韩欧美国产小视频| 国产v综合v亚洲欧| 一二三四区精品视频| 欧美一级片在线看| 成人在线视频一区二区| 亚洲永久精品国产| 2019国产精品| 色诱视频网站一区| 精品系列免费在线观看| 国产精品久久久久久久裸模| 欧美自拍偷拍一区| 国产在线播放一区三区四| 中文字幕亚洲一区二区va在线| 欧美制服丝袜第一页| 激情成人综合网| 一区二区高清免费观看影视大全 | 中文字幕国产一区| 欧美日韩免费一区二区三区视频| 激情图区综合网| 夜夜精品视频一区二区| 久久午夜色播影院免费高清| 91国偷自产一区二区三区观看 | 日韩精品综合一本久道在线视频| 成人激情小说乱人伦| 欧美a级一区二区| 亚洲欧美国产77777| 久久伊人中文字幕| 欧美丰满高潮xxxx喷水动漫| 国产成a人无v码亚洲福利| 日韩精品视频网站| 日韩毛片精品高清免费| 久久久美女毛片| 欧美一区在线视频| 精品伦理精品一区| 欧美亚洲国产怡红院影院| 成人综合在线观看| 韩国成人在线视频| 蜜臀av性久久久久蜜臀aⅴ| 一区二区三区四区亚洲| 国产精品乱码一区二区三区软件| 欧美成人一区二区三区| 欧美日韩日日摸| 91久久奴性调教| gogogo免费视频观看亚洲一| 国产精品资源站在线| 日韩av电影免费观看高清完整版| 一区二区免费在线播放| 亚洲欧洲三级电影| 一色屋精品亚洲香蕉网站| 国产婷婷色一区二区三区四区| 日韩欧美一区中文| 精品国产a毛片| 日韩精品一区二区三区视频播放| 51精品国自产在线| 欧美三级在线看| 欧美日本在线播放| 欧美日本在线一区| 欧美一级视频精品观看| 日韩一级大片在线| 欧美白人最猛性xxxxx69交| 欧美一区二区视频在线观看| 日韩视频中午一区| 亚洲精品在线免费播放| 久久久天堂av| 国产精品高清亚洲| 亚洲精品乱码久久久久久日本蜜臀 | 国产欧美日韩三级| 国产亚洲1区2区3区| 久久久99精品免费观看不卡| 国产日韩欧美一区二区三区综合| 国产偷国产偷亚洲高清人白洁| 国产欧美日韩精品在线| 国产精品国产三级国产aⅴ入口 | 欧美日韩高清一区二区| 7777精品伊人久久久大香线蕉经典版下载 | 色噜噜狠狠色综合欧洲selulu| 91免费在线看| 在线播放视频一区| 精品毛片乱码1区2区3区| 日本一区二区动态图| 亚洲激情男女视频| 青青青伊人色综合久久| 国产精品99久久久| 日本电影欧美片| 欧美不卡一区二区三区四区| 国产精品女上位| 亚洲gay无套男同| 热久久国产精品| 国产成人精品网址| 欧洲精品一区二区| 日韩欧美高清一区| 国产精品福利一区| 五月天网站亚洲| 成人在线视频一区| 欧美精品xxxxbbbb| 国产精品乱子久久久久| 五月激情丁香一区二区三区| 国产美女主播视频一区| 欧美在线观看视频一区二区 | 久久精品噜噜噜成人av农村| 丰满亚洲少妇av| 欧美四级电影网| 久久久久国产精品厨房| 夜夜亚洲天天久久| 国产91在线观看丝袜| 欧美日韩在线亚洲一区蜜芽| 久久网站最新地址| 性感美女极品91精品| 国产.欧美.日韩| 欧美一级黄色大片| 亚洲伦理在线精品| 国内成人自拍视频| 欧美日韩一卡二卡三卡 | 国产精品12区| 91精品国产一区二区人妖| 中文字幕亚洲综合久久菠萝蜜| 麻豆91在线观看| 欧美人妇做爰xxxⅹ性高电影| 日本一区二区三区dvd视频在线| 日韩电影免费在线观看网站| 色综合天天综合色综合av| 久久久久亚洲综合| 精品一区二区三区不卡| 国产女主播一区| 另类小说综合欧美亚洲| 欧美亚男人的天堂| 亚洲三级电影全部在线观看高清| 国模一区二区三区白浆| 欧美一级午夜免费电影| 午夜电影网亚洲视频| 欧美日韩一区二区三区四区| 国产精品久久久久久妇女6080| 国产乱码字幕精品高清av| 精品久久久久一区| 九九九久久久精品| 亚洲精品一区二区三区蜜桃下载| 日本不卡在线视频| 欧美一区二区精品| 蜜芽一区二区三区| 欧美一区二区美女| 精品在线亚洲视频| 久久久另类综合| 国产91综合一区在线观看| 国产欧美综合在线观看第十页| 国产综合色在线|