pynput键盘侦听器在MacOS x中不做全球工作
我正在使用pynput在Macos Monterey上录制击键,并修复了该问题,其中说“这个过程不信任...”,因为我登录时,但在登录屏幕上仍然显示。我知道MacOS正在阻止此操作,以防止钥匙记录员获取您的密码,但实际上我想要它可以在那里工作。
如果有帮助,这是我的代码:
#! usr/bin/python3
from pynput.keyboard import Key, Listener
import logging
logging.basicConfig(filename=("keylog.txt"), level=logging.DEBUG, format=" %(asctime)s - %(message)s")
def on_press(key):
logging.info(str(key))
with Listener(on_press=on_press) as listener :
listener.join()
# This code simply writes the keystrokes to a file.
我希望在登录屏幕上工作的原因是因为MacOS停止PYNPUT过程,因为该程序不信任。我希望该程序继续运行。
那么,如何在所有用户,甚至在登录屏幕上都能使此代码在MacOS上在MacOS上工作?
I am using pynput to record keystrokes on MacOS Monterey, and I fixed the issue where it says "This process isn't trusted ..." for when I'm logged in, but on the login screen it still shows. I understand that MacOS is blocking this to prevent a keylogger from getting your password, but I actually want it to work there.
Here's my code if it helps:
#! usr/bin/python3
from pynput.keyboard import Key, Listener
import logging
logging.basicConfig(filename=("keylog.txt"), level=logging.DEBUG, format=" %(asctime)s - %(message)s")
def on_press(key):
logging.info(str(key))
with Listener(on_press=on_press) as listener :
listener.join()
# This code simply writes the keystrokes to a file.
The reason I want this to work on the login screens is because the program stops itself once MacOS stops the pynput process because it's not trusted. I want the program to keep running.
So, how can I get this code to work globally on MacOS, throughout all users, and even in the login screen?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论