[英]Inserting text from a C# WinForms application into a web browser textbox
I'm currently working on a WinForms application that I'm hoping will allow users to enter stored passwords into a web browser without a keylogger being able to see the password. 我目前正在开发一个WinForms应用程序,希望该应用程序允许用户在Web浏览器中输入存储的密码,而键盘记录程序却无法看到该密码。 I've got the storing part completed, but I can't figure out how to insert the password into a browser without using either the clipboard or .NET's SendKeys class, both of which can be seen by most keyloggers. 我已经完成了存储部分,但是我不知道如何在不使用剪贴板或.NET的SendKeys类的情况下将密码插入浏览器,大多数键盘记录程序都可以看到这两种类型。
I looked into using Windows messages to do this, but, from what I understand, you need to know the hWnd of a control in order to send it a Windows message. 我研究了使用Windows消息执行此操作的方法,但是据我了解,您需要了解控件的硬件才能向其发送Windows消息。 Unfortunately, it appears that web browsers do not use hWnds for individual textbox controls. 不幸的是,Web浏览器似乎没有对单个文本框控件使用hWnds。
I know there has to be a way to do this. 我知道必须有一种方法可以做到这一点。 In Notepad++, for example, you can drag text into a web browser textbox and the text doesn't show up in keyloggers. 例如,在Notepad ++中,您可以将文本拖到Web浏览器文本框中,而文本不会显示在键盘记录器中。 Same goes for Neo's SafeKeys. Neo的SafeKeys也是如此。 Anyone have any ideas on a general approach to doing this? 有人对执行此操作的一般方法有任何想法吗? Thanks so much. 非常感谢。
What you want is a WebDriver Library. 您想要的是一个WebDriver库。 Unfortunately .net does not have plenty of good ones. 不幸的是,.net没有很多好的。 You can take a look at WatiN
or selenium
您可以看一下WatiN
或selenium
From what I understand watin isn't supported anymore and is not multi-browser compatible. 据我了解,不再支持watin,并且不兼容多浏览器。
Here is an example of what you can do with selenium 这是您可以用硒做什么的一个例子
using (var driver = new ChromeDriver())
{
driver.Navigate().GoToUrl("http://testing-ground.scraping.pro/login");
var userNameField = driver.FindElementById("usr");
var userPasswordField = driver.FindElementById("pwd");
var loginButton = driver.FindElementByXPath("//input[@value='Login']");
userNameField.SendKeys("admin");
userPasswordField.SendKeys("12345");
loginButton.Click();
}
I image you can link your driver to an existing opened browser 我可以将驱动程序链接到现有打开的浏览器,
If you are able to run ruby on the computers I would recommend using Watir
and running the ruby script doing the web manipulation from the c# using processes. 如果您能够在计算机上运行ruby,我建议您使用Watir
并通过使用进程从c#进行Web操作来运行ruby脚本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.