public SSHShortcutLoginDialog(SSHTerminalParam param) { // // Windows �t�H�[�� �f�U�C�i �T�|�[�g�ɕK�v�ł��B // InitializeComponent(); this._privateKeyLabel.Text = GApp.Strings.GetString("Form.SSHShortcutLoginDialog._privateKeyLabel"); this._passphraseLabel.Text = GApp.Strings.GetString("Form.SSHShortcutLoginDialog._passphraseLabel"); this._logFileLabel.Text = GApp.Strings.GetString("Form.SSHShortcutLoginDialog._logFileLabel"); this._hostLabel.Text = GApp.Strings.GetString("Form.SSHShortcutLoginDialog._hostLabel"); this._methodLabel.Text = GApp.Strings.GetString("Form.SSHShortcutLoginDialog._methodLabel"); this._accountLabel.Text = GApp.Strings.GetString("Form.SSHShortcutLoginDialog._accountLabel"); this._authTypeLabel.Text = GApp.Strings.GetString("Form.SSHShortcutLoginDialog._authTypeLabel"); this._encodingLabel.Text = GApp.Strings.GetString("Form.SSHShortcutLoginDialog._encodingLabel"); this._logTypeLabel.Text = GApp.Strings.GetString("Form.SSHShortcutLoginDialog._logTypeLabel"); this.Text = GApp.Strings.GetString("Form.SSHShortcutLoginDialog.Text"); this._cancelButton.Text = GApp.Strings.GetString("Common.Cancel"); this._loginButton.Text = GApp.Strings.GetString("Common.OK"); // // TODO: InitializeComponent �Ăяo���̌�ɁA�R���X�g���N�^ �R�[�h��lj����Ă��������B // _terminalParam = param; InitUI(); }
public static ConnectionTag CreateNewConnection(SSHTerminalParam param, HostKeyCheckCallback keycheck) { SilentClient s = new SilentClient(); SocketWithTimeout swt = StartNewConnection(s, param, param.Passphrase, keycheck); if(swt==null) return null; else return s.Wait(swt); }
public KeyCheckResult Check(SSHTerminalParam param, string key) { object k = param.Method==ConnectionMethod.SSH1? _dataForSSH1[ToKeyString(param)] : _dataForSSH2[ToKeyString(param)]; if(k==null) return KeyCheckResult.NotExists; else return key.Equals(k)? KeyCheckResult.OK : KeyCheckResult.Different; }
internal SSHTerminalParam(SSHTerminalParam r) : base(r) { _account = r._account; _auth = r._auth; _identityfile = r._identityfile; _passphrase = r._passphrase; }
public override bool Equals(object t_) { SSHTerminalParam t = t_ as SSHTerminalParam; if (t == null) { return(false); } return(base.Equals(t) && _account == t.Account && _auth == t.AuthType); }
public virtual void Update(SSHTerminalParam param, string server_key) { }
public virtual KeyCheckResult Check(SSHTerminalParam param, string server_key) { return KeyCheckResult.OK; }
public static TerminalParam CreateFromConfigNode(ConfigNode sec) { string type = sec["type"]; TerminalParam param; if(type=="serial") param = new SerialTerminalParam(); else if(type=="tcp") { ConnectionMethod cm = ParseMethod(sec["method"]); if(cm==ConnectionMethod.Telnet) param = new TelnetTerminalParam(); else param = new SSHTerminalParam(); } else if(type=="cygwin") param = new CygwinTerminalParam(); else if(type=="sfu") param = new SFUTerminalParam(); else throw new Exception("invalid format"); param.Import(sec); return param; }
public void Connect() { #region old stuff /* Poderosa.ConnectionParam.LogType logType = Poderosa.ConnectionParam.LogType.Default; string file = null; if (this.TerminalPane.Connection != null) { logType = this.TerminalPane.Connection.LogType; file = this.TerminalPane.Connection.LogPath; //GApp.GetConnectionCommandTarget().Close(); this.TerminalPane.Connection.Close(); this.TerminalPane.Detach(); } SSHTerminalParam p = new SSHTerminalParam((Poderosa.ConnectionParam.ConnectionMethod)this.Method, this.Host, this.UserName, this.Password); GApp.GlobalCommandTarget.SilentNewConnection(p); if (file != null) this.SetLog((LogType) logType, file, true); */ #endregion // Save old log info in case this is a reconnect Poderosa.ConnectionParam.LogType logType = Poderosa.ConnectionParam.LogType.Default; string file = null; if (this.TerminalPane.Connection != null) { logType = this.TerminalPane.Connection.LogType; file = this.TerminalPane.Connection.LogPath; //GApp.GetConnectionCommandTarget().Close(); this.TerminalPane.Connection.Close(); this.TerminalPane.Detach(); } //------------------------------------------------------------------------ SSHTerminalParam sshp = new SSHTerminalParam((Poderosa.ConnectionParam.ConnectionMethod)this.Method, this.Host, this.UserName, this.Password); sshp.AuthType = this.AuthType; sshp.IdentityFile = this.IdentifyFile; sshp.Encoding = EncodingType.ISO8859_1; sshp.Port = 22; sshp.RenderProfile = new RenderProfile(); sshp.TerminalType = TerminalType.XTerm; CommunicationUtil.SilentClient s = new CommunicationUtil.SilentClient(); Size sz = this.Size; SocketWithTimeout swt; swt = new SSHConnector((Poderosa.ConnectionParam.SSHTerminalParam)sshp, sz, sshp.Passphrase, (HostKeyCheckCallback)null); swt.AsyncConnect(s, sshp.Host, sshp.Port); ConnectionTag ct = s.Wait(swt); if (ct == null) throw new SSHException(swt.ErrorMessage); this.TerminalPane.FakeVisible = true; this.TerminalPane.Attach(ct); ct.Receiver.Listen(); //------------------------------------------------------------- if (file != null) this.SetLog((LogType)logType, file, true); this.TerminalPane.ConnectionTag.RenderProfile = new RenderProfile(); this.SetPaneColors(Color.LightBlue, Color.Black); }
private static string ToKeyString(SSHTerminalParam param) { string h = param.Host; if(param.Port!=22) h += ":" + param.Port; return h; }
public void Update(SSHTerminalParam param, string key) { if(param.Method==ConnectionMethod.SSH1) _dataForSSH1[ToKeyString(param)] = key; else _dataForSSH2[ToKeyString(param)] = key; }
//���͓�e�Ɍ�肪��������x������null��Ԃ��B�Ȃ���ΕK�v�ȂƂ���߂�TCPTerminalParam��Ԃ� private TCPTerminalParam ValidateContent() { string msg = null; TCPTerminalParam p = null; SSHTerminalParam sp = null; try { ConnectionMethod m = ParseMethod(_methodBox.Text); if(m==ConnectionMethod.Telnet) p = new TelnetTerminalParam(""); else { p = sp = new SSHTerminalParam(ConnectionMethod.SSH2, "", "", ""); sp.Method = m; sp.Account = _userNameBox.Text; } p.Host = _hostBox.Text; try { p.Port = ParsePort(_portBox.Text); } catch(FormatException ex) { msg = ex.Message; } if(_hostBox.Text.Length==0) msg = GApp.Strings.GetString("Message.LoginDialog.HostIsEmpty"); p.LogType = (LogType)EnumDescAttributeT.For(typeof(LogType)).FromDescription(_logTypeBox.Text, LogType.None); if(p.LogType!=LogType.None) { p.LogPath = _logFileBox.Text; if(p.LogPath==GUtil.CreateLogFileName(null)) p.LogPath = GUtil.CreateLogFileName(_hostBox.Text); LogFileCheckResult r = GCUtil.CheckLogFileName(p.LogPath, this); if(r==LogFileCheckResult.Cancel || r==LogFileCheckResult.Error) return null; p.LogAppend = (r==LogFileCheckResult.Append); } if(p.IsSSH) { Debug.Assert(sp!=null); sp.AuthType = (AuthType)_authOptions.SelectedIndex; if(sp.AuthType==AuthType.PublicKey) { if(!File.Exists(_privateKeyFile.Text)) msg = GApp.Strings.GetString("Message.LoginDialog.KeyFileNotExist"); else sp.IdentityFile = _privateKeyFile.Text; } } p.EncodingProfile = EncodingProfile.Get((EncodingType)_encodingBox.SelectedIndex); p.LocalEcho = _localEchoBox.SelectedIndex==1; p.TransmitNL = (NewLine)EnumDescAttributeT.For(typeof(NewLine)).FromDescription(_newLineBox.Text, NewLine.CR); p.TerminalType = (TerminalType)_terminalTypeBox.SelectedIndex; if(msg!=null) { ShowError(msg); return null; } else return p; } catch(Exception ex) { GUtil.Warning(this, ex.Message); return null; } }
public void Connect() { #region old stuff /* Poderosa.ConnectionParam.LogType logType = Poderosa.ConnectionParam.LogType.Default; string file = null; if (this.TerminalPane.Connection != null) { logType = this.TerminalPane.Connection.LogType; file = this.TerminalPane.Connection.LogPath; //GApp.GetConnectionCommandTarget().Close(); this.TerminalPane.Connection.Close(); this.TerminalPane.Detach(); } SSHTerminalParam p = new SSHTerminalParam((Poderosa.ConnectionParam.ConnectionMethod)this.Method, this.Host, this.UserName, this.Password); GApp.GlobalCommandTarget.SilentNewConnection(p); if (file != null) this.SetLog((LogType) logType, file, true); */ #endregion // Save old log info in case this is a reconnect Poderosa.ConnectionParam.LogType logType = Poderosa.ConnectionParam.LogType.Default; string file = null; if (this.TerminalPane.Connection != null) { logType = this.TerminalPane.Connection.LogType; file = this.TerminalPane.Connection.LogPath; //GApp.GetConnectionCommandTarget().Close(); this.TerminalPane.Connection.Close(); this.TerminalPane.Detach(); } try { //------------------------------------------------------------------------ //edited by xavier (stond niet in een thread) System.Threading.ThreadPool.QueueUserWorkItem( o => { SSHTerminalParam sshp = new SSHTerminalParam((Poderosa.ConnectionParam.ConnectionMethod)this.Method, this.Host, this.UserName, this.Password); sshp.AuthType = this.AuthType; sshp.IdentityFile = this.IdentifyFile; sshp.Encoding = EncodingType.ISO8859_1; sshp.Port = 22; sshp.RenderProfile = new RenderProfile(); sshp.TerminalType = TerminalType.XTerm; sshp.ControlName = this.Name;//edited by xavier CommunicationUtil.SilentClient s = new CommunicationUtil.SilentClient(); Size sz = this.Size; SocketWithTimeout swt; swt = new SSHConnector((Poderosa.ConnectionParam.SSHTerminalParam)sshp, sz, sshp.Passphrase, (HostKeyCheckCallback)null); swt.AsyncConnect(s, sshp.Host, sshp.Port); ConnectionTag ct = s.Wait(swt); GalaSoft.MvvmLight.Threading.DispatcherHelper.CheckBeginInvokeOnUI(() => { this.TerminalPane.FakeVisible = true; this.TerminalPane.Attach(ct); ct.Receiver.Listen(); //------------------------------------------------------------- if (file != null) this.SetLog((LogType)logType, file, true); this.TerminalPane.ConnectionTag.RenderProfile = new RenderProfile(); this.SetPaneColors(Color.White, Color.Black); }); }); } catch { //MessageBox.Show(e.Message, "Connection Error"); return; } }
public HostKeyChecker(IWin32Window parent, SSHTerminalParam param) { _parentForm = parent; _tryingParam = param; }
public void Connect(Control control) { // Save old log info in case this is a reconnect Poderosa.ConnectionParam.LogType logType = Poderosa.ConnectionParam.LogType.Default; string file = null; if (this.TerminalPane.Connection != null) { logType = this.TerminalPane.Connection.LogType; file = this.TerminalPane.Connection.LogPath; //GApp.GetConnectionCommandTarget().Close(); this.TerminalPane.Connection.Close(); this.TerminalPane.Detach(); } try { //------------------------------------------------------------------------ SSHTerminalParam sshp = new SSHTerminalParam((Poderosa.ConnectionParam.ConnectionMethod)this.Method, this.Host, this.UserName, this.Password); sshp.AuthType = this.AuthType; sshp.IdentityFile = this.IdentifyFile; sshp.Encoding = EncodingType.ISO8859_1; sshp.Port = 22; sshp.RenderProfile = new RenderProfile(); sshp.TerminalType = TerminalType.XTerm; CommunicationUtil.SilentClient s = new CommunicationUtil.SilentClient(); Size sz = this.Size; SocketWithTimeout swt; swt = new SSHConnector((Poderosa.ConnectionParam.SSHTerminalParam)sshp, sz, sshp.Passphrase, (HostKeyCheckCallback)null); swt.AsyncConnect(s, sshp.Host, sshp.Port); //var thread = new Thread(() => // { while (swt.Succeeded == false) { Application.DoEvents(); } ct = s.Wait(swt); control.Invoke((MethodInvoker)( () => { this.TerminalPane.FakeVisible = true; this.TerminalPane.Attach(ct); ct.Receiver.Listen(); //------------------------------------------------------------- if (file != null) this.SetLog((LogType)logType, file, true); this.TerminalPane.ConnectionTag.RenderProfile = new RenderProfile(); this.SetPaneColors(Color.LightBlue, Color.Black); } )); // }); //start thread //thread.Start(); } catch { //MessageBox.Show(e.Message, "Connection Error"); return; } }
public SSHConnector(SSHTerminalParam param, Size size, string password, HostKeyCheckCallback keycheck) { _param = param; _size = size; _password = password; _keycheck = keycheck; }