键盘记录器仅在使用特定应用程序时使用

Keylogger only used when using a specific application

我应该注意什么 tools/references 让定制的键盘记录器仅在用户输入专有公司应用程序时捕获数据?

例如,当用户输入 excel 时没有任何反应。当他们切换到 word 时,我的应用程序意识到了这一点,并捕获了数据。请记住,我希望它能与我们专有的(不可修改的)软件结合使用,所以我不能指望目标程序在这个过程中提供帮助。

我打算用 VBscript 或 JavaScript 编写。只是一个业余码农。

我希望这是有道理的。欢迎提出建议!

set service = GetObject ("winmgmts:")

for each Process in Service.InstancesOf ("Win32_Process")
    If Process.Name = "Progranametocheck.exe" then
        wscript.echo "Progranametocheck is running"
        wscript.quit
    End If
next
wscript.echo "Progranametocheck is not running"

上面的代码 (VBscript) 检查程序是 运行ning,并弹出一个窗口告诉你它是否 运行ning。要 运行 一个程序,如果一个程序 运行ning 替换:"wscript.echo "Progranametocheck is 运行ning" 为:

Set objShell = Nothing
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run("""C:\dir\logger.exe""")
Set objShell = Nothing

所以加在一起就变成了:

set service = GetObject ("winmgmts:")

for each Process in Service.InstancesOf ("Win32_Process")
    If Process.Name = "Progranametocheck.exe" then
        Set objShell = Nothing
        Set objShell = WScript.CreateObject("WScript.Shell")
        objShell.Run("""C:\dir\logger.exe""")
        Set objShell = Nothing
        wscript.quit
    End If
next
wscript.echo "Progranametocheck is not running"