是否可以恢复 Mac OS 启动时完成的键盘输入?

发布于 2024-08-17 04:28:02 字数 443 浏览 3 评论 0原文

我想知道是否有可能弄清楚用户在 Mac 操作系统启动时按下了哪些键?

任何方式都可以。据我了解,没有简单的方法可以简单地挂钩应用程序/脚本来开始工作并与操作系统同时捕获击键。但也许有一种方法可以对此进行某种逆向工程?也许查看特定的日志文件或类似的东西?

任何结果都可以。基本上我感兴趣的是找出用户在操作系统启动期间按下/按住的键。它可能是字符串、字符代码或十六进制,并不重要。

更新:根据 Pekka 的建议,我找到了一个可以完成这项工作的内核扩展。在这个后续问题之后,希望它能够做到这一点 - 为什么这个键盘拦截内核扩展不起作用? 已得到解答。 :)

I wonder if it is possible to figure out what keys user was pressing while his Mac OS was starting up?

Any way will do. As far as I understand it there is no easy way to simply hook an app/script to start working and capturing keystrokes simultaneously along with the OS. But maybe there is a way to some kind of reverse engineer this? Maybe looking into a specific log file or something like that?

Any results will do. Basically what I'm interested in is in finding out, which key the user pressed/held during the OS startup. It may be string, a character code or a hex, doesn't really matter.

UPDATE: guided by Pekka's advice I've found a kernel extension that should do the job. And it, hopefully, will do it, after this follow-up question - Why this keyboard intercepting kernel extension doesn’t work? is answered. :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

千鲤 2024-08-24 04:28:02

我不是操作系统专家,但我认为非常非常困难。我不认为这样的东西会自动记录在任何地方。

我想您必须查看系统中处理启动的部分键 可以以某种方式访问​​,并且可以扩展以调用您定义的命令。

第二个想到的最好的事情是让您编写某种自定义设备驱动程序或启动脚本,在启动时加载并侦听按键事件。

I'm no OS guru, but I think very, very, very hardly. I don't suppose stuff like this is automatically recorded anywhere.

I guess you would have to look whether the part of the system that handles the startup keys is somehow accessible, and can be extended to invoke a command defined by you.

The second best thing that comes to mind is for you to write some sort of custom device driver or startup script that gets loaded at startup, and listens to keypress events.

江湖正好 2024-08-24 04:28:02

如何解决这个问题完全取决于 启动过程您要检查密钥。

  • 如果你想尽早检查,你唯一的选择就是使用 EFI(固件)环境 - 也许你可以修改 rEFIt 来做你想做的事?
  • 固件之后,控制权传递给 boot.efi(PPC Mac 上的 BootX)。这可能会被替换/黑客攻击,我希望源代码可以作为 Darwin,但我在快速检查中没有看到它。
  • 之后,内核加载(您可以构建自己的内核)带有一组最小的缓存驱动程序(您可以编写一个驱动程序,但不确定如何让它被缓存)。
  • 之后,各种各样的事情或多或少同时发生。加载普通驱动程序,运行 /etc/rc.local, /System/Library/LaunchDaemons 中的启动项 和 Library/LaunchDaemons 变为活动状态...如果您愿意等到启动过程的此阶段,您有很多选择。

How to approach this depends completely on what point in the boot process you want to check for keys.

  • If you want to check really early, your only choice is to play with the EFI (firmware) environment -- maybe you could modify rEFIt to do what you want?
  • After the firmware, control passes to boot.efi (BootX on PPC Macs). This could presumably be replaced/hacked, and I'd expect the source to be available from as part of Darwin, but I don't see it on a quick inspection.
  • After that, the kernel loads (you could build your own kernel) with a minimal set of cached drivers (you could write a driver, not sure how to get it to be cached, though).
  • After that, all sorts of things happen more or less at once. Normal drivers get loaded, /etc/rc.local gets run, launchd items in /System/Library/LaunchDaemons and Library/LaunchDaemons become active... If you're willing to wait until this phase of the boot process, you have many options.
三生殊途 2024-08-24 04:28:02

它不仅没有在任何地方记录,而且在启动过程中很长一段时间都没有键盘驱动程序。因此,从软件的角度来看,在这段时间内键盘根本不存在。

It's not just not recorded anywhere, for quite a while during startup there is no keyboard driver. So from the point of view of software, during that interval the keyboard simply doesn't exist.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文