开发者

NASM keyboard emulation

开发者 https://www.devze.com 2023-02-23 18:37 出处:网络
I have been doing basic NASM coding, and I wondered开发者_开发百科 if it is possible to emulate a keypress using NASM. If so, how?

I have been doing basic NASM coding, and I wondered开发者_开发百科 if it is possible to emulate a keypress using NASM. If so, how?

I'm using Ubuntu linux 10.04 and a Pentium R T4300 processer if it matters.


There are several possible paths to proceed depending on what you want to do exactly. None of them are very simple (like for example in DOS) since there is no single globally accessable keyboard buffer in Linux. I don't think it's possible to inject events into the kernel driver for your keyboard (correct me if i'm wrong). Unless, of course, you modify the driver. You can create a virtual keyboard and configure your programs to read events from that in addition to your real one. Or if you only need it to work in a specific environment on top of Linux (for example X) you might find some usable function in it's API.

For some scenarios on the other hand it can be very simple. If you want to automatically answer some questions in an interactive terminal application you do it like: yes | someapplication or echo yyny | someapplication. Obviously what was shell code and not nasm code. Translating it is left as an exercise for the reader.

0

精彩评论

暂无评论...
验证码 换一张
取 消