检测要求输入密码的程序并传递正确的代码
我正在开发需要特定 VPN 连接的 Windows 服务。
我的问题是客户提供的解决方案(Rainbow iKey USB 棒)要求用户在每次启动 VPN 连接时输入 pin 码。这至少会在每天晚上发生,当有维护窗口时。
由于这是一项 Windows 服务并且旨在在服务器环境中运行,因此我不能依赖人们每天早上输入 PIN 码。
我需要检测何时出现“令牌登录”并传递正确的 pin 码 - 这可行吗?
I am working on a windows service that requires a specific VPN connection.
My problem is that the solution provided by the customer (Rainbow iKey usb stick) requires the user to enter a pin code for each time the VPN connection is initiated. This will happen at least every night, when there is a maintenance window.
As this is a windows service and intended to run in a server environment, I can't rely on people punching in the PIN code every morning.
I need to detect when the "Token login" appears and pass the correct pin code - is it doable?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
原来有一个适用于此 USB 密钥的 SDK。然而,它并不公开,直到我花了几天时间给提供商发电子邮件,他们才给了我 SDK 的链接以及试用许可证。
唯一的缺点是 SDK 是 C++ 6.0 dll。
Turns out there exists an SDK for this usb key. However, it's not publicly available and it was not until I had spent some days emailing the provider that they gave me a link to the SDK along with a trial license.
Only drawback is that the SDK is a C++ 6.0 dll.
AutoHotKey 是一款可能对您有所帮助的免费软件工具。它主要用于编写可以绑定到键盘上的按键的脚本(因此得名),但它的脚本语言非常灵活。我用它来编写位于后台的脚本,等待特定窗口的出现,然后自动与该窗口进行交互——这听起来正是您所需要的(如果对话框没有针对编程进行强化)汉斯理论中的操纵)。
AutoHotKey is a freeware tool that might help you. It's primarily meant for writing scripts that you can bind to keys on the keyboard (hence the name), but its scripting language is pretty flexible. I've used it to write scripts that sit in the background, waiting for a particular window to appear, and then automatically interact with that window for me -- which sounds like exactly what you need (if the dialog isn't hardened against programmatic manipulation as Hans theorized).
有一个名为 AutoIt 的工具可能可以解决这个问题。我对 Autoit 没有经验,但您可以使用它自动执行此类操作:等待特定窗口出现,键入文本,单击按钮。
There is a tool named AutoIt which possibly can do the trick. I'm not experienced with Autoit, but you can automate such things with it: Wait for a specific window to appear, type text, click buttons.
如果您使用 shell 脚本调用 VPN,则可以使用
发送密钥
。SendKeys
的成功很大程度上取决于 iKey 如何实现其提示。祝你好运。If you use a shell script for invoking the VPN, you can use
SendKeys
.The success of
SendKeys
will depend a lot on how the iKey implements its prompt. So good luck.