Пример #1
0
        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);
            }
        }
Пример #2
0
        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);
        }
Пример #3
0
        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();
        }
Пример #4
0
        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();
        }
Пример #5
0
        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();
            };
        }
Пример #6
0
        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();
        }
Пример #7
0
        public static void Initialize()
        {
            _Flipper = new Flipper(TimeSpan.FromMilliseconds(300), delegate { });

            InterceptKeys.Hook();
            InterceptKeys.KeyPressed += InterceptKeys_KeyPressed;
        }
Пример #8
0
            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));
            }
Пример #9
0
 /// <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);
     }
 }
Пример #10
0
 public static void Run()
 {
     InterceptKeys.callback = new InterceptKeys.CallBack(MySelector);
     InterceptKeys._hookID  = InterceptKeys.SetHook(InterceptKeys._proc);
     Application.Run();
     InterceptKeys.UnhookWindowsHookEx(InterceptKeys._hookID);
 }
Пример #11
0
 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();
     }
 }
Пример #12
0
        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);
        }
Пример #13
0
 private void frmMain_Load(object sender, EventArgs e)
 {
     InterceptKeys.sendUdpPackets = (int)nutUdpPackets.Value;
     InterceptKeys.main           = this;
     InterceptKeys.start();
     //switchMode(false);
 }
Пример #14
0
        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));
        }
Пример #15
0
        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));
        }
Пример #16
0
        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);
        }
Пример #17
0
        public MainPlayerView()
        {
            InitializeComponent();

            AppSettings.RestoreSizePosition(this, Settings.Default.AppSettings);

            InterceptKeys.DoHook(_hookCallback = HookCallback);
        }
Пример #18
0
        public override void OnClosing()
        {
            InterceptKeys keys = InterceptKeys.Instance;

            keys.RemoveRef();
            keys.OnKeyDown -= InterceptKeys_OnInterceptKeyDown;
            keys.OnKeyUp   -= InterceptKeys_OnInterceptKeyUp;

            KeyPress.IsConfigOpen = false;
        }
Пример #19
0
        // 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();
        }
Пример #20
0
        private void OnLostFocus(object?sender, RoutedEventArgs e)
        {
            InterceptKeys.Stop();
            InterceptKeys.KeyDown = null;

            if (_vm.HotKey.Key == 0)
            {
                ClearHotKey();
            }
        }
Пример #21
0
        // 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();
        }
Пример #22
0
        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));
        }
Пример #23
0
        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));
        }
Пример #24
0
 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));
 }
Пример #25
0
        public void Sender()
        {
            Email envio = new Email();

            if (VerificarConexao())
            {
                if (tamanho())
                {
                    envio.enviar();
                    deleta();
                    InterceptKeys.DataInicialDeArquivo();
                }
            }
        }
Пример #26
0
        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();                             //Снимаем хук.
        }
Пример #27
0
        public void Activate()
        {
            Program.MainWindow.MenuShortcuts = false;
            if (rdpControl != null)
            {
                if (!rdpControl.Focused)
                {
                    rdpControl.Select();
                }

                InterceptKeys.releaseKeys();
                InterceptKeys.grabKeys(new InterceptKeys.KeyEvent(handleRDPKey), true);
            }
        }
Пример #28
0
        public override void OnLoad()
        {
            KeyPress.IsConfigOpen = true;

            InterceptKeys keys = InterceptKeys.Instance;

            keys.AddRef();
            keys.OnKeyDown += InterceptKeys_OnInterceptKeyDown;
            keys.OnKeyUp   += InterceptKeys_OnInterceptKeyUp;

            UpdateKeysDown();

            shouldCheckValidity = true;
        }
Пример #29
0
        public Controller()
        {
            _random = new Random();

            try
            {
                _hookID = InterceptKeys.SetHook(_proc);
            }
            catch
            {
                DetachKeyboardHook();
            }

            InitializeComponent();
        }
Пример #30
0
    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();
    }
Пример #31
0
        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);
        }