Global keylogger in Java

二次信任 提交于 2019-11-28 02:11:34

You need a bit of C/C++ code and call SetWindowsHookEx This function allows you to hook into Windows events and receive a copy.

This question contains code to get you started: JNA Keyboard Hook in Windows

If you want to do this for only your application, then its very simple. You can simply add listerns i.e Toolkit.getDefaultToolkit.addAwtEventListener(..).

But for the system as a whole, I am afraid, it cannot be done in java, you may use JNI though.

Alon

If you only want to monitor activity in Java application windows, it's trivial – all you have to do is register to the appropriate event.

But to monitor all mouse and keyboard activity in the OS you will have to hook to the API which is platform dependent and will require using the JNI

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!