keylogger

Capturing Keystrokes in GNU/Linux in C without X11

只愿长相守 提交于 2019-11-27 00:47:14
问题 If I am working in an application and I press key from keyboard, how can I capture that key (or string), including the source application's name, in C, under GNU/LINUX, in userland, without X11 :) Thanks. 回答1: Well, without X11 this problem is way more difficult. For the keystroke part you can use a code similar to this one, but you have to pass as an argument the device that you are reading (keyboard, usually /dev/input/event0 ) #include <linux/input.h> #include <sys/types.h> #include <sys

How can I write a key listener to track all keystrokes in Java? [closed]

邮差的信 提交于 2019-11-26 05:30:02
问题 I want to write a key listener in Java. It should track all the key presses regardless of whether the Java app has focus or not. Is this possible? 回答1: It's possible but requires an implementation taking advantage of JNI which will not always be portable. Java System Hook is one such library that will work with Windows 32 & 64 bit. 回答2: I used something like that a while ago. Take a look at Java System Hook. It tracks global key presses (not just your Java application) via JNI. It worked fast

How to handle key press event in console application

假如想象 提交于 2019-11-26 05:17:59
I want to create a console application that will display the key that is pressed on the console screen, I made this code so far: static void Main(string[] args) { // this is absolutely wrong, but I hope you get what I mean PreviewKeyDownEventArgs += new PreviewKeyDownEventArgs(keylogger); } private void keylogger(KeyEventArgs e) { Console.Write(e.KeyCode); } I want to know, what should I type in main so I can call that event? For console application you can do this, the do while loop runs untill you press x public class Program { public static void Main() { ConsoleKeyInfo keyinfo; do { keyinfo

How to handle key press event in console application

╄→гoц情女王★ 提交于 2019-11-26 01:54:23
问题 I want to create a console application that will display the key that is pressed on the console screen, I made this code so far: static void Main(string[] args) { // this is absolutely wrong, but I hope you get what I mean PreviewKeyDownEventArgs += new PreviewKeyDownEventArgs(keylogger); } private void keylogger(KeyEventArgs e) { Console.Write(e.KeyCode); } I want to know, what should I type in main so I can call that event? 回答1: For console application you can do this, the do while loop