private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { //Create New RDP Object rdp = null; rdp = new AxMSTSCLib.AxMsTscAxNotSafeForScripting(); rdp.Size = new Size(1430, this.Height - 80); //Get Selected Node TreeNode nodClicked = e.Node; RDP selectedRDP = repo.Find(x => x.serverName == nodClicked.Text); if (selectedRDP.serverIP == "-1") { return; } try { //Check if connection is already open foreach (TabPage t in rdpTabs.TabPages) { if (t.Text == nodClicked.Text) { throw new InvalidConstraintException("connection is already up"); } } //Building the tab TabPage tab = new TabPage(selectedRDP.serverName); tab.Controls.Add(rdp); rdpTabs.TabPages.Add(tab); rdpTabs.SelectedIndex = rdpTabs.TabPages.Count - 1; IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx(); rdp.Server = selectedRDP.serverIP; rdp.UserName = selectedRDP.username; secured.ClearTextPassword = selectedRDP.password; rdp.Connect(); } catch (InvalidConstraintException x) { MessageBox.Show(x.Message, x.Message + " for " + selectedRDP.serverName, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch {} /* * try * { * // Check if connected before disconnecting * if (rdp.Connected.ToString() == "1") * rdp.Disconnect(); * } * catch (Exception Ex) * { * MessageBox.Show("Error Disconnecting", "Error disconnecting from remote desktop " + txtServer.Text + " Error: " + Ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); * } */ }
public void Connect(string ip, int port, string user, string pass) { try { this.timeOutLog.Start(); this.AdvancedSettings.Compress = 1; this.Height = 1; this.Width = 1; this.Password = pass; this.ColorDepth = 4; this.Server = ip; this.UserName = user; this.AdvancedSettings4.EnableMouse = 0; this.AdvancedSettings4.EnableWindowsKey = 0; this.AdvancedSettings4.RDPPort = port; IMsTscNonScriptable secured = (IMsTscNonScriptable)this.GetOcx(); secured.ClearTextPassword = pass; this.Connect(); } catch (Exception e) { timeOutLog.Stop(); throw e; } }
/// <summary> /// “连接”按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Connect_Click(object sender, RoutedEventArgs e) { try { string ip = ((sender as Button).DataContext as device).Ip; string username = ((sender as Button).DataContext as device).Username; string password = ((sender as Button).DataContext as device).Password; var form = new System.Windows.Forms.Form(); form.Text = ip; form.Size = new System.Drawing.Size((int)SystemParameters.PrimaryScreenWidth, (int)SystemParameters.PrimaryScreenHeight); var axmstsc = new AxMsTscAxNotSafeForScripting(); ((System.ComponentModel.ISupportInitialize)(axmstsc)).BeginInit(); form.Controls.Add(axmstsc); ((System.ComponentModel.ISupportInitialize)(axmstsc)).EndInit(); Desktop desk = new Desktop(); desk.Title = ip; //WindowsFormsHost wfh = new WindowsFormsHost(); axmstsc.Height = (int)SystemParameters.PrimaryScreenHeight; axmstsc.Width = (int)SystemParameters.PrimaryScreenWidth; //wfh.Child = axmstsc; axmstsc.Server = ip; axmstsc.UserName = username; IMsTscNonScriptable secured = (IMsTscNonScriptable)axmstsc.GetOcx(); secured.ClearTextPassword = password; axmstsc.Connect(); form.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void Connect(string machineName, string displayName, string username, string password, string domain) { if (axMsTscAxNotSafeForScripting.Connected == 0) { _disconnectRequested = false; axMsTscAxNotSafeForScripting.Server = machineName; axMsTscAxNotSafeForScripting.UserName = username; axMsTscAxNotSafeForScripting.Domain = domain; axMsTscAxNotSafeForScripting.ConnectingText = $"Connecting to {machineName}"; axMsTscAxNotSafeForScripting.DesktopWidth = Screen.PrimaryScreen.Bounds.Width - 50; axMsTscAxNotSafeForScripting.DesktopHeight = Screen.PrimaryScreen.Bounds.Height - 63; IMsRdpClientAdvancedSettings7 advancedSettings = (IMsRdpClientAdvancedSettings7)axMsTscAxNotSafeForScripting.AdvancedSettings; advancedSettings.AuthenticationLevel = 2; advancedSettings.EnableCredSspSupport = true; advancedSettings.SmartSizing = true; advancedSettings.BitmapPersistence = 1; IMsTscNonScriptable secureSettings = (IMsTscNonScriptable)axMsTscAxNotSafeForScripting.GetOcx(); secureSettings.ClearTextPassword = password; DisplayName.Text = displayName; axMsTscAxNotSafeForScripting.Connect(); } }
private void pfull_Click(object sender, EventArgs e) { FrmFullScreen f = new FrmFullScreen(); f.username = username; f.password = password; f.ip = ip; zoom = true; remote1.Disconnect(); f.Height = Screen.PrimaryScreen.WorkingArea.Height; f.Width = Screen.PrimaryScreen.WorkingArea.Width; f.Top = 0; f.Left = 0; if (f.ShowDialog() == DialogResult.OK) { pload.Visible = true; remote1.Server = ip; remote1.UserName = username; IMsTscNonScriptable secured = (IMsTscNonScriptable)remote1.GetOcx(); secured.ClearTextPassword = password; remote1.Connect(); } else { pclose_Click(sender, e); } zoom = false; }
private void Form1_Load(object sender, EventArgs e) { WebClient webclientForIP = new WebClient(); string IPdefine = File.ReadAllText("..\\..\\P01.txt"); AES aes = new AES(); // string IPdefine = webclientForIP.DownloadString("https://raw.githubusercontent.com/arisosoftware/RemoteDesk/master/RemoteAccess/P01.txt"); string decoded = aes.DecryptString(IPdefine); Console.WriteLine(decoded); MSTSCConfig cfg = RemoteAccess.Program.SerializeFromString(decoded) as MSTSCConfig; this.axMsRdpClient71.Server = cfg.ServerIP; this.axMsRdpClient71.UserName = cfg.usrname; IMsTscNonScriptable secured = (IMsTscNonScriptable)this.axMsRdpClient71.GetOcx(); this.axMsRdpClient71.OnConnected += new EventHandler(axMsRdpClient71_OnConnected); this.axMsRdpClient71.OnFatalError += new AxMSTSCLib.IMsTscAxEvents_OnFatalErrorEventHandler(axMsRdpClient71_OnFatalError); secured.ClearTextPassword = cfg.password; this.axMsRdpClient71.Connect(); }
private void btnConnect_Click(object sender, EventArgs e) { string serverip = txtServerIP.Text; string username = txtUserName.Text; string password = txtPassword.Text; if (string.IsNullOrEmpty(serverip)) { MessageBox.Show("服务器IP不能为空!", "温馨提示"); return; } if (string.IsNullOrEmpty(username)) { MessageBox.Show("用户名不能为空!", "温馨提示"); return; } if (string.IsNullOrEmpty(password)) { MessageBox.Show("密码不能为空!", "温馨提示"); return; } try { axMsTscAxNotSafeForScripting1.Server = txtServerIP.Text; axMsTscAxNotSafeForScripting1.UserName = txtUserName.Text; IMsTscNonScriptable secured = (IMsTscNonScriptable)axMsTscAxNotSafeForScripting1.GetOcx(); secured.ClearTextPassword = txtPassword.Text; axMsTscAxNotSafeForScripting1.Connect(); } catch (Exception ex) { MessageBox.Show(ex.Message, "温馨提示"); } }
private void RDPClientForm_Load(object sender, EventArgs e) { axMsTscAxNotSafeForScripting1.Server = mDevice.DeviceIP; axMsTscAxNotSafeForScripting1.UserName = mDevice.DeviceUser; IMsTscNonScriptable secured = (IMsTscNonScriptable)axMsTscAxNotSafeForScripting1.GetOcx(); secured.ClearTextPassword = mDevice.DevicePwd; axMsTscAxNotSafeForScripting1.Connect(); }
private void button1_Click(object sender, EventArgs e) { MSTerminalServiceControl1.Server = textBox1.Text; MSTerminalServiceControl1.UserName = textBox2.Text; IMsTscNonScriptable secured = (IMsTscNonScriptable)MSTerminalServiceControl1.GetOcx(); secured.ClearTextPassword = textBox3.Text; MSTerminalServiceControl1.Connect(); }
private void Btnconnect_Click(object sender, EventArgs e) { axMsTscAxNotSafeForScripting1.Server = textBox1.Text; axMsTscAxNotSafeForScripting1.UserName = textBox2.Text; IMsTscNonScriptable guvenlik = (IMsTscNonScriptable)axMsTscAxNotSafeForScripting1.GetOcx(); guvenlik.ClearTextPassword = textBox3.Text; axMsTscAxNotSafeForScripting1.Connect(); }
//rdp建立连接用通用函数 public void StartConnection(string IpName, String UserName, String PassWord) { rdp.Server = IpName; //rdp为窗体名字,rdp.Server设置IP rdp.UserName = UserName; //用户名 IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx(); secured.ClearTextPassword = PassWord;//密码 rdp.Connect(); }
private void connectbtn_Click(object sender, EventArgs e) //Connects to RDP server { rdp.Server = serverNameBox.Text; rdp.UserName = usernameBox.Text; IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx(); secured.ClearTextPassword = psswordBox.Text; rdp.Connect(); }
/// <summary> /// Apply the values of SecuredSettings to the internal RDP ActiveX component /// Override in derived classes to extend the settings that apply to a given version. Always call /// the ancestor version. /// </summary> protected virtual void ApplySecuredSettings() { IMsTscNonScriptable secured = (IMsTscNonScriptable)internalMsClient.GetOcx(); secured.ClearTextPassword = SecuredSettings.ClearTextPassword; //secured.BinaryPassword = SecuredSettings.BinaryPassword; //secured.BinarySalt = SecuredSettings.BinarySalt; //secured.PortablePassword = SecuredSettings.PortablePassword; //secured.PortableSalt = SecuredSettings.PortableSalt; }
private void btnConnect_Click(object sender, EventArgs e) { if (btnConnect.Text == "链接") { //MessageBox.Show("正在准备链接..."); //if() if (string.IsNullOrEmpty(cbxserver.Text) || string.IsNullOrEmpty(cbxusername.Text) || string.IsNullOrEmpty(txtpassword.Text)) { MessageBox.Show("请输入一个有效的远程连接信息———主机IP,端口号,用户名,密码!", "登录失败提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); } else { rdpClient.Server = cbxserver.Text; rdpClient.UserName = cbxusername.Text; rdpClient.AdvancedSettings2.RDPPort = 3389; rdpClient.AdvancedSettings2.SmartSizing = true; rdpClient.AdvancedSettings9.NegotiateSecurityLayer = true; IMsTscNonScriptable secured = (IMsTscNonScriptable)rdpClient.GetOcx(); secured.ClearTextPassword = txtpassword.Text; rdpClient.AdvancedSettings5.ClearTextPassword = txtpassword.Text; rdpClient.ColorDepth = 24; //rdpClient.Width = this.Size.Width; //rdpClient.Height = this.Size.Height; //rdpClient.DesktopWidth = this.Size.Width; //rdpClient.DesktopHeight = this.Size.Height; //rdpClient.FullScreenTitle = "this is test"; rdpClient.Connect(); btnConnect.Text = "Disconnect"; btnConnect.BackColor = Color.Red; } } else { btnConnect.Text = "Connect"; btnConnect.BackColor = Color.PaleGreen; try { rdpClient.Disconnect(); } catch (Exception) { } rdpClient.Refresh(); } }
private void timer1_Tick(object sender, EventArgs e) { remote1.Server = ip; remote1.UserName = username; IMsTscNonScriptable secured = (IMsTscNonScriptable)remote1.GetOcx(); secured.ClearTextPassword = password; remote1.Connect(); timer1.Enabled = false; panel1.Visible = false; }
public void connect() { rdp.Server = Form1.sRDPServer; IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx(); //The following 2 settings are for NLA support rdp.AdvancedSettings5.AuthenticationLevel = 2; if (Form1.NLA == true) { rdp.AdvancedSettings7.EnableCredSspSupport = true; } else { rdp.AdvancedSettings7.EnableCredSspSupport = false; } if (Form1.sRDPGateway != "") { //The following 4 settings are for RDP gateways rdp.TransportSettings2.GatewayProfileUsageMethod = 1; rdp.TransportSettings2.GatewayUsageMethod = 2; rdp.TransportSettings2.GatewayCredsSource = 0; rdp.TransportSettings2.GatewayHostname = Form1.sRDPGateway; } else { rdp.TransportSettings2.GatewayUsageMethod = 0; } if (Form1.FullScreen == true) { rdp.FullScreen = true; } rdp.ConnectingText = "Connecting..."; rdp.AdvancedSettings2.overallConnectionTimeout = Form1.iTimeout; //test for port rdp.AdvancedSettings2.RDPPort = Form1.iRDPPort; rdp.AdvancedSettings2.SmartSizing = true; disconnectedEventHandler = new AxMSTSCLib.IMsTscAxEvents_OnDisconnectedEventHandler(rdp_OnDisconnected); rdp.OnDisconnected += disconnectedEventHandler; rdp.OnChannelReceivedData += new AxMSTSCLib.IMsTscAxEvents_OnChannelReceivedDataEventHandler(rdp_OnChannelReceivedData); if (hasbeenconnected == false) { rdp.CreateVirtualChannels("Loki1,Fenrir"); hasbeenconnected = true; } rdp.Connect(); }
private void btn_conn_Click(object sender, EventArgs e) { if (btn_conn.Text == "连接") { if (tb_server.Text == "") { MessageBox.Show("请输入主机地址"); return; } if (tb_user.Text == "") { MessageBox.Show("请输入用户名"); return; } if (tb_pwd.Text == "") { MessageBox.Show("请输入密码"); return; } try { rdp.Server = tb_server.Text; rdp.UserName = tb_user.Text; IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx(); secured.ClearTextPassword = tb_pwd.Text; rdp.Connect(); btn_conn.Text = "断开连接"; btn_conn.BackColor = Color.Red; } catch (Exception Ex) { MessageBox.Show("无法链接远程主机" + Ex.Message); return; } } else { btn_conn.Text = "连接"; btn_conn.BackColor = Color.PaleGreen; try { rdp.Disconnect(); } catch (Exception Ex) { MessageBox.Show("断开连接失败" + Ex.Message); return; } rdp.Refresh(); } }
public void Connect(string ip, string user, string pass) { timeOutLog.Interval = ItimeOutLog; timeOutTotal.Interval = ItimeOutTotal; timeOutTotal.Start(); Password = pass; Server = ip; UserName = user; IMsTscNonScriptable secured = (IMsTscNonScriptable)GetOcx(); secured.ClearTextPassword = pass; Respponse(ResponseType.Connecting); Connect(); }
/// <summary> /// Конструктор дополнительно инициализирует объект для работы с RDP /// </summary> /// <param name="IP"></param> /// <param name="userName"></param> /// <param name="password"></param> public Form1(string IP, string userName, string password) { InitializeComponent(); rdp.Server = IP; rdp.UserName = userName; IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx(); secured.ClearTextPassword = password; rdp.AdvancedSettings8.EnableCredSspSupport = true; this.Opacity = 0; this.ShowInTaskbar = false; }
private void button1_Click(object sender, EventArgs e) { try { axMsTscAxNotSafeForScripting1.Server = textBox1.Text; axMsTscAxNotSafeForScripting1.UserName = textBox2.Text; IMsTscNonScriptable secured = (IMsTscNonScriptable)axMsTscAxNotSafeForScripting1.GetOcx(); secured.ClearTextPassword = textBox3.Text; axMsTscAxNotSafeForScripting1.Connect(); } catch (Exception Ex) { MessageBox.Show("Bağlantı Hatası", "Pc’ye Ulaşılamadı." + "Hata:" + Ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnConnect_Click(object sender, EventArgs e) { try { rdp.Server = tbServer.Text; rdp.UserName = tbUsername.Text; IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx(); secured.ClearTextPassword = tbPassword.Text; rdp.Connect(); } catch (Exception ex) { MessageBox.Show("Something went wrong" + ex.StackTrace, "Click on ok" + MessageBoxButtons.OK); } }
private void button1_Click(object sender, EventArgs e) { try { rdp.Server = txtServer.Text; rdp.UserName = txtUserName.Text; IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx(); secured.ClearTextPassword = txtPassword.Text; rdp.Connect(); } catch (Exception Ex) { MessageBox.Show("Error Connecting", "Error connecting to remote desktop " + txtServer.Text + " Error: " + Ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btn_connect_Click(object sender, EventArgs e) { try { rdp.Server = tb_servername.Text; rdp.Server = tb_username.Text; rdp.Server = tb_password.Text; IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx(); secured.ClearTextPassword = tb_password.Text; rdp.Connect(); } catch (Exception ex) { MessageBox.Show("Error", "Error" + tb_servername.Text + "Error" + ex.Message, MessageBoxButtons.OK); } }
private void Connect_Click_1(object sender, EventArgs e) { try { remote.Server = hostiptextbox.Text; remote.UserName = usertextbox.Text; IMsTscNonScriptable secured = (IMsTscNonScriptable)remote.GetOcx(); secured.ClearTextPassword = passwordtextbox.Text; remote.Connect(); } catch { label4.Text = "Connection Status: ERROR"; } }
private void bruteForceBaşlaToolStripMenuItem_Click(object sender, EventArgs e) { for (int i = 0; i < servernam.Count; i++) { rdp.Server = servernam[i].ToString(); for (int j = 0; j < user.Count; j++) { rdp.UserName = user[j].ToString(); IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx(); secured.ClearTextPassword = pass[i].ToString(); rdp.Connect(); } } }
private void btnConnect_Click(object sender, EventArgs e) { rdpClient.Server = "192.168.3.162"; rdpClient.UserName = "******"; rdpClient.AdvancedSettings2.RDPPort = 3389; rdpClient.AdvancedSettings2.SmartSizing = true; rdpClient.AdvancedSettings8.NegotiateSecurityLayer = true; IMsTscNonScriptable secured = (IMsTscNonScriptable)rdpClient.GetOcx(); secured.ClearTextPassword = "******"; rdpClient.AdvancedSettings5.ClearTextPassword = "******"; rdpClient.ColorDepth = 24; rdpClient.Connect(); }
private void frm_RemoteDesktop_Load(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; RDC.Server = "server"; RDC.UserName = frm_Home.Username + "\\" + frm_RDCInput.user.ToString(); IMsTscNonScriptable secured = (IMsTscNonScriptable)RDC.GetOcx(); secured.ClearTextPassword = frm_RDCInput.password.ToString(); RDC.Connect(); this.Cursor = Cursors.Default; } catch (Exception E) { MessageBox.Show(E.ToString()); } }
public Form3(RemoteMachine remoteMachine) { InitializeComponent(); rdp.Width = this.Size.Width; rdp.Height = this.Size.Height; rdp.Server = remoteMachine.Server; rdp.UserName = remoteMachine.UserName; IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx(); secured.ClearTextPassword = remoteMachine.Password; rdp.Dock = DockStyle.Fill; this.Text = remoteMachine.DesktopName; //if (!string.IsNullOrEmpty(remoteMachine.Password)) //rdp.AdvancedSettings5.ClearTextPassword = remoteMachine.Password; rdp.AdvancedSettings5.RedirectDrives = remoteMachine.RedirectDrives; rdp.AdvancedSettings5.RedirectPrinters = remoteMachine.RedirectPrinters; rdp.AdvancedSettings5.RedirectPorts = remoteMachine.RedirectPorts; }
public Form2(string ip, string user, string pass) { this.TopMost = true; //this.FormBorderStyle = FormBorderStyle.None; this.WindowState = FormWindowState.Maximized; InitializeComponent(); panel1.Dock = DockStyle.Bottom; panel1.BackColor = Color.FromArgb(70, 0, 0, 0); panel1.Visible = false; axMsRdpClient71.Dock = DockStyle.Fill; axMsRdpClient71.Server = ip; axMsRdpClient71.UserName = user; IMsTscNonScriptable secured = (IMsTscNonScriptable)axMsRdpClient71.GetOcx(); secured.ClearTextPassword = pass; axMsRdpClient71.AdvancedSettings8.AuthenticationLevel = 2; axMsRdpClient71.AdvancedSettings8.EnableCredSspSupport = true; axMsRdpClient71.AdvancedSettings8.NegotiateSecurityLayer = false; axMsRdpClient71.AdvancedSettings8.RelativeMouseMode = true; axMsRdpClient71.AdvancedSettings.BitmapPeristence = 1; axMsRdpClient71.AdvancedSettings.Compress = 1; axMsRdpClient71.AdvancedSettings8.SmartSizing = true; //axMsRdpClient71.DesktopHeight = 1366; //axMsRdpClient71.DesktopWidth = 768; axMsRdpClient71.FullScreen = false; axMsRdpClient71.ColorDepth = 32; axMsRdpClient71.AdvancedSettings8.RedirectDrives = false; axMsRdpClient71.AdvancedSettings8.RedirectPrinters = false; axMsRdpClient71.AdvancedSettings8.RedirectClipboard = true; axMsRdpClient71.AdvancedSettings8.RedirectSmartCards = false; axMsRdpClient71.Connect(); }
/// <summary> /// При загрузке формы. /// </summary> private void MSTSC_Load(object sender, EventArgs e) { CMD cmd = new CMD(); Text = " " + _server; try { rdp.Dock = DockStyle.Fill; rdp.Server = _server; //rdp.UserName = _login; IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx(); // secured.ClearTextPassword = _pass; rdp.Connect(); } catch { MessageBox.Show("Ошибка при подключении к удаленному серверу.", "Servers View", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); } }