How to get the password in a Web page password box

Source: Internet
Author: User

Objective

I am surfing the internet in my home, often have some BBS password too lazy to remember, use IE's automatic password save function, this is convenient, but there is a trouble, once the machine is not, want to reinstall the operating system, these passwords can not be taken out, but also to reapply, good trouble! So I wrote a tool, You can get the password for the Web page password box.

Because the Web page password box is not a generic edit control, you cannot get a handle to the Web page's password box. To implement this functionality, you have to pass the WebBrowser control's COM interface. So getting these interfaces is the key to the entire program. There are two ways to get the interface of the WebBrowser control. Next we will introduce each one, and provide sample source code for your reference.

Sample program Run effect diagram

The first method: using the scripting language and the IE right mouse menu

We can use the registry to control the IE right click menu. When you install the FlashGet (Internet Express), you will find that the IE right menu more than two items: "Use the Internet Express Download" and "Use the Internet to download all links", and then you open the registry, in Hkey_current_user\ There are two primary keys under the Software\Microsoft\Internet explorer\menuext\. There are two values under these two primary keys, one is the default string value, which specifies that the menu command to open the Url,ie opens it in a hidden window, The external.menuarguments value of this hidden window is set to the current Window object, and the script that the URL dialog page contains is automatically closed. Another name is contexts is a DWORD value, Specifies the circumstances under which this menu item needs to be displayed. See below for specific values.

(0x1 << Context_menu_default) (equal to 0x1)//Show by default

(0x1 << Context_menu_image) (equals 0x2)///Right click on image to display the item

(0x1 << Context_menu_control) (equals 0x4)///Right-click the form element to display the item

(0x1 << context_menu_table) (equals 0x8)//Right click on the table to display the item

(0x1 << Context_menu_textselect) (equals 0x10)///Right click on highlighted text to display the item

(0x1 << Context_menu_anchor) (equal to 0x20)//Right click on the link to display the item

(0x1 << Context_menu_unknown) (equal to 0x40)//Right click on the page to display the item except above

Now we write a script to get the value of the Password box.

Sub GetPassword ()
  Set srcevent = external.menuArguments.event
  set doc=external.menuarguments.document
  Set Ele=doc.elementfrompoint (Srcevent.clientx, Srcevent.clienty)
  If ele.type = "Password" then
		if ele.value= " "Then
			alert (" Password is blank ")
		else
			alert (" Password: "+ele.value) End
		If End-
  if End
sub
called GetPassword ()

Then, under the registry HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\menuext\, create a new primary key, the key is "Get password", and the default value is set to the path of the HTM file. Add another DWORD value under the primary key, a value of 4 indicates that the item is displayed only when you right-click the form element. Close the registry, restart the IE window, click the Password box, the item will appear, click on the item, Pop Up a dialog box, and tell you the password.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.